react-sui-wallets
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

React Sui wallets

React library to make interaction with Sui wallets easy

Wallets supported:

  • Sui

Installation

npm install react-sui-wallets

Api

WalletProvider

props:

  • wallets: WalletType[] - wallets that app will support

Example

  import { WalletProvider, WalletType } from 'react-sui-wallets';

  export const App = () => (
    <WalletProvider
      wallets={[WalletType.Sui]}
    >
      // other components...
    </WalletProvider>
  );

useWallet()

returns:

  • connect: (walletType: WalletType) => void - tries connect to provided wallet
  • signAndSubmitTransaction: (tx: MoveCallTransaction): Promise<TransactionResponse> - submits provided transaction
  • isConnected: () => boolean
  • accounts: SuiAddress[]

example:

  import { useWallet, WalletType } from 'react-sui-wallets';

  export const App = () => {
    const { isConnected, connect, accounts } = useWallet();

    return (
      <div>
        {isConnected()
          ? accounts[0]
          : <button onClick={() => connect(WalletType.Sui)}>Connect wallet</button>}
      </div>
    );
  }

Dependencies (3)

Dev Dependencies (8)

Package Sidebar

Install

npm i react-sui-wallets

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

36 kB

Total Files

39

Last publish

Collaborators

  • susp3nce