@dedot/cli 0.18.3 → 0.18.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,9 +2,8 @@ import { rpc } from '@polkadot/types-support/metadata/static-substrate';
|
|
|
2
2
|
import staticSubstrate from '@polkadot/types-support/metadata/v15/substrate-hex';
|
|
3
3
|
import { ConstantExecutor } from '@dedot/api';
|
|
4
4
|
import { $Metadata, PortableRegistry, unwrapOpaqueMetadata } from '@dedot/codecs';
|
|
5
|
-
import * as $ from '@dedot/shape';
|
|
6
5
|
import { hexToU8a, isHex } from '@dedot/utils';
|
|
7
|
-
import {
|
|
6
|
+
import { getMetadataFromWasmRuntime } from '@dedot/wasm';
|
|
8
7
|
import * as fs from 'fs';
|
|
9
8
|
export const getRuntimeVersion = (metadata) => {
|
|
10
9
|
const registry = new PortableRegistry(metadata.latest);
|
|
@@ -41,12 +40,8 @@ export const parseMetadataFromRaw = async (metadataFile) => {
|
|
|
41
40
|
};
|
|
42
41
|
};
|
|
43
42
|
export const parseMetadataFromWasm = async (runtimeFile) => {
|
|
44
|
-
const u8aMetadata = hexToU8a(
|
|
45
|
-
|
|
46
|
-
const length = $.compactU32.tryDecode(u8aMetadata);
|
|
47
|
-
const offset = $.compactU32.tryEncode(length).length;
|
|
48
|
-
const metadataU8a = u8aMetadata.subarray(offset);
|
|
49
|
-
const { metadata, runtimeVersion } = decodeMetadata(metadataU8a);
|
|
43
|
+
const u8aMetadata = hexToU8a(getMetadataFromWasmRuntime(('0x' + fs.readFileSync(runtimeFile).toString('hex'))));
|
|
44
|
+
const { metadata, runtimeVersion } = decodeMetadata(u8aMetadata);
|
|
50
45
|
return {
|
|
51
46
|
metadata,
|
|
52
47
|
runtimeVersion,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dedot/cli",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.4",
|
|
4
4
|
"author": "Thang X. Vu <thang@dedot.dev>",
|
|
5
5
|
"homepage": "https://dedot.dev",
|
|
6
6
|
"repository": {
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"test": "npx vitest --watch=false"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@dedot/api": "0.18.
|
|
26
|
-
"@dedot/codecs": "0.18.
|
|
27
|
-
"@dedot/codegen": "0.18.
|
|
28
|
-
"@
|
|
25
|
+
"@dedot/api": "0.18.4",
|
|
26
|
+
"@dedot/codecs": "0.18.4",
|
|
27
|
+
"@dedot/codegen": "0.18.4",
|
|
28
|
+
"@dedot/wasm": "^0.1.0",
|
|
29
29
|
"@polkadot/types-support": "^16.4.6",
|
|
30
30
|
"ora": "^8.2.0",
|
|
31
31
|
"yargs": "^17.7.2"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"node": ">=18"
|
|
42
42
|
},
|
|
43
43
|
"license": "Apache-2.0",
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "ccfe55a98b0a7244b7fc0974c269f2c90b2a1f4d",
|
|
45
45
|
"module": "./index.js",
|
|
46
46
|
"types": "./index.d.ts"
|
|
47
47
|
}
|