@everyprotocol/every-cli 0.1.15 → 0.1.17
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/abis2/IElementRegistry.json +1 -0
- package/abis2/IKindRegistry.json +1 -0
- package/abis2/IOmniRegistry.json +1 -0
- package/abis2/ISet.json +1 -0
- package/abis2/ISetRegistry.json +1 -0
- package/abis2/ObjectMinterAdmin.json +1 -0
- package/abis2/SetRegistryAdmin.json +1 -0
- package/abis2/events-errors.json +4407 -0
- package/dist/abi.js +3 -3
- package/dist/abi2.js +52 -0
- package/dist/abicmd.js +121 -0
- package/dist/artifact.js +1 -1
- package/dist/cmds/kind.js +34 -25
- package/dist/cmds/object.js +333 -160
- package/dist/cmds/set.js +84 -34
- package/dist/parsers.js +42 -5
- package/package.json +2 -1
package/dist/parsers.js
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import { u8aFixLength } from "@polkadot/util";
|
|
2
2
|
import { decodeAddress } from "@polkadot/util-crypto";
|
|
3
3
|
import { InvalidArgumentError } from "commander";
|
|
4
|
+
import { getAddress, hexToBytes, isHex, parseUnits } from "viem";
|
|
4
5
|
export function parseBigInt(arg) {
|
|
5
6
|
try {
|
|
6
7
|
return BigInt(arg);
|
|
7
8
|
}
|
|
8
9
|
catch (e /* eslint-disable-line */) {
|
|
9
|
-
throw new InvalidArgumentError("
|
|
10
|
+
throw new InvalidArgumentError("Invalid bigint");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export function parseInt(arg) {
|
|
14
|
+
try {
|
|
15
|
+
return Number.parseInt(arg);
|
|
16
|
+
}
|
|
17
|
+
catch (e /* eslint-disable-line */) {
|
|
18
|
+
throw new InvalidArgumentError("Invalid integer");
|
|
10
19
|
}
|
|
11
20
|
}
|
|
12
21
|
export function parseSID(arg) {
|
|
@@ -17,16 +26,44 @@ export function parseSID(arg) {
|
|
|
17
26
|
return { set, id };
|
|
18
27
|
}
|
|
19
28
|
catch (e /* eslint-disable-line */) {
|
|
20
|
-
throw new InvalidArgumentError(`
|
|
29
|
+
throw new InvalidArgumentError(`Invalid SID: ${arg}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export function parseEther(arg) {
|
|
33
|
+
try {
|
|
34
|
+
return parseUnits(arg, 18);
|
|
35
|
+
}
|
|
36
|
+
catch (e /* eslint-disable-line */) {
|
|
37
|
+
throw new InvalidArgumentError(`Invalid ether amount: ${arg}`);
|
|
21
38
|
}
|
|
22
39
|
}
|
|
23
|
-
export function parseAccountId(
|
|
40
|
+
export function parseAccountId(arg) {
|
|
24
41
|
try {
|
|
25
|
-
return u8aFixLength(decodeAddress(
|
|
42
|
+
return u8aFixLength(decodeAddress(arg), 256);
|
|
26
43
|
}
|
|
27
44
|
catch (e /* eslint-disable-line */) {
|
|
28
|
-
throw new InvalidArgumentError("
|
|
45
|
+
throw new InvalidArgumentError("Invalid account ID");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export function parseAddress(arg) {
|
|
49
|
+
try {
|
|
50
|
+
return getAddress(arg);
|
|
51
|
+
}
|
|
52
|
+
catch (e /* eslint-disable-line */) {
|
|
53
|
+
throw new InvalidArgumentError("Invalid address");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export function parseBytes32(arg) {
|
|
57
|
+
if (isHex(arg, { strict: true }) && hexToBytes(arg).length == 32) {
|
|
58
|
+
return arg;
|
|
59
|
+
}
|
|
60
|
+
throw new InvalidArgumentError("Invalid bytes32");
|
|
61
|
+
}
|
|
62
|
+
export function parseHexData(arg) {
|
|
63
|
+
if (isHex(arg, { strict: true })) {
|
|
64
|
+
return arg;
|
|
29
65
|
}
|
|
66
|
+
throw new InvalidArgumentError("Invalid hex data");
|
|
30
67
|
}
|
|
31
68
|
export function parseNode4(arg) {
|
|
32
69
|
const parts = arg.split(".");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everyprotocol/every-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.17",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/everyprotocol/cli.git"
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist/",
|
|
11
11
|
"abis/",
|
|
12
|
+
"abis2/",
|
|
12
13
|
".every.toml",
|
|
13
14
|
"LICENSE",
|
|
14
15
|
"README.md"
|