Skip to content

Commit

Permalink
feat: track runes balance after transfer (#263)
Browse files Browse the repository at this point in the history
* feat: track runes balance after transfer

* chore: avoid calling fiat rates when balances is empty

* chore: update core version
  • Loading branch information
fedeerbes committed May 17, 2024
1 parent a941037 commit 48b11ca
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@playwright/test": "^1.43.1",
"@react-spring/web": "^9.6.1",
"@scure/btc-signer": "1.2.1",
"@secretkeylabs/xverse-core": "13.6.7-60156af",
"@secretkeylabs/xverse-core": "13.6.7-517e5bf",
"@stacks/connect": "7.4.1",
"@stacks/stacks-blockchain-api-types": "6.1.1",
"@stacks/transactions": "6.13.1",
Expand Down
9 changes: 7 additions & 2 deletions src/app/hooks/queries/runes/useGetRuneFungibleTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ import BigNumber from 'bignumber.js';

export const fetchRuneBalances =
(
runesApi,
runesApi: ReturnType<typeof useRunesApi>,
network: NetworkType,
ordinalsAddress: string,
fiatCurrency: string,
): (() => Promise<FungibleToken[]>) =>
async () => {
const runeBalances = await runesApi.getRuneFungibleTokens(ordinalsAddress);
const runeBalances = await runesApi.getRuneFungibleTokens(ordinalsAddress, true);

if (!Array.isArray(runeBalances) || runeBalances.length === 0) {
return [];
}

const runeNames = runeBalances.map((runeBalanceFt: FungibleToken) => runeBalanceFt.name);
return getXverseApiClient(network)
.getRuneFiatRates(runeNames, fiatCurrency)
Expand Down

0 comments on commit 48b11ca

Please sign in to comment.