@ocap/config 1.31.8 → 1.32.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/default.mjs +5 -4
- package/esm/index.mjs +5 -5
- package/esm/schema.d.mts +1 -0
- package/esm/schema.mjs +2 -0
- package/lib/default.cjs +5 -4
- package/lib/index.cjs +4 -4
- package/lib/schema.cjs +2 -0
- package/lib/schema.d.cts +1 -0
- package/package.json +6 -6
package/esm/default.mjs
CHANGED
|
@@ -28,17 +28,18 @@ const defaultConfig = {
|
|
|
28
28
|
"fg:t:return_stake": 4096,
|
|
29
29
|
"fg:t:create_rollup": 8192,
|
|
30
30
|
"fg:t:update_rollup": 1691,
|
|
31
|
-
"fg:t:pause_rollup":
|
|
32
|
-
"fg:t:resume_rollup":
|
|
33
|
-
"fg:t:close_rollup":
|
|
31
|
+
"fg:t:pause_rollup": 8192,
|
|
32
|
+
"fg:t:resume_rollup": 8192,
|
|
33
|
+
"fg:t:close_rollup": 8192,
|
|
34
34
|
"fg:t:join_rollup": 4096,
|
|
35
35
|
"fg:t:leave_rollup": 4096,
|
|
36
|
-
"fg:t:migrate_rollup":
|
|
36
|
+
"fg:t:migrate_rollup": 8192,
|
|
37
37
|
"fg:t:create_rollup_block": 32768,
|
|
38
38
|
"fg:t:claim_block_reward": 1691,
|
|
39
39
|
"fg:t:mint_token": 4096,
|
|
40
40
|
"fg:t:burn_token": 4096,
|
|
41
41
|
"fg:t:deposit_token_v2_bridge": 8192,
|
|
42
|
+
"fg:t:update_rollup_bridge": 16384,
|
|
42
43
|
"fg:t:create_token_factory": Math.floor(20480),
|
|
43
44
|
"fg:t:update_token_factory": Math.floor(18075)
|
|
44
45
|
},
|
package/esm/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import default_default, { defaultGasSecurityKnobs } from "./default.mjs";
|
|
2
2
|
import schema_default, { decodePublicKeyCandidates } from "./schema.mjs";
|
|
3
|
-
import { isFromPublicKey, isValid, toTypeInfoStr } from "@arcblock/did";
|
|
3
|
+
import { isFromPublicKey, isValid, toAddress, toTypeInfoStr } from "@arcblock/did";
|
|
4
4
|
import { toTokenAddress } from "@arcblock/did-util";
|
|
5
5
|
import { vValidate } from "@arcblock/validator";
|
|
6
6
|
import { fromTokenToUnit } from "@ocap/util";
|
|
@@ -47,12 +47,12 @@ const genTokenItx = (config) => {
|
|
|
47
47
|
initialSupply: fromTokenToUnit(token.initialSupply || token.totalSupply, token.decimal).toString(),
|
|
48
48
|
issuer: moderator.address,
|
|
49
49
|
address: "",
|
|
50
|
-
foreignToken: token.foreignToken,
|
|
51
|
-
metadata: token.metadata,
|
|
50
|
+
foreignToken: token.foreignToken ? { ...token.foreignToken } : token.foreignToken,
|
|
51
|
+
metadata: token.metadata ? { ...token.metadata } : token.metadata,
|
|
52
52
|
website: token.website
|
|
53
53
|
};
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
54
|
+
const explicitAddr = token.address || process.env.CHAIN_TOKEN_ADDRESS;
|
|
55
|
+
if (explicitAddr && isValid(explicitAddr) && toTypeInfoStr(explicitAddr).role === "ROLE_TOKEN") itx.address = toAddress(explicitAddr);
|
|
56
56
|
else {
|
|
57
57
|
const { foreignToken, ...rest } = pick(itx, [
|
|
58
58
|
"name",
|
package/esm/schema.d.mts
CHANGED
|
@@ -87,6 +87,7 @@ declare const configSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
87
87
|
readonly txGas: v.OptionalSchema<v.ArraySchema<any, undefined>, undefined>;
|
|
88
88
|
}, undefined>, any>;
|
|
89
89
|
readonly token: v.OptionalSchema<v.ObjectSchema<{
|
|
90
|
+
readonly address: v.OptionalSchema<v.UnionSchema<v.UnionOptions, undefined>, undefined>;
|
|
90
91
|
readonly name: v.StringSchema<undefined>;
|
|
91
92
|
readonly description: v.StringSchema<undefined>;
|
|
92
93
|
readonly symbol: v.StringSchema<undefined>;
|
package/esm/schema.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import default_default from "./default.mjs";
|
|
2
|
+
import { toAddress } from "@arcblock/did";
|
|
2
3
|
import { v, vDID, vStripUnknown } from "@arcblock/validator";
|
|
3
4
|
import { fromBase58, fromBase64, isBase58btc, isHexStrict, toUint8Array } from "@ocap/util";
|
|
4
5
|
|
|
@@ -113,6 +114,7 @@ const configSchema = v.pipe(v.object({
|
|
|
113
114
|
txGas: v.optional(v.array(vDID({ prefix: true })))
|
|
114
115
|
}), {}),
|
|
115
116
|
token: v.optional(v.object({
|
|
117
|
+
address: v.optional(v.union([v.literal(""), v.pipe(vDID({ role: "ROLE_TOKEN" }), v.transform((val) => toAddress(val)))])),
|
|
116
118
|
name: v.string(),
|
|
117
119
|
description: v.string(),
|
|
118
120
|
symbol: v.string(),
|
package/lib/default.cjs
CHANGED
|
@@ -30,17 +30,18 @@ const defaultConfig = {
|
|
|
30
30
|
"fg:t:return_stake": 4096,
|
|
31
31
|
"fg:t:create_rollup": 8192,
|
|
32
32
|
"fg:t:update_rollup": 1691,
|
|
33
|
-
"fg:t:pause_rollup":
|
|
34
|
-
"fg:t:resume_rollup":
|
|
35
|
-
"fg:t:close_rollup":
|
|
33
|
+
"fg:t:pause_rollup": 8192,
|
|
34
|
+
"fg:t:resume_rollup": 8192,
|
|
35
|
+
"fg:t:close_rollup": 8192,
|
|
36
36
|
"fg:t:join_rollup": 4096,
|
|
37
37
|
"fg:t:leave_rollup": 4096,
|
|
38
|
-
"fg:t:migrate_rollup":
|
|
38
|
+
"fg:t:migrate_rollup": 8192,
|
|
39
39
|
"fg:t:create_rollup_block": 32768,
|
|
40
40
|
"fg:t:claim_block_reward": 1691,
|
|
41
41
|
"fg:t:mint_token": 4096,
|
|
42
42
|
"fg:t:burn_token": 4096,
|
|
43
43
|
"fg:t:deposit_token_v2_bridge": 8192,
|
|
44
|
+
"fg:t:update_rollup_bridge": 16384,
|
|
44
45
|
"fg:t:create_token_factory": Math.floor(20480),
|
|
45
46
|
"fg:t:update_token_factory": Math.floor(18075)
|
|
46
47
|
},
|
package/lib/index.cjs
CHANGED
|
@@ -51,12 +51,12 @@ const genTokenItx = (config) => {
|
|
|
51
51
|
initialSupply: (0, _ocap_util.fromTokenToUnit)(token.initialSupply || token.totalSupply, token.decimal).toString(),
|
|
52
52
|
issuer: moderator.address,
|
|
53
53
|
address: "",
|
|
54
|
-
foreignToken: token.foreignToken,
|
|
55
|
-
metadata: token.metadata,
|
|
54
|
+
foreignToken: token.foreignToken ? { ...token.foreignToken } : token.foreignToken,
|
|
55
|
+
metadata: token.metadata ? { ...token.metadata } : token.metadata,
|
|
56
56
|
website: token.website
|
|
57
57
|
};
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
58
|
+
const explicitAddr = token.address || process.env.CHAIN_TOKEN_ADDRESS;
|
|
59
|
+
if (explicitAddr && (0, _arcblock_did.isValid)(explicitAddr) && (0, _arcblock_did.toTypeInfoStr)(explicitAddr).role === "ROLE_TOKEN") itx.address = (0, _arcblock_did.toAddress)(explicitAddr);
|
|
60
60
|
else {
|
|
61
61
|
const { foreignToken, ...rest } = (0, lodash_pick.default)(itx, [
|
|
62
62
|
"name",
|
package/lib/schema.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
3
|
const require_default = require('./default.cjs');
|
|
4
|
+
let _arcblock_did = require("@arcblock/did");
|
|
4
5
|
let _arcblock_validator = require("@arcblock/validator");
|
|
5
6
|
let _ocap_util = require("@ocap/util");
|
|
6
7
|
|
|
@@ -115,6 +116,7 @@ const configSchema = _arcblock_validator.v.pipe(_arcblock_validator.v.object({
|
|
|
115
116
|
txGas: _arcblock_validator.v.optional(_arcblock_validator.v.array((0, _arcblock_validator.vDID)({ prefix: true })))
|
|
116
117
|
}), {}),
|
|
117
118
|
token: _arcblock_validator.v.optional(_arcblock_validator.v.object({
|
|
119
|
+
address: _arcblock_validator.v.optional(_arcblock_validator.v.union([_arcblock_validator.v.literal(""), _arcblock_validator.v.pipe((0, _arcblock_validator.vDID)({ role: "ROLE_TOKEN" }), _arcblock_validator.v.transform((val) => (0, _arcblock_did.toAddress)(val)))])),
|
|
118
120
|
name: _arcblock_validator.v.string(),
|
|
119
121
|
description: _arcblock_validator.v.string(),
|
|
120
122
|
symbol: _arcblock_validator.v.string(),
|
package/lib/schema.d.cts
CHANGED
|
@@ -87,6 +87,7 @@ declare const configSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
87
87
|
readonly txGas: v.OptionalSchema<v.ArraySchema<any, undefined>, undefined>;
|
|
88
88
|
}, undefined>, any>;
|
|
89
89
|
readonly token: v.OptionalSchema<v.ObjectSchema<{
|
|
90
|
+
readonly address: v.OptionalSchema<v.UnionSchema<v.UnionOptions, undefined>, undefined>;
|
|
90
91
|
readonly name: v.StringSchema<undefined>;
|
|
91
92
|
readonly description: v.StringSchema<undefined>;
|
|
92
93
|
readonly symbol: v.StringSchema<undefined>;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.32.0",
|
|
7
7
|
"description": "OCAP config parsing/validation and default",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "./lib/index.cjs",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"license": "MIT",
|
|
48
48
|
"devDependencies": {},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@arcblock/did": "1.
|
|
51
|
-
"@arcblock/did-util": "1.
|
|
52
|
-
"@arcblock/validator": "1.
|
|
50
|
+
"@arcblock/did": "1.32.0",
|
|
51
|
+
"@arcblock/did-util": "1.32.0",
|
|
52
|
+
"@arcblock/validator": "1.32.0",
|
|
53
53
|
"@noble/hashes": "2.2.0",
|
|
54
|
-
"@ocap/types": "1.
|
|
55
|
-
"@ocap/util": "1.
|
|
54
|
+
"@ocap/types": "1.32.0",
|
|
55
|
+
"@ocap/util": "1.32.0",
|
|
56
56
|
"lodash": "^4.17.23"
|
|
57
57
|
}
|
|
58
58
|
}
|