@ocap/tx-protocols 1.29.27 → 1.30.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/esm/_virtual/rolldown_runtime.mjs +32 -0
- package/esm/node_modules/bn.js/lib/bn.mjs +2551 -0
- package/esm/node_modules/valibot/dist/index.mjs +663 -0
- package/esm/protocols/account/delegate.mjs +42 -36
- package/esm/protocols/account/migrate.mjs +7 -10
- package/esm/protocols/account/revoke-delegate.mjs +11 -11
- package/esm/protocols/asset/acquire-v2.mjs +19 -13
- package/esm/protocols/asset/acquire-v3.mjs +17 -14
- package/esm/protocols/asset/consume.mjs +9 -9
- package/esm/protocols/asset/create.mjs +2 -1
- package/esm/protocols/asset/mint.mjs +19 -13
- package/esm/protocols/asset/update.mjs +11 -11
- package/esm/protocols/governance/claim-stake.mjs +10 -10
- package/esm/protocols/governance/return-stake.mjs +11 -11
- package/esm/protocols/governance/revoke-stake.mjs +10 -10
- package/esm/protocols/governance/slash-stake.mjs +11 -11
- package/esm/protocols/governance/stake.mjs +16 -16
- package/esm/protocols/rollup/claim-reward.mjs +21 -18
- package/esm/protocols/rollup/close.mjs +16 -13
- package/esm/protocols/rollup/create-block.mjs +25 -22
- package/esm/protocols/rollup/join.mjs +14 -12
- package/esm/protocols/rollup/leave.mjs +12 -11
- package/esm/protocols/rollup/migrate.mjs +15 -12
- package/esm/protocols/rollup/pause.mjs +9 -9
- package/esm/protocols/rollup/resume.mjs +9 -9
- package/esm/protocols/rollup/update.mjs +31 -28
- package/esm/protocols/token/create.mjs +25 -22
- package/esm/protocols/token/deposit-v2.mjs +20 -14
- package/esm/protocols/token/withdraw-v2.mjs +20 -14
- package/esm/protocols/token-factory/burn.mjs +12 -12
- package/esm/protocols/token-factory/create.mjs +45 -37
- package/esm/protocols/token-factory/mint.mjs +13 -12
- package/esm/protocols/token-factory/update.mjs +21 -21
- package/esm/protocols/trade/exchange-v2.mjs +15 -15
- package/esm/protocols/trade/transfer-v2.mjs +12 -12
- package/esm/protocols/trade/transfer-v3.mjs +7 -10
- package/esm/util.d.mts +3 -1
- package/esm/util.mjs +16 -1
- package/lib/_virtual/rolldown_runtime.cjs +2 -0
- package/lib/node_modules/bn.js/lib/bn.cjs +2554 -0
- package/lib/node_modules/valibot/dist/index.cjs +683 -0
- package/lib/protocols/account/delegate.cjs +41 -35
- package/lib/protocols/account/migrate.cjs +6 -9
- package/lib/protocols/account/revoke-delegate.cjs +10 -10
- package/lib/protocols/asset/acquire-v2.cjs +18 -12
- package/lib/protocols/asset/acquire-v3.cjs +16 -13
- package/lib/protocols/asset/consume.cjs +8 -8
- package/lib/protocols/asset/create.cjs +2 -1
- package/lib/protocols/asset/mint.cjs +18 -12
- package/lib/protocols/asset/update.cjs +10 -10
- package/lib/protocols/governance/claim-stake.cjs +9 -9
- package/lib/protocols/governance/return-stake.cjs +10 -10
- package/lib/protocols/governance/revoke-stake.cjs +9 -9
- package/lib/protocols/governance/slash-stake.cjs +10 -10
- package/lib/protocols/governance/stake.cjs +15 -15
- package/lib/protocols/rollup/claim-reward.cjs +20 -17
- package/lib/protocols/rollup/close.cjs +15 -12
- package/lib/protocols/rollup/create-block.cjs +24 -21
- package/lib/protocols/rollup/join.cjs +13 -11
- package/lib/protocols/rollup/leave.cjs +11 -10
- package/lib/protocols/rollup/migrate.cjs +14 -11
- package/lib/protocols/rollup/pause.cjs +8 -8
- package/lib/protocols/rollup/resume.cjs +8 -8
- package/lib/protocols/rollup/update.cjs +29 -27
- package/lib/protocols/token/create.cjs +23 -20
- package/lib/protocols/token/deposit-v2.cjs +19 -13
- package/lib/protocols/token/withdraw-v2.cjs +19 -13
- package/lib/protocols/token-factory/burn.cjs +11 -11
- package/lib/protocols/token-factory/create.cjs +43 -35
- package/lib/protocols/token-factory/mint.cjs +12 -11
- package/lib/protocols/token-factory/update.cjs +19 -19
- package/lib/protocols/trade/exchange-v2.cjs +14 -14
- package/lib/protocols/trade/transfer-v2.cjs +11 -11
- package/lib/protocols/trade/transfer-v3.cjs +6 -9
- package/lib/util.cjs +17 -0
- package/lib/util.d.cts +3 -1
- package/package.json +16 -18
- package/tools/fixtures.ts +2 -1
|
@@ -26,31 +26,34 @@ _ocap_merkle_tree = require_rolldown_runtime.__toESM(_ocap_merkle_tree);
|
|
|
26
26
|
//#region src/protocols/rollup/create-block.ts
|
|
27
27
|
const debug$1 = (0, debug.default)("@ocap/tx-protocols:create-rollup-block");
|
|
28
28
|
const runner = new _ocap_tx_pipeline.Runner("create_rollup_block");
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
const txHashString = _arcblock_validator.v.pipe(_arcblock_validator.v.string(), _arcblock_validator.v.regex(_arcblock_validator.patterns.txHash));
|
|
30
|
+
const schema = _arcblock_validator.v.pipe(_arcblock_validator.v.object({
|
|
31
|
+
hash: txHashString,
|
|
32
|
+
height: _arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.check((n) => n > 0, "Must be greater than 0")),
|
|
33
|
+
merkleRoot: txHashString,
|
|
34
|
+
previousHash: _arcblock_validator.v.optional(_arcblock_validator.v.nullable(_arcblock_validator.v.string())),
|
|
35
|
+
txsHash: txHashString,
|
|
36
|
+
txsList: _arcblock_validator.v.pipe(_arcblock_validator.v.array(txHashString), _arcblock_validator.v.minLength(1)),
|
|
37
|
+
proposer: (0, _arcblock_validator.vDID)({
|
|
38
|
+
prefix: true,
|
|
39
|
+
wallet: "ethereum"
|
|
37
40
|
}),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
minReward: _arcblock_validator.
|
|
44
|
-
governance: _arcblock_validator.
|
|
45
|
-
data: _arcblock_validator.
|
|
46
|
-
}).
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
41
|
+
signaturesList: _arcblock_validator.v.pipe(_arcblock_validator.schemas.multiSig, _arcblock_validator.v.minLength(1)),
|
|
42
|
+
rollup: (0, _arcblock_validator.vDID)({
|
|
43
|
+
prefix: true,
|
|
44
|
+
role: "ROLE_ROLLUP"
|
|
45
|
+
}),
|
|
46
|
+
minReward: (0, _arcblock_validator.vBN)((0, _arcblock_validator.vBNMin)(0)),
|
|
47
|
+
governance: _arcblock_validator.v.optional(_arcblock_validator.v.boolean(), false),
|
|
48
|
+
data: _arcblock_validator.v.optional(_arcblock_validator.v.nullable(_arcblock_validator.v.any()))
|
|
49
|
+
}), _arcblock_validator.v.forward(_arcblock_validator.v.check((input) => {
|
|
50
|
+
if (input.height === 1) return true;
|
|
51
|
+
return typeof input.previousHash === "string" && _arcblock_validator.patterns.txHash.test(input.previousHash);
|
|
52
|
+
}, "previousHash must match txHash pattern when height > 1"), ["previousHash"]), (0, _arcblock_validator.vStripUnknown)());
|
|
50
53
|
runner.use((context, next) => {
|
|
51
54
|
const { tx, itx } = context;
|
|
52
55
|
context.formattedItx = (0, _ocap_message.formatMessage)("CreateRollupBlockTx", itx);
|
|
53
|
-
const { error } =
|
|
56
|
+
const { error } = (0, _arcblock_validator.vValidate)(schema, itx);
|
|
54
57
|
if (error) return next(new _ocap_util_lib_error.CustomError("INVALID_TX", error.message));
|
|
55
58
|
if (tx.from !== itx.proposer) return next(new _ocap_util_lib_error.CustomError("INVALID_TX", "itx.proposer must be same with tx.from"));
|
|
56
59
|
if ((0, _ocap_util_lib_get_list_field.getListField)(tx, "signatures").some((x) => x.signer === itx.proposer) === false) return next(new _ocap_util_lib_error.CustomError("INVALID_TX", "itx.proposer must exist in signatures"));
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
3
|
+
const require_util = require('../../util.cjs');
|
|
3
4
|
const require_pipes_ensure_cost = require('../../pipes/ensure-cost.cjs');
|
|
4
5
|
const require_pipes_ensure_gas = require('../../pipes/ensure-gas.cjs');
|
|
5
6
|
const require_protocols_rollup_pipes_verify_signers = require('./pipes/verify-signers.cjs');
|
|
6
7
|
const require_protocols_rollup_pipes_verify_status = require('./pipes/verify-status.cjs');
|
|
7
8
|
const require_protocols_rollup_pipes_verify_evidence = require('./pipes/verify-evidence.cjs');
|
|
9
|
+
const require_index = require('../../node_modules/valibot/dist/index.cjs');
|
|
8
10
|
let _ocap_tx_pipeline = require("@ocap/tx-pipeline");
|
|
9
11
|
let _ocap_util_lib_error = require("@ocap/util/lib/error");
|
|
10
12
|
let _arcblock_did = require("@arcblock/did");
|
|
@@ -22,18 +24,18 @@ url_join = require_rolldown_runtime.__toESM(url_join);
|
|
|
22
24
|
//#region src/protocols/rollup/join.ts
|
|
23
25
|
const debug$1 = (0, debug.default)("@ocap/tx-protocols:join-rollup");
|
|
24
26
|
const runner = new _ocap_tx_pipeline.Runner("join_rollup");
|
|
25
|
-
const schema =
|
|
26
|
-
rollup: _arcblock_validator.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
});
|
|
27
|
+
const schema = require_index.pipe(require_index.object({
|
|
28
|
+
rollup: (0, _arcblock_validator.vDID)({
|
|
29
|
+
prefix: true,
|
|
30
|
+
role: "ROLE_ROLLUP"
|
|
31
|
+
}),
|
|
32
|
+
endpoint: require_index.pipe(require_index.string(), require_index.check(require_util.isHttpUrl, "Must be a valid HTTP/HTTPS URL")),
|
|
33
|
+
evidence: require_index.object({ hash: require_index.pipe(require_index.string(), require_index.regex(_arcblock_validator.patterns.txHash)) }),
|
|
34
|
+
signaturesList: require_index.pipe(_arcblock_validator.schemas.multiSig, require_index.minLength(1)),
|
|
35
|
+
data: require_index.optional(require_index.nullable(require_index.any()))
|
|
36
|
+
}), (0, _arcblock_validator.vStripUnknown)());
|
|
35
37
|
runner.use(({ itx }, next) => {
|
|
36
|
-
const { error } =
|
|
38
|
+
const { error } = (0, _arcblock_validator.vValidate)(schema, itx);
|
|
37
39
|
return next(error ? new _ocap_util_lib_error.CustomError("INVALID_TX", `Invalid itx: ${error.message}`) : void 0);
|
|
38
40
|
});
|
|
39
41
|
runner.use(_ocap_tx_pipeline.pipes.ExtractState({
|
|
@@ -6,6 +6,7 @@ const require_protocols_rollup_pipes_ensure_validator = require('./pipes/ensure-
|
|
|
6
6
|
const require_protocols_rollup_pipes_verify_signers = require('./pipes/verify-signers.cjs');
|
|
7
7
|
const require_protocols_rollup_pipes_verify_status = require('./pipes/verify-status.cjs');
|
|
8
8
|
const require_protocols_rollup_pipes_verify_evidence = require('./pipes/verify-evidence.cjs');
|
|
9
|
+
const require_index = require('../../node_modules/valibot/dist/index.cjs');
|
|
9
10
|
let _ocap_tx_pipeline = require("@ocap/tx-pipeline");
|
|
10
11
|
let _ocap_util_lib_error = require("@ocap/util/lib/error");
|
|
11
12
|
let _arcblock_did_util = require("@arcblock/did-util");
|
|
@@ -19,17 +20,17 @@ _ocap_merkle_tree = require_rolldown_runtime.__toESM(_ocap_merkle_tree);
|
|
|
19
20
|
//#region src/protocols/rollup/leave.ts
|
|
20
21
|
const debug$1 = (0, debug.default)("@ocap/tx-protocols:leave-rollup");
|
|
21
22
|
const runner = new _ocap_tx_pipeline.Runner("leave_rollup");
|
|
22
|
-
const schema =
|
|
23
|
-
rollup: _arcblock_validator.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
23
|
+
const schema = require_index.pipe(require_index.object({
|
|
24
|
+
rollup: (0, _arcblock_validator.vDID)({
|
|
25
|
+
prefix: true,
|
|
26
|
+
role: "ROLE_ROLLUP"
|
|
27
|
+
}),
|
|
28
|
+
evidence: require_index.object({ hash: require_index.pipe(require_index.string(), require_index.regex(_arcblock_validator.patterns.txHash)) }),
|
|
29
|
+
signaturesList: require_index.pipe(_arcblock_validator.schemas.multiSig, require_index.minLength(1)),
|
|
30
|
+
data: require_index.optional(require_index.nullable(require_index.any()))
|
|
31
|
+
}), (0, _arcblock_validator.vStripUnknown)());
|
|
31
32
|
runner.use(({ itx }, next) => {
|
|
32
|
-
const { error } =
|
|
33
|
+
const { error } = (0, _arcblock_validator.vValidate)(schema, itx);
|
|
33
34
|
return next(error ? new _ocap_util_lib_error.CustomError("INVALID_TX", `Invalid itx: ${error.message}`) : void 0);
|
|
34
35
|
});
|
|
35
36
|
runner.use(_ocap_tx_pipeline.pipes.ExtractState({
|
|
@@ -12,18 +12,21 @@ let _arcblock_validator = require("@arcblock/validator");
|
|
|
12
12
|
|
|
13
13
|
//#region src/protocols/rollup/migrate.ts
|
|
14
14
|
const runner = new _ocap_tx_pipeline.Runner("migrate_rollup");
|
|
15
|
-
const schema = _arcblock_validator.
|
|
16
|
-
rollup: _arcblock_validator.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
const schema = _arcblock_validator.v.pipe(_arcblock_validator.v.object({
|
|
16
|
+
rollup: (0, _arcblock_validator.vDID)({
|
|
17
|
+
prefix: true,
|
|
18
|
+
role: "ROLE_ROLLUP"
|
|
19
|
+
}),
|
|
20
|
+
to: (0, _arcblock_validator.vDID)({
|
|
21
|
+
prefix: true,
|
|
22
|
+
wallet: "ethereum"
|
|
23
|
+
}),
|
|
24
|
+
type: _arcblock_validator.v.pipe(_arcblock_validator.v.string(), _arcblock_validator.v.trim(), _arcblock_validator.v.check((s) => s === "vault" || s === "contract", "Must be vault or contract")),
|
|
25
|
+
message: _arcblock_validator.v.pipe(_arcblock_validator.v.string(), _arcblock_validator.v.trim(), _arcblock_validator.v.minLength(1), _arcblock_validator.v.maxLength(512)),
|
|
26
|
+
data: _arcblock_validator.v.optional(_arcblock_validator.v.nullable(_arcblock_validator.v.any()))
|
|
27
|
+
}), (0, _arcblock_validator.vStripUnknown)());
|
|
25
28
|
runner.use(({ itx }, next) => {
|
|
26
|
-
const { error } =
|
|
29
|
+
const { error } = (0, _arcblock_validator.vValidate)(schema, itx);
|
|
27
30
|
return next(error ? new _ocap_util_lib_error.CustomError("INVALID_TX", `Invalid itx: ${error.message}`) : void 0);
|
|
28
31
|
});
|
|
29
32
|
runner.use(_ocap_tx_pipeline.pipes.ExtractState({
|
|
@@ -12,15 +12,15 @@ let _arcblock_validator = require("@arcblock/validator");
|
|
|
12
12
|
|
|
13
13
|
//#region src/protocols/rollup/pause.ts
|
|
14
14
|
const runner = new _ocap_tx_pipeline.Runner("pause_rollup");
|
|
15
|
-
const schema = _arcblock_validator.
|
|
16
|
-
rollup: _arcblock_validator.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
});
|
|
15
|
+
const schema = _arcblock_validator.v.pipe(_arcblock_validator.v.object({
|
|
16
|
+
rollup: (0, _arcblock_validator.vDID)({
|
|
17
|
+
prefix: true,
|
|
18
|
+
role: "ROLE_ROLLUP"
|
|
19
|
+
}),
|
|
20
|
+
data: _arcblock_validator.v.optional(_arcblock_validator.v.nullable(_arcblock_validator.v.any()))
|
|
21
|
+
}), (0, _arcblock_validator.vStripUnknown)());
|
|
22
22
|
runner.use(({ itx }, next) => {
|
|
23
|
-
const { error } =
|
|
23
|
+
const { error } = (0, _arcblock_validator.vValidate)(schema, itx);
|
|
24
24
|
return next(error ? new _ocap_util_lib_error.CustomError("INVALID_TX", `Invalid itx: ${error.message}`) : void 0);
|
|
25
25
|
});
|
|
26
26
|
runner.use(_ocap_tx_pipeline.pipes.ExtractState({
|
|
@@ -12,15 +12,15 @@ let _arcblock_validator = require("@arcblock/validator");
|
|
|
12
12
|
|
|
13
13
|
//#region src/protocols/rollup/resume.ts
|
|
14
14
|
const runner = new _ocap_tx_pipeline.Runner("resume_rollup");
|
|
15
|
-
const schema = _arcblock_validator.
|
|
16
|
-
rollup: _arcblock_validator.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
});
|
|
15
|
+
const schema = _arcblock_validator.v.pipe(_arcblock_validator.v.object({
|
|
16
|
+
rollup: (0, _arcblock_validator.vDID)({
|
|
17
|
+
prefix: true,
|
|
18
|
+
role: "ROLE_ROLLUP"
|
|
19
|
+
}),
|
|
20
|
+
data: _arcblock_validator.v.optional(_arcblock_validator.v.nullable(_arcblock_validator.v.any()))
|
|
21
|
+
}), (0, _arcblock_validator.vStripUnknown)());
|
|
22
22
|
runner.use(({ itx }, next) => {
|
|
23
|
-
const { error } =
|
|
23
|
+
const { error } = (0, _arcblock_validator.vValidate)(schema, itx);
|
|
24
24
|
return next(error ? new _ocap_util_lib_error.CustomError("INVALID_TX", `Invalid itx: ${error.message}`) : void 0);
|
|
25
25
|
});
|
|
26
26
|
runner.use(_ocap_tx_pipeline.pipes.ExtractState({
|
|
@@ -6,6 +6,7 @@ const require_pipes_ensure_gas = require('../../pipes/ensure-gas.cjs');
|
|
|
6
6
|
const require_protocols_rollup_pipes_ensure_validator = require('./pipes/ensure-validator.cjs');
|
|
7
7
|
const require_protocols_rollup_pipes_verify_signers = require('./pipes/verify-signers.cjs');
|
|
8
8
|
const require_protocols_rollup_pipes_verify_status = require('./pipes/verify-status.cjs');
|
|
9
|
+
const require_bn$1 = require('../../node_modules/bn.js/lib/bn.cjs');
|
|
9
10
|
let _ocap_tx_pipeline = require("@ocap/tx-pipeline");
|
|
10
11
|
let _ocap_util_lib_error = require("@ocap/util/lib/error");
|
|
11
12
|
let _ocap_state = require("@ocap/state");
|
|
@@ -14,36 +15,37 @@ debug = require_rolldown_runtime.__toESM(debug);
|
|
|
14
15
|
let _arcblock_validator = require("@arcblock/validator");
|
|
15
16
|
|
|
16
17
|
//#region src/protocols/rollup/update.ts
|
|
18
|
+
var import_bn = /* @__PURE__ */ require_rolldown_runtime.__toESM(require_bn$1.default, 1);
|
|
17
19
|
const debug$1 = (0, debug.default)("@ocap/tx-protocols:update-rollup");
|
|
18
20
|
const runner = new _ocap_tx_pipeline.Runner("update_rollup");
|
|
19
|
-
const schema = _arcblock_validator.
|
|
20
|
-
rollup: _arcblock_validator.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
21
|
+
const schema = _arcblock_validator.v.pipe(_arcblock_validator.v.object({
|
|
22
|
+
rollup: (0, _arcblock_validator.vDID)({
|
|
23
|
+
prefix: true,
|
|
24
|
+
role: "ROLE_ROLLUP"
|
|
25
|
+
}),
|
|
26
|
+
minStakeAmount: (0, _arcblock_validator.vBN)((0, _arcblock_validator.vBNGreater)(0)),
|
|
27
|
+
maxStakeAmount: (0, _arcblock_validator.vBN)((0, _arcblock_validator.vBNGreater)(0)),
|
|
28
|
+
minSignerCount: _arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer()),
|
|
29
|
+
maxSignerCount: _arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1), _arcblock_validator.v.maxValue(8)),
|
|
30
|
+
minBlockSize: _arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1)),
|
|
31
|
+
maxBlockSize: _arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1), _arcblock_validator.v.maxValue(10)),
|
|
32
|
+
minBlockInterval: _arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1), _arcblock_validator.v.maxValue(3600)),
|
|
33
|
+
minBlockConfirmation: _arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1), _arcblock_validator.v.maxValue(100)),
|
|
34
|
+
minDepositAmount: (0, _arcblock_validator.vBN)((0, _arcblock_validator.vBNPositive)()),
|
|
35
|
+
maxDepositAmount: (0, _arcblock_validator.vBN)((0, _arcblock_validator.vBNPositive)()),
|
|
36
|
+
minWithdrawAmount: (0, _arcblock_validator.vBN)((0, _arcblock_validator.vBNPositive)()),
|
|
37
|
+
maxWithdrawAmount: (0, _arcblock_validator.vBN)((0, _arcblock_validator.vBNPositive)()),
|
|
38
|
+
depositFeeRate: _arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1), _arcblock_validator.v.maxValue(1e4)),
|
|
39
|
+
withdrawFeeRate: _arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1), _arcblock_validator.v.maxValue(1e4)),
|
|
40
|
+
publisherFeeShare: _arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1), _arcblock_validator.v.maxValue(1e4)),
|
|
41
|
+
minDepositFee: (0, _arcblock_validator.vBN)((0, _arcblock_validator.vBNPositive)()),
|
|
42
|
+
maxDepositFee: (0, _arcblock_validator.vBN)((0, _arcblock_validator.vBNPositive)()),
|
|
43
|
+
minWithdrawFee: (0, _arcblock_validator.vBN)((0, _arcblock_validator.vBNPositive)()),
|
|
44
|
+
maxWithdrawFee: (0, _arcblock_validator.vBN)((0, _arcblock_validator.vBNPositive)()),
|
|
45
|
+
data: _arcblock_validator.v.optional(_arcblock_validator.v.nullable(_arcblock_validator.v.any()))
|
|
46
|
+
}), _arcblock_validator.v.forward(_arcblock_validator.v.check((input) => new import_bn.default(input.maxStakeAmount).gt(new import_bn.default(input.minStakeAmount)), "maxStakeAmount must be > minStakeAmount"), ["maxStakeAmount"]), _arcblock_validator.v.forward(_arcblock_validator.v.check((input) => input.maxSignerCount > input.minSignerCount, "maxSignerCount must be > minSignerCount"), ["maxSignerCount"]), _arcblock_validator.v.forward(_arcblock_validator.v.check((input) => input.maxBlockSize > input.minBlockSize, "maxBlockSize must be > minBlockSize"), ["maxBlockSize"]), _arcblock_validator.v.forward(_arcblock_validator.v.check((input) => new import_bn.default(input.maxDepositAmount).gt(new import_bn.default(input.minDepositAmount)), "maxDepositAmount must be > minDepositAmount"), ["maxDepositAmount"]), _arcblock_validator.v.forward(_arcblock_validator.v.check((input) => new import_bn.default(input.maxWithdrawAmount).gt(new import_bn.default(input.minWithdrawAmount)), "maxWithdrawAmount must be > minWithdrawAmount"), ["maxWithdrawAmount"]), _arcblock_validator.v.forward(_arcblock_validator.v.check((input) => new import_bn.default(input.maxDepositFee).gt(new import_bn.default(input.minDepositFee)), "maxDepositFee must be > minDepositFee"), ["maxDepositFee"]), _arcblock_validator.v.forward(_arcblock_validator.v.check((input) => new import_bn.default(input.maxWithdrawFee).gt(new import_bn.default(input.minWithdrawFee)), "maxWithdrawFee must be > minWithdrawFee"), ["maxWithdrawFee"]), (0, _arcblock_validator.vStripUnknown)());
|
|
45
47
|
runner.use(({ itx }, next) => {
|
|
46
|
-
const { error } =
|
|
48
|
+
const { error } = (0, _arcblock_validator.vValidate)(schema, itx);
|
|
47
49
|
return next(error ? new _ocap_util_lib_error.CustomError("INVALID_TX", `Invalid itx: ${error.message}`) : void 0);
|
|
48
50
|
});
|
|
49
51
|
runner.use(_ocap_tx_pipeline.pipes.VerifyInfo([{
|
|
@@ -23,27 +23,30 @@ const debug$1 = (0, debug.default)("@ocap/tx-protocols:create-token");
|
|
|
23
23
|
const MAX_TOTAL_SUPPLY = (0, _ocap_util.fromTokenToUnit)(1e4 * 1e8, 18);
|
|
24
24
|
const runner = new _ocap_tx_pipeline.Runner("create_token");
|
|
25
25
|
runner.use(_ocap_tx_pipeline.pipes.VerifyMultiSig(0));
|
|
26
|
-
const schema = _arcblock_validator.
|
|
27
|
-
address: _arcblock_validator.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}).
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
})
|
|
26
|
+
const schema = _arcblock_validator.v.pipe(_arcblock_validator.v.object({
|
|
27
|
+
address: (0, _arcblock_validator.vDID)({
|
|
28
|
+
prefix: true,
|
|
29
|
+
role: "ROLE_TOKEN"
|
|
30
|
+
}),
|
|
31
|
+
name: _arcblock_validator.v.pipe(_arcblock_validator.v.string(), _arcblock_validator.v.minLength(1), _arcblock_validator.v.maxLength(32)),
|
|
32
|
+
description: _arcblock_validator.v.pipe(_arcblock_validator.v.string(), _arcblock_validator.v.minLength(16), _arcblock_validator.v.maxLength(128)),
|
|
33
|
+
symbol: _arcblock_validator.v.pipe(_arcblock_validator.v.string(), _arcblock_validator.v.minLength(2), _arcblock_validator.v.maxLength(6), _arcblock_validator.v.toUpperCase()),
|
|
34
|
+
unit: _arcblock_validator.v.pipe(_arcblock_validator.v.string(), _arcblock_validator.v.minLength(1), _arcblock_validator.v.maxLength(6), _arcblock_validator.v.toLowerCase()),
|
|
35
|
+
decimal: _arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.minValue(2), _arcblock_validator.v.maxValue(18)),
|
|
36
|
+
icon: _arcblock_validator.v.optional(_arcblock_validator.v.nullable(_arcblock_validator.v.literal(""))),
|
|
37
|
+
totalSupply: (0, _arcblock_validator.vBN)((0, _arcblock_validator.vBNGreater)(0), (0, _arcblock_validator.vBNMax)(MAX_TOTAL_SUPPLY)),
|
|
38
|
+
initialSupply: (0, _arcblock_validator.vBN)((0, _arcblock_validator.vBNGreater)(0)),
|
|
39
|
+
maxTotalSupply: _arcblock_validator.v.optional(_arcblock_validator.v.nullable(_arcblock_validator.v.union([(0, _arcblock_validator.vBN)((0, _arcblock_validator.vBNGreater)(0)), _arcblock_validator.v.literal("")]))),
|
|
40
|
+
foreignToken: _arcblock_validator.v.optional(_arcblock_validator.v.nullable(_arcblock_validator.schemas.foreignToken)),
|
|
41
|
+
spendersList: _arcblock_validator.v.optional(_arcblock_validator.v.nullable(_arcblock_validator.v.pipe(_arcblock_validator.v.array((0, _arcblock_validator.vDID)({ prefix: true })), _arcblock_validator.v.maxLength(30)))),
|
|
42
|
+
tokenFactoryAddress: _arcblock_validator.v.optional((0, _arcblock_validator.vForbidden)("tokenFactoryAddress is forbidden")),
|
|
43
|
+
data: _arcblock_validator.v.optional(_arcblock_validator.v.nullable(_arcblock_validator.v.any()))
|
|
44
|
+
}), _arcblock_validator.v.forward(_arcblock_validator.v.check((input) => new _ocap_util.BN(input.initialSupply).lte(new _ocap_util.BN(input.totalSupply)), "initialSupply must be <= totalSupply"), ["initialSupply"]), _arcblock_validator.v.forward(_arcblock_validator.v.check((input) => {
|
|
45
|
+
if (!input.maxTotalSupply || input.maxTotalSupply === "") return true;
|
|
46
|
+
return new _ocap_util.BN(input.maxTotalSupply).lte(new _ocap_util.BN(input.totalSupply));
|
|
47
|
+
}, "maxTotalSupply must be <= totalSupply"), ["maxTotalSupply"]), (0, _arcblock_validator.vStripUnknown)());
|
|
45
48
|
runner.use(({ itx }, next) => {
|
|
46
|
-
const { error, value } =
|
|
49
|
+
const { error, value } = (0, _arcblock_validator.vValidate)(schema, itx);
|
|
47
50
|
if (error) return next(new _ocap_util_lib_error.CustomError("INVALID_TX", `Invalid itx: ${error.message}`));
|
|
48
51
|
const spendersList = value.spendersList;
|
|
49
52
|
itx.spenders = spendersList?.length ? (0, lodash_uniq.default)(spendersList) : null;
|
|
@@ -17,21 +17,27 @@ let _arcblock_validator = require("@arcblock/validator");
|
|
|
17
17
|
|
|
18
18
|
//#region src/protocols/token/deposit-v2.ts
|
|
19
19
|
const debug$1 = (0, debug.default)("@ocap/tx-protocols:deposit-token");
|
|
20
|
-
const schema = _arcblock_validator.
|
|
21
|
-
token: _arcblock_validator.schemas.tokenInput
|
|
22
|
-
to: _arcblock_validator.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
const schema = _arcblock_validator.v.pipe(_arcblock_validator.v.object({
|
|
21
|
+
token: _arcblock_validator.schemas.tokenInput,
|
|
22
|
+
to: (0, _arcblock_validator.vDID)({
|
|
23
|
+
prefix: true,
|
|
24
|
+
wallet: "ethereum"
|
|
25
|
+
}),
|
|
26
|
+
proposer: (0, _arcblock_validator.vDID)({
|
|
27
|
+
prefix: true,
|
|
28
|
+
wallet: "ethereum"
|
|
29
|
+
}),
|
|
30
|
+
evidence: _arcblock_validator.v.object({ hash: _arcblock_validator.v.pipe(_arcblock_validator.v.string(), _arcblock_validator.v.regex(_arcblock_validator.patterns.txHash)) }),
|
|
31
|
+
rollup: (0, _arcblock_validator.vDID)({
|
|
32
|
+
prefix: true,
|
|
33
|
+
role: "ROLE_ROLLUP"
|
|
34
|
+
}),
|
|
35
|
+
actualFee: (0, _arcblock_validator.vBN)((0, _arcblock_validator.vBNMin)(0)),
|
|
36
|
+
data: _arcblock_validator.v.optional(_arcblock_validator.v.nullable(_arcblock_validator.v.any()))
|
|
37
|
+
}), (0, _arcblock_validator.vStripUnknown)());
|
|
32
38
|
const runner = new _ocap_tx_pipeline.Runner("deposit_token_v2");
|
|
33
39
|
runner.use(({ tx, itx }, next) => {
|
|
34
|
-
const { error } =
|
|
40
|
+
const { error } = (0, _arcblock_validator.vValidate)(schema, itx);
|
|
35
41
|
if (error) return next(new _ocap_util_lib_error.CustomError("INVALID_TX", `Invalid itx: ${error.message}`));
|
|
36
42
|
if (itx.to !== tx.from) return next(new _ocap_util_lib_error.CustomError("INVALID_TX", "You can only deposit to tx sender account"));
|
|
37
43
|
const signatures = (0, _ocap_util_lib_get_list_field.getListField)(tx, "signatures");
|
|
@@ -17,21 +17,27 @@ let _arcblock_validator = require("@arcblock/validator");
|
|
|
17
17
|
//#region src/protocols/token/withdraw-v2.ts
|
|
18
18
|
const debug$1 = (0, debug.default)("@ocap/tx-protocols:withdraw-token");
|
|
19
19
|
const verifyMultiSigV2 = _ocap_tx_pipeline.pipes.VerifyMultiSigV2({ signersKey: "signers" });
|
|
20
|
-
const schema = _arcblock_validator.
|
|
21
|
-
token: _arcblock_validator.schemas.tokenInput
|
|
22
|
-
to: _arcblock_validator.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
const schema = _arcblock_validator.v.pipe(_arcblock_validator.v.object({
|
|
21
|
+
token: _arcblock_validator.schemas.tokenInput,
|
|
22
|
+
to: (0, _arcblock_validator.vDID)({
|
|
23
|
+
prefix: true,
|
|
24
|
+
wallet: "ethereum"
|
|
25
|
+
}),
|
|
26
|
+
rollup: (0, _arcblock_validator.vDID)({
|
|
27
|
+
prefix: true,
|
|
28
|
+
role: "ROLE_ROLLUP"
|
|
29
|
+
}),
|
|
30
|
+
proposer: _arcblock_validator.v.optional(_arcblock_validator.v.nullable(_arcblock_validator.v.union([_arcblock_validator.v.literal(""), (0, _arcblock_validator.vDID)({
|
|
31
|
+
prefix: true,
|
|
32
|
+
wallet: "ethereum"
|
|
33
|
+
})])), ""),
|
|
34
|
+
actualFee: (0, _arcblock_validator.vBN)((0, _arcblock_validator.vBNMin)(0)),
|
|
35
|
+
maxFee: (0, _arcblock_validator.vBN)((0, _arcblock_validator.vBNMin)(0)),
|
|
36
|
+
data: _arcblock_validator.v.optional(_arcblock_validator.v.nullable(_arcblock_validator.v.any()))
|
|
37
|
+
}), (0, _arcblock_validator.vStripUnknown)());
|
|
32
38
|
const runner = new _ocap_tx_pipeline.Runner("withdraw_token_v2");
|
|
33
39
|
runner.use(({ tx, itx }, next) => {
|
|
34
|
-
const { error } =
|
|
40
|
+
const { error } = (0, _arcblock_validator.vValidate)(schema, itx);
|
|
35
41
|
if (error) return next(new _ocap_util_lib_error.CustomError("INVALID_TX", `Invalid itx: ${error.message}`));
|
|
36
42
|
if (itx.to !== tx.from) return next(new _ocap_util_lib_error.CustomError("INVALID_TX", "You can only withdraw to tx sender account"));
|
|
37
43
|
return next();
|
|
@@ -15,18 +15,18 @@ let _arcblock_validator = require("@arcblock/validator");
|
|
|
15
15
|
|
|
16
16
|
//#region src/protocols/token-factory/burn.ts
|
|
17
17
|
const runner = new _ocap_tx_pipeline.Runner("burn_token");
|
|
18
|
-
const schema = _arcblock_validator.
|
|
19
|
-
tokenFactory: _arcblock_validator.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
18
|
+
const schema = _arcblock_validator.v.pipe(_arcblock_validator.v.object({
|
|
19
|
+
tokenFactory: (0, _arcblock_validator.vDID)({
|
|
20
|
+
prefix: true,
|
|
21
|
+
role: "ROLE_TOKEN_FACTORY"
|
|
22
|
+
}),
|
|
23
|
+
receiver: _arcblock_validator.schemas.tokenHolder,
|
|
24
|
+
minReserve: _arcblock_validator.v.optional(_arcblock_validator.v.union([(0, _arcblock_validator.vBN)((0, _arcblock_validator.vBNGreater)(0)), _arcblock_validator.v.literal("")])),
|
|
25
|
+
inputsList: _arcblock_validator.v.pipe(_arcblock_validator.schemas.multiInput, _arcblock_validator.v.minLength(1)),
|
|
26
|
+
data: _arcblock_validator.v.optional(_arcblock_validator.v.nullable(_arcblock_validator.v.any()))
|
|
27
|
+
}), (0, _arcblock_validator.vStripUnknown)());
|
|
28
28
|
runner.use(({ itx }, next) => {
|
|
29
|
-
const { error } =
|
|
29
|
+
const { error } = (0, _arcblock_validator.vValidate)(schema, itx);
|
|
30
30
|
if (error) return next(new _ocap_util_lib_error.CustomError("INVALID_TX", `Invalid itx: ${error.message}`));
|
|
31
31
|
return next();
|
|
32
32
|
});
|
|
@@ -3,6 +3,7 @@ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
|
3
3
|
const require_util = require('../../util.cjs');
|
|
4
4
|
const require_pipes_ensure_cost = require('../../pipes/ensure-cost.cjs');
|
|
5
5
|
const require_pipes_ensure_gas = require('../../pipes/ensure-gas.cjs');
|
|
6
|
+
const require_index = require('../../node_modules/valibot/dist/index.cjs');
|
|
6
7
|
const require_protocols_token_factory_pipes_verify_icon = require('./pipes/verify-icon.cjs');
|
|
7
8
|
const require_protocols_token_factory_pipes_verify_ownership = require('./pipes/verify-ownership.cjs');
|
|
8
9
|
const require_protocols_token_factory_pipes_verify_url = require('./pipes/verify-url.cjs');
|
|
@@ -25,51 +26,58 @@ lodash_isEmpty = require_rolldown_runtime.__toESM(lodash_isEmpty);
|
|
|
25
26
|
//#region src/protocols/token-factory/create.ts
|
|
26
27
|
const debug$1 = (0, debug.default)("@ocap/tx-protocols:create-token-factory");
|
|
27
28
|
const runner = new _ocap_tx_pipeline.Runner("create_token_factory");
|
|
28
|
-
const
|
|
29
|
+
const isValidUrl = process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test" || process.env.CI ? require_util.isHttpUrl : require_util.isHttpsUrl;
|
|
29
30
|
runner.use(_ocap_tx_pipeline.pipes.VerifyMultiSig(0));
|
|
30
|
-
const schema =
|
|
31
|
-
address: _arcblock_validator.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
is: "CreditToken",
|
|
35
|
-
then: _arcblock_validator.Joi.valid(null).optional().messages({ "any.only": "Should not provide curve for CreditToken" }),
|
|
36
|
-
otherwise: _ocap_state.tokenFactory.curveSchema.required()
|
|
31
|
+
const schema = require_index.pipe(require_index.object({
|
|
32
|
+
address: (0, _arcblock_validator.vDID)({
|
|
33
|
+
prefix: true,
|
|
34
|
+
role: "ROLE_TOKEN_FACTORY"
|
|
37
35
|
}),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
});
|
|
36
|
+
feeRate: require_index.pipe(require_index.number(), require_index.minValue(0), require_index.maxValue(2e3)),
|
|
37
|
+
curve: require_index.optional(require_index.nullable(require_index.any())),
|
|
38
|
+
reserveAddress: (0, _arcblock_validator.vDID)({
|
|
39
|
+
prefix: true,
|
|
40
|
+
role: "ROLE_TOKEN"
|
|
41
|
+
}),
|
|
42
|
+
token: require_index.object({
|
|
43
|
+
name: require_index.pipe(require_index.string(), require_index.minLength(1), require_index.maxLength(32)),
|
|
44
|
+
description: require_index.pipe(require_index.string(), require_index.minLength(16), require_index.maxLength(128)),
|
|
45
|
+
symbol: require_index.pipe(require_index.string(), require_index.minLength(2), require_index.maxLength(6), require_index.toUpperCase()),
|
|
46
|
+
unit: require_index.pipe(require_index.string(), require_index.minLength(1), require_index.maxLength(6), require_index.toLowerCase()),
|
|
47
|
+
decimal: require_index.pipe(require_index.number(), require_index.minValue(2), require_index.maxValue(18)),
|
|
48
|
+
icon: require_index.optional(require_index.nullable(require_index.string())),
|
|
49
|
+
maxTotalSupply: require_index.optional(require_index.nullable(require_index.union([(0, _arcblock_validator.vBN)((0, _arcblock_validator.vBNGreater)(0)), require_index.literal("")]))),
|
|
50
|
+
website: require_index.optional(require_index.nullable(require_index.union([require_index.literal(""), require_index.pipe(require_index.string(), require_index.maxLength(256), require_index.check(isValidUrl, "Must be a valid URL"))]))),
|
|
51
|
+
metadata: require_index.any(),
|
|
52
|
+
spendersList: require_index.optional(require_index.nullable(require_index.pipe(require_index.array((0, _arcblock_validator.vDID)({ prefix: true })), require_index.maxLength(30))), null),
|
|
53
|
+
mintersList: require_index.optional(require_index.nullable(require_index.pipe(require_index.array((0, _arcblock_validator.vDID)({ prefix: true })), require_index.maxLength(30))), null),
|
|
54
|
+
type: require_index.picklist(["CreditToken", "BondingCurveToken"])
|
|
55
|
+
}),
|
|
56
|
+
data: require_index.optional(require_index.nullable(require_index.any()))
|
|
57
|
+
}), (0, _arcblock_validator.vStripUnknown)());
|
|
61
58
|
runner.use((context, next) => {
|
|
62
|
-
const { error, value } =
|
|
59
|
+
const { error, value } = (0, _arcblock_validator.vValidate)(schema, context.itx);
|
|
63
60
|
if (error) return next(new _ocap_util_lib_error.CustomError("INVALID_TX", `Invalid itx: ${error.message}`));
|
|
64
|
-
context.itx.
|
|
61
|
+
if (context.itx.token?.type === "CreditToken") {
|
|
62
|
+
if (context.itx.curve != null) return next(new _ocap_util_lib_error.CustomError("INVALID_TX", "Invalid itx: Should not provide curve for CreditToken"));
|
|
63
|
+
context.itx.curve = value.curve;
|
|
64
|
+
} else {
|
|
65
|
+
if (context.itx.curve == null) return next(new _ocap_util_lib_error.CustomError("INVALID_TX", "Invalid itx: curve is required for non-CreditToken"));
|
|
66
|
+
const curveResult = require_index.safeParse(_ocap_state.tokenFactory.vCurveSchema, context.itx.curve);
|
|
67
|
+
if (!curveResult.success) return next(new _ocap_util_lib_error.CustomError("INVALID_TX", `Invalid itx: ${curveResult.issues.map((i) => i.message).join("; ")}`));
|
|
68
|
+
context.itx.curve = curveResult.output;
|
|
69
|
+
}
|
|
65
70
|
const itxToken = context.itx.token;
|
|
66
71
|
if (itxToken.metadata) {
|
|
67
72
|
const metadata = require_util.decodeAnySafe(itxToken.metadata ?? null);
|
|
68
|
-
const { error: metadataError, value: metadataValue } = _ocap_state.token.metadataSchema
|
|
73
|
+
const { error: metadataError, value: metadataValue } = (0, _arcblock_validator.vValidate)(_ocap_state.token.metadataSchema, metadata?.value);
|
|
69
74
|
if (metadataError) return next(new _ocap_util_lib_error.CustomError("INVALID_TX", `Invalid metadata: ${metadataError.message}`));
|
|
75
|
+
const validKeys = new Set(Object.keys(metadataValue));
|
|
76
|
+
const orderedValue = {};
|
|
77
|
+
for (const key of Object.keys(metadata?.value || {})) if (validKeys.has(key)) orderedValue[key] = metadataValue[key];
|
|
70
78
|
itxToken.metadata = {
|
|
71
79
|
...metadata,
|
|
72
|
-
value:
|
|
80
|
+
value: orderedValue
|
|
73
81
|
};
|
|
74
82
|
}
|
|
75
83
|
const tokenWithLists = itxToken;
|