@dedot/api 0.9.5 → 0.10.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/cjs/extrinsic/extensions/ExtraSignedExtension.js +10 -3
- package/cjs/extrinsic/submittable/BaseSubmittableExtrinsic.js +0 -4
- package/executor/Executor.d.ts +1 -1
- package/extrinsic/extensions/ExtraSignedExtension.js +10 -3
- package/extrinsic/submittable/BaseSubmittableExtrinsic.js +0 -4
- 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;
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dedot/api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
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.
|
|
17
|
-
"@dedot/providers": "0.
|
|
18
|
-
"@dedot/runtime-specs": "0.
|
|
19
|
-
"@dedot/shape": "0.
|
|
20
|
-
"@dedot/storage": "0.
|
|
21
|
-
"@dedot/types": "0.
|
|
22
|
-
"@dedot/utils": "0.
|
|
16
|
+
"@dedot/codecs": "0.10.0",
|
|
17
|
+
"@dedot/providers": "0.10.0",
|
|
18
|
+
"@dedot/runtime-specs": "0.10.0",
|
|
19
|
+
"@dedot/shape": "0.10.0",
|
|
20
|
+
"@dedot/storage": "0.10.0",
|
|
21
|
+
"@dedot/types": "0.10.0",
|
|
22
|
+
"@dedot/utils": "0.10.0"
|
|
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": "b6139d257df621080e3e7a0ce260da19e572c1c5",
|
|
52
52
|
"module": "./index.js",
|
|
53
53
|
"types": "./index.d.ts"
|
|
54
54
|
}
|