@acala-network/chopsticks-utils 1.5.1 → 1.6.0
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/index.d.ts +7 -7
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/signFake.js +2 -1
- package/dist/esm/index.d.ts +7 -7
- package/dist/esm/index.js +2 -2
- package/dist/esm/signFake.js +2 -1
- package/package.json +53 -49
package/dist/cjs/index.d.ts
CHANGED
|
@@ -176,11 +176,11 @@ export declare const testingPairs: (keyringType?: "ed25519" | "sr25519", ss58For
|
|
|
176
176
|
* @returns Object containing various test signers, and a `polkadotSignerBuilder` function to create more.
|
|
177
177
|
*/
|
|
178
178
|
export declare const testingSigners: (keyringType?: "Ed25519" | "Sr25519") => {
|
|
179
|
-
alice: import("@polkadot-api/
|
|
180
|
-
bob: import("@polkadot-api/
|
|
181
|
-
charlie: import("@polkadot-api/
|
|
182
|
-
dave: import("@polkadot-api/
|
|
183
|
-
eve: import("@polkadot-api/
|
|
184
|
-
ferdie: import("@polkadot-api/
|
|
185
|
-
polkadotSignerBuilder: (path: string, keyringType?: "Ed25519" | "Sr25519") => import("@polkadot-api/
|
|
179
|
+
alice: import("@polkadot-api/signers-common").CommonSignerTxCreator;
|
|
180
|
+
bob: import("@polkadot-api/signers-common").CommonSignerTxCreator;
|
|
181
|
+
charlie: import("@polkadot-api/signers-common").CommonSignerTxCreator;
|
|
182
|
+
dave: import("@polkadot-api/signers-common").CommonSignerTxCreator;
|
|
183
|
+
eve: import("@polkadot-api/signers-common").CommonSignerTxCreator;
|
|
184
|
+
ferdie: import("@polkadot-api/signers-common").CommonSignerTxCreator;
|
|
185
|
+
polkadotSignerBuilder: (path: string, keyringType?: "Ed25519" | "Sr25519") => import("@polkadot-api/signers-common").CommonSignerTxCreator;
|
|
186
186
|
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -42,7 +42,7 @@ const _api = require("@polkadot/api");
|
|
|
42
42
|
const _keyring = require("@polkadot/keyring");
|
|
43
43
|
const _hdkd = require("@polkadot-labs/hdkd");
|
|
44
44
|
const _hdkdhelpers = require("@polkadot-labs/hdkd-helpers");
|
|
45
|
-
const
|
|
45
|
+
const _txcreator = require("polkadot-api/tx-creator");
|
|
46
46
|
_export_star(require("./signFake.js"), exports);
|
|
47
47
|
function _export_star(from, to) {
|
|
48
48
|
Object.keys(from).forEach(function(k) {
|
|
@@ -234,7 +234,7 @@ const testingSigners = (keyringType = 'Ed25519')=>{
|
|
|
234
234
|
// Create a PAPI polkadot signer given a derivation path e.g. "//Alice" or "//Bob".
|
|
235
235
|
const polkadotSignerBuilder = (path, keyringType = 'Ed25519')=>{
|
|
236
236
|
const hdkdKeyPair = derive(path);
|
|
237
|
-
return (0,
|
|
237
|
+
return (0, _txcreator.getTxCreator)(hdkdKeyPair.publicKey, keyringType, hdkdKeyPair.sign);
|
|
238
238
|
};
|
|
239
239
|
return {
|
|
240
240
|
alice: polkadotSignerBuilder('//Alice', keyringType),
|
package/dist/cjs/signFake.js
CHANGED
|
@@ -17,7 +17,8 @@ _export(exports, {
|
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
const signFakeWithApi = async (api, tx, addr, options = {})=>{
|
|
20
|
-
const
|
|
20
|
+
const account = await api.query.system.account(addr);
|
|
21
|
+
const nonce = options.nonce ?? account.nonce;
|
|
21
22
|
signFake(tx, addr, {
|
|
22
23
|
nonce,
|
|
23
24
|
genesisHash: api.genesisHash,
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -176,11 +176,11 @@ export declare const testingPairs: (keyringType?: "ed25519" | "sr25519", ss58For
|
|
|
176
176
|
* @returns Object containing various test signers, and a `polkadotSignerBuilder` function to create more.
|
|
177
177
|
*/
|
|
178
178
|
export declare const testingSigners: (keyringType?: "Ed25519" | "Sr25519") => {
|
|
179
|
-
alice: import("@polkadot-api/
|
|
180
|
-
bob: import("@polkadot-api/
|
|
181
|
-
charlie: import("@polkadot-api/
|
|
182
|
-
dave: import("@polkadot-api/
|
|
183
|
-
eve: import("@polkadot-api/
|
|
184
|
-
ferdie: import("@polkadot-api/
|
|
185
|
-
polkadotSignerBuilder: (path: string, keyringType?: "Ed25519" | "Sr25519") => import("@polkadot-api/
|
|
179
|
+
alice: import("@polkadot-api/signers-common").CommonSignerTxCreator;
|
|
180
|
+
bob: import("@polkadot-api/signers-common").CommonSignerTxCreator;
|
|
181
|
+
charlie: import("@polkadot-api/signers-common").CommonSignerTxCreator;
|
|
182
|
+
dave: import("@polkadot-api/signers-common").CommonSignerTxCreator;
|
|
183
|
+
eve: import("@polkadot-api/signers-common").CommonSignerTxCreator;
|
|
184
|
+
ferdie: import("@polkadot-api/signers-common").CommonSignerTxCreator;
|
|
185
|
+
polkadotSignerBuilder: (path: string, keyringType?: "Ed25519" | "Sr25519") => import("@polkadot-api/signers-common").CommonSignerTxCreator;
|
|
186
186
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { ApiPromise, WsProvider } from '@polkadot/api';
|
|
|
3
3
|
import { createTestKeyring, Keyring } from '@polkadot/keyring';
|
|
4
4
|
import { ed25519CreateDerive, sr25519CreateDerive } from '@polkadot-labs/hdkd';
|
|
5
5
|
import { DEV_PHRASE, entropyToMiniSecret, mnemonicToEntropy } from '@polkadot-labs/hdkd-helpers';
|
|
6
|
-
import {
|
|
6
|
+
import { getTxCreator } from 'polkadot-api/tx-creator';
|
|
7
7
|
const logger = defaultLogger.child({
|
|
8
8
|
name: 'utils'
|
|
9
9
|
});
|
|
@@ -216,7 +216,7 @@ export * from './signFake.js';
|
|
|
216
216
|
// Create a PAPI polkadot signer given a derivation path e.g. "//Alice" or "//Bob".
|
|
217
217
|
const polkadotSignerBuilder = (path, keyringType = 'Ed25519')=>{
|
|
218
218
|
const hdkdKeyPair = derive(path);
|
|
219
|
-
return
|
|
219
|
+
return getTxCreator(hdkdKeyPair.publicKey, keyringType, hdkdKeyPair.sign);
|
|
220
220
|
};
|
|
221
221
|
return {
|
|
222
222
|
alice: polkadotSignerBuilder('//Alice', keyringType),
|
package/dist/esm/signFake.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const signFakeWithApi = async (api, tx, addr, options = {})=>{
|
|
2
|
-
const
|
|
2
|
+
const account = await api.query.system.account(addr);
|
|
3
|
+
const nonce = options.nonce ?? account.nonce;
|
|
3
4
|
signFake(tx, addr, {
|
|
4
5
|
nonce,
|
|
5
6
|
genesisHash: api.genesisHash,
|
package/package.json
CHANGED
|
@@ -1,50 +1,54 @@
|
|
|
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
|
-
|
|
2
|
+
"name": "@acala-network/chopsticks-utils",
|
|
3
|
+
"version": "1.6.0",
|
|
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
|
+
"depcheck": "bunx depcheck"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@acala-network/chopsticks": "workspace:*",
|
|
21
|
+
"@acala-network/chopsticks-core": "workspace:*",
|
|
22
|
+
"@polkadot-labs/hdkd": "^0.0.32",
|
|
23
|
+
"@polkadot-labs/hdkd-helpers": "^0.0.34",
|
|
24
|
+
"@polkadot/api": "^17.0.2",
|
|
25
|
+
"@polkadot/api-base": "^17.0.2",
|
|
26
|
+
"@polkadot/keyring": "^14.0.3",
|
|
27
|
+
"@polkadot/types": "^17.0.2",
|
|
28
|
+
"@polkadot/util": "^14.0.3",
|
|
29
|
+
"polkadot-api": "^3.3.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@swc/cli": "0.8.2",
|
|
33
|
+
"@swc/core": "^1.16.22",
|
|
34
|
+
"typescript": "^6.0.3"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist/esm/**",
|
|
38
|
+
"dist/cjs/**"
|
|
39
|
+
],
|
|
40
|
+
"main": "./dist/cjs/index.js",
|
|
41
|
+
"module": "./dist/esm/index.js",
|
|
42
|
+
"exports": {
|
|
43
|
+
".": {
|
|
44
|
+
"require": "./dist/cjs/index.js",
|
|
45
|
+
"import": "./dist/esm/index.js",
|
|
46
|
+
"default": "./dist/esm/index.js"
|
|
47
|
+
},
|
|
48
|
+
"./*": {
|
|
49
|
+
"require": "./dist/cjs/*.js",
|
|
50
|
+
"import": "./dist/esm/*.js",
|
|
51
|
+
"default": "./dist/esm/*.js"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|