Skip to content

Commit

Permalink
chore: expose token metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirvolek committed Jun 10, 2024
1 parent 24b2412 commit 90ca5f6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/utils/asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ export const transformAsset = (
};
};

export const getAssetBalance = (
asset: string,
sent: Responses['account_addresses_total']['sent_sum'],
received: Responses['account_addresses_total']['received_sum'],
) => {
const receivedAsset = received.find(r => r.unit === asset)?.quantity ?? '0';
const sentAsset = sent.find(r => r.unit === asset)?.quantity ?? '0';

return new BigNumber(receivedAsset).minus(sentAsset);
};

export const sumAssetBalances = (list: { amount: Pick<AssetBalance, 'quantity' | 'unit'>[] }[]) => {
const balances: Pick<AssetBalance, 'quantity' | 'unit'>[] = [];

Expand Down

0 comments on commit 90ca5f6

Please sign in to comment.