0.2.2 • Published 3 years ago

@knownout/evm-wallet-controller v0.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years 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

3 years ago

0.1.39

3 years ago

0.1.38

3 years ago

0.1.37

3 years ago

0.1.36

3 years ago

0.1.35

3 years ago

0.1.34

3 years ago

0.1.33

3 years ago

0.1.32

3 years ago

0.1.31

3 years ago

0.1.30

3 years ago

0.1.29

3 years ago

0.1.28

3 years ago

0.1.27

3 years ago

0.1.26

3 years ago

0.1.25

3 years ago

0.1.24

3 years ago

0.1.22

3 years ago

0.1.21

3 years ago

0.1.20

3 years ago

0.1.19

3 years ago

0.1.18

3 years ago

0.1.17

3 years ago

0.1.16

3 years ago

0.1.15

3 years ago

0.1.14

3 years ago

0.1.13

3 years ago

0.1.12

3 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago