forked from leather-io/extension
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add brc-20 send for non-zero-index taproot addresses, closes le…
- Loading branch information
1 parent
950a28a
commit be93e72
Showing
3 changed files
with
95 additions
and
16 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 |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import { | ||
Brc20Token, | ||
useBrc20TokensByAddressQuery, | ||
useBrc20TokensQuery, | ||
} from '@app/query/bitcoin/ordinals/brc20/brc20-tokens.query'; | ||
import { useCurrentAccountTaprootIndexZeroSigner } from '@app/store/accounts/blockchain/bitcoin/taproot-account.hooks'; | ||
|
||
interface Brc20TokensLoaderProps { | ||
children(brc20Tokens: Brc20Token[]): JSX.Element; | ||
} | ||
export function Brc20TokensLoader({ children }: Brc20TokensLoaderProps) { | ||
const { address: bitcoinAddressTaproot } = useCurrentAccountTaprootIndexZeroSigner(); | ||
const { data: brc20Tokens } = useBrc20TokensByAddressQuery(bitcoinAddressTaproot); | ||
if (!bitcoinAddressTaproot || !brc20Tokens) return null; | ||
const { data: allBrc20TokensResponse } = useBrc20TokensQuery(); | ||
const brc20Tokens = allBrc20TokensResponse?.pages | ||
.flatMap(page => page.brc20Tokens) | ||
.filter(token => token.length > 0) | ||
.flatMap(token => token); | ||
|
||
if (!brc20Tokens) return null; | ||
return children(brc20Tokens); | ||
} |
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