Skip to content

Commit aed9e9f

Browse files
arvind-bgajays97
andcommitted
fix(sdk-coin-dot): handles breaking test cases
TICKET: WIN-7059 Co-authored-by: Ajay Srinivas <[email protected]>
1 parent 2e94080 commit aed9e9f

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

modules/sdk-coin-dot/src/lib/utils.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,14 +255,12 @@ export class Utils implements BaseUtils {
255255
getMaterial(coinConfig: Readonly<CoinConfig>): Material {
256256
const networkConfig = coinConfig.network as DotNetwork;
257257
const { specName, specVersion, chainName, txVersion, genesisHash } = networkConfig;
258-
let metadataRpc = '';
258+
let metadataRpc = mainnetMetadataRpc;
259259

260260
if (specName === 'westend') {
261261
metadataRpc = westendMetadataRpc;
262262
} else if (specName === 'westmint') {
263263
metadataRpc = westendAssetHubMetadataRpc;
264-
} else {
265-
metadataRpc = mainnetMetadataRpc;
266264
}
267265

268266
return {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export const rawTx = {
7777
signed:
7878
'0xcd01840061b18c6dc02ddcabdeac56cb4f21a971cc41cc97640f6f85b073480008c53a0d00aadae7fa1f53e7a5c900b330ff71bee6782cf3c29a2c6f9599162381cd021ad581c74ded89f49ec79adefed64af8ff16649553523dda9cb4f017cbf15681e50ed501210300000050010bfadb9bbae251',
7979
unsigned:
80-
'0x2450010bfadb9bbae251d50121030000009d880f001000000067f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9149799bc9602cb5cf201f3425fb8d253b2d4e61fc119dcab3249f307f594754d00',
80+
'0x2450010bfadb9bbae251d501210300000060900f001000000067f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9149799bc9602cb5cf201f3425fb8d253b2d4e61fc119dcab3249f307f594754d00',
8181
batchAll: {
8282
signed: '',
8383
unsigned:
@@ -127,7 +127,7 @@ export const rawTx = {
127127
signed:
128128
'0xe5028400d472bd6e0f1f92297631938e30edb682208c2cd2698d80cf678c53a69979eb9f00aadae7fa1f53e7a5c900b330ff71bee6782cf3c29a2c6f9599162381cd021ad581c74ded89f49ec79adefed64af8ff16649553523dda9cb4f017cbf15681e50ed50121030000002a000061b18c6dc02ddcabdeac56cb4f21a971cc41cc97640f6f85b073480008c53a0d01000a03009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f02540bfadb9bbae251',
129129
unsigned:
130-
'0x3d012a000061b18c6dc02ddcabdeac56cb4f21a971cc41cc97640f6f85b073480008c53a0d01000a03009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f02540bfadb9bbae251d50121030000009d880f001000000067f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9149799bc9602cb5cf201f3425fb8d253b2d4e61fc119dcab3249f307f594754d00',
130+
'0x3d012a000061b18c6dc02ddcabdeac56cb4f21a971cc41cc97640f6f85b073480008c53a0d01000a03009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f02540bfadb9bbae251d501210300000060900f001000000067f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9149799bc9602cb5cf201f3425fb8d253b2d4e61fc119dcab3249f307f594754d00',
131131
transferCall: '0x0503009f7b0675db59d19b4bd9c8c72eaabba75a9863d02b30115b8b3c3ca5c20f02540bfadb9bbae251',
132132
},
133133
unstake: {

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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('10036500000'); // weird expecting 10036500000 instead of 1002050000000
222+
should(tx.inputs[1].value).eql('10036500000');
223223
should(tx.inputs[1].coin).eql('tdot');
224224

225225
should(tx.outputs).not.be.null();
@@ -232,7 +232,7 @@ 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('10036500000'); // weird expecting 1002050000000 instead of 10036500000
235+
should(tx.outputs[1].value).eql('10036500000');
236236
should(tx.outputs[1].coin).eql('tdot');
237237
});
238238

@@ -250,15 +250,15 @@ 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('10036500000'); // weird expecting 10036500000 instead of 1002050000000
253+
should(tx.inputs[0].value).eql('10036500000');
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('10036500000'); // weird expecting 1002050000000 instead of 10036500000
261+
should(tx.outputs[0].value).eql('10036500000');
262262
should(tx.outputs[0].coin).eql('tdot');
263263
});
264264

modules/sdk-coin-dot/test/unit/transactionBuilder/batchTransactionBuilder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,8 @@ describe('Dot Batch Transaction Builder', () => {
363363
const txJson = tx.toJson();
364364
should.deepEqual(txJson.batchCalls.length, rawTx.stake.batchAll.batch.length);
365365
should.deepEqual(txJson.batchCalls[0].callIndex, rawTx.stake.batchAll.batch[0].slice(0, 6));
366-
// should.deepEqual(txJson.batchCalls[0].args?.value, 500000000000);
367-
// should.deepEqual(txJson.batchCalls[0].args?.payee, { staked: null });
366+
should.deepEqual(txJson.batchCalls[0].args?.value, 500000000000);
367+
should.deepEqual(txJson.batchCalls[0].args?.payee, { staked: null });
368368
should.deepEqual(txJson.batchCalls[1].callIndex, rawTx.stake.batchAll.batch[1].slice(0, 6));
369369
should.deepEqual(txJson.batchCalls[1].args?.delegate, { id: accounts.stakingProxy.address });
370370
should.deepEqual(txJson.batchCalls[1].args?.proxy_type, ProxyType.STAKING);

modules/statics/src/networks.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,6 @@ class WestendAssetHub extends Testnet implements DotNetwork {
527527
explorerUrl = 'https://assethub-westend.subscan.io/extrinsic/';
528528
specName = 'westmint' as PolkadotSpecNameType;
529529
genesisHash = '0x67f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9';
530-
// specVersion = 1018013;
531530
specVersion = 1020000;
532531
chainName = 'Westend Asset Hub';
533532
txVersion = 16;

0 commit comments

Comments
 (0)