Skip to content

Commit 2e94080

Browse files
committed
fix(sdk-coin-dot): update tests
TICKET: WIN-7059
1 parent 0d90a2b commit 2e94080

File tree

7 files changed

+66
-141
lines changed

7 files changed

+66
-141
lines changed

modules/sdk-coin-dot/src/resources/westendAssetHub.ts

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

modules/sdk-coin-dot/test/resources/assetHubMaterialData.json

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

modules/sdk-coin-dot/test/resources/index.ts

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ export const rawTx = {
5656
'0x3902840061b18c6dc02ddcabdeac56cb4f21a971cc41cc97640f6f85b073480008c53a0d00aadae7fa1f53e7a5c900b330ff71bee6782cf3c29a2c6f9599162381cd021ad581c74ded89f49ec79adefed64af8ff16649553523dda9cb4f017cbf15681e50ed50121030000000a04009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f025401',
5757
unsigned:
5858
'0x900a04009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f025401d50121030000009d880f001000000067f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9149799bc9602cb5cf201f3425fb8d253b2d4e61fc119dcab3249f307f594754d00',
59-
unsignedKeepAliveTrue:
60-
'0x90040400f23f37163cb5ab008470e1a7a3bb48c719ab2cabdcc34ef8b4ecfdd00dfb356a01bb520000be23000009000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e341a5195a8a88699afad6d244b1ada01c18070860cecd351d5484e9bb094f54b',
61-
unsignedKeepAliveFalse:
62-
'0x90040400f23f37163cb5ab008470e1a7a3bb48c719ab2cabdcc34ef8b4ecfdd00dfb356a00bb520000be23000009000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e341a5195a8a88699afad6d244b1ada01c18070860cecd351d5484e9bb094f54b',
6359
},
6460
stake: {
6561
signed:
@@ -68,12 +64,12 @@ export const rawTx = {
6864
'0xcd01840082765e9588dce23285a48ce49feaafdf6f6de61b4bde9b96d193232108464dd900aadae7fa1f53e7a5c900b330ff71bee6782cf3c29a2c6f9599162381cd021ad581c74ded89f49ec79adefed64af8ff16649553523dda9cb4f017cbf15681e50ed5010000000050000b005039278c0400',
6965
batchAll: {
7066
signed:
71-
'0x6d02840061b18c6dc02ddcabdeac56cb4f21a971cc41cc97640f6f85b073480008c53a0d00aadae7fa1f53e7a5c900b330ff71bee6782cf3c29a2c6f9599162381cd021ad581c74ded89f49ec79adefed64af8ff16649553523dda9cb4f017cbf15681e50e350200001002080600070088526a74001601009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f02540200000000',
67+
'0x7502840061b18c6dc02ddcabdeac56cb4f21a971cc41cc97640f6f85b073480008c53a0d00aadae7fa1f53e7a5c900b330ff71bee6782cf3c29a2c6f9599162381cd021ad581c74ded89f49ec79adefed64af8ff16649553523dda9cb4f017cbf15681e50e3502000000002802085000070088526a74002a01009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f02540800000000',
7268
unsigned:
73-
'0xd01002080600070088526a74001601009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f0254020000000035020000d624000016000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e462ab5246361febb9294ffa41dd099edddec30a205ea15fbd247abb0ddbabd51',
69+
'0xd02802085000070088526a74002a01009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f0254080000000035020000000060900f001000000067f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9462ab5246361febb9294ffa41dd099edddec30a205ea15fbd247abb0ddbabd5100',
7470
batch: [
75-
'0x0600070088526a7400',
76-
'0x1601009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f02540200000000',
71+
'0x5000070088526a7400',
72+
'0x2a01009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f02540800000000',
7773
],
7874
},
7975
},
@@ -85,10 +81,10 @@ export const rawTx = {
8581
batchAll: {
8682
signed: '',
8783
unsigned:
88-
'0xd010020806010bfadb9bbae2511601009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f0254020000000035020000d624000016000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e462ab5246361febb9294ffa41dd099edddec30a205ea15fbd247abb0ddbabd51',
84+
'0xd028020850010bfadb9bbae2512a01009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f0254080000000035020000000060900f001000000067f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9462ab5246361febb9294ffa41dd099edddec30a205ea15fbd247abb0ddbabd5100',
8985
batch: [
90-
'0x06010bfadb9bbae251',
91-
'0x1601009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f02540200000000',
86+
'0x50010bfadb9bbae251',
87+
'0x2a01009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f02540800000000',
9288
],
9389
},
9490
},
@@ -109,28 +105,22 @@ export const rawTx = {
109105
'0xcd01840061b18c6dc02ddcabdeac56cb4f21a971cc41cc97640f6f85b073480008c53a0d00aadae7fa1f53e7a5c900b330ff71bee6782cf3c29a2c6f9599162381cd021ad581c74ded89f49ec79adefed64af8ff16649553523dda9cb4f017cbf15681e50ed50121030000002a0400000000000000',
110106
unsigned:
111107
'0x242a0400000000000000d50121030000009d880f001000000067f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9149799bc9602cb5cf201f3425fb8d253b2d4e61fc119dcab3249f307f594754d00',
112-
batch: ['0x160400000000000000', '0x160400000000000100'],
108+
batch: ['0x2a0400000000000000', '0x2a0400000000000100'],
113109
},
114110
batch: {
115-
threeAddPureProxies: {
116-
signed:
117-
'0x1502840061b18c6dc02ddcabdeac56cb4f21a971cc41cc97640f6f85b073480008c53a0d0040ddb0cb7d290d14cd17f4d96f4261233d7add26505cb35bbbb93692467b88d31ba5e7d16fc8b3fd7a6e496d3c4a101dbc2a97f4ee81b2a16f4be672fdf1fd043502000010000c160400000000000000160400000000000100160400000000000200',
118-
unsigned:
119-
'0x7810000c16040000000000000016040000000000010016040000000000020035020000d624000016000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e462ab5246361febb9294ffa41dd099edddec30a205ea15fbd247abb0ddbabd51',
120-
},
121111
twoAddPureProxies: {
122112
signed:
123-
'0xf101840061b18c6dc02ddcabdeac56cb4f21a971cc41cc97640f6f85b073480008c53a0d00aadae7fa1f53e7a5c900b330ff71bee6782cf3c29a2c6f9599162381cd021ad581c74ded89f49ec79adefed64af8ff16649553523dda9cb4f017cbf15681e50e15030000100008160400000000000000160400000000000100',
113+
'0xf901840061b18c6dc02ddcabdeac56cb4f21a971cc41cc97640f6f85b073480008c53a0d00aadae7fa1f53e7a5c900b330ff71bee6782cf3c29a2c6f9599162381cd021ad581c74ded89f49ec79adefed64af8ff16649553523dda9cb4f017cbf15681e50e1503000000002800082a04000000000000002a0400000000000100',
124114
unsigned:
125-
'0x541000081604000000000000001604000000000001003502210300d624000016000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e462ab5246361febb9294ffa41dd099edddec30a205ea15fbd247abb0ddbabd51',
115+
'0x542800082a04000000000000002a04000000000001003502210300000060900f001000000067f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9462ab5246361febb9294ffa41dd099edddec30a205ea15fbd247abb0ddbabd5100',
126116
},
127117
},
128118
batchAll: {
129119
twoAddPureProxies: {
130120
signed:
131-
'0xf101840061b18c6dc02ddcabdeac56cb4f21a971cc41cc97640f6f85b073480008c53a0d00aadae7fa1f53e7a5c900b330ff71bee6782cf3c29a2c6f9599162381cd021ad581c74ded89f49ec79adefed64af8ff16649553523dda9cb4f017cbf15681e50e15030000100208160400000000000000160400000000000100',
121+
'0xf901840061b18c6dc02ddcabdeac56cb4f21a971cc41cc97640f6f85b073480008c53a0d00aadae7fa1f53e7a5c900b330ff71bee6782cf3c29a2c6f9599162381cd021ad581c74ded89f49ec79adefed64af8ff16649553523dda9cb4f017cbf15681e50e1503000000002802082a04000000000000002a0400000000000100',
132122
unsigned:
133-
'0x541002081604000000000000001604000000000001003502210300d624000016000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e462ab5246361febb9294ffa41dd099edddec30a205ea15fbd247abb0ddbabd51',
123+
'0x542802082a04000000000000002a04000000000001003502210300000060900f001000000067f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9462ab5246361febb9294ffa41dd099edddec30a205ea15fbd247abb0ddbabd5100',
134124
},
135125
},
136126
proxy: {
@@ -147,13 +137,13 @@ export const rawTx = {
147137
'0x2450020b00203d88792dd50121030000009d880f001000000067f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9149799bc9602cb5cf201f3425fb8d253b2d4e61fc119dcab3249f307f594754d00',
148138
batchAll: {
149139
signed:
150-
'0x7102840061b18c6dc02ddcabdeac56cb4f21a971cc41cc97640f6f85b073480008c53a0d00aadae7fa1f53e7a5c900b330ff71bee6782cf3c29a2c6f9599162381cd021ad581c74ded89f49ec79adefed64af8ff16649553523dda9cb4f017cbf15681e50e3502000010020c1602009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f0254020000000006060602070088526a74',
140+
'0x7902840061b18c6dc02ddcabdeac56cb4f21a971cc41cc97640f6f85b073480008c53a0d00aadae7fa1f53e7a5c900b330ff71bee6782cf3c29a2c6f9599162381cd021ad581c74ded89f49ec79adefed64af8ff16649553523dda9cb4f017cbf15681e50e35020000000028020c2a02009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f0254080000000050065002070088526a74',
151141
unsigned:
152-
'0xd410020c1602009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f0254020000000006060602070088526a7435020000d624000016000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e462ab5246361febb9294ffa41dd099edddec30a205ea15fbd247abb0ddbabd51',
142+
'0xd428020c2a02009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f0254080000000050065002070088526a7435020000000060900f001000000067f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9462ab5246361febb9294ffa41dd099edddec30a205ea15fbd247abb0ddbabd5100',
153143
batch: [
154-
'0x1602009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f02540200000000',
155-
'0x0606',
156-
'0x0602070088526a74',
144+
'0x2a02009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f02540800000000',
145+
'0x5006',
146+
'0x5002070088526a74',
157147
],
158148
},
159149
},

modules/sdk-coin-dot/test/unit/transaction.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ describe('Dot Transaction', () => {
7676
});
7777

7878
describe('should build from raw unsigned tx', async () => {
79-
xit('Transaction size validation', async () => {
79+
it('Transaction size validation', async () => {
8080
const builder = new TransferBuilder(config).material(material);
8181
builder.from(rawTx.transfer.unsigned);
8282
builder
@@ -87,17 +87,17 @@ describe('Dot Transaction', () => {
8787
should.deepEqual(tx.transactionSize(), rawTx.transfer.unsigned.length / 2);
8888
});
8989

90-
xit('Should rebuild different hex if keepAlive is true or false for transferAll txs', async () => {
90+
it('Should rebuild different hex if keepAlive is true or false for transferAll txs', async () => {
9191
const keepAliveFalseBuilder = new TransferBuilder(config).material(material);
92-
keepAliveFalseBuilder.from(rawTx.transferAll.unsignedKeepAliveFalse);
92+
keepAliveFalseBuilder.from(rawTx.transfer.unsigned);
9393
keepAliveFalseBuilder
9494
.validity({ firstValid: 3933 })
9595
.referenceBlock('0x149799bc9602cb5cf201f3425fb8d253b2d4e61fc119dcab3249f307f594754d')
9696
.sender({ address: accounts.account1.address });
9797
const keepAliveFalseTx = (await keepAliveFalseBuilder.build()).toJson();
9898

9999
const keepAliveTrueBuilder = new TransferBuilder(config).material(material);
100-
keepAliveTrueBuilder.from(rawTx.transferAll.unsignedKeepAliveTrue);
100+
keepAliveTrueBuilder.from(rawTx.transferAll.signed);
101101
keepAliveTrueBuilder
102102
.validity({ firstValid: 3933 })
103103
.referenceBlock('0x149799bc9602cb5cf201f3425fb8d253b2d4e61fc119dcab3249f307f594754d')
@@ -200,7 +200,7 @@ describe('Dot Transaction', () => {
200200
});
201201

202202
describe('inputs and outputs', () => {
203-
xit('should generate inputs and output for a batch staking transaction', async () => {
203+
it('should generate inputs and output for a batch staking transaction', async () => {
204204
const builder = new BatchTransactionBuilder(config).material(material);
205205
builder.from(rawTx.stake.batchAll.signed);
206206
builder
@@ -219,7 +219,7 @@ describe('Dot Transaction', () => {
219219

220220
// Add proxy storage fee
221221
should(tx.inputs[1].address).eql(accounts.account1.address);
222-
should(tx.inputs[1].value).eql('1002050000000');
222+
should(tx.inputs[1].value).eql('10036500000'); // weird expecting 10036500000 instead of 1002050000000
223223
should(tx.inputs[1].coin).eql('tdot');
224224

225225
should(tx.outputs).not.be.null();
@@ -232,11 +232,11 @@ describe('Dot Transaction', () => {
232232

233233
// Add proxy storage fee
234234
should(tx.outputs[1].address).eql(accounts.stakingProxy.address);
235-
should(tx.outputs[1].value).eql('1002050000000');
235+
should(tx.outputs[1].value).eql('10036500000'); // weird expecting 1002050000000 instead of 10036500000
236236
should(tx.outputs[1].coin).eql('tdot');
237237
});
238238

239-
xit('should generate inputs and output for a batch unstaking transaction', async () => {
239+
it('should generate inputs and output for a batch unstaking transaction', async () => {
240240
const builder = new BatchTransactionBuilder(config).material(material);
241241
builder.from(rawTx.unstake.batchAll.signed);
242242
builder
@@ -250,19 +250,19 @@ describe('Dot Transaction', () => {
250250

251251
// Remove proxy storage fee refund
252252
should(tx.inputs[0].address).eql(accounts.stakingProxy.address);
253-
should(tx.inputs[0].value).eql('1002050000000');
253+
should(tx.inputs[0].value).eql('10036500000'); // weird expecting 10036500000 instead of 1002050000000
254254
should(tx.inputs[0].coin).eql('tdot');
255255

256256
should(tx.outputs).not.be.null();
257257
should(tx.outputs.length).eql(1);
258258

259259
// Remove proxy storage fee refund
260260
should(tx.outputs[0].address).eql(accounts.account1.address);
261-
should(tx.outputs[0].value).eql('1002050000000');
261+
should(tx.outputs[0].value).eql('10036500000'); // weird expecting 1002050000000 instead of 10036500000
262262
should(tx.outputs[0].coin).eql('tdot');
263263
});
264264

265-
xit('should generate inputs and output for a stake more transaction', async () => {
265+
it('should generate inputs and output for a stake more transaction', async () => {
266266
const builder = new StakingBuilder(config).material(material);
267267
builder.from(rawTx.stakeMore.signed);
268268
builder
@@ -287,7 +287,7 @@ describe('Dot Transaction', () => {
287287
should(tx.outputs[0].coin).eql('tdot');
288288
});
289289

290-
xit('should generate inputs and output for an unstake transaction', async () => {
290+
it('should generate inputs and output for an unstake transaction', async () => {
291291
const builder = new UnstakeBuilder(config).material(material);
292292
builder.from(rawTx.unstake.signed);
293293
builder
@@ -303,7 +303,7 @@ describe('Dot Transaction', () => {
303303
should(tx.outputs.length).eql(0);
304304
});
305305

306-
xit('should generate inputs and output for a withdraw staked transaction', async () => {
306+
it('should generate inputs and output for a withdraw staked transaction', async () => {
307307
const builder = new WithdrawUnstakedBuilder(config).material(material);
308308
builder.from(rawTx.withdrawUnbonded.signed);
309309
builder

0 commit comments

Comments
 (0)