@acala-network/chopsticks 0.8.0-5 → 0.8.0-6
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/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/plugins/new-block/index.js +2 -1
- package/lib/utils/index.d.ts +5 -0
- package/lib/utils/index.js +21 -0
- package/lib/utils/signFake.d.ts +6 -0
- package/lib/utils/signFake.js +23 -0
- package/package.json +4 -4
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.fetchConfig = exports.setupWithServer = void 0;
|
|
18
|
+
require("@polkadot/api-augment");
|
|
18
19
|
__exportStar(require("@acala-network/chopsticks-core"), exports);
|
|
19
20
|
var setup_with_server_1 = require("./setup-with-server");
|
|
20
21
|
Object.defineProperty(exports, "setupWithServer", { enumerable: true, get: function () { return setup_with_server_1.setupWithServer; } });
|
|
@@ -4,7 +4,7 @@ exports.rpc = void 0;
|
|
|
4
4
|
const shared_1 = require("../../rpc/shared");
|
|
5
5
|
const logger_1 = require("../../logger");
|
|
6
6
|
const rpc = async (context, [param]) => {
|
|
7
|
-
const { count, to, hrmp, ump, dmp, transactions } = param || {};
|
|
7
|
+
const { count, to, hrmp, ump, dmp, transactions, unsafeBlockHeight } = param || {};
|
|
8
8
|
const now = context.chain.head.number;
|
|
9
9
|
const diff = to ? to - now : count;
|
|
10
10
|
const finalCount = diff > 0 ? diff : 1;
|
|
@@ -16,6 +16,7 @@ const rpc = async (context, [param]) => {
|
|
|
16
16
|
horizontalMessages: hrmp,
|
|
17
17
|
upwardMessages: ump,
|
|
18
18
|
downwardMessages: dmp,
|
|
19
|
+
unsafeBlockHeight: i === 0 ? unsafeBlockHeight : undefined,
|
|
19
20
|
})
|
|
20
21
|
.catch((error) => {
|
|
21
22
|
throw new shared_1.ResponseError(1, error.toString());
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./decoder"), exports);
|
|
18
|
+
__exportStar(require("./generate-html-diff"), exports);
|
|
19
|
+
__exportStar(require("./open-html"), exports);
|
|
20
|
+
__exportStar(require("./override"), exports);
|
|
21
|
+
__exportStar(require("./signFake"), exports);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ApiPromise } from '@polkadot/api';
|
|
2
|
+
import { GenericExtrinsic } from '@polkadot/types';
|
|
3
|
+
import { SignatureOptions } from '@polkadot/types/types';
|
|
4
|
+
export type SignFakeOptions = Partial<SignatureOptions>;
|
|
5
|
+
export declare const signFakeWithApi: (api: ApiPromise, tx: GenericExtrinsic, addr: string, options?: SignFakeOptions) => Promise<GenericExtrinsic<import("@polkadot/types/types").AnyTuple>>;
|
|
6
|
+
export declare const signFake: (tx: GenericExtrinsic, addr: string, options: SignatureOptions) => GenericExtrinsic<import("@polkadot/types/types").AnyTuple>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.signFake = exports.signFakeWithApi = void 0;
|
|
4
|
+
const signFakeWithApi = async (api, tx, addr, options = {}) => {
|
|
5
|
+
const nonce = options.nonce ?? (await api.query.system.account(addr)).nonce;
|
|
6
|
+
return (0, exports.signFake)(tx, addr, {
|
|
7
|
+
nonce,
|
|
8
|
+
genesisHash: api.genesisHash,
|
|
9
|
+
runtimeVersion: api.runtimeVersion,
|
|
10
|
+
blockHash: api.genesisHash,
|
|
11
|
+
...options,
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
exports.signFakeWithApi = signFakeWithApi;
|
|
15
|
+
const signFake = (tx, addr, options) => {
|
|
16
|
+
const mockSignature = new Uint8Array(64);
|
|
17
|
+
mockSignature.fill(0xcd);
|
|
18
|
+
mockSignature.set([0xde, 0xad, 0xbe, 0xef]);
|
|
19
|
+
tx.signFake(addr, options);
|
|
20
|
+
tx.signature.set(mockSignature);
|
|
21
|
+
return tx;
|
|
22
|
+
};
|
|
23
|
+
exports.signFake = signFake;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acala-network/chopsticks",
|
|
3
|
-
"version": "0.8.0-
|
|
3
|
+
"version": "0.8.0-6",
|
|
4
4
|
"author": "Bryan Chen <xlchen1291@gmail.com>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"bin": "./chopsticks.js",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"dev:moonbeam": "cd ../..; ts-node-dev --transpile-only --inspect -r tsconfig-paths/register --notify=false packages/chopsticks/src/cli.ts -- --config=configs/moonbeam.yml"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@acala-network/chopsticks-core": "0.8.0-
|
|
19
|
+
"@acala-network/chopsticks-core": "0.8.0-6",
|
|
20
20
|
"@pnpm/npm-conf": "^2.2.2",
|
|
21
21
|
"@polkadot/api": "^10.9.1",
|
|
22
|
-
"axios": "^1.
|
|
22
|
+
"axios": "^1.5.0",
|
|
23
23
|
"dotenv": "^16.3.1",
|
|
24
24
|
"global-agent": "^3.0.0",
|
|
25
25
|
"js-yaml": "^4.1.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@types/global-agent": "^2.1.1",
|
|
34
34
|
"@types/js-yaml": "^4.0.5",
|
|
35
35
|
"@types/lodash": "^4.14.197",
|
|
36
|
-
"@types/node": "^20.5.
|
|
36
|
+
"@types/node": "^20.5.7",
|
|
37
37
|
"@types/ws": "^8.5.5",
|
|
38
38
|
"@types/yargs": "^17.0.24",
|
|
39
39
|
"ts-node": "^10.9.1",
|