Skip to content

Commit a90cccb

Browse files
refactor(sdk-api): send many uniform error messages changes
Ticket: WIN-3945
1 parent 986e2f1 commit a90cccb

File tree

11 files changed

+31
-10
lines changed

11 files changed

+31
-10
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
/modules/sdk-coin-atom/ @BitGo/ethalt-team
5353
/modules/sdk-coin-avaxc/ @BitGo/ethalt-team
5454
/modules/sdk-coin-avaxp/ @BitGo/ethalt-team
55+
/modules/sdk-coin-bera/ @BitGo/ethalt-team
5556
/modules/sdk-coin-bsc/ @BitGo/ethalt-team
5657
/modules/sdk-coin-coredao/ @BitGo/ethalt-team
5758
/modules/sdk-coin-cspr/ @BitGo/ethalt-team

modules/abstract-eth/src/abstractEthLikeNewCoins.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2281,7 +2281,9 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
22812281
throw new Error(`tx cannot be both a batch and hop transaction`);
22822282
}
22832283
if (txPrebuild.recipients.length !== 1) {
2284-
throw new Error(`txPrebuild should only have 1 recipient but ${txPrebuild.recipients.length} found`);
2284+
throw new Error(
2285+
`${this.getChain()} doesn't support sending to more then 1 destination address within a single transaction. Try again, using only a single recipient.`
2286+
);
22852287
}
22862288
if (txParams.hop && txPrebuild.hopTransaction) {
22872289
// Check recipient amount for hop transaction

modules/abstract-eth/test/unit/coin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,9 @@ export function runTransactionVerificationTests(coinName: string, bitgo: TestBit
348348

349349
await basecoin
350350
.verifyTransaction({ txParams, txPrebuild, wallet, verification })
351-
.should.be.rejectedWith('txPrebuild should only have 1 recipient but 2 found');
351+
.should.be.rejectedWith(
352+
`${basecoin} doesn't support sending to more then 1 destination address within a single transaction. Try again, using only a single recipient.`
353+
);
352354
});
353355

354356
it('should reject a hop txPrebuild that does not send to its hop address', async () => {

modules/sdk-coin-arbeth/test/unit/arbeth.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,9 @@ describe('Arbitrum', function () {
402402

403403
await basecoin
404404
.verifyTransaction({ txParams, txPrebuild, wallet, verification })
405-
.should.be.rejectedWith('txPrebuild should only have 1 recipient but 2 found');
405+
.should.be.rejectedWith(
406+
`tarbeth doesn't support sending to more then 1 destination address within a single transaction. Try again, using only a single recipient.`
407+
);
406408
});
407409

408410
it('should reject a hop txPrebuild that does not send to its hop address', async function () {

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ export class AvaxC extends AbstractEthLikeNewCoins {
171171
throw new Error(`tx cannot be both a batch and hop transaction`);
172172
}
173173
if (txPrebuild.recipients.length !== 1) {
174-
throw new Error(`txPrebuild should only have 1 recipient but ${txPrebuild.recipients.length} found`);
174+
throw new Error(
175+
`${this.getChain()} doesn't support sending to more then 1 destination address within a single transaction. Try again, using only a single recipient.`
176+
);
175177
}
176178
if (txParams.hop && txPrebuild.hopTransaction) {
177179
// Check recipient amount for hop transaction

modules/sdk-coin-avaxc/test/unit/avaxc.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,9 @@ describe('Avalanche C-Chain', function () {
610610

611611
await tavaxCoin
612612
.verifyTransaction({ txParams, txPrebuild, wallet, verification })
613-
.should.be.rejectedWith('txPrebuild should only have 1 recipient but 2 found');
613+
.should.be.rejectedWith(
614+
`tavaxc doesn't support sending to more then 1 destination address within a single transaction. Try again, using only a single recipient.`
615+
);
614616
});
615617

616618
it('should reject a hop txPrebuild that does not send to its hop address', async function () {

modules/sdk-coin-bera/test/unit/bera.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,9 @@ describe('Bera', function () {
302302

303303
await basecoin
304304
.verifyTransaction({ txParams, txPrebuild, wallet, verification })
305-
.should.be.rejectedWith('txPrebuild should only have 1 recipient but 2 found');
305+
.should.be.rejectedWith(
306+
`tbera doesn't support sending to more then 1 destination address within a single transaction. Try again, using only a single recipient.`
307+
);
306308
});
307309

308310
it('should reject a normal txPrebuild from the bitgo server with the wrong amount', async function () {

modules/sdk-coin-eth/test/unit/eth.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,9 @@ describe('ETH:', function () {
411411

412412
await coin
413413
.verifyTransaction({ txParams, txPrebuild: txPrebuild as any, wallet, verification })
414-
.should.be.rejectedWith('txPrebuild should only have 1 recipient but 2 found');
414+
.should.be.rejectedWith(
415+
`teth doesn't support sending to more then 1 destination address within a single transaction. Try again, using only a single recipient.`
416+
);
415417
});
416418

417419
it('should reject a hop txPrebuild that does not send to its hop address', async function () {

modules/sdk-coin-opeth/test/unit/opeth.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,9 @@ describe('Optimism', function () {
398398

399399
await basecoin
400400
.verifyTransaction({ txParams, txPrebuild, wallet, verification })
401-
.should.be.rejectedWith('txPrebuild should only have 1 recipient but 2 found');
401+
.should.be.rejectedWith(
402+
`topeth doesn't support sending to more then 1 destination address within a single transaction. Try again, using only a single recipient.`
403+
);
402404
});
403405

404406
it('should reject a hop txPrebuild that does not send to its hop address', async function () {

modules/sdk-coin-polygon/test/unit/polygon.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,9 @@ describe('Polygon', function () {
387387

388388
await basecoin
389389
.verifyTransaction({ txParams, txPrebuild, wallet, verification })
390-
.should.be.rejectedWith('txPrebuild should only have 1 recipient but 2 found');
390+
.should.be.rejectedWith(
391+
`tpoloygon doesn't support sending to more then 1 destination address within a single transaction. Try again, using only a single recipient.`
392+
);
391393
});
392394

393395
it('should reject a hop txPrebuild that does not send to its hop address', async function () {

0 commit comments

Comments
 (0)