Skip to content

Commit

Permalink
feat: add check for bsv20 sends to prevent over spend
Browse files Browse the repository at this point in the history
  • Loading branch information
danwag06 committed Mar 13, 2024
1 parent 1703ca6 commit 408420c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/hooks/useOrds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@ export const useOrds = () => {
return a + BigInt(item.amt);
}, 0n);

if (amount > tokenTotalAmt) {
return { error: 'insufficient-funds' };
}

const tokenChangeAmt = tokenTotalAmt - amount;

const tx = new Transaction(1, 0);
Expand Down

0 comments on commit 408420c

Please sign in to comment.