@dedot/api 0.9.5-next.889fe7cd.3 → 0.9.5-next.98544c8c.42
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/cjs/extrinsic/extensions/ExtraSignedExtension.js +10 -3
- package/cjs/extrinsic/submittable/BaseSubmittableExtrinsic.js +0 -4
- package/cjs/json-rpc/group/ChainHead/ChainHead.js +2 -1
- package/executor/Executor.d.ts +1 -1
- package/extrinsic/extensions/ExtraSignedExtension.js +10 -3
- package/extrinsic/submittable/BaseSubmittableExtrinsic.js +0 -4
- package/json-rpc/group/ChainHead/ChainHead.js +2 -1
- package/package.json +9 -9
|
@@ -26,8 +26,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.ExtraSignedExtension = void 0;
|
|
27
27
|
const $ = __importStar(require("@dedot/shape"));
|
|
28
28
|
const utils_1 = require("@dedot/utils");
|
|
29
|
-
const SignedExtension_js_1 = require("./SignedExtension.js");
|
|
30
29
|
const FallbackSignedExtension_js_1 = require("./FallbackSignedExtension.js");
|
|
30
|
+
const SignedExtension_js_1 = require("./SignedExtension.js");
|
|
31
31
|
const index_js_1 = require("./known/index.js");
|
|
32
32
|
class ExtraSignedExtension extends SignedExtension_js_1.SignedExtension {
|
|
33
33
|
#signedExtensions;
|
|
@@ -83,13 +83,20 @@ class ExtraSignedExtension extends SignedExtension_js_1.SignedExtension {
|
|
|
83
83
|
* @returns boolean
|
|
84
84
|
*/
|
|
85
85
|
isRequireNoExternalInputs(extDef) {
|
|
86
|
-
return ((0, FallbackSignedExtension_js_1.isEmptyStructOrTuple)(this.registry, extDef.typeId) &&
|
|
86
|
+
return ((0, FallbackSignedExtension_js_1.isEmptyStructOrTuple)(this.registry, extDef.typeId) && // prettier-end-here
|
|
87
87
|
(0, FallbackSignedExtension_js_1.isEmptyStructOrTuple)(this.registry, extDef.additionalSigned));
|
|
88
88
|
}
|
|
89
89
|
toPayload(call = '0x') {
|
|
90
90
|
const signedExtensions = this.#signedExtensions.map((se) => se.identifier);
|
|
91
91
|
const { version } = this.registry.metadata.extrinsic;
|
|
92
|
-
|
|
92
|
+
const { signerAddress } = this.options;
|
|
93
|
+
return Object.assign({
|
|
94
|
+
address: signerAddress,
|
|
95
|
+
signedExtensions,
|
|
96
|
+
version,
|
|
97
|
+
method: call,
|
|
98
|
+
withSignedTransaction: true, // allow signer/wallet to alter transaction by default
|
|
99
|
+
}, ...this.#signedExtensions.map((se) => se.toPayload()));
|
|
93
100
|
}
|
|
94
101
|
toRawPayload(call = '0x') {
|
|
95
102
|
const payload = this.toPayload(call);
|
|
@@ -91,10 +91,6 @@ class BaseSubmittableExtrinsic extends codecs_1.Extrinsic {
|
|
|
91
91
|
if (!alteredTx.signed) {
|
|
92
92
|
throw new utils_1.DedotError('Altered transaction from signer is not signed');
|
|
93
93
|
}
|
|
94
|
-
// Signer's not allow the change the call data
|
|
95
|
-
if (alteredTx.callHex !== this.callHex) {
|
|
96
|
-
throw new utils_1.DedotError('Call data does not match, signer is not allowed to change tx call data.');
|
|
97
|
-
}
|
|
98
94
|
}
|
|
99
95
|
#getSigner(options) {
|
|
100
96
|
return options?.signer || this.client.options.signer;
|
|
@@ -33,7 +33,8 @@ class ChainHead extends JsonRpcGroup_js_1.JsonRpcGroup {
|
|
|
33
33
|
this.#retryQueue = new utils_1.AsyncQueue();
|
|
34
34
|
this.#blockUsage = new BlockUsage_js_1.BlockUsage();
|
|
35
35
|
this.#cache = new Map();
|
|
36
|
-
|
|
36
|
+
// This helps us to not accidentally putting too much stress on the JSON-RPC server, especially smoldot/light-client
|
|
37
|
+
this.#operationQueue = new utils_1.ThrottleQueue(this.#__unsafe__isSmoldot() ? 25 : 250);
|
|
37
38
|
}
|
|
38
39
|
async runtimeVersion() {
|
|
39
40
|
await this.#ensureFollowed();
|
package/executor/Executor.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as $ from '@dedot/shape';
|
|
2
2
|
import { ensurePresence, u8aToHex } from '@dedot/utils';
|
|
3
|
-
import { SignedExtension } from './SignedExtension.js';
|
|
4
3
|
import { FallbackSignedExtension, isEmptyStructOrTuple } from './FallbackSignedExtension.js';
|
|
4
|
+
import { SignedExtension } from './SignedExtension.js';
|
|
5
5
|
import { knownSignedExtensions } from './known/index.js';
|
|
6
6
|
export class ExtraSignedExtension extends SignedExtension {
|
|
7
7
|
#signedExtensions;
|
|
@@ -57,13 +57,20 @@ export class ExtraSignedExtension extends SignedExtension {
|
|
|
57
57
|
* @returns boolean
|
|
58
58
|
*/
|
|
59
59
|
isRequireNoExternalInputs(extDef) {
|
|
60
|
-
return (isEmptyStructOrTuple(this.registry, extDef.typeId) &&
|
|
60
|
+
return (isEmptyStructOrTuple(this.registry, extDef.typeId) && // prettier-end-here
|
|
61
61
|
isEmptyStructOrTuple(this.registry, extDef.additionalSigned));
|
|
62
62
|
}
|
|
63
63
|
toPayload(call = '0x') {
|
|
64
64
|
const signedExtensions = this.#signedExtensions.map((se) => se.identifier);
|
|
65
65
|
const { version } = this.registry.metadata.extrinsic;
|
|
66
|
-
|
|
66
|
+
const { signerAddress } = this.options;
|
|
67
|
+
return Object.assign({
|
|
68
|
+
address: signerAddress,
|
|
69
|
+
signedExtensions,
|
|
70
|
+
version,
|
|
71
|
+
method: call,
|
|
72
|
+
withSignedTransaction: true, // allow signer/wallet to alter transaction by default
|
|
73
|
+
}, ...this.#signedExtensions.map((se) => se.toPayload()));
|
|
67
74
|
}
|
|
68
75
|
toRawPayload(call = '0x') {
|
|
69
76
|
const payload = this.toPayload(call);
|
|
@@ -88,10 +88,6 @@ export class BaseSubmittableExtrinsic extends Extrinsic {
|
|
|
88
88
|
if (!alteredTx.signed) {
|
|
89
89
|
throw new DedotError('Altered transaction from signer is not signed');
|
|
90
90
|
}
|
|
91
|
-
// Signer's not allow the change the call data
|
|
92
|
-
if (alteredTx.callHex !== this.callHex) {
|
|
93
|
-
throw new DedotError('Call data does not match, signer is not allowed to change tx call data.');
|
|
94
|
-
}
|
|
95
91
|
}
|
|
96
92
|
#getSigner(options) {
|
|
97
93
|
return options?.signer || this.client.options.signer;
|
|
@@ -30,7 +30,8 @@ export class ChainHead extends JsonRpcGroup {
|
|
|
30
30
|
this.#retryQueue = new AsyncQueue();
|
|
31
31
|
this.#blockUsage = new BlockUsage();
|
|
32
32
|
this.#cache = new Map();
|
|
33
|
-
|
|
33
|
+
// This helps us to not accidentally putting too much stress on the JSON-RPC server, especially smoldot/light-client
|
|
34
|
+
this.#operationQueue = new ThrottleQueue(this.#__unsafe__isSmoldot() ? 25 : 250);
|
|
34
35
|
}
|
|
35
36
|
async runtimeVersion() {
|
|
36
37
|
await this.#ensureFollowed();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dedot/api",
|
|
3
|
-
"version": "0.9.5-next.
|
|
3
|
+
"version": "0.9.5-next.98544c8c.42+98544c8c",
|
|
4
4
|
"description": "A delightful JavaScript/TypeScript client for Polkadot & Substrate",
|
|
5
5
|
"author": "Thang X. Vu <thang@dedot.dev>",
|
|
6
6
|
"homepage": "https://dedot.dev",
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"sideEffects": false,
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@dedot/codecs": "0.9.5-next.
|
|
17
|
-
"@dedot/providers": "0.9.5-next.
|
|
18
|
-
"@dedot/runtime-specs": "0.9.5-next.
|
|
19
|
-
"@dedot/shape": "0.9.5-next.
|
|
20
|
-
"@dedot/storage": "0.9.5-next.
|
|
21
|
-
"@dedot/types": "0.9.5-next.
|
|
22
|
-
"@dedot/utils": "0.9.5-next.
|
|
16
|
+
"@dedot/codecs": "0.9.5-next.98544c8c.42+98544c8c",
|
|
17
|
+
"@dedot/providers": "0.9.5-next.98544c8c.42+98544c8c",
|
|
18
|
+
"@dedot/runtime-specs": "0.9.5-next.98544c8c.42+98544c8c",
|
|
19
|
+
"@dedot/shape": "0.9.5-next.98544c8c.42+98544c8c",
|
|
20
|
+
"@dedot/storage": "0.9.5-next.98544c8c.42+98544c8c",
|
|
21
|
+
"@dedot/types": "0.9.5-next.98544c8c.42+98544c8c",
|
|
22
|
+
"@dedot/utils": "0.9.5-next.98544c8c.42+98544c8c"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "tsc --project tsconfig.build.json && tsc --project tsconfig.build.cjs.json",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"node": ">=18"
|
|
49
49
|
},
|
|
50
50
|
"license": "Apache-2.0",
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "98544c8c9a5d4f5edf41bdb24fcd1bb67858f71d",
|
|
52
52
|
"module": "./index.js",
|
|
53
53
|
"types": "./index.d.ts"
|
|
54
54
|
}
|