Skip to content

sei1x3mu9x764s7ap2zp8rhudkmts9q9jrr3enkv6p

License

Notifications You must be signed in to change notification settings

skyvaky/js-react

 
 

Repository files navigation

@sei-js/react

A set of React hooks for @sei-js/core written in Typescript.

Tutorial

For an in depth tutorial please see our documentation.

Installation

yarn add @sei-js/react

Hooks

Hook Params
useWallet (window: any, config: object)
useQueryClient (rpcAddress: string)
useSigningClient (rpcAddress: string, offlineSigner: any)

useWallet

A hook to connect one of our supported wallets to your application.

Input Props

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' })

Return Values

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

useQueryClient

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

useSigningClient

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

About

sei1x3mu9x764s7ap2zp8rhudkmts9q9jrr3enkv6p

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%