@monolythium/core-sdk 0.4.5 → 0.4.9
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/README.md +45 -1
- package/dist/crypto/index.cjs +36 -0
- package/dist/crypto/index.cjs.map +1 -1
- package/dist/crypto/index.d.cts +2 -2
- package/dist/crypto/index.d.ts +2 -2
- package/dist/crypto/index.js +36 -1
- package/dist/crypto/index.js.map +1 -1
- package/dist/index.cjs +710 -84
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +162 -42
- package/dist/index.d.ts +162 -42
- package/dist/index.js +663 -85
- package/dist/index.js.map +1 -1
- package/dist/{submission-D9k_xppI.d.cts → submission-7MkZky2W.d.cts} +141 -15
- package/dist/{submission-D9k_xppI.d.ts → submission-7MkZky2W.d.ts} +141 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -449,7 +449,13 @@ var NODE_REGISTRY_SELECTORS = {
|
|
|
449
449
|
/** `getClusterJoinRequest(uint32,bytes32)` — CJ-1 request status view. */
|
|
450
450
|
getClusterJoinRequest: "0x" + selectorHex("getClusterJoinRequest(uint32,bytes32)"),
|
|
451
451
|
/** `formCluster(bytes,bytes,bytes)` — no-foundation cluster formation by roster consent. */
|
|
452
|
-
formCluster: "0x" + selectorHex("formCluster(bytes,bytes,bytes)")
|
|
452
|
+
formCluster: "0x" + selectorHex("formCluster(bytes,bytes,bytes)"),
|
|
453
|
+
/** `setOperatorDisplay(bytes32,string,string)` — owner-callable public display metadata. */
|
|
454
|
+
setOperatorDisplay: "0x" + selectorHex("setOperatorDisplay(bytes32,string,string)"),
|
|
455
|
+
/** `publishOperatorSealKey(bytes32,bytes)` — owner-callable LythiumSeal EK publication. */
|
|
456
|
+
publishOperatorSealKey: "0x" + selectorHex("publishOperatorSealKey(bytes32,bytes)"),
|
|
457
|
+
/** `getOperatorSealKey(bytes32)` view — returns the operator's published LythiumSeal EK. */
|
|
458
|
+
getOperatorSealKey: "0x" + selectorHex("getOperatorSealKey(bytes32)")
|
|
453
459
|
};
|
|
454
460
|
var NODE_REGISTRY_CLUSTER_MEMBER_REF_BYTES = 48;
|
|
455
461
|
var NODE_REGISTRY_LEGACY_CLUSTER_MEMBER_PUBKEY_BYTES = NODE_REGISTRY_CLUSTER_MEMBER_REF_BYTES;
|
|
@@ -457,6 +463,7 @@ var NODE_REGISTRY_BLS_PUBKEY_BYTES = NODE_REGISTRY_CLUSTER_MEMBER_REF_BYTES;
|
|
|
457
463
|
var NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES = 1952;
|
|
458
464
|
var NODE_REGISTRY_CONSENSUS_SIGNATURE_BYTES = 3309;
|
|
459
465
|
var NODE_REGISTRY_CONSENSUS_POP_BYTES = 3309;
|
|
466
|
+
var NODE_REGISTRY_OPERATOR_SEAL_EK_BYTES = 1184;
|
|
460
467
|
var NODE_REGISTRY_DKG_ATTESTATION_SIG_BYTES = 96;
|
|
461
468
|
var NODE_REGISTRY_DKG_THRESHOLD_SIG_BYTES = NODE_REGISTRY_DKG_ATTESTATION_SIG_BYTES;
|
|
462
469
|
var NODE_REGISTRY_DKG_RESHARE_MIN_SIGNERS = 5;
|
|
@@ -467,6 +474,8 @@ var NODE_REGISTRY_FORM_CLUSTER_STANDBY_COUNT = 3;
|
|
|
467
474
|
var NODE_REGISTRY_FORM_CLUSTER_MEMBER_COUNT = NODE_REGISTRY_FORM_CLUSTER_ACTIVE_COUNT + NODE_REGISTRY_FORM_CLUSTER_STANDBY_COUNT;
|
|
468
475
|
var NODE_REGISTRY_FORM_CLUSTER_THRESHOLD = 7;
|
|
469
476
|
var NODE_REGISTRY_FORM_CLUSTER_MESSAGE_DOMAIN = "PROTOCORE_NODE_REGISTRY_CLUSTER_FORM_V1\0";
|
|
477
|
+
var NODE_REGISTRY_OPERATOR_MONIKER_MAX_BYTES = 128;
|
|
478
|
+
var NODE_REGISTRY_OPERATOR_ALIAS_MAX_BYTES = 64;
|
|
470
479
|
var PENDING_CHANGE_KIND_CODES = {
|
|
471
480
|
add: 1,
|
|
472
481
|
remove: 2,
|
|
@@ -675,6 +684,68 @@ function encodeVoteClusterAdmitCalldata(args) {
|
|
|
675
684
|
)
|
|
676
685
|
);
|
|
677
686
|
}
|
|
687
|
+
function encodeSetOperatorDisplayCalldata(args) {
|
|
688
|
+
const peerId = expectLength2(toBytes(args.peerId), 32, "peerId");
|
|
689
|
+
const moniker = displayTextBytes(
|
|
690
|
+
args.moniker,
|
|
691
|
+
NODE_REGISTRY_OPERATOR_MONIKER_MAX_BYTES,
|
|
692
|
+
"moniker"
|
|
693
|
+
);
|
|
694
|
+
const alias = displayTextBytes(args.alias, NODE_REGISTRY_OPERATOR_ALIAS_MAX_BYTES, "alias");
|
|
695
|
+
const monikerPadded = padToWord(moniker);
|
|
696
|
+
const aliasPadded = padToWord(alias);
|
|
697
|
+
const monikerOffset = 3n * 32n;
|
|
698
|
+
const aliasOffset = monikerOffset + 32n + BigInt(monikerPadded.length);
|
|
699
|
+
return bytesToHex(
|
|
700
|
+
concatBytes(
|
|
701
|
+
hexToBytes(NODE_REGISTRY_SELECTORS.setOperatorDisplay),
|
|
702
|
+
peerId,
|
|
703
|
+
uint64Word(monikerOffset, "monikerOffset"),
|
|
704
|
+
uint64Word(aliasOffset, "aliasOffset"),
|
|
705
|
+
uint64Word(BigInt(moniker.length), "monikerLength"),
|
|
706
|
+
monikerPadded,
|
|
707
|
+
uint64Word(BigInt(alias.length), "aliasLength"),
|
|
708
|
+
aliasPadded
|
|
709
|
+
)
|
|
710
|
+
);
|
|
711
|
+
}
|
|
712
|
+
function encodePublishOperatorSealKeyCalldata(args) {
|
|
713
|
+
const peerId = expectLength2(toBytes(args.peerId), 32, "peerId");
|
|
714
|
+
const sealEk = expectNonZeroBytes(
|
|
715
|
+
expectLength2(toBytes(args.sealEk), NODE_REGISTRY_OPERATOR_SEAL_EK_BYTES, "sealEk"),
|
|
716
|
+
"sealEk"
|
|
717
|
+
);
|
|
718
|
+
const sealEkPadded = padToWord(sealEk);
|
|
719
|
+
return bytesToHex(
|
|
720
|
+
concatBytes(
|
|
721
|
+
hexToBytes(NODE_REGISTRY_SELECTORS.publishOperatorSealKey),
|
|
722
|
+
peerId,
|
|
723
|
+
uint64Word(2n * 32n, "sealEkOffset"),
|
|
724
|
+
uint64Word(BigInt(sealEk.length), "sealEkLength"),
|
|
725
|
+
sealEkPadded
|
|
726
|
+
)
|
|
727
|
+
);
|
|
728
|
+
}
|
|
729
|
+
function encodeGetOperatorSealKeyCalldata(args) {
|
|
730
|
+
return bytesToHex(
|
|
731
|
+
concatBytes(
|
|
732
|
+
hexToBytes(NODE_REGISTRY_SELECTORS.getOperatorSealKey),
|
|
733
|
+
expectLength2(toBytes(args.operatorId), 32, "operatorId")
|
|
734
|
+
)
|
|
735
|
+
);
|
|
736
|
+
}
|
|
737
|
+
function decodeOperatorSealKey(returnData) {
|
|
738
|
+
const bytes = toBytes(returnData);
|
|
739
|
+
if (bytes.length === NODE_REGISTRY_OPERATOR_SEAL_EK_BYTES) {
|
|
740
|
+
return bytesToHex(expectNonZeroBytes(bytes, "operatorSealKey"));
|
|
741
|
+
}
|
|
742
|
+
const sealEk = decodeDynamicBytesResult(
|
|
743
|
+
bytes,
|
|
744
|
+
NODE_REGISTRY_OPERATOR_SEAL_EK_BYTES,
|
|
745
|
+
"operatorSealKey"
|
|
746
|
+
);
|
|
747
|
+
return bytesToHex(expectNonZeroBytes(sealEk, "operatorSealKey"));
|
|
748
|
+
}
|
|
678
749
|
function encodeCancelClusterJoinCalldata(args) {
|
|
679
750
|
return bytesToHex(
|
|
680
751
|
concatBytes(
|
|
@@ -1048,6 +1119,19 @@ function toBytes(value) {
|
|
|
1048
1119
|
}
|
|
1049
1120
|
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
1050
1121
|
}
|
|
1122
|
+
function displayTextBytes(value, maxBytes, name) {
|
|
1123
|
+
for (const ch of value) {
|
|
1124
|
+
const code = ch.codePointAt(0);
|
|
1125
|
+
if (code !== void 0 && (code >= 0 && code <= 31 || code >= 127 && code <= 159)) {
|
|
1126
|
+
throw new NodeRegistryError(`${name} must not contain control characters`);
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
const bytes = new TextEncoder().encode(value);
|
|
1130
|
+
if (bytes.length > maxBytes) {
|
|
1131
|
+
throw new NodeRegistryError(`${name} must be <= ${maxBytes} UTF-8 bytes`);
|
|
1132
|
+
}
|
|
1133
|
+
return bytes;
|
|
1134
|
+
}
|
|
1051
1135
|
function hexToBytes(hex) {
|
|
1052
1136
|
const body = hex.startsWith("0x") || hex.startsWith("0X") ? hex.slice(2) : hex;
|
|
1053
1137
|
if (body.length % 2 !== 0 || !/^[0-9a-fA-F]*$/.test(body)) {
|
|
@@ -1077,6 +1161,30 @@ function expectLength2(value, len, name) {
|
|
|
1077
1161
|
}
|
|
1078
1162
|
return value;
|
|
1079
1163
|
}
|
|
1164
|
+
function expectNonZeroBytes(value, name) {
|
|
1165
|
+
if (value.every((byte) => byte === 0)) {
|
|
1166
|
+
throw new NodeRegistryError(`${name} must not be all-zero`);
|
|
1167
|
+
}
|
|
1168
|
+
return value;
|
|
1169
|
+
}
|
|
1170
|
+
function decodeDynamicBytesResult(bytes, expectedLength, label) {
|
|
1171
|
+
if (bytes.length < 64) {
|
|
1172
|
+
throw new NodeRegistryError(`${label} return must be ABI-encoded dynamic bytes`);
|
|
1173
|
+
}
|
|
1174
|
+
const offset = uintFromWord(bytes.slice(0, 32));
|
|
1175
|
+
if (offset !== 32n) {
|
|
1176
|
+
throw new NodeRegistryError(`${label} return offset must be 0x20`);
|
|
1177
|
+
}
|
|
1178
|
+
const len = uintFromWord(bytes.slice(32, 64));
|
|
1179
|
+
if (len !== BigInt(expectedLength)) {
|
|
1180
|
+
throw new NodeRegistryError(`${label} must be ${expectedLength} bytes, got ${len}`);
|
|
1181
|
+
}
|
|
1182
|
+
const paddedLen = Math.ceil(expectedLength / 32) * 32;
|
|
1183
|
+
if (bytes.length < 64 + paddedLen) {
|
|
1184
|
+
throw new NodeRegistryError(`${label} body is truncated`);
|
|
1185
|
+
}
|
|
1186
|
+
return bytes.slice(64, 64 + expectedLength);
|
|
1187
|
+
}
|
|
1080
1188
|
|
|
1081
1189
|
// src/crypto/bytes.ts
|
|
1082
1190
|
function concatBytes2(...chunks) {
|
|
@@ -1322,6 +1430,7 @@ var MlDsa65Backend = class _MlDsa65Backend {
|
|
|
1322
1430
|
#secretKey;
|
|
1323
1431
|
#publicKey;
|
|
1324
1432
|
#addressBytes;
|
|
1433
|
+
#disposed = false;
|
|
1325
1434
|
constructor(secretKey, publicKey) {
|
|
1326
1435
|
this.#secretKey = expectBytes(secretKey, ML_DSA_65_SIGNING_KEY_LEN, "ML-DSA-65 secret key").slice();
|
|
1327
1436
|
this.#publicKey = expectBytes(publicKey, ML_DSA_65_PUBLIC_KEY_LEN, "ML-DSA-65 public key").slice();
|
|
@@ -1341,8 +1450,35 @@ var MlDsa65Backend = class _MlDsa65Backend {
|
|
|
1341
1450
|
return bytesToHex2(this.#addressBytes);
|
|
1342
1451
|
}
|
|
1343
1452
|
sign(message) {
|
|
1453
|
+
if (this.#disposed) {
|
|
1454
|
+
throw new Error("MlDsa65Backend disposed");
|
|
1455
|
+
}
|
|
1344
1456
|
return ml_dsa65.sign(message, this.#secretKey, { extraEntropy: false });
|
|
1345
1457
|
}
|
|
1458
|
+
/**
|
|
1459
|
+
* Best-effort deterministic wipe of the in-memory secret key. Zeroes the
|
|
1460
|
+
* SDK-held `#secretKey` copy and makes any subsequent `sign()` /
|
|
1461
|
+
* `signPrehash()` / `signEvmTx()` throw `"MlDsa65Backend disposed"` rather
|
|
1462
|
+
* than signing with a zeroed key. Idempotent. Public material
|
|
1463
|
+
* (`publicKey()` / `getAddress()` / `verify()`) stays usable.
|
|
1464
|
+
*
|
|
1465
|
+
* Defense-in-depth (S1-01): narrows the post-lock residency window of the
|
|
1466
|
+
* ML-DSA-65 secret in the JS heap. `@noble/post-quantum`'s internal
|
|
1467
|
+
* transient keygen/sign buffers are out of scope; the SDK-held copy is the
|
|
1468
|
+
* meaningful residency win.
|
|
1469
|
+
*/
|
|
1470
|
+
dispose() {
|
|
1471
|
+
this.#secretKey.fill(0);
|
|
1472
|
+
this.#disposed = true;
|
|
1473
|
+
}
|
|
1474
|
+
/** Alias for {@link dispose}. */
|
|
1475
|
+
zeroize() {
|
|
1476
|
+
this.dispose();
|
|
1477
|
+
}
|
|
1478
|
+
/** Whether {@link dispose} has been called (the secret key is wiped). */
|
|
1479
|
+
get disposed() {
|
|
1480
|
+
return this.#disposed;
|
|
1481
|
+
}
|
|
1346
1482
|
signPrehash(digest) {
|
|
1347
1483
|
return this.sign(expectBytes(digest, 32, "prehash"));
|
|
1348
1484
|
}
|
|
@@ -2704,8 +2840,8 @@ var TESTNET_69420 = {
|
|
|
2704
2840
|
network: "testnet-69420",
|
|
2705
2841
|
display_name: "Monolythium Testnet",
|
|
2706
2842
|
description: "Public Monolythium testnet. Testnet state may reset without notice; do not store value on this network.",
|
|
2707
|
-
genesis_hash: "
|
|
2708
|
-
binary_sha: "
|
|
2843
|
+
genesis_hash: "0x4327b7e8d1c06eed00194152f8235acaec5ba84a01487c885d9933840dc36fa5",
|
|
2844
|
+
binary_sha: "898cf29081ec",
|
|
2709
2845
|
rpc: [
|
|
2710
2846
|
{
|
|
2711
2847
|
url: "http://178.105.12.9:8545",
|
|
@@ -2766,7 +2902,7 @@ var TESTNET_69420 = {
|
|
|
2766
2902
|
{
|
|
2767
2903
|
url: "http://162.55.54.198:8545",
|
|
2768
2904
|
provider: "monolythium-foundation",
|
|
2769
|
-
region: "
|
|
2905
|
+
region: "fsn1",
|
|
2770
2906
|
tier: "official",
|
|
2771
2907
|
notes: "operator-9"
|
|
2772
2908
|
},
|
|
@@ -2777,24 +2913,10 @@ var TESTNET_69420 = {
|
|
|
2777
2913
|
tier: "official",
|
|
2778
2914
|
notes: "operator-10"
|
|
2779
2915
|
},
|
|
2780
|
-
{
|
|
2781
|
-
url: "http://5.223.65.201:8545",
|
|
2782
|
-
provider: "monolythium-foundation",
|
|
2783
|
-
region: "sin",
|
|
2784
|
-
tier: "official",
|
|
2785
|
-
notes: "operator-11; APAC"
|
|
2786
|
-
},
|
|
2787
|
-
{
|
|
2788
|
-
url: "http://128.140.125.5:8545",
|
|
2789
|
-
provider: "monolythium-foundation",
|
|
2790
|
-
region: "fsn1",
|
|
2791
|
-
tier: "official",
|
|
2792
|
-
notes: "operator-12"
|
|
2793
|
-
},
|
|
2794
2916
|
{
|
|
2795
2917
|
url: "http://178.105.45.210:8545",
|
|
2796
2918
|
provider: "monolythium-foundation",
|
|
2797
|
-
region: "
|
|
2919
|
+
region: "fsn1",
|
|
2798
2920
|
tier: "official",
|
|
2799
2921
|
notes: "relay-1"
|
|
2800
2922
|
},
|
|
@@ -2808,52 +2930,52 @@ var TESTNET_69420 = {
|
|
|
2808
2930
|
],
|
|
2809
2931
|
p2p: [
|
|
2810
2932
|
{
|
|
2811
|
-
multiaddr: "/ip4/178.105.12.9/tcp/29898/p2p/
|
|
2933
|
+
multiaddr: "/ip4/178.105.12.9/tcp/29898/p2p/12D3KooWGgh9vYbNSqYbci8w7bg2AAaFWx7umN1ADjjcUoUTF2Za",
|
|
2812
2934
|
region: "fsn1"
|
|
2813
2935
|
},
|
|
2814
2936
|
{
|
|
2815
|
-
multiaddr: "/ip4/178.105.15.216/tcp/29898/p2p/
|
|
2937
|
+
multiaddr: "/ip4/178.105.15.216/tcp/29898/p2p/12D3KooWPUMj4vt1ee1Ug2QMJQwbDHSJ936JVaqw3iLXtAqPrq7R",
|
|
2816
2938
|
region: "fsn1"
|
|
2817
2939
|
},
|
|
2818
2940
|
{
|
|
2819
|
-
multiaddr: "/ip4/178.104.233.182/tcp/29898/p2p/
|
|
2941
|
+
multiaddr: "/ip4/178.104.233.182/tcp/29898/p2p/12D3KooWLPNJFUZhXyc1S7YvjMiKXyrNKCN3eFegDFF5UZAio7NJ",
|
|
2820
2942
|
region: "nbg1"
|
|
2821
2943
|
},
|
|
2822
2944
|
{
|
|
2823
|
-
multiaddr: "/ip4/65.108.94.1/tcp/29898/p2p/
|
|
2945
|
+
multiaddr: "/ip4/65.108.94.1/tcp/29898/p2p/12D3KooWRAuuQa5iEAzLUpLnyZ9VM53dvZMt3FPj7smDcwXn3oxz",
|
|
2824
2946
|
region: "hel1"
|
|
2825
2947
|
},
|
|
2826
2948
|
{
|
|
2827
|
-
multiaddr: "/ip4/95.216.154.155/tcp/29898/p2p/
|
|
2949
|
+
multiaddr: "/ip4/95.216.154.155/tcp/29898/p2p/12D3KooWFc9sVuCAuLxFTVy8KN5KXhyDvPjKkU98ySK81dFyStN8",
|
|
2828
2950
|
region: "hel1"
|
|
2829
2951
|
},
|
|
2830
2952
|
{
|
|
2831
|
-
multiaddr: "/ip4/87.99.145.48/tcp/29898/p2p/
|
|
2953
|
+
multiaddr: "/ip4/87.99.145.48/tcp/29898/p2p/12D3KooWL2KLRUHybGLd736nusDRTF2V1a9waeTsxKPwF78HDCmb",
|
|
2832
2954
|
region: "ash"
|
|
2833
2955
|
},
|
|
2834
2956
|
{
|
|
2835
|
-
multiaddr: "/ip4/5.223.85.76/tcp/29898/p2p/
|
|
2957
|
+
multiaddr: "/ip4/5.223.85.76/tcp/29898/p2p/12D3KooWHvobdzzEAiKcFkgdkRfr8vWGyWYfBoWS3jnPycvfwGrK",
|
|
2836
2958
|
region: "sin"
|
|
2837
2959
|
},
|
|
2838
2960
|
{
|
|
2839
|
-
multiaddr: "/ip4/142.132.180.99/tcp/29898/p2p/
|
|
2961
|
+
multiaddr: "/ip4/142.132.180.99/tcp/29898/p2p/12D3KooWBcAeWScYmDWPTjNM47CkKR4vEf44CNhDCcWuGpyY7Hko",
|
|
2840
2962
|
region: "fsn1"
|
|
2841
2963
|
},
|
|
2842
2964
|
{
|
|
2843
|
-
multiaddr: "/ip4/162.55.54.198/tcp/29898/p2p/
|
|
2844
|
-
region: "
|
|
2965
|
+
multiaddr: "/ip4/162.55.54.198/tcp/29898/p2p/12D3KooWRBA5Wzs619GuMY2NrDD6fGoLYCK2tkXff2JAZyXn7RvR",
|
|
2966
|
+
region: "fsn1"
|
|
2845
2967
|
},
|
|
2846
2968
|
{
|
|
2847
|
-
multiaddr: "/ip4/95.217.156.190/tcp/29898/p2p/
|
|
2969
|
+
multiaddr: "/ip4/95.217.156.190/tcp/29898/p2p/12D3KooWPBr8guuWoZT59AobZEBHDZqKgwHWAP3aKUzKWeGTa7Z6",
|
|
2848
2970
|
region: "hel1"
|
|
2849
2971
|
},
|
|
2850
2972
|
{
|
|
2851
|
-
multiaddr: "/ip4/
|
|
2852
|
-
region: "
|
|
2973
|
+
multiaddr: "/ip4/178.105.45.210/tcp/29898/p2p/12D3KooWQRpCMLezJmvqqpbpEu8ixGHgonqianG1aVZjw6GiStbd",
|
|
2974
|
+
region: "fsn1"
|
|
2853
2975
|
},
|
|
2854
2976
|
{
|
|
2855
|
-
multiaddr: "/ip4/
|
|
2856
|
-
region: "
|
|
2977
|
+
multiaddr: "/ip4/65.21.252.34/tcp/29898/p2p/12D3KooWRGzTwPX21Nee2c39RWuT2ayNWb6NMX19jCx8recrNeXL",
|
|
2978
|
+
region: "hel1"
|
|
2857
2979
|
}
|
|
2858
2980
|
]
|
|
2859
2981
|
};
|
|
@@ -3650,6 +3772,16 @@ var RpcClient = class _RpcClient {
|
|
|
3650
3772
|
async ethGetCode(address, block = "latest") {
|
|
3651
3773
|
return this.call("eth_getCode", [address, encodeBlockSelector(block)]);
|
|
3652
3774
|
}
|
|
3775
|
+
/** `eth_call` — read-only execution against committed state. */
|
|
3776
|
+
async ethCall(request, block = "latest") {
|
|
3777
|
+
return this.call("eth_call", [request, encodeBlockSelector(block)]);
|
|
3778
|
+
}
|
|
3779
|
+
/** `eth_estimateGas` — read-only execution-unit estimate for a call object. */
|
|
3780
|
+
async ethEstimateGas(request, block = "latest") {
|
|
3781
|
+
return parseQuantityBig(
|
|
3782
|
+
await this.call("eth_estimateGas", [request, encodeBlockSelector(block)])
|
|
3783
|
+
);
|
|
3784
|
+
}
|
|
3653
3785
|
/** Compatibility block-header read by height/tag. */
|
|
3654
3786
|
async ethGetBlockByNumber(block = "latest") {
|
|
3655
3787
|
return normalizeBlockHeader(await this.call(ethCompatMethod("getBlockByNumber"), [encodeBlockSelector(block)]));
|
|
@@ -8348,6 +8480,7 @@ function pqm1MnemonicToMlDsa65Backend(mnemonic) {
|
|
|
8348
8480
|
|
|
8349
8481
|
// src/cluster-join.ts
|
|
8350
8482
|
var DEFAULT_CLUSTER_JOIN_EXECUTION_UNIT_LIMIT = REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT;
|
|
8483
|
+
var DEFAULT_OPERATOR_SEAL_KEY_EXECUTION_UNIT_LIMIT = REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT;
|
|
8351
8484
|
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
8352
8485
|
var MAX_UINT32 = (1n << 32n) - 1n;
|
|
8353
8486
|
function deriveClusterJoinOperatorId(operatorPubkey) {
|
|
@@ -8455,6 +8588,24 @@ function buildVoteClusterAdmitTxFields(args) {
|
|
|
8455
8588
|
})
|
|
8456
8589
|
};
|
|
8457
8590
|
}
|
|
8591
|
+
function buildPublishOperatorSealKeyTxFields(args) {
|
|
8592
|
+
return {
|
|
8593
|
+
chainId: args.chainId,
|
|
8594
|
+
nonce: args.nonce,
|
|
8595
|
+
maxFeePerGas: parseBigint(args.fee.maxFeePerGas, "maxFeePerGas"),
|
|
8596
|
+
maxPriorityFeePerGas: parseBigint(args.fee.maxPriorityFeePerGas, "maxPriorityFeePerGas"),
|
|
8597
|
+
gasLimit: parseBigint(
|
|
8598
|
+
args.fee.gasLimit ?? DEFAULT_OPERATOR_SEAL_KEY_EXECUTION_UNIT_LIMIT,
|
|
8599
|
+
"gasLimit"
|
|
8600
|
+
),
|
|
8601
|
+
to: nodeRegistryAddressHex(),
|
|
8602
|
+
value: 0n,
|
|
8603
|
+
input: encodePublishOperatorSealKeyCalldata({
|
|
8604
|
+
peerId: normalizeOperatorId(args.peerId),
|
|
8605
|
+
sealEk: normalizeOperatorSealEk(args.sealEk)
|
|
8606
|
+
})
|
|
8607
|
+
};
|
|
8608
|
+
}
|
|
8458
8609
|
async function submitRequestClusterJoin(args) {
|
|
8459
8610
|
const clusterId = parseUint32(args.clusterId, "clusterId");
|
|
8460
8611
|
const operatorPubkey = normalizeConsensusPubkey(args.operatorPubkey, "operatorPubkey");
|
|
@@ -8510,6 +8661,39 @@ async function submitVoteClusterAdmit(args) {
|
|
|
8510
8661
|
});
|
|
8511
8662
|
return submitClusterJoinTx(args.client, backend, tx, clusterId, operatorIdHex, args);
|
|
8512
8663
|
}
|
|
8664
|
+
async function submitPublishOperatorSealKey(args) {
|
|
8665
|
+
const operatorIdHex = normalizeOperatorId(args.peerId);
|
|
8666
|
+
const sealEk = normalizeOperatorSealEk(args.sealEk);
|
|
8667
|
+
const backend = pqm1MnemonicToMlDsa65Backend(args.mnemonic);
|
|
8668
|
+
const senderAddress = addressToTypedBech32("user", backend.addressBytes());
|
|
8669
|
+
const [chainId, nonce, quote] = await Promise.all([
|
|
8670
|
+
args.client.ethChainId(),
|
|
8671
|
+
args.client.lythGetTransactionCount(senderAddress),
|
|
8672
|
+
args.client.lythExecutionUnitPrice()
|
|
8673
|
+
]);
|
|
8674
|
+
const tx = buildPublishOperatorSealKeyTxFields({
|
|
8675
|
+
chainId,
|
|
8676
|
+
nonce,
|
|
8677
|
+
fee: resolveClusterJoinExecutionFee(quote, {
|
|
8678
|
+
...args,
|
|
8679
|
+
executionUnitLimit: args.executionUnitLimit ?? DEFAULT_OPERATOR_SEAL_KEY_EXECUTION_UNIT_LIMIT
|
|
8680
|
+
}),
|
|
8681
|
+
peerId: operatorIdHex,
|
|
8682
|
+
sealEk
|
|
8683
|
+
});
|
|
8684
|
+
const plaintext = buildPlaintextSubmission({ backend, tx });
|
|
8685
|
+
const txHash = await submitPlaintextTransaction(
|
|
8686
|
+
args.client,
|
|
8687
|
+
plaintext.signedTxWireHex,
|
|
8688
|
+
plaintext.innerTxHashHex
|
|
8689
|
+
);
|
|
8690
|
+
return {
|
|
8691
|
+
txHash,
|
|
8692
|
+
operatorIdHex,
|
|
8693
|
+
innerSighashHex: plaintext.innerSighashHex,
|
|
8694
|
+
signedTxWireBytes: plaintext.innerWireBytes
|
|
8695
|
+
};
|
|
8696
|
+
}
|
|
8513
8697
|
async function submitClusterJoinTx(client, backend, tx, clusterId, operatorIdHex, options) {
|
|
8514
8698
|
if (options.private !== false) {
|
|
8515
8699
|
const encrypted = await buildEncryptedSubmission({
|
|
@@ -8597,6 +8781,10 @@ function normalizeOperatorId(value) {
|
|
|
8597
8781
|
const bytes = typeof value === "string" ? hexToBytes2(value, "operatorId") : value;
|
|
8598
8782
|
return bytesToHex2(expectBytes(bytes, 32, "operatorId"));
|
|
8599
8783
|
}
|
|
8784
|
+
function normalizeOperatorSealEk(value) {
|
|
8785
|
+
const bytes = typeof value === "string" ? hexToBytes2(value, "sealEk") : value;
|
|
8786
|
+
return expectBytes(bytes, NODE_REGISTRY_OPERATOR_SEAL_EK_BYTES, "sealEk").slice();
|
|
8787
|
+
}
|
|
8600
8788
|
function parseUint32(value, label) {
|
|
8601
8789
|
const parsed = parseBigint(value, label);
|
|
8602
8790
|
if (parsed < 0n || parsed > MAX_UINT32) {
|
|
@@ -8811,15 +8999,405 @@ function expectLength4(value, len, name) {
|
|
|
8811
8999
|
}
|
|
8812
9000
|
return value;
|
|
8813
9001
|
}
|
|
9002
|
+
var TokenFactoryError = class extends Error {
|
|
9003
|
+
constructor(message) {
|
|
9004
|
+
super(message);
|
|
9005
|
+
this.name = "TokenFactoryError";
|
|
9006
|
+
}
|
|
9007
|
+
};
|
|
9008
|
+
var TOKEN_FACTORY_CREATE_DEPOSIT_LYTHOSHI = 3000000000000000n;
|
|
9009
|
+
var TOKEN_FACTORY_NAME_MAX_BYTES = 256;
|
|
9010
|
+
var TOKEN_FACTORY_SYMBOL_MAX_BYTES = 256;
|
|
9011
|
+
var TOKEN_FACTORY_MAX_DECIMALS = 30;
|
|
9012
|
+
var TOKEN_FACTORY_MAX_CREATOR_FEE_BPS = 1e4;
|
|
9013
|
+
var TOKEN_FACTORY_TOKEN_ID_DOMAIN_TAG = 250;
|
|
9014
|
+
var TOKEN_FACTORY_FLAGS = {
|
|
9015
|
+
MINTABLE: 1 << 0,
|
|
9016
|
+
BURNABLE: 1 << 1,
|
|
9017
|
+
PAUSABLE: 1 << 2,
|
|
9018
|
+
FIXED_SUPPLY: 1 << 3,
|
|
9019
|
+
CREATOR_FEE_OPT_IN: 1 << 4,
|
|
9020
|
+
DESTRUCTIBLE: 1 << 5
|
|
9021
|
+
};
|
|
9022
|
+
var TOKEN_FACTORY_KNOWN_FLAG_MASK = TOKEN_FACTORY_FLAGS.MINTABLE | TOKEN_FACTORY_FLAGS.BURNABLE | TOKEN_FACTORY_FLAGS.PAUSABLE | TOKEN_FACTORY_FLAGS.FIXED_SUPPLY | TOKEN_FACTORY_FLAGS.CREATOR_FEE_OPT_IN | TOKEN_FACTORY_FLAGS.DESTRUCTIBLE;
|
|
9023
|
+
var TOKEN_FACTORY_SIGS = {
|
|
9024
|
+
createToken: "createToken(string,string,uint8,uint256,uint256,uint32,uint16)",
|
|
9025
|
+
transfer: "transfer(bytes32,address,uint256)",
|
|
9026
|
+
transferFrom: "transferFrom(bytes32,address,address,uint256)",
|
|
9027
|
+
approve: "approve(bytes32,address,uint256)",
|
|
9028
|
+
increaseAllowance: "increaseAllowance(bytes32,address,uint256)",
|
|
9029
|
+
decreaseAllowance: "decreaseAllowance(bytes32,address,uint256)",
|
|
9030
|
+
balanceOf: "balanceOf(bytes32,address)",
|
|
9031
|
+
allowance: "allowance(bytes32,address,address)",
|
|
9032
|
+
totalSupply: "totalSupply(bytes32)",
|
|
9033
|
+
metadata: "metadata(bytes32)",
|
|
9034
|
+
mint: "mint(bytes32,address,uint256)",
|
|
9035
|
+
burn: "burn(bytes32,uint256)",
|
|
9036
|
+
setPaused: "setPaused(bytes32,bool)",
|
|
9037
|
+
transferOwnership: "transferOwnership(bytes32,address)",
|
|
9038
|
+
destroyToken: "destroyToken(bytes32)"
|
|
9039
|
+
};
|
|
9040
|
+
var TOKEN_FACTORY_SELECTORS = {
|
|
9041
|
+
createToken: selectorHex3(TOKEN_FACTORY_SIGS.createToken),
|
|
9042
|
+
transfer: selectorHex3(TOKEN_FACTORY_SIGS.transfer),
|
|
9043
|
+
transferFrom: selectorHex3(TOKEN_FACTORY_SIGS.transferFrom),
|
|
9044
|
+
approve: selectorHex3(TOKEN_FACTORY_SIGS.approve),
|
|
9045
|
+
increaseAllowance: selectorHex3(TOKEN_FACTORY_SIGS.increaseAllowance),
|
|
9046
|
+
decreaseAllowance: selectorHex3(TOKEN_FACTORY_SIGS.decreaseAllowance),
|
|
9047
|
+
balanceOf: selectorHex3(TOKEN_FACTORY_SIGS.balanceOf),
|
|
9048
|
+
allowance: selectorHex3(TOKEN_FACTORY_SIGS.allowance),
|
|
9049
|
+
totalSupply: selectorHex3(TOKEN_FACTORY_SIGS.totalSupply),
|
|
9050
|
+
metadata: selectorHex3(TOKEN_FACTORY_SIGS.metadata),
|
|
9051
|
+
mint: selectorHex3(TOKEN_FACTORY_SIGS.mint),
|
|
9052
|
+
burn: selectorHex3(TOKEN_FACTORY_SIGS.burn),
|
|
9053
|
+
setPaused: selectorHex3(TOKEN_FACTORY_SIGS.setPaused),
|
|
9054
|
+
transferOwnership: selectorHex3(TOKEN_FACTORY_SIGS.transferOwnership),
|
|
9055
|
+
destroyToken: selectorHex3(TOKEN_FACTORY_SIGS.destroyToken)
|
|
9056
|
+
};
|
|
9057
|
+
function tokenFactoryAddressHex() {
|
|
9058
|
+
return PRECOMPILE_ADDRESSES.TOKEN_FACTORY.toLowerCase();
|
|
9059
|
+
}
|
|
9060
|
+
function deriveTokenFactoryTokenId(creator, creatorTokenNonce) {
|
|
9061
|
+
const nonce = parseUint(creatorTokenNonce, "creatorTokenNonce", 64);
|
|
9062
|
+
return bytesToHex2(
|
|
9063
|
+
keccak_256(
|
|
9064
|
+
concatBytes2(
|
|
9065
|
+
new Uint8Array([TOKEN_FACTORY_TOKEN_ID_DOMAIN_TAG]),
|
|
9066
|
+
addressBytes(creator, "creator"),
|
|
9067
|
+
uint64Be(nonce)
|
|
9068
|
+
)
|
|
9069
|
+
)
|
|
9070
|
+
);
|
|
9071
|
+
}
|
|
9072
|
+
function encodeCreateTokenCalldata(args) {
|
|
9073
|
+
const name = textBytes(args.name, "name", TOKEN_FACTORY_NAME_MAX_BYTES);
|
|
9074
|
+
const symbol = textBytes(args.symbol, "symbol", TOKEN_FACTORY_SYMBOL_MAX_BYTES);
|
|
9075
|
+
const decimals = parseSmallUint(args.decimals, "decimals", TOKEN_FACTORY_MAX_DECIMALS);
|
|
9076
|
+
const initialSupply = parseUint(args.initialSupply, "initialSupply");
|
|
9077
|
+
const maxSupply = parseUint(args.maxSupply, "maxSupply");
|
|
9078
|
+
const flags = args.flags ?? 0;
|
|
9079
|
+
validateTokenFactoryFlags(flags, args.creatorFeeBps ?? 0);
|
|
9080
|
+
const creatorFeeBps = parseSmallUint(
|
|
9081
|
+
args.creatorFeeBps ?? 0,
|
|
9082
|
+
"creatorFeeBps",
|
|
9083
|
+
TOKEN_FACTORY_MAX_CREATOR_FEE_BPS
|
|
9084
|
+
);
|
|
9085
|
+
const headLen = 7 * 32;
|
|
9086
|
+
const nameTail = dynamicBytesTail(name);
|
|
9087
|
+
const symbolOffset = BigInt(headLen + nameTail.length);
|
|
9088
|
+
return bytesToHex2(
|
|
9089
|
+
concatBytes2(
|
|
9090
|
+
hexToBytes2(TOKEN_FACTORY_SELECTORS.createToken, "createToken selector"),
|
|
9091
|
+
uint256Word2(BigInt(headLen), "nameOffset"),
|
|
9092
|
+
uint256Word2(symbolOffset, "symbolOffset"),
|
|
9093
|
+
uint256Word2(BigInt(decimals), "decimals"),
|
|
9094
|
+
uint256Word2(initialSupply, "initialSupply"),
|
|
9095
|
+
uint256Word2(maxSupply, "maxSupply"),
|
|
9096
|
+
uint256Word2(BigInt(flags), "flags"),
|
|
9097
|
+
uint256Word2(BigInt(creatorFeeBps), "creatorFeeBps"),
|
|
9098
|
+
nameTail,
|
|
9099
|
+
dynamicBytesTail(symbol)
|
|
9100
|
+
)
|
|
9101
|
+
);
|
|
9102
|
+
}
|
|
9103
|
+
function encodeCreateFixedSupplyMrc20Calldata(args) {
|
|
9104
|
+
let flags = TOKEN_FACTORY_FLAGS.FIXED_SUPPLY;
|
|
9105
|
+
if (args.burnable) flags |= TOKEN_FACTORY_FLAGS.BURNABLE;
|
|
9106
|
+
if (args.pausable) flags |= TOKEN_FACTORY_FLAGS.PAUSABLE;
|
|
9107
|
+
if (args.destructible) flags |= TOKEN_FACTORY_FLAGS.DESTRUCTIBLE;
|
|
9108
|
+
return encodeCreateTokenCalldata({
|
|
9109
|
+
name: args.name,
|
|
9110
|
+
symbol: args.symbol,
|
|
9111
|
+
decimals: args.decimals,
|
|
9112
|
+
initialSupply: args.supply,
|
|
9113
|
+
maxSupply: args.supply,
|
|
9114
|
+
flags,
|
|
9115
|
+
creatorFeeBps: 0
|
|
9116
|
+
});
|
|
9117
|
+
}
|
|
9118
|
+
function encodeTokenFactoryTransferCalldata(tokenId, to, amount) {
|
|
9119
|
+
return encodeBytes32AddressUint(TOKEN_FACTORY_SELECTORS.transfer, tokenId, to, amount);
|
|
9120
|
+
}
|
|
9121
|
+
function encodeTokenFactoryTransferFromCalldata(tokenId, from, to, amount) {
|
|
9122
|
+
return bytesToHex2(
|
|
9123
|
+
concatBytes2(
|
|
9124
|
+
hexToBytes2(TOKEN_FACTORY_SELECTORS.transferFrom, "transferFrom selector"),
|
|
9125
|
+
bytes32(tokenId, "tokenId"),
|
|
9126
|
+
addressWord3(from, "from"),
|
|
9127
|
+
addressWord3(to, "to"),
|
|
9128
|
+
uint256Word2(parseUint(amount, "amount"), "amount")
|
|
9129
|
+
)
|
|
9130
|
+
);
|
|
9131
|
+
}
|
|
9132
|
+
function encodeTokenFactoryApproveCalldata(tokenId, spender, amount) {
|
|
9133
|
+
return encodeBytes32AddressUint(TOKEN_FACTORY_SELECTORS.approve, tokenId, spender, amount);
|
|
9134
|
+
}
|
|
9135
|
+
function encodeTokenFactoryIncreaseAllowanceCalldata(tokenId, spender, delta) {
|
|
9136
|
+
return encodeBytes32AddressUint(TOKEN_FACTORY_SELECTORS.increaseAllowance, tokenId, spender, delta);
|
|
9137
|
+
}
|
|
9138
|
+
function encodeTokenFactoryDecreaseAllowanceCalldata(tokenId, spender, delta) {
|
|
9139
|
+
return encodeBytes32AddressUint(TOKEN_FACTORY_SELECTORS.decreaseAllowance, tokenId, spender, delta);
|
|
9140
|
+
}
|
|
9141
|
+
function encodeTokenFactoryBalanceOfCalldata(tokenId, holder) {
|
|
9142
|
+
return encodeBytes32Address(TOKEN_FACTORY_SELECTORS.balanceOf, tokenId, holder);
|
|
9143
|
+
}
|
|
9144
|
+
function encodeTokenFactoryAllowanceCalldata(tokenId, owner, spender) {
|
|
9145
|
+
return bytesToHex2(
|
|
9146
|
+
concatBytes2(
|
|
9147
|
+
hexToBytes2(TOKEN_FACTORY_SELECTORS.allowance, "allowance selector"),
|
|
9148
|
+
bytes32(tokenId, "tokenId"),
|
|
9149
|
+
addressWord3(owner, "owner"),
|
|
9150
|
+
addressWord3(spender, "spender")
|
|
9151
|
+
)
|
|
9152
|
+
);
|
|
9153
|
+
}
|
|
9154
|
+
function encodeTokenFactoryTotalSupplyCalldata(tokenId) {
|
|
9155
|
+
return encodeBytes32(TOKEN_FACTORY_SELECTORS.totalSupply, tokenId);
|
|
9156
|
+
}
|
|
9157
|
+
function encodeTokenFactoryMetadataCalldata(tokenId) {
|
|
9158
|
+
return encodeBytes32(TOKEN_FACTORY_SELECTORS.metadata, tokenId);
|
|
9159
|
+
}
|
|
9160
|
+
function encodeTokenFactoryMintCalldata(tokenId, to, amount) {
|
|
9161
|
+
return encodeBytes32AddressUint(TOKEN_FACTORY_SELECTORS.mint, tokenId, to, amount);
|
|
9162
|
+
}
|
|
9163
|
+
function encodeTokenFactoryBurnCalldata(tokenId, amount) {
|
|
9164
|
+
return encodeBytes32Uint(TOKEN_FACTORY_SELECTORS.burn, tokenId, amount);
|
|
9165
|
+
}
|
|
9166
|
+
function encodeTokenFactorySetPausedCalldata(tokenId, paused) {
|
|
9167
|
+
return bytesToHex2(
|
|
9168
|
+
concatBytes2(
|
|
9169
|
+
hexToBytes2(TOKEN_FACTORY_SELECTORS.setPaused, "setPaused selector"),
|
|
9170
|
+
bytes32(tokenId, "tokenId"),
|
|
9171
|
+
boolWord(paused)
|
|
9172
|
+
)
|
|
9173
|
+
);
|
|
9174
|
+
}
|
|
9175
|
+
function encodeTokenFactoryTransferOwnershipCalldata(tokenId, newOwner) {
|
|
9176
|
+
return encodeBytes32Address(TOKEN_FACTORY_SELECTORS.transferOwnership, tokenId, newOwner);
|
|
9177
|
+
}
|
|
9178
|
+
function encodeTokenFactoryDestroyCalldata(tokenId) {
|
|
9179
|
+
return encodeBytes32(TOKEN_FACTORY_SELECTORS.destroyToken, tokenId);
|
|
9180
|
+
}
|
|
9181
|
+
function decodeTokenFactoryTokenId(output) {
|
|
9182
|
+
return bytesToHex2(bytes32(output, "output"));
|
|
9183
|
+
}
|
|
9184
|
+
function validateTokenFactoryFlags(flags, creatorFeeBps = 0) {
|
|
9185
|
+
if (!Number.isInteger(flags) || flags < 0 || flags > 4294967295) {
|
|
9186
|
+
throw new TokenFactoryError("flags must be a uint32");
|
|
9187
|
+
}
|
|
9188
|
+
if ((flags & ~TOKEN_FACTORY_KNOWN_FLAG_MASK) !== 0) {
|
|
9189
|
+
throw new TokenFactoryError("flags contain an unknown bit");
|
|
9190
|
+
}
|
|
9191
|
+
if ((flags & TOKEN_FACTORY_FLAGS.MINTABLE) !== 0 && (flags & TOKEN_FACTORY_FLAGS.FIXED_SUPPLY) !== 0) {
|
|
9192
|
+
throw new TokenFactoryError("MINTABLE and FIXED_SUPPLY are mutually exclusive");
|
|
9193
|
+
}
|
|
9194
|
+
if ((flags & TOKEN_FACTORY_FLAGS.CREATOR_FEE_OPT_IN) !== 0) {
|
|
9195
|
+
if (creatorFeeBps <= 0) throw new TokenFactoryError("CREATOR_FEE_OPT_IN requires non-zero creatorFeeBps");
|
|
9196
|
+
} else if (creatorFeeBps !== 0) {
|
|
9197
|
+
throw new TokenFactoryError("creatorFeeBps must be 0 when CREATOR_FEE_OPT_IN is unset");
|
|
9198
|
+
}
|
|
9199
|
+
}
|
|
9200
|
+
function encodeBytes32(selector, value) {
|
|
9201
|
+
return bytesToHex2(concatBytes2(hexToBytes2(selector, "selector"), bytes32(value, "tokenId")));
|
|
9202
|
+
}
|
|
9203
|
+
function encodeBytes32Uint(selector, tokenId, amount) {
|
|
9204
|
+
return bytesToHex2(
|
|
9205
|
+
concatBytes2(
|
|
9206
|
+
hexToBytes2(selector, "selector"),
|
|
9207
|
+
bytes32(tokenId, "tokenId"),
|
|
9208
|
+
uint256Word2(parseUint(amount, "amount"), "amount")
|
|
9209
|
+
)
|
|
9210
|
+
);
|
|
9211
|
+
}
|
|
9212
|
+
function encodeBytes32Address(selector, tokenId, address) {
|
|
9213
|
+
return bytesToHex2(
|
|
9214
|
+
concatBytes2(
|
|
9215
|
+
hexToBytes2(selector, "selector"),
|
|
9216
|
+
bytes32(tokenId, "tokenId"),
|
|
9217
|
+
addressWord3(address, "address")
|
|
9218
|
+
)
|
|
9219
|
+
);
|
|
9220
|
+
}
|
|
9221
|
+
function encodeBytes32AddressUint(selector, tokenId, address, amount) {
|
|
9222
|
+
return bytesToHex2(
|
|
9223
|
+
concatBytes2(
|
|
9224
|
+
hexToBytes2(selector, "selector"),
|
|
9225
|
+
bytes32(tokenId, "tokenId"),
|
|
9226
|
+
addressWord3(address, "address"),
|
|
9227
|
+
uint256Word2(parseUint(amount, "amount"), "amount")
|
|
9228
|
+
)
|
|
9229
|
+
);
|
|
9230
|
+
}
|
|
9231
|
+
function selectorHex3(signature) {
|
|
9232
|
+
const sel = keccak_256(new TextEncoder().encode(signature)).slice(0, 4);
|
|
9233
|
+
return bytesToHex2(sel);
|
|
9234
|
+
}
|
|
9235
|
+
function textBytes(value, label, maxBytes) {
|
|
9236
|
+
const bytes = new TextEncoder().encode(value);
|
|
9237
|
+
if (bytes.length === 0 || bytes.length > maxBytes) {
|
|
9238
|
+
throw new TokenFactoryError(`${label} must be 1..=${maxBytes} UTF-8 bytes`);
|
|
9239
|
+
}
|
|
9240
|
+
return bytes;
|
|
9241
|
+
}
|
|
9242
|
+
function dynamicBytesTail(bytes) {
|
|
9243
|
+
return concatBytes2(uint256Word2(BigInt(bytes.length), "length"), padTo323(bytes));
|
|
9244
|
+
}
|
|
9245
|
+
function padTo323(bytes) {
|
|
9246
|
+
const padded = Math.ceil(bytes.length / 32) * 32;
|
|
9247
|
+
if (padded === bytes.length) return bytes;
|
|
9248
|
+
const out = new Uint8Array(padded);
|
|
9249
|
+
out.set(bytes);
|
|
9250
|
+
return out;
|
|
9251
|
+
}
|
|
9252
|
+
function addressWord3(value, label) {
|
|
9253
|
+
const out = new Uint8Array(32);
|
|
9254
|
+
out.set(addressBytes(value, label), 12);
|
|
9255
|
+
return out;
|
|
9256
|
+
}
|
|
9257
|
+
function addressBytes(value, label) {
|
|
9258
|
+
const bytes = toBytes5(value, label);
|
|
9259
|
+
if (bytes.length !== 20) {
|
|
9260
|
+
throw new TokenFactoryError(`${label} must be 20 bytes, got ${bytes.length}`);
|
|
9261
|
+
}
|
|
9262
|
+
return bytes;
|
|
9263
|
+
}
|
|
9264
|
+
function bytes32(value, label) {
|
|
9265
|
+
const bytes = toBytes5(value, label);
|
|
9266
|
+
if (bytes.length !== 32) {
|
|
9267
|
+
throw new TokenFactoryError(`${label} must be 32 bytes, got ${bytes.length}`);
|
|
9268
|
+
}
|
|
9269
|
+
return bytes;
|
|
9270
|
+
}
|
|
9271
|
+
function boolWord(value) {
|
|
9272
|
+
const out = new Uint8Array(32);
|
|
9273
|
+
out[31] = value ? 1 : 0;
|
|
9274
|
+
return out;
|
|
9275
|
+
}
|
|
9276
|
+
function uint256Word2(value, label) {
|
|
9277
|
+
if (value < 0n || value > (1n << 256n) - 1n) {
|
|
9278
|
+
throw new TokenFactoryError(`${label} out of uint256 range`);
|
|
9279
|
+
}
|
|
9280
|
+
const out = new Uint8Array(32);
|
|
9281
|
+
let rest = value;
|
|
9282
|
+
for (let i = 31; i >= 0 && rest > 0n; i--) {
|
|
9283
|
+
out[i] = Number(rest & 0xffn);
|
|
9284
|
+
rest >>= 8n;
|
|
9285
|
+
}
|
|
9286
|
+
return out;
|
|
9287
|
+
}
|
|
9288
|
+
function uint64Be(value) {
|
|
9289
|
+
const out = new Uint8Array(8);
|
|
9290
|
+
let rest = value;
|
|
9291
|
+
for (let i = 7; i >= 0; i--) {
|
|
9292
|
+
out[i] = Number(rest & 0xffn);
|
|
9293
|
+
rest >>= 8n;
|
|
9294
|
+
}
|
|
9295
|
+
return out;
|
|
9296
|
+
}
|
|
9297
|
+
function parseSmallUint(value, label, max) {
|
|
9298
|
+
if (!Number.isInteger(value) || value < 0 || value > max) {
|
|
9299
|
+
throw new TokenFactoryError(`${label} must be an integer in 0..=${max}`);
|
|
9300
|
+
}
|
|
9301
|
+
return value;
|
|
9302
|
+
}
|
|
9303
|
+
function parseUint(value, label, bits = 256) {
|
|
9304
|
+
let parsed;
|
|
9305
|
+
if (typeof value === "bigint") {
|
|
9306
|
+
parsed = value;
|
|
9307
|
+
} else if (typeof value === "number") {
|
|
9308
|
+
if (!Number.isSafeInteger(value)) throw new TokenFactoryError(`${label} must be a safe integer`);
|
|
9309
|
+
parsed = BigInt(value);
|
|
9310
|
+
} else if (value.startsWith("0x") || value.startsWith("0X")) {
|
|
9311
|
+
parsed = BigInt(value);
|
|
9312
|
+
} else {
|
|
9313
|
+
if (!/^[0-9]+$/.test(value)) throw new TokenFactoryError(`${label} must be a non-negative integer`);
|
|
9314
|
+
parsed = BigInt(value);
|
|
9315
|
+
}
|
|
9316
|
+
if (parsed < 0n || parsed > (1n << BigInt(bits)) - 1n) {
|
|
9317
|
+
throw new TokenFactoryError(`${label} out of uint${bits} range`);
|
|
9318
|
+
}
|
|
9319
|
+
return parsed;
|
|
9320
|
+
}
|
|
9321
|
+
function toBytes5(value, label) {
|
|
9322
|
+
if (typeof value === "string") return hexToBytes2(value, label);
|
|
9323
|
+
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
9324
|
+
}
|
|
9325
|
+
|
|
9326
|
+
// src/vrf.ts
|
|
9327
|
+
var VrfCallError = class extends Error {
|
|
9328
|
+
constructor(message) {
|
|
9329
|
+
super(message);
|
|
9330
|
+
this.name = "VrfCallError";
|
|
9331
|
+
}
|
|
9332
|
+
};
|
|
9333
|
+
var VRF_OUTPUT_BYTES = 32;
|
|
9334
|
+
var VRF_DOMAIN_TAG_MAX_BYTES = 256;
|
|
9335
|
+
var VRF_HEIGHT_NOT_FINALIZED_REVERT = "vrf: height not finalized";
|
|
9336
|
+
function vrfAddressHex() {
|
|
9337
|
+
return PRECOMPILE_ADDRESSES.VRF.toLowerCase();
|
|
9338
|
+
}
|
|
9339
|
+
function encodeVrfEvaluateCalldata(blockHeight, domainTag = new Uint8Array()) {
|
|
9340
|
+
const height = parseUint64(blockHeight, "blockHeight");
|
|
9341
|
+
const tag = normalizeDomainTag(domainTag);
|
|
9342
|
+
if (tag.length > VRF_DOMAIN_TAG_MAX_BYTES) {
|
|
9343
|
+
throw new VrfCallError(`domainTag exceeds ${VRF_DOMAIN_TAG_MAX_BYTES} bytes`);
|
|
9344
|
+
}
|
|
9345
|
+
return bytesToHex2(concatBytes2(uint256Word3(height), tag));
|
|
9346
|
+
}
|
|
9347
|
+
function decodeVrfOutput(output) {
|
|
9348
|
+
const bytes = toBytes6(output, "output");
|
|
9349
|
+
if (bytes.length !== VRF_OUTPUT_BYTES) {
|
|
9350
|
+
throw new VrfCallError(`VRF output must be ${VRF_OUTPUT_BYTES} bytes, got ${bytes.length}`);
|
|
9351
|
+
}
|
|
9352
|
+
return bytes;
|
|
9353
|
+
}
|
|
9354
|
+
function normalizeDomainTag(value) {
|
|
9355
|
+
if (typeof value === "string") {
|
|
9356
|
+
if (value.startsWith("0x") || value.startsWith("0X")) return hexToBytes2(value, "domainTag");
|
|
9357
|
+
return new TextEncoder().encode(value);
|
|
9358
|
+
}
|
|
9359
|
+
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
9360
|
+
}
|
|
9361
|
+
function parseUint64(value, label) {
|
|
9362
|
+
let parsed;
|
|
9363
|
+
if (typeof value === "bigint") {
|
|
9364
|
+
parsed = value;
|
|
9365
|
+
} else if (typeof value === "number") {
|
|
9366
|
+
if (!Number.isSafeInteger(value)) throw new VrfCallError(`${label} must be a safe integer`);
|
|
9367
|
+
parsed = BigInt(value);
|
|
9368
|
+
} else if (value.startsWith("0x") || value.startsWith("0X")) {
|
|
9369
|
+
parsed = BigInt(value);
|
|
9370
|
+
} else {
|
|
9371
|
+
if (!/^[0-9]+$/.test(value)) throw new VrfCallError(`${label} must be a non-negative integer`);
|
|
9372
|
+
parsed = BigInt(value);
|
|
9373
|
+
}
|
|
9374
|
+
if (parsed < 0n || parsed > (1n << 64n) - 1n) {
|
|
9375
|
+
throw new VrfCallError(`${label} out of uint64 range`);
|
|
9376
|
+
}
|
|
9377
|
+
return parsed;
|
|
9378
|
+
}
|
|
9379
|
+
function uint256Word3(value) {
|
|
9380
|
+
const out = new Uint8Array(32);
|
|
9381
|
+
let rest = value;
|
|
9382
|
+
for (let i = 31; i >= 0 && rest > 0n; i--) {
|
|
9383
|
+
out[i] = Number(rest & 0xffn);
|
|
9384
|
+
rest >>= 8n;
|
|
9385
|
+
}
|
|
9386
|
+
return out;
|
|
9387
|
+
}
|
|
9388
|
+
function toBytes6(value, label) {
|
|
9389
|
+
if (typeof value === "string") return hexToBytes2(value, label);
|
|
9390
|
+
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
9391
|
+
}
|
|
8814
9392
|
var PROVER_MARKET_ADDRESS = PRECOMPILE_ADDRESSES.PROVER_MARKET;
|
|
8815
9393
|
var SERVES_GPU_PROVE = 512;
|
|
8816
9394
|
var PROVER_MARKET_SELECTORS = {
|
|
8817
|
-
createRequest: "0x" +
|
|
8818
|
-
submitBid: "0x" +
|
|
8819
|
-
closeRequest: "0x" +
|
|
8820
|
-
submitProof: "0x" +
|
|
8821
|
-
settle: "0x" +
|
|
8822
|
-
slash: "0x" +
|
|
9395
|
+
createRequest: "0x" + selectorHex4("createRequest(bytes)"),
|
|
9396
|
+
submitBid: "0x" + selectorHex4("submitBid(bytes)"),
|
|
9397
|
+
closeRequest: "0x" + selectorHex4("closeRequest(bytes)"),
|
|
9398
|
+
submitProof: "0x" + selectorHex4("submitProof(bytes)"),
|
|
9399
|
+
settle: "0x" + selectorHex4("settle(bytes)"),
|
|
9400
|
+
slash: "0x" + selectorHex4("slash(bytes)")
|
|
8823
9401
|
};
|
|
8824
9402
|
var PROVER_MARKET_EVENT_SIGS = {
|
|
8825
9403
|
proofRequested: "ProofRequested(bytes32,address,bytes32,uint128,uint64)",
|
|
@@ -8861,8 +9439,8 @@ function requestSighash(vkeyHash, inputsHash, maxFee, deadline, nonce) {
|
|
|
8861
9439
|
keccak_256(
|
|
8862
9440
|
concatBytes7(
|
|
8863
9441
|
new TextEncoder().encode(PROVER_MARKET_REQUEST_DOMAIN),
|
|
8864
|
-
expectLength5(
|
|
8865
|
-
expectLength5(
|
|
9442
|
+
expectLength5(toBytes7(vkeyHash), 32, "vkeyHash"),
|
|
9443
|
+
expectLength5(toBytes7(inputsHash), 32, "inputsHash"),
|
|
8866
9444
|
u128Bytes(maxFee, "maxFee"),
|
|
8867
9445
|
u64Bytes(deadline, "deadline"),
|
|
8868
9446
|
u64Bytes(nonce, "nonce")
|
|
@@ -8875,7 +9453,7 @@ function bidSighash(requestId, fee) {
|
|
|
8875
9453
|
keccak_256(
|
|
8876
9454
|
concatBytes7(
|
|
8877
9455
|
new TextEncoder().encode(PROVER_MARKET_BID_DOMAIN),
|
|
8878
|
-
expectLength5(
|
|
9456
|
+
expectLength5(toBytes7(requestId), 32, "requestId"),
|
|
8879
9457
|
u128Bytes(fee, "fee")
|
|
8880
9458
|
)
|
|
8881
9459
|
)
|
|
@@ -8886,16 +9464,16 @@ function submitSighash(requestId, proofHash) {
|
|
|
8886
9464
|
keccak_256(
|
|
8887
9465
|
concatBytes7(
|
|
8888
9466
|
new TextEncoder().encode(PROVER_MARKET_SUBMIT_DOMAIN),
|
|
8889
|
-
expectLength5(
|
|
8890
|
-
expectLength5(
|
|
9467
|
+
expectLength5(toBytes7(requestId), 32, "requestId"),
|
|
9468
|
+
expectLength5(toBytes7(proofHash), 32, "proofHash")
|
|
8891
9469
|
)
|
|
8892
9470
|
)
|
|
8893
9471
|
);
|
|
8894
9472
|
}
|
|
8895
9473
|
function encodeCreateRequestCanonical(args) {
|
|
8896
|
-
const buyer = expectLength5(
|
|
8897
|
-
const buyerPubkey =
|
|
8898
|
-
const sig =
|
|
9474
|
+
const buyer = expectLength5(toBytes7(args.buyer), 20, "buyer");
|
|
9475
|
+
const buyerPubkey = toBytes7(args.buyerPubkey);
|
|
9476
|
+
const sig = toBytes7(args.sig);
|
|
8899
9477
|
if (buyerPubkey.length === 0 || buyerPubkey.length > 65535) {
|
|
8900
9478
|
throw new ProverMarketError("buyerPubkey length out of range (1..=65535)");
|
|
8901
9479
|
}
|
|
@@ -8907,8 +9485,8 @@ function encodeCreateRequestCanonical(args) {
|
|
|
8907
9485
|
buyer,
|
|
8908
9486
|
u16Bytes(buyerPubkey.length),
|
|
8909
9487
|
buyerPubkey,
|
|
8910
|
-
expectLength5(
|
|
8911
|
-
expectLength5(
|
|
9488
|
+
expectLength5(toBytes7(args.vkeyHash), 32, "vkeyHash"),
|
|
9489
|
+
expectLength5(toBytes7(args.inputsHash), 32, "inputsHash"),
|
|
8912
9490
|
u128Bytes(args.maxFee, "maxFee"),
|
|
8913
9491
|
u64Bytes(args.deadline, "deadline"),
|
|
8914
9492
|
u64Bytes(args.nonce, "nonce"),
|
|
@@ -8918,7 +9496,7 @@ function encodeCreateRequestCanonical(args) {
|
|
|
8918
9496
|
);
|
|
8919
9497
|
}
|
|
8920
9498
|
function encodeCreateRequestCalldata(args) {
|
|
8921
|
-
const canonical =
|
|
9499
|
+
const canonical = toBytes7(encodeCreateRequestCanonical(args));
|
|
8922
9500
|
const offset = new Uint8Array(32);
|
|
8923
9501
|
offset[31] = 32;
|
|
8924
9502
|
const lenWord = new Uint8Array(32);
|
|
@@ -8932,10 +9510,10 @@ function encodeCreateRequestCalldata(args) {
|
|
|
8932
9510
|
concatBytes7(hexToBytes7(PROVER_MARKET_SELECTORS.createRequest), offset, lenWord, canonical, new Uint8Array(pad))
|
|
8933
9511
|
);
|
|
8934
9512
|
}
|
|
8935
|
-
function
|
|
9513
|
+
function selectorHex4(sig) {
|
|
8936
9514
|
return [...keccak_256(new TextEncoder().encode(sig)).slice(0, 4)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
8937
9515
|
}
|
|
8938
|
-
function
|
|
9516
|
+
function toBytes7(value) {
|
|
8939
9517
|
if (typeof value === "string") return hexToBytes7(value);
|
|
8940
9518
|
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
8941
9519
|
}
|
|
@@ -9073,7 +9651,7 @@ function encodeSetAutoCompoundCalldata(enabled) {
|
|
|
9073
9651
|
);
|
|
9074
9652
|
}
|
|
9075
9653
|
function isRedemptionPrincipalUnavailableRevert(data) {
|
|
9076
|
-
return bytesToHex9(
|
|
9654
|
+
return bytesToHex9(toBytes8(data)).toLowerCase() === DELEGATION_REVERT_TAGS.redemptionPrincipalUnavailable;
|
|
9077
9655
|
}
|
|
9078
9656
|
function uint64Word3(value, name) {
|
|
9079
9657
|
const n = toBigint3(value, name);
|
|
@@ -9127,7 +9705,7 @@ function toBigint3(value, name) {
|
|
|
9127
9705
|
}
|
|
9128
9706
|
return BigInt(value);
|
|
9129
9707
|
}
|
|
9130
|
-
function
|
|
9708
|
+
function toBytes8(value) {
|
|
9131
9709
|
if (typeof value === "string") {
|
|
9132
9710
|
return hexToBytes8(value);
|
|
9133
9711
|
}
|
|
@@ -9241,8 +9819,8 @@ function encodeSetPolicyCalldata(args) {
|
|
|
9241
9819
|
}
|
|
9242
9820
|
function encodeSetPolicyClaimCalldata(args, subAccountPubkey, subAccountSig) {
|
|
9243
9821
|
const normalized = normalizeArgs(args);
|
|
9244
|
-
const pubkey =
|
|
9245
|
-
const sig =
|
|
9822
|
+
const pubkey = toBytes9(subAccountPubkey);
|
|
9823
|
+
const sig = toBytes9(subAccountSig);
|
|
9246
9824
|
if (pubkey.length !== ML_DSA_65_PUBLIC_KEY_LEN2) {
|
|
9247
9825
|
throw new SpendingPolicyError(
|
|
9248
9826
|
`subAccountPubkey must be ${ML_DSA_65_PUBLIC_KEY_LEN2} bytes, got ${pubkey.length}`
|
|
@@ -9264,7 +9842,7 @@ function encodeSetPolicyClaimCalldata(args, subAccountPubkey, subAccountSig) {
|
|
|
9264
9842
|
}
|
|
9265
9843
|
function encodeClaimPolicyByAddressCalldata(args, subAccountSig) {
|
|
9266
9844
|
const normalized = normalizeArgs(args);
|
|
9267
|
-
const sig =
|
|
9845
|
+
const sig = toBytes9(subAccountSig);
|
|
9268
9846
|
if (sig.length !== ML_DSA_65_SIGNATURE_LEN2) {
|
|
9269
9847
|
throw new SpendingPolicyError(
|
|
9270
9848
|
`subAccountSig must be ${ML_DSA_65_SIGNATURE_LEN2} bytes, got ${sig.length}`
|
|
@@ -9291,12 +9869,12 @@ function normalizeArgs(args) {
|
|
|
9291
9869
|
principal: toUserAddressBytes(args.principal, "principal"),
|
|
9292
9870
|
dailyCapLythoshi: toBigint4(args.dailyCapLythoshi, "dailyCapLythoshi"),
|
|
9293
9871
|
perTxCapLythoshi: toBigint4(args.perTxCapLythoshi, "perTxCapLythoshi"),
|
|
9294
|
-
allowRoot: expectLength6(
|
|
9295
|
-
denyRoot: expectLength6(
|
|
9872
|
+
allowRoot: expectLength6(toBytes9(args.allowRoot), 32, "allowRoot"),
|
|
9873
|
+
denyRoot: expectLength6(toBytes9(args.denyRoot), 32, "denyRoot"),
|
|
9296
9874
|
weeklyCapLythoshi: toBigint4(args.weeklyCapLythoshi ?? 0n, "weeklyCapLythoshi"),
|
|
9297
9875
|
monthlyCapLythoshi: toBigint4(args.monthlyCapLythoshi ?? 0n, "monthlyCapLythoshi"),
|
|
9298
|
-
categoryAllowRoot: args.categoryAllowRoot == null ? ZERO_WORD : expectLength6(
|
|
9299
|
-
timeWindow: args.timeWindow == null ? ZERO_WORD : expectLength6(
|
|
9876
|
+
categoryAllowRoot: args.categoryAllowRoot == null ? ZERO_WORD : expectLength6(toBytes9(args.categoryAllowRoot), 32, "categoryAllowRoot"),
|
|
9877
|
+
timeWindow: args.timeWindow == null ? ZERO_WORD : expectLength6(toBytes9(args.timeWindow), 32, "timeWindow"),
|
|
9300
9878
|
policyExpiry: toBigint4(args.policyExpiry ?? 0n, "policyExpiry")
|
|
9301
9879
|
};
|
|
9302
9880
|
}
|
|
@@ -9326,7 +9904,7 @@ function packTimeWindow(enabled, startHour, endHour) {
|
|
|
9326
9904
|
return out;
|
|
9327
9905
|
}
|
|
9328
9906
|
function decodeTimeWindow(word) {
|
|
9329
|
-
const bytes = expectLength6(
|
|
9907
|
+
const bytes = expectLength6(toBytes9(word), 32, "timeWindow");
|
|
9330
9908
|
if (bytes.every((b) => b === 0)) return null;
|
|
9331
9909
|
if (bytes[29] === 0) return null;
|
|
9332
9910
|
return [Math.min(bytes[30], 23), Math.min(bytes[31], 23)];
|
|
@@ -9369,7 +9947,7 @@ function toRawAddressBytes(value) {
|
|
|
9369
9947
|
}
|
|
9370
9948
|
return expectLength6(value instanceof Uint8Array ? value : Uint8Array.from(value), 20, "address");
|
|
9371
9949
|
}
|
|
9372
|
-
function
|
|
9950
|
+
function toBytes9(value) {
|
|
9373
9951
|
if (typeof value === "string") {
|
|
9374
9952
|
return hexToBytes9(value);
|
|
9375
9953
|
}
|
|
@@ -9451,7 +10029,7 @@ function pubkeyRegistryAddressHex() {
|
|
|
9451
10029
|
return PRECOMPILE_ADDRESSES.PUBKEY_REGISTRY.toLowerCase();
|
|
9452
10030
|
}
|
|
9453
10031
|
function encodeRegisterPubkeyCalldata(pubkey) {
|
|
9454
|
-
const bytes =
|
|
10032
|
+
const bytes = toBytes10(pubkey);
|
|
9455
10033
|
if (bytes.length !== PUBKEY_REGISTRY_ML_DSA_65_PUBLIC_KEY_LEN) {
|
|
9456
10034
|
throw new PubkeyRegistryError(
|
|
9457
10035
|
`pubkey must be ${PUBKEY_REGISTRY_ML_DSA_65_PUBLIC_KEY_LEN} bytes, got ${bytes.length}`
|
|
@@ -9460,8 +10038,8 @@ function encodeRegisterPubkeyCalldata(pubkey) {
|
|
|
9460
10038
|
return bytesToHex11(
|
|
9461
10039
|
concatBytes10(
|
|
9462
10040
|
hexToBytes10(PUBKEY_REGISTRY_SELECTORS.registerPubkey),
|
|
9463
|
-
|
|
9464
|
-
|
|
10041
|
+
uint256Word4(32n),
|
|
10042
|
+
uint256Word4(BigInt(bytes.length)),
|
|
9465
10043
|
bytes
|
|
9466
10044
|
)
|
|
9467
10045
|
);
|
|
@@ -9473,7 +10051,7 @@ function encodeHasPubkeyCalldata(address) {
|
|
|
9473
10051
|
return encodeSingleAddressCall2(PUBKEY_REGISTRY_SELECTORS.hasPubkey, address);
|
|
9474
10052
|
}
|
|
9475
10053
|
function decodeLookupPubkeyReturn(data) {
|
|
9476
|
-
const bytes =
|
|
10054
|
+
const bytes = toBytes10(data);
|
|
9477
10055
|
if (bytes.length < 96) {
|
|
9478
10056
|
throw new PubkeyRegistryError("lookup return must be at least 96 bytes");
|
|
9479
10057
|
}
|
|
@@ -9498,7 +10076,7 @@ function decodeLookupPubkeyReturn(data) {
|
|
|
9498
10076
|
};
|
|
9499
10077
|
}
|
|
9500
10078
|
function decodeHasPubkeyReturn(data) {
|
|
9501
|
-
const bytes =
|
|
10079
|
+
const bytes = toBytes10(data);
|
|
9502
10080
|
if (bytes.length !== 32) {
|
|
9503
10081
|
throw new PubkeyRegistryError("hasPubkey return must be 32 bytes");
|
|
9504
10082
|
}
|
|
@@ -9512,9 +10090,9 @@ function decodeHasPubkeyReturn(data) {
|
|
|
9512
10090
|
throw new PubkeyRegistryError("hasPubkey bool must be 0 or 1");
|
|
9513
10091
|
}
|
|
9514
10092
|
function encodeSingleAddressCall2(selector, address) {
|
|
9515
|
-
return bytesToHex11(concatBytes10(hexToBytes10(selector),
|
|
10093
|
+
return bytesToHex11(concatBytes10(hexToBytes10(selector), addressWord4(toAddressBytes(address))));
|
|
9516
10094
|
}
|
|
9517
|
-
function
|
|
10095
|
+
function addressWord4(address) {
|
|
9518
10096
|
return concatBytes10(new Uint8Array(12), address);
|
|
9519
10097
|
}
|
|
9520
10098
|
function toAddressBytes(value) {
|
|
@@ -9531,7 +10109,7 @@ function toAddressBytes(value) {
|
|
|
9531
10109
|
throw new PubkeyRegistryError(`address must be a typed mono bech32m address${detail}`);
|
|
9532
10110
|
}
|
|
9533
10111
|
}
|
|
9534
|
-
function
|
|
10112
|
+
function toBytes10(value) {
|
|
9535
10113
|
if (typeof value === "string") {
|
|
9536
10114
|
return hexToBytes10(value);
|
|
9537
10115
|
}
|
|
@@ -9560,7 +10138,7 @@ function concatBytes10(...parts) {
|
|
|
9560
10138
|
}
|
|
9561
10139
|
return out;
|
|
9562
10140
|
}
|
|
9563
|
-
function
|
|
10141
|
+
function uint256Word4(value) {
|
|
9564
10142
|
if (value < 0n || value > (1n << 256n) - 1n) {
|
|
9565
10143
|
throw new PubkeyRegistryError("uint256 value out of range");
|
|
9566
10144
|
}
|
|
@@ -9708,8 +10286,8 @@ function encodePlaceLimitOrderCalldata(args) {
|
|
|
9708
10286
|
normalized.baseTokenId,
|
|
9709
10287
|
normalized.quoteTokenId,
|
|
9710
10288
|
uint8Word2(normalized.side),
|
|
9711
|
-
|
|
9712
|
-
|
|
10289
|
+
uint256Word5(normalized.price, "price"),
|
|
10290
|
+
uint256Word5(normalized.quantity, "quantity"),
|
|
9713
10291
|
uint64Word4(normalized.expiryBlock, "expiryBlock")
|
|
9714
10292
|
)
|
|
9715
10293
|
);
|
|
@@ -9722,7 +10300,7 @@ function encodePlaceMarketOrderCalldata(args) {
|
|
|
9722
10300
|
normalized.baseTokenId,
|
|
9723
10301
|
normalized.quoteTokenId,
|
|
9724
10302
|
uint8Word2(normalized.side),
|
|
9725
|
-
|
|
10303
|
+
uint256Word5(normalized.quantity, "quantity"),
|
|
9726
10304
|
uint16Word2(normalized.maxSlippageBps, "maxSlippageBps")
|
|
9727
10305
|
)
|
|
9728
10306
|
);
|
|
@@ -9735,7 +10313,7 @@ function encodePlaceMarketOrderExCalldata(args) {
|
|
|
9735
10313
|
normalized.baseTokenId,
|
|
9736
10314
|
normalized.quoteTokenId,
|
|
9737
10315
|
uint8Word2(normalized.side),
|
|
9738
|
-
|
|
10316
|
+
uint256Word5(normalized.quantity, "quantity"),
|
|
9739
10317
|
uint16Word2(normalized.maxSlippageBps, "maxSlippageBps"),
|
|
9740
10318
|
uint8Word2(normalized.mode)
|
|
9741
10319
|
)
|
|
@@ -9755,7 +10333,7 @@ function encodeMarketGridTuneCalldata(selector, label, args) {
|
|
|
9755
10333
|
hexToBytes2(selector, `${label} selector`),
|
|
9756
10334
|
bytes32FromHex(args.baseTokenId, "baseTokenId"),
|
|
9757
10335
|
bytes32FromHex(args.quoteTokenId, "quoteTokenId"),
|
|
9758
|
-
|
|
10336
|
+
uint256Word5(BigInt(args.newValue), "newValue")
|
|
9759
10337
|
)
|
|
9760
10338
|
);
|
|
9761
10339
|
}
|
|
@@ -10043,12 +10621,12 @@ function encodePlaceLimitOrderViaCalldata(args) {
|
|
|
10043
10621
|
return bytesToHex2(
|
|
10044
10622
|
concatBytes2(
|
|
10045
10623
|
hexToBytes2(OPERATOR_ROUTER_SELECTORS.placeLimitOrderVia, "placeLimitOrderVia selector"),
|
|
10046
|
-
|
|
10624
|
+
addressWord5(operator.bytes),
|
|
10047
10625
|
bytes32FromHex(args.base, "base"),
|
|
10048
10626
|
bytes32FromHex(args.quote, "quote"),
|
|
10049
10627
|
uint8Word2(side),
|
|
10050
|
-
|
|
10051
|
-
|
|
10628
|
+
uint256Word5(price, "price"),
|
|
10629
|
+
uint256Word5(amount, "amount"),
|
|
10052
10630
|
uint64Word4(expiresAtBlock, "expiresAtBlock")
|
|
10053
10631
|
)
|
|
10054
10632
|
);
|
|
@@ -10360,7 +10938,7 @@ function uint16Word2(value, name) {
|
|
|
10360
10938
|
out[31] = Number(value & 0xffn);
|
|
10361
10939
|
return out;
|
|
10362
10940
|
}
|
|
10363
|
-
function
|
|
10941
|
+
function uint256Word5(value, name) {
|
|
10364
10942
|
if (value < 0n || value >= 1n << 256n) {
|
|
10365
10943
|
throw new MarketActionError(`${name} must fit uint256`);
|
|
10366
10944
|
}
|
|
@@ -10372,7 +10950,7 @@ function uint256Word3(value, name) {
|
|
|
10372
10950
|
}
|
|
10373
10951
|
return out;
|
|
10374
10952
|
}
|
|
10375
|
-
function
|
|
10953
|
+
function addressWord5(addr) {
|
|
10376
10954
|
if (addr.length !== 20) {
|
|
10377
10955
|
throw new MarketActionError("address must be 20 bytes");
|
|
10378
10956
|
}
|
|
@@ -10912,8 +11490,8 @@ var MONOLYTHIUM_NETWORKS = {
|
|
|
10912
11490
|
};
|
|
10913
11491
|
|
|
10914
11492
|
// src/index.ts
|
|
10915
|
-
var version = "0.4.
|
|
11493
|
+
var version = "0.4.8";
|
|
10916
11494
|
|
|
10917
|
-
export { ADDRESS_HRP, ADDRESS_KIND_HRPS, API_STREAM_TOPICS, AddressError, AgentActionError, ApiClient, BRIDGE_QUOTE_API_BLOCKED_REASON, BRIDGE_REVERT_TAGS, BRIDGE_SELECTORS, BRIDGE_SUBMIT_API_BLOCKED_REASON, BURN_ADDR, BridgePrecompileError, BridgeRouteCatalogueError, CHAIN_REGISTRY, CHAIN_REGISTRY_RAW_BASE, CLOB_MARKET_ID_DOMAIN_TAG, CLOB_SELECTORS, CLUSTER_FORMED_EVENT_SIG, DEFAULT_CLUSTER_JOIN_EXECUTION_UNIT_LIMIT, DELEGATION_REVERT_TAGS, DELEGATION_SELECTORS, DIVERSITY_SCORE_MAX, DelegationPrecompileError, EMPTY_ROOT, EXECUTION_UNIT_PRICE_SAFETY_MULTIPLIER, FEED_ID_DOMAIN_TAG, LYTHOSHI_PER_LYTH, LYTH_DECIMALS, MAX_NATIVE_CALL_FORWARDER_REQUEST_BYTES, MAX_NATIVE_RECEIPT_EVENTS, MIN_EXECUTION_UNIT_PRICE_LYTHOSHI, ML_DSA_65_PUBLIC_KEY_LEN2 as ML_DSA_65_PUBLIC_KEY_LEN, ML_DSA_65_SIGNATURE_LEN2 as ML_DSA_65_SIGNATURE_LEN, MONOLYTHIUM_NETWORKS, MONOLYTHIUM_TESTNET_CHAIN_ID, MONOLYTHIUM_TESTNET_NETWORK_NAME, MRV_DEPLOY_PAYLOAD_VERSION, MRV_FORMAT_VERSION, MRV_MAX_ABI_SYMBOLS, MRV_MAX_CODE_BYTES, MRV_MAX_DEBUG_BYTES, MRV_MAX_MEMORY_PAGES, MRV_MAX_STORAGE_NAMESPACE_BYTES, MRV_MEMORY_PAGE_BYTES, MRV_PROFILE_MONO_RV32IM_V1, MRV_STRUCTURED_FEE_FIELDS, MRV_TX_EXTENSION_KIND, MRV_TX_EXTENSION_V1, MULTISIG_ADDRESS_DERIVATION_DOMAIN, MarketActionError, MrvValidationError, NAME_BASE_MULTIPLIER, NAME_FALLBACK_FEE_UNIT_LYTHOSHI, NAME_LABEL_MAX_LEN, NAME_LABEL_MIN_LEN, NAME_MAX_LEN, NAME_REGISTRY_SELECTORS, NATIVE_AGENT_MODULE_ADDRESS, NATIVE_AGENT_MODULE_ADDRESS_BYTES, NATIVE_CALL_FORWARDER_ARTIFACT_PROFILE, NATIVE_CALL_FORWARDER_RESPONSE_CAPACITY, NATIVE_CALL_FORWARDER_RESPONSE_OFFSET, NATIVE_DEV_HOST_API_VERSION, NATIVE_DEV_IPC_PROTOCOL_VERSION, NATIVE_DEV_MANIFEST_SCHEMA_VERSION, NATIVE_LYTH_DECIMALS, NATIVE_MARKET_EVENT_FAMILY, NATIVE_MARKET_MODULE_ADDRESS, NATIVE_MARKET_MODULE_ADDRESS_BYTES, NATIVE_MARKET_ORDER_BOOK_STREAM_TOPIC, NODE_REGISTRY_BLS_PUBKEY_BYTES, NODE_REGISTRY_CAPABILITIES, NODE_REGISTRY_CAPABILITY_MASK, NODE_REGISTRY_CLUSTER_MEMBER_REF_BYTES, NODE_REGISTRY_CONSENSUS_POP_BYTES, NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES, NODE_REGISTRY_CONSENSUS_SIGNATURE_BYTES, NODE_REGISTRY_DKG_ATTESTATION_SIG_BYTES, NODE_REGISTRY_DKG_RESHARE_MAX_SIGNERS, NODE_REGISTRY_DKG_RESHARE_MIN_SIGNERS, NODE_REGISTRY_DKG_THRESHOLD_SIG_BYTES, NODE_REGISTRY_FORM_CLUSTER_ACTIVE_COUNT, NODE_REGISTRY_FORM_CLUSTER_MEMBER_COUNT, NODE_REGISTRY_FORM_CLUSTER_MESSAGE_DOMAIN, NODE_REGISTRY_FORM_CLUSTER_STANDBY_COUNT, NODE_REGISTRY_FORM_CLUSTER_THRESHOLD, NODE_REGISTRY_LEGACY_CLUSTER_MEMBER_PUBKEY_BYTES, NODE_REGISTRY_PENDING_CHANGE_MAX_INTENT_ID, NODE_REGISTRY_PUBLIC_SERVICE_MASK, NODE_REGISTRY_SELECTORS, NO_EVM_ARCHIVE_PROOF_SCHEMA, NO_EVM_ARCHIVE_SIGNATURE_SCHEME, NO_EVM_FINALITY_EVIDENCE_SCHEMA, NO_EVM_FINALITY_EVIDENCE_SOURCE, NO_EVM_RECEIPTS_ROOT_DOMAIN, NO_EVM_RECEIPT_CODEC, NO_EVM_RECEIPT_PROOF_SCHEMA, NO_EVM_RECEIPT_PROOF_TYPE, NO_EVM_RECEIPT_ROOT_ALGORITHM, NameRegistryError, NoEvmReceiptProofError, NodeRegistryError, OPERATOR_ROUTER_ADDRESS, OPERATOR_ROUTER_EVENT_SIGS, OPERATOR_ROUTER_SELECTORS, OPERATOR_ROUTER_SIGS, ORACLE_EVENT_SIGS, OracleEventError, PENDING_CHANGE_KIND_CODES, PRECOMPILE_ADDRESSES, PROTOCOL_MAX_OPERATOR_FEE_BPS, PROVER_MARKET_ADDRESS, PROVER_MARKET_BID_DOMAIN, PROVER_MARKET_EVENT_SIGS, PROVER_MARKET_REQUEST_DOMAIN, PROVER_MARKET_SELECTORS, PROVER_MARKET_SUBMIT_DOMAIN, PROVER_SLASH_REASON_BAD_PROOF, PROVER_SLASH_REASON_NON_DELIVERY, PUBKEY_REGISTRY_ML_DSA_65_PUBLIC_KEY_LEN, PUBKEY_REGISTRY_SELECTORS, ProverMarketError, PubkeyRegistryError, REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT, RESERVED_ADDRESS_HRPS, RpcClient, SERVES_GPU_PROVE, SERVICE_PROBE_STATUS, SET_POLICY_CLAIM_DOMAIN_TAG, SPENDING_POLICY_SELECTORS, SdkError, SpendingPolicyError, TESTNET_69420, TRANSFER_DEFAULT_EXECUTION_UNIT_LIMIT, V1_BRIDGE_ALLOWED_FEE_TOKEN, V1_BRIDGE_ALLOWED_PROTOCOL, addressBytesToHex, addressToBech32, addressToTypedBech32, allowRootFor, apiEndpointFromRpcEndpoint, assertMrvCallNativeSubmissionPlan, assertMrvDeployNativeSubmissionPlan, assertMrvFeeDisplayConformance, assertMrvStructuredFeeConformance, assertNativeDevMrcTokenPlan, assertNativeDevMrvDeployPlan, assertNativeDevWalletApprovalRequest, assertNativeMarketOrderBookStreamPayload, assessBridgeRoute, bech32ToAddress, bech32ToAddressBytes, bidSighash, bridgeAddressHex, bridgeDrainRemaining, bridgeQuoteSubmitReadiness, bridgeRoutesReadiness, bridgeTransferCandidates, buildBridgeRouteCatalogue, buildCancelSpotOrderPlan, buildMrvCallNativeTxPlan, buildMrvCallPlan, buildMrvCallRequest, buildMrvDeployNativeTxPlan, buildMrvDeployPayloadNativeTxPlan, buildMrvDeployPayloadPlan, buildMrvDeployPayloadRequest, buildMrvDeployPlan, buildMrvDeployRequest, buildNativeAgentCreateEscrowForwarderInput, buildNativeAgentCreateEscrowModuleCall, buildNativeAgentModuleCallEnvelope, buildNativeAgentRecordReputationForwarderInput, buildNativeAgentRecordReputationModuleCall, buildNativeAgentSetSpendingPolicyForwarderInput, buildNativeAgentSetSpendingPolicyModuleCall, buildNativeCallForwarderArtifact, buildNativeMarketModuleCallEnvelope, buildNativeNftBuyListingForwarderInput, buildNativeNftBuyListingModuleCall, buildNativeNftCancelListingForwarderInput, buildNativeNftCancelListingModuleCall, buildNativeNftCreateListingForwarderInput, buildNativeNftCreateListingModuleCall, buildNativeNftPlaceAuctionBidForwarderInput, buildNativeNftPlaceAuctionBidModuleCall, buildNativeNftSettleAuctionForwarderInput, buildNativeNftSettleAuctionModuleCall, buildNativeNftSweepExpiredListingsForwarderInput, buildNativeNftSweepExpiredListingsModuleCall, buildNativeSpotCancelOrderForwarderInput, buildNativeSpotCancelOrderModuleCall, buildNativeSpotCreateMarketForwarderInput, buildNativeSpotCreateMarketModuleCall, buildNativeSpotLimitOrderForwarderInput, buildNativeSpotLimitOrderModuleCall, buildNativeSpotSettleLimitOrderForwarderInput, buildNativeSpotSettleLimitOrderModuleCall, buildNativeSpotSettleRoutedLimitOrderForwarderInput, buildNativeSpotSettleRoutedLimitOrderModuleCall, buildPlaceLimitOrderViaPlan, buildPlaceSpotLimitOrderPlan, buildPlaceSpotMarketOrderExPlan, buildPlaceSpotMarketOrderPlan, buildRequestClusterJoinTxFields, buildVoteClusterAdmitTxFields, categoryRoot, checkMrvFeeDisplayConformance, checkMrvStructuredFeeConformance, checkNativeDevkitCompatibility, clampPriorityTip, clobAddressHex, clusterApyPercent, clusterJoinRequestExists, compareNativeDevVersions, composeClaimBoundMessage, computeNoEvmDacFinalityMessage, computeNoEvmLeaderFinalityMessage, computeNoEvmReceiptsRoot, computeNoEvmRoundFinalityMessage, computeNoEvmTargetReceiptHash, computeQuoteLiquidity, consumeNativeEvents, decodeClusterDiversity, decodeClusterFormedEvent, decodeClusterJoinRequest, decodeHasPubkeyReturn, decodeLookupPubkeyReturn, decodeNativeAgentStateResponse, decodeNativeMarketOrderBookDeltasResponse, decodeNativeReceiptResponse, decodeNoEvmReceiptTranscript, decodeOperatorFeeChargedEvent, decodeOperatorNetworkMetadata, decodeOracleEvent, decodeTimeWindow, decodeTxFeedResponse, delegationAddressHex, denyRootFor, deriveClobMarketId, deriveClusterAnchorAddress, deriveClusterJoinOperatorId, deriveFeedId, deriveMrvContractAddress, deriveNativeSpotMarketId, deriveNativeSpotOrderId, destinationRoot, encodeAttestDkgReshareCalldata, encodeBlockSelector, encodeBridgeChallengeCalldata, encodeBridgeClaimCalldata, encodeCancelClusterJoinCalldata, encodeCancelOrderCalldata, encodeCancelPendingChangeCalldata, encodeClaimCalldata, encodeClaimPolicyByAddressCalldata, encodeCompleteRedemptionCalldata, encodeCreateRequestCalldata, encodeCreateRequestCanonical, encodeDelegateCalldata, encodeDisableCalldata, encodeEnableCalldata, encodeExpireClusterJoinCalldata, encodeFormClusterCalldata, encodeGetClusterJoinRequestCalldata, encodeHasPubkeyCalldata, encodeLockBridgeConfigCalldata, encodeLookupPubkeyCalldata, encodeMrvDeployPayload, encodeNameAcceptTransferCall, encodeNameProposeTransferCall, encodeNameRegisterCall, encodeNativeAgentAcceptEscrowCall, encodeNativeAgentApproveEscrowCall, encodeNativeAgentArbiterGetCall, encodeNativeAgentAttestationGetCall, encodeNativeAgentAvailabilityGetCall, encodeNativeAgentCancelEscrowCall, encodeNativeAgentCloseAvailabilityCall, encodeNativeAgentConsentGetCall, encodeNativeAgentCounterEscrowCall, encodeNativeAgentCreateEscrowCall, encodeNativeAgentDeactivateServiceCall, encodeNativeAgentDisputeEscrowCall, encodeNativeAgentEscrowGetCall, encodeNativeAgentGrantConsentCall, encodeNativeAgentIssueAttestationCall, encodeNativeAgentIssuerGetCall, encodeNativeAgentListServiceCall, encodeNativeAgentModuleForwarderInput, encodeNativeAgentOpenAvailabilityCall, encodeNativeAgentRecordPolicySpendCall, encodeNativeAgentRecordReputationCall, encodeNativeAgentRegisterArbiterCall, encodeNativeAgentRegisterIssuerCall, encodeNativeAgentReputationGetCall, encodeNativeAgentResolveEscrowCall, encodeNativeAgentRevokeAttestationCall, encodeNativeAgentRevokeConsentCall, encodeNativeAgentServiceGetCall, encodeNativeAgentSetAvailabilityCall, encodeNativeAgentSetSpendingPolicyCall, encodeNativeAgentSpendingPolicyGetCall, encodeNativeAgentStartEscrowCall, encodeNativeAgentSubmitEscrowCall, encodeNativeMarketModuleForwarderInput, encodeNativeNftBuyListingCall, encodeNativeNftCancelListingCall, encodeNativeNftCreateListingCall, encodeNativeNftPlaceAuctionBidCall, encodeNativeNftSettleAuctionCall, encodeNativeNftSweepExpiredListingsCall, encodeNativeSpotCancelOrderCall, encodeNativeSpotCreateMarketCall, encodeNativeSpotLimitOrderCall, encodeNativeSpotSettleLimitOrderCall, encodeNativeSpotSettleRoutedLimitOrderCall, encodePlaceLimitOrderCalldata, encodePlaceLimitOrderViaCalldata, encodePlaceMarketOrderCalldata, encodePlaceMarketOrderExCalldata, encodeRecoverOperatorNodeCalldata, encodeRedelegateCalldata, encodeRegisterPubkeyCalldata, encodeReportServiceProbeCalldata, encodeRequestClusterJoinCalldata, encodeSetAutoCompoundCalldata, encodeSetBridgeResumeCooldownCalldata, encodeSetBridgeRouteFinalityCalldata, encodeSetLotSizeCalldata, encodeSetMinNotionalCalldata, encodeSetPolicyCalldata, encodeSetPolicyClaimCalldata, encodeSetTickSizeCalldata, encodeSubmitBridgeProofCalldata, encodeSubmitPendingChangeCalldata, encodeUndelegateCalldata, encodeVoteClusterAdmitCalldata, exportBridgeRouteCatalogueJson, fetchChainInfoLatest, fetchChainRegistryLatest, formClusterMessage, formClusterMessageHex, formatLyth, formatLythoshi, formatNativeReceiptFeeDisplay, formatOraclePrice, getChainInfo, getNoEvmReceiptTrustPolicy, getP2pSeeds, getRpcEndpoints, hexToAddressBytes, isBridgeAdminLockedRevert, isBridgeCooldownZeroRevert, isBridgeFinalityZeroRevert, isBridgeResumeCooldownActiveRevert, isConcreteServiceProbeStatus, isNativeDecodedEvent, isNativeMarketOrderBookStreamPayload, isRedemptionPrincipalUnavailableRevert, isSinglePublicServiceProbeMask, isValidNodeRegistryCapabilities, isValidPublicServiceProbeMask, mrvAddressToBech32, mrvBech32ToAddress, mrvCodeHashHex, mrvV1TransactionExtension, nameLengthModifierX10, nameRegistrationCost, nameRegistryAddressHex, nativeAgentStateFilterParams, nativeDevSchemaFieldNames, nativeDevUiStrings, nativeEventMatches, nativeEventsFilterParams, nativeEventsFromHistory, nativeEventsFromReceipt, nativeMarketEventFilter, nativeMarketEventsFromHistory, nativeMarketEventsFromReceipt, nativeMarketStateFilterParams, noEvmReceiptTrustPolicyFromChainInfo, nodeHostingClassFromByte, nodeHostingClassToByte, nodeRegistryAddressHex, normalizeAddressHex, normalizeBridgeRouteCatalogue, normalizePendingChangeKind, oracleAddressHex, oraclePriceToNumber, packTimeWindow, parseAddress, parseBridgeRouteCatalogueJson, parseChainRegistryToml, parseDkgResharePublicKeys, parseLythToLythoshi, parseNameCategory, parseNativeDecodedEvent, parseQuantity, parseQuantityBig, preflightClusterJoinRequest, previewRequestClusterJoin, previewVoteClusterAdmit, proverMarketStateFromByte, pubkeyRegistryAddressHex, quoteOperatorFee, rankBridgeRoutes, rankMarketsByVolume, readClusterJoinRequest, requestSighash, requireTypedAddress, resolveClusterJoinExecutionFee, resolveExecutionFee, resolveMaxExecutionUnitPrice, resolveRegistryExecutionFee, resolveStudioHostStatus, selectBridgeTransferRoute, serviceProbeStatusLabel, setDestinationRoot, spendingPolicyAddressHex, submitMrvCallNativeTx, submitMrvDeployNativeTx, submitMrvDeployPayloadNativeTx, submitRequestClusterJoin, submitSighash, submitVoteClusterAdmit, transactionFeeExposure, typedBech32ToAddress, validateAddress, validateBridgeRouteCatalogue, validateMrvArtifactMetadata, validateMrvCallRequest, validateMrvDeployRequest, verifyNoEvmArchiveProofSignatures, verifyNoEvmBlockFinalityEvidenceMultisig, verifyNoEvmBlockFinalityEvidenceThreshold, verifyNoEvmFinalityEvidenceMultisig, verifyNoEvmFinalityEvidenceThreshold, verifyNoEvmReceiptProof, verifyNoEvmReceiptProofTrust, version };
|
|
11495
|
+
export { ADDRESS_HRP, ADDRESS_KIND_HRPS, API_STREAM_TOPICS, AddressError, AgentActionError, ApiClient, BRIDGE_QUOTE_API_BLOCKED_REASON, BRIDGE_REVERT_TAGS, BRIDGE_SELECTORS, BRIDGE_SUBMIT_API_BLOCKED_REASON, BURN_ADDR, BridgePrecompileError, BridgeRouteCatalogueError, CHAIN_REGISTRY, CHAIN_REGISTRY_RAW_BASE, CLOB_MARKET_ID_DOMAIN_TAG, CLOB_SELECTORS, CLUSTER_FORMED_EVENT_SIG, DEFAULT_CLUSTER_JOIN_EXECUTION_UNIT_LIMIT, DEFAULT_OPERATOR_SEAL_KEY_EXECUTION_UNIT_LIMIT, DELEGATION_REVERT_TAGS, DELEGATION_SELECTORS, DIVERSITY_SCORE_MAX, DelegationPrecompileError, EMPTY_ROOT, EXECUTION_UNIT_PRICE_SAFETY_MULTIPLIER, FEED_ID_DOMAIN_TAG, LYTHOSHI_PER_LYTH, LYTH_DECIMALS, MAX_NATIVE_CALL_FORWARDER_REQUEST_BYTES, MAX_NATIVE_RECEIPT_EVENTS, MIN_EXECUTION_UNIT_PRICE_LYTHOSHI, ML_DSA_65_PUBLIC_KEY_LEN2 as ML_DSA_65_PUBLIC_KEY_LEN, ML_DSA_65_SIGNATURE_LEN2 as ML_DSA_65_SIGNATURE_LEN, MONOLYTHIUM_NETWORKS, MONOLYTHIUM_TESTNET_CHAIN_ID, MONOLYTHIUM_TESTNET_NETWORK_NAME, MRV_DEPLOY_PAYLOAD_VERSION, MRV_FORMAT_VERSION, MRV_MAX_ABI_SYMBOLS, MRV_MAX_CODE_BYTES, MRV_MAX_DEBUG_BYTES, MRV_MAX_MEMORY_PAGES, MRV_MAX_STORAGE_NAMESPACE_BYTES, MRV_MEMORY_PAGE_BYTES, MRV_PROFILE_MONO_RV32IM_V1, MRV_STRUCTURED_FEE_FIELDS, MRV_TX_EXTENSION_KIND, MRV_TX_EXTENSION_V1, MULTISIG_ADDRESS_DERIVATION_DOMAIN, MarketActionError, MrvValidationError, NAME_BASE_MULTIPLIER, NAME_FALLBACK_FEE_UNIT_LYTHOSHI, NAME_LABEL_MAX_LEN, NAME_LABEL_MIN_LEN, NAME_MAX_LEN, NAME_REGISTRY_SELECTORS, NATIVE_AGENT_MODULE_ADDRESS, NATIVE_AGENT_MODULE_ADDRESS_BYTES, NATIVE_CALL_FORWARDER_ARTIFACT_PROFILE, NATIVE_CALL_FORWARDER_RESPONSE_CAPACITY, NATIVE_CALL_FORWARDER_RESPONSE_OFFSET, NATIVE_DEV_HOST_API_VERSION, NATIVE_DEV_IPC_PROTOCOL_VERSION, NATIVE_DEV_MANIFEST_SCHEMA_VERSION, NATIVE_LYTH_DECIMALS, NATIVE_MARKET_EVENT_FAMILY, NATIVE_MARKET_MODULE_ADDRESS, NATIVE_MARKET_MODULE_ADDRESS_BYTES, NATIVE_MARKET_ORDER_BOOK_STREAM_TOPIC, NODE_REGISTRY_BLS_PUBKEY_BYTES, NODE_REGISTRY_CAPABILITIES, NODE_REGISTRY_CAPABILITY_MASK, NODE_REGISTRY_CLUSTER_MEMBER_REF_BYTES, NODE_REGISTRY_CONSENSUS_POP_BYTES, NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES, NODE_REGISTRY_CONSENSUS_SIGNATURE_BYTES, NODE_REGISTRY_DKG_ATTESTATION_SIG_BYTES, NODE_REGISTRY_DKG_RESHARE_MAX_SIGNERS, NODE_REGISTRY_DKG_RESHARE_MIN_SIGNERS, NODE_REGISTRY_DKG_THRESHOLD_SIG_BYTES, NODE_REGISTRY_FORM_CLUSTER_ACTIVE_COUNT, NODE_REGISTRY_FORM_CLUSTER_MEMBER_COUNT, NODE_REGISTRY_FORM_CLUSTER_MESSAGE_DOMAIN, NODE_REGISTRY_FORM_CLUSTER_STANDBY_COUNT, NODE_REGISTRY_FORM_CLUSTER_THRESHOLD, NODE_REGISTRY_LEGACY_CLUSTER_MEMBER_PUBKEY_BYTES, NODE_REGISTRY_OPERATOR_ALIAS_MAX_BYTES, NODE_REGISTRY_OPERATOR_MONIKER_MAX_BYTES, NODE_REGISTRY_OPERATOR_SEAL_EK_BYTES, NODE_REGISTRY_PENDING_CHANGE_MAX_INTENT_ID, NODE_REGISTRY_PUBLIC_SERVICE_MASK, NODE_REGISTRY_SELECTORS, NO_EVM_ARCHIVE_PROOF_SCHEMA, NO_EVM_ARCHIVE_SIGNATURE_SCHEME, NO_EVM_FINALITY_EVIDENCE_SCHEMA, NO_EVM_FINALITY_EVIDENCE_SOURCE, NO_EVM_RECEIPTS_ROOT_DOMAIN, NO_EVM_RECEIPT_CODEC, NO_EVM_RECEIPT_PROOF_SCHEMA, NO_EVM_RECEIPT_PROOF_TYPE, NO_EVM_RECEIPT_ROOT_ALGORITHM, NameRegistryError, NoEvmReceiptProofError, NodeRegistryError, OPERATOR_ROUTER_ADDRESS, OPERATOR_ROUTER_EVENT_SIGS, OPERATOR_ROUTER_SELECTORS, OPERATOR_ROUTER_SIGS, ORACLE_EVENT_SIGS, OracleEventError, PENDING_CHANGE_KIND_CODES, PRECOMPILE_ADDRESSES, PROTOCOL_MAX_OPERATOR_FEE_BPS, PROVER_MARKET_ADDRESS, PROVER_MARKET_BID_DOMAIN, PROVER_MARKET_EVENT_SIGS, PROVER_MARKET_REQUEST_DOMAIN, PROVER_MARKET_SELECTORS, PROVER_MARKET_SUBMIT_DOMAIN, PROVER_SLASH_REASON_BAD_PROOF, PROVER_SLASH_REASON_NON_DELIVERY, PUBKEY_REGISTRY_ML_DSA_65_PUBLIC_KEY_LEN, PUBKEY_REGISTRY_SELECTORS, ProverMarketError, PubkeyRegistryError, REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT, RESERVED_ADDRESS_HRPS, RpcClient, SERVES_GPU_PROVE, SERVICE_PROBE_STATUS, SET_POLICY_CLAIM_DOMAIN_TAG, SPENDING_POLICY_SELECTORS, SdkError, SpendingPolicyError, TESTNET_69420, TOKEN_FACTORY_CREATE_DEPOSIT_LYTHOSHI, TOKEN_FACTORY_FLAGS, TOKEN_FACTORY_KNOWN_FLAG_MASK, TOKEN_FACTORY_MAX_CREATOR_FEE_BPS, TOKEN_FACTORY_MAX_DECIMALS, TOKEN_FACTORY_NAME_MAX_BYTES, TOKEN_FACTORY_SELECTORS, TOKEN_FACTORY_SIGS, TOKEN_FACTORY_SYMBOL_MAX_BYTES, TOKEN_FACTORY_TOKEN_ID_DOMAIN_TAG, TRANSFER_DEFAULT_EXECUTION_UNIT_LIMIT, TokenFactoryError, V1_BRIDGE_ALLOWED_FEE_TOKEN, V1_BRIDGE_ALLOWED_PROTOCOL, VRF_DOMAIN_TAG_MAX_BYTES, VRF_HEIGHT_NOT_FINALIZED_REVERT, VRF_OUTPUT_BYTES, VrfCallError, addressBytesToHex, addressToBech32, addressToTypedBech32, allowRootFor, apiEndpointFromRpcEndpoint, assertMrvCallNativeSubmissionPlan, assertMrvDeployNativeSubmissionPlan, assertMrvFeeDisplayConformance, assertMrvStructuredFeeConformance, assertNativeDevMrcTokenPlan, assertNativeDevMrvDeployPlan, assertNativeDevWalletApprovalRequest, assertNativeMarketOrderBookStreamPayload, assessBridgeRoute, bech32ToAddress, bech32ToAddressBytes, bidSighash, bridgeAddressHex, bridgeDrainRemaining, bridgeQuoteSubmitReadiness, bridgeRoutesReadiness, bridgeTransferCandidates, buildBridgeRouteCatalogue, buildCancelSpotOrderPlan, buildMrvCallNativeTxPlan, buildMrvCallPlan, buildMrvCallRequest, buildMrvDeployNativeTxPlan, buildMrvDeployPayloadNativeTxPlan, buildMrvDeployPayloadPlan, buildMrvDeployPayloadRequest, buildMrvDeployPlan, buildMrvDeployRequest, buildNativeAgentCreateEscrowForwarderInput, buildNativeAgentCreateEscrowModuleCall, buildNativeAgentModuleCallEnvelope, buildNativeAgentRecordReputationForwarderInput, buildNativeAgentRecordReputationModuleCall, buildNativeAgentSetSpendingPolicyForwarderInput, buildNativeAgentSetSpendingPolicyModuleCall, buildNativeCallForwarderArtifact, buildNativeMarketModuleCallEnvelope, buildNativeNftBuyListingForwarderInput, buildNativeNftBuyListingModuleCall, buildNativeNftCancelListingForwarderInput, buildNativeNftCancelListingModuleCall, buildNativeNftCreateListingForwarderInput, buildNativeNftCreateListingModuleCall, buildNativeNftPlaceAuctionBidForwarderInput, buildNativeNftPlaceAuctionBidModuleCall, buildNativeNftSettleAuctionForwarderInput, buildNativeNftSettleAuctionModuleCall, buildNativeNftSweepExpiredListingsForwarderInput, buildNativeNftSweepExpiredListingsModuleCall, buildNativeSpotCancelOrderForwarderInput, buildNativeSpotCancelOrderModuleCall, buildNativeSpotCreateMarketForwarderInput, buildNativeSpotCreateMarketModuleCall, buildNativeSpotLimitOrderForwarderInput, buildNativeSpotLimitOrderModuleCall, buildNativeSpotSettleLimitOrderForwarderInput, buildNativeSpotSettleLimitOrderModuleCall, buildNativeSpotSettleRoutedLimitOrderForwarderInput, buildNativeSpotSettleRoutedLimitOrderModuleCall, buildPlaceLimitOrderViaPlan, buildPlaceSpotLimitOrderPlan, buildPlaceSpotMarketOrderExPlan, buildPlaceSpotMarketOrderPlan, buildPublishOperatorSealKeyTxFields, buildRequestClusterJoinTxFields, buildVoteClusterAdmitTxFields, categoryRoot, checkMrvFeeDisplayConformance, checkMrvStructuredFeeConformance, checkNativeDevkitCompatibility, clampPriorityTip, clobAddressHex, clusterApyPercent, clusterJoinRequestExists, compareNativeDevVersions, composeClaimBoundMessage, computeNoEvmDacFinalityMessage, computeNoEvmLeaderFinalityMessage, computeNoEvmReceiptsRoot, computeNoEvmRoundFinalityMessage, computeNoEvmTargetReceiptHash, computeQuoteLiquidity, consumeNativeEvents, decodeClusterDiversity, decodeClusterFormedEvent, decodeClusterJoinRequest, decodeHasPubkeyReturn, decodeLookupPubkeyReturn, decodeNativeAgentStateResponse, decodeNativeMarketOrderBookDeltasResponse, decodeNativeReceiptResponse, decodeNoEvmReceiptTranscript, decodeOperatorFeeChargedEvent, decodeOperatorNetworkMetadata, decodeOperatorSealKey, decodeOracleEvent, decodeTimeWindow, decodeTokenFactoryTokenId, decodeTxFeedResponse, decodeVrfOutput, delegationAddressHex, denyRootFor, deriveClobMarketId, deriveClusterAnchorAddress, deriveClusterJoinOperatorId, deriveFeedId, deriveMrvContractAddress, deriveNativeSpotMarketId, deriveNativeSpotOrderId, deriveTokenFactoryTokenId, destinationRoot, encodeAttestDkgReshareCalldata, encodeBlockSelector, encodeBridgeChallengeCalldata, encodeBridgeClaimCalldata, encodeCancelClusterJoinCalldata, encodeCancelOrderCalldata, encodeCancelPendingChangeCalldata, encodeClaimCalldata, encodeClaimPolicyByAddressCalldata, encodeCompleteRedemptionCalldata, encodeCreateFixedSupplyMrc20Calldata, encodeCreateRequestCalldata, encodeCreateRequestCanonical, encodeCreateTokenCalldata, encodeDelegateCalldata, encodeDisableCalldata, encodeEnableCalldata, encodeExpireClusterJoinCalldata, encodeFormClusterCalldata, encodeGetClusterJoinRequestCalldata, encodeGetOperatorSealKeyCalldata, encodeHasPubkeyCalldata, encodeLockBridgeConfigCalldata, encodeLookupPubkeyCalldata, encodeMrvDeployPayload, encodeNameAcceptTransferCall, encodeNameProposeTransferCall, encodeNameRegisterCall, encodeNativeAgentAcceptEscrowCall, encodeNativeAgentApproveEscrowCall, encodeNativeAgentArbiterGetCall, encodeNativeAgentAttestationGetCall, encodeNativeAgentAvailabilityGetCall, encodeNativeAgentCancelEscrowCall, encodeNativeAgentCloseAvailabilityCall, encodeNativeAgentConsentGetCall, encodeNativeAgentCounterEscrowCall, encodeNativeAgentCreateEscrowCall, encodeNativeAgentDeactivateServiceCall, encodeNativeAgentDisputeEscrowCall, encodeNativeAgentEscrowGetCall, encodeNativeAgentGrantConsentCall, encodeNativeAgentIssueAttestationCall, encodeNativeAgentIssuerGetCall, encodeNativeAgentListServiceCall, encodeNativeAgentModuleForwarderInput, encodeNativeAgentOpenAvailabilityCall, encodeNativeAgentRecordPolicySpendCall, encodeNativeAgentRecordReputationCall, encodeNativeAgentRegisterArbiterCall, encodeNativeAgentRegisterIssuerCall, encodeNativeAgentReputationGetCall, encodeNativeAgentResolveEscrowCall, encodeNativeAgentRevokeAttestationCall, encodeNativeAgentRevokeConsentCall, encodeNativeAgentServiceGetCall, encodeNativeAgentSetAvailabilityCall, encodeNativeAgentSetSpendingPolicyCall, encodeNativeAgentSpendingPolicyGetCall, encodeNativeAgentStartEscrowCall, encodeNativeAgentSubmitEscrowCall, encodeNativeMarketModuleForwarderInput, encodeNativeNftBuyListingCall, encodeNativeNftCancelListingCall, encodeNativeNftCreateListingCall, encodeNativeNftPlaceAuctionBidCall, encodeNativeNftSettleAuctionCall, encodeNativeNftSweepExpiredListingsCall, encodeNativeSpotCancelOrderCall, encodeNativeSpotCreateMarketCall, encodeNativeSpotLimitOrderCall, encodeNativeSpotSettleLimitOrderCall, encodeNativeSpotSettleRoutedLimitOrderCall, encodePlaceLimitOrderCalldata, encodePlaceLimitOrderViaCalldata, encodePlaceMarketOrderCalldata, encodePlaceMarketOrderExCalldata, encodePublishOperatorSealKeyCalldata, encodeRecoverOperatorNodeCalldata, encodeRedelegateCalldata, encodeRegisterPubkeyCalldata, encodeReportServiceProbeCalldata, encodeRequestClusterJoinCalldata, encodeSetAutoCompoundCalldata, encodeSetBridgeResumeCooldownCalldata, encodeSetBridgeRouteFinalityCalldata, encodeSetLotSizeCalldata, encodeSetMinNotionalCalldata, encodeSetOperatorDisplayCalldata, encodeSetPolicyCalldata, encodeSetPolicyClaimCalldata, encodeSetTickSizeCalldata, encodeSubmitBridgeProofCalldata, encodeSubmitPendingChangeCalldata, encodeTokenFactoryAllowanceCalldata, encodeTokenFactoryApproveCalldata, encodeTokenFactoryBalanceOfCalldata, encodeTokenFactoryBurnCalldata, encodeTokenFactoryDecreaseAllowanceCalldata, encodeTokenFactoryDestroyCalldata, encodeTokenFactoryIncreaseAllowanceCalldata, encodeTokenFactoryMetadataCalldata, encodeTokenFactoryMintCalldata, encodeTokenFactorySetPausedCalldata, encodeTokenFactoryTotalSupplyCalldata, encodeTokenFactoryTransferCalldata, encodeTokenFactoryTransferFromCalldata, encodeTokenFactoryTransferOwnershipCalldata, encodeUndelegateCalldata, encodeVoteClusterAdmitCalldata, encodeVrfEvaluateCalldata, exportBridgeRouteCatalogueJson, fetchChainInfoLatest, fetchChainRegistryLatest, formClusterMessage, formClusterMessageHex, formatLyth, formatLythoshi, formatNativeReceiptFeeDisplay, formatOraclePrice, getChainInfo, getNoEvmReceiptTrustPolicy, getP2pSeeds, getRpcEndpoints, hexToAddressBytes, isBridgeAdminLockedRevert, isBridgeCooldownZeroRevert, isBridgeFinalityZeroRevert, isBridgeResumeCooldownActiveRevert, isConcreteServiceProbeStatus, isNativeDecodedEvent, isNativeMarketOrderBookStreamPayload, isRedemptionPrincipalUnavailableRevert, isSinglePublicServiceProbeMask, isValidNodeRegistryCapabilities, isValidPublicServiceProbeMask, mrvAddressToBech32, mrvBech32ToAddress, mrvCodeHashHex, mrvV1TransactionExtension, nameLengthModifierX10, nameRegistrationCost, nameRegistryAddressHex, nativeAgentStateFilterParams, nativeDevSchemaFieldNames, nativeDevUiStrings, nativeEventMatches, nativeEventsFilterParams, nativeEventsFromHistory, nativeEventsFromReceipt, nativeMarketEventFilter, nativeMarketEventsFromHistory, nativeMarketEventsFromReceipt, nativeMarketStateFilterParams, noEvmReceiptTrustPolicyFromChainInfo, nodeHostingClassFromByte, nodeHostingClassToByte, nodeRegistryAddressHex, normalizeAddressHex, normalizeBridgeRouteCatalogue, normalizePendingChangeKind, oracleAddressHex, oraclePriceToNumber, packTimeWindow, parseAddress, parseBridgeRouteCatalogueJson, parseChainRegistryToml, parseDkgResharePublicKeys, parseLythToLythoshi, parseNameCategory, parseNativeDecodedEvent, parseQuantity, parseQuantityBig, preflightClusterJoinRequest, previewRequestClusterJoin, previewVoteClusterAdmit, proverMarketStateFromByte, pubkeyRegistryAddressHex, quoteOperatorFee, rankBridgeRoutes, rankMarketsByVolume, readClusterJoinRequest, requestSighash, requireTypedAddress, resolveClusterJoinExecutionFee, resolveExecutionFee, resolveMaxExecutionUnitPrice, resolveRegistryExecutionFee, resolveStudioHostStatus, selectBridgeTransferRoute, serviceProbeStatusLabel, setDestinationRoot, spendingPolicyAddressHex, submitMrvCallNativeTx, submitMrvDeployNativeTx, submitMrvDeployPayloadNativeTx, submitPublishOperatorSealKey, submitRequestClusterJoin, submitSighash, submitVoteClusterAdmit, tokenFactoryAddressHex, transactionFeeExposure, typedBech32ToAddress, validateAddress, validateBridgeRouteCatalogue, validateMrvArtifactMetadata, validateMrvCallRequest, validateMrvDeployRequest, validateTokenFactoryFlags, verifyNoEvmArchiveProofSignatures, verifyNoEvmBlockFinalityEvidenceMultisig, verifyNoEvmBlockFinalityEvidenceThreshold, verifyNoEvmFinalityEvidenceMultisig, verifyNoEvmFinalityEvidenceThreshold, verifyNoEvmReceiptProof, verifyNoEvmReceiptProofTrust, version, vrfAddressHex };
|
|
10918
11496
|
//# sourceMappingURL=index.js.map
|
|
10919
11497
|
//# sourceMappingURL=index.js.map
|