Skip to content

Commit e24ce72

Browse files
authored
fix(sdk-coin-etc): Unsigned sweep error message
2 parents 1fb05df + 6bfb623 commit e24ce72

File tree

1 file changed

+11
-3
lines changed
  • modules/sdk-coin-etc/src

1 file changed

+11
-3
lines changed

modules/sdk-coin-etc/src/etc.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,18 @@ export class Etc extends AbstractEthLikeCoin {
301301
params: [address, 'latest'],
302302
id: 1,
303303
});
304-
// throw if the result does not exist or the result is not a valid number
305-
if (!result || !result.result || isNaN(result.result)) {
306-
throw new Error(`Could not obtain address balance for ${address} from etc.network, got: ${result.result}`);
304+
305+
// throw if the result object does not exist
306+
if (!result) {
307+
throw new Error(`Could not obtain address balance for ${address} from etc.network, got: Empty object response`);
308+
} else if (result.error) {
309+
// throw if result.error exists
310+
throw new Error(`Could not obtain address balance for ${address} from etc.network, got: ${result.error}`);
311+
} else if (!result.result || isNaN(result.result)) {
312+
// throw if the result.result is not a number
313+
throw new Error(`Could not obtain address balance for ${address} from etc.network, got: Incorrect Balance Hex`);
307314
}
315+
308316
const nativeBalanceHex = result.result;
309317
return new optionalDeps.ethUtil.BN(nativeBalanceHex.slice(2), 16);
310318
}

0 commit comments

Comments
 (0)