Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useTxHistory #3

Closed
talentlessguy opened this issue Aug 18, 2021 · 1 comment
Closed

useTxHistory #3

talentlessguy opened this issue Aug 18, 2021 · 1 comment

Comments

@talentlessguy
Copy link
Contributor

talentlessguy commented Aug 18, 2021

Related: #2

Description

A React hook to fetch the most recent transaction history using event logs. Optionally you can pass your own tx history fetcher function that must return the same looking array of txes.

In the core, it will use useWeb3React to get the user address and web3 provider instance.

Example

import { Tx } from '@rainbowkit/ui'
import { useTxHistory } from '@rainbowkit/util'

const App = () => {
 const { txes, loading, error } = useTxHistory({ txFetcher: () => [/* Transaction objects */] )

 if (loading) return <h1>Loading...</h1>

 if (error) return <h1 style={{ color: 'red' }}>ERROR!!!</h1>

 return <>{txes.map(tx => <Tx {...tx } />}</>
}
@talentlessguy
Copy link
Contributor Author

closed via 5da023d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant