Skip to content

Commit b604b29

Browse files
fix: use max spendable amount to sweep balance
TICKET: COIN-2432
1 parent 27440dd commit b604b29

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

modules/sdk-core/src/bitgo/wallet/wallet.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -938,14 +938,15 @@ export class Wallet implements IWallet {
938938
);
939939
}
940940

941-
const value = this.spendableBalanceString();
942-
if (_.isUndefined(value) || value === '0') {
941+
const value = await this.maximumSpendable();
942+
const maximumSpendable = new BigNumber(value.maximumSpendable).toString();
943+
if (_.isUndefined(value) || maximumSpendable === '0') {
943944
throw new Error('no funds to sweep');
944945
}
945946
(params as any).recipients = [
946947
{
947948
address: params.address,
948-
amount: value,
949+
amount: maximumSpendable,
949950
},
950951
];
951952

0 commit comments

Comments
 (0)