A set of React hooks for @sei-js/core written in Typescript.
For an in depth tutorial please see our documentation.
yarn add @sei-js/react
Hook | Params |
---|---|
useWallet | (window: any, config: object) |
useQueryClient | (rpcAddress: string) |
useSigningClient | (rpcAddress: string, offlineSigner: any) |
A hook to connect one of our supported wallets to your application.
Hook | Params |
---|---|
window | The client side window object which has access to wallet providers injected code. |
walletOptions | UseWalletOptions |
import { useWallet } from '@sei-js/react';
const { offlineSigner } = useWallet(window, { inputWallet: "leap", autoconnect: true, chainConfiguration: 'testnet' })
Property | Type | Description |
---|---|---|
connectedWallet | string? | The currently connected wallet |
connect | () => Promise | Async function to connect to input wallet |
disconnect | () => void | Function to disconnect from input wallet |
supportedWallets | string[] | List of supported wallets |
installedWallets | string[] | List of wallets installed |
error | string? | Error message |
chainId | string | Sei chain id |
restUrl | string | The rest url associated with the connected wallet |
rpcUrl | string | The rpc url associated with the connected wallet |
offlineSigner | object? | The offline signer associated with the connected wallet |
accounts | object[]? | The accounts associated with the connected wallet |
import { useQueryClient } from '@sei-js/react';
const { queryClient, isLoading } = useQueryCleint("rest_url")
Property | Type | Description |
---|---|---|
queryClient | StargateSigningClient? | A stargate signing client. |
isLoading | boolean | Boolean value for when the initial loading is happening |
import { useWallet, useSigningClient } from '@sei-js/react';
const { offlineSigner } = useWallet(window, { inputWallet: "keplr", autoconnect: true, chainConfiguration: 'testnet' })
const { signingClient, isLoading } = useSigningClient("rpc_address", offlineSigner)
Property | Type | Description |
---|---|---|
signingClient | StargateSigningClient? | A stargate signing client. |
isLoading | boolean | Boolean value for when the initial loading is happening |