@leapwallet/elements-hooks
v1.7.8
Published
React hooks package for Leap Elements SDK. This has hooks used in `@leapwallet/elements` package.
Downloads
2,487
Readme
Leap Elements Hooks
React hooks package for Leap Elements SDK. This has hooks used in @leapwallet/elements
package.
How to use
Install
npm install @leapwallet/elements-hooks
Import
import { usePollForTxn } from '@leapwallet/elements-hooks'
const TxnStatusToast = ({ txHash, chainId }) => {
// get the rest url for the chain
const restUrl = useChainRestUrl(chainId)
const { tx, isPolling, error } = usePollForTxn(
// transaction hash
txHash,
// rest url to fetch the transaction status
restUrl,
// poll interval in milliseconds
5 * 1000,
// polling timeout in milliseconds
2 * 60 * 100
)
// rest of the component
}