Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion modules/sdk-coin-sui/src/sui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,11 @@ export class Sui extends BaseCoin {
availableBalance = new BigNumber(balanceInfo.totalBalance);
fundsInAddressBalance = new BigNumber(balanceInfo.fundsInAddressBalance);
} catch (e) {
continue;
throw new Error(
`Failed to query Sui balance for address ${senderAddress} at index ${idx} via ${this.getPublicNodeUrl()}: ${
(e as Error).message
}`
);
}
if (availableBalance.minus(MAX_GAS_BUDGET).toNumber() <= 0) {
continue;
Expand Down
19 changes: 19 additions & 0 deletions modules/sdk-coin-sui/test/unit/sui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3018,6 +3018,25 @@ describe('SUI:', function () {

sandBox.assert.callCount(basecoin.getBalance, 10);
});

it('should surface RPC errors from getBalance instead of reporting no funds', async function () {
const callBack = sandBox.stub(Sui.prototype, 'getBalance' as keyof Sui);
callBack.rejects(new Error('Method not found'));

await basecoin
.recover({
userKey: keys.userKey,
backupKey: keys.backupKey,
bitgoKey: keys.bitgoKey,
recoveryDestination,
walletPassphrase,
startingScanIndex: '0',
scan: 1,
})
.should.be.rejectedWith(/Failed to query Sui balance.*Method not found/);

sandBox.assert.callCount(basecoin.getBalance, 1);
});
});

describe('Consolidation Transaction Failures:', () => {
Expand Down
4 changes: 2 additions & 2 deletions modules/sdk-core/src/bitgo/environments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ const mainnetBase: EnvironmentTemplate = {
},
hmacVerificationEnforced: true,
tonNodeUrl: 'https://toncenter.com/api/v2/jsonRPC',
suiNodeUrl: 'https://fullnode.mainnet.sui.io',
suiNodeUrl: 'https://sui-rpc.publicnode.com',
iotaNodeUrl: 'https://api.mainnet.iota.cafe',
etcNodeUrl: 'https://etc.blockscout.com',
coredaoExplorerBaseUrl: 'https://openapi.coredao.org',
Expand Down Expand Up @@ -449,7 +449,7 @@ const testnetBase: EnvironmentTemplate = {
},
hmacVerificationEnforced: false,
tonNodeUrl: 'https://testnet.toncenter.com/api/v2/jsonRPC',
suiNodeUrl: 'https://fullnode.testnet.sui.io',
suiNodeUrl: 'https://sui-testnet-rpc.publicnode.com',
iotaNodeUrl: 'https://api.testnet.iota.cafe',
etcNodeUrl: 'https://etc-mordor.blockscout.com',
coredaoExplorerBaseUrl: 'https://api.test2.btcs.network',
Expand Down
Loading