Skip to content

Commit dce165e

Browse files
committed
test: add test case wallet v6
ticket: WIN-5700
1 parent 596e192 commit dce165e

File tree

1 file changed

+65
-2
lines changed
  • modules/sdk-coin-eth/test/unit

1 file changed

+65
-2
lines changed

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

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ describe('ETH:', function () {
10661066
basecoin = bitgo.coin('hteth') as Hteth;
10671067
});
10681068

1069-
it('should generate an unsigned consolidation', async function () {
1069+
it('should generate an unsigned consolidation for wallet v5', async function () {
10701070
nock(baseUrl)
10711071
.get('/api')
10721072
.query(mockData.getTxListRequest(mockData.getBuildUnsignedSweepForSelfCustodyColdWalletsMPCv2().address))
@@ -1091,7 +1091,6 @@ describe('ETH:', function () {
10911091

10921092
const params = mockData.getBuildUnsignedSweepForSelfCustodyColdWalletsMPCv2();
10931093
const consolidationResult = await (basecoin as AbstractEthLikeNewCoins).recoverConsolidations({
1094-
userKey: params.commonKeyChain, // Box A Data
10951094
backupKey: params.commonKeyChain, // Box B Data
10961095
derivationSeed: params.derivationSeed, // Key Derivation Seed (optional)
10971096
recoveryDestination: params.recoveryDestination, // Destination Address
@@ -1131,6 +1130,70 @@ describe('ETH:', function () {
11311130
);
11321131
});
11331132

1133+
it('should generate an unsigned consolidation for wallet v6', async function () {
1134+
nock(baseUrl)
1135+
.get('/api')
1136+
.query(mockData.getTxListRequest(mockData.getBuildUnsignedSweepForSelfCustodyColdWalletsMPCv2().address))
1137+
.times(2)
1138+
.reply(200, mockData.getTxListResponse);
1139+
1140+
nock(baseUrl)
1141+
.get('/api')
1142+
.query(mockData.getBalanceRequest(mockData.getBuildUnsignedSweepForSelfCustodyColdWalletsMPCv2().address))
1143+
.times(2)
1144+
.reply(200, mockData.getBalanceResponse);
1145+
nock(baseUrl)
1146+
.get('/api')
1147+
.query(
1148+
mockData.getBalanceRequest(
1149+
mockData.getBuildUnsignedSweepForSelfCustodyColdWalletsMPCv2().walletContractAddress
1150+
)
1151+
)
1152+
.reply(200, mockData.getBalanceResponse);
1153+
1154+
nock(baseUrl).get('/api').query(mockData.getContractCallRequest).reply(200, mockData.getContractCallResponse);
1155+
1156+
const params = mockData.getBuildUnsignedSweepForSelfCustodyColdWalletsMPCv2();
1157+
const consolidationResult = await (basecoin as AbstractEthLikeNewCoins).recoverConsolidations({
1158+
userKey: params.commonKeyChain, // Box A Data
1159+
backupKey: params.commonKeyChain, // Box B Data
1160+
derivationSeed: params.derivationSeed, // Key Derivation Seed (optional)
1161+
recoveryDestination: params.recoveryDestination, // Destination Address
1162+
gasLimit: 200000, // Gas Limit
1163+
eip1559: { maxFeePerGas: 20000000000, maxPriorityFeePerGas: 10000000000 }, // Max Fee Per Gas and Max Priority Fee Per Gas
1164+
isTss: true,
1165+
replayProtectionOptions: {
1166+
chain: '42',
1167+
hardfork: 'london',
1168+
},
1169+
bitgoFeeAddress: '0x33a42faea3c6e87021347e51700b48aaf49aa1e7',
1170+
startingScanIndex: 1,
1171+
endingScanIndex: 2,
1172+
});
1173+
should.exist(consolidationResult);
1174+
const unsignedBuilConsolidation = consolidationResult as UnsignedBuilConsolidation;
1175+
unsignedBuilConsolidation.should.have.property('transactions');
1176+
unsignedBuilConsolidation.transactions.should.have.length(2);
1177+
1178+
const output = unsignedBuilConsolidation.transactions[0] as MPCSweepTxs;
1179+
output.should.have.property('txRequests');
1180+
output.txRequests[0].should.have.property('transactions');
1181+
output.txRequests[0].transactions.should.have.length(1);
1182+
output.txRequests[0].should.have.property('walletCoin');
1183+
output.txRequests[0].transactions.should.have.length(1);
1184+
output.txRequests[0].transactions[0].should.have.property('unsignedTx');
1185+
output.txRequests[0].transactions[0].unsignedTx.should.have.property('serializedTxHex');
1186+
output.txRequests[0].transactions[0].unsignedTx.should.have.property('signableHex');
1187+
output.txRequests[0].transactions[0].unsignedTx.should.have.property('derivationPath');
1188+
output.txRequests[0].transactions[0].unsignedTx.should.have.property('feeInfo');
1189+
output.txRequests[0].transactions[0].unsignedTx.should.have.property('parsedTx');
1190+
const parsedTx = output.txRequests[0].transactions[0].unsignedTx.parsedTx as { spendAmount: string };
1191+
parsedTx.should.have.property('spendAmount');
1192+
(output.txRequests[0].transactions[0].unsignedTx.parsedTx as { outputs: any[] }).should.have.property(
1193+
'outputs'
1194+
);
1195+
});
1196+
11341197
it('should throw an error for invalid address', async function () {
11351198
const params = mockData.getBuildUnsignedSweepForSelfCustodyColdWalletsMPCv2();
11361199
params.recoveryDestination = 'invalidAddress';

0 commit comments

Comments
 (0)