@monolythium/core-sdk 0.3.13 → 0.3.14
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 +24 -0
- package/dist/crypto/index.d.cts +2 -2
- package/dist/crypto/index.d.ts +2 -2
- package/dist/index.cjs +947 -160
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +906 -161
- package/dist/index.js.map +1 -1
- package/dist/{submission-CA8L21An.d.cts → submission-vhPqAwkD.d.cts} +488 -1
- package/dist/{submission-CA8L21An.d.ts → submission-vhPqAwkD.d.ts} +488 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -422,6 +422,14 @@ var SERVICE_PROBE_STATUS = {
|
|
|
422
422
|
UNREACHABLE: 3
|
|
423
423
|
};
|
|
424
424
|
var NODE_REGISTRY_SELECTORS = {
|
|
425
|
+
/** `recoverOperatorNode(bytes32)` — foundation-gated DR alias for `unjail`. */
|
|
426
|
+
recoverOperatorNode: "0x" + selectorHex("recoverOperatorNode(bytes32)"),
|
|
427
|
+
/** `submitPendingChange(uint8,bytes,uint64,uint64)` — foundation-gated roster lifecycle. */
|
|
428
|
+
submitPendingChange: "0x" + selectorHex("submitPendingChange(uint8,bytes,uint64,uint64)"),
|
|
429
|
+
/** `cancelPendingChange(uint64,bytes)` — foundation-gated pending-change cancellation. */
|
|
430
|
+
cancelPendingChange: "0x" + selectorHex("cancelPendingChange(uint64,bytes)"),
|
|
431
|
+
/** `attestDkgReshare(uint64,bytes,bytes)` — operator-signed DKG re-share attestation. */
|
|
432
|
+
attestDkgReshare: "0x" + selectorHex("attestDkgReshare(uint64,bytes,bytes)"),
|
|
425
433
|
reportServiceProbe: "0xeee31bba",
|
|
426
434
|
getServiceProbe: "0x1fcbfbce",
|
|
427
435
|
/** `setNetworkMetadata(bytes32,uint16,bytes3,bytes)` — owner-callable (PF-6). */
|
|
@@ -431,6 +439,21 @@ var NODE_REGISTRY_SELECTORS = {
|
|
|
431
439
|
/** `getClusterDiversity(uint32)` view (PF-6). */
|
|
432
440
|
getClusterDiversity: "0x" + selectorHex("getClusterDiversity(uint32)")
|
|
433
441
|
};
|
|
442
|
+
var NODE_REGISTRY_BLS_PUBKEY_BYTES = 48;
|
|
443
|
+
var NODE_REGISTRY_DKG_THRESHOLD_SIG_BYTES = 96;
|
|
444
|
+
var NODE_REGISTRY_DKG_RESHARE_MIN_SIGNERS = 5;
|
|
445
|
+
var NODE_REGISTRY_DKG_RESHARE_MAX_SIGNERS = 7;
|
|
446
|
+
var NODE_REGISTRY_PENDING_CHANGE_MAX_INTENT_ID = (1n << 56n) - 1n;
|
|
447
|
+
var PENDING_CHANGE_KIND_CODES = {
|
|
448
|
+
add: 1,
|
|
449
|
+
remove: 2,
|
|
450
|
+
rotate: 3
|
|
451
|
+
};
|
|
452
|
+
var PENDING_CHANGE_KIND_LABELS = {
|
|
453
|
+
1: "add",
|
|
454
|
+
2: "remove",
|
|
455
|
+
3: "rotate"
|
|
456
|
+
};
|
|
434
457
|
var CLUSTER_FORMED_EVENT_SIG = "ClusterFormed(uint32,uint64,address,bytes)";
|
|
435
458
|
var NodeRegistryError = class extends Error {
|
|
436
459
|
constructor(message) {
|
|
@@ -465,6 +488,131 @@ function serviceProbeStatusLabel(status) {
|
|
|
465
488
|
return "unknown";
|
|
466
489
|
}
|
|
467
490
|
}
|
|
491
|
+
function normalizePendingChangeKind(kind) {
|
|
492
|
+
if (typeof kind === "number") {
|
|
493
|
+
const label = PENDING_CHANGE_KIND_LABELS[kind];
|
|
494
|
+
if (!label) throw new NodeRegistryError(`unknown pending-change kind ${kind}`);
|
|
495
|
+
return { kind: label, kindCode: kind };
|
|
496
|
+
}
|
|
497
|
+
const kindCode = PENDING_CHANGE_KIND_CODES[kind];
|
|
498
|
+
if (!kindCode) throw new NodeRegistryError(`unknown pending-change kind ${kind}`);
|
|
499
|
+
return { kind, kindCode };
|
|
500
|
+
}
|
|
501
|
+
function encodeRecoverOperatorNodeCalldata(peerId) {
|
|
502
|
+
return bytesToHex(
|
|
503
|
+
concatBytes(
|
|
504
|
+
hexToBytes(NODE_REGISTRY_SELECTORS.recoverOperatorNode),
|
|
505
|
+
expectLength2(toBytes(peerId), 32, "peerId")
|
|
506
|
+
)
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
function encodeSubmitPendingChangeCalldata(args) {
|
|
510
|
+
const { kind, kindCode } = normalizePendingChangeKind(args.kind);
|
|
511
|
+
const targetPubkey = expectLength2(
|
|
512
|
+
toBytes(args.targetPubkey),
|
|
513
|
+
NODE_REGISTRY_BLS_PUBKEY_BYTES,
|
|
514
|
+
"targetPubkey"
|
|
515
|
+
);
|
|
516
|
+
const effectiveEpoch = toUint64(args.effectiveEpoch, "effectiveEpoch");
|
|
517
|
+
if (effectiveEpoch === 0n) {
|
|
518
|
+
throw new NodeRegistryError("effectiveEpoch must be greater than zero");
|
|
519
|
+
}
|
|
520
|
+
const intentId = toUint64(args.intentId ?? 0n, "intentId");
|
|
521
|
+
if (intentId > NODE_REGISTRY_PENDING_CHANGE_MAX_INTENT_ID) {
|
|
522
|
+
throw new NodeRegistryError("intentId must be <= 2^56-1");
|
|
523
|
+
}
|
|
524
|
+
if (kind !== "rotate" && intentId !== 0n) {
|
|
525
|
+
throw new NodeRegistryError("only rotate pending changes may carry a non-zero intentId");
|
|
526
|
+
}
|
|
527
|
+
const targetTail = new Uint8Array(32);
|
|
528
|
+
targetTail.set(targetPubkey.slice(32, 48), 0);
|
|
529
|
+
return bytesToHex(
|
|
530
|
+
concatBytes(
|
|
531
|
+
hexToBytes(NODE_REGISTRY_SELECTORS.submitPendingChange),
|
|
532
|
+
uint8Word(kindCode),
|
|
533
|
+
uint64Word(4n * 32n, "targetPubkeyOffset"),
|
|
534
|
+
uint64Word(effectiveEpoch, "effectiveEpoch"),
|
|
535
|
+
uint64Word(intentId, "intentId"),
|
|
536
|
+
uint64Word(BigInt(NODE_REGISTRY_BLS_PUBKEY_BYTES), "targetPubkeyLength"),
|
|
537
|
+
targetPubkey.slice(0, 32),
|
|
538
|
+
targetTail
|
|
539
|
+
)
|
|
540
|
+
);
|
|
541
|
+
}
|
|
542
|
+
function encodeCancelPendingChangeCalldata(args) {
|
|
543
|
+
const targetPubkey = expectLength2(
|
|
544
|
+
toBytes(args.targetPubkey),
|
|
545
|
+
NODE_REGISTRY_BLS_PUBKEY_BYTES,
|
|
546
|
+
"targetPubkey"
|
|
547
|
+
);
|
|
548
|
+
const targetTail = new Uint8Array(32);
|
|
549
|
+
targetTail.set(targetPubkey.slice(32, 48), 0);
|
|
550
|
+
return bytesToHex(
|
|
551
|
+
concatBytes(
|
|
552
|
+
hexToBytes(NODE_REGISTRY_SELECTORS.cancelPendingChange),
|
|
553
|
+
uint64Word(args.epoch, "epoch"),
|
|
554
|
+
uint64Word(2n * 32n, "targetPubkeyOffset"),
|
|
555
|
+
uint64Word(BigInt(NODE_REGISTRY_BLS_PUBKEY_BYTES), "targetPubkeyLength"),
|
|
556
|
+
targetPubkey.slice(0, 32),
|
|
557
|
+
targetTail
|
|
558
|
+
)
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
function parseDkgResharePublicKeys(blsPublicKeys) {
|
|
562
|
+
const keys = toBytes(blsPublicKeys);
|
|
563
|
+
if (keys.length % NODE_REGISTRY_BLS_PUBKEY_BYTES !== 0) {
|
|
564
|
+
throw new NodeRegistryError("blsPublicKeys length must be a multiple of 48 bytes");
|
|
565
|
+
}
|
|
566
|
+
const signerCount = keys.length / NODE_REGISTRY_BLS_PUBKEY_BYTES;
|
|
567
|
+
if (signerCount < NODE_REGISTRY_DKG_RESHARE_MIN_SIGNERS || signerCount > NODE_REGISTRY_DKG_RESHARE_MAX_SIGNERS) {
|
|
568
|
+
throw new NodeRegistryError(
|
|
569
|
+
`blsPublicKeys must contain ${NODE_REGISTRY_DKG_RESHARE_MIN_SIGNERS}..${NODE_REGISTRY_DKG_RESHARE_MAX_SIGNERS} signers`
|
|
570
|
+
);
|
|
571
|
+
}
|
|
572
|
+
const out = [];
|
|
573
|
+
const seen = /* @__PURE__ */ new Set();
|
|
574
|
+
for (let offset = 0; offset < keys.length; offset += NODE_REGISTRY_BLS_PUBKEY_BYTES) {
|
|
575
|
+
const key = keys.slice(offset, offset + NODE_REGISTRY_BLS_PUBKEY_BYTES);
|
|
576
|
+
const keyHex = bytesToHex(key);
|
|
577
|
+
if (seen.has(keyHex)) {
|
|
578
|
+
throw new NodeRegistryError("blsPublicKeys contains a duplicate signer pubkey");
|
|
579
|
+
}
|
|
580
|
+
seen.add(keyHex);
|
|
581
|
+
out.push(key);
|
|
582
|
+
}
|
|
583
|
+
return out;
|
|
584
|
+
}
|
|
585
|
+
function encodeAttestDkgReshareCalldata(args) {
|
|
586
|
+
const intentId = toUint64(args.intentId, "intentId");
|
|
587
|
+
if (intentId === 0n) {
|
|
588
|
+
throw new NodeRegistryError("intentId must be greater than zero");
|
|
589
|
+
}
|
|
590
|
+
if (intentId > NODE_REGISTRY_PENDING_CHANGE_MAX_INTENT_ID) {
|
|
591
|
+
throw new NodeRegistryError("intentId must be <= 2^56-1");
|
|
592
|
+
}
|
|
593
|
+
const publicKeys = concatBytes(...parseDkgResharePublicKeys(args.blsPublicKeys));
|
|
594
|
+
const thresholdSig = expectLength2(
|
|
595
|
+
toBytes(args.thresholdSig),
|
|
596
|
+
NODE_REGISTRY_DKG_THRESHOLD_SIG_BYTES,
|
|
597
|
+
"thresholdSig"
|
|
598
|
+
);
|
|
599
|
+
const keysPadded = padToWord(publicKeys);
|
|
600
|
+
const sigPadded = padToWord(thresholdSig);
|
|
601
|
+
const offsetKeys = 3n * 32n;
|
|
602
|
+
const offsetSig = offsetKeys + 32n + BigInt(keysPadded.length);
|
|
603
|
+
return bytesToHex(
|
|
604
|
+
concatBytes(
|
|
605
|
+
hexToBytes(NODE_REGISTRY_SELECTORS.attestDkgReshare),
|
|
606
|
+
uint64Word(intentId, "intentId"),
|
|
607
|
+
uint64Word(offsetKeys, "blsPublicKeysOffset"),
|
|
608
|
+
uint64Word(offsetSig, "thresholdSigOffset"),
|
|
609
|
+
uint64Word(BigInt(publicKeys.length), "blsPublicKeysLength"),
|
|
610
|
+
keysPadded,
|
|
611
|
+
uint64Word(BigInt(thresholdSig.length), "thresholdSigLength"),
|
|
612
|
+
sigPadded
|
|
613
|
+
)
|
|
614
|
+
);
|
|
615
|
+
}
|
|
468
616
|
function encodeReportServiceProbeCalldata(args) {
|
|
469
617
|
if (!isValidPublicServiceProbeMask(args.serviceMask)) {
|
|
470
618
|
throw new NodeRegistryError(
|
|
@@ -624,6 +772,44 @@ function uint8Word(value) {
|
|
|
624
772
|
out[31] = value;
|
|
625
773
|
return out;
|
|
626
774
|
}
|
|
775
|
+
function uint64Word(value, name) {
|
|
776
|
+
const n = toUint64(value, name);
|
|
777
|
+
const out = new Uint8Array(32);
|
|
778
|
+
let rest = n;
|
|
779
|
+
for (let i = 31; i >= 24; i--) {
|
|
780
|
+
out[i] = Number(rest & 0xffn);
|
|
781
|
+
rest >>= 8n;
|
|
782
|
+
}
|
|
783
|
+
return out;
|
|
784
|
+
}
|
|
785
|
+
function toUint64(value, name) {
|
|
786
|
+
let parsed;
|
|
787
|
+
if (typeof value === "bigint") {
|
|
788
|
+
parsed = value;
|
|
789
|
+
} else if (typeof value === "number") {
|
|
790
|
+
if (!Number.isSafeInteger(value)) {
|
|
791
|
+
throw new NodeRegistryError(`${name} must be a safe integer`);
|
|
792
|
+
}
|
|
793
|
+
parsed = BigInt(value);
|
|
794
|
+
} else {
|
|
795
|
+
const trimmed = value.trim();
|
|
796
|
+
if (!/^\d+$/u.test(trimmed)) {
|
|
797
|
+
throw new NodeRegistryError(`${name} must be a decimal uint64`);
|
|
798
|
+
}
|
|
799
|
+
parsed = BigInt(trimmed);
|
|
800
|
+
}
|
|
801
|
+
if (parsed < 0n || parsed > 0xffffffffffffffffn) {
|
|
802
|
+
throw new NodeRegistryError(`${name} must fit uint64`);
|
|
803
|
+
}
|
|
804
|
+
return parsed;
|
|
805
|
+
}
|
|
806
|
+
function padToWord(bytes) {
|
|
807
|
+
const paddedLength = Math.ceil(bytes.length / 32) * 32;
|
|
808
|
+
if (paddedLength === bytes.length) return bytes;
|
|
809
|
+
const out = new Uint8Array(paddedLength);
|
|
810
|
+
out.set(bytes);
|
|
811
|
+
return out;
|
|
812
|
+
}
|
|
627
813
|
function toBytes(value) {
|
|
628
814
|
if (typeof value === "string") {
|
|
629
815
|
return hexToBytes(value);
|
|
@@ -2430,6 +2616,192 @@ function encodeBlockSelector(b) {
|
|
|
2430
2616
|
if (typeof b === "bigint") return `0x${b.toString(16)}`;
|
|
2431
2617
|
return b;
|
|
2432
2618
|
}
|
|
2619
|
+
var NameRegistryError = class extends Error {
|
|
2620
|
+
constructor(message) {
|
|
2621
|
+
super(message);
|
|
2622
|
+
this.name = "NameRegistryError";
|
|
2623
|
+
}
|
|
2624
|
+
};
|
|
2625
|
+
var NAME_REGISTRY_SELECTORS = {
|
|
2626
|
+
register: selectorHex2("register(string,address)"),
|
|
2627
|
+
proposeTransfer: selectorHex2("proposeTransfer(string,address)"),
|
|
2628
|
+
acceptTransfer: selectorHex2("acceptTransfer(string)")
|
|
2629
|
+
};
|
|
2630
|
+
var NAME_BASE_MULTIPLIER = {
|
|
2631
|
+
human: 5,
|
|
2632
|
+
agent: 2,
|
|
2633
|
+
cluster: 20,
|
|
2634
|
+
contract: 10
|
|
2635
|
+
};
|
|
2636
|
+
var NAME_FALLBACK_FEE_UNIT_LYTHOSHI = 100n;
|
|
2637
|
+
var NAME_MAX_LEN = 80;
|
|
2638
|
+
var NAME_LABEL_MIN_LEN = 1;
|
|
2639
|
+
var NAME_LABEL_MAX_LEN = 63;
|
|
2640
|
+
function nameRegistryAddressHex() {
|
|
2641
|
+
return PRECOMPILE_ADDRESSES.NAME_REGISTRY.toLowerCase();
|
|
2642
|
+
}
|
|
2643
|
+
function nameLengthModifierX10(labelLen) {
|
|
2644
|
+
if (labelLen === 1) return 1e3;
|
|
2645
|
+
if (labelLen === 2) return 500;
|
|
2646
|
+
if (labelLen === 3) return 100;
|
|
2647
|
+
if (labelLen === 4) return 50;
|
|
2648
|
+
if (labelLen === 5) return 30;
|
|
2649
|
+
if (labelLen >= 6 && labelLen <= 12) return 10;
|
|
2650
|
+
if (labelLen >= 13 && labelLen <= 20) return 15;
|
|
2651
|
+
if (labelLen >= 21 && labelLen <= 32) return 30;
|
|
2652
|
+
if (labelLen >= 33 && labelLen <= 50) return 100;
|
|
2653
|
+
if (labelLen >= 51 && labelLen <= 63) return 500;
|
|
2654
|
+
return null;
|
|
2655
|
+
}
|
|
2656
|
+
function parseNameCategory(name) {
|
|
2657
|
+
if (name.length === 0) throw new NameRegistryError("name is empty");
|
|
2658
|
+
if (name.length > NAME_MAX_LEN) throw new NameRegistryError(`name exceeds ${NAME_MAX_LEN} chars`);
|
|
2659
|
+
const parts = name.split(".");
|
|
2660
|
+
if (parts.some((p) => p.length === 0)) {
|
|
2661
|
+
throw new NameRegistryError("name has an empty label");
|
|
2662
|
+
}
|
|
2663
|
+
for (const label of parts) validateLabel(label);
|
|
2664
|
+
if (parts[parts.length - 1] !== "mono") {
|
|
2665
|
+
throw new NameRegistryError("name must end with .mono");
|
|
2666
|
+
}
|
|
2667
|
+
const primaryLabelLen = parts[0].length;
|
|
2668
|
+
switch (parts.length) {
|
|
2669
|
+
case 2:
|
|
2670
|
+
if (STRUCTURAL_RESERVES.has(parts[0])) {
|
|
2671
|
+
throw new NameRegistryError(`"${parts[0]}.mono" is a structural reserve`);
|
|
2672
|
+
}
|
|
2673
|
+
return { category: "human", primaryLabelLen };
|
|
2674
|
+
case 3: {
|
|
2675
|
+
const anchor = parts[1];
|
|
2676
|
+
if (anchor === "cluster") return { category: "cluster", primaryLabelLen };
|
|
2677
|
+
if (anchor === "contract") return { category: "contract", primaryLabelLen };
|
|
2678
|
+
if (anchor === "system") return { category: "system", primaryLabelLen };
|
|
2679
|
+
throw new NameRegistryError(`unknown name category anchor ".${anchor}.mono"`);
|
|
2680
|
+
}
|
|
2681
|
+
case 4:
|
|
2682
|
+
if (parts[1] !== "agent") {
|
|
2683
|
+
throw new NameRegistryError("unknown 4-label name form (expected <x>.agent.<human>.mono)");
|
|
2684
|
+
}
|
|
2685
|
+
return { category: "agent", primaryLabelLen };
|
|
2686
|
+
default:
|
|
2687
|
+
throw new NameRegistryError("unrecognised name structure");
|
|
2688
|
+
}
|
|
2689
|
+
}
|
|
2690
|
+
function nameRegistrationCost(category, primaryLabelLen, feeUnitLythoshi) {
|
|
2691
|
+
if (category === "system") {
|
|
2692
|
+
throw new NameRegistryError("system names are not registerable via this path");
|
|
2693
|
+
}
|
|
2694
|
+
const base = BigInt(NAME_BASE_MULTIPLIER[category]);
|
|
2695
|
+
const modX10 = nameLengthModifierX10(primaryLabelLen);
|
|
2696
|
+
if (modX10 === null) {
|
|
2697
|
+
throw new NameRegistryError("primary label length is outside the priceable 1..=63 range");
|
|
2698
|
+
}
|
|
2699
|
+
return base * BigInt(modX10) * feeUnitLythoshi / 10n;
|
|
2700
|
+
}
|
|
2701
|
+
function encodeNameRegisterCall(name, owner) {
|
|
2702
|
+
return encodeStringAddressCall(NAME_REGISTRY_SELECTORS.register, name, owner);
|
|
2703
|
+
}
|
|
2704
|
+
function encodeNameProposeTransferCall(name, recipient) {
|
|
2705
|
+
return encodeStringAddressCall(NAME_REGISTRY_SELECTORS.proposeTransfer, name, recipient);
|
|
2706
|
+
}
|
|
2707
|
+
function encodeNameAcceptTransferCall(name) {
|
|
2708
|
+
const nameBytes = new TextEncoder().encode(name);
|
|
2709
|
+
return bytesToHex4(
|
|
2710
|
+
concatBytes4(
|
|
2711
|
+
hexToBytes4(NAME_REGISTRY_SELECTORS.acceptTransfer),
|
|
2712
|
+
// Single head word → the string offset is 0x20 (one word precedes the tail).
|
|
2713
|
+
uint256Word(0x20n),
|
|
2714
|
+
uint256Word(BigInt(nameBytes.length)),
|
|
2715
|
+
padTo32(nameBytes)
|
|
2716
|
+
)
|
|
2717
|
+
);
|
|
2718
|
+
}
|
|
2719
|
+
var STRUCTURAL_RESERVES = /* @__PURE__ */ new Set(["agent", "cluster", "contract", "system"]);
|
|
2720
|
+
function encodeStringAddressCall(selector, name, address) {
|
|
2721
|
+
const nameBytes = new TextEncoder().encode(name);
|
|
2722
|
+
return bytesToHex4(
|
|
2723
|
+
concatBytes4(
|
|
2724
|
+
hexToBytes4(selector),
|
|
2725
|
+
// Two head words (string offset, address) → string tail starts at 0x40.
|
|
2726
|
+
uint256Word(0x40n),
|
|
2727
|
+
addressWord(address),
|
|
2728
|
+
uint256Word(BigInt(nameBytes.length)),
|
|
2729
|
+
padTo32(nameBytes)
|
|
2730
|
+
)
|
|
2731
|
+
);
|
|
2732
|
+
}
|
|
2733
|
+
function validateLabel(label) {
|
|
2734
|
+
if (label.length < NAME_LABEL_MIN_LEN || label.length > NAME_LABEL_MAX_LEN) {
|
|
2735
|
+
throw new NameRegistryError(`label "${label}" must be ${NAME_LABEL_MIN_LEN}..${NAME_LABEL_MAX_LEN} chars`);
|
|
2736
|
+
}
|
|
2737
|
+
if (label.startsWith("-") || label.endsWith("-")) {
|
|
2738
|
+
throw new NameRegistryError(`label "${label}" may not start or end with a hyphen`);
|
|
2739
|
+
}
|
|
2740
|
+
if (label.includes("--")) {
|
|
2741
|
+
throw new NameRegistryError(`label "${label}" may not contain a double hyphen`);
|
|
2742
|
+
}
|
|
2743
|
+
if (!/^[a-z0-9-]+$/.test(label)) {
|
|
2744
|
+
throw new NameRegistryError(`label "${label}" has an invalid char (allowed: a-z 0-9 -)`);
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
function selectorHex2(signature) {
|
|
2748
|
+
const sel = sha3_js.keccak_256(new TextEncoder().encode(signature)).slice(0, 4);
|
|
2749
|
+
return `0x${[...sel].map((b) => b.toString(16).padStart(2, "0")).join("")}`;
|
|
2750
|
+
}
|
|
2751
|
+
function addressWord(value) {
|
|
2752
|
+
const out = new Uint8Array(32);
|
|
2753
|
+
if (value == null) return out;
|
|
2754
|
+
const bytes = toBytes2(value);
|
|
2755
|
+
if (bytes.length !== 20) {
|
|
2756
|
+
throw new NameRegistryError(`address must be 20 bytes, got ${bytes.length}`);
|
|
2757
|
+
}
|
|
2758
|
+
out.set(bytes, 12);
|
|
2759
|
+
return out;
|
|
2760
|
+
}
|
|
2761
|
+
function uint256Word(value) {
|
|
2762
|
+
if (value < 0n || value > (1n << 256n) - 1n) {
|
|
2763
|
+
throw new NameRegistryError("uint256 word out of range");
|
|
2764
|
+
}
|
|
2765
|
+
const out = new Uint8Array(32);
|
|
2766
|
+
let rest = value;
|
|
2767
|
+
for (let i = 31; i >= 0 && rest > 0n; i--) {
|
|
2768
|
+
out[i] = Number(rest & 0xffn);
|
|
2769
|
+
rest >>= 8n;
|
|
2770
|
+
}
|
|
2771
|
+
return out;
|
|
2772
|
+
}
|
|
2773
|
+
function padTo32(bytes) {
|
|
2774
|
+
const padded = Math.ceil(bytes.length / 32) * 32;
|
|
2775
|
+
if (padded === bytes.length) return bytes;
|
|
2776
|
+
const out = new Uint8Array(padded);
|
|
2777
|
+
out.set(bytes);
|
|
2778
|
+
return out;
|
|
2779
|
+
}
|
|
2780
|
+
function toBytes2(value) {
|
|
2781
|
+
if (typeof value === "string") return hexToBytes4(value);
|
|
2782
|
+
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
2783
|
+
}
|
|
2784
|
+
function hexToBytes4(hex) {
|
|
2785
|
+
const body = hex.startsWith("0x") || hex.startsWith("0X") ? hex.slice(2) : hex;
|
|
2786
|
+
if (body.length % 2 !== 0 || !/^[0-9a-fA-F]*$/.test(body)) {
|
|
2787
|
+
throw new NameRegistryError("invalid hex bytes");
|
|
2788
|
+
}
|
|
2789
|
+
const out = new Uint8Array(body.length / 2);
|
|
2790
|
+
for (let i = 0; i < out.length; i++) out[i] = Number.parseInt(body.slice(i * 2, i * 2 + 2), 16);
|
|
2791
|
+
return out;
|
|
2792
|
+
}
|
|
2793
|
+
function bytesToHex4(bytes) {
|
|
2794
|
+
return `0x${[...bytes].map((b) => b.toString(16).padStart(2, "0")).join("")}`;
|
|
2795
|
+
}
|
|
2796
|
+
function concatBytes4(...parts) {
|
|
2797
|
+
const out = new Uint8Array(parts.reduce((acc, p) => acc + p.length, 0));
|
|
2798
|
+
let offset = 0;
|
|
2799
|
+
for (const part of parts) {
|
|
2800
|
+
out.set(part, offset);
|
|
2801
|
+
offset += part.length;
|
|
2802
|
+
}
|
|
2803
|
+
return out;
|
|
2804
|
+
}
|
|
2433
2805
|
|
|
2434
2806
|
// src/client.ts
|
|
2435
2807
|
var MAX_NATIVE_RECEIPT_EVENTS = 1e3;
|
|
@@ -3267,7 +3639,234 @@ var RpcClient = class _RpcClient {
|
|
|
3267
3639
|
async meshSubmitTx(signedTx) {
|
|
3268
3640
|
return this.call("mesh_submitTx", [signedTx]);
|
|
3269
3641
|
}
|
|
3642
|
+
// ---- lyth_* additions (R15 / wallet + monoscan surfaces) -----------
|
|
3643
|
+
/**
|
|
3644
|
+
* `lyth_clusterApr` — observed APR for a cluster over a rolling window.
|
|
3645
|
+
* `windowBlocks` defaults to the chain's 1200-block (~1h) window and is
|
|
3646
|
+
* server-clamped to `[10, 86_400]`.
|
|
3647
|
+
*/
|
|
3648
|
+
async lythClusterApr(clusterId, windowBlocks) {
|
|
3649
|
+
const params = windowBlocks === void 0 ? [clusterId] : [clusterId, windowBlocks];
|
|
3650
|
+
return normalizeClusterApr(await this.call("lyth_clusterApr", params));
|
|
3651
|
+
}
|
|
3652
|
+
/** `lyth_resolveName` — forward name → address resolution (0x110E). */
|
|
3653
|
+
async lythResolveName(name, block = "latest") {
|
|
3654
|
+
return this.call("lyth_resolveName", [name, encodeBlockSelector(block)]);
|
|
3655
|
+
}
|
|
3656
|
+
/** `lyth_nameOf` — reverse address → name resolution. */
|
|
3657
|
+
async lythNameOf(address, block = "latest") {
|
|
3658
|
+
return this.call("lyth_nameOf", [sdkTypedAddress(address, "user", "address"), encodeBlockSelector(block)]);
|
|
3659
|
+
}
|
|
3660
|
+
/** `lyth_getClusterName` — reverse cluster id → canonical name. */
|
|
3661
|
+
async lythGetClusterName(clusterId, block = "latest") {
|
|
3662
|
+
return this.call("lyth_getClusterName", [clusterId, encodeBlockSelector(block)]);
|
|
3663
|
+
}
|
|
3664
|
+
/**
|
|
3665
|
+
* Convenience over {@link lythResolveName}: `true` when a well-formed
|
|
3666
|
+
* name is unregistered. A malformed name throws `RpcError`
|
|
3667
|
+
* (`InvalidParams`) rather than returning `true`, so the UI should treat
|
|
3668
|
+
* a thrown validation error distinctly from "taken".
|
|
3669
|
+
*/
|
|
3670
|
+
async lythIsNameAvailable(name, block = "latest") {
|
|
3671
|
+
const resolved = await this.lythResolveName(name, block);
|
|
3672
|
+
return resolved.address === null;
|
|
3673
|
+
}
|
|
3674
|
+
/**
|
|
3675
|
+
* Live name-registration quote: parses the name's category + primary
|
|
3676
|
+
* label length, reads the chain's base fee unit via `eth_feeHistory`
|
|
3677
|
+
* (the bare `baseFeePerGas` — NOT `eth_gasPrice`, which adds the tip and
|
|
3678
|
+
* would over-quote), and applies the U-curve. The resulting
|
|
3679
|
+
* `costLythoshi` is what the `register` tx `value` must equal exactly
|
|
3680
|
+
* (else the precompile reverts `IncorrectFee`).
|
|
3681
|
+
*/
|
|
3682
|
+
async quoteNameRegistration(name, block = "latest") {
|
|
3683
|
+
const parsed = parseNameCategory(name);
|
|
3684
|
+
const history = await this.ethFeeHistory(1, block, []);
|
|
3685
|
+
const baseFees = history.baseFeePerGas ?? [];
|
|
3686
|
+
const lastHex = baseFees.length > 0 ? baseFees[baseFees.length - 1] : "0x0";
|
|
3687
|
+
const baseFee = parseQuantityBig(lastHex);
|
|
3688
|
+
const feeUnitLythoshi = baseFee > 0n ? baseFee : NAME_FALLBACK_FEE_UNIT_LYTHOSHI;
|
|
3689
|
+
return {
|
|
3690
|
+
name,
|
|
3691
|
+
category: parsed.category,
|
|
3692
|
+
primaryLabelLen: parsed.primaryLabelLen,
|
|
3693
|
+
feeUnitLythoshi,
|
|
3694
|
+
costLythoshi: nameRegistrationCost(parsed.category, parsed.primaryLabelLen, feeUnitLythoshi)
|
|
3695
|
+
};
|
|
3696
|
+
}
|
|
3697
|
+
/** `lyth_circulatingSupply` — native LYTH circulating / initial / burned (decimal lythoshi strings). */
|
|
3698
|
+
async lythCirculatingSupply() {
|
|
3699
|
+
return this.call("lyth_circulatingSupply", []);
|
|
3700
|
+
}
|
|
3701
|
+
/** `lyth_totalBurned` — cumulative burned native LYTH (decimal lythoshi string). */
|
|
3702
|
+
async lythTotalBurned() {
|
|
3703
|
+
return this.call("lyth_totalBurned", []);
|
|
3704
|
+
}
|
|
3705
|
+
/** `lyth_swapIntentStatus` — bridge swap-intent / DKG-reshare lifecycle for one intent id. */
|
|
3706
|
+
async lythSwapIntentStatus(intentId) {
|
|
3707
|
+
let id;
|
|
3708
|
+
if (typeof intentId === "number") {
|
|
3709
|
+
id = intentId;
|
|
3710
|
+
} else if (typeof intentId === "bigint") {
|
|
3711
|
+
id = `0x${intentId.toString(16)}`;
|
|
3712
|
+
} else if (intentId.startsWith("0x") || intentId.startsWith("0X")) {
|
|
3713
|
+
id = intentId;
|
|
3714
|
+
} else {
|
|
3715
|
+
id = `0x${BigInt(intentId).toString(16)}`;
|
|
3716
|
+
}
|
|
3717
|
+
return this.call("lyth_swapIntentStatus", [id]);
|
|
3718
|
+
}
|
|
3719
|
+
/**
|
|
3720
|
+
* Per-tx confirmation depth, derived from `lyth_txStatus` (which returns
|
|
3721
|
+
* both the tx's `blockNumber` and the node `latestHeight`).
|
|
3722
|
+
*/
|
|
3723
|
+
async lythTxConfirmations(txHash) {
|
|
3724
|
+
const status = await this.lythTxStatus(txHash);
|
|
3725
|
+
if (status.status === "found") {
|
|
3726
|
+
return {
|
|
3727
|
+
status: "found",
|
|
3728
|
+
confirmations: status.latestHeight - status.blockNumber + 1,
|
|
3729
|
+
blockNumber: status.blockNumber,
|
|
3730
|
+
latestHeight: status.latestHeight
|
|
3731
|
+
};
|
|
3732
|
+
}
|
|
3733
|
+
return {
|
|
3734
|
+
status: "not_found",
|
|
3735
|
+
confirmations: null,
|
|
3736
|
+
blockNumber: null,
|
|
3737
|
+
latestHeight: status.latestHeight
|
|
3738
|
+
};
|
|
3739
|
+
}
|
|
3740
|
+
/**
|
|
3741
|
+
* Resolve a user-pasted MRC token id to its metadata (name/symbol/
|
|
3742
|
+
* decimals), for an "add custom token" flow. Returns `null` for an
|
|
3743
|
+
* unknown/untracked id. Performs light client-side format validation
|
|
3744
|
+
* (32-byte hex) for fast UX feedback; the chain re-validates regardless.
|
|
3745
|
+
*/
|
|
3746
|
+
async lythResolveTokenMetadata(rawTokenId) {
|
|
3747
|
+
const body = rawTokenId.startsWith("0x") || rawTokenId.startsWith("0X") ? rawTokenId.slice(2) : rawTokenId;
|
|
3748
|
+
if (!/^[0-9a-fA-F]{64}$/.test(body)) {
|
|
3749
|
+
throw SdkError.malformed("token id must be 32 bytes (64 hex chars)");
|
|
3750
|
+
}
|
|
3751
|
+
return (await this.lythMrcMetadata(rawTokenId)).metadata;
|
|
3752
|
+
}
|
|
3753
|
+
/**
|
|
3754
|
+
* `lyth_getTokenBalances` joined with per-token MRC metadata. Balances
|
|
3755
|
+
* are PUBLIC-only by construction (private-denomination balances are
|
|
3756
|
+
* excluded by the chain). Raw `balance` strings are preserved (apply
|
|
3757
|
+
* `metadata.decimals` client-side for display).
|
|
3758
|
+
*/
|
|
3759
|
+
async lythGetTokenBalancesWithMetadata(address) {
|
|
3760
|
+
const rows = await this.lythGetTokenBalances(address);
|
|
3761
|
+
const keyFor = (row) => {
|
|
3762
|
+
const assetId = row.mrc?.assetId ?? row.tokenId;
|
|
3763
|
+
const tokenId = row.mrc?.tokenId ?? null;
|
|
3764
|
+
return { assetId, tokenId, key: `${assetId}:${tokenId ?? ""}` };
|
|
3765
|
+
};
|
|
3766
|
+
const distinct = /* @__PURE__ */ new Map();
|
|
3767
|
+
for (const row of rows) {
|
|
3768
|
+
const k = keyFor(row);
|
|
3769
|
+
if (!distinct.has(k.key)) distinct.set(k.key, { assetId: k.assetId, tokenId: k.tokenId });
|
|
3770
|
+
}
|
|
3771
|
+
const metaByKey = /* @__PURE__ */ new Map();
|
|
3772
|
+
await Promise.all(
|
|
3773
|
+
[...distinct.entries()].map(async ([key, { assetId, tokenId }]) => {
|
|
3774
|
+
const resp = await this.lythMrcMetadata(assetId, tokenId);
|
|
3775
|
+
metaByKey.set(key, resp.metadata);
|
|
3776
|
+
})
|
|
3777
|
+
);
|
|
3778
|
+
return rows.map((row) => ({ ...row, metadata: metaByKey.get(keyFor(row).key) ?? null }));
|
|
3779
|
+
}
|
|
3780
|
+
/**
|
|
3781
|
+
* Resolve a CLOB market's base/quote asset metadata (symbol/name/
|
|
3782
|
+
* decimals) by joining `lyth_clobMarket` to `lyth_mrcMetadata`. Either
|
|
3783
|
+
* side may be `null` when the indexer has no MRC row (e.g. native LYTH).
|
|
3784
|
+
*/
|
|
3785
|
+
async resolveClobMarketAssets(marketId) {
|
|
3786
|
+
const response = await this.lythClobMarket(marketId);
|
|
3787
|
+
const market = response.market;
|
|
3788
|
+
if (!market) return { base: null, quote: null };
|
|
3789
|
+
const [base, quote] = await Promise.all([
|
|
3790
|
+
this.lythMrcMetadata(market.baseToken).then((m) => m.metadata),
|
|
3791
|
+
this.lythMrcMetadata(market.quoteToken).then((m) => m.metadata)
|
|
3792
|
+
]);
|
|
3793
|
+
return { base, quote };
|
|
3794
|
+
}
|
|
3795
|
+
/**
|
|
3796
|
+
* `lyth_getAddressActivity` enriched with each row's block timestamp,
|
|
3797
|
+
* canonical tx hash (resolved from `(blockHeight, txIndex)`), and
|
|
3798
|
+
* resolved cluster name. Issues one block read per distinct height and
|
|
3799
|
+
* one name read per distinct cluster.
|
|
3800
|
+
*/
|
|
3801
|
+
async enrichAddressActivity(address, limit = 50, cursor) {
|
|
3802
|
+
const entries = await this.lythGetAddressActivity(address, limit, cursor);
|
|
3803
|
+
const heights = [...new Set(entries.map((entry) => BigInt(entry.blockHeight)))];
|
|
3804
|
+
const blockByHeight = /* @__PURE__ */ new Map();
|
|
3805
|
+
await Promise.all(
|
|
3806
|
+
heights.map(async (height) => {
|
|
3807
|
+
blockByHeight.set(height, await this.blockTimeAndTxHashes(height));
|
|
3808
|
+
})
|
|
3809
|
+
);
|
|
3810
|
+
const clusters = [
|
|
3811
|
+
...new Set(entries.map((entry) => entry.cluster).filter((c) => c != null))
|
|
3812
|
+
];
|
|
3813
|
+
const nameByCluster = /* @__PURE__ */ new Map();
|
|
3814
|
+
await Promise.all(
|
|
3815
|
+
clusters.map(async (clusterId) => {
|
|
3816
|
+
nameByCluster.set(clusterId, (await this.lythGetClusterName(clusterId)).name);
|
|
3817
|
+
})
|
|
3818
|
+
);
|
|
3819
|
+
return entries.map((entry) => {
|
|
3820
|
+
const block = blockByHeight.get(BigInt(entry.blockHeight));
|
|
3821
|
+
const txHash = block && entry.txIndex >= 0 && entry.txIndex < block.txHashes.length ? block.txHashes[entry.txIndex] : null;
|
|
3822
|
+
return {
|
|
3823
|
+
...entry,
|
|
3824
|
+
blockTimestampSeconds: block?.timestampSeconds ?? null,
|
|
3825
|
+
txHash,
|
|
3826
|
+
clusterName: entry.cluster != null ? nameByCluster.get(entry.cluster) ?? null : null
|
|
3827
|
+
};
|
|
3828
|
+
});
|
|
3829
|
+
}
|
|
3830
|
+
/**
|
|
3831
|
+
* Read a block's header timestamp (UNIX seconds) and ordered tx-hash
|
|
3832
|
+
* array via the raw `eth_getBlockByNumber` (hash-only mode). The typed
|
|
3833
|
+
* `ethGetBlockByNumber` wrapper drops the `transactions` array, so this
|
|
3834
|
+
* uses the raw call.
|
|
3835
|
+
*/
|
|
3836
|
+
async blockTimeAndTxHashes(height) {
|
|
3837
|
+
const hexHeight = `0x${height.toString(16)}`;
|
|
3838
|
+
const raw = await this.call("eth_getBlockByNumber", [
|
|
3839
|
+
hexHeight,
|
|
3840
|
+
false
|
|
3841
|
+
]);
|
|
3842
|
+
if (!raw || typeof raw !== "object") return { timestampSeconds: null, txHashes: [] };
|
|
3843
|
+
const ts = raw["timestamp"];
|
|
3844
|
+
const timestampSeconds = ts === null || ts === void 0 ? null : parseRpcBigint(ts, "block timestamp");
|
|
3845
|
+
const txs = raw["transactions"];
|
|
3846
|
+
const txHashes = Array.isArray(txs) ? txs.filter((t) => typeof t === "string") : [];
|
|
3847
|
+
return { timestampSeconds, txHashes };
|
|
3848
|
+
}
|
|
3270
3849
|
};
|
|
3850
|
+
function clusterApyPercent(apr) {
|
|
3851
|
+
return Number(apr.aprBps) / 100;
|
|
3852
|
+
}
|
|
3853
|
+
function computeQuoteLiquidity(book) {
|
|
3854
|
+
const sumQuote = (levels) => levels.reduce((acc, level) => acc + BigInt(level.price) * BigInt(level.size), 0n);
|
|
3855
|
+
const bidQuote = sumQuote(book.bids);
|
|
3856
|
+
const askQuote = sumQuote(book.asks);
|
|
3857
|
+
return {
|
|
3858
|
+
bidQuote: bidQuote.toString(10),
|
|
3859
|
+
askQuote: askQuote.toString(10),
|
|
3860
|
+
totalQuote: (bidQuote + askQuote).toString(10)
|
|
3861
|
+
};
|
|
3862
|
+
}
|
|
3863
|
+
function rankMarketsByVolume(markets) {
|
|
3864
|
+
return [...markets].sort((a, b) => {
|
|
3865
|
+
const av = BigInt(a.totalVolumeBase);
|
|
3866
|
+
const bv = BigInt(b.totalVolumeBase);
|
|
3867
|
+
return av < bv ? 1 : av > bv ? -1 : 0;
|
|
3868
|
+
}).map((market, index) => ({ ...market, volumeRank: index + 1 }));
|
|
3869
|
+
}
|
|
3271
3870
|
function parseQuantityBig(hex) {
|
|
3272
3871
|
if (!hex) return 0n;
|
|
3273
3872
|
const rest = hex.startsWith("0x") || hex.startsWith("0X") ? hex.slice(2) : hex;
|
|
@@ -3922,6 +4521,29 @@ function normalizeRoundInfo(value) {
|
|
|
3922
4521
|
height: parseRpcBigint(row["height"], "round height")
|
|
3923
4522
|
};
|
|
3924
4523
|
}
|
|
4524
|
+
function normalizeClusterApr(value) {
|
|
4525
|
+
if (!value || typeof value !== "object") {
|
|
4526
|
+
throw SdkError.malformed("cluster apr must be an object");
|
|
4527
|
+
}
|
|
4528
|
+
const row = value;
|
|
4529
|
+
const blocks = row["blocks"] ?? {};
|
|
4530
|
+
return {
|
|
4531
|
+
clusterId: parseRpcNumber(row["clusterId"], "clusterId"),
|
|
4532
|
+
blocks: {
|
|
4533
|
+
from: parseRpcBigint(blocks["from"], "blocks.from"),
|
|
4534
|
+
to: parseRpcBigint(blocks["to"], "blocks.to"),
|
|
4535
|
+
window: parseRpcBigint(blocks["window"], "blocks.window")
|
|
4536
|
+
},
|
|
4537
|
+
rewardIndexFromHex: parseStringField(row["rewardIndexFromHex"], "rewardIndexFromHex"),
|
|
4538
|
+
rewardIndexToHex: parseStringField(row["rewardIndexToHex"], "rewardIndexToHex"),
|
|
4539
|
+
deltaIndexHex: parseStringField(row["deltaIndexHex"], "deltaIndexHex"),
|
|
4540
|
+
rewardIndexScale: parseStringField(row["rewardIndexScale"], "rewardIndexScale"),
|
|
4541
|
+
totalBps: parseRpcNumber(row["totalBps"], "totalBps"),
|
|
4542
|
+
blocksPerYear: parseRpcBigint(row["blocksPerYear"], "blocksPerYear"),
|
|
4543
|
+
stakePerBpsLythoshi: parseRpcBigint(row["stakePerBpsLythoshi"], "stakePerBpsLythoshi"),
|
|
4544
|
+
aprBps: parseRpcBigint(row["aprBps"], "aprBps")
|
|
4545
|
+
};
|
|
4546
|
+
}
|
|
3925
4547
|
function normalizeExecutionUnitPriceResponse(value) {
|
|
3926
4548
|
if (!value || typeof value !== "object") {
|
|
3927
4549
|
throw SdkError.malformed("execution unit price response must be an object");
|
|
@@ -4567,8 +5189,6 @@ function encodePathBlock(block) {
|
|
|
4567
5189
|
function encodePathSegment(value) {
|
|
4568
5190
|
return encodeURIComponent(typeof value === "bigint" ? value.toString() : String(value));
|
|
4569
5191
|
}
|
|
4570
|
-
|
|
4571
|
-
// src/bridge.ts
|
|
4572
5192
|
var BRIDGE_SELECTORS = {
|
|
4573
5193
|
lockBridgeConfig: "0x8956feb3",
|
|
4574
5194
|
setBridgeResumeCooldown: "0x1a3a0672",
|
|
@@ -4602,42 +5222,105 @@ function bridgeAddressHex() {
|
|
|
4602
5222
|
return PRECOMPILE_ADDRESSES.BRIDGE.toLowerCase();
|
|
4603
5223
|
}
|
|
4604
5224
|
function encodeLockBridgeConfigCalldata(bridgeId) {
|
|
4605
|
-
return
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
expectLength3(
|
|
5225
|
+
return bytesToHex5(
|
|
5226
|
+
concatBytes5(
|
|
5227
|
+
hexToBytes5(BRIDGE_SELECTORS.lockBridgeConfig),
|
|
5228
|
+
expectLength3(toBytes3(bridgeId), 32, "bridgeId")
|
|
4609
5229
|
)
|
|
4610
5230
|
);
|
|
4611
5231
|
}
|
|
4612
5232
|
function encodeSetBridgeResumeCooldownCalldata(bridgeId, cooldownBlocks) {
|
|
4613
|
-
return
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
expectLength3(
|
|
4617
|
-
|
|
5233
|
+
return bytesToHex5(
|
|
5234
|
+
concatBytes5(
|
|
5235
|
+
hexToBytes5(BRIDGE_SELECTORS.setBridgeResumeCooldown),
|
|
5236
|
+
expectLength3(toBytes3(bridgeId), 32, "bridgeId"),
|
|
5237
|
+
uint64Word2(cooldownBlocks, "cooldownBlocks")
|
|
4618
5238
|
)
|
|
4619
5239
|
);
|
|
4620
5240
|
}
|
|
4621
5241
|
function encodeSetBridgeRouteFinalityCalldata(bridgeId, finalityBlocks) {
|
|
4622
|
-
return
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
expectLength3(
|
|
4626
|
-
|
|
5242
|
+
return bytesToHex5(
|
|
5243
|
+
concatBytes5(
|
|
5244
|
+
hexToBytes5(BRIDGE_SELECTORS.setBridgeRouteFinality),
|
|
5245
|
+
expectLength3(toBytes3(bridgeId), 32, "bridgeId"),
|
|
5246
|
+
uint64Word2(finalityBlocks, "finalityBlocks")
|
|
5247
|
+
)
|
|
5248
|
+
);
|
|
5249
|
+
}
|
|
5250
|
+
function bridgeSelector(signature) {
|
|
5251
|
+
return sha3_js.keccak_256(new TextEncoder().encode(signature)).slice(0, 4);
|
|
5252
|
+
}
|
|
5253
|
+
function addressWord2(value, name) {
|
|
5254
|
+
const addr = expectLength3(toBytes3(value), 20, name);
|
|
5255
|
+
const out = new Uint8Array(32);
|
|
5256
|
+
out.set(addr, 12);
|
|
5257
|
+
return out;
|
|
5258
|
+
}
|
|
5259
|
+
function padTo322(bytes) {
|
|
5260
|
+
const padded = Math.ceil(bytes.length / 32) * 32;
|
|
5261
|
+
if (padded === bytes.length) return bytes;
|
|
5262
|
+
const out = new Uint8Array(padded);
|
|
5263
|
+
out.set(bytes);
|
|
5264
|
+
return out;
|
|
5265
|
+
}
|
|
5266
|
+
function encodeBridgeClaimCalldata(bridgeId, depositId, recipient) {
|
|
5267
|
+
return bytesToHex5(
|
|
5268
|
+
concatBytes5(
|
|
5269
|
+
bridgeSelector("claim(bytes32,bytes32,address)"),
|
|
5270
|
+
expectLength3(toBytes3(bridgeId), 32, "bridgeId"),
|
|
5271
|
+
expectLength3(toBytes3(depositId), 32, "depositId"),
|
|
5272
|
+
addressWord2(recipient, "recipient")
|
|
5273
|
+
)
|
|
5274
|
+
);
|
|
5275
|
+
}
|
|
5276
|
+
function encodeBridgeChallengeCalldata(bridgeId, depositId, fraudProof) {
|
|
5277
|
+
const proof = toBytes3(fraudProof);
|
|
5278
|
+
return bytesToHex5(
|
|
5279
|
+
concatBytes5(
|
|
5280
|
+
bridgeSelector("challenge(bytes32,bytes32,bytes)"),
|
|
5281
|
+
expectLength3(toBytes3(bridgeId), 32, "bridgeId"),
|
|
5282
|
+
expectLength3(toBytes3(depositId), 32, "depositId"),
|
|
5283
|
+
uint64Word2(3n * 32n, "fraudProofOffset"),
|
|
5284
|
+
uint64Word2(BigInt(proof.length), "fraudProofLength"),
|
|
5285
|
+
padTo322(proof)
|
|
5286
|
+
)
|
|
5287
|
+
);
|
|
5288
|
+
}
|
|
5289
|
+
function encodeSubmitBridgeProofCalldata(bridgeId, depositId, lockReceipt, zkProof, publicInputs) {
|
|
5290
|
+
const receipt = toBytes3(lockReceipt);
|
|
5291
|
+
const proof = toBytes3(zkProof);
|
|
5292
|
+
const inputs = toBytes3(publicInputs);
|
|
5293
|
+
const off0 = 5n * 32n;
|
|
5294
|
+
const off1 = off0 + 32n + BigInt(Math.ceil(receipt.length / 32) * 32);
|
|
5295
|
+
const off2 = off1 + 32n + BigInt(Math.ceil(proof.length / 32) * 32);
|
|
5296
|
+
return bytesToHex5(
|
|
5297
|
+
concatBytes5(
|
|
5298
|
+
bridgeSelector("submitProof(bytes32,bytes32,bytes,bytes,bytes)"),
|
|
5299
|
+
expectLength3(toBytes3(bridgeId), 32, "bridgeId"),
|
|
5300
|
+
expectLength3(toBytes3(depositId), 32, "depositId"),
|
|
5301
|
+
uint64Word2(off0, "lockReceiptOffset"),
|
|
5302
|
+
uint64Word2(off1, "zkProofOffset"),
|
|
5303
|
+
uint64Word2(off2, "publicInputsOffset"),
|
|
5304
|
+
uint64Word2(BigInt(receipt.length), "lockReceiptLength"),
|
|
5305
|
+
padTo322(receipt),
|
|
5306
|
+
uint64Word2(BigInt(proof.length), "zkProofLength"),
|
|
5307
|
+
padTo322(proof),
|
|
5308
|
+
uint64Word2(BigInt(inputs.length), "publicInputsLength"),
|
|
5309
|
+
padTo322(inputs)
|
|
4627
5310
|
)
|
|
4628
5311
|
);
|
|
4629
5312
|
}
|
|
4630
5313
|
function isBridgeAdminLockedRevert(data) {
|
|
4631
|
-
return
|
|
5314
|
+
return bytesToHex5(toBytes3(data)).toLowerCase() === BRIDGE_REVERT_TAGS.bridgeAdminLocked;
|
|
4632
5315
|
}
|
|
4633
5316
|
function isBridgeResumeCooldownActiveRevert(data) {
|
|
4634
|
-
return
|
|
5317
|
+
return bytesToHex5(toBytes3(data)).toLowerCase() === BRIDGE_REVERT_TAGS.bridgeResumeCooldownActive;
|
|
4635
5318
|
}
|
|
4636
5319
|
function isBridgeCooldownZeroRevert(data) {
|
|
4637
|
-
return
|
|
5320
|
+
return bytesToHex5(toBytes3(data)).toLowerCase() === BRIDGE_REVERT_TAGS.bridgeCooldownZero;
|
|
4638
5321
|
}
|
|
4639
5322
|
function isBridgeFinalityZeroRevert(data) {
|
|
4640
|
-
return
|
|
5323
|
+
return bytesToHex5(toBytes3(data)).toLowerCase() === BRIDGE_REVERT_TAGS.bridgeFinalityZero;
|
|
4641
5324
|
}
|
|
4642
5325
|
function bridgeDrainRemaining(capPerWindow, drained) {
|
|
4643
5326
|
const cap = BigInt(capPerWindow);
|
|
@@ -5240,7 +5923,7 @@ function expectLength3(value, len, name) {
|
|
|
5240
5923
|
}
|
|
5241
5924
|
return value;
|
|
5242
5925
|
}
|
|
5243
|
-
function
|
|
5926
|
+
function uint64Word2(value, name) {
|
|
5244
5927
|
const n = toBigint(value, name);
|
|
5245
5928
|
if (n < 0n || n > 0xffffffffffffffffn) {
|
|
5246
5929
|
throw new BridgePrecompileError(`${name} must fit uint64`);
|
|
@@ -5266,13 +5949,13 @@ function toBigint(value, name) {
|
|
|
5266
5949
|
}
|
|
5267
5950
|
return BigInt(value);
|
|
5268
5951
|
}
|
|
5269
|
-
function
|
|
5952
|
+
function toBytes3(value) {
|
|
5270
5953
|
if (typeof value === "string") {
|
|
5271
|
-
return
|
|
5954
|
+
return hexToBytes5(value);
|
|
5272
5955
|
}
|
|
5273
5956
|
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
5274
5957
|
}
|
|
5275
|
-
function
|
|
5958
|
+
function hexToBytes5(hex) {
|
|
5276
5959
|
const body = hex.startsWith("0x") || hex.startsWith("0X") ? hex.slice(2) : hex;
|
|
5277
5960
|
if (body.length % 2 !== 0 || !/^[0-9a-fA-F]*$/.test(body)) {
|
|
5278
5961
|
throw new BridgePrecompileError("invalid hex bytes");
|
|
@@ -5283,10 +5966,10 @@ function hexToBytes4(hex) {
|
|
|
5283
5966
|
}
|
|
5284
5967
|
return out;
|
|
5285
5968
|
}
|
|
5286
|
-
function
|
|
5969
|
+
function bytesToHex5(bytes) {
|
|
5287
5970
|
return `0x${[...bytes].map((b) => b.toString(16).padStart(2, "0")).join("")}`;
|
|
5288
5971
|
}
|
|
5289
|
-
function
|
|
5972
|
+
function concatBytes5(...parts) {
|
|
5290
5973
|
const out = new Uint8Array(parts.reduce((acc, p) => acc + p.length, 0));
|
|
5291
5974
|
let offset = 0;
|
|
5292
5975
|
for (const part of parts) {
|
|
@@ -5341,10 +6024,10 @@ function decodeNoEvmReceiptTranscript(proof) {
|
|
|
5341
6024
|
);
|
|
5342
6025
|
}
|
|
5343
6026
|
function computeNoEvmReceiptsRoot(receipts) {
|
|
5344
|
-
return
|
|
6027
|
+
return bytesToHex6(computeNoEvmReceiptsRootBytes(receipts));
|
|
5345
6028
|
}
|
|
5346
6029
|
function computeNoEvmTargetReceiptHash(receiptBytes) {
|
|
5347
|
-
return
|
|
6030
|
+
return bytesToHex6(sha3_js.keccak_256(receiptBytes));
|
|
5348
6031
|
}
|
|
5349
6032
|
function verifyNoEvmReceiptProof(proof) {
|
|
5350
6033
|
if (proof == null) return null;
|
|
@@ -5931,7 +6614,7 @@ function verifyCompactReceiptProof(proof) {
|
|
|
5931
6614
|
if (!bytesEqual(expectedLeafHashBytes, actualLeafHashBytes)) {
|
|
5932
6615
|
throw new NoEvmReceiptProofError(
|
|
5933
6616
|
"compact_leaf_hash_mismatch",
|
|
5934
|
-
`compactInclusionProof.leafHash mismatch: expected ${compactProof.leafHash}, computed ${
|
|
6617
|
+
`compactInclusionProof.leafHash mismatch: expected ${compactProof.leafHash}, computed ${bytesToHex6(
|
|
5935
6618
|
actualLeafHashBytes
|
|
5936
6619
|
)}`
|
|
5937
6620
|
);
|
|
@@ -5964,14 +6647,14 @@ function verifyCompactReceiptProof(proof) {
|
|
|
5964
6647
|
if (!bytesEqual(actualRootBytes, compactRootBytes)) {
|
|
5965
6648
|
throw new NoEvmReceiptProofError(
|
|
5966
6649
|
"compact_path_mismatch",
|
|
5967
|
-
`compact inclusion path mismatch: expected ${compactProof.root}, computed ${
|
|
6650
|
+
`compact inclusion path mismatch: expected ${compactProof.root}, computed ${bytesToHex6(
|
|
5968
6651
|
actualRootBytes
|
|
5969
6652
|
)}`
|
|
5970
6653
|
);
|
|
5971
6654
|
}
|
|
5972
6655
|
return {
|
|
5973
6656
|
receipts: [],
|
|
5974
|
-
receiptsRoot:
|
|
6657
|
+
receiptsRoot: bytesToHex6(actualRootBytes),
|
|
5975
6658
|
targetReceiptHash: actualTargetHash,
|
|
5976
6659
|
receiptCount: proof.receiptCount,
|
|
5977
6660
|
txIndex: proof.txIndex,
|
|
@@ -6181,7 +6864,7 @@ function parseArchiveProofSignature(signature, index, fieldPrefix = "archiveProo
|
|
|
6181
6864
|
`${field2}.payload must be non-empty`
|
|
6182
6865
|
);
|
|
6183
6866
|
}
|
|
6184
|
-
return { signerId:
|
|
6867
|
+
return { signerId: bytesToHex6(signerId), payload };
|
|
6185
6868
|
}
|
|
6186
6869
|
function normalizeSignerId(value) {
|
|
6187
6870
|
const bytes = decodeHexBytes(value, "signerId");
|
|
@@ -6191,7 +6874,7 @@ function normalizeSignerId(value) {
|
|
|
6191
6874
|
`signerId must be ${ARCHIVE_SIGNATURE_SIGNER_ID_BYTE_LENGTH} bytes, got ${bytes.length}`
|
|
6192
6875
|
);
|
|
6193
6876
|
}
|
|
6194
|
-
return
|
|
6877
|
+
return bytesToHex6(bytes);
|
|
6195
6878
|
}
|
|
6196
6879
|
function expectArchivePublicKey(value, field2) {
|
|
6197
6880
|
if (value.length !== ML_DSA_65_PUBLIC_KEY_LEN) {
|
|
@@ -6672,7 +7355,7 @@ function bytesEqual(a, b) {
|
|
|
6672
7355
|
}
|
|
6673
7356
|
return diff === 0;
|
|
6674
7357
|
}
|
|
6675
|
-
function
|
|
7358
|
+
function bytesToHex6(bytes) {
|
|
6676
7359
|
let out = "0x";
|
|
6677
7360
|
for (let index = 0; index < bytes.length; index++) {
|
|
6678
7361
|
out += bytes[index].toString(16).padStart(2, "0");
|
|
@@ -6891,12 +7574,48 @@ var OracleEventError = class extends Error {
|
|
|
6891
7574
|
function oracleAddressHex() {
|
|
6892
7575
|
return PRECOMPILE_ADDRESSES.ORACLE.toLowerCase();
|
|
6893
7576
|
}
|
|
7577
|
+
var FEED_ID_DOMAIN_TAG = "protocore-oracle/feed-id/v1";
|
|
7578
|
+
function deriveFeedId(name, decimals) {
|
|
7579
|
+
if (!Number.isInteger(decimals) || decimals < 0 || decimals > 255) {
|
|
7580
|
+
throw new OracleEventError("feed decimals must be an integer in 0..=255");
|
|
7581
|
+
}
|
|
7582
|
+
const nameBytes = new TextEncoder().encode(name);
|
|
7583
|
+
const buf = concatBytes6(
|
|
7584
|
+
new TextEncoder().encode(FEED_ID_DOMAIN_TAG),
|
|
7585
|
+
nameBytes,
|
|
7586
|
+
Uint8Array.of(decimals & 255)
|
|
7587
|
+
);
|
|
7588
|
+
return bytesToHex7(sha3_js.keccak_256(buf));
|
|
7589
|
+
}
|
|
7590
|
+
function formatOraclePrice(price) {
|
|
7591
|
+
if (price.median === null) return null;
|
|
7592
|
+
const value = BigInt(price.median);
|
|
7593
|
+
const decimals = price.decimals;
|
|
7594
|
+
if (decimals <= 0) return value.toString(10);
|
|
7595
|
+
const base = 10n ** BigInt(decimals);
|
|
7596
|
+
const whole = value / base;
|
|
7597
|
+
const frac = (value % base).toString(10).padStart(decimals, "0").replace(/0+$/, "");
|
|
7598
|
+
return frac.length > 0 ? `${whole.toString(10)}.${frac}` : whole.toString(10);
|
|
7599
|
+
}
|
|
7600
|
+
function oraclePriceToNumber(price) {
|
|
7601
|
+
const formatted = formatOraclePrice(price);
|
|
7602
|
+
return formatted === null ? null : Number(formatted);
|
|
7603
|
+
}
|
|
7604
|
+
function concatBytes6(...parts) {
|
|
7605
|
+
const out = new Uint8Array(parts.reduce((acc, p) => acc + p.length, 0));
|
|
7606
|
+
let offset = 0;
|
|
7607
|
+
for (const part of parts) {
|
|
7608
|
+
out.set(part, offset);
|
|
7609
|
+
offset += part.length;
|
|
7610
|
+
}
|
|
7611
|
+
return out;
|
|
7612
|
+
}
|
|
6894
7613
|
function decodeOracleEvent(topics, data) {
|
|
6895
7614
|
if (topics.length === 0) {
|
|
6896
7615
|
throw new OracleEventError("event record has no topics");
|
|
6897
7616
|
}
|
|
6898
|
-
const topic0 =
|
|
6899
|
-
const body =
|
|
7617
|
+
const topic0 = bytesToHex7(expectLength4(toBytes4(topics[0]), 32, "topic0"));
|
|
7618
|
+
const body = toBytes4(data);
|
|
6900
7619
|
if (topic0 === topicHex(ORACLE_EVENT_SIGS.oracleRoundFinalized)) {
|
|
6901
7620
|
checkArity("OracleRoundFinalized", 3, topics.length);
|
|
6902
7621
|
checkData("OracleRoundFinalized", 3 * 32, body.length);
|
|
@@ -6929,7 +7648,7 @@ function decodeOracleEvent(topics, data) {
|
|
|
6929
7648
|
feedId: hex32(topics[1]),
|
|
6930
7649
|
roundId: u64FromTopic(topics[2]),
|
|
6931
7650
|
writer: addressFromTopic(topics[3]),
|
|
6932
|
-
evidenceHash:
|
|
7651
|
+
evidenceHash: bytesToHex7(body.subarray(0, 32))
|
|
6933
7652
|
};
|
|
6934
7653
|
}
|
|
6935
7654
|
if (topic0 === topicHex(ORACLE_EVENT_SIGS.feedAdded)) {
|
|
@@ -6977,7 +7696,7 @@ function decodeFeedFields(feedTopic, body) {
|
|
|
6977
7696
|
};
|
|
6978
7697
|
}
|
|
6979
7698
|
function topicHex(sig) {
|
|
6980
|
-
return
|
|
7699
|
+
return bytesToHex7(sha3_js.keccak_256(new TextEncoder().encode(sig)));
|
|
6981
7700
|
}
|
|
6982
7701
|
function checkArity(event, expected, found) {
|
|
6983
7702
|
if (found !== expected) {
|
|
@@ -6990,13 +7709,13 @@ function checkData(event, expected, found) {
|
|
|
6990
7709
|
}
|
|
6991
7710
|
}
|
|
6992
7711
|
function hex32(topic) {
|
|
6993
|
-
return
|
|
7712
|
+
return bytesToHex7(expectLength4(toBytes4(topic), 32, "feedId topic"));
|
|
6994
7713
|
}
|
|
6995
7714
|
function addressFromTopic(topic) {
|
|
6996
|
-
return
|
|
7715
|
+
return bytesToHex7(expectLength4(toBytes4(topic), 32, "address topic").subarray(12, 32));
|
|
6997
7716
|
}
|
|
6998
7717
|
function u64FromTopic(topic) {
|
|
6999
|
-
return u64FromWord2(expectLength4(
|
|
7718
|
+
return u64FromWord2(expectLength4(toBytes4(topic), 32, "u64 topic"));
|
|
7000
7719
|
}
|
|
7001
7720
|
function u64FromWord2(word) {
|
|
7002
7721
|
let v = 0n;
|
|
@@ -7011,11 +7730,11 @@ function u256Decimal(word) {
|
|
|
7011
7730
|
for (const b of word) v = v << 8n | BigInt(b);
|
|
7012
7731
|
return v.toString(10);
|
|
7013
7732
|
}
|
|
7014
|
-
function
|
|
7015
|
-
if (typeof value === "string") return
|
|
7733
|
+
function toBytes4(value) {
|
|
7734
|
+
if (typeof value === "string") return hexToBytes6(value);
|
|
7016
7735
|
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
7017
7736
|
}
|
|
7018
|
-
function
|
|
7737
|
+
function hexToBytes6(hex) {
|
|
7019
7738
|
const b = hex.startsWith("0x") || hex.startsWith("0X") ? hex.slice(2) : hex;
|
|
7020
7739
|
if (b.length % 2 !== 0 || !/^[0-9a-fA-F]*$/.test(b)) {
|
|
7021
7740
|
throw new OracleEventError("invalid hex bytes");
|
|
@@ -7024,7 +7743,7 @@ function hexToBytes5(hex) {
|
|
|
7024
7743
|
for (let i = 0; i < out.length; i++) out[i] = Number.parseInt(b.slice(i * 2, i * 2 + 2), 16);
|
|
7025
7744
|
return out;
|
|
7026
7745
|
}
|
|
7027
|
-
function
|
|
7746
|
+
function bytesToHex7(bytes) {
|
|
7028
7747
|
return `0x${[...bytes].map((b) => b.toString(16).padStart(2, "0")).join("")}`;
|
|
7029
7748
|
}
|
|
7030
7749
|
function expectLength4(value, len, name) {
|
|
@@ -7036,12 +7755,12 @@ function expectLength4(value, len, name) {
|
|
|
7036
7755
|
var PROVER_MARKET_ADDRESS = PRECOMPILE_ADDRESSES.PROVER_MARKET;
|
|
7037
7756
|
var SERVES_GPU_PROVE = 512;
|
|
7038
7757
|
var PROVER_MARKET_SELECTORS = {
|
|
7039
|
-
createRequest: "0x" +
|
|
7040
|
-
submitBid: "0x" +
|
|
7041
|
-
closeRequest: "0x" +
|
|
7042
|
-
submitProof: "0x" +
|
|
7043
|
-
settle: "0x" +
|
|
7044
|
-
slash: "0x" +
|
|
7758
|
+
createRequest: "0x" + selectorHex3("createRequest(bytes)"),
|
|
7759
|
+
submitBid: "0x" + selectorHex3("submitBid(bytes)"),
|
|
7760
|
+
closeRequest: "0x" + selectorHex3("closeRequest(bytes)"),
|
|
7761
|
+
submitProof: "0x" + selectorHex3("submitProof(bytes)"),
|
|
7762
|
+
settle: "0x" + selectorHex3("settle(bytes)"),
|
|
7763
|
+
slash: "0x" + selectorHex3("slash(bytes)")
|
|
7045
7764
|
};
|
|
7046
7765
|
var PROVER_MARKET_EVENT_SIGS = {
|
|
7047
7766
|
proofRequested: "ProofRequested(bytes32,address,bytes32,uint128,uint64)",
|
|
@@ -7079,12 +7798,12 @@ var ProverMarketError = class extends Error {
|
|
|
7079
7798
|
}
|
|
7080
7799
|
};
|
|
7081
7800
|
function requestSighash(vkeyHash, inputsHash, maxFee, deadline, nonce) {
|
|
7082
|
-
return
|
|
7801
|
+
return bytesToHex8(
|
|
7083
7802
|
sha3_js.keccak_256(
|
|
7084
|
-
|
|
7803
|
+
concatBytes7(
|
|
7085
7804
|
new TextEncoder().encode(PROVER_MARKET_REQUEST_DOMAIN),
|
|
7086
|
-
expectLength5(
|
|
7087
|
-
expectLength5(
|
|
7805
|
+
expectLength5(toBytes5(vkeyHash), 32, "vkeyHash"),
|
|
7806
|
+
expectLength5(toBytes5(inputsHash), 32, "inputsHash"),
|
|
7088
7807
|
u128Bytes(maxFee, "maxFee"),
|
|
7089
7808
|
u64Bytes(deadline, "deadline"),
|
|
7090
7809
|
u64Bytes(nonce, "nonce")
|
|
@@ -7093,44 +7812,44 @@ function requestSighash(vkeyHash, inputsHash, maxFee, deadline, nonce) {
|
|
|
7093
7812
|
);
|
|
7094
7813
|
}
|
|
7095
7814
|
function bidSighash(requestId, fee) {
|
|
7096
|
-
return
|
|
7815
|
+
return bytesToHex8(
|
|
7097
7816
|
sha3_js.keccak_256(
|
|
7098
|
-
|
|
7817
|
+
concatBytes7(
|
|
7099
7818
|
new TextEncoder().encode(PROVER_MARKET_BID_DOMAIN),
|
|
7100
|
-
expectLength5(
|
|
7819
|
+
expectLength5(toBytes5(requestId), 32, "requestId"),
|
|
7101
7820
|
u128Bytes(fee, "fee")
|
|
7102
7821
|
)
|
|
7103
7822
|
)
|
|
7104
7823
|
);
|
|
7105
7824
|
}
|
|
7106
7825
|
function submitSighash(requestId, proofHash) {
|
|
7107
|
-
return
|
|
7826
|
+
return bytesToHex8(
|
|
7108
7827
|
sha3_js.keccak_256(
|
|
7109
|
-
|
|
7828
|
+
concatBytes7(
|
|
7110
7829
|
new TextEncoder().encode(PROVER_MARKET_SUBMIT_DOMAIN),
|
|
7111
|
-
expectLength5(
|
|
7112
|
-
expectLength5(
|
|
7830
|
+
expectLength5(toBytes5(requestId), 32, "requestId"),
|
|
7831
|
+
expectLength5(toBytes5(proofHash), 32, "proofHash")
|
|
7113
7832
|
)
|
|
7114
7833
|
)
|
|
7115
7834
|
);
|
|
7116
7835
|
}
|
|
7117
7836
|
function encodeCreateRequestCanonical(args) {
|
|
7118
|
-
const buyer = expectLength5(
|
|
7119
|
-
const buyerPubkey =
|
|
7120
|
-
const sig =
|
|
7837
|
+
const buyer = expectLength5(toBytes5(args.buyer), 20, "buyer");
|
|
7838
|
+
const buyerPubkey = toBytes5(args.buyerPubkey);
|
|
7839
|
+
const sig = toBytes5(args.sig);
|
|
7121
7840
|
if (buyerPubkey.length === 0 || buyerPubkey.length > 65535) {
|
|
7122
7841
|
throw new ProverMarketError("buyerPubkey length out of range (1..=65535)");
|
|
7123
7842
|
}
|
|
7124
7843
|
if (sig.length === 0 || sig.length > 65535) {
|
|
7125
7844
|
throw new ProverMarketError("sig length out of range (1..=65535)");
|
|
7126
7845
|
}
|
|
7127
|
-
return
|
|
7128
|
-
|
|
7846
|
+
return bytesToHex8(
|
|
7847
|
+
concatBytes7(
|
|
7129
7848
|
buyer,
|
|
7130
7849
|
u16Bytes(buyerPubkey.length),
|
|
7131
7850
|
buyerPubkey,
|
|
7132
|
-
expectLength5(
|
|
7133
|
-
expectLength5(
|
|
7851
|
+
expectLength5(toBytes5(args.vkeyHash), 32, "vkeyHash"),
|
|
7852
|
+
expectLength5(toBytes5(args.inputsHash), 32, "inputsHash"),
|
|
7134
7853
|
u128Bytes(args.maxFee, "maxFee"),
|
|
7135
7854
|
u64Bytes(args.deadline, "deadline"),
|
|
7136
7855
|
u64Bytes(args.nonce, "nonce"),
|
|
@@ -7140,7 +7859,7 @@ function encodeCreateRequestCanonical(args) {
|
|
|
7140
7859
|
);
|
|
7141
7860
|
}
|
|
7142
7861
|
function encodeCreateRequestCalldata(args) {
|
|
7143
|
-
const canonical =
|
|
7862
|
+
const canonical = toBytes5(encodeCreateRequestCanonical(args));
|
|
7144
7863
|
const offset = new Uint8Array(32);
|
|
7145
7864
|
offset[31] = 32;
|
|
7146
7865
|
const lenWord = new Uint8Array(32);
|
|
@@ -7150,18 +7869,18 @@ function encodeCreateRequestCalldata(args) {
|
|
|
7150
7869
|
lenWord[30] = len >>> 8 & 255;
|
|
7151
7870
|
lenWord[31] = len & 255;
|
|
7152
7871
|
const pad = (32 - len % 32) % 32;
|
|
7153
|
-
return
|
|
7154
|
-
|
|
7872
|
+
return bytesToHex8(
|
|
7873
|
+
concatBytes7(hexToBytes7(PROVER_MARKET_SELECTORS.createRequest), offset, lenWord, canonical, new Uint8Array(pad))
|
|
7155
7874
|
);
|
|
7156
7875
|
}
|
|
7157
|
-
function
|
|
7876
|
+
function selectorHex3(sig) {
|
|
7158
7877
|
return [...sha3_js.keccak_256(new TextEncoder().encode(sig)).slice(0, 4)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
7159
7878
|
}
|
|
7160
|
-
function
|
|
7161
|
-
if (typeof value === "string") return
|
|
7879
|
+
function toBytes5(value) {
|
|
7880
|
+
if (typeof value === "string") return hexToBytes7(value);
|
|
7162
7881
|
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
7163
7882
|
}
|
|
7164
|
-
function
|
|
7883
|
+
function hexToBytes7(hex) {
|
|
7165
7884
|
const b = hex.startsWith("0x") || hex.startsWith("0X") ? hex.slice(2) : hex;
|
|
7166
7885
|
if (b.length % 2 !== 0 || !/^[0-9a-fA-F]*$/.test(b)) {
|
|
7167
7886
|
throw new ProverMarketError("invalid hex bytes");
|
|
@@ -7170,10 +7889,10 @@ function hexToBytes6(hex) {
|
|
|
7170
7889
|
for (let i = 0; i < out.length; i++) out[i] = Number.parseInt(b.slice(i * 2, i * 2 + 2), 16);
|
|
7171
7890
|
return out;
|
|
7172
7891
|
}
|
|
7173
|
-
function
|
|
7892
|
+
function bytesToHex8(bytes) {
|
|
7174
7893
|
return `0x${[...bytes].map((b) => b.toString(16).padStart(2, "0")).join("")}`;
|
|
7175
7894
|
}
|
|
7176
|
-
function
|
|
7895
|
+
function concatBytes7(...parts) {
|
|
7177
7896
|
const out = new Uint8Array(parts.reduce((acc, p) => acc + p.length, 0));
|
|
7178
7897
|
let offset = 0;
|
|
7179
7898
|
for (const part of parts) {
|
|
@@ -7250,34 +7969,34 @@ function delegationAddressHex() {
|
|
|
7250
7969
|
return PRECOMPILE_ADDRESSES.DELEGATION.toLowerCase();
|
|
7251
7970
|
}
|
|
7252
7971
|
function encodeCompleteRedemptionCalldata(index) {
|
|
7253
|
-
return
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7972
|
+
return bytesToHex9(
|
|
7973
|
+
concatBytes8(
|
|
7974
|
+
hexToBytes8(DELEGATION_SELECTORS.completeRedemption),
|
|
7975
|
+
uint64Word3(index, "index")
|
|
7257
7976
|
)
|
|
7258
7977
|
);
|
|
7259
7978
|
}
|
|
7260
7979
|
function encodeDelegateCalldata(cluster, weightBps) {
|
|
7261
|
-
return
|
|
7262
|
-
|
|
7263
|
-
|
|
7980
|
+
return bytesToHex9(
|
|
7981
|
+
concatBytes8(
|
|
7982
|
+
hexToBytes8(DELEGATION_SELECTORS.delegate),
|
|
7264
7983
|
uint32Word2(cluster, "cluster"),
|
|
7265
7984
|
uint16Word(weightBps, "weightBps")
|
|
7266
7985
|
)
|
|
7267
7986
|
);
|
|
7268
7987
|
}
|
|
7269
7988
|
function encodeUndelegateCalldata(cluster) {
|
|
7270
|
-
return
|
|
7271
|
-
|
|
7272
|
-
|
|
7989
|
+
return bytesToHex9(
|
|
7990
|
+
concatBytes8(
|
|
7991
|
+
hexToBytes8(DELEGATION_SELECTORS.undelegate),
|
|
7273
7992
|
uint32Word2(cluster, "cluster")
|
|
7274
7993
|
)
|
|
7275
7994
|
);
|
|
7276
7995
|
}
|
|
7277
7996
|
function encodeRedelegateCalldata(fromCluster, toCluster, weightBps) {
|
|
7278
|
-
return
|
|
7279
|
-
|
|
7280
|
-
|
|
7997
|
+
return bytesToHex9(
|
|
7998
|
+
concatBytes8(
|
|
7999
|
+
hexToBytes8(DELEGATION_SELECTORS.redelegate),
|
|
7281
8000
|
uint32Word2(fromCluster, "fromCluster"),
|
|
7282
8001
|
uint32Word2(toCluster, "toCluster"),
|
|
7283
8002
|
uint16Word(weightBps, "weightBps")
|
|
@@ -7290,14 +8009,14 @@ function encodeClaimCalldata() {
|
|
|
7290
8009
|
function encodeSetAutoCompoundCalldata(enabled) {
|
|
7291
8010
|
const flag = new Uint8Array(32);
|
|
7292
8011
|
flag[31] = enabled ? 1 : 0;
|
|
7293
|
-
return
|
|
7294
|
-
|
|
8012
|
+
return bytesToHex9(
|
|
8013
|
+
concatBytes8(hexToBytes8(DELEGATION_SELECTORS.setAutoCompound), flag)
|
|
7295
8014
|
);
|
|
7296
8015
|
}
|
|
7297
8016
|
function isRedemptionPrincipalUnavailableRevert(data) {
|
|
7298
|
-
return
|
|
8017
|
+
return bytesToHex9(toBytes6(data)).toLowerCase() === DELEGATION_REVERT_TAGS.redemptionPrincipalUnavailable;
|
|
7299
8018
|
}
|
|
7300
|
-
function
|
|
8019
|
+
function uint64Word3(value, name) {
|
|
7301
8020
|
const n = toBigint3(value, name);
|
|
7302
8021
|
if (n < 0n || n > 0xffffffffffffffffn) {
|
|
7303
8022
|
throw new DelegationPrecompileError(`${name} must fit uint64`);
|
|
@@ -7349,13 +8068,13 @@ function toBigint3(value, name) {
|
|
|
7349
8068
|
}
|
|
7350
8069
|
return BigInt(value);
|
|
7351
8070
|
}
|
|
7352
|
-
function
|
|
8071
|
+
function toBytes6(value) {
|
|
7353
8072
|
if (typeof value === "string") {
|
|
7354
|
-
return
|
|
8073
|
+
return hexToBytes8(value);
|
|
7355
8074
|
}
|
|
7356
8075
|
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
7357
8076
|
}
|
|
7358
|
-
function
|
|
8077
|
+
function hexToBytes8(hex) {
|
|
7359
8078
|
const body = hex.startsWith("0x") || hex.startsWith("0X") ? hex.slice(2) : hex;
|
|
7360
8079
|
if (body.length % 2 !== 0 || !/^[0-9a-fA-F]*$/.test(body)) {
|
|
7361
8080
|
throw new DelegationPrecompileError("invalid hex bytes");
|
|
@@ -7366,10 +8085,10 @@ function hexToBytes7(hex) {
|
|
|
7366
8085
|
}
|
|
7367
8086
|
return out;
|
|
7368
8087
|
}
|
|
7369
|
-
function
|
|
8088
|
+
function bytesToHex9(bytes) {
|
|
7370
8089
|
return `0x${[...bytes].map((b) => b.toString(16).padStart(2, "0")).join("")}`;
|
|
7371
8090
|
}
|
|
7372
|
-
function
|
|
8091
|
+
function concatBytes8(...parts) {
|
|
7373
8092
|
const out = new Uint8Array(parts.reduce((acc, p) => acc + p.length, 0));
|
|
7374
8093
|
let offset = 0;
|
|
7375
8094
|
for (const part of parts) {
|
|
@@ -7378,8 +8097,6 @@ function concatBytes6(...parts) {
|
|
|
7378
8097
|
}
|
|
7379
8098
|
return out;
|
|
7380
8099
|
}
|
|
7381
|
-
|
|
7382
|
-
// src/spending-policy.ts
|
|
7383
8100
|
var SET_POLICY_CLAIM_DOMAIN_TAG = "lyth.spending-policy.claim.v1";
|
|
7384
8101
|
var ML_DSA_65_PUBLIC_KEY_LEN2 = 1952;
|
|
7385
8102
|
var ML_DSA_65_SIGNATURE_LEN2 = 3309;
|
|
@@ -7402,10 +8119,38 @@ var SpendingPolicyError = class extends Error {
|
|
|
7402
8119
|
function spendingPolicyAddressHex() {
|
|
7403
8120
|
return PRECOMPILE_ADDRESSES.SPENDING_POLICY.toLowerCase();
|
|
7404
8121
|
}
|
|
8122
|
+
var EMPTY_ROOT = new Uint8Array(32);
|
|
8123
|
+
function destinationRoot(address) {
|
|
8124
|
+
const bytes = toUserAddressBytes(address, "address");
|
|
8125
|
+
return sha3_js.keccak_256(bytes);
|
|
8126
|
+
}
|
|
8127
|
+
var allowRootFor = destinationRoot;
|
|
8128
|
+
var denyRootFor = destinationRoot;
|
|
8129
|
+
function categoryRoot(selectorOrSig) {
|
|
8130
|
+
let selector;
|
|
8131
|
+
if (typeof selectorOrSig === "string") {
|
|
8132
|
+
selector = sha3_js.keccak_256(new TextEncoder().encode(selectorOrSig)).slice(0, 4);
|
|
8133
|
+
} else {
|
|
8134
|
+
selector = selectorOrSig instanceof Uint8Array ? selectorOrSig : Uint8Array.from(selectorOrSig);
|
|
8135
|
+
if (selector.length !== 4) {
|
|
8136
|
+
throw new SpendingPolicyError("category selector must be exactly 4 bytes");
|
|
8137
|
+
}
|
|
8138
|
+
}
|
|
8139
|
+
return sha3_js.keccak_256(selector);
|
|
8140
|
+
}
|
|
8141
|
+
function setDestinationRoot(entries) {
|
|
8142
|
+
if (entries.length === 0) return EMPTY_ROOT;
|
|
8143
|
+
if (entries.length > 1) {
|
|
8144
|
+
throw new SpendingPolicyError(
|
|
8145
|
+
"multi-entry destination sets are not supported by the chain yet (v1 allows a single counterparty per root); pass exactly one address"
|
|
8146
|
+
);
|
|
8147
|
+
}
|
|
8148
|
+
return destinationRoot(entries[0]);
|
|
8149
|
+
}
|
|
7405
8150
|
function composeClaimBoundMessage(chainId, args, opts) {
|
|
7406
8151
|
const precompileAddress = toRawAddressBytes(opts?.precompileAddress ?? PRECOMPILE_ADDRESSES.SPENDING_POLICY);
|
|
7407
8152
|
const normalized = normalizeArgs(args);
|
|
7408
|
-
return
|
|
8153
|
+
return concatBytes9(
|
|
7409
8154
|
new TextEncoder().encode(SET_POLICY_CLAIM_DOMAIN_TAG),
|
|
7410
8155
|
uint64Bytes(chainId, "chainId"),
|
|
7411
8156
|
precompileAddress,
|
|
@@ -7428,17 +8173,17 @@ function composeClaimBoundMessage(chainId, args, opts) {
|
|
|
7428
8173
|
}
|
|
7429
8174
|
function encodeSetPolicyCalldata(args) {
|
|
7430
8175
|
const normalized = normalizeArgs(args);
|
|
7431
|
-
return
|
|
7432
|
-
|
|
7433
|
-
|
|
8176
|
+
return bytesToHex10(
|
|
8177
|
+
concatBytes9(
|
|
8178
|
+
hexToBytes9(SPENDING_POLICY_SELECTORS.setPolicy),
|
|
7434
8179
|
encodePolicyWords(normalized)
|
|
7435
8180
|
)
|
|
7436
8181
|
);
|
|
7437
8182
|
}
|
|
7438
8183
|
function encodeSetPolicyClaimCalldata(args, subAccountPubkey, subAccountSig) {
|
|
7439
8184
|
const normalized = normalizeArgs(args);
|
|
7440
|
-
const pubkey =
|
|
7441
|
-
const sig =
|
|
8185
|
+
const pubkey = toBytes7(subAccountPubkey);
|
|
8186
|
+
const sig = toBytes7(subAccountSig);
|
|
7442
8187
|
if (pubkey.length !== ML_DSA_65_PUBLIC_KEY_LEN2) {
|
|
7443
8188
|
throw new SpendingPolicyError(
|
|
7444
8189
|
`subAccountPubkey must be ${ML_DSA_65_PUBLIC_KEY_LEN2} bytes, got ${pubkey.length}`
|
|
@@ -7449,9 +8194,9 @@ function encodeSetPolicyClaimCalldata(args, subAccountPubkey, subAccountSig) {
|
|
|
7449
8194
|
`subAccountSig must be ${ML_DSA_65_SIGNATURE_LEN2} bytes, got ${sig.length}`
|
|
7450
8195
|
);
|
|
7451
8196
|
}
|
|
7452
|
-
return
|
|
7453
|
-
|
|
7454
|
-
|
|
8197
|
+
return bytesToHex10(
|
|
8198
|
+
concatBytes9(
|
|
8199
|
+
hexToBytes9(SPENDING_POLICY_SELECTORS.setPolicyClaim),
|
|
7455
8200
|
encodePolicyWords(normalized),
|
|
7456
8201
|
pubkey,
|
|
7457
8202
|
sig
|
|
@@ -7460,15 +8205,15 @@ function encodeSetPolicyClaimCalldata(args, subAccountPubkey, subAccountSig) {
|
|
|
7460
8205
|
}
|
|
7461
8206
|
function encodeClaimPolicyByAddressCalldata(args, subAccountSig) {
|
|
7462
8207
|
const normalized = normalizeArgs(args);
|
|
7463
|
-
const sig =
|
|
8208
|
+
const sig = toBytes7(subAccountSig);
|
|
7464
8209
|
if (sig.length !== ML_DSA_65_SIGNATURE_LEN2) {
|
|
7465
8210
|
throw new SpendingPolicyError(
|
|
7466
8211
|
`subAccountSig must be ${ML_DSA_65_SIGNATURE_LEN2} bytes, got ${sig.length}`
|
|
7467
8212
|
);
|
|
7468
8213
|
}
|
|
7469
|
-
return
|
|
7470
|
-
|
|
7471
|
-
|
|
8214
|
+
return bytesToHex10(
|
|
8215
|
+
concatBytes9(
|
|
8216
|
+
hexToBytes9(SPENDING_POLICY_SELECTORS.claimPolicyByAddress),
|
|
7472
8217
|
encodePolicyWords(normalized),
|
|
7473
8218
|
sig
|
|
7474
8219
|
)
|
|
@@ -7487,17 +8232,17 @@ function normalizeArgs(args) {
|
|
|
7487
8232
|
principal: toUserAddressBytes(args.principal, "principal"),
|
|
7488
8233
|
dailyCapLythoshi: toBigint4(args.dailyCapLythoshi, "dailyCapLythoshi"),
|
|
7489
8234
|
perTxCapLythoshi: toBigint4(args.perTxCapLythoshi, "perTxCapLythoshi"),
|
|
7490
|
-
allowRoot: expectLength6(
|
|
7491
|
-
denyRoot: expectLength6(
|
|
8235
|
+
allowRoot: expectLength6(toBytes7(args.allowRoot), 32, "allowRoot"),
|
|
8236
|
+
denyRoot: expectLength6(toBytes7(args.denyRoot), 32, "denyRoot"),
|
|
7492
8237
|
weeklyCapLythoshi: toBigint4(args.weeklyCapLythoshi ?? 0n, "weeklyCapLythoshi"),
|
|
7493
8238
|
monthlyCapLythoshi: toBigint4(args.monthlyCapLythoshi ?? 0n, "monthlyCapLythoshi"),
|
|
7494
|
-
categoryAllowRoot: args.categoryAllowRoot == null ? ZERO_WORD : expectLength6(
|
|
7495
|
-
timeWindow: args.timeWindow == null ? ZERO_WORD : expectLength6(
|
|
8239
|
+
categoryAllowRoot: args.categoryAllowRoot == null ? ZERO_WORD : expectLength6(toBytes7(args.categoryAllowRoot), 32, "categoryAllowRoot"),
|
|
8240
|
+
timeWindow: args.timeWindow == null ? ZERO_WORD : expectLength6(toBytes7(args.timeWindow), 32, "timeWindow"),
|
|
7496
8241
|
policyExpiry: toBigint4(args.policyExpiry ?? 0n, "policyExpiry")
|
|
7497
8242
|
};
|
|
7498
8243
|
}
|
|
7499
8244
|
function encodePolicyWords(args) {
|
|
7500
|
-
return
|
|
8245
|
+
return concatBytes9(
|
|
7501
8246
|
encodeAddressWord(args.subAccount),
|
|
7502
8247
|
encodeAddressWord(args.principal),
|
|
7503
8248
|
encodeUint128Word(args.dailyCapLythoshi),
|
|
@@ -7522,7 +8267,7 @@ function packTimeWindow(enabled, startHour, endHour) {
|
|
|
7522
8267
|
return out;
|
|
7523
8268
|
}
|
|
7524
8269
|
function decodeTimeWindow(word) {
|
|
7525
|
-
const bytes = expectLength6(
|
|
8270
|
+
const bytes = expectLength6(toBytes7(word), 32, "timeWindow");
|
|
7526
8271
|
if (bytes.every((b) => b === 0)) return null;
|
|
7527
8272
|
if (bytes[29] === 0) return null;
|
|
7528
8273
|
return [Math.min(bytes[30], 23), Math.min(bytes[31], 23)];
|
|
@@ -7534,16 +8279,16 @@ function clampHour(hour) {
|
|
|
7534
8279
|
return Math.min(hour, 23);
|
|
7535
8280
|
}
|
|
7536
8281
|
function encodeUint64Word(value) {
|
|
7537
|
-
return
|
|
8282
|
+
return concatBytes9(new Uint8Array(24), uint64Bytes(value, "policyExpiry"));
|
|
7538
8283
|
}
|
|
7539
8284
|
function encodeSingleAddressCall(selector, address, name) {
|
|
7540
|
-
return
|
|
8285
|
+
return bytesToHex10(concatBytes9(hexToBytes9(selector), encodeAddressWord(toUserAddressBytes(address, name))));
|
|
7541
8286
|
}
|
|
7542
8287
|
function encodeAddressWord(address) {
|
|
7543
|
-
return
|
|
8288
|
+
return concatBytes9(new Uint8Array(12), address);
|
|
7544
8289
|
}
|
|
7545
8290
|
function encodeUint128Word(value) {
|
|
7546
|
-
return
|
|
8291
|
+
return concatBytes9(new Uint8Array(16), uint128Bytes(value, "uint128"));
|
|
7547
8292
|
}
|
|
7548
8293
|
function toUserAddressBytes(value, name) {
|
|
7549
8294
|
if (typeof value !== "string") {
|
|
@@ -7565,13 +8310,13 @@ function toRawAddressBytes(value) {
|
|
|
7565
8310
|
}
|
|
7566
8311
|
return expectLength6(value instanceof Uint8Array ? value : Uint8Array.from(value), 20, "address");
|
|
7567
8312
|
}
|
|
7568
|
-
function
|
|
8313
|
+
function toBytes7(value) {
|
|
7569
8314
|
if (typeof value === "string") {
|
|
7570
|
-
return
|
|
8315
|
+
return hexToBytes9(value);
|
|
7571
8316
|
}
|
|
7572
8317
|
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
7573
8318
|
}
|
|
7574
|
-
function
|
|
8319
|
+
function hexToBytes9(hex) {
|
|
7575
8320
|
const body = hex.startsWith("0x") || hex.startsWith("0X") ? hex.slice(2) : hex;
|
|
7576
8321
|
if (body.length % 2 !== 0 || !/^[0-9a-fA-F]*$/.test(body)) {
|
|
7577
8322
|
throw new SpendingPolicyError("invalid hex bytes");
|
|
@@ -7582,10 +8327,10 @@ function hexToBytes8(hex) {
|
|
|
7582
8327
|
}
|
|
7583
8328
|
return out;
|
|
7584
8329
|
}
|
|
7585
|
-
function
|
|
8330
|
+
function bytesToHex10(bytes) {
|
|
7586
8331
|
return `0x${[...bytes].map((b) => b.toString(16).padStart(2, "0")).join("")}`;
|
|
7587
8332
|
}
|
|
7588
|
-
function
|
|
8333
|
+
function concatBytes9(...parts) {
|
|
7589
8334
|
const out = new Uint8Array(parts.reduce((acc, p) => acc + p.length, 0));
|
|
7590
8335
|
let offset = 0;
|
|
7591
8336
|
for (const part of parts) {
|
|
@@ -7647,17 +8392,17 @@ function pubkeyRegistryAddressHex() {
|
|
|
7647
8392
|
return PRECOMPILE_ADDRESSES.PUBKEY_REGISTRY.toLowerCase();
|
|
7648
8393
|
}
|
|
7649
8394
|
function encodeRegisterPubkeyCalldata(pubkey) {
|
|
7650
|
-
const bytes =
|
|
8395
|
+
const bytes = toBytes8(pubkey);
|
|
7651
8396
|
if (bytes.length !== PUBKEY_REGISTRY_ML_DSA_65_PUBLIC_KEY_LEN) {
|
|
7652
8397
|
throw new PubkeyRegistryError(
|
|
7653
8398
|
`pubkey must be ${PUBKEY_REGISTRY_ML_DSA_65_PUBLIC_KEY_LEN} bytes, got ${bytes.length}`
|
|
7654
8399
|
);
|
|
7655
8400
|
}
|
|
7656
|
-
return
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
8401
|
+
return bytesToHex11(
|
|
8402
|
+
concatBytes10(
|
|
8403
|
+
hexToBytes10(PUBKEY_REGISTRY_SELECTORS.registerPubkey),
|
|
8404
|
+
uint256Word2(32n),
|
|
8405
|
+
uint256Word2(BigInt(bytes.length)),
|
|
7661
8406
|
bytes
|
|
7662
8407
|
)
|
|
7663
8408
|
);
|
|
@@ -7669,7 +8414,7 @@ function encodeHasPubkeyCalldata(address) {
|
|
|
7669
8414
|
return encodeSingleAddressCall2(PUBKEY_REGISTRY_SELECTORS.hasPubkey, address);
|
|
7670
8415
|
}
|
|
7671
8416
|
function decodeLookupPubkeyReturn(data) {
|
|
7672
|
-
const bytes =
|
|
8417
|
+
const bytes = toBytes8(data);
|
|
7673
8418
|
if (bytes.length < 96) {
|
|
7674
8419
|
throw new PubkeyRegistryError("lookup return must be at least 96 bytes");
|
|
7675
8420
|
}
|
|
@@ -7694,7 +8439,7 @@ function decodeLookupPubkeyReturn(data) {
|
|
|
7694
8439
|
};
|
|
7695
8440
|
}
|
|
7696
8441
|
function decodeHasPubkeyReturn(data) {
|
|
7697
|
-
const bytes =
|
|
8442
|
+
const bytes = toBytes8(data);
|
|
7698
8443
|
if (bytes.length !== 32) {
|
|
7699
8444
|
throw new PubkeyRegistryError("hasPubkey return must be 32 bytes");
|
|
7700
8445
|
}
|
|
@@ -7708,10 +8453,10 @@ function decodeHasPubkeyReturn(data) {
|
|
|
7708
8453
|
throw new PubkeyRegistryError("hasPubkey bool must be 0 or 1");
|
|
7709
8454
|
}
|
|
7710
8455
|
function encodeSingleAddressCall2(selector, address) {
|
|
7711
|
-
return
|
|
8456
|
+
return bytesToHex11(concatBytes10(hexToBytes10(selector), addressWord3(toAddressBytes(address))));
|
|
7712
8457
|
}
|
|
7713
|
-
function
|
|
7714
|
-
return
|
|
8458
|
+
function addressWord3(address) {
|
|
8459
|
+
return concatBytes10(new Uint8Array(12), address);
|
|
7715
8460
|
}
|
|
7716
8461
|
function toAddressBytes(value) {
|
|
7717
8462
|
if (typeof value !== "string") {
|
|
@@ -7727,13 +8472,13 @@ function toAddressBytes(value) {
|
|
|
7727
8472
|
throw new PubkeyRegistryError(`address must be a typed mono bech32m address${detail}`);
|
|
7728
8473
|
}
|
|
7729
8474
|
}
|
|
7730
|
-
function
|
|
8475
|
+
function toBytes8(value) {
|
|
7731
8476
|
if (typeof value === "string") {
|
|
7732
|
-
return
|
|
8477
|
+
return hexToBytes10(value);
|
|
7733
8478
|
}
|
|
7734
8479
|
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
7735
8480
|
}
|
|
7736
|
-
function
|
|
8481
|
+
function hexToBytes10(hex) {
|
|
7737
8482
|
const body = hex.startsWith("0x") || hex.startsWith("0X") ? hex.slice(2) : hex;
|
|
7738
8483
|
if (body.length % 2 !== 0 || !/^[0-9a-fA-F]*$/.test(body)) {
|
|
7739
8484
|
throw new PubkeyRegistryError("invalid hex bytes");
|
|
@@ -7744,10 +8489,10 @@ function hexToBytes9(hex) {
|
|
|
7744
8489
|
}
|
|
7745
8490
|
return out;
|
|
7746
8491
|
}
|
|
7747
|
-
function
|
|
8492
|
+
function bytesToHex11(bytes) {
|
|
7748
8493
|
return `0x${[...bytes].map((b) => b.toString(16).padStart(2, "0")).join("")}`;
|
|
7749
8494
|
}
|
|
7750
|
-
function
|
|
8495
|
+
function concatBytes10(...parts) {
|
|
7751
8496
|
const out = new Uint8Array(parts.reduce((acc, p) => acc + p.length, 0));
|
|
7752
8497
|
let offset = 0;
|
|
7753
8498
|
for (const part of parts) {
|
|
@@ -7756,7 +8501,7 @@ function concatBytes8(...parts) {
|
|
|
7756
8501
|
}
|
|
7757
8502
|
return out;
|
|
7758
8503
|
}
|
|
7759
|
-
function
|
|
8504
|
+
function uint256Word2(value) {
|
|
7760
8505
|
if (value < 0n || value > (1n << 256n) - 1n) {
|
|
7761
8506
|
throw new PubkeyRegistryError("uint256 value out of range");
|
|
7762
8507
|
}
|
|
@@ -7904,9 +8649,9 @@ function encodePlaceLimitOrderCalldata(args) {
|
|
|
7904
8649
|
normalized.baseTokenId,
|
|
7905
8650
|
normalized.quoteTokenId,
|
|
7906
8651
|
uint8Word2(normalized.side),
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
8652
|
+
uint256Word3(normalized.price, "price"),
|
|
8653
|
+
uint256Word3(normalized.quantity, "quantity"),
|
|
8654
|
+
uint64Word4(normalized.expiryBlock, "expiryBlock")
|
|
7910
8655
|
)
|
|
7911
8656
|
);
|
|
7912
8657
|
}
|
|
@@ -7918,7 +8663,7 @@ function encodePlaceMarketOrderCalldata(args) {
|
|
|
7918
8663
|
normalized.baseTokenId,
|
|
7919
8664
|
normalized.quoteTokenId,
|
|
7920
8665
|
uint8Word2(normalized.side),
|
|
7921
|
-
|
|
8666
|
+
uint256Word3(normalized.quantity, "quantity"),
|
|
7922
8667
|
uint16Word2(normalized.maxSlippageBps, "maxSlippageBps")
|
|
7923
8668
|
)
|
|
7924
8669
|
);
|
|
@@ -7931,7 +8676,7 @@ function encodePlaceMarketOrderExCalldata(args) {
|
|
|
7931
8676
|
normalized.baseTokenId,
|
|
7932
8677
|
normalized.quoteTokenId,
|
|
7933
8678
|
uint8Word2(normalized.side),
|
|
7934
|
-
|
|
8679
|
+
uint256Word3(normalized.quantity, "quantity"),
|
|
7935
8680
|
uint16Word2(normalized.maxSlippageBps, "maxSlippageBps"),
|
|
7936
8681
|
uint8Word2(normalized.mode)
|
|
7937
8682
|
)
|
|
@@ -7951,7 +8696,7 @@ function encodeMarketGridTuneCalldata(selector, label, args) {
|
|
|
7951
8696
|
hexToBytes2(selector, `${label} selector`),
|
|
7952
8697
|
bytes32FromHex(args.baseTokenId, "baseTokenId"),
|
|
7953
8698
|
bytes32FromHex(args.quoteTokenId, "quoteTokenId"),
|
|
7954
|
-
|
|
8699
|
+
uint256Word3(BigInt(args.newValue), "newValue")
|
|
7955
8700
|
)
|
|
7956
8701
|
);
|
|
7957
8702
|
}
|
|
@@ -8239,13 +8984,13 @@ function encodePlaceLimitOrderViaCalldata(args) {
|
|
|
8239
8984
|
return bytesToHex2(
|
|
8240
8985
|
concatBytes2(
|
|
8241
8986
|
hexToBytes2(OPERATOR_ROUTER_SELECTORS.placeLimitOrderVia, "placeLimitOrderVia selector"),
|
|
8242
|
-
|
|
8987
|
+
addressWord4(operator.bytes),
|
|
8243
8988
|
bytes32FromHex(args.base, "base"),
|
|
8244
8989
|
bytes32FromHex(args.quote, "quote"),
|
|
8245
8990
|
uint8Word2(side),
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8991
|
+
uint256Word3(price, "price"),
|
|
8992
|
+
uint256Word3(amount, "amount"),
|
|
8993
|
+
uint64Word4(expiresAtBlock, "expiresAtBlock")
|
|
8249
8994
|
)
|
|
8250
8995
|
);
|
|
8251
8996
|
}
|
|
@@ -8535,7 +9280,7 @@ function uint8Word2(value) {
|
|
|
8535
9280
|
out[31] = value;
|
|
8536
9281
|
return out;
|
|
8537
9282
|
}
|
|
8538
|
-
function
|
|
9283
|
+
function uint64Word4(value, name) {
|
|
8539
9284
|
if (value < 0n || value > 0xffffffffffffffffn) {
|
|
8540
9285
|
throw new MarketActionError(`${name} must fit uint64`);
|
|
8541
9286
|
}
|
|
@@ -8556,7 +9301,7 @@ function uint16Word2(value, name) {
|
|
|
8556
9301
|
out[31] = Number(value & 0xffn);
|
|
8557
9302
|
return out;
|
|
8558
9303
|
}
|
|
8559
|
-
function
|
|
9304
|
+
function uint256Word3(value, name) {
|
|
8560
9305
|
if (value < 0n || value >= 1n << 256n) {
|
|
8561
9306
|
throw new MarketActionError(`${name} must fit uint256`);
|
|
8562
9307
|
}
|
|
@@ -8568,7 +9313,7 @@ function uint256Word2(value, name) {
|
|
|
8568
9313
|
}
|
|
8569
9314
|
return out;
|
|
8570
9315
|
}
|
|
8571
|
-
function
|
|
9316
|
+
function addressWord4(addr) {
|
|
8572
9317
|
if (addr.length !== 20) {
|
|
8573
9318
|
throw new MarketActionError("address must be 20 bytes");
|
|
8574
9319
|
}
|
|
@@ -9132,7 +9877,9 @@ exports.DELEGATION_REVERT_TAGS = DELEGATION_REVERT_TAGS;
|
|
|
9132
9877
|
exports.DELEGATION_SELECTORS = DELEGATION_SELECTORS;
|
|
9133
9878
|
exports.DIVERSITY_SCORE_MAX = DIVERSITY_SCORE_MAX;
|
|
9134
9879
|
exports.DelegationPrecompileError = DelegationPrecompileError;
|
|
9880
|
+
exports.EMPTY_ROOT = EMPTY_ROOT;
|
|
9135
9881
|
exports.EXECUTION_UNIT_PRICE_SAFETY_MULTIPLIER = EXECUTION_UNIT_PRICE_SAFETY_MULTIPLIER;
|
|
9882
|
+
exports.FEED_ID_DOMAIN_TAG = FEED_ID_DOMAIN_TAG;
|
|
9136
9883
|
exports.LYTHOSHI_PER_LYTH = LYTHOSHI_PER_LYTH;
|
|
9137
9884
|
exports.LYTH_DECIMALS = LYTH_DECIMALS;
|
|
9138
9885
|
exports.MAX_NATIVE_CALL_FORWARDER_REQUEST_BYTES = MAX_NATIVE_CALL_FORWARDER_REQUEST_BYTES;
|
|
@@ -9158,6 +9905,12 @@ exports.MRV_TX_EXTENSION_V1 = MRV_TX_EXTENSION_V1;
|
|
|
9158
9905
|
exports.MULTISIG_ADDRESS_DERIVATION_DOMAIN = MULTISIG_ADDRESS_DERIVATION_DOMAIN;
|
|
9159
9906
|
exports.MarketActionError = MarketActionError;
|
|
9160
9907
|
exports.MrvValidationError = MrvValidationError;
|
|
9908
|
+
exports.NAME_BASE_MULTIPLIER = NAME_BASE_MULTIPLIER;
|
|
9909
|
+
exports.NAME_FALLBACK_FEE_UNIT_LYTHOSHI = NAME_FALLBACK_FEE_UNIT_LYTHOSHI;
|
|
9910
|
+
exports.NAME_LABEL_MAX_LEN = NAME_LABEL_MAX_LEN;
|
|
9911
|
+
exports.NAME_LABEL_MIN_LEN = NAME_LABEL_MIN_LEN;
|
|
9912
|
+
exports.NAME_MAX_LEN = NAME_MAX_LEN;
|
|
9913
|
+
exports.NAME_REGISTRY_SELECTORS = NAME_REGISTRY_SELECTORS;
|
|
9161
9914
|
exports.NATIVE_AGENT_MODULE_ADDRESS = NATIVE_AGENT_MODULE_ADDRESS;
|
|
9162
9915
|
exports.NATIVE_AGENT_MODULE_ADDRESS_BYTES = NATIVE_AGENT_MODULE_ADDRESS_BYTES;
|
|
9163
9916
|
exports.NATIVE_CALL_FORWARDER_ARTIFACT_PROFILE = NATIVE_CALL_FORWARDER_ARTIFACT_PROFILE;
|
|
@@ -9171,8 +9924,13 @@ exports.NATIVE_MARKET_EVENT_FAMILY = NATIVE_MARKET_EVENT_FAMILY;
|
|
|
9171
9924
|
exports.NATIVE_MARKET_MODULE_ADDRESS = NATIVE_MARKET_MODULE_ADDRESS;
|
|
9172
9925
|
exports.NATIVE_MARKET_MODULE_ADDRESS_BYTES = NATIVE_MARKET_MODULE_ADDRESS_BYTES;
|
|
9173
9926
|
exports.NATIVE_MARKET_ORDER_BOOK_STREAM_TOPIC = NATIVE_MARKET_ORDER_BOOK_STREAM_TOPIC;
|
|
9927
|
+
exports.NODE_REGISTRY_BLS_PUBKEY_BYTES = NODE_REGISTRY_BLS_PUBKEY_BYTES;
|
|
9174
9928
|
exports.NODE_REGISTRY_CAPABILITIES = NODE_REGISTRY_CAPABILITIES;
|
|
9175
9929
|
exports.NODE_REGISTRY_CAPABILITY_MASK = NODE_REGISTRY_CAPABILITY_MASK;
|
|
9930
|
+
exports.NODE_REGISTRY_DKG_RESHARE_MAX_SIGNERS = NODE_REGISTRY_DKG_RESHARE_MAX_SIGNERS;
|
|
9931
|
+
exports.NODE_REGISTRY_DKG_RESHARE_MIN_SIGNERS = NODE_REGISTRY_DKG_RESHARE_MIN_SIGNERS;
|
|
9932
|
+
exports.NODE_REGISTRY_DKG_THRESHOLD_SIG_BYTES = NODE_REGISTRY_DKG_THRESHOLD_SIG_BYTES;
|
|
9933
|
+
exports.NODE_REGISTRY_PENDING_CHANGE_MAX_INTENT_ID = NODE_REGISTRY_PENDING_CHANGE_MAX_INTENT_ID;
|
|
9176
9934
|
exports.NODE_REGISTRY_PUBLIC_SERVICE_MASK = NODE_REGISTRY_PUBLIC_SERVICE_MASK;
|
|
9177
9935
|
exports.NODE_REGISTRY_SELECTORS = NODE_REGISTRY_SELECTORS;
|
|
9178
9936
|
exports.NO_EVM_ARCHIVE_PROOF_SCHEMA = NO_EVM_ARCHIVE_PROOF_SCHEMA;
|
|
@@ -9184,6 +9942,7 @@ exports.NO_EVM_RECEIPT_CODEC = NO_EVM_RECEIPT_CODEC;
|
|
|
9184
9942
|
exports.NO_EVM_RECEIPT_PROOF_SCHEMA = NO_EVM_RECEIPT_PROOF_SCHEMA;
|
|
9185
9943
|
exports.NO_EVM_RECEIPT_PROOF_TYPE = NO_EVM_RECEIPT_PROOF_TYPE;
|
|
9186
9944
|
exports.NO_EVM_RECEIPT_ROOT_ALGORITHM = NO_EVM_RECEIPT_ROOT_ALGORITHM;
|
|
9945
|
+
exports.NameRegistryError = NameRegistryError;
|
|
9187
9946
|
exports.NoEvmReceiptProofError = NoEvmReceiptProofError;
|
|
9188
9947
|
exports.NodeRegistryError = NodeRegistryError;
|
|
9189
9948
|
exports.OPERATOR_ROUTER_ADDRESS = OPERATOR_ROUTER_ADDRESS;
|
|
@@ -9192,6 +9951,7 @@ exports.OPERATOR_ROUTER_SELECTORS = OPERATOR_ROUTER_SELECTORS;
|
|
|
9192
9951
|
exports.OPERATOR_ROUTER_SIGS = OPERATOR_ROUTER_SIGS;
|
|
9193
9952
|
exports.ORACLE_EVENT_SIGS = ORACLE_EVENT_SIGS;
|
|
9194
9953
|
exports.OracleEventError = OracleEventError;
|
|
9954
|
+
exports.PENDING_CHANGE_KIND_CODES = PENDING_CHANGE_KIND_CODES;
|
|
9195
9955
|
exports.PRECOMPILE_ADDRESSES = PRECOMPILE_ADDRESSES;
|
|
9196
9956
|
exports.PROTOCOL_MAX_OPERATOR_FEE_BPS = PROTOCOL_MAX_OPERATOR_FEE_BPS;
|
|
9197
9957
|
exports.PROVER_MARKET_ADDRESS = PROVER_MARKET_ADDRESS;
|
|
@@ -9222,6 +9982,7 @@ exports.V1_BRIDGE_ALLOWED_PROTOCOL = V1_BRIDGE_ALLOWED_PROTOCOL;
|
|
|
9222
9982
|
exports.addressBytesToHex = addressBytesToHex;
|
|
9223
9983
|
exports.addressToBech32 = addressToBech32;
|
|
9224
9984
|
exports.addressToTypedBech32 = addressToTypedBech32;
|
|
9985
|
+
exports.allowRootFor = allowRootFor;
|
|
9225
9986
|
exports.apiEndpointFromRpcEndpoint = apiEndpointFromRpcEndpoint;
|
|
9226
9987
|
exports.assertMrvCallNativeSubmissionPlan = assertMrvCallNativeSubmissionPlan;
|
|
9227
9988
|
exports.assertMrvDeployNativeSubmissionPlan = assertMrvDeployNativeSubmissionPlan;
|
|
@@ -9286,11 +10047,13 @@ exports.buildPlaceLimitOrderViaPlan = buildPlaceLimitOrderViaPlan;
|
|
|
9286
10047
|
exports.buildPlaceSpotLimitOrderPlan = buildPlaceSpotLimitOrderPlan;
|
|
9287
10048
|
exports.buildPlaceSpotMarketOrderExPlan = buildPlaceSpotMarketOrderExPlan;
|
|
9288
10049
|
exports.buildPlaceSpotMarketOrderPlan = buildPlaceSpotMarketOrderPlan;
|
|
10050
|
+
exports.categoryRoot = categoryRoot;
|
|
9289
10051
|
exports.checkMrvFeeDisplayConformance = checkMrvFeeDisplayConformance;
|
|
9290
10052
|
exports.checkMrvStructuredFeeConformance = checkMrvStructuredFeeConformance;
|
|
9291
10053
|
exports.checkNativeDevkitCompatibility = checkNativeDevkitCompatibility;
|
|
9292
10054
|
exports.clampPriorityTip = clampPriorityTip;
|
|
9293
10055
|
exports.clobAddressHex = clobAddressHex;
|
|
10056
|
+
exports.clusterApyPercent = clusterApyPercent;
|
|
9294
10057
|
exports.compareNativeDevVersions = compareNativeDevVersions;
|
|
9295
10058
|
exports.composeClaimBoundMessage = composeClaimBoundMessage;
|
|
9296
10059
|
exports.computeNoEvmDacFinalityMessage = computeNoEvmDacFinalityMessage;
|
|
@@ -9298,6 +10061,7 @@ exports.computeNoEvmLeaderFinalityMessage = computeNoEvmLeaderFinalityMessage;
|
|
|
9298
10061
|
exports.computeNoEvmReceiptsRoot = computeNoEvmReceiptsRoot;
|
|
9299
10062
|
exports.computeNoEvmRoundFinalityMessage = computeNoEvmRoundFinalityMessage;
|
|
9300
10063
|
exports.computeNoEvmTargetReceiptHash = computeNoEvmTargetReceiptHash;
|
|
10064
|
+
exports.computeQuoteLiquidity = computeQuoteLiquidity;
|
|
9301
10065
|
exports.consumeNativeEvents = consumeNativeEvents;
|
|
9302
10066
|
exports.decodeClusterDiversity = decodeClusterDiversity;
|
|
9303
10067
|
exports.decodeClusterFormedEvent = decodeClusterFormedEvent;
|
|
@@ -9313,13 +10077,20 @@ exports.decodeOracleEvent = decodeOracleEvent;
|
|
|
9313
10077
|
exports.decodeTimeWindow = decodeTimeWindow;
|
|
9314
10078
|
exports.decodeTxFeedResponse = decodeTxFeedResponse;
|
|
9315
10079
|
exports.delegationAddressHex = delegationAddressHex;
|
|
10080
|
+
exports.denyRootFor = denyRootFor;
|
|
9316
10081
|
exports.deriveClobMarketId = deriveClobMarketId;
|
|
9317
10082
|
exports.deriveClusterAnchorAddress = deriveClusterAnchorAddress;
|
|
10083
|
+
exports.deriveFeedId = deriveFeedId;
|
|
9318
10084
|
exports.deriveMrvContractAddress = deriveMrvContractAddress;
|
|
9319
10085
|
exports.deriveNativeSpotMarketId = deriveNativeSpotMarketId;
|
|
9320
10086
|
exports.deriveNativeSpotOrderId = deriveNativeSpotOrderId;
|
|
10087
|
+
exports.destinationRoot = destinationRoot;
|
|
10088
|
+
exports.encodeAttestDkgReshareCalldata = encodeAttestDkgReshareCalldata;
|
|
9321
10089
|
exports.encodeBlockSelector = encodeBlockSelector;
|
|
10090
|
+
exports.encodeBridgeChallengeCalldata = encodeBridgeChallengeCalldata;
|
|
10091
|
+
exports.encodeBridgeClaimCalldata = encodeBridgeClaimCalldata;
|
|
9322
10092
|
exports.encodeCancelOrderCalldata = encodeCancelOrderCalldata;
|
|
10093
|
+
exports.encodeCancelPendingChangeCalldata = encodeCancelPendingChangeCalldata;
|
|
9323
10094
|
exports.encodeClaimCalldata = encodeClaimCalldata;
|
|
9324
10095
|
exports.encodeClaimPolicyByAddressCalldata = encodeClaimPolicyByAddressCalldata;
|
|
9325
10096
|
exports.encodeCompleteRedemptionCalldata = encodeCompleteRedemptionCalldata;
|
|
@@ -9332,6 +10103,9 @@ exports.encodeHasPubkeyCalldata = encodeHasPubkeyCalldata;
|
|
|
9332
10103
|
exports.encodeLockBridgeConfigCalldata = encodeLockBridgeConfigCalldata;
|
|
9333
10104
|
exports.encodeLookupPubkeyCalldata = encodeLookupPubkeyCalldata;
|
|
9334
10105
|
exports.encodeMrvDeployPayload = encodeMrvDeployPayload;
|
|
10106
|
+
exports.encodeNameAcceptTransferCall = encodeNameAcceptTransferCall;
|
|
10107
|
+
exports.encodeNameProposeTransferCall = encodeNameProposeTransferCall;
|
|
10108
|
+
exports.encodeNameRegisterCall = encodeNameRegisterCall;
|
|
9335
10109
|
exports.encodeNativeAgentAcceptEscrowCall = encodeNativeAgentAcceptEscrowCall;
|
|
9336
10110
|
exports.encodeNativeAgentApproveEscrowCall = encodeNativeAgentApproveEscrowCall;
|
|
9337
10111
|
exports.encodeNativeAgentArbiterGetCall = encodeNativeAgentArbiterGetCall;
|
|
@@ -9381,6 +10155,7 @@ exports.encodePlaceLimitOrderCalldata = encodePlaceLimitOrderCalldata;
|
|
|
9381
10155
|
exports.encodePlaceLimitOrderViaCalldata = encodePlaceLimitOrderViaCalldata;
|
|
9382
10156
|
exports.encodePlaceMarketOrderCalldata = encodePlaceMarketOrderCalldata;
|
|
9383
10157
|
exports.encodePlaceMarketOrderExCalldata = encodePlaceMarketOrderExCalldata;
|
|
10158
|
+
exports.encodeRecoverOperatorNodeCalldata = encodeRecoverOperatorNodeCalldata;
|
|
9384
10159
|
exports.encodeRedelegateCalldata = encodeRedelegateCalldata;
|
|
9385
10160
|
exports.encodeRegisterPubkeyCalldata = encodeRegisterPubkeyCalldata;
|
|
9386
10161
|
exports.encodeReportServiceProbeCalldata = encodeReportServiceProbeCalldata;
|
|
@@ -9392,6 +10167,8 @@ exports.encodeSetMinNotionalCalldata = encodeSetMinNotionalCalldata;
|
|
|
9392
10167
|
exports.encodeSetPolicyCalldata = encodeSetPolicyCalldata;
|
|
9393
10168
|
exports.encodeSetPolicyClaimCalldata = encodeSetPolicyClaimCalldata;
|
|
9394
10169
|
exports.encodeSetTickSizeCalldata = encodeSetTickSizeCalldata;
|
|
10170
|
+
exports.encodeSubmitBridgeProofCalldata = encodeSubmitBridgeProofCalldata;
|
|
10171
|
+
exports.encodeSubmitPendingChangeCalldata = encodeSubmitPendingChangeCalldata;
|
|
9395
10172
|
exports.encodeUndelegateCalldata = encodeUndelegateCalldata;
|
|
9396
10173
|
exports.exportBridgeRouteCatalogueJson = exportBridgeRouteCatalogueJson;
|
|
9397
10174
|
exports.fetchChainInfoLatest = fetchChainInfoLatest;
|
|
@@ -9399,6 +10176,7 @@ exports.fetchChainRegistryLatest = fetchChainRegistryLatest;
|
|
|
9399
10176
|
exports.formatLyth = formatLyth;
|
|
9400
10177
|
exports.formatLythoshi = formatLythoshi;
|
|
9401
10178
|
exports.formatNativeReceiptFeeDisplay = formatNativeReceiptFeeDisplay;
|
|
10179
|
+
exports.formatOraclePrice = formatOraclePrice;
|
|
9402
10180
|
exports.getChainInfo = getChainInfo;
|
|
9403
10181
|
exports.getNoEvmReceiptTrustPolicy = getNoEvmReceiptTrustPolicy;
|
|
9404
10182
|
exports.getP2pSeeds = getP2pSeeds;
|
|
@@ -9419,6 +10197,9 @@ exports.mrvAddressToBech32 = mrvAddressToBech32;
|
|
|
9419
10197
|
exports.mrvBech32ToAddress = mrvBech32ToAddress;
|
|
9420
10198
|
exports.mrvCodeHashHex = mrvCodeHashHex;
|
|
9421
10199
|
exports.mrvV1TransactionExtension = mrvV1TransactionExtension;
|
|
10200
|
+
exports.nameLengthModifierX10 = nameLengthModifierX10;
|
|
10201
|
+
exports.nameRegistrationCost = nameRegistrationCost;
|
|
10202
|
+
exports.nameRegistryAddressHex = nameRegistryAddressHex;
|
|
9422
10203
|
exports.nativeAgentStateFilterParams = nativeAgentStateFilterParams;
|
|
9423
10204
|
exports.nativeDevSchemaFieldNames = nativeDevSchemaFieldNames;
|
|
9424
10205
|
exports.nativeDevUiStrings = nativeDevUiStrings;
|
|
@@ -9436,12 +10217,16 @@ exports.nodeHostingClassToByte = nodeHostingClassToByte;
|
|
|
9436
10217
|
exports.nodeRegistryAddressHex = nodeRegistryAddressHex;
|
|
9437
10218
|
exports.normalizeAddressHex = normalizeAddressHex;
|
|
9438
10219
|
exports.normalizeBridgeRouteCatalogue = normalizeBridgeRouteCatalogue;
|
|
10220
|
+
exports.normalizePendingChangeKind = normalizePendingChangeKind;
|
|
9439
10221
|
exports.oracleAddressHex = oracleAddressHex;
|
|
10222
|
+
exports.oraclePriceToNumber = oraclePriceToNumber;
|
|
9440
10223
|
exports.packTimeWindow = packTimeWindow;
|
|
9441
10224
|
exports.parseAddress = parseAddress;
|
|
9442
10225
|
exports.parseBridgeRouteCatalogueJson = parseBridgeRouteCatalogueJson;
|
|
9443
10226
|
exports.parseChainRegistryToml = parseChainRegistryToml;
|
|
10227
|
+
exports.parseDkgResharePublicKeys = parseDkgResharePublicKeys;
|
|
9444
10228
|
exports.parseLythToLythoshi = parseLythToLythoshi;
|
|
10229
|
+
exports.parseNameCategory = parseNameCategory;
|
|
9445
10230
|
exports.parseNativeDecodedEvent = parseNativeDecodedEvent;
|
|
9446
10231
|
exports.parseQuantity = parseQuantity;
|
|
9447
10232
|
exports.parseQuantityBig = parseQuantityBig;
|
|
@@ -9449,6 +10234,7 @@ exports.proverMarketStateFromByte = proverMarketStateFromByte;
|
|
|
9449
10234
|
exports.pubkeyRegistryAddressHex = pubkeyRegistryAddressHex;
|
|
9450
10235
|
exports.quoteOperatorFee = quoteOperatorFee;
|
|
9451
10236
|
exports.rankBridgeRoutes = rankBridgeRoutes;
|
|
10237
|
+
exports.rankMarketsByVolume = rankMarketsByVolume;
|
|
9452
10238
|
exports.requestSighash = requestSighash;
|
|
9453
10239
|
exports.requireTypedAddress = requireTypedAddress;
|
|
9454
10240
|
exports.resolveExecutionFee = resolveExecutionFee;
|
|
@@ -9457,6 +10243,7 @@ exports.resolveRegistryExecutionFee = resolveRegistryExecutionFee;
|
|
|
9457
10243
|
exports.resolveStudioHostStatus = resolveStudioHostStatus;
|
|
9458
10244
|
exports.selectBridgeTransferRoute = selectBridgeTransferRoute;
|
|
9459
10245
|
exports.serviceProbeStatusLabel = serviceProbeStatusLabel;
|
|
10246
|
+
exports.setDestinationRoot = setDestinationRoot;
|
|
9460
10247
|
exports.spendingPolicyAddressHex = spendingPolicyAddressHex;
|
|
9461
10248
|
exports.submitMrvCallNativeTx = submitMrvCallNativeTx;
|
|
9462
10249
|
exports.submitMrvDeployNativeTx = submitMrvDeployNativeTx;
|