@monolythium/core-sdk 0.4.4 → 0.4.8
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 +8 -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 +8 -1
- package/dist/crypto/index.js.map +1 -1
- package/dist/index.cjs +733 -83
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +172 -46
- package/dist/index.d.ts +172 -46
- package/dist/index.js +686 -84
- package/dist/index.js.map +1 -1
- package/dist/{submission-5dQUuwtq.d.cts → submission-Bd8ajSxX.d.cts} +124 -15
- package/dist/{submission-5dQUuwtq.d.ts → submission-Bd8ajSxX.d.ts} +124 -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) {
|
|
@@ -2704,8 +2812,8 @@ var TESTNET_69420 = {
|
|
|
2704
2812
|
network: "testnet-69420",
|
|
2705
2813
|
display_name: "Monolythium Testnet",
|
|
2706
2814
|
description: "Public Monolythium testnet. Testnet state may reset without notice; do not store value on this network.",
|
|
2707
|
-
genesis_hash: "
|
|
2708
|
-
binary_sha: "
|
|
2815
|
+
genesis_hash: "0xb9bcc577fa7256664364518f2943fe298b50973b0e43831a081b4dca3d2d5a6a",
|
|
2816
|
+
binary_sha: "a5d5b299a0bf",
|
|
2709
2817
|
rpc: [
|
|
2710
2818
|
{
|
|
2711
2819
|
url: "http://178.105.12.9:8545",
|
|
@@ -2763,13 +2871,6 @@ var TESTNET_69420 = {
|
|
|
2763
2871
|
tier: "official",
|
|
2764
2872
|
notes: "operator-8"
|
|
2765
2873
|
},
|
|
2766
|
-
{
|
|
2767
|
-
url: "http://162.55.54.198:8545",
|
|
2768
|
-
provider: "monolythium-foundation",
|
|
2769
|
-
region: "nbg1",
|
|
2770
|
-
tier: "official",
|
|
2771
|
-
notes: "operator-9"
|
|
2772
|
-
},
|
|
2773
2874
|
{
|
|
2774
2875
|
url: "http://95.217.156.190:8545",
|
|
2775
2876
|
provider: "monolythium-foundation",
|
|
@@ -2782,78 +2883,93 @@ var TESTNET_69420 = {
|
|
|
2782
2883
|
provider: "monolythium-foundation",
|
|
2783
2884
|
region: "sin",
|
|
2784
2885
|
tier: "official",
|
|
2785
|
-
notes: "operator-11
|
|
2886
|
+
notes: "operator-11"
|
|
2887
|
+
},
|
|
2888
|
+
{
|
|
2889
|
+
url: "http://162.55.54.198:8545",
|
|
2890
|
+
provider: "monolythium-foundation",
|
|
2891
|
+
region: "fsn1",
|
|
2892
|
+
tier: "official",
|
|
2893
|
+
notes: "operator-9 preview operator"
|
|
2786
2894
|
},
|
|
2787
2895
|
{
|
|
2788
2896
|
url: "http://128.140.125.5:8545",
|
|
2789
2897
|
provider: "monolythium-foundation",
|
|
2790
2898
|
region: "fsn1",
|
|
2791
2899
|
tier: "official",
|
|
2792
|
-
notes: "
|
|
2900
|
+
notes: "relay-1"
|
|
2793
2901
|
},
|
|
2794
2902
|
{
|
|
2795
2903
|
url: "http://178.105.45.210:8545",
|
|
2796
2904
|
provider: "monolythium-foundation",
|
|
2797
|
-
region: "
|
|
2905
|
+
region: "fsn1",
|
|
2798
2906
|
tier: "official",
|
|
2799
|
-
notes: "relay-
|
|
2907
|
+
notes: "relay-2"
|
|
2800
2908
|
},
|
|
2801
2909
|
{
|
|
2802
2910
|
url: "http://65.21.252.34:8545",
|
|
2803
2911
|
provider: "monolythium-foundation",
|
|
2804
2912
|
region: "hel1",
|
|
2805
2913
|
tier: "official",
|
|
2806
|
-
notes: "relay-
|
|
2914
|
+
notes: "relay-3"
|
|
2807
2915
|
}
|
|
2808
2916
|
],
|
|
2809
2917
|
p2p: [
|
|
2810
2918
|
{
|
|
2811
|
-
multiaddr: "/ip4/178.105.12.9/tcp/29898/p2p/
|
|
2919
|
+
multiaddr: "/ip4/178.105.12.9/tcp/29898/p2p/12D3KooWGgh9vYbNSqYbci8w7bg2AAaFWx7umN1ADjjcUoUTF2Za",
|
|
2812
2920
|
region: "fsn1"
|
|
2813
2921
|
},
|
|
2814
2922
|
{
|
|
2815
|
-
multiaddr: "/ip4/178.105.15.216/tcp/29898/p2p/
|
|
2923
|
+
multiaddr: "/ip4/178.105.15.216/tcp/29898/p2p/12D3KooWPUMj4vt1ee1Ug2QMJQwbDHSJ936JVaqw3iLXtAqPrq7R",
|
|
2816
2924
|
region: "fsn1"
|
|
2817
2925
|
},
|
|
2818
2926
|
{
|
|
2819
|
-
multiaddr: "/ip4/178.104.233.182/tcp/29898/p2p/
|
|
2927
|
+
multiaddr: "/ip4/178.104.233.182/tcp/29898/p2p/12D3KooWLPNJFUZhXyc1S7YvjMiKXyrNKCN3eFegDFF5UZAio7NJ",
|
|
2820
2928
|
region: "nbg1"
|
|
2821
2929
|
},
|
|
2822
2930
|
{
|
|
2823
|
-
multiaddr: "/ip4/65.108.94.1/tcp/29898/p2p/
|
|
2931
|
+
multiaddr: "/ip4/65.108.94.1/tcp/29898/p2p/12D3KooWRAuuQa5iEAzLUpLnyZ9VM53dvZMt3FPj7smDcwXn3oxz",
|
|
2824
2932
|
region: "hel1"
|
|
2825
2933
|
},
|
|
2826
2934
|
{
|
|
2827
|
-
multiaddr: "/ip4/95.216.154.155/tcp/29898/p2p/
|
|
2935
|
+
multiaddr: "/ip4/95.216.154.155/tcp/29898/p2p/12D3KooWFc9sVuCAuLxFTVy8KN5KXhyDvPjKkU98ySK81dFyStN8",
|
|
2828
2936
|
region: "hel1"
|
|
2829
2937
|
},
|
|
2830
2938
|
{
|
|
2831
|
-
multiaddr: "/ip4/87.99.145.48/tcp/29898/p2p/
|
|
2939
|
+
multiaddr: "/ip4/87.99.145.48/tcp/29898/p2p/12D3KooWL2KLRUHybGLd736nusDRTF2V1a9waeTsxKPwF78HDCmb",
|
|
2832
2940
|
region: "ash"
|
|
2833
2941
|
},
|
|
2834
2942
|
{
|
|
2835
|
-
multiaddr: "/ip4/5.223.85.76/tcp/29898/p2p/
|
|
2943
|
+
multiaddr: "/ip4/5.223.85.76/tcp/29898/p2p/12D3KooWHvobdzzEAiKcFkgdkRfr8vWGyWYfBoWS3jnPycvfwGrK",
|
|
2836
2944
|
region: "sin"
|
|
2837
2945
|
},
|
|
2838
2946
|
{
|
|
2839
|
-
multiaddr: "/ip4/142.132.180.99/tcp/29898/p2p/
|
|
2947
|
+
multiaddr: "/ip4/142.132.180.99/tcp/29898/p2p/12D3KooWBcAeWScYmDWPTjNM47CkKR4vEf44CNhDCcWuGpyY7Hko",
|
|
2840
2948
|
region: "fsn1"
|
|
2841
2949
|
},
|
|
2842
2950
|
{
|
|
2843
|
-
multiaddr: "/ip4/
|
|
2844
|
-
region: "nbg1"
|
|
2845
|
-
},
|
|
2846
|
-
{
|
|
2847
|
-
multiaddr: "/ip4/95.217.156.190/tcp/29898/p2p/12D3KooWLD8kzKHPVexZv2pMTvpjcEPTVZxr5qMxCeVB2QR6NNa6",
|
|
2951
|
+
multiaddr: "/ip4/95.217.156.190/tcp/29898/p2p/12D3KooWPBr8guuWoZT59AobZEBHDZqKgwHWAP3aKUzKWeGTa7Z6",
|
|
2848
2952
|
region: "hel1"
|
|
2849
2953
|
},
|
|
2850
2954
|
{
|
|
2851
|
-
multiaddr: "/ip4/5.223.65.201/tcp/29898/p2p/
|
|
2955
|
+
multiaddr: "/ip4/5.223.65.201/tcp/29898/p2p/12D3KooWGk3fQcDxD3uPKEe56G89X6m4ksrPKCfq6LMA952HVwbs",
|
|
2852
2956
|
region: "sin"
|
|
2853
2957
|
},
|
|
2854
2958
|
{
|
|
2855
|
-
multiaddr: "/ip4/
|
|
2959
|
+
multiaddr: "/ip4/162.55.54.198/tcp/29898/p2p/12D3KooWRBA5Wzs619GuMY2NrDD6fGoLYCK2tkXff2JAZyXn7RvR",
|
|
2856
2960
|
region: "fsn1"
|
|
2961
|
+
},
|
|
2962
|
+
{
|
|
2963
|
+
multiaddr: "/ip4/128.140.125.5/tcp/29898/p2p/12D3KooWAxWQueEVut82vNNbi1ncBrcnPbbHNyp5RZs7KSJBmu19",
|
|
2964
|
+
region: "fsn1"
|
|
2965
|
+
},
|
|
2966
|
+
{
|
|
2967
|
+
multiaddr: "/ip4/178.105.45.210/tcp/29898/p2p/12D3KooWQRpCMLezJmvqqpbpEu8ixGHgonqianG1aVZjw6GiStbd",
|
|
2968
|
+
region: "fsn1"
|
|
2969
|
+
},
|
|
2970
|
+
{
|
|
2971
|
+
multiaddr: "/ip4/65.21.252.34/tcp/29898/p2p/12D3KooWRGzTwPX21Nee2c39RWuT2ayNWb6NMX19jCx8recrNeXL",
|
|
2972
|
+
region: "hel1"
|
|
2857
2973
|
}
|
|
2858
2974
|
]
|
|
2859
2975
|
};
|
|
@@ -3650,6 +3766,16 @@ var RpcClient = class _RpcClient {
|
|
|
3650
3766
|
async ethGetCode(address, block = "latest") {
|
|
3651
3767
|
return this.call("eth_getCode", [address, encodeBlockSelector(block)]);
|
|
3652
3768
|
}
|
|
3769
|
+
/** `eth_call` — read-only execution against committed state. */
|
|
3770
|
+
async ethCall(request, block = "latest") {
|
|
3771
|
+
return this.call("eth_call", [request, encodeBlockSelector(block)]);
|
|
3772
|
+
}
|
|
3773
|
+
/** `eth_estimateGas` — read-only execution-unit estimate for a call object. */
|
|
3774
|
+
async ethEstimateGas(request, block = "latest") {
|
|
3775
|
+
return parseQuantityBig(
|
|
3776
|
+
await this.call("eth_estimateGas", [request, encodeBlockSelector(block)])
|
|
3777
|
+
);
|
|
3778
|
+
}
|
|
3653
3779
|
/** Compatibility block-header read by height/tag. */
|
|
3654
3780
|
async ethGetBlockByNumber(block = "latest") {
|
|
3655
3781
|
return normalizeBlockHeader(await this.call(ethCompatMethod("getBlockByNumber"), [encodeBlockSelector(block)]));
|
|
@@ -8348,6 +8474,7 @@ function pqm1MnemonicToMlDsa65Backend(mnemonic) {
|
|
|
8348
8474
|
|
|
8349
8475
|
// src/cluster-join.ts
|
|
8350
8476
|
var DEFAULT_CLUSTER_JOIN_EXECUTION_UNIT_LIMIT = REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT;
|
|
8477
|
+
var DEFAULT_OPERATOR_SEAL_KEY_EXECUTION_UNIT_LIMIT = REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT;
|
|
8351
8478
|
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
8352
8479
|
var MAX_UINT32 = (1n << 32n) - 1n;
|
|
8353
8480
|
function deriveClusterJoinOperatorId(operatorPubkey) {
|
|
@@ -8455,6 +8582,24 @@ function buildVoteClusterAdmitTxFields(args) {
|
|
|
8455
8582
|
})
|
|
8456
8583
|
};
|
|
8457
8584
|
}
|
|
8585
|
+
function buildPublishOperatorSealKeyTxFields(args) {
|
|
8586
|
+
return {
|
|
8587
|
+
chainId: args.chainId,
|
|
8588
|
+
nonce: args.nonce,
|
|
8589
|
+
maxFeePerGas: parseBigint(args.fee.maxFeePerGas, "maxFeePerGas"),
|
|
8590
|
+
maxPriorityFeePerGas: parseBigint(args.fee.maxPriorityFeePerGas, "maxPriorityFeePerGas"),
|
|
8591
|
+
gasLimit: parseBigint(
|
|
8592
|
+
args.fee.gasLimit ?? DEFAULT_OPERATOR_SEAL_KEY_EXECUTION_UNIT_LIMIT,
|
|
8593
|
+
"gasLimit"
|
|
8594
|
+
),
|
|
8595
|
+
to: nodeRegistryAddressHex(),
|
|
8596
|
+
value: 0n,
|
|
8597
|
+
input: encodePublishOperatorSealKeyCalldata({
|
|
8598
|
+
peerId: normalizeOperatorId(args.peerId),
|
|
8599
|
+
sealEk: normalizeOperatorSealEk(args.sealEk)
|
|
8600
|
+
})
|
|
8601
|
+
};
|
|
8602
|
+
}
|
|
8458
8603
|
async function submitRequestClusterJoin(args) {
|
|
8459
8604
|
const clusterId = parseUint32(args.clusterId, "clusterId");
|
|
8460
8605
|
const operatorPubkey = normalizeConsensusPubkey(args.operatorPubkey, "operatorPubkey");
|
|
@@ -8481,7 +8626,7 @@ async function submitRequestClusterJoin(args) {
|
|
|
8481
8626
|
operatorPubkey,
|
|
8482
8627
|
bondLythoshi: args.bondLythoshi
|
|
8483
8628
|
});
|
|
8484
|
-
return submitClusterJoinTx(args.client, backend, tx, clusterId, operatorIdHex);
|
|
8629
|
+
return submitClusterJoinTx(args.client, backend, tx, clusterId, operatorIdHex, args);
|
|
8485
8630
|
}
|
|
8486
8631
|
async function submitVoteClusterAdmit(args) {
|
|
8487
8632
|
const clusterId = parseUint32(args.clusterId, "clusterId");
|
|
@@ -8508,9 +8653,62 @@ async function submitVoteClusterAdmit(args) {
|
|
|
8508
8653
|
operatorId: operatorIdHex,
|
|
8509
8654
|
voterPubkey: args.voterPubkey
|
|
8510
8655
|
});
|
|
8511
|
-
return submitClusterJoinTx(args.client, backend, tx, clusterId, operatorIdHex);
|
|
8656
|
+
return submitClusterJoinTx(args.client, backend, tx, clusterId, operatorIdHex, args);
|
|
8657
|
+
}
|
|
8658
|
+
async function submitPublishOperatorSealKey(args) {
|
|
8659
|
+
const operatorIdHex = normalizeOperatorId(args.peerId);
|
|
8660
|
+
const sealEk = normalizeOperatorSealEk(args.sealEk);
|
|
8661
|
+
const backend = pqm1MnemonicToMlDsa65Backend(args.mnemonic);
|
|
8662
|
+
const senderAddress = addressToTypedBech32("user", backend.addressBytes());
|
|
8663
|
+
const [chainId, nonce, quote] = await Promise.all([
|
|
8664
|
+
args.client.ethChainId(),
|
|
8665
|
+
args.client.lythGetTransactionCount(senderAddress),
|
|
8666
|
+
args.client.lythExecutionUnitPrice()
|
|
8667
|
+
]);
|
|
8668
|
+
const tx = buildPublishOperatorSealKeyTxFields({
|
|
8669
|
+
chainId,
|
|
8670
|
+
nonce,
|
|
8671
|
+
fee: resolveClusterJoinExecutionFee(quote, {
|
|
8672
|
+
...args,
|
|
8673
|
+
executionUnitLimit: args.executionUnitLimit ?? DEFAULT_OPERATOR_SEAL_KEY_EXECUTION_UNIT_LIMIT
|
|
8674
|
+
}),
|
|
8675
|
+
peerId: operatorIdHex,
|
|
8676
|
+
sealEk
|
|
8677
|
+
});
|
|
8678
|
+
const plaintext = buildPlaintextSubmission({ backend, tx });
|
|
8679
|
+
const txHash = await submitPlaintextTransaction(
|
|
8680
|
+
args.client,
|
|
8681
|
+
plaintext.signedTxWireHex,
|
|
8682
|
+
plaintext.innerTxHashHex
|
|
8683
|
+
);
|
|
8684
|
+
return {
|
|
8685
|
+
txHash,
|
|
8686
|
+
operatorIdHex,
|
|
8687
|
+
innerSighashHex: plaintext.innerSighashHex,
|
|
8688
|
+
signedTxWireBytes: plaintext.innerWireBytes
|
|
8689
|
+
};
|
|
8512
8690
|
}
|
|
8513
|
-
async function submitClusterJoinTx(client, backend, tx, clusterId, operatorIdHex) {
|
|
8691
|
+
async function submitClusterJoinTx(client, backend, tx, clusterId, operatorIdHex, options) {
|
|
8692
|
+
if (options.private !== false) {
|
|
8693
|
+
const encrypted = await buildEncryptedSubmission({
|
|
8694
|
+
client,
|
|
8695
|
+
backend,
|
|
8696
|
+
tx,
|
|
8697
|
+
clusterId: Number(clusterId),
|
|
8698
|
+
clusterSealKeys: options.clusterSealKeys,
|
|
8699
|
+
clusterSealKeysSource: options.clusterSealKeysSource,
|
|
8700
|
+
class: MempoolClass.ContractCall
|
|
8701
|
+
});
|
|
8702
|
+
assertRpcHash(await submitEncryptedEnvelope(client, encrypted.envelopeWireHex));
|
|
8703
|
+
return {
|
|
8704
|
+
txHash: encrypted.innerTxHashHex,
|
|
8705
|
+
clusterId: clusterId.toString(10),
|
|
8706
|
+
operatorIdHex,
|
|
8707
|
+
innerSighashHex: encrypted.innerSighashHex,
|
|
8708
|
+
signedTxWireBytes: encrypted.innerWireBytes,
|
|
8709
|
+
envelopeWireBytes: hexByteLength(encrypted.envelopeWireHex)
|
|
8710
|
+
};
|
|
8711
|
+
}
|
|
8514
8712
|
const plaintext = buildPlaintextSubmission({ backend, tx });
|
|
8515
8713
|
const txHash = await submitPlaintextTransaction(
|
|
8516
8714
|
client,
|
|
@@ -8525,6 +8723,16 @@ async function submitClusterJoinTx(client, backend, tx, clusterId, operatorIdHex
|
|
|
8525
8723
|
signedTxWireBytes: plaintext.innerWireBytes
|
|
8526
8724
|
};
|
|
8527
8725
|
}
|
|
8726
|
+
function hexByteLength(value) {
|
|
8727
|
+
const clean = value.startsWith("0x") || value.startsWith("0X") ? value.slice(2) : value;
|
|
8728
|
+
return clean.length / 2;
|
|
8729
|
+
}
|
|
8730
|
+
function assertRpcHash(value) {
|
|
8731
|
+
const bytes = hexToBytes2(value, "lyth_submitEncrypted tx hash");
|
|
8732
|
+
if (bytes.length !== 32) {
|
|
8733
|
+
throw new Error(`lyth_submitEncrypted tx hash must be 32 bytes, got ${bytes.length}`);
|
|
8734
|
+
}
|
|
8735
|
+
}
|
|
8528
8736
|
function adaptNativeClusterJoinRequest(request) {
|
|
8529
8737
|
return {
|
|
8530
8738
|
owner: request.owner ?? ZERO_ADDRESS,
|
|
@@ -8567,6 +8775,10 @@ function normalizeOperatorId(value) {
|
|
|
8567
8775
|
const bytes = typeof value === "string" ? hexToBytes2(value, "operatorId") : value;
|
|
8568
8776
|
return bytesToHex2(expectBytes(bytes, 32, "operatorId"));
|
|
8569
8777
|
}
|
|
8778
|
+
function normalizeOperatorSealEk(value) {
|
|
8779
|
+
const bytes = typeof value === "string" ? hexToBytes2(value, "sealEk") : value;
|
|
8780
|
+
return expectBytes(bytes, NODE_REGISTRY_OPERATOR_SEAL_EK_BYTES, "sealEk").slice();
|
|
8781
|
+
}
|
|
8570
8782
|
function parseUint32(value, label) {
|
|
8571
8783
|
const parsed = parseBigint(value, label);
|
|
8572
8784
|
if (parsed < 0n || parsed > MAX_UINT32) {
|
|
@@ -8781,15 +8993,405 @@ function expectLength4(value, len, name) {
|
|
|
8781
8993
|
}
|
|
8782
8994
|
return value;
|
|
8783
8995
|
}
|
|
8996
|
+
var TokenFactoryError = class extends Error {
|
|
8997
|
+
constructor(message) {
|
|
8998
|
+
super(message);
|
|
8999
|
+
this.name = "TokenFactoryError";
|
|
9000
|
+
}
|
|
9001
|
+
};
|
|
9002
|
+
var TOKEN_FACTORY_CREATE_DEPOSIT_LYTHOSHI = 3000000000000000n;
|
|
9003
|
+
var TOKEN_FACTORY_NAME_MAX_BYTES = 256;
|
|
9004
|
+
var TOKEN_FACTORY_SYMBOL_MAX_BYTES = 256;
|
|
9005
|
+
var TOKEN_FACTORY_MAX_DECIMALS = 30;
|
|
9006
|
+
var TOKEN_FACTORY_MAX_CREATOR_FEE_BPS = 1e4;
|
|
9007
|
+
var TOKEN_FACTORY_TOKEN_ID_DOMAIN_TAG = 250;
|
|
9008
|
+
var TOKEN_FACTORY_FLAGS = {
|
|
9009
|
+
MINTABLE: 1 << 0,
|
|
9010
|
+
BURNABLE: 1 << 1,
|
|
9011
|
+
PAUSABLE: 1 << 2,
|
|
9012
|
+
FIXED_SUPPLY: 1 << 3,
|
|
9013
|
+
CREATOR_FEE_OPT_IN: 1 << 4,
|
|
9014
|
+
DESTRUCTIBLE: 1 << 5
|
|
9015
|
+
};
|
|
9016
|
+
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;
|
|
9017
|
+
var TOKEN_FACTORY_SIGS = {
|
|
9018
|
+
createToken: "createToken(string,string,uint8,uint256,uint256,uint32,uint16)",
|
|
9019
|
+
transfer: "transfer(bytes32,address,uint256)",
|
|
9020
|
+
transferFrom: "transferFrom(bytes32,address,address,uint256)",
|
|
9021
|
+
approve: "approve(bytes32,address,uint256)",
|
|
9022
|
+
increaseAllowance: "increaseAllowance(bytes32,address,uint256)",
|
|
9023
|
+
decreaseAllowance: "decreaseAllowance(bytes32,address,uint256)",
|
|
9024
|
+
balanceOf: "balanceOf(bytes32,address)",
|
|
9025
|
+
allowance: "allowance(bytes32,address,address)",
|
|
9026
|
+
totalSupply: "totalSupply(bytes32)",
|
|
9027
|
+
metadata: "metadata(bytes32)",
|
|
9028
|
+
mint: "mint(bytes32,address,uint256)",
|
|
9029
|
+
burn: "burn(bytes32,uint256)",
|
|
9030
|
+
setPaused: "setPaused(bytes32,bool)",
|
|
9031
|
+
transferOwnership: "transferOwnership(bytes32,address)",
|
|
9032
|
+
destroyToken: "destroyToken(bytes32)"
|
|
9033
|
+
};
|
|
9034
|
+
var TOKEN_FACTORY_SELECTORS = {
|
|
9035
|
+
createToken: selectorHex3(TOKEN_FACTORY_SIGS.createToken),
|
|
9036
|
+
transfer: selectorHex3(TOKEN_FACTORY_SIGS.transfer),
|
|
9037
|
+
transferFrom: selectorHex3(TOKEN_FACTORY_SIGS.transferFrom),
|
|
9038
|
+
approve: selectorHex3(TOKEN_FACTORY_SIGS.approve),
|
|
9039
|
+
increaseAllowance: selectorHex3(TOKEN_FACTORY_SIGS.increaseAllowance),
|
|
9040
|
+
decreaseAllowance: selectorHex3(TOKEN_FACTORY_SIGS.decreaseAllowance),
|
|
9041
|
+
balanceOf: selectorHex3(TOKEN_FACTORY_SIGS.balanceOf),
|
|
9042
|
+
allowance: selectorHex3(TOKEN_FACTORY_SIGS.allowance),
|
|
9043
|
+
totalSupply: selectorHex3(TOKEN_FACTORY_SIGS.totalSupply),
|
|
9044
|
+
metadata: selectorHex3(TOKEN_FACTORY_SIGS.metadata),
|
|
9045
|
+
mint: selectorHex3(TOKEN_FACTORY_SIGS.mint),
|
|
9046
|
+
burn: selectorHex3(TOKEN_FACTORY_SIGS.burn),
|
|
9047
|
+
setPaused: selectorHex3(TOKEN_FACTORY_SIGS.setPaused),
|
|
9048
|
+
transferOwnership: selectorHex3(TOKEN_FACTORY_SIGS.transferOwnership),
|
|
9049
|
+
destroyToken: selectorHex3(TOKEN_FACTORY_SIGS.destroyToken)
|
|
9050
|
+
};
|
|
9051
|
+
function tokenFactoryAddressHex() {
|
|
9052
|
+
return PRECOMPILE_ADDRESSES.TOKEN_FACTORY.toLowerCase();
|
|
9053
|
+
}
|
|
9054
|
+
function deriveTokenFactoryTokenId(creator, creatorTokenNonce) {
|
|
9055
|
+
const nonce = parseUint(creatorTokenNonce, "creatorTokenNonce", 64);
|
|
9056
|
+
return bytesToHex2(
|
|
9057
|
+
keccak_256(
|
|
9058
|
+
concatBytes2(
|
|
9059
|
+
new Uint8Array([TOKEN_FACTORY_TOKEN_ID_DOMAIN_TAG]),
|
|
9060
|
+
addressBytes(creator, "creator"),
|
|
9061
|
+
uint64Be(nonce)
|
|
9062
|
+
)
|
|
9063
|
+
)
|
|
9064
|
+
);
|
|
9065
|
+
}
|
|
9066
|
+
function encodeCreateTokenCalldata(args) {
|
|
9067
|
+
const name = textBytes(args.name, "name", TOKEN_FACTORY_NAME_MAX_BYTES);
|
|
9068
|
+
const symbol = textBytes(args.symbol, "symbol", TOKEN_FACTORY_SYMBOL_MAX_BYTES);
|
|
9069
|
+
const decimals = parseSmallUint(args.decimals, "decimals", TOKEN_FACTORY_MAX_DECIMALS);
|
|
9070
|
+
const initialSupply = parseUint(args.initialSupply, "initialSupply");
|
|
9071
|
+
const maxSupply = parseUint(args.maxSupply, "maxSupply");
|
|
9072
|
+
const flags = args.flags ?? 0;
|
|
9073
|
+
validateTokenFactoryFlags(flags, args.creatorFeeBps ?? 0);
|
|
9074
|
+
const creatorFeeBps = parseSmallUint(
|
|
9075
|
+
args.creatorFeeBps ?? 0,
|
|
9076
|
+
"creatorFeeBps",
|
|
9077
|
+
TOKEN_FACTORY_MAX_CREATOR_FEE_BPS
|
|
9078
|
+
);
|
|
9079
|
+
const headLen = 7 * 32;
|
|
9080
|
+
const nameTail = dynamicBytesTail(name);
|
|
9081
|
+
const symbolOffset = BigInt(headLen + nameTail.length);
|
|
9082
|
+
return bytesToHex2(
|
|
9083
|
+
concatBytes2(
|
|
9084
|
+
hexToBytes2(TOKEN_FACTORY_SELECTORS.createToken, "createToken selector"),
|
|
9085
|
+
uint256Word2(BigInt(headLen), "nameOffset"),
|
|
9086
|
+
uint256Word2(symbolOffset, "symbolOffset"),
|
|
9087
|
+
uint256Word2(BigInt(decimals), "decimals"),
|
|
9088
|
+
uint256Word2(initialSupply, "initialSupply"),
|
|
9089
|
+
uint256Word2(maxSupply, "maxSupply"),
|
|
9090
|
+
uint256Word2(BigInt(flags), "flags"),
|
|
9091
|
+
uint256Word2(BigInt(creatorFeeBps), "creatorFeeBps"),
|
|
9092
|
+
nameTail,
|
|
9093
|
+
dynamicBytesTail(symbol)
|
|
9094
|
+
)
|
|
9095
|
+
);
|
|
9096
|
+
}
|
|
9097
|
+
function encodeCreateFixedSupplyMrc20Calldata(args) {
|
|
9098
|
+
let flags = TOKEN_FACTORY_FLAGS.FIXED_SUPPLY;
|
|
9099
|
+
if (args.burnable) flags |= TOKEN_FACTORY_FLAGS.BURNABLE;
|
|
9100
|
+
if (args.pausable) flags |= TOKEN_FACTORY_FLAGS.PAUSABLE;
|
|
9101
|
+
if (args.destructible) flags |= TOKEN_FACTORY_FLAGS.DESTRUCTIBLE;
|
|
9102
|
+
return encodeCreateTokenCalldata({
|
|
9103
|
+
name: args.name,
|
|
9104
|
+
symbol: args.symbol,
|
|
9105
|
+
decimals: args.decimals,
|
|
9106
|
+
initialSupply: args.supply,
|
|
9107
|
+
maxSupply: args.supply,
|
|
9108
|
+
flags,
|
|
9109
|
+
creatorFeeBps: 0
|
|
9110
|
+
});
|
|
9111
|
+
}
|
|
9112
|
+
function encodeTokenFactoryTransferCalldata(tokenId, to, amount) {
|
|
9113
|
+
return encodeBytes32AddressUint(TOKEN_FACTORY_SELECTORS.transfer, tokenId, to, amount);
|
|
9114
|
+
}
|
|
9115
|
+
function encodeTokenFactoryTransferFromCalldata(tokenId, from, to, amount) {
|
|
9116
|
+
return bytesToHex2(
|
|
9117
|
+
concatBytes2(
|
|
9118
|
+
hexToBytes2(TOKEN_FACTORY_SELECTORS.transferFrom, "transferFrom selector"),
|
|
9119
|
+
bytes32(tokenId, "tokenId"),
|
|
9120
|
+
addressWord3(from, "from"),
|
|
9121
|
+
addressWord3(to, "to"),
|
|
9122
|
+
uint256Word2(parseUint(amount, "amount"), "amount")
|
|
9123
|
+
)
|
|
9124
|
+
);
|
|
9125
|
+
}
|
|
9126
|
+
function encodeTokenFactoryApproveCalldata(tokenId, spender, amount) {
|
|
9127
|
+
return encodeBytes32AddressUint(TOKEN_FACTORY_SELECTORS.approve, tokenId, spender, amount);
|
|
9128
|
+
}
|
|
9129
|
+
function encodeTokenFactoryIncreaseAllowanceCalldata(tokenId, spender, delta) {
|
|
9130
|
+
return encodeBytes32AddressUint(TOKEN_FACTORY_SELECTORS.increaseAllowance, tokenId, spender, delta);
|
|
9131
|
+
}
|
|
9132
|
+
function encodeTokenFactoryDecreaseAllowanceCalldata(tokenId, spender, delta) {
|
|
9133
|
+
return encodeBytes32AddressUint(TOKEN_FACTORY_SELECTORS.decreaseAllowance, tokenId, spender, delta);
|
|
9134
|
+
}
|
|
9135
|
+
function encodeTokenFactoryBalanceOfCalldata(tokenId, holder) {
|
|
9136
|
+
return encodeBytes32Address(TOKEN_FACTORY_SELECTORS.balanceOf, tokenId, holder);
|
|
9137
|
+
}
|
|
9138
|
+
function encodeTokenFactoryAllowanceCalldata(tokenId, owner, spender) {
|
|
9139
|
+
return bytesToHex2(
|
|
9140
|
+
concatBytes2(
|
|
9141
|
+
hexToBytes2(TOKEN_FACTORY_SELECTORS.allowance, "allowance selector"),
|
|
9142
|
+
bytes32(tokenId, "tokenId"),
|
|
9143
|
+
addressWord3(owner, "owner"),
|
|
9144
|
+
addressWord3(spender, "spender")
|
|
9145
|
+
)
|
|
9146
|
+
);
|
|
9147
|
+
}
|
|
9148
|
+
function encodeTokenFactoryTotalSupplyCalldata(tokenId) {
|
|
9149
|
+
return encodeBytes32(TOKEN_FACTORY_SELECTORS.totalSupply, tokenId);
|
|
9150
|
+
}
|
|
9151
|
+
function encodeTokenFactoryMetadataCalldata(tokenId) {
|
|
9152
|
+
return encodeBytes32(TOKEN_FACTORY_SELECTORS.metadata, tokenId);
|
|
9153
|
+
}
|
|
9154
|
+
function encodeTokenFactoryMintCalldata(tokenId, to, amount) {
|
|
9155
|
+
return encodeBytes32AddressUint(TOKEN_FACTORY_SELECTORS.mint, tokenId, to, amount);
|
|
9156
|
+
}
|
|
9157
|
+
function encodeTokenFactoryBurnCalldata(tokenId, amount) {
|
|
9158
|
+
return encodeBytes32Uint(TOKEN_FACTORY_SELECTORS.burn, tokenId, amount);
|
|
9159
|
+
}
|
|
9160
|
+
function encodeTokenFactorySetPausedCalldata(tokenId, paused) {
|
|
9161
|
+
return bytesToHex2(
|
|
9162
|
+
concatBytes2(
|
|
9163
|
+
hexToBytes2(TOKEN_FACTORY_SELECTORS.setPaused, "setPaused selector"),
|
|
9164
|
+
bytes32(tokenId, "tokenId"),
|
|
9165
|
+
boolWord(paused)
|
|
9166
|
+
)
|
|
9167
|
+
);
|
|
9168
|
+
}
|
|
9169
|
+
function encodeTokenFactoryTransferOwnershipCalldata(tokenId, newOwner) {
|
|
9170
|
+
return encodeBytes32Address(TOKEN_FACTORY_SELECTORS.transferOwnership, tokenId, newOwner);
|
|
9171
|
+
}
|
|
9172
|
+
function encodeTokenFactoryDestroyCalldata(tokenId) {
|
|
9173
|
+
return encodeBytes32(TOKEN_FACTORY_SELECTORS.destroyToken, tokenId);
|
|
9174
|
+
}
|
|
9175
|
+
function decodeTokenFactoryTokenId(output) {
|
|
9176
|
+
return bytesToHex2(bytes32(output, "output"));
|
|
9177
|
+
}
|
|
9178
|
+
function validateTokenFactoryFlags(flags, creatorFeeBps = 0) {
|
|
9179
|
+
if (!Number.isInteger(flags) || flags < 0 || flags > 4294967295) {
|
|
9180
|
+
throw new TokenFactoryError("flags must be a uint32");
|
|
9181
|
+
}
|
|
9182
|
+
if ((flags & ~TOKEN_FACTORY_KNOWN_FLAG_MASK) !== 0) {
|
|
9183
|
+
throw new TokenFactoryError("flags contain an unknown bit");
|
|
9184
|
+
}
|
|
9185
|
+
if ((flags & TOKEN_FACTORY_FLAGS.MINTABLE) !== 0 && (flags & TOKEN_FACTORY_FLAGS.FIXED_SUPPLY) !== 0) {
|
|
9186
|
+
throw new TokenFactoryError("MINTABLE and FIXED_SUPPLY are mutually exclusive");
|
|
9187
|
+
}
|
|
9188
|
+
if ((flags & TOKEN_FACTORY_FLAGS.CREATOR_FEE_OPT_IN) !== 0) {
|
|
9189
|
+
if (creatorFeeBps <= 0) throw new TokenFactoryError("CREATOR_FEE_OPT_IN requires non-zero creatorFeeBps");
|
|
9190
|
+
} else if (creatorFeeBps !== 0) {
|
|
9191
|
+
throw new TokenFactoryError("creatorFeeBps must be 0 when CREATOR_FEE_OPT_IN is unset");
|
|
9192
|
+
}
|
|
9193
|
+
}
|
|
9194
|
+
function encodeBytes32(selector, value) {
|
|
9195
|
+
return bytesToHex2(concatBytes2(hexToBytes2(selector, "selector"), bytes32(value, "tokenId")));
|
|
9196
|
+
}
|
|
9197
|
+
function encodeBytes32Uint(selector, tokenId, amount) {
|
|
9198
|
+
return bytesToHex2(
|
|
9199
|
+
concatBytes2(
|
|
9200
|
+
hexToBytes2(selector, "selector"),
|
|
9201
|
+
bytes32(tokenId, "tokenId"),
|
|
9202
|
+
uint256Word2(parseUint(amount, "amount"), "amount")
|
|
9203
|
+
)
|
|
9204
|
+
);
|
|
9205
|
+
}
|
|
9206
|
+
function encodeBytes32Address(selector, tokenId, address) {
|
|
9207
|
+
return bytesToHex2(
|
|
9208
|
+
concatBytes2(
|
|
9209
|
+
hexToBytes2(selector, "selector"),
|
|
9210
|
+
bytes32(tokenId, "tokenId"),
|
|
9211
|
+
addressWord3(address, "address")
|
|
9212
|
+
)
|
|
9213
|
+
);
|
|
9214
|
+
}
|
|
9215
|
+
function encodeBytes32AddressUint(selector, tokenId, address, amount) {
|
|
9216
|
+
return bytesToHex2(
|
|
9217
|
+
concatBytes2(
|
|
9218
|
+
hexToBytes2(selector, "selector"),
|
|
9219
|
+
bytes32(tokenId, "tokenId"),
|
|
9220
|
+
addressWord3(address, "address"),
|
|
9221
|
+
uint256Word2(parseUint(amount, "amount"), "amount")
|
|
9222
|
+
)
|
|
9223
|
+
);
|
|
9224
|
+
}
|
|
9225
|
+
function selectorHex3(signature) {
|
|
9226
|
+
const sel = keccak_256(new TextEncoder().encode(signature)).slice(0, 4);
|
|
9227
|
+
return bytesToHex2(sel);
|
|
9228
|
+
}
|
|
9229
|
+
function textBytes(value, label, maxBytes) {
|
|
9230
|
+
const bytes = new TextEncoder().encode(value);
|
|
9231
|
+
if (bytes.length === 0 || bytes.length > maxBytes) {
|
|
9232
|
+
throw new TokenFactoryError(`${label} must be 1..=${maxBytes} UTF-8 bytes`);
|
|
9233
|
+
}
|
|
9234
|
+
return bytes;
|
|
9235
|
+
}
|
|
9236
|
+
function dynamicBytesTail(bytes) {
|
|
9237
|
+
return concatBytes2(uint256Word2(BigInt(bytes.length), "length"), padTo323(bytes));
|
|
9238
|
+
}
|
|
9239
|
+
function padTo323(bytes) {
|
|
9240
|
+
const padded = Math.ceil(bytes.length / 32) * 32;
|
|
9241
|
+
if (padded === bytes.length) return bytes;
|
|
9242
|
+
const out = new Uint8Array(padded);
|
|
9243
|
+
out.set(bytes);
|
|
9244
|
+
return out;
|
|
9245
|
+
}
|
|
9246
|
+
function addressWord3(value, label) {
|
|
9247
|
+
const out = new Uint8Array(32);
|
|
9248
|
+
out.set(addressBytes(value, label), 12);
|
|
9249
|
+
return out;
|
|
9250
|
+
}
|
|
9251
|
+
function addressBytes(value, label) {
|
|
9252
|
+
const bytes = toBytes5(value, label);
|
|
9253
|
+
if (bytes.length !== 20) {
|
|
9254
|
+
throw new TokenFactoryError(`${label} must be 20 bytes, got ${bytes.length}`);
|
|
9255
|
+
}
|
|
9256
|
+
return bytes;
|
|
9257
|
+
}
|
|
9258
|
+
function bytes32(value, label) {
|
|
9259
|
+
const bytes = toBytes5(value, label);
|
|
9260
|
+
if (bytes.length !== 32) {
|
|
9261
|
+
throw new TokenFactoryError(`${label} must be 32 bytes, got ${bytes.length}`);
|
|
9262
|
+
}
|
|
9263
|
+
return bytes;
|
|
9264
|
+
}
|
|
9265
|
+
function boolWord(value) {
|
|
9266
|
+
const out = new Uint8Array(32);
|
|
9267
|
+
out[31] = value ? 1 : 0;
|
|
9268
|
+
return out;
|
|
9269
|
+
}
|
|
9270
|
+
function uint256Word2(value, label) {
|
|
9271
|
+
if (value < 0n || value > (1n << 256n) - 1n) {
|
|
9272
|
+
throw new TokenFactoryError(`${label} out of uint256 range`);
|
|
9273
|
+
}
|
|
9274
|
+
const out = new Uint8Array(32);
|
|
9275
|
+
let rest = value;
|
|
9276
|
+
for (let i = 31; i >= 0 && rest > 0n; i--) {
|
|
9277
|
+
out[i] = Number(rest & 0xffn);
|
|
9278
|
+
rest >>= 8n;
|
|
9279
|
+
}
|
|
9280
|
+
return out;
|
|
9281
|
+
}
|
|
9282
|
+
function uint64Be(value) {
|
|
9283
|
+
const out = new Uint8Array(8);
|
|
9284
|
+
let rest = value;
|
|
9285
|
+
for (let i = 7; i >= 0; i--) {
|
|
9286
|
+
out[i] = Number(rest & 0xffn);
|
|
9287
|
+
rest >>= 8n;
|
|
9288
|
+
}
|
|
9289
|
+
return out;
|
|
9290
|
+
}
|
|
9291
|
+
function parseSmallUint(value, label, max) {
|
|
9292
|
+
if (!Number.isInteger(value) || value < 0 || value > max) {
|
|
9293
|
+
throw new TokenFactoryError(`${label} must be an integer in 0..=${max}`);
|
|
9294
|
+
}
|
|
9295
|
+
return value;
|
|
9296
|
+
}
|
|
9297
|
+
function parseUint(value, label, bits = 256) {
|
|
9298
|
+
let parsed;
|
|
9299
|
+
if (typeof value === "bigint") {
|
|
9300
|
+
parsed = value;
|
|
9301
|
+
} else if (typeof value === "number") {
|
|
9302
|
+
if (!Number.isSafeInteger(value)) throw new TokenFactoryError(`${label} must be a safe integer`);
|
|
9303
|
+
parsed = BigInt(value);
|
|
9304
|
+
} else if (value.startsWith("0x") || value.startsWith("0X")) {
|
|
9305
|
+
parsed = BigInt(value);
|
|
9306
|
+
} else {
|
|
9307
|
+
if (!/^[0-9]+$/.test(value)) throw new TokenFactoryError(`${label} must be a non-negative integer`);
|
|
9308
|
+
parsed = BigInt(value);
|
|
9309
|
+
}
|
|
9310
|
+
if (parsed < 0n || parsed > (1n << BigInt(bits)) - 1n) {
|
|
9311
|
+
throw new TokenFactoryError(`${label} out of uint${bits} range`);
|
|
9312
|
+
}
|
|
9313
|
+
return parsed;
|
|
9314
|
+
}
|
|
9315
|
+
function toBytes5(value, label) {
|
|
9316
|
+
if (typeof value === "string") return hexToBytes2(value, label);
|
|
9317
|
+
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
9318
|
+
}
|
|
9319
|
+
|
|
9320
|
+
// src/vrf.ts
|
|
9321
|
+
var VrfCallError = class extends Error {
|
|
9322
|
+
constructor(message) {
|
|
9323
|
+
super(message);
|
|
9324
|
+
this.name = "VrfCallError";
|
|
9325
|
+
}
|
|
9326
|
+
};
|
|
9327
|
+
var VRF_OUTPUT_BYTES = 32;
|
|
9328
|
+
var VRF_DOMAIN_TAG_MAX_BYTES = 256;
|
|
9329
|
+
var VRF_HEIGHT_NOT_FINALIZED_REVERT = "vrf: height not finalized";
|
|
9330
|
+
function vrfAddressHex() {
|
|
9331
|
+
return PRECOMPILE_ADDRESSES.VRF.toLowerCase();
|
|
9332
|
+
}
|
|
9333
|
+
function encodeVrfEvaluateCalldata(blockHeight, domainTag = new Uint8Array()) {
|
|
9334
|
+
const height = parseUint64(blockHeight, "blockHeight");
|
|
9335
|
+
const tag = normalizeDomainTag(domainTag);
|
|
9336
|
+
if (tag.length > VRF_DOMAIN_TAG_MAX_BYTES) {
|
|
9337
|
+
throw new VrfCallError(`domainTag exceeds ${VRF_DOMAIN_TAG_MAX_BYTES} bytes`);
|
|
9338
|
+
}
|
|
9339
|
+
return bytesToHex2(concatBytes2(uint256Word3(height), tag));
|
|
9340
|
+
}
|
|
9341
|
+
function decodeVrfOutput(output) {
|
|
9342
|
+
const bytes = toBytes6(output, "output");
|
|
9343
|
+
if (bytes.length !== VRF_OUTPUT_BYTES) {
|
|
9344
|
+
throw new VrfCallError(`VRF output must be ${VRF_OUTPUT_BYTES} bytes, got ${bytes.length}`);
|
|
9345
|
+
}
|
|
9346
|
+
return bytes;
|
|
9347
|
+
}
|
|
9348
|
+
function normalizeDomainTag(value) {
|
|
9349
|
+
if (typeof value === "string") {
|
|
9350
|
+
if (value.startsWith("0x") || value.startsWith("0X")) return hexToBytes2(value, "domainTag");
|
|
9351
|
+
return new TextEncoder().encode(value);
|
|
9352
|
+
}
|
|
9353
|
+
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
9354
|
+
}
|
|
9355
|
+
function parseUint64(value, label) {
|
|
9356
|
+
let parsed;
|
|
9357
|
+
if (typeof value === "bigint") {
|
|
9358
|
+
parsed = value;
|
|
9359
|
+
} else if (typeof value === "number") {
|
|
9360
|
+
if (!Number.isSafeInteger(value)) throw new VrfCallError(`${label} must be a safe integer`);
|
|
9361
|
+
parsed = BigInt(value);
|
|
9362
|
+
} else if (value.startsWith("0x") || value.startsWith("0X")) {
|
|
9363
|
+
parsed = BigInt(value);
|
|
9364
|
+
} else {
|
|
9365
|
+
if (!/^[0-9]+$/.test(value)) throw new VrfCallError(`${label} must be a non-negative integer`);
|
|
9366
|
+
parsed = BigInt(value);
|
|
9367
|
+
}
|
|
9368
|
+
if (parsed < 0n || parsed > (1n << 64n) - 1n) {
|
|
9369
|
+
throw new VrfCallError(`${label} out of uint64 range`);
|
|
9370
|
+
}
|
|
9371
|
+
return parsed;
|
|
9372
|
+
}
|
|
9373
|
+
function uint256Word3(value) {
|
|
9374
|
+
const out = new Uint8Array(32);
|
|
9375
|
+
let rest = value;
|
|
9376
|
+
for (let i = 31; i >= 0 && rest > 0n; i--) {
|
|
9377
|
+
out[i] = Number(rest & 0xffn);
|
|
9378
|
+
rest >>= 8n;
|
|
9379
|
+
}
|
|
9380
|
+
return out;
|
|
9381
|
+
}
|
|
9382
|
+
function toBytes6(value, label) {
|
|
9383
|
+
if (typeof value === "string") return hexToBytes2(value, label);
|
|
9384
|
+
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
9385
|
+
}
|
|
8784
9386
|
var PROVER_MARKET_ADDRESS = PRECOMPILE_ADDRESSES.PROVER_MARKET;
|
|
8785
9387
|
var SERVES_GPU_PROVE = 512;
|
|
8786
9388
|
var PROVER_MARKET_SELECTORS = {
|
|
8787
|
-
createRequest: "0x" +
|
|
8788
|
-
submitBid: "0x" +
|
|
8789
|
-
closeRequest: "0x" +
|
|
8790
|
-
submitProof: "0x" +
|
|
8791
|
-
settle: "0x" +
|
|
8792
|
-
slash: "0x" +
|
|
9389
|
+
createRequest: "0x" + selectorHex4("createRequest(bytes)"),
|
|
9390
|
+
submitBid: "0x" + selectorHex4("submitBid(bytes)"),
|
|
9391
|
+
closeRequest: "0x" + selectorHex4("closeRequest(bytes)"),
|
|
9392
|
+
submitProof: "0x" + selectorHex4("submitProof(bytes)"),
|
|
9393
|
+
settle: "0x" + selectorHex4("settle(bytes)"),
|
|
9394
|
+
slash: "0x" + selectorHex4("slash(bytes)")
|
|
8793
9395
|
};
|
|
8794
9396
|
var PROVER_MARKET_EVENT_SIGS = {
|
|
8795
9397
|
proofRequested: "ProofRequested(bytes32,address,bytes32,uint128,uint64)",
|
|
@@ -8831,8 +9433,8 @@ function requestSighash(vkeyHash, inputsHash, maxFee, deadline, nonce) {
|
|
|
8831
9433
|
keccak_256(
|
|
8832
9434
|
concatBytes7(
|
|
8833
9435
|
new TextEncoder().encode(PROVER_MARKET_REQUEST_DOMAIN),
|
|
8834
|
-
expectLength5(
|
|
8835
|
-
expectLength5(
|
|
9436
|
+
expectLength5(toBytes7(vkeyHash), 32, "vkeyHash"),
|
|
9437
|
+
expectLength5(toBytes7(inputsHash), 32, "inputsHash"),
|
|
8836
9438
|
u128Bytes(maxFee, "maxFee"),
|
|
8837
9439
|
u64Bytes(deadline, "deadline"),
|
|
8838
9440
|
u64Bytes(nonce, "nonce")
|
|
@@ -8845,7 +9447,7 @@ function bidSighash(requestId, fee) {
|
|
|
8845
9447
|
keccak_256(
|
|
8846
9448
|
concatBytes7(
|
|
8847
9449
|
new TextEncoder().encode(PROVER_MARKET_BID_DOMAIN),
|
|
8848
|
-
expectLength5(
|
|
9450
|
+
expectLength5(toBytes7(requestId), 32, "requestId"),
|
|
8849
9451
|
u128Bytes(fee, "fee")
|
|
8850
9452
|
)
|
|
8851
9453
|
)
|
|
@@ -8856,16 +9458,16 @@ function submitSighash(requestId, proofHash) {
|
|
|
8856
9458
|
keccak_256(
|
|
8857
9459
|
concatBytes7(
|
|
8858
9460
|
new TextEncoder().encode(PROVER_MARKET_SUBMIT_DOMAIN),
|
|
8859
|
-
expectLength5(
|
|
8860
|
-
expectLength5(
|
|
9461
|
+
expectLength5(toBytes7(requestId), 32, "requestId"),
|
|
9462
|
+
expectLength5(toBytes7(proofHash), 32, "proofHash")
|
|
8861
9463
|
)
|
|
8862
9464
|
)
|
|
8863
9465
|
);
|
|
8864
9466
|
}
|
|
8865
9467
|
function encodeCreateRequestCanonical(args) {
|
|
8866
|
-
const buyer = expectLength5(
|
|
8867
|
-
const buyerPubkey =
|
|
8868
|
-
const sig =
|
|
9468
|
+
const buyer = expectLength5(toBytes7(args.buyer), 20, "buyer");
|
|
9469
|
+
const buyerPubkey = toBytes7(args.buyerPubkey);
|
|
9470
|
+
const sig = toBytes7(args.sig);
|
|
8869
9471
|
if (buyerPubkey.length === 0 || buyerPubkey.length > 65535) {
|
|
8870
9472
|
throw new ProverMarketError("buyerPubkey length out of range (1..=65535)");
|
|
8871
9473
|
}
|
|
@@ -8877,8 +9479,8 @@ function encodeCreateRequestCanonical(args) {
|
|
|
8877
9479
|
buyer,
|
|
8878
9480
|
u16Bytes(buyerPubkey.length),
|
|
8879
9481
|
buyerPubkey,
|
|
8880
|
-
expectLength5(
|
|
8881
|
-
expectLength5(
|
|
9482
|
+
expectLength5(toBytes7(args.vkeyHash), 32, "vkeyHash"),
|
|
9483
|
+
expectLength5(toBytes7(args.inputsHash), 32, "inputsHash"),
|
|
8882
9484
|
u128Bytes(args.maxFee, "maxFee"),
|
|
8883
9485
|
u64Bytes(args.deadline, "deadline"),
|
|
8884
9486
|
u64Bytes(args.nonce, "nonce"),
|
|
@@ -8888,7 +9490,7 @@ function encodeCreateRequestCanonical(args) {
|
|
|
8888
9490
|
);
|
|
8889
9491
|
}
|
|
8890
9492
|
function encodeCreateRequestCalldata(args) {
|
|
8891
|
-
const canonical =
|
|
9493
|
+
const canonical = toBytes7(encodeCreateRequestCanonical(args));
|
|
8892
9494
|
const offset = new Uint8Array(32);
|
|
8893
9495
|
offset[31] = 32;
|
|
8894
9496
|
const lenWord = new Uint8Array(32);
|
|
@@ -8902,10 +9504,10 @@ function encodeCreateRequestCalldata(args) {
|
|
|
8902
9504
|
concatBytes7(hexToBytes7(PROVER_MARKET_SELECTORS.createRequest), offset, lenWord, canonical, new Uint8Array(pad))
|
|
8903
9505
|
);
|
|
8904
9506
|
}
|
|
8905
|
-
function
|
|
9507
|
+
function selectorHex4(sig) {
|
|
8906
9508
|
return [...keccak_256(new TextEncoder().encode(sig)).slice(0, 4)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
8907
9509
|
}
|
|
8908
|
-
function
|
|
9510
|
+
function toBytes7(value) {
|
|
8909
9511
|
if (typeof value === "string") return hexToBytes7(value);
|
|
8910
9512
|
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
8911
9513
|
}
|
|
@@ -9043,7 +9645,7 @@ function encodeSetAutoCompoundCalldata(enabled) {
|
|
|
9043
9645
|
);
|
|
9044
9646
|
}
|
|
9045
9647
|
function isRedemptionPrincipalUnavailableRevert(data) {
|
|
9046
|
-
return bytesToHex9(
|
|
9648
|
+
return bytesToHex9(toBytes8(data)).toLowerCase() === DELEGATION_REVERT_TAGS.redemptionPrincipalUnavailable;
|
|
9047
9649
|
}
|
|
9048
9650
|
function uint64Word3(value, name) {
|
|
9049
9651
|
const n = toBigint3(value, name);
|
|
@@ -9097,7 +9699,7 @@ function toBigint3(value, name) {
|
|
|
9097
9699
|
}
|
|
9098
9700
|
return BigInt(value);
|
|
9099
9701
|
}
|
|
9100
|
-
function
|
|
9702
|
+
function toBytes8(value) {
|
|
9101
9703
|
if (typeof value === "string") {
|
|
9102
9704
|
return hexToBytes8(value);
|
|
9103
9705
|
}
|
|
@@ -9211,8 +9813,8 @@ function encodeSetPolicyCalldata(args) {
|
|
|
9211
9813
|
}
|
|
9212
9814
|
function encodeSetPolicyClaimCalldata(args, subAccountPubkey, subAccountSig) {
|
|
9213
9815
|
const normalized = normalizeArgs(args);
|
|
9214
|
-
const pubkey =
|
|
9215
|
-
const sig =
|
|
9816
|
+
const pubkey = toBytes9(subAccountPubkey);
|
|
9817
|
+
const sig = toBytes9(subAccountSig);
|
|
9216
9818
|
if (pubkey.length !== ML_DSA_65_PUBLIC_KEY_LEN2) {
|
|
9217
9819
|
throw new SpendingPolicyError(
|
|
9218
9820
|
`subAccountPubkey must be ${ML_DSA_65_PUBLIC_KEY_LEN2} bytes, got ${pubkey.length}`
|
|
@@ -9234,7 +9836,7 @@ function encodeSetPolicyClaimCalldata(args, subAccountPubkey, subAccountSig) {
|
|
|
9234
9836
|
}
|
|
9235
9837
|
function encodeClaimPolicyByAddressCalldata(args, subAccountSig) {
|
|
9236
9838
|
const normalized = normalizeArgs(args);
|
|
9237
|
-
const sig =
|
|
9839
|
+
const sig = toBytes9(subAccountSig);
|
|
9238
9840
|
if (sig.length !== ML_DSA_65_SIGNATURE_LEN2) {
|
|
9239
9841
|
throw new SpendingPolicyError(
|
|
9240
9842
|
`subAccountSig must be ${ML_DSA_65_SIGNATURE_LEN2} bytes, got ${sig.length}`
|
|
@@ -9261,12 +9863,12 @@ function normalizeArgs(args) {
|
|
|
9261
9863
|
principal: toUserAddressBytes(args.principal, "principal"),
|
|
9262
9864
|
dailyCapLythoshi: toBigint4(args.dailyCapLythoshi, "dailyCapLythoshi"),
|
|
9263
9865
|
perTxCapLythoshi: toBigint4(args.perTxCapLythoshi, "perTxCapLythoshi"),
|
|
9264
|
-
allowRoot: expectLength6(
|
|
9265
|
-
denyRoot: expectLength6(
|
|
9866
|
+
allowRoot: expectLength6(toBytes9(args.allowRoot), 32, "allowRoot"),
|
|
9867
|
+
denyRoot: expectLength6(toBytes9(args.denyRoot), 32, "denyRoot"),
|
|
9266
9868
|
weeklyCapLythoshi: toBigint4(args.weeklyCapLythoshi ?? 0n, "weeklyCapLythoshi"),
|
|
9267
9869
|
monthlyCapLythoshi: toBigint4(args.monthlyCapLythoshi ?? 0n, "monthlyCapLythoshi"),
|
|
9268
|
-
categoryAllowRoot: args.categoryAllowRoot == null ? ZERO_WORD : expectLength6(
|
|
9269
|
-
timeWindow: args.timeWindow == null ? ZERO_WORD : expectLength6(
|
|
9870
|
+
categoryAllowRoot: args.categoryAllowRoot == null ? ZERO_WORD : expectLength6(toBytes9(args.categoryAllowRoot), 32, "categoryAllowRoot"),
|
|
9871
|
+
timeWindow: args.timeWindow == null ? ZERO_WORD : expectLength6(toBytes9(args.timeWindow), 32, "timeWindow"),
|
|
9270
9872
|
policyExpiry: toBigint4(args.policyExpiry ?? 0n, "policyExpiry")
|
|
9271
9873
|
};
|
|
9272
9874
|
}
|
|
@@ -9296,7 +9898,7 @@ function packTimeWindow(enabled, startHour, endHour) {
|
|
|
9296
9898
|
return out;
|
|
9297
9899
|
}
|
|
9298
9900
|
function decodeTimeWindow(word) {
|
|
9299
|
-
const bytes = expectLength6(
|
|
9901
|
+
const bytes = expectLength6(toBytes9(word), 32, "timeWindow");
|
|
9300
9902
|
if (bytes.every((b) => b === 0)) return null;
|
|
9301
9903
|
if (bytes[29] === 0) return null;
|
|
9302
9904
|
return [Math.min(bytes[30], 23), Math.min(bytes[31], 23)];
|
|
@@ -9339,7 +9941,7 @@ function toRawAddressBytes(value) {
|
|
|
9339
9941
|
}
|
|
9340
9942
|
return expectLength6(value instanceof Uint8Array ? value : Uint8Array.from(value), 20, "address");
|
|
9341
9943
|
}
|
|
9342
|
-
function
|
|
9944
|
+
function toBytes9(value) {
|
|
9343
9945
|
if (typeof value === "string") {
|
|
9344
9946
|
return hexToBytes9(value);
|
|
9345
9947
|
}
|
|
@@ -9421,7 +10023,7 @@ function pubkeyRegistryAddressHex() {
|
|
|
9421
10023
|
return PRECOMPILE_ADDRESSES.PUBKEY_REGISTRY.toLowerCase();
|
|
9422
10024
|
}
|
|
9423
10025
|
function encodeRegisterPubkeyCalldata(pubkey) {
|
|
9424
|
-
const bytes =
|
|
10026
|
+
const bytes = toBytes10(pubkey);
|
|
9425
10027
|
if (bytes.length !== PUBKEY_REGISTRY_ML_DSA_65_PUBLIC_KEY_LEN) {
|
|
9426
10028
|
throw new PubkeyRegistryError(
|
|
9427
10029
|
`pubkey must be ${PUBKEY_REGISTRY_ML_DSA_65_PUBLIC_KEY_LEN} bytes, got ${bytes.length}`
|
|
@@ -9430,8 +10032,8 @@ function encodeRegisterPubkeyCalldata(pubkey) {
|
|
|
9430
10032
|
return bytesToHex11(
|
|
9431
10033
|
concatBytes10(
|
|
9432
10034
|
hexToBytes10(PUBKEY_REGISTRY_SELECTORS.registerPubkey),
|
|
9433
|
-
|
|
9434
|
-
|
|
10035
|
+
uint256Word4(32n),
|
|
10036
|
+
uint256Word4(BigInt(bytes.length)),
|
|
9435
10037
|
bytes
|
|
9436
10038
|
)
|
|
9437
10039
|
);
|
|
@@ -9443,7 +10045,7 @@ function encodeHasPubkeyCalldata(address) {
|
|
|
9443
10045
|
return encodeSingleAddressCall2(PUBKEY_REGISTRY_SELECTORS.hasPubkey, address);
|
|
9444
10046
|
}
|
|
9445
10047
|
function decodeLookupPubkeyReturn(data) {
|
|
9446
|
-
const bytes =
|
|
10048
|
+
const bytes = toBytes10(data);
|
|
9447
10049
|
if (bytes.length < 96) {
|
|
9448
10050
|
throw new PubkeyRegistryError("lookup return must be at least 96 bytes");
|
|
9449
10051
|
}
|
|
@@ -9468,7 +10070,7 @@ function decodeLookupPubkeyReturn(data) {
|
|
|
9468
10070
|
};
|
|
9469
10071
|
}
|
|
9470
10072
|
function decodeHasPubkeyReturn(data) {
|
|
9471
|
-
const bytes =
|
|
10073
|
+
const bytes = toBytes10(data);
|
|
9472
10074
|
if (bytes.length !== 32) {
|
|
9473
10075
|
throw new PubkeyRegistryError("hasPubkey return must be 32 bytes");
|
|
9474
10076
|
}
|
|
@@ -9482,9 +10084,9 @@ function decodeHasPubkeyReturn(data) {
|
|
|
9482
10084
|
throw new PubkeyRegistryError("hasPubkey bool must be 0 or 1");
|
|
9483
10085
|
}
|
|
9484
10086
|
function encodeSingleAddressCall2(selector, address) {
|
|
9485
|
-
return bytesToHex11(concatBytes10(hexToBytes10(selector),
|
|
10087
|
+
return bytesToHex11(concatBytes10(hexToBytes10(selector), addressWord4(toAddressBytes(address))));
|
|
9486
10088
|
}
|
|
9487
|
-
function
|
|
10089
|
+
function addressWord4(address) {
|
|
9488
10090
|
return concatBytes10(new Uint8Array(12), address);
|
|
9489
10091
|
}
|
|
9490
10092
|
function toAddressBytes(value) {
|
|
@@ -9501,7 +10103,7 @@ function toAddressBytes(value) {
|
|
|
9501
10103
|
throw new PubkeyRegistryError(`address must be a typed mono bech32m address${detail}`);
|
|
9502
10104
|
}
|
|
9503
10105
|
}
|
|
9504
|
-
function
|
|
10106
|
+
function toBytes10(value) {
|
|
9505
10107
|
if (typeof value === "string") {
|
|
9506
10108
|
return hexToBytes10(value);
|
|
9507
10109
|
}
|
|
@@ -9530,7 +10132,7 @@ function concatBytes10(...parts) {
|
|
|
9530
10132
|
}
|
|
9531
10133
|
return out;
|
|
9532
10134
|
}
|
|
9533
|
-
function
|
|
10135
|
+
function uint256Word4(value) {
|
|
9534
10136
|
if (value < 0n || value > (1n << 256n) - 1n) {
|
|
9535
10137
|
throw new PubkeyRegistryError("uint256 value out of range");
|
|
9536
10138
|
}
|
|
@@ -9678,8 +10280,8 @@ function encodePlaceLimitOrderCalldata(args) {
|
|
|
9678
10280
|
normalized.baseTokenId,
|
|
9679
10281
|
normalized.quoteTokenId,
|
|
9680
10282
|
uint8Word2(normalized.side),
|
|
9681
|
-
|
|
9682
|
-
|
|
10283
|
+
uint256Word5(normalized.price, "price"),
|
|
10284
|
+
uint256Word5(normalized.quantity, "quantity"),
|
|
9683
10285
|
uint64Word4(normalized.expiryBlock, "expiryBlock")
|
|
9684
10286
|
)
|
|
9685
10287
|
);
|
|
@@ -9692,7 +10294,7 @@ function encodePlaceMarketOrderCalldata(args) {
|
|
|
9692
10294
|
normalized.baseTokenId,
|
|
9693
10295
|
normalized.quoteTokenId,
|
|
9694
10296
|
uint8Word2(normalized.side),
|
|
9695
|
-
|
|
10297
|
+
uint256Word5(normalized.quantity, "quantity"),
|
|
9696
10298
|
uint16Word2(normalized.maxSlippageBps, "maxSlippageBps")
|
|
9697
10299
|
)
|
|
9698
10300
|
);
|
|
@@ -9705,7 +10307,7 @@ function encodePlaceMarketOrderExCalldata(args) {
|
|
|
9705
10307
|
normalized.baseTokenId,
|
|
9706
10308
|
normalized.quoteTokenId,
|
|
9707
10309
|
uint8Word2(normalized.side),
|
|
9708
|
-
|
|
10310
|
+
uint256Word5(normalized.quantity, "quantity"),
|
|
9709
10311
|
uint16Word2(normalized.maxSlippageBps, "maxSlippageBps"),
|
|
9710
10312
|
uint8Word2(normalized.mode)
|
|
9711
10313
|
)
|
|
@@ -9725,7 +10327,7 @@ function encodeMarketGridTuneCalldata(selector, label, args) {
|
|
|
9725
10327
|
hexToBytes2(selector, `${label} selector`),
|
|
9726
10328
|
bytes32FromHex(args.baseTokenId, "baseTokenId"),
|
|
9727
10329
|
bytes32FromHex(args.quoteTokenId, "quoteTokenId"),
|
|
9728
|
-
|
|
10330
|
+
uint256Word5(BigInt(args.newValue), "newValue")
|
|
9729
10331
|
)
|
|
9730
10332
|
);
|
|
9731
10333
|
}
|
|
@@ -10013,12 +10615,12 @@ function encodePlaceLimitOrderViaCalldata(args) {
|
|
|
10013
10615
|
return bytesToHex2(
|
|
10014
10616
|
concatBytes2(
|
|
10015
10617
|
hexToBytes2(OPERATOR_ROUTER_SELECTORS.placeLimitOrderVia, "placeLimitOrderVia selector"),
|
|
10016
|
-
|
|
10618
|
+
addressWord5(operator.bytes),
|
|
10017
10619
|
bytes32FromHex(args.base, "base"),
|
|
10018
10620
|
bytes32FromHex(args.quote, "quote"),
|
|
10019
10621
|
uint8Word2(side),
|
|
10020
|
-
|
|
10021
|
-
|
|
10622
|
+
uint256Word5(price, "price"),
|
|
10623
|
+
uint256Word5(amount, "amount"),
|
|
10022
10624
|
uint64Word4(expiresAtBlock, "expiresAtBlock")
|
|
10023
10625
|
)
|
|
10024
10626
|
);
|
|
@@ -10330,7 +10932,7 @@ function uint16Word2(value, name) {
|
|
|
10330
10932
|
out[31] = Number(value & 0xffn);
|
|
10331
10933
|
return out;
|
|
10332
10934
|
}
|
|
10333
|
-
function
|
|
10935
|
+
function uint256Word5(value, name) {
|
|
10334
10936
|
if (value < 0n || value >= 1n << 256n) {
|
|
10335
10937
|
throw new MarketActionError(`${name} must fit uint256`);
|
|
10336
10938
|
}
|
|
@@ -10342,7 +10944,7 @@ function uint256Word3(value, name) {
|
|
|
10342
10944
|
}
|
|
10343
10945
|
return out;
|
|
10344
10946
|
}
|
|
10345
|
-
function
|
|
10947
|
+
function addressWord5(addr) {
|
|
10346
10948
|
if (addr.length !== 20) {
|
|
10347
10949
|
throw new MarketActionError("address must be 20 bytes");
|
|
10348
10950
|
}
|
|
@@ -10882,8 +11484,8 @@ var MONOLYTHIUM_NETWORKS = {
|
|
|
10882
11484
|
};
|
|
10883
11485
|
|
|
10884
11486
|
// src/index.ts
|
|
10885
|
-
var version = "0.4.
|
|
11487
|
+
var version = "0.4.8";
|
|
10886
11488
|
|
|
10887
|
-
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 };
|
|
11489
|
+
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 };
|
|
10888
11490
|
//# sourceMappingURL=index.js.map
|
|
10889
11491
|
//# sourceMappingURL=index.js.map
|