Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into @mago/enhanced-provider
- Loading branch information
Showing
7 changed files
with
122 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
"@rainbow-me/rainbowkit": patch | ||
--- | ||
|
||
Added real-time balance fetching based on the [Recent Transaction](https://www.rainbowkit.com/docs/recent-transactions) API. As a transaction is confirmed on-chain, the user's gas balance will be updated to reflect the transaction. | ||
|
||
```tsx | ||
import { useAddRecentTransaction } from '@rainbow-me/rainbowkit'; | ||
|
||
export default () => { | ||
const addRecentTransaction = useAddRecentTransaction(); | ||
|
||
return ( | ||
<button | ||
onClick={() => { | ||
addRecentTransaction({ | ||
hash: '0x...', | ||
description: '...', | ||
}); | ||
}} | ||
> | ||
Add recent transaction | ||
</button> | ||
); | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Address } from 'viem'; | ||
import { useBalance } from 'wagmi'; | ||
import { useMainnetEnsAvatar } from './useMainnetEnsAvatar'; | ||
import { useMainnetEnsName } from './useMainnetEnsName'; | ||
|
||
interface UseProfileParameters { | ||
address?: Address; | ||
includeBalance?: boolean; | ||
} | ||
|
||
export function useProfile({ address, includeBalance }: UseProfileParameters) { | ||
const ensName = useMainnetEnsName(address); | ||
const ensAvatar = useMainnetEnsAvatar(ensName); | ||
const { data: balance } = useBalance({ | ||
address: includeBalance ? address : undefined, | ||
}); | ||
|
||
return { ensName, ensAvatar, balance }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters