0.2.2 • Published 1 year ago

@knownout/evm-wallet-controller v0.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

💷 EVM wallet controller

EVM wallet controller that allows to connect different EVM wallets to decentralized application and get basic data and providers.

Before using controller, you need to initialize it:

import evmWallet from "@knownout/evm-wallet-controller"

function App () {
    useEffect(() => {
        // Since the initialization should only be done
        // once, we do it inside the effect.
        // In this case controller will use predefined list of networks
        evmWallet.initController("web3-connect");

        // If you want use your own list of available networks, 
        // call setNetworksList method after init:
        evmWallet.setNetworksList(myNetworksList);
    }, []);

    return (
        <div>
            { /* ... */ }
        </div>
    );
}

To connect or disconnect the wallet, you can call the callWalletAction method:

function App () {
    return (
        <button
            onClick={ () => evmWallet.callWalletAction() }
            disabled={ evmWallet.state.loading }
        >
            {
                evmWallet.state.loading
                    ? "Loading"
                    : evmWallet.state.connected
                        ? "Disconnect wallet"
                        : "Connect wallet"
            }
        </button>
    )
}

To get a core currency symbol and balance, use following methods:

evmWallet.state.balance.toFixed() // Formatted core currency balance as string

evmWallet.nativeTokenSymbol // Getter

knownout - https://github.com/knownout/ knownout@hotmail.com

0.2.2

1 year ago

0.1.39

2 years ago

0.1.38

2 years ago

0.1.37

2 years ago

0.1.36

2 years ago

0.1.35

2 years ago

0.1.34

2 years ago

0.1.33

2 years ago

0.1.32

2 years ago

0.1.31

2 years ago

0.1.30

2 years ago

0.1.29

2 years ago

0.1.28

2 years ago

0.1.27

2 years ago

0.1.26

2 years ago

0.1.25

2 years ago

0.1.24

2 years ago

0.1.22

2 years ago

0.1.21

2 years ago

0.1.20

2 years ago

0.1.19

2 years ago

0.1.18

2 years ago

0.1.17

2 years ago

0.1.16

2 years ago

0.1.15

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago