@monolythium/core-sdk 0.4.0 → 0.4.1

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/dist/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import { blake3 } from '@noble/hashes/blake3.js';
2
- import { keccak_256 } from '@noble/hashes/sha3.js';
2
+ import { keccak_256, shake256 } from '@noble/hashes/sha3.js';
3
3
  import { ml_dsa65 } from '@noble/post-quantum/ml-dsa.js';
4
4
  import { bls12_381 } from '@noble/curves/bls12-381.js';
5
+ import { mnemonicToEntropy } from '@scure/bip39';
6
+ import { wordlist } from '@scure/bip39/wordlists/english.js';
5
7
  import '@noble/post-quantum/ml-kem.js';
6
8
  import '@noble/ciphers/chacha.js';
7
9
  import '@noble/hashes/utils.js';
@@ -435,10 +437,24 @@ var NODE_REGISTRY_SELECTORS = {
435
437
  /** `getOperatorNetworkMetadata(bytes32)` view (PF-6). */
436
438
  getOperatorNetworkMetadata: "0x" + selectorHex("getOperatorNetworkMetadata(bytes32)"),
437
439
  /** `getClusterDiversity(uint32)` view (PF-6). */
438
- getClusterDiversity: "0x" + selectorHex("getClusterDiversity(uint32)")
440
+ getClusterDiversity: "0x" + selectorHex("getClusterDiversity(uint32)"),
441
+ /** `requestClusterJoin(uint32,bytes)` — CJ-1 joining operator posts an admit request. */
442
+ requestClusterJoin: "0x" + selectorHex("requestClusterJoin(uint32,bytes)"),
443
+ /** `voteClusterAdmit(uint32,bytes32,bytes)` — CJ-1 current member admit vote. */
444
+ voteClusterAdmit: "0x" + selectorHex("voteClusterAdmit(uint32,bytes32,bytes)"),
445
+ /** `cancelClusterJoin(uint32,bytes32)` — CJ-1 requester cancellation/refund. */
446
+ cancelClusterJoin: "0x" + selectorHex("cancelClusterJoin(uint32,bytes32)"),
447
+ /** `expireClusterJoin(uint32,bytes32)` — CJ-1 public reaper/refund. */
448
+ expireClusterJoin: "0x" + selectorHex("expireClusterJoin(uint32,bytes32)"),
449
+ /** `getClusterJoinRequest(uint32,bytes32)` — CJ-1 request status view. */
450
+ getClusterJoinRequest: "0x" + selectorHex("getClusterJoinRequest(uint32,bytes32)")
439
451
  };
440
- var NODE_REGISTRY_BLS_PUBKEY_BYTES = 48;
441
- var NODE_REGISTRY_DKG_THRESHOLD_SIG_BYTES = 96;
452
+ var NODE_REGISTRY_LEGACY_CLUSTER_MEMBER_PUBKEY_BYTES = 48;
453
+ var NODE_REGISTRY_BLS_PUBKEY_BYTES = NODE_REGISTRY_LEGACY_CLUSTER_MEMBER_PUBKEY_BYTES;
454
+ var NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES = 1952;
455
+ var NODE_REGISTRY_CONSENSUS_POP_BYTES = 3309;
456
+ var NODE_REGISTRY_DKG_ATTESTATION_SIG_BYTES = 96;
457
+ var NODE_REGISTRY_DKG_THRESHOLD_SIG_BYTES = NODE_REGISTRY_DKG_ATTESTATION_SIG_BYTES;
442
458
  var NODE_REGISTRY_DKG_RESHARE_MIN_SIGNERS = 5;
443
459
  var NODE_REGISTRY_DKG_RESHARE_MAX_SIGNERS = 7;
444
460
  var NODE_REGISTRY_PENDING_CHANGE_MAX_INTENT_ID = (1n << 56n) - 1n;
@@ -508,7 +524,7 @@ function encodeSubmitPendingChangeCalldata(args) {
508
524
  const { kind, kindCode } = normalizePendingChangeKind(args.kind);
509
525
  const targetPubkey = expectLength2(
510
526
  toBytes(args.targetPubkey),
511
- NODE_REGISTRY_BLS_PUBKEY_BYTES,
527
+ NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES,
512
528
  "targetPubkey"
513
529
  );
514
530
  const effectiveEpoch = toUint64(args.effectiveEpoch, "effectiveEpoch");
@@ -522,8 +538,7 @@ function encodeSubmitPendingChangeCalldata(args) {
522
538
  if (kind !== "rotate" && intentId !== 0n) {
523
539
  throw new NodeRegistryError("only rotate pending changes may carry a non-zero intentId");
524
540
  }
525
- const targetTail = new Uint8Array(32);
526
- targetTail.set(targetPubkey.slice(32, 48), 0);
541
+ const targetPubkeyPadded = padToWord(targetPubkey);
527
542
  return bytesToHex(
528
543
  concatBytes(
529
544
  hexToBytes(NODE_REGISTRY_SELECTORS.submitPendingChange),
@@ -531,55 +546,59 @@ function encodeSubmitPendingChangeCalldata(args) {
531
546
  uint64Word(4n * 32n, "targetPubkeyOffset"),
532
547
  uint64Word(effectiveEpoch, "effectiveEpoch"),
533
548
  uint64Word(intentId, "intentId"),
534
- uint64Word(BigInt(NODE_REGISTRY_BLS_PUBKEY_BYTES), "targetPubkeyLength"),
535
- targetPubkey.slice(0, 32),
536
- targetTail
549
+ uint64Word(BigInt(targetPubkey.length), "targetPubkeyLength"),
550
+ targetPubkeyPadded
537
551
  )
538
552
  );
539
553
  }
540
554
  function encodeCancelPendingChangeCalldata(args) {
541
555
  const targetPubkey = expectLength2(
542
556
  toBytes(args.targetPubkey),
543
- NODE_REGISTRY_BLS_PUBKEY_BYTES,
557
+ NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES,
544
558
  "targetPubkey"
545
559
  );
546
- const targetTail = new Uint8Array(32);
547
- targetTail.set(targetPubkey.slice(32, 48), 0);
560
+ const targetPubkeyPadded = padToWord(targetPubkey);
548
561
  return bytesToHex(
549
562
  concatBytes(
550
563
  hexToBytes(NODE_REGISTRY_SELECTORS.cancelPendingChange),
551
564
  uint64Word(args.epoch, "epoch"),
552
565
  uint64Word(2n * 32n, "targetPubkeyOffset"),
553
- uint64Word(BigInt(NODE_REGISTRY_BLS_PUBKEY_BYTES), "targetPubkeyLength"),
554
- targetPubkey.slice(0, 32),
555
- targetTail
566
+ uint64Word(BigInt(targetPubkey.length), "targetPubkeyLength"),
567
+ targetPubkeyPadded
556
568
  )
557
569
  );
558
570
  }
559
- function parseDkgResharePublicKeys(blsPublicKeys) {
560
- const keys = toBytes(blsPublicKeys);
561
- if (keys.length % NODE_REGISTRY_BLS_PUBKEY_BYTES !== 0) {
562
- throw new NodeRegistryError("blsPublicKeys length must be a multiple of 48 bytes");
571
+ function parseDkgResharePublicKeys(consensusPublicKeys) {
572
+ const keys = toBytes(consensusPublicKeys);
573
+ if (keys.length % NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES !== 0) {
574
+ throw new NodeRegistryError(
575
+ `consensusPublicKeys length must be a multiple of ${NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES} bytes`
576
+ );
563
577
  }
564
- const signerCount = keys.length / NODE_REGISTRY_BLS_PUBKEY_BYTES;
578
+ const signerCount = keys.length / NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES;
565
579
  if (signerCount < NODE_REGISTRY_DKG_RESHARE_MIN_SIGNERS || signerCount > NODE_REGISTRY_DKG_RESHARE_MAX_SIGNERS) {
566
580
  throw new NodeRegistryError(
567
- `blsPublicKeys must contain ${NODE_REGISTRY_DKG_RESHARE_MIN_SIGNERS}..${NODE_REGISTRY_DKG_RESHARE_MAX_SIGNERS} signers`
581
+ `consensusPublicKeys must contain ${NODE_REGISTRY_DKG_RESHARE_MIN_SIGNERS}..${NODE_REGISTRY_DKG_RESHARE_MAX_SIGNERS} signers`
568
582
  );
569
583
  }
570
584
  const out = [];
571
585
  const seen = /* @__PURE__ */ new Set();
572
- for (let offset = 0; offset < keys.length; offset += NODE_REGISTRY_BLS_PUBKEY_BYTES) {
573
- const key = keys.slice(offset, offset + NODE_REGISTRY_BLS_PUBKEY_BYTES);
586
+ for (let offset = 0; offset < keys.length; offset += NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES) {
587
+ const key = keys.slice(offset, offset + NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES);
574
588
  const keyHex = bytesToHex(key);
575
589
  if (seen.has(keyHex)) {
576
- throw new NodeRegistryError("blsPublicKeys contains a duplicate signer pubkey");
590
+ throw new NodeRegistryError("consensusPublicKeys contains a duplicate signer pubkey");
577
591
  }
578
592
  seen.add(keyHex);
579
593
  out.push(key);
580
594
  }
581
595
  return out;
582
596
  }
597
+ function dkgReshareConsensusPublicKeys(args) {
598
+ if (args.consensusPublicKeys !== void 0) return args.consensusPublicKeys;
599
+ if (args.blsPublicKeys !== void 0) return args.blsPublicKeys;
600
+ throw new NodeRegistryError("consensusPublicKeys is required");
601
+ }
583
602
  function encodeAttestDkgReshareCalldata(args) {
584
603
  const intentId = toUint64(args.intentId, "intentId");
585
604
  if (intentId === 0n) {
@@ -588,10 +607,10 @@ function encodeAttestDkgReshareCalldata(args) {
588
607
  if (intentId > NODE_REGISTRY_PENDING_CHANGE_MAX_INTENT_ID) {
589
608
  throw new NodeRegistryError("intentId must be <= 2^56-1");
590
609
  }
591
- const publicKeys = concatBytes(...parseDkgResharePublicKeys(args.blsPublicKeys));
610
+ const publicKeys = concatBytes(...parseDkgResharePublicKeys(dkgReshareConsensusPublicKeys(args)));
592
611
  const thresholdSig = expectLength2(
593
612
  toBytes(args.thresholdSig),
594
- NODE_REGISTRY_DKG_THRESHOLD_SIG_BYTES,
613
+ NODE_REGISTRY_DKG_ATTESTATION_SIG_BYTES,
595
614
  "thresholdSig"
596
615
  );
597
616
  const keysPadded = padToWord(publicKeys);
@@ -602,15 +621,94 @@ function encodeAttestDkgReshareCalldata(args) {
602
621
  concatBytes(
603
622
  hexToBytes(NODE_REGISTRY_SELECTORS.attestDkgReshare),
604
623
  uint64Word(intentId, "intentId"),
605
- uint64Word(offsetKeys, "blsPublicKeysOffset"),
624
+ uint64Word(offsetKeys, "consensusPublicKeysOffset"),
606
625
  uint64Word(offsetSig, "thresholdSigOffset"),
607
- uint64Word(BigInt(publicKeys.length), "blsPublicKeysLength"),
626
+ uint64Word(BigInt(publicKeys.length), "consensusPublicKeysLength"),
608
627
  keysPadded,
609
628
  uint64Word(BigInt(thresholdSig.length), "thresholdSigLength"),
610
629
  sigPadded
611
630
  )
612
631
  );
613
632
  }
633
+ function encodeRequestClusterJoinCalldata(args) {
634
+ const operatorPubkey = expectLength2(
635
+ toBytes(args.operatorPubkey),
636
+ NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES,
637
+ "operatorPubkey"
638
+ );
639
+ const operatorPubkeyPadded = padToWord(operatorPubkey);
640
+ return bytesToHex(
641
+ concatBytes(
642
+ hexToBytes(NODE_REGISTRY_SELECTORS.requestClusterJoin),
643
+ uint32Word(toUint32(args.clusterId, "clusterId")),
644
+ uint64Word(2n * 32n, "operatorPubkeyOffset"),
645
+ uint64Word(BigInt(operatorPubkey.length), "operatorPubkeyLength"),
646
+ operatorPubkeyPadded
647
+ )
648
+ );
649
+ }
650
+ function encodeVoteClusterAdmitCalldata(args) {
651
+ const operatorId = expectLength2(toBytes(args.operatorId), 32, "operatorId");
652
+ const voterPubkey = expectLength2(
653
+ toBytes(args.voterPubkey),
654
+ NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES,
655
+ "voterPubkey"
656
+ );
657
+ const voterPubkeyPadded = padToWord(voterPubkey);
658
+ return bytesToHex(
659
+ concatBytes(
660
+ hexToBytes(NODE_REGISTRY_SELECTORS.voteClusterAdmit),
661
+ uint32Word(toUint32(args.clusterId, "clusterId")),
662
+ operatorId,
663
+ uint64Word(3n * 32n, "voterPubkeyOffset"),
664
+ uint64Word(BigInt(voterPubkey.length), "voterPubkeyLength"),
665
+ voterPubkeyPadded
666
+ )
667
+ );
668
+ }
669
+ function encodeCancelClusterJoinCalldata(args) {
670
+ return bytesToHex(
671
+ concatBytes(
672
+ hexToBytes(NODE_REGISTRY_SELECTORS.cancelClusterJoin),
673
+ uint32Word(toUint32(args.clusterId, "clusterId")),
674
+ expectLength2(toBytes(args.operatorId), 32, "operatorId")
675
+ )
676
+ );
677
+ }
678
+ function encodeExpireClusterJoinCalldata(args) {
679
+ return bytesToHex(
680
+ concatBytes(
681
+ hexToBytes(NODE_REGISTRY_SELECTORS.expireClusterJoin),
682
+ uint32Word(toUint32(args.clusterId, "clusterId")),
683
+ expectLength2(toBytes(args.operatorId), 32, "operatorId")
684
+ )
685
+ );
686
+ }
687
+ function encodeGetClusterJoinRequestCalldata(args) {
688
+ return bytesToHex(
689
+ concatBytes(
690
+ hexToBytes(NODE_REGISTRY_SELECTORS.getClusterJoinRequest),
691
+ uint32Word(toUint32(args.clusterId, "clusterId")),
692
+ expectLength2(toBytes(args.operatorId), 32, "operatorId")
693
+ )
694
+ );
695
+ }
696
+ function decodeClusterJoinRequest(returnData) {
697
+ const bytes = expectLength2(toBytes(returnData), 8 * 32, "clusterJoinRequest");
698
+ const word = (i) => bytes.slice(i * 32, (i + 1) * 32);
699
+ const statusCode = numberFromWord(word(5), "status", 255);
700
+ return {
701
+ owner: bytesToHex(word(0).slice(12, 32)),
702
+ requestEpoch: u64FromWord(word(1)),
703
+ snapshotThreshold: numberFromWord(word(2), "snapshotThreshold", 65535),
704
+ snapshotN: numberFromWord(word(3), "snapshotN", 65535),
705
+ voteCount: numberFromWord(word(4), "voteCount", 65535),
706
+ statusCode,
707
+ status: clusterJoinRequestStatusLabel(statusCode),
708
+ bondLythoshi: uintFromWord(word(6)),
709
+ sealRosterPending: numberFromWord(word(7), "sealRosterPending", 1) === 1
710
+ };
711
+ }
614
712
  function encodeReportServiceProbeCalldata(args) {
615
713
  if (!isValidPublicServiceProbeMask(args.serviceMask)) {
616
714
  throw new NodeRegistryError(
@@ -697,7 +795,9 @@ function deriveClusterAnchorAddress(roster, threshold) {
697
795
  if (!Number.isInteger(threshold) || threshold < 0 || threshold > 65535) {
698
796
  throw new NodeRegistryError("threshold must be a uint16");
699
797
  }
700
- const members = roster.map((m, i) => expectLength2(toBytes(m), 48, `roster[${i}]`));
798
+ const members = roster.map(
799
+ (m, i) => expectLength2(toBytes(m), NODE_REGISTRY_LEGACY_CLUSTER_MEMBER_PUBKEY_BYTES, `roster[${i}]`)
800
+ );
701
801
  members.sort(compareBytes);
702
802
  const parts = [
703
803
  new TextEncoder().encode(MULTISIG_ADDRESS_DERIVATION_DOMAIN),
@@ -722,6 +822,36 @@ function u64FromWord(word) {
722
822
  }
723
823
  return v;
724
824
  }
825
+ function uintFromWord(word) {
826
+ let v = 0n;
827
+ for (const byte of word) {
828
+ v = v << 8n | BigInt(byte);
829
+ }
830
+ return v;
831
+ }
832
+ function numberFromWord(word, name, max) {
833
+ const value = uintFromWord(word);
834
+ if (value > BigInt(max)) {
835
+ throw new NodeRegistryError(`${name} must be <= ${max}`);
836
+ }
837
+ return Number(value);
838
+ }
839
+ function clusterJoinRequestStatusLabel(status) {
840
+ switch (status) {
841
+ case 0:
842
+ return "none";
843
+ case 1:
844
+ return "open";
845
+ case 2:
846
+ return "admitted";
847
+ case 3:
848
+ return "cancelled";
849
+ case 4:
850
+ return "expired";
851
+ default:
852
+ return "unknown";
853
+ }
854
+ }
725
855
  function u64BeBytes(value) {
726
856
  const out = new Uint8Array(8);
727
857
  let n = value;
@@ -753,6 +883,27 @@ function expectUint32(value, name) {
753
883
  }
754
884
  return value;
755
885
  }
886
+ function toUint32(value, name) {
887
+ let parsed;
888
+ if (typeof value === "bigint") {
889
+ parsed = value;
890
+ } else if (typeof value === "number") {
891
+ if (!Number.isSafeInteger(value)) {
892
+ throw new NodeRegistryError(`${name} must be a safe integer`);
893
+ }
894
+ parsed = BigInt(value);
895
+ } else {
896
+ const trimmed = value.trim();
897
+ if (!/^\d+$/u.test(trimmed)) {
898
+ throw new NodeRegistryError(`${name} must be a decimal uint32`);
899
+ }
900
+ parsed = BigInt(trimmed);
901
+ }
902
+ if (parsed < 0n || parsed > 0xffffffffn) {
903
+ throw new NodeRegistryError(`${name} must fit uint32`);
904
+ }
905
+ return Number(parsed);
906
+ }
756
907
  function uint32Word(value) {
757
908
  const out = new Uint8Array(32);
758
909
  const n = expectUint32(value, "uint32");
@@ -895,6 +1046,16 @@ function bigintToBeBytes(value, bytes, label) {
895
1046
  }
896
1047
  return out;
897
1048
  }
1049
+ function parseBigint(value, label) {
1050
+ if (value === void 0) throw new Error(`${label} missing`);
1051
+ if (typeof value === "bigint") return value;
1052
+ if (typeof value === "number") {
1053
+ if (!Number.isSafeInteger(value) || value < 0) throw new Error(`${label} must be a non-negative safe integer`);
1054
+ return BigInt(value);
1055
+ }
1056
+ if (value.startsWith("0x") || value.startsWith("0X")) return BigInt(value);
1057
+ return BigInt(value);
1058
+ }
898
1059
 
899
1060
  // src/crypto/submission.ts
900
1061
  async function fetchEncryptionKey(client) {
@@ -916,6 +1077,38 @@ async function buildEncryptedSubmission(_args) {
916
1077
  async function submitEncryptedEnvelope(client, envelopeWireHex) {
917
1078
  return client.call("lyth_submitEncrypted", [envelopeWireHex]);
918
1079
  }
1080
+ function buildPlaintextSubmission(args) {
1081
+ const signed = args.backend.signEvmTx(args.tx);
1082
+ return {
1083
+ signedTxWireHex: `0x${signed.wireHex}`,
1084
+ innerTxHashHex: bytesToHex2(signed.txHash),
1085
+ innerSighashHex: bytesToHex2(signed.sighash),
1086
+ innerWireBytes: signed.wireBytes.length
1087
+ };
1088
+ }
1089
+ async function submitPlaintextTransaction(client, signedTxWireHex, expectedTxHashHex) {
1090
+ const returned = await client.call("mesh_submitTx", [signedTxWireHex]);
1091
+ const returnedBytes = hexToBytes2(returned, "mesh_submitTx tx hash");
1092
+ if (returnedBytes.length !== 32) {
1093
+ throw new Error(
1094
+ `mesh_submitTx tx hash must be 32 bytes, got ${returnedBytes.length}`
1095
+ );
1096
+ }
1097
+ const expectedBytes = hexToBytes2(expectedTxHashHex, "expected tx hash");
1098
+ if (!bytesEqual(returnedBytes, expectedBytes)) {
1099
+ throw new Error(
1100
+ `mesh_submitTx returned tx hash ${bytesToHex2(returnedBytes)} but the locally computed canonical hash is ${bytesToHex2(expectedBytes)}`
1101
+ );
1102
+ }
1103
+ return bytesToHex2(returnedBytes);
1104
+ }
1105
+ function bytesEqual(a, b) {
1106
+ if (a.length !== b.length) return false;
1107
+ for (let i = 0; i < a.length; i++) {
1108
+ if (a[i] !== b[i]) return false;
1109
+ }
1110
+ return true;
1111
+ }
919
1112
 
920
1113
  // src/crypto/bincode.ts
921
1114
  var BincodeWriter = class {
@@ -1833,11 +2026,181 @@ function concatBytes3(...parts) {
1833
2026
  function isIdentifier(value) {
1834
2027
  return /^[a-z][a-z0-9_]*$/.test(value);
1835
2028
  }
2029
+
2030
+ // src/crypto/tx.ts
2031
+ function encodeTransactionForHash(fields, tag) {
2032
+ const n = normalizeTxFields(fields);
2033
+ return concatBytes2(
2034
+ Uint8Array.of(tag),
2035
+ bigintToBeBytes(n.chainId, 8, "chainId"),
2036
+ bigintToBeBytes(n.nonce, 8, "nonce"),
2037
+ bigintToBeBytes(n.maxPriorityFeePerGas, 32, "maxPriorityFeePerGas"),
2038
+ bigintToBeBytes(n.maxFeePerGas, 32, "maxFeePerGas"),
2039
+ bigintToBeBytes(n.gasLimit, 8, "gasLimit"),
2040
+ n.to === null ? Uint8Array.of(0) : concatBytes2(Uint8Array.of(1), n.to),
2041
+ bigintToBeBytes(n.value, 32, "value"),
2042
+ bigintToBeBytes(BigInt(n.input.length), 4, "input.length"),
2043
+ n.input,
2044
+ new Uint8Array(4),
2045
+ // access_list length
2046
+ encodeExtensionsForHash(n.extensions)
2047
+ );
2048
+ }
2049
+ function bincodeSignedTransaction(fields, signature, publicKey) {
2050
+ const n = normalizeTxFields(fields);
2051
+ const sig = expectBytes(signature, ML_DSA_65_SIGNATURE_LEN, "ML-DSA-65 signature");
2052
+ const pk = expectBytes(publicKey, ML_DSA_65_PUBLIC_KEY_LEN, "ML-DSA-65 public key");
2053
+ const w = new BincodeWriter();
2054
+ w.u64(n.chainId);
2055
+ w.u64(n.nonce);
2056
+ w.bytes(uint256Be(n.maxPriorityFeePerGas, "maxPriorityFeePerGas"));
2057
+ w.bytes(uint256Be(n.maxFeePerGas, "maxFeePerGas"));
2058
+ w.u64(n.gasLimit);
2059
+ if (n.to === null) {
2060
+ w.u8(0);
2061
+ } else {
2062
+ w.u8(1);
2063
+ w.bytes(n.to);
2064
+ }
2065
+ w.bytes(uint256Be(n.value, "value"));
2066
+ w.bytes(n.input);
2067
+ w.u64(0n);
2068
+ w.u64(BigInt(n.extensions.length));
2069
+ for (const ext of n.extensions) bincodeTypedExtensionInto(w, ext);
2070
+ bincodeMlDsa65OpaqueInto(w, sig);
2071
+ bincodeMlDsa65OpaqueInto(w, pk);
2072
+ return w.toBytes();
2073
+ }
2074
+ function normalizeTxFields(fields) {
2075
+ return {
2076
+ chainId: parseBigint(fields.chainId, "chainId"),
2077
+ nonce: parseBigint(fields.nonce, "nonce"),
2078
+ maxPriorityFeePerGas: parseBigint(fields.maxPriorityFeePerGas, "maxPriorityFeePerGas"),
2079
+ maxFeePerGas: parseBigint(fields.maxFeePerGas, "maxFeePerGas"),
2080
+ gasLimit: parseBigint(fields.gasLimit, "gasLimit"),
2081
+ to: normalizeTo(fields.to),
2082
+ value: parseBigint(fields.value, "value"),
2083
+ input: normalizeBytes(fields.input ?? new Uint8Array(0), "input"),
2084
+ extensions: normalizeExtensions(fields.extensions)
2085
+ };
2086
+ }
2087
+ function normalizeTo(value) {
2088
+ if (value === null) return null;
2089
+ const bytes = normalizeBytes(value, "to");
2090
+ return expectBytes(bytes, 20, "to");
2091
+ }
2092
+ function normalizeBytes(value, label) {
2093
+ if (typeof value === "string") return hexToBytes2(value, label);
2094
+ return value instanceof Uint8Array ? value : Uint8Array.from(value);
2095
+ }
2096
+ function normalizeExtensions(value) {
2097
+ if (value === void 0) return [];
2098
+ return value.map((ext, index) => {
2099
+ if (!Number.isInteger(ext.kind) || ext.kind < 0 || ext.kind > 255) {
2100
+ throw new Error(`extensions[${index}].kind out of u8 range`);
2101
+ }
2102
+ const body = normalizeBytes("bodyHex" in ext ? ext.bodyHex : ext.body, `extensions[${index}].body`);
2103
+ if (body.length > 4294967295) {
2104
+ throw new Error(`extensions[${index}].body exceeds u32 length`);
2105
+ }
2106
+ return { kind: ext.kind, body };
2107
+ });
2108
+ }
2109
+ function encodeExtensionsForHash(extensions) {
2110
+ const chunks = [bigintToBeBytes(BigInt(extensions.length), 4, "extensions.length")];
2111
+ for (const ext of extensions) {
2112
+ chunks.push(
2113
+ Uint8Array.of(ext.kind),
2114
+ bigintToBeBytes(BigInt(ext.body.length), 4, "extension.body.length"),
2115
+ ext.body
2116
+ );
2117
+ }
2118
+ return concatBytes2(...chunks);
2119
+ }
2120
+ function uint256Be(value, label) {
2121
+ if (value < 0n || value >= 1n << 256n) throw new Error(`${label} out of u256 range`);
2122
+ const out = new Uint8Array(32);
2123
+ let v = value;
2124
+ for (let i = 31; i >= 0; i--) {
2125
+ out[i] = Number(v & 0xffn);
2126
+ v >>= 8n;
2127
+ }
2128
+ return out;
2129
+ }
2130
+ function bincodeMlDsa65OpaqueInto(w, raw) {
2131
+ w.enumVariant(ENUM_VARIANT_INDEX_ML_DSA_65);
2132
+ w.u16(STANDARD_ALGO_NUMBER_ML_DSA_65);
2133
+ w.bytes(raw);
2134
+ }
2135
+ function bincodeTypedExtensionInto(w, ext) {
2136
+ w.u8(ext.kind);
2137
+ w.bytes(ext.body);
2138
+ }
2139
+
2140
+ // src/crypto/ml-dsa.ts
2141
+ var ML_DSA_65_SEED_LEN = 32;
2142
+ var ML_DSA_65_SIGNING_KEY_LEN = 4032;
1836
2143
  var ML_DSA_65_PUBLIC_KEY_LEN = 1952;
1837
2144
  var ML_DSA_65_SIGNATURE_LEN = 3309;
1838
2145
  var STANDARD_ALGO_NUMBER_ML_DSA_65 = 1001;
2146
+ var ENUM_VARIANT_INDEX_ML_DSA_65 = 5;
1839
2147
  var ADDRESS_DERIVATION_DOMAIN = "MONO_ADDRESS_BLAKE3_20_V1";
1840
2148
  var ADDRESS_DERIVATION_DOMAIN_BYTES = new TextEncoder().encode(ADDRESS_DERIVATION_DOMAIN);
2149
+ var MlDsa65Backend = class _MlDsa65Backend {
2150
+ #secretKey;
2151
+ #publicKey;
2152
+ #addressBytes;
2153
+ constructor(secretKey, publicKey) {
2154
+ this.#secretKey = expectBytes(secretKey, ML_DSA_65_SIGNING_KEY_LEN, "ML-DSA-65 secret key").slice();
2155
+ this.#publicKey = expectBytes(publicKey, ML_DSA_65_PUBLIC_KEY_LEN, "ML-DSA-65 public key").slice();
2156
+ this.#addressBytes = mlDsa65AddressBytes(this.#publicKey);
2157
+ }
2158
+ static fromSeed(seed) {
2159
+ const kp = ml_dsa65.keygen(expectBytes(seed, ML_DSA_65_SEED_LEN, "ML-DSA-65 seed"));
2160
+ return new _MlDsa65Backend(kp.secretKey, kp.publicKey);
2161
+ }
2162
+ publicKey() {
2163
+ return this.#publicKey.slice();
2164
+ }
2165
+ addressBytes() {
2166
+ return this.#addressBytes.slice();
2167
+ }
2168
+ getAddress() {
2169
+ return bytesToHex2(this.#addressBytes);
2170
+ }
2171
+ sign(message) {
2172
+ return ml_dsa65.sign(message, this.#secretKey, { extraEntropy: false });
2173
+ }
2174
+ signPrehash(digest) {
2175
+ return this.sign(expectBytes(digest, 32, "prehash"));
2176
+ }
2177
+ verify(message, signature) {
2178
+ return ml_dsa65.verify(
2179
+ expectBytes(signature, ML_DSA_65_SIGNATURE_LEN, "ML-DSA-65 signature"),
2180
+ message,
2181
+ this.#publicKey
2182
+ );
2183
+ }
2184
+ signEvmTx(fields) {
2185
+ const txHashPreimage = encodeTransactionForHash(fields, 1);
2186
+ const sighash = keccak_256(txHashPreimage);
2187
+ const signature = this.sign(sighash);
2188
+ const wireBytes = bincodeSignedTransaction(fields, signature, this.#publicKey);
2189
+ const txHash = keccak_256(
2190
+ concatBytes2(
2191
+ encodeTransactionForHash(fields, 2),
2192
+ signature,
2193
+ this.#publicKey
2194
+ )
2195
+ );
2196
+ return {
2197
+ wireHex: bytesToHex2(wireBytes).slice(2),
2198
+ wireBytes,
2199
+ sighash,
2200
+ txHash
2201
+ };
2202
+ }
2203
+ };
1841
2204
  function mlDsa65AddressFromPublicKey(publicKey) {
1842
2205
  return bytesToHex2(mlDsa65AddressBytes(publicKey));
1843
2206
  }
@@ -3445,11 +3808,15 @@ var RpcClient = class _RpcClient {
3445
3808
  const params = status === void 0 ? operator == null ? [] : [operator] : [operator ?? null, status];
3446
3809
  return this.call("lyth_getClusterResignations", params);
3447
3810
  }
3448
- /** `lyth_getBlsRoundCertificate` — round-advancement BLS aggregate. */
3811
+ /** `lyth_getRoundCertificate` — round-advancement certificate. */
3812
+ async lythGetRoundCertificate(round) {
3813
+ return this.call("lyth_getRoundCertificate", [encodeRpcInteger(round)]);
3814
+ }
3815
+ /** @deprecated Use lythGetRoundCertificate. */
3449
3816
  async lythGetBlsRoundCertificate(round) {
3450
- return this.call("lyth_getBlsRoundCertificate", [encodeRpcInteger(round)]);
3817
+ return this.lythGetRoundCertificate(round);
3451
3818
  }
3452
- /** `lyth_getLeaderCertificate` — leader-vote BLS aggregate for a block ref. */
3819
+ /** `lyth_getLeaderCertificate` — leader-vote certificate for a block ref. */
3453
3820
  async lythGetLeaderCertificate(round, authority, digest) {
3454
3821
  return this.call("lyth_getLeaderCertificate", [encodeRpcInteger(round), authority, digest]);
3455
3822
  }
@@ -4047,7 +4414,9 @@ function normalizeOperatorInfo(value) {
4047
4414
  (v, i) => parseRpcNumber(v, `operator info activeClusterIds[${i}]`)
4048
4415
  ),
4049
4416
  operatorKeyFingerprint: parseStringNullable(row["operatorKeyFingerprint"]),
4050
- blsKeyFingerprint: parseStringNullable(row["blsKeyFingerprint"]),
4417
+ consensusKeyFingerprint: parseStringNullable(
4418
+ row["consensusKeyFingerprint"] ?? row["blsKeyFingerprint"]
4419
+ ),
4051
4420
  lifecycleState: String(row["lifecycleState"]),
4052
4421
  capability: capability && typeof capability === "object" && !Array.isArray(capability) ? capability : {}
4053
4422
  };
@@ -4056,7 +4425,7 @@ function normalizeClusterMember(value, label) {
4056
4425
  const row = expectObject(value, label);
4057
4426
  return {
4058
4427
  operatorId: String(row["operatorId"]),
4059
- blsPubkey: String(row["blsPubkey"]),
4428
+ consensusPubkey: String(row["consensusPubkey"] ?? row["blsPubkey"]),
4060
4429
  state: String(row["state"])
4061
4430
  };
4062
4431
  }
@@ -4122,7 +4491,7 @@ function normalizeOperatorAuthority(value) {
4122
4491
  schemaVersion: parseRpcNumber(row["schemaVersion"], "operator authority schemaVersion"),
4123
4492
  operatorId: String(row["operatorId"]),
4124
4493
  authorityIndex: parseRpcNumber(row["authorityIndex"], "operator authority authorityIndex"),
4125
- blsPubkey: String(row["blsPubkey"]),
4494
+ consensusPubkey: String(row["consensusPubkey"] ?? row["blsPubkey"]),
4126
4495
  active: Boolean(row["active"])
4127
4496
  };
4128
4497
  }
@@ -5868,7 +6237,7 @@ var NO_EVM_COMPACT_INCLUSION_TREE_ALGORITHM = "binary-keccak-receipt-tree";
5868
6237
  var NO_EVM_ARCHIVE_PROOF_SCHEMA = "mono.no_evm_receipt_archive_binding.v1";
5869
6238
  var NO_EVM_ARCHIVE_SIGNATURE_SCHEME = "mono.snapshot.sig.v1";
5870
6239
  var NO_EVM_FINALITY_EVIDENCE_SCHEMA = "mono.no_evm_receipt_finality.v1";
5871
- var NO_EVM_FINALITY_EVIDENCE_SOURCE = "blsRoundCertificate";
6240
+ var NO_EVM_FINALITY_EVIDENCE_SOURCE = "roundCertificate";
5872
6241
  var EMPTY_ROOT_DOMAIN_BYTES = new TextEncoder().encode(NO_EVM_RECEIPTS_ROOT_DOMAIN);
5873
6242
  var LEAF_DOMAIN_BYTES = new TextEncoder().encode(NO_EVM_RECEIPT_LEAF_DOMAIN);
5874
6243
  var NODE_DOMAIN_BYTES = new TextEncoder().encode(NO_EVM_RECEIPT_NODE_DOMAIN);
@@ -6410,7 +6779,7 @@ function verifyBoundedReceiptProof(proof) {
6410
6779
  }
6411
6780
  const actualRoot = computeNoEvmReceiptsRoot(receipts);
6412
6781
  const expectedRoot = decodeHash(proof.receiptsRoot, "receiptsRoot");
6413
- if (!bytesEqual(expectedRoot, decodeHash(actualRoot, "computedReceiptsRoot"))) {
6782
+ if (!bytesEqual2(expectedRoot, decodeHash(actualRoot, "computedReceiptsRoot"))) {
6414
6783
  throw new NoEvmReceiptProofError(
6415
6784
  "receipts_root_mismatch",
6416
6785
  `receiptsRoot mismatch: expected ${proof.receiptsRoot}, computed ${actualRoot}`
@@ -6418,7 +6787,7 @@ function verifyBoundedReceiptProof(proof) {
6418
6787
  }
6419
6788
  const actualTargetHash = computeNoEvmTargetReceiptHash(targetReceipt);
6420
6789
  const expectedTargetHash = decodeHash(proof.targetReceiptHash, "targetReceiptHash");
6421
- if (!bytesEqual(expectedTargetHash, decodeHash(actualTargetHash, "computedTargetReceiptHash"))) {
6790
+ if (!bytesEqual2(expectedTargetHash, decodeHash(actualTargetHash, "computedTargetReceiptHash"))) {
6422
6791
  throw new NoEvmReceiptProofError(
6423
6792
  "target_receipt_hash_mismatch",
6424
6793
  `targetReceiptHash mismatch: expected ${proof.targetReceiptHash}, computed ${actualTargetHash}`
@@ -6475,7 +6844,7 @@ function verifyCompactReceiptProof(proof) {
6475
6844
  const targetReceipt = decodeHexBytes(targetReceiptBytes, "targetReceiptBytes");
6476
6845
  const actualTargetHash = computeNoEvmTargetReceiptHash(targetReceipt);
6477
6846
  const expectedTargetHash = decodeHash(proof.targetReceiptHash, "targetReceiptHash");
6478
- if (!bytesEqual(expectedTargetHash, decodeHash(actualTargetHash, "computedTargetReceiptHash"))) {
6847
+ if (!bytesEqual2(expectedTargetHash, decodeHash(actualTargetHash, "computedTargetReceiptHash"))) {
6479
6848
  throw new NoEvmReceiptProofError(
6480
6849
  "target_receipt_hash_mismatch",
6481
6850
  `targetReceiptHash mismatch: expected ${proof.targetReceiptHash}, computed ${actualTargetHash}`
@@ -6486,7 +6855,7 @@ function verifyCompactReceiptProof(proof) {
6486
6855
  compactProof.leafHash,
6487
6856
  "compactInclusionProof.leafHash"
6488
6857
  );
6489
- if (!bytesEqual(expectedLeafHashBytes, actualLeafHashBytes)) {
6858
+ if (!bytesEqual2(expectedLeafHashBytes, actualLeafHashBytes)) {
6490
6859
  throw new NoEvmReceiptProofError(
6491
6860
  "compact_leaf_hash_mismatch",
6492
6861
  `compactInclusionProof.leafHash mismatch: expected ${compactProof.leafHash}, computed ${bytesToHex6(
@@ -6496,7 +6865,7 @@ function verifyCompactReceiptProof(proof) {
6496
6865
  }
6497
6866
  const compactRootBytes = decodeHash(compactProof.root, "compactInclusionProof.root");
6498
6867
  const receiptsRootBytes = decodeHash(proof.receiptsRoot, "receiptsRoot");
6499
- if (!bytesEqual(receiptsRootBytes, compactRootBytes)) {
6868
+ if (!bytesEqual2(receiptsRootBytes, compactRootBytes)) {
6500
6869
  throw new NoEvmReceiptProofError(
6501
6870
  "compact_root_mismatch",
6502
6871
  `receiptsRoot must equal compactInclusionProof.root: receiptsRoot ${proof.receiptsRoot}, compact root ${compactProof.root}`
@@ -6519,7 +6888,7 @@ function verifyCompactReceiptProof(proof) {
6519
6888
  siblingHashes,
6520
6889
  pathSides
6521
6890
  );
6522
- if (!bytesEqual(actualRootBytes, compactRootBytes)) {
6891
+ if (!bytesEqual2(actualRootBytes, compactRootBytes)) {
6523
6892
  throw new NoEvmReceiptProofError(
6524
6893
  "compact_path_mismatch",
6525
6894
  `compact inclusion path mismatch: expected ${compactProof.root}, computed ${bytesToHex6(
@@ -6673,7 +7042,7 @@ function validateCoveringSnapshotObject(snapshot, archiveContentHash, proofBlock
6673
7042
  "archiveProof.coveringSnapshot.checkpointTo must match blockHeight"
6674
7043
  );
6675
7044
  }
6676
- if (!bytesEqual(checkpointContentHash, archiveContentHash)) {
7045
+ if (!bytesEqual2(checkpointContentHash, archiveContentHash)) {
6677
7046
  throw new NoEvmReceiptProofError(
6678
7047
  "invalid_proof_shape",
6679
7048
  "archiveProof.coveringSnapshot.checkpointContentHash must match archiveProof.contentHash"
@@ -6872,7 +7241,7 @@ function validateFinalityBlockReference(blockReference, round, proofBlockHash) {
6872
7241
  );
6873
7242
  if (proofBlockHash !== void 0) {
6874
7243
  const blockHash = decodeHash(proofBlockHash, "blockHash");
6875
- if (!bytesEqual(digest, blockHash)) {
7244
+ if (!bytesEqual2(digest, blockHash)) {
6876
7245
  throw new NoEvmReceiptProofError(
6877
7246
  "invalid_proof_shape",
6878
7247
  "finalityEvidence.blockReference.digest must match blockHash"
@@ -7222,7 +7591,7 @@ function assertHashBytes(value, field2) {
7222
7591
  function isRecord3(value) {
7223
7592
  return typeof value === "object" && value !== null && !Array.isArray(value);
7224
7593
  }
7225
- function bytesEqual(a, b) {
7594
+ function bytesEqual2(a, b) {
7226
7595
  if (a.length !== b.length) return false;
7227
7596
  let diff = 0;
7228
7597
  for (let index = 0; index < a.length; index++) {
@@ -7430,6 +7799,251 @@ function assertWholeNumber(field2, value) {
7430
7799
  throw new Error(`${field2} must be a whole number`);
7431
7800
  }
7432
7801
  }
7802
+ var PQM1_ALGO_TAG_MLDSA65 = 1;
7803
+ var PQM1_VERSION_V1 = 1;
7804
+ var PQM1_PAYLOAD_LEN = 32;
7805
+ var PQM1_V1_MNEMONIC_WORDS = 24;
7806
+ var PQM1_V1_MLDSA65_DOMAIN_TAG = "monolythium.pqm1.v1.mldsa65";
7807
+ var Pqm1Error = class extends Error {
7808
+ constructor(kind, message) {
7809
+ super(message);
7810
+ this.kind = kind;
7811
+ this.name = "Pqm1Error";
7812
+ }
7813
+ kind;
7814
+ };
7815
+ var DOMAIN_BYTES = new TextEncoder().encode(PQM1_V1_MLDSA65_DOMAIN_TAG);
7816
+ function normalizeMnemonic(mnemonic) {
7817
+ return mnemonic.trim().toLowerCase().replace(/\s+/g, " ");
7818
+ }
7819
+ function ensureSupportedPayload(bytes) {
7820
+ if (bytes.length !== PQM1_PAYLOAD_LEN) {
7821
+ throw new Pqm1Error("badPayloadLength", `PQM-1 payload must be ${PQM1_PAYLOAD_LEN} bytes, got ${bytes.length}`);
7822
+ }
7823
+ if (bytes[0] !== PQM1_ALGO_TAG_MLDSA65) {
7824
+ throw new Pqm1Error("unsupportedAlgorithm", `unsupported PQM-1 algorithm tag 0x${bytes[0].toString(16).padStart(2, "0")}`);
7825
+ }
7826
+ if (bytes[1] !== PQM1_VERSION_V1) {
7827
+ throw new Pqm1Error("unsupportedVersion", `unsupported PQM-1 version 0x${bytes[1].toString(16).padStart(2, "0")}`);
7828
+ }
7829
+ }
7830
+ function parsePqm1Payload(payload) {
7831
+ const bytes = expectBytes(payload, PQM1_PAYLOAD_LEN, "PQM-1 payload").slice();
7832
+ ensureSupportedPayload(bytes);
7833
+ return {
7834
+ algoTag: PQM1_ALGO_TAG_MLDSA65,
7835
+ version: PQM1_VERSION_V1,
7836
+ entropy: bytes.slice(2),
7837
+ bytes
7838
+ };
7839
+ }
7840
+ function pqm1MnemonicToPayload(mnemonic) {
7841
+ const normalized = normalizeMnemonic(mnemonic);
7842
+ const words = normalized.length === 0 ? [] : normalized.split(" ");
7843
+ if (words.length !== PQM1_V1_MNEMONIC_WORDS) {
7844
+ throw new Pqm1Error("badWordCount", `PQM-1 mnemonic must be ${PQM1_V1_MNEMONIC_WORDS} words, got ${words.length}`);
7845
+ }
7846
+ let payload;
7847
+ try {
7848
+ payload = mnemonicToEntropy(normalized, wordlist);
7849
+ } catch (e) {
7850
+ throw new Pqm1Error("bip39Decode", `invalid PQM-1 mnemonic: ${e.message}`);
7851
+ }
7852
+ return parsePqm1Payload(payload);
7853
+ }
7854
+ function derivePqm1MlDsa65SeedFromPayload(payload) {
7855
+ const parsed = parsePqm1Payload(payload);
7856
+ return shake256(concatBytes2(DOMAIN_BYTES, parsed.bytes), { dkLen: ML_DSA_65_SEED_LEN });
7857
+ }
7858
+ function pqm1MnemonicToMlDsa65Seed(mnemonic) {
7859
+ return derivePqm1MlDsa65SeedFromPayload(pqm1MnemonicToPayload(mnemonic).bytes);
7860
+ }
7861
+ function pqm1MnemonicToMlDsa65Backend(mnemonic) {
7862
+ return MlDsa65Backend.fromSeed(pqm1MnemonicToMlDsa65Seed(mnemonic));
7863
+ }
7864
+
7865
+ // src/cluster-join.ts
7866
+ var DEFAULT_CLUSTER_JOIN_EXECUTION_UNIT_LIMIT = REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT;
7867
+ var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
7868
+ var MAX_UINT32 = (1n << 32n) - 1n;
7869
+ function deriveClusterJoinOperatorId(operatorPubkey) {
7870
+ return bytesToHex2(blake3(normalizeConsensusPubkey(operatorPubkey, "operatorPubkey")));
7871
+ }
7872
+ function clusterJoinRequestExists(view) {
7873
+ return view.status !== "none" || view.owner.toLowerCase() !== ZERO_ADDRESS || view.bondLythoshi !== 0n;
7874
+ }
7875
+ async function readClusterJoinRequest(client, args) {
7876
+ const data = encodeGetClusterJoinRequestCalldata({
7877
+ clusterId: args.clusterId,
7878
+ operatorId: normalizeOperatorId(args.operatorId)
7879
+ });
7880
+ const output = await client.call("eth_call", [
7881
+ {
7882
+ to: nodeRegistryAddressHex(),
7883
+ data
7884
+ },
7885
+ "latest"
7886
+ ]);
7887
+ return decodeClusterJoinRequest(output);
7888
+ }
7889
+ async function preflightClusterJoinRequest(client, args) {
7890
+ try {
7891
+ return await readClusterJoinRequest(client, args);
7892
+ } catch (cause) {
7893
+ throw new Error(
7894
+ `CJ-1 getClusterJoinRequest is not exposed or failed on the connected chain: ${errorMessage(cause)}`
7895
+ );
7896
+ }
7897
+ }
7898
+ function resolveClusterJoinExecutionFee(quote, options = {}) {
7899
+ const quoted = parseBigint(quote.executionUnitPriceLythoshi, "executionUnitPriceLythoshi");
7900
+ const floor = options.minPriceLythoshi === void 0 ? MIN_EXECUTION_UNIT_PRICE_LYTHOSHI : parseBigint(options.minPriceLythoshi, "minPriceLythoshi");
7901
+ const multiplier = options.safetyMultiplier === void 0 ? EXECUTION_UNIT_PRICE_SAFETY_MULTIPLIER : parseBigint(options.safetyMultiplier, "safetyMultiplier");
7902
+ if (multiplier <= 0n) throw new Error("safetyMultiplier must be greater than zero");
7903
+ const base = quoted > floor ? quoted : floor;
7904
+ const maxFeePerGas = base * multiplier;
7905
+ const tip = options.priorityTipLythoshi === void 0 ? maxFeePerGas : clampPriorityTip(options.priorityTipLythoshi, maxFeePerGas);
7906
+ return {
7907
+ maxFeePerGas,
7908
+ maxPriorityFeePerGas: tip,
7909
+ gasLimit: options.executionUnitLimit ?? DEFAULT_CLUSTER_JOIN_EXECUTION_UNIT_LIMIT
7910
+ };
7911
+ }
7912
+ function buildRequestClusterJoinTxFields(args) {
7913
+ return {
7914
+ chainId: args.chainId,
7915
+ nonce: args.nonce,
7916
+ maxFeePerGas: parseBigint(args.fee.maxFeePerGas, "maxFeePerGas"),
7917
+ maxPriorityFeePerGas: parseBigint(args.fee.maxPriorityFeePerGas, "maxPriorityFeePerGas"),
7918
+ gasLimit: parseBigint(
7919
+ args.fee.gasLimit ?? DEFAULT_CLUSTER_JOIN_EXECUTION_UNIT_LIMIT,
7920
+ "gasLimit"
7921
+ ),
7922
+ to: nodeRegistryAddressHex(),
7923
+ value: parseU256(args.bondLythoshi, "bondLythoshi"),
7924
+ input: encodeRequestClusterJoinCalldata({
7925
+ clusterId: args.clusterId,
7926
+ operatorPubkey: normalizeConsensusPubkey(args.operatorPubkey, "operatorPubkey")
7927
+ })
7928
+ };
7929
+ }
7930
+ function buildVoteClusterAdmitTxFields(args) {
7931
+ return {
7932
+ chainId: args.chainId,
7933
+ nonce: args.nonce,
7934
+ maxFeePerGas: parseBigint(args.fee.maxFeePerGas, "maxFeePerGas"),
7935
+ maxPriorityFeePerGas: parseBigint(args.fee.maxPriorityFeePerGas, "maxPriorityFeePerGas"),
7936
+ gasLimit: parseBigint(
7937
+ args.fee.gasLimit ?? DEFAULT_CLUSTER_JOIN_EXECUTION_UNIT_LIMIT,
7938
+ "gasLimit"
7939
+ ),
7940
+ to: nodeRegistryAddressHex(),
7941
+ value: 0n,
7942
+ input: encodeVoteClusterAdmitCalldata({
7943
+ clusterId: args.clusterId,
7944
+ operatorId: normalizeOperatorId(args.operatorId),
7945
+ voterPubkey: normalizeConsensusPubkey(args.voterPubkey, "voterPubkey")
7946
+ })
7947
+ };
7948
+ }
7949
+ async function submitRequestClusterJoin(args) {
7950
+ const clusterId = parseUint32(args.clusterId, "clusterId");
7951
+ const operatorPubkey = normalizeConsensusPubkey(args.operatorPubkey, "operatorPubkey");
7952
+ const operatorIdHex = deriveClusterJoinOperatorId(operatorPubkey);
7953
+ const existing = await preflightClusterJoinRequest(args.client, {
7954
+ clusterId,
7955
+ operatorId: operatorIdHex
7956
+ });
7957
+ if (existing.status === "open") {
7958
+ throw new Error("cluster join request is already open for this operator");
7959
+ }
7960
+ if (existing.status === "admitted") {
7961
+ throw new Error("operator is already admitted for this cluster request");
7962
+ }
7963
+ const backend = pqm1MnemonicToMlDsa65Backend(args.mnemonic);
7964
+ const senderAddress = addressToTypedBech32("user", backend.addressBytes());
7965
+ const [chainId, nonce, quote] = await Promise.all([
7966
+ args.client.ethChainId(),
7967
+ args.client.lythGetTransactionCount(senderAddress),
7968
+ args.client.lythExecutionUnitPrice()
7969
+ ]);
7970
+ const tx = buildRequestClusterJoinTxFields({
7971
+ chainId,
7972
+ nonce,
7973
+ fee: resolveClusterJoinExecutionFee(quote, args),
7974
+ clusterId,
7975
+ operatorPubkey,
7976
+ bondLythoshi: args.bondLythoshi
7977
+ });
7978
+ return submitClusterJoinTx(args.client, backend, tx, clusterId, operatorIdHex);
7979
+ }
7980
+ async function submitVoteClusterAdmit(args) {
7981
+ const clusterId = parseUint32(args.clusterId, "clusterId");
7982
+ const operatorIdHex = normalizeOperatorId(args.operatorId);
7983
+ const existing = await preflightClusterJoinRequest(args.client, {
7984
+ clusterId,
7985
+ operatorId: operatorIdHex
7986
+ });
7987
+ if (!clusterJoinRequestExists(existing) || existing.status !== "open") {
7988
+ throw new Error("candidate cluster join request is not open for voting");
7989
+ }
7990
+ const backend = pqm1MnemonicToMlDsa65Backend(args.mnemonic);
7991
+ const senderAddress = addressToTypedBech32("user", backend.addressBytes());
7992
+ const [chainId, nonce, quote] = await Promise.all([
7993
+ args.client.ethChainId(),
7994
+ args.client.lythGetTransactionCount(senderAddress),
7995
+ args.client.lythExecutionUnitPrice()
7996
+ ]);
7997
+ const tx = buildVoteClusterAdmitTxFields({
7998
+ chainId,
7999
+ nonce,
8000
+ fee: resolveClusterJoinExecutionFee(quote, args),
8001
+ clusterId,
8002
+ operatorId: operatorIdHex,
8003
+ voterPubkey: args.voterPubkey
8004
+ });
8005
+ return submitClusterJoinTx(args.client, backend, tx, clusterId, operatorIdHex);
8006
+ }
8007
+ async function submitClusterJoinTx(client, backend, tx, clusterId, operatorIdHex) {
8008
+ const plaintext = buildPlaintextSubmission({ backend, tx });
8009
+ const txHash = await submitPlaintextTransaction(
8010
+ client,
8011
+ plaintext.signedTxWireHex,
8012
+ plaintext.innerTxHashHex
8013
+ );
8014
+ return {
8015
+ txHash,
8016
+ clusterId: clusterId.toString(10),
8017
+ operatorIdHex,
8018
+ innerSighashHex: plaintext.innerSighashHex,
8019
+ signedTxWireBytes: plaintext.innerWireBytes
8020
+ };
8021
+ }
8022
+ function normalizeConsensusPubkey(value, label) {
8023
+ const bytes = typeof value === "string" ? hexToBytes2(value, label) : value;
8024
+ return expectBytes(bytes, NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES, label).slice();
8025
+ }
8026
+ function normalizeOperatorId(value) {
8027
+ const bytes = typeof value === "string" ? hexToBytes2(value, "operatorId") : value;
8028
+ return bytesToHex2(expectBytes(bytes, 32, "operatorId"));
8029
+ }
8030
+ function parseUint32(value, label) {
8031
+ const parsed = parseBigint(value, label);
8032
+ if (parsed < 0n || parsed > MAX_UINT32) {
8033
+ throw new Error(`${label} out of 32-bit range`);
8034
+ }
8035
+ return parsed;
8036
+ }
8037
+ function parseU256(value, label) {
8038
+ const parsed = parseBigint(value, label);
8039
+ if (parsed < 0n || parsed >= 1n << 256n) {
8040
+ throw new Error(`${label} out of 256-bit range`);
8041
+ }
8042
+ return parsed;
8043
+ }
8044
+ function errorMessage(cause) {
8045
+ return cause instanceof Error ? cause.message : String(cause);
8046
+ }
7433
8047
  var ORACLE_EVENT_SIGS = {
7434
8048
  oracleRoundFinalized: "OracleRoundFinalized(bytes32,uint64,uint256,uint64,uint32)",
7435
8049
  observationSubmitted: "ObservationSubmitted(bytes32,uint64,address,uint256,uint64)",
@@ -9733,8 +10347,8 @@ var MONOLYTHIUM_NETWORKS = {
9733
10347
  };
9734
10348
 
9735
10349
  // src/index.ts
9736
- var version = "0.3.16";
10350
+ var version = "0.4.1";
9737
10351
 
9738
- 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, 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_DKG_RESHARE_MAX_SIGNERS, NODE_REGISTRY_DKG_RESHARE_MIN_SIGNERS, NODE_REGISTRY_DKG_THRESHOLD_SIG_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, categoryRoot, checkMrvFeeDisplayConformance, checkMrvStructuredFeeConformance, checkNativeDevkitCompatibility, clampPriorityTip, clobAddressHex, clusterApyPercent, compareNativeDevVersions, composeClaimBoundMessage, computeNoEvmDacFinalityMessage, computeNoEvmLeaderFinalityMessage, computeNoEvmReceiptsRoot, computeNoEvmRoundFinalityMessage, computeNoEvmTargetReceiptHash, computeQuoteLiquidity, consumeNativeEvents, decodeClusterDiversity, decodeClusterFormedEvent, decodeHasPubkeyReturn, decodeLookupPubkeyReturn, decodeNativeAgentStateResponse, decodeNativeMarketOrderBookDeltasResponse, decodeNativeReceiptResponse, decodeNoEvmReceiptTranscript, decodeOperatorFeeChargedEvent, decodeOperatorNetworkMetadata, decodeOracleEvent, decodeTimeWindow, decodeTxFeedResponse, delegationAddressHex, denyRootFor, deriveClobMarketId, deriveClusterAnchorAddress, deriveFeedId, deriveMrvContractAddress, deriveNativeSpotMarketId, deriveNativeSpotOrderId, destinationRoot, encodeAttestDkgReshareCalldata, encodeBlockSelector, encodeBridgeChallengeCalldata, encodeBridgeClaimCalldata, encodeCancelOrderCalldata, encodeCancelPendingChangeCalldata, encodeClaimCalldata, encodeClaimPolicyByAddressCalldata, encodeCompleteRedemptionCalldata, encodeCreateRequestCalldata, encodeCreateRequestCanonical, encodeDelegateCalldata, encodeDisableCalldata, encodeEnableCalldata, 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, encodeSetAutoCompoundCalldata, encodeSetBridgeResumeCooldownCalldata, encodeSetBridgeRouteFinalityCalldata, encodeSetLotSizeCalldata, encodeSetMinNotionalCalldata, encodeSetPolicyCalldata, encodeSetPolicyClaimCalldata, encodeSetTickSizeCalldata, encodeSubmitBridgeProofCalldata, encodeSubmitPendingChangeCalldata, encodeUndelegateCalldata, exportBridgeRouteCatalogueJson, fetchChainInfoLatest, fetchChainRegistryLatest, 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, proverMarketStateFromByte, pubkeyRegistryAddressHex, quoteOperatorFee, rankBridgeRoutes, rankMarketsByVolume, requestSighash, requireTypedAddress, resolveExecutionFee, resolveMaxExecutionUnitPrice, resolveRegistryExecutionFee, resolveStudioHostStatus, selectBridgeTransferRoute, serviceProbeStatusLabel, setDestinationRoot, spendingPolicyAddressHex, submitMrvCallNativeTx, submitMrvDeployNativeTx, submitMrvDeployPayloadNativeTx, submitSighash, transactionFeeExposure, typedBech32ToAddress, validateAddress, validateBridgeRouteCatalogue, validateMrvArtifactMetadata, validateMrvCallRequest, validateMrvDeployRequest, verifyNoEvmArchiveProofSignatures, verifyNoEvmBlockFinalityEvidenceMultisig, verifyNoEvmBlockFinalityEvidenceThreshold, verifyNoEvmFinalityEvidenceMultisig, verifyNoEvmFinalityEvidenceThreshold, verifyNoEvmReceiptProof, verifyNoEvmReceiptProofTrust, version };
10352
+ 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_CONSENSUS_POP_BYTES, NODE_REGISTRY_CONSENSUS_PUBKEY_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_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, 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, 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, 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 };
9739
10353
  //# sourceMappingURL=index.js.map
9740
10354
  //# sourceMappingURL=index.js.map