@acala-network/chopsticks-core 1.5.2 → 1.6.1
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.
- package/dist/cjs/api.js +6 -15
- package/dist/cjs/blockchain/block-builder.js +3 -1
- package/dist/cjs/blockchain/block.js +5 -12
- package/dist/cjs/blockchain/head-state.js +4 -9
- package/dist/cjs/blockchain/index.js +6 -15
- package/dist/cjs/blockchain/storage-layer.js +5 -12
- package/dist/cjs/blockchain/txpool.js +17 -17
- package/dist/cjs/chopsticks-provider.js +5 -12
- package/dist/cjs/env.d.ts +25 -47
- package/dist/cjs/env.js +8 -19
- package/dist/cjs/genesis-provider.js +5 -12
- package/dist/cjs/logger.d.ts +3 -2
- package/dist/cjs/offchain.js +1 -3
- package/dist/cjs/rpc/dev/new-block.d.ts +9 -53
- package/dist/cjs/rpc/dev/set-head.d.ts +1 -1
- package/dist/cjs/rpc/index.d.ts +1 -1
- package/dist/cjs/rpc/rpc-spec/chainHead_v1.js +33 -7
- package/dist/cjs/rpc/rpc-spec/index.d.ts +1 -1
- package/dist/cjs/rpc/rpc-spec/index.js +8 -19
- package/dist/cjs/rpc/shared.d.ts +2 -2
- package/dist/cjs/rpc/shared.js +1 -3
- package/dist/cjs/rpc/substrate/index.d.ts +1 -6
- package/dist/cjs/rpc/substrate/index.js +8 -19
- package/dist/cjs/rpc/substrate/payment.js +7 -4
- package/dist/cjs/schema/index.d.ts +6 -52
- package/dist/cjs/schema/index.js +1 -1
- package/dist/cjs/utils/index.d.ts +5 -0
- package/dist/cjs/utils/index.js +9 -0
- package/dist/cjs/utils/key-cache.js +1 -3
- package/dist/cjs/wasm-executor/browser-wasm-executor.js +8 -19
- package/dist/cjs/wasm-executor/index.js +8 -19
- package/dist/cjs/wasm-executor/node-wasm-executor.js +8 -19
- package/dist/esm/blockchain/block-builder.js +4 -2
- package/dist/esm/blockchain/txpool.js +12 -3
- package/dist/esm/env.d.ts +25 -47
- package/dist/esm/logger.d.ts +3 -2
- package/dist/esm/rpc/dev/new-block.d.ts +9 -53
- package/dist/esm/rpc/dev/set-head.d.ts +1 -1
- package/dist/esm/rpc/index.d.ts +1 -1
- package/dist/esm/rpc/index.js +1 -1
- package/dist/esm/rpc/rpc-spec/chainHead_v1.js +33 -7
- package/dist/esm/rpc/rpc-spec/index.d.ts +1 -1
- package/dist/esm/rpc/rpc-spec/index.js +1 -1
- package/dist/esm/rpc/shared.d.ts +2 -2
- package/dist/esm/rpc/substrate/index.d.ts +1 -6
- package/dist/esm/rpc/substrate/index.js +1 -6
- package/dist/esm/rpc/substrate/payment.js +8 -5
- package/dist/esm/schema/index.d.ts +6 -52
- package/dist/esm/schema/index.js +1 -1
- package/dist/esm/utils/index.d.ts +5 -0
- package/dist/esm/utils/index.js +10 -1
- package/package.json +65 -61
|
@@ -5,62 +5,18 @@ declare const schema: z.ZodObject<{
|
|
|
5
5
|
to: z.ZodOptional<z.ZodNumber>;
|
|
6
6
|
dmp: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
7
7
|
sentAt: z.ZodNumber;
|
|
8
|
-
msg: z.
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}, {
|
|
13
|
-
msg: `0x${string}`;
|
|
14
|
-
sentAt: number;
|
|
15
|
-
}>, "many">>;
|
|
16
|
-
ump: z.ZodOptional<z.ZodRecord<z.ZodNumber, z.ZodArray<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, "many">>>;
|
|
17
|
-
hrmp: z.ZodOptional<z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString]>, z.ZodArray<z.ZodObject<{
|
|
8
|
+
msg: z.ZodCustom<`0x${string}`, `0x${string}`>;
|
|
9
|
+
}, z.core.$strip>>>;
|
|
10
|
+
ump: z.ZodOptional<z.ZodRecord<z.ZodNumber, z.ZodArray<z.ZodCustom<`0x${string}`, `0x${string}`>>>>;
|
|
11
|
+
hrmp: z.ZodOptional<z.ZodRecord<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodArray<z.ZodObject<{
|
|
18
12
|
sentAt: z.ZodNumber;
|
|
19
|
-
data: z.
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
sentAt: number;
|
|
23
|
-
}, {
|
|
24
|
-
data: `0x${string}`;
|
|
25
|
-
sentAt: number;
|
|
26
|
-
}>, "many">>>;
|
|
27
|
-
transactions: z.ZodOptional<z.ZodArray<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, "many">>;
|
|
13
|
+
data: z.ZodCustom<`0x${string}`, `0x${string}`>;
|
|
14
|
+
}, z.core.$strip>>>>;
|
|
15
|
+
transactions: z.ZodOptional<z.ZodArray<z.ZodCustom<`0x${string}`, `0x${string}`>>>;
|
|
28
16
|
unsafeBlockHeight: z.ZodOptional<z.ZodNumber>;
|
|
29
|
-
relayChainStateOverrides: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.
|
|
17
|
+
relayChainStateOverrides: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodCustom<`0x${string}`, `0x${string}`>, z.ZodUnion<readonly [z.ZodCustom<`0x${string}`, `0x${string}`>, z.ZodNull]>], null>>>;
|
|
30
18
|
relayParentNumber: z.ZodOptional<z.ZodNumber>;
|
|
31
|
-
},
|
|
32
|
-
transactions?: `0x${string}`[] | undefined;
|
|
33
|
-
unsafeBlockHeight?: number | undefined;
|
|
34
|
-
relayChainStateOverrides?: [`0x${string}`, `0x${string}` | null][] | undefined;
|
|
35
|
-
relayParentNumber?: number | undefined;
|
|
36
|
-
ump?: Record<number, `0x${string}`[]> | undefined;
|
|
37
|
-
dmp?: {
|
|
38
|
-
msg: `0x${string}`;
|
|
39
|
-
sentAt: number;
|
|
40
|
-
}[] | undefined;
|
|
41
|
-
hrmp?: Record<string | number, {
|
|
42
|
-
data: `0x${string}`;
|
|
43
|
-
sentAt: number;
|
|
44
|
-
}[]> | undefined;
|
|
45
|
-
count?: number | undefined;
|
|
46
|
-
to?: number | undefined;
|
|
47
|
-
}, {
|
|
48
|
-
transactions?: `0x${string}`[] | undefined;
|
|
49
|
-
unsafeBlockHeight?: number | undefined;
|
|
50
|
-
relayChainStateOverrides?: [`0x${string}`, `0x${string}` | null][] | undefined;
|
|
51
|
-
relayParentNumber?: number | undefined;
|
|
52
|
-
ump?: Record<number, `0x${string}`[]> | undefined;
|
|
53
|
-
dmp?: {
|
|
54
|
-
msg: `0x${string}`;
|
|
55
|
-
sentAt: number;
|
|
56
|
-
}[] | undefined;
|
|
57
|
-
hrmp?: Record<string | number, {
|
|
58
|
-
data: `0x${string}`;
|
|
59
|
-
sentAt: number;
|
|
60
|
-
}[]> | undefined;
|
|
61
|
-
count?: number | undefined;
|
|
62
|
-
to?: number | undefined;
|
|
63
|
-
}>;
|
|
19
|
+
}, z.core.$strip>;
|
|
64
20
|
type Params = z.infer<typeof schema>;
|
|
65
21
|
export interface NewBlockParams {
|
|
66
22
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { type Context } from '../shared.js';
|
|
3
|
-
declare const schema: z.ZodUnion<[z.ZodIntersection<z.ZodString, z.
|
|
3
|
+
declare const schema: z.ZodUnion<[z.ZodIntersection<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>, z.ZodNumber]>;
|
|
4
4
|
type Params = z.infer<typeof schema>;
|
|
5
5
|
/**
|
|
6
6
|
* Set head.
|
package/dist/esm/rpc/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import dev from './dev/index.js';
|
|
|
2
2
|
import type { Handlers } from './shared.js';
|
|
3
3
|
import substrate from './substrate/index.js';
|
|
4
4
|
export declare const allHandlers: Handlers;
|
|
5
|
-
export { substrate, dev };
|
|
6
5
|
export type { Context, Handler, Handlers, SubscriptionManager } from './shared.js';
|
|
7
6
|
export { ResponseError } from './shared.js';
|
|
7
|
+
export { dev, substrate };
|
package/dist/esm/rpc/index.js
CHANGED
|
@@ -6,6 +6,28 @@ const logger = defaultLogger.child({
|
|
|
6
6
|
name: 'rpc-chainHead_v1'
|
|
7
7
|
});
|
|
8
8
|
const following = new Map();
|
|
9
|
+
const runtimeSpec = (runtime)=>({
|
|
10
|
+
type: 'valid',
|
|
11
|
+
spec: {
|
|
12
|
+
specName: runtime.specName,
|
|
13
|
+
implName: runtime.implName,
|
|
14
|
+
specVersion: runtime.specVersion,
|
|
15
|
+
implVersion: runtime.implVersion,
|
|
16
|
+
transactionVersion: runtime.transactionVersion,
|
|
17
|
+
apis: Object.fromEntries(runtime.apis)
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const invalidRuntimeSpec = (error)=>({
|
|
21
|
+
type: 'invalid',
|
|
22
|
+
error: error instanceof Error ? error.message : String(error)
|
|
23
|
+
});
|
|
24
|
+
const getRuntimeSpec = async (runtime)=>{
|
|
25
|
+
try {
|
|
26
|
+
return runtimeSpec(await runtime);
|
|
27
|
+
} catch (error) {
|
|
28
|
+
return invalidRuntimeSpec(error);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
9
31
|
/**
|
|
10
32
|
* Start a chainHead follow subscription
|
|
11
33
|
*
|
|
@@ -20,12 +42,16 @@ const following = new Map();
|
|
|
20
42
|
hash: block.hash
|
|
21
43
|
}, 'chainHead_v1_follow');
|
|
22
44
|
const getNewRuntime = async ()=>{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
45
|
+
try {
|
|
46
|
+
const [runtime, previousRuntime] = await Promise.all([
|
|
47
|
+
block.runtimeVersion,
|
|
48
|
+
block.parentBlock.then((b)=>b?.runtimeVersion)
|
|
49
|
+
]);
|
|
50
|
+
const hasNewRuntime = runtime.implVersion !== previousRuntime?.implVersion || runtime.specVersion !== previousRuntime.specVersion;
|
|
51
|
+
return hasNewRuntime ? runtimeSpec(runtime) : null;
|
|
52
|
+
} catch (error) {
|
|
53
|
+
return invalidRuntimeSpec(error);
|
|
54
|
+
}
|
|
29
55
|
};
|
|
30
56
|
const newRuntime = withRuntime ? await getNewRuntime() : null;
|
|
31
57
|
callback({
|
|
@@ -73,7 +99,7 @@ const following = new Map();
|
|
|
73
99
|
finalizedBlockHashes: [
|
|
74
100
|
context.chain.head.hash
|
|
75
101
|
],
|
|
76
|
-
finalizedBlockRuntime: withRuntime ? await context.chain.head.runtimeVersion : null
|
|
102
|
+
finalizedBlockRuntime: withRuntime ? await getRuntimeSpec(context.chain.head.runtimeVersion) : null
|
|
77
103
|
});
|
|
78
104
|
callback({
|
|
79
105
|
event: 'bestBlockChanged',
|
|
@@ -2,7 +2,7 @@ import * as ArchiveV1RPC from './archive_v1.js';
|
|
|
2
2
|
import * as ChainHeadV1RPC from './chainHead_v1.js';
|
|
3
3
|
import * as ChainSpecV1RPC from './chainSpec_v1.js';
|
|
4
4
|
import * as TransactionV1RPC from './transaction_v1.js';
|
|
5
|
-
export { ChainHeadV1RPC,
|
|
5
|
+
export { ChainHeadV1RPC, ChainSpecV1RPC, TransactionV1RPC };
|
|
6
6
|
declare const handlers: {
|
|
7
7
|
chainSpec_v1_chainName: import("../shared.js").Handler<[], string>;
|
|
8
8
|
chainSpec_v1_genesisHash: import("../shared.js").Handler<[], import("@polkadot/util/types").HexString>;
|
|
@@ -2,7 +2,7 @@ import * as ArchiveV1RPC from './archive_v1.js';
|
|
|
2
2
|
import * as ChainHeadV1RPC from './chainHead_v1.js';
|
|
3
3
|
import * as ChainSpecV1RPC from './chainSpec_v1.js';
|
|
4
4
|
import * as TransactionV1RPC from './transaction_v1.js';
|
|
5
|
-
export { ChainHeadV1RPC,
|
|
5
|
+
export { ChainHeadV1RPC, ChainSpecV1RPC, TransactionV1RPC };
|
|
6
6
|
const handlers = {
|
|
7
7
|
...ArchiveV1RPC,
|
|
8
8
|
...ChainHeadV1RPC,
|
package/dist/esm/rpc/shared.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { Blockchain } from '../blockchain/index.js';
|
|
3
3
|
export declare const logger: import("pino").Logger<never, boolean>;
|
|
4
|
-
export declare const zHex: z.
|
|
5
|
-
export declare const zHash: z.ZodIntersection<z.ZodString, z.
|
|
4
|
+
export declare const zHex: z.ZodCustom<`0x${string}`, `0x${string}`>;
|
|
5
|
+
export declare const zHash: z.ZodIntersection<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
6
6
|
export declare class ResponseError extends Error {
|
|
7
7
|
code: number;
|
|
8
8
|
constructor(code: number, message: string);
|
|
@@ -4,12 +4,7 @@ import * as ChainRPC from './chain.js';
|
|
|
4
4
|
import * as PaymentRPC from './payment.js';
|
|
5
5
|
import * as StateRPC from './state.js';
|
|
6
6
|
import * as SystemRPC from './system.js';
|
|
7
|
-
export { ArchiveRPC };
|
|
8
|
-
export { AuthorRPC };
|
|
9
|
-
export { ChainRPC };
|
|
10
|
-
export { PaymentRPC };
|
|
11
|
-
export { StateRPC };
|
|
12
|
-
export { SystemRPC };
|
|
7
|
+
export { ArchiveRPC, AuthorRPC, ChainRPC, PaymentRPC, StateRPC, SystemRPC };
|
|
13
8
|
declare const handlers: {
|
|
14
9
|
system_localPeerId: () => Promise<string>;
|
|
15
10
|
system_nodeRoles: () => Promise<string[]>;
|
|
@@ -4,12 +4,7 @@ import * as ChainRPC from './chain.js';
|
|
|
4
4
|
import * as PaymentRPC from './payment.js';
|
|
5
5
|
import * as StateRPC from './state.js';
|
|
6
6
|
import * as SystemRPC from './system.js';
|
|
7
|
-
export { ArchiveRPC };
|
|
8
|
-
export { AuthorRPC };
|
|
9
|
-
export { ChainRPC };
|
|
10
|
-
export { PaymentRPC };
|
|
11
|
-
export { StateRPC };
|
|
12
|
-
export { SystemRPC };
|
|
7
|
+
export { ArchiveRPC, AuthorRPC, ChainRPC, PaymentRPC, StateRPC, SystemRPC };
|
|
13
8
|
const handlers = {
|
|
14
9
|
...ArchiveRPC,
|
|
15
10
|
...AuthorRPC,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { hexToU8a } from '@polkadot/util';
|
|
1
|
+
import { hexToU8a, u8aToHex } from '@polkadot/util';
|
|
2
|
+
import { isGeneralExtrinsic } from '../../utils/index.js';
|
|
2
3
|
import { ResponseError } from '../shared.js';
|
|
3
4
|
/**
|
|
4
5
|
* @param context
|
|
@@ -13,8 +14,9 @@ import { ResponseError } from '../shared.js';
|
|
|
13
14
|
const registry = await block.registry;
|
|
14
15
|
const tx = hexToU8a(extrinsic);
|
|
15
16
|
const resp = await block.call('TransactionPaymentApi_query_fee_details', [
|
|
16
|
-
|
|
17
|
-
registry.createType('
|
|
17
|
+
// polkadot.js cannot always decode a general (v5) extrinsic; the runtime takes its bytes as they are
|
|
18
|
+
isGeneralExtrinsic(tx) ? extrinsic : registry.createType('Extrinsic', tx).toHex(),
|
|
19
|
+
u8aToHex(registry.createType('u32', tx.byteLength).toU8a())
|
|
18
20
|
]);
|
|
19
21
|
return resp.result;
|
|
20
22
|
};
|
|
@@ -31,8 +33,9 @@ import { ResponseError } from '../shared.js';
|
|
|
31
33
|
const registry = await block.registry;
|
|
32
34
|
const tx = hexToU8a(extrinsic);
|
|
33
35
|
const resp = await block.call('TransactionPaymentApi_query_info', [
|
|
34
|
-
|
|
35
|
-
registry.createType('
|
|
36
|
+
// polkadot.js cannot always decode a general (v5) extrinsic; the runtime takes its bytes as they are
|
|
37
|
+
isGeneralExtrinsic(tx) ? extrinsic : registry.createType('Extrinsic', tx).toHex(),
|
|
38
|
+
u8aToHex(registry.createType('u32', tx.byteLength).toU8a())
|
|
36
39
|
]);
|
|
37
40
|
return resp.result;
|
|
38
41
|
};
|
|
@@ -4,59 +4,13 @@ export declare const genesisSchema: z.ZodObject<{
|
|
|
4
4
|
name: z.ZodString;
|
|
5
5
|
properties: z.ZodObject<{
|
|
6
6
|
ss58Format: z.ZodOptional<z.ZodNumber>;
|
|
7
|
-
tokenDecimals: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodArray<z.ZodNumber
|
|
8
|
-
tokenSymbol: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString
|
|
9
|
-
},
|
|
10
|
-
ss58Format?: number | undefined;
|
|
11
|
-
tokenDecimals?: number | number[] | undefined;
|
|
12
|
-
tokenSymbol?: string | string[] | undefined;
|
|
13
|
-
}, {
|
|
14
|
-
ss58Format?: number | undefined;
|
|
15
|
-
tokenDecimals?: number | number[] | undefined;
|
|
16
|
-
tokenSymbol?: string | string[] | undefined;
|
|
17
|
-
}>;
|
|
7
|
+
tokenDecimals: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>;
|
|
8
|
+
tokenSymbol: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
9
|
+
}, z.core.$strip>;
|
|
18
10
|
genesis: z.ZodObject<{
|
|
19
11
|
raw: z.ZodObject<{
|
|
20
12
|
top: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
top: Record<string, string>;
|
|
25
|
-
}>;
|
|
26
|
-
}, "strip", z.ZodTypeAny, {
|
|
27
|
-
raw: {
|
|
28
|
-
top: Record<string, string>;
|
|
29
|
-
};
|
|
30
|
-
}, {
|
|
31
|
-
raw: {
|
|
32
|
-
top: Record<string, string>;
|
|
33
|
-
};
|
|
34
|
-
}>;
|
|
35
|
-
}, "strip", z.ZodTypeAny, {
|
|
36
|
-
name: string;
|
|
37
|
-
id: string;
|
|
38
|
-
properties: {
|
|
39
|
-
ss58Format?: number | undefined;
|
|
40
|
-
tokenDecimals?: number | number[] | undefined;
|
|
41
|
-
tokenSymbol?: string | string[] | undefined;
|
|
42
|
-
};
|
|
43
|
-
genesis: {
|
|
44
|
-
raw: {
|
|
45
|
-
top: Record<string, string>;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
}, {
|
|
49
|
-
name: string;
|
|
50
|
-
id: string;
|
|
51
|
-
properties: {
|
|
52
|
-
ss58Format?: number | undefined;
|
|
53
|
-
tokenDecimals?: number | number[] | undefined;
|
|
54
|
-
tokenSymbol?: string | string[] | undefined;
|
|
55
|
-
};
|
|
56
|
-
genesis: {
|
|
57
|
-
raw: {
|
|
58
|
-
top: Record<string, string>;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
}>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
}, z.core.$strip>;
|
|
62
16
|
export type Genesis = z.infer<typeof genesisSchema>;
|
package/dist/esm/schema/index.js
CHANGED
|
@@ -10,6 +10,11 @@ export type ProcessKey = (key: StorageKey<any>) => any;
|
|
|
10
10
|
export declare function fetchKeys(getKeys: GetKeys, processKey: ProcessKey): Promise<void>;
|
|
11
11
|
export declare function fetchKeysToArray(getKeys: GetKeys): Promise<StorageKey<any>[]>;
|
|
12
12
|
export declare const compactHex: (value: Uint8Array) => HexString;
|
|
13
|
+
/**
|
|
14
|
+
* Whether `extrinsic` is a general (v5) extrinsic, read from its preamble byte. polkadot.js cannot always decode one: it
|
|
15
|
+
* skips the payload of a transaction extension it does not know, such as VerifySignature.
|
|
16
|
+
*/
|
|
17
|
+
export declare const isGeneralExtrinsic: (extrinsic: HexString | Uint8Array) => boolean;
|
|
13
18
|
export declare const getParaId: (chain: Blockchain) => Promise<import("@polkadot/types").U32>;
|
|
14
19
|
export declare const isUrl: (url: string) => boolean;
|
|
15
20
|
export type Deferred<T> = {
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GENERAL_EXTRINSIC, TYPE_MASK } from '@polkadot/types/extrinsic/constants';
|
|
2
|
+
import { compactFromU8a, compactStripLength, u8aToHex, u8aToU8a } from '@polkadot/util';
|
|
2
3
|
import { hexAddPrefix, hexStripPrefix } from '@polkadot/util/hex';
|
|
3
4
|
import { getAuraSlotDuration } from '../wasm-executor/index.js';
|
|
4
5
|
export * from './decoder.js';
|
|
@@ -29,6 +30,14 @@ export async function fetchKeysToArray(getKeys) {
|
|
|
29
30
|
export const compactHex = (value)=>{
|
|
30
31
|
return u8aToHex(compactStripLength(value)[1]);
|
|
31
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* Whether `extrinsic` is a general (v5) extrinsic, read from its preamble byte. polkadot.js cannot always decode one: it
|
|
35
|
+
* skips the payload of a transaction extension it does not know, such as VerifySignature.
|
|
36
|
+
*/ export const isGeneralExtrinsic = (extrinsic)=>{
|
|
37
|
+
const u8a = u8aToU8a(extrinsic);
|
|
38
|
+
const [offset] = compactFromU8a(u8a);
|
|
39
|
+
return (u8a[offset] & TYPE_MASK) === GENERAL_EXTRINSIC;
|
|
40
|
+
};
|
|
32
41
|
export const getParaId = async (chain)=>{
|
|
33
42
|
const meta = await chain.head.meta;
|
|
34
43
|
const id = await chain.head.read('u32', meta.query.parachainInfo.parachainId);
|
package/package.json
CHANGED
|
@@ -1,62 +1,66 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
2
|
+
"name": "@acala-network/chopsticks-core",
|
|
3
|
+
"version": "1.6.1",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/AcalaNetwork/chopsticks"
|
|
7
|
+
},
|
|
8
|
+
"author": "Acala Developers <hello@acala.network>",
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=v24"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
16
|
+
"build": "bun run clean && ../../package-build.sh",
|
|
17
|
+
"docs:prep": "typedoc",
|
|
18
|
+
"depcheck": "bunx depcheck"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@acala-network/chopsticks-executor": "1.6.1",
|
|
22
|
+
"@polkadot/rpc-provider": "^17.0.2",
|
|
23
|
+
"@polkadot/types": "^17.0.2",
|
|
24
|
+
"@polkadot/types-codec": "^17.0.2",
|
|
25
|
+
"@polkadot/types-known": "^17.0.2",
|
|
26
|
+
"@polkadot/util": "^14.0.3",
|
|
27
|
+
"@polkadot/util-crypto": "^14.0.3",
|
|
28
|
+
"comlink": "^4.4.2",
|
|
29
|
+
"eventemitter3": "^5.0.4",
|
|
30
|
+
"lodash": "^4.18.1",
|
|
31
|
+
"lru-cache": "^11.5.3",
|
|
32
|
+
"pino": "^10.4.0",
|
|
33
|
+
"pino-pretty": "^13.2.0",
|
|
34
|
+
"rxjs": "^7.8.2",
|
|
35
|
+
"zod": "^4.6.7"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@swc/cli": "0.8.2",
|
|
39
|
+
"@swc/core": "^1.16.22",
|
|
40
|
+
"@types/lodash": "^4.17.27",
|
|
41
|
+
"typescript": "^6.0.3",
|
|
42
|
+
"vitest": "^5.1.0"
|
|
43
|
+
},
|
|
44
|
+
"files": [
|
|
45
|
+
"dist/esm/**",
|
|
46
|
+
"dist/cjs/**"
|
|
47
|
+
],
|
|
48
|
+
"main": "./dist/cjs/index.js",
|
|
49
|
+
"module": "./dist/esm/index.js",
|
|
50
|
+
"exports": {
|
|
51
|
+
".": {
|
|
52
|
+
"require": "./dist/cjs/index.js",
|
|
53
|
+
"import": "./dist/esm/index.js",
|
|
54
|
+
"default": "./dist/esm/index.js"
|
|
55
|
+
},
|
|
56
|
+
"./*": {
|
|
57
|
+
"require": "./dist/cjs/*.js",
|
|
58
|
+
"import": "./dist/esm/*.js",
|
|
59
|
+
"default": "./dist/esm/*.js"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"browser": {
|
|
63
|
+
"./dist/cjs/wasm-executor/node-worker.js": "./dist/cjs/wasm-executor/browser-worker.js",
|
|
64
|
+
"./dist/esm/wasm-executor/node-worker.js": "./dist/esm/wasm-executor/browser-worker.js"
|
|
65
|
+
}
|
|
66
|
+
}
|