Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit 1ce1a47

Browse files
impelcryptogluneau
andauthored
feat: updated polkadot.js packages version (#50)
* feat: updated polkadot.js packages version * fix: accepts prefix:0 in isValidAddressPolkadotAddress function * update versions for check-deps * latest update of open-web3/dev-config that does not break tests --------- Co-authored-by: Gregory Luneau <gregory.luneau@gmail.com>
1 parent 46ed3ad commit 1ce1a47

16 files changed

Lines changed: 2161 additions & 660 deletions

File tree

‎.123trigger‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
0.1.4
22
0.1.50.1.80.1.80.1.90.1.90.1.90.1.100.1.110.1.110.1.110.1.12
3-
0.1.120.1.130.1.130.1.130.1.130.1.140.1.140.1.150.1.150.1.160.1.160.1.170.1.170.1.170.1.170.1.190.1.190.2.20.2.3
3+
0.1.120.1.130.1.130.1.130.1.130.1.140.1.140.1.150.1.150.1.160.1.160.1.170.1.170.1.170.1.170.1.190.1.190.2.20.2.30.2.4

‎package.json‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"url": "https://github.com/AstarNetwork/astar.js.git"
1313
},
1414
"sideEffects": false,
15-
"version": "0.2.3",
15+
"version": "0.2.4",
1616
"workspaces": [
1717
"packages/*",
1818
"examples/*"
@@ -37,17 +37,17 @@
3737
"@babel/core": "^7.14.3",
3838
"@babel/register": "^7.13.6",
3939
"@babel/runtime": "^7.14.0",
40-
"@open-web3/dev-config": "^0.1.13",
41-
"@open-web3/util": "^1.0.2-0",
42-
"@polkadot/api": "9.14.2",
43-
"@polkadot/api-augment": "9.14.2",
44-
"@polkadot/api-contract": "9.14.2",
45-
"@polkadot/api-derive": "9.14.2",
40+
"@open-web3/dev-config": "^0.1.14",
41+
"@open-web3/util": "^2.0.1",
42+
"@polkadot/api": "10.9.1",
43+
"@polkadot/api-augment": "10.9.1",
44+
"@polkadot/api-contract": "10.9.1",
45+
"@polkadot/api-derive": "10.9.1",
4646
"@polkadot/dev": "^0.67.178",
47-
"@polkadot/rpc-core": "9.14.2",
48-
"@polkadot/typegen": "9.14.2",
49-
"@polkadot/types": "9.14.2",
50-
"@polkadot/types-codec": "9.14.2",
47+
"@polkadot/rpc-core": "10.9.1",
48+
"@polkadot/typegen": "10.9.1",
49+
"@polkadot/types": "10.9.1",
50+
"@polkadot/types-codec": "10.9.1",
5151
"@types/jest": "27.4.0",
5252
"@typescript-eslint/eslint-plugin": "^5.11.0",
5353
"jest": "^27.5.1",

‎packages/api-derive/package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@astar-network/astar-api-derive",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"description": "Astar JS API",
55
"main": "index.js",
66
"author": "Astar Network <info@astar.network>",
@@ -19,9 +19,9 @@
1919
},
2020
"homepage": "https://github.com/AstarNetwork/astar.js",
2121
"dependencies": {
22-
"@astar-network/astar-types": "0.2.3",
22+
"@astar-network/astar-types": "0.2.4",
2323
"@babel/runtime": "^7.10.2",
2424
"@open-web3/orml-types": "^1.0.2-0",
25-
"@polkadot/api-derive": "9.14.2"
25+
"@polkadot/api-derive": "10.9.1"
2626
}
2727
}

‎packages/api/package.json‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@astar-network/astar-api",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"description": "Astar JS API",
55
"main": "index.js",
66
"author": "Astar Network <info@astar.network>",
@@ -19,14 +19,14 @@
1919
},
2020
"homepage": "https://github.com/AstarNetwork/astar.js",
2121
"dependencies": {
22-
"@astar-network/astar-api-derive": "0.2.3",
23-
"@astar-network/astar-types": "0.2.3",
22+
"@astar-network/astar-api-derive": "0.2.4",
23+
"@astar-network/astar-types": "0.2.4",
2424
"@babel/runtime": "^7.10.2",
2525
"@open-web3/orml-api-derive": "^1.0.2-0",
26-
"@polkadot/api": "9.14.2"
26+
"@polkadot/api": "10.9.1"
2727
},
2828
"peerDependencies": {
29-
"@polkadot/api": "9.14.2",
30-
"@polkadot/types": "9.14.2"
29+
"@polkadot/api": "10.9.1",
30+
"@polkadot/types": "10.9.1"
3131
}
3232
}

‎packages/sdk-core/package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@astar-network/astar-sdk-core",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"description": "the core for astar SDK",
55
"main": "index.js",
66
"author": "Astar Network <info@astar.network>",
@@ -23,8 +23,8 @@
2323
},
2424
"dependencies": {
2525
"@ethersproject/bignumber": "^5.6.2",
26-
"@polkadot/util": "^10.3.1",
27-
"@polkadot/util-crypto": "^10.3.1",
26+
"@polkadot/util": "^12.3.2",
27+
"@polkadot/util-crypto": "^12.3.2",
2828
"axios": "^0.24.0",
2929
"bn.js": "^5.2.1",
3030
"ethers": "^5.6.9",

‎packages/sdk-core/src/modules/address/index.spec.ts‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,21 @@ import { isValidAddressPolkadotAddress, checkSumEvmAddress, isValidEvmAddress, b
55
describe('Test functions defined in the address module', () => {
66
it('returns results of the substrate address verification', () => {
77
expect(isValidAddressPolkadotAddress('axodJWpkSi9E5k7SgewYCCnTMZw3y6n79nuLevTCGFt7ADw')).toStrictEqual(true);
8-
expect(isValidAddressPolkadotAddress('axodJWpkSi9E5k7SgewYCCnTMZw3y6n79nuLevTCGFt7ADw', ASTAR_SS58_FORMAT)).toStrictEqual(true);
8+
expect(
9+
isValidAddressPolkadotAddress('axodJWpkSi9E5k7SgewYCCnTMZw3y6n79nuLevTCGFt7ADw', ASTAR_SS58_FORMAT)
10+
).toStrictEqual(true);
911
expect(isValidAddressPolkadotAddress('axodJWpkSi9E5k7SgewYCCnTMZw3y6n79nuLevTCGFt7ADw', 1)).toStrictEqual(false);
12+
expect(isValidAddressPolkadotAddress('axodJWpkSi9E5k7SgewYCCnTMZw3y6n79nuLevTCGFt7ADw', 0)).toStrictEqual(false);
1013
});
1114
it('returns results of the EVM address verification', () => {
12-
expect(checkSumEvmAddress('0x91986602d9c0d8A4f5BFB5F39a7Aa2cD73Db73B7')).toStrictEqual('0x91986602d9c0d8A4f5BFB5F39a7Aa2cD73Db73B7');
15+
expect(checkSumEvmAddress('0x91986602d9c0d8A4f5BFB5F39a7Aa2cD73Db73B7')).toStrictEqual(
16+
'0x91986602d9c0d8A4f5BFB5F39a7Aa2cD73Db73B7'
17+
);
1318
expect(isValidEvmAddress('0x91986602d9c0d8A4f5BFB5F39a7Aa2cD73Db73B7')).toStrictEqual(true);
1419
});
1520
it('returns mapped EVM address', () => {
16-
expect(buildEvmAddress('axodJWpkSi9E5k7SgewYCCnTMZw3y6n79nuLevTCGFt7ADw')).toStrictEqual('0xde53286f1d6c299fb712a3b48239e714ca117b69');
21+
expect(buildEvmAddress('axodJWpkSi9E5k7SgewYCCnTMZw3y6n79nuLevTCGFt7ADw')).toStrictEqual(
22+
'0xde53286f1d6c299fb712a3b48239e714ca117b69'
23+
);
1724
});
1825
});

‎packages/sdk-core/src/modules/address/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ethers } from 'ethers';
55

66
export const isValidAddressPolkadotAddress = (address: string, prefix?: number): boolean => {
77
try {
8-
if (prefix) {
8+
if (prefix || prefix === 0) {
99
return checkAddress(address, prefix)[0];
1010
} else {
1111
encodeAddress(isHex(address) ? hexToU8a(address) : decodeAddress(address));

‎packages/type-definitions/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@astar-network/astar-type-definitions",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"description": "Polkadot.js type definations for astar Network",
55
"main": "index.js",
66
"author": "Astar Network <info@astar.network>",

‎packages/types/package.json‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@astar-network/astar-types",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"description": "Polkadot.js type definations for Astar Network",
55
"main": "index.js",
66
"author": "Astar Network <info@astar.network>",
@@ -19,21 +19,21 @@
1919
},
2020
"homepage": "https://github.com/AstarNetwork/astar.js",
2121
"dependencies": {
22-
"@astar-network/astar-type-definitions": "0.2.3",
22+
"@astar-network/astar-type-definitions": "0.2.4",
2323
"@babel/runtime": "^7.10.2",
2424
"@open-web3/api-mobx": "^1.0.2-0",
2525
"@open-web3/orml-types": "^1.0.2-0",
26-
"@polkadot/api": "9.14.2",
27-
"@polkadot/typegen": "9.14.2",
28-
"@polkadot/types": "9.14.2"
26+
"@polkadot/api": "10.9.1",
27+
"@polkadot/typegen": "10.9.1",
28+
"@polkadot/types": "10.9.1"
2929
},
3030
"devDependencies": {
3131
"@types/websocket": "^1.0.0",
3232
"websocket": "^1.0.31"
3333
},
3434
"peerDependencies": {
35-
"@polkadot/api": "9.14.2",
36-
"@polkadot/typegen": "9.14.2",
37-
"@polkadot/types": "9.14.2"
35+
"@polkadot/api": "10.9.1",
36+
"@polkadot/typegen": "10.9.1",
37+
"@polkadot/types": "10.9.1"
3838
}
3939
}

‎packages/types/src/interfaces/augment-api-rpc.ts‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import type { CreatedBlock } from '@polkadot/types/interfaces/engine';
2222
import type { EthAccount, EthCallRequest, EthFeeHistory, EthFilter, EthFilterChanges, EthLog, EthReceipt, EthRichBlock, EthSubKind, EthSubParams, EthSyncStatus, EthTransaction, EthTransactionRequest, EthWork } from '@polkadot/types/interfaces/eth';
2323
import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
2424
import type { EncodedFinalityProofs, JustificationNotification, ReportedRoundStates } from '@polkadot/types/interfaces/grandpa';
25-
import type { MmrLeafBatchProof, MmrLeafProof } from '@polkadot/types/interfaces/mmr';
25+
import type { MmrHash, MmrLeafBatchProof } from '@polkadot/types/interfaces/mmr';
2626
import type { StorageKind } from '@polkadot/types/interfaces/offchain';
2727
import type { FeeDetails, RuntimeDispatchInfoV1 } from '@polkadot/types/interfaces/payment';
2828
import type { RpcMethods } from '@polkadot/types/interfaces/rpc';
@@ -373,13 +373,21 @@ declare module '@polkadot/rpc-core/types/jsonrpc' {
373373
};
374374
mmr: {
375375
/**
376-
* Generate MMR proof for the given leaf indices.
376+
* Generate MMR proof for the given block numbers.
377377
**/
378-
generateBatchProof: AugmentedRpc<(leafIndices: Vec<u64> | (u64 | AnyNumber | Uint8Array)[], at?: BlockHash | string | Uint8Array) => Observable<MmrLeafProof>>;
378+
generateProof: AugmentedRpc<(blockNumbers: Vec<u64> | (u64 | AnyNumber | Uint8Array)[], bestKnownBlockNumber?: u64 | AnyNumber | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<MmrLeafBatchProof>>;
379379
/**
380-
* Generate MMR proof for given leaf index.
380+
* Get the MMR root hash for the current best block.
381381
**/
382-
generateProof: AugmentedRpc<(leafIndex: u64 | AnyNumber | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<MmrLeafBatchProof>>;
382+
root: AugmentedRpc<(at?: BlockHash | string | Uint8Array) => Observable<MmrHash>>;
383+
/**
384+
* Verify an MMR proof
385+
**/
386+
verifyProof: AugmentedRpc<(proof: MmrLeafBatchProof | { blockHash?: any; leaves?: any; proof?: any } | string | Uint8Array) => Observable<bool>>;
387+
/**
388+
* Verify an MMR proof statelessly given an mmr_root
389+
**/
390+
verifyProofStateless: AugmentedRpc<(root: MmrHash | string | Uint8Array, proof: MmrLeafBatchProof | { blockHash?: any; leaves?: any; proof?: any } | string | Uint8Array) => Observable<bool>>;
383391
};
384392
net: {
385393
/**

0 commit comments

Comments
 (0)