@monolythium/core-sdk 0.4.23 → 0.5.0
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 +17 -9
- package/dist/crypto/index.cjs +51 -617
- package/dist/crypto/index.cjs.map +1 -1
- package/dist/crypto/index.d.cts +116 -31
- package/dist/crypto/index.d.ts +116 -31
- package/dist/crypto/index.js +44 -564
- package/dist/crypto/index.js.map +1 -1
- package/dist/index.cjs +912 -951
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7411 -391
- package/dist/index.d.ts +7411 -391
- package/dist/index.js +876 -946
- package/dist/index.js.map +1 -1
- package/dist/ml-dsa-Drcmrw5h.d.cts +90 -0
- package/dist/ml-dsa-Drcmrw5h.d.ts +90 -0
- package/package.json +1 -1
- package/dist/submission-B4FmDnm_.d.cts +0 -7079
- package/dist/submission-B4FmDnm_.d.ts +0 -7079
package/dist/index.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { blake3 } from '@noble/hashes/blake3.js';
|
|
2
2
|
import { keccak_256, shake256 } from '@noble/hashes/sha3.js';
|
|
3
|
-
import { ml_kem768 } from '@noble/post-quantum/ml-kem.js';
|
|
4
|
-
import { chacha20poly1305 } from '@noble/ciphers/chacha.js';
|
|
5
|
-
import '@noble/hashes/utils.js';
|
|
6
3
|
import { ml_dsa65 } from '@noble/post-quantum/ml-dsa.js';
|
|
7
4
|
import { bls12_381 } from '@noble/curves/bls12-381.js';
|
|
8
|
-
import {
|
|
5
|
+
import { validateMnemonic, mnemonicToSeedSync } from '@scure/bip39';
|
|
9
6
|
import { wordlist } from '@scure/bip39/wordlists/english.js';
|
|
10
7
|
|
|
11
8
|
// src/error.ts
|
|
@@ -380,10 +377,6 @@ var NODE_REGISTRY_SELECTORS = {
|
|
|
380
377
|
formClusterV2: "0x" + selectorHex("formCluster(bytes,bytes,bytes,bytes)"),
|
|
381
378
|
/** `setOperatorDisplay(bytes32,string,string)` — owner-callable public display metadata. */
|
|
382
379
|
setOperatorDisplay: "0x" + selectorHex("setOperatorDisplay(bytes32,string,string)"),
|
|
383
|
-
/** `publishOperatorSealKey(bytes32,bytes)` — owner-callable LythiumSeal EK publication. */
|
|
384
|
-
publishOperatorSealKey: "0x" + selectorHex("publishOperatorSealKey(bytes32,bytes)"),
|
|
385
|
-
/** `getOperatorSealKey(bytes32)` view — returns the operator's published LythiumSeal EK. */
|
|
386
|
-
getOperatorSealKey: "0x" + selectorHex("getOperatorSealKey(bytes32)"),
|
|
387
380
|
/**
|
|
388
381
|
* `updateCharter(uint32,bytes,bytes,bytes)` — Component H live charter
|
|
389
382
|
* amendment (Law §6.8); re-signs a new 30-byte charter for a LIVE cluster
|
|
@@ -409,7 +402,35 @@ var NODE_REGISTRY_SELECTORS = {
|
|
|
409
402
|
/** `getProbeAuthority()` view — Component C configured probe-authority address. */
|
|
410
403
|
getProbeAuthority: "0x" + selectorHex("getProbeAuthority()"),
|
|
411
404
|
/** `attestServiceProbe(bytes32,uint32,uint8,uint64)` — Component C attested score-eligibility path. */
|
|
412
|
-
attestServiceProbe: "0x" + selectorHex("attestServiceProbe(bytes32,uint32,uint8,uint64)")
|
|
405
|
+
attestServiceProbe: "0x" + selectorHex("attestServiceProbe(bytes32,uint32,uint8,uint64)"),
|
|
406
|
+
/**
|
|
407
|
+
* `advertiseSeat(uint32,uint8,uint32,uint128,uint32,bytes32)` returns
|
|
408
|
+
* `uint32 seatId` (L6 open-seat marketplace). Publishes a vacancy
|
|
409
|
+
* listing; caller must own an active member op-hash of the cluster.
|
|
410
|
+
*/
|
|
411
|
+
advertiseSeat: "0x" + selectorHex("advertiseSeat(uint32,uint8,uint32,uint128,uint32,bytes32)"),
|
|
412
|
+
/**
|
|
413
|
+
* `applyForSeat(uint32,uint32,bytes)` returns `bytes32 appKey` (L6).
|
|
414
|
+
* Payable — the native `value` carries the refundable application
|
|
415
|
+
* escrow ({@link NODE_REGISTRY_SEAT_APPLICATION_ESCROW_LYTHOSHI}).
|
|
416
|
+
*/
|
|
417
|
+
applyForSeat: "0x" + selectorHex("applyForSeat(uint32,uint32,bytes)"),
|
|
418
|
+
/**
|
|
419
|
+
* `voteSeatAdmit(uint32,bytes32,bytes)` returns `uint16 voteCount`
|
|
420
|
+
* (L6). Active-member admission vote; the 7-of-10 threshold-reaching
|
|
421
|
+
* vote fills the seat and admits the operator.
|
|
422
|
+
*/
|
|
423
|
+
voteSeatAdmit: "0x" + selectorHex("voteSeatAdmit(uint32,bytes32,bytes)"),
|
|
424
|
+
/**
|
|
425
|
+
* `withdrawSeatApplication(uint32,bytes32)` returns `bool` (L6) —
|
|
426
|
+
* applicant withdrawal that refunds the escrow.
|
|
427
|
+
*/
|
|
428
|
+
withdrawSeatApplication: "0x" + selectorHex("withdrawSeatApplication(uint32,bytes32)"),
|
|
429
|
+
/**
|
|
430
|
+
* `closeSeat(uint32,uint32)` returns `bool` (L6) — advertiser rescind
|
|
431
|
+
* of an `Open` listing.
|
|
432
|
+
*/
|
|
433
|
+
closeSeat: "0x" + selectorHex("closeSeat(uint32,uint32)")
|
|
413
434
|
};
|
|
414
435
|
var NODE_REGISTRY_CLUSTER_MEMBER_REF_BYTES = 48;
|
|
415
436
|
var NODE_REGISTRY_LEGACY_CLUSTER_MEMBER_PUBKEY_BYTES = NODE_REGISTRY_CLUSTER_MEMBER_REF_BYTES;
|
|
@@ -417,7 +438,6 @@ var NODE_REGISTRY_BLS_PUBKEY_BYTES = NODE_REGISTRY_CLUSTER_MEMBER_REF_BYTES;
|
|
|
417
438
|
var NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES = 1952;
|
|
418
439
|
var NODE_REGISTRY_CONSENSUS_SIGNATURE_BYTES = 3309;
|
|
419
440
|
var NODE_REGISTRY_CONSENSUS_POP_BYTES = 3309;
|
|
420
|
-
var NODE_REGISTRY_OPERATOR_SEAL_EK_BYTES = 1184;
|
|
421
441
|
var NODE_REGISTRY_DKG_ATTESTATION_SIG_BYTES = 96;
|
|
422
442
|
var NODE_REGISTRY_DKG_THRESHOLD_SIG_BYTES = NODE_REGISTRY_DKG_ATTESTATION_SIG_BYTES;
|
|
423
443
|
var NODE_REGISTRY_DKG_RESHARE_MIN_SIGNERS = 5;
|
|
@@ -684,43 +704,6 @@ function encodeSetOperatorDisplayCalldata(args) {
|
|
|
684
704
|
)
|
|
685
705
|
);
|
|
686
706
|
}
|
|
687
|
-
function encodePublishOperatorSealKeyCalldata(args) {
|
|
688
|
-
const peerId = expectLength2(toBytes(args.peerId), 32, "peerId");
|
|
689
|
-
const sealEk = expectNonZeroBytes(
|
|
690
|
-
expectLength2(toBytes(args.sealEk), NODE_REGISTRY_OPERATOR_SEAL_EK_BYTES, "sealEk"),
|
|
691
|
-
"sealEk"
|
|
692
|
-
);
|
|
693
|
-
const sealEkPadded = padToWord(sealEk);
|
|
694
|
-
return bytesToHex(
|
|
695
|
-
concatBytes(
|
|
696
|
-
hexToBytes(NODE_REGISTRY_SELECTORS.publishOperatorSealKey),
|
|
697
|
-
peerId,
|
|
698
|
-
uint64Word(2n * 32n, "sealEkOffset"),
|
|
699
|
-
uint64Word(BigInt(sealEk.length), "sealEkLength"),
|
|
700
|
-
sealEkPadded
|
|
701
|
-
)
|
|
702
|
-
);
|
|
703
|
-
}
|
|
704
|
-
function encodeGetOperatorSealKeyCalldata(args) {
|
|
705
|
-
return bytesToHex(
|
|
706
|
-
concatBytes(
|
|
707
|
-
hexToBytes(NODE_REGISTRY_SELECTORS.getOperatorSealKey),
|
|
708
|
-
expectLength2(toBytes(args.operatorId), 32, "operatorId")
|
|
709
|
-
)
|
|
710
|
-
);
|
|
711
|
-
}
|
|
712
|
-
function decodeOperatorSealKey(returnData) {
|
|
713
|
-
const bytes = toBytes(returnData);
|
|
714
|
-
if (bytes.length === NODE_REGISTRY_OPERATOR_SEAL_EK_BYTES) {
|
|
715
|
-
return bytesToHex(expectNonZeroBytes(bytes, "operatorSealKey"));
|
|
716
|
-
}
|
|
717
|
-
const sealEk = decodeDynamicBytesResult(
|
|
718
|
-
bytes,
|
|
719
|
-
NODE_REGISTRY_OPERATOR_SEAL_EK_BYTES,
|
|
720
|
-
"operatorSealKey"
|
|
721
|
-
);
|
|
722
|
-
return bytesToHex(expectNonZeroBytes(sealEk, "operatorSealKey"));
|
|
723
|
-
}
|
|
724
707
|
function encodeCancelClusterJoinCalldata(args) {
|
|
725
708
|
return bytesToHex(
|
|
726
709
|
concatBytes(
|
|
@@ -1394,6 +1377,253 @@ function deriveClusterAnchorAddress(roster, threshold) {
|
|
|
1394
1377
|
}
|
|
1395
1378
|
return bytesToHex(blake3(concatBytes(...parts)).slice(0, 20));
|
|
1396
1379
|
}
|
|
1380
|
+
var NODE_REGISTRY_TAG_CLUSTER_SEAT = 50;
|
|
1381
|
+
var NODE_REGISTRY_SEAT_APPLICATION_ESCROW_LYTHOSHI = 100n * 1000000000000000000n;
|
|
1382
|
+
var NODE_REGISTRY_MIN_SELF_BOND_LYTHOSHI = 5000n * 1000000000000000000n;
|
|
1383
|
+
var NODE_REGISTRY_SEAT_KIND_ACTIVE = 0;
|
|
1384
|
+
var NODE_REGISTRY_SEAT_KIND_STANDBY = 1;
|
|
1385
|
+
function seatKindFromByte(b) {
|
|
1386
|
+
return b === NODE_REGISTRY_SEAT_KIND_STANDBY ? "standby" : "active";
|
|
1387
|
+
}
|
|
1388
|
+
function seatKindToByte(kind) {
|
|
1389
|
+
return kind === "standby" ? NODE_REGISTRY_SEAT_KIND_STANDBY : NODE_REGISTRY_SEAT_KIND_ACTIVE;
|
|
1390
|
+
}
|
|
1391
|
+
var SEAT_STATUS_CODES = {
|
|
1392
|
+
none: 0,
|
|
1393
|
+
open: 1,
|
|
1394
|
+
filled: 2,
|
|
1395
|
+
closed: 3
|
|
1396
|
+
};
|
|
1397
|
+
function seatStatusFromByte(b) {
|
|
1398
|
+
switch (b) {
|
|
1399
|
+
case 1:
|
|
1400
|
+
return "open";
|
|
1401
|
+
case 2:
|
|
1402
|
+
return "filled";
|
|
1403
|
+
case 3:
|
|
1404
|
+
return "closed";
|
|
1405
|
+
default:
|
|
1406
|
+
return "none";
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
var SEAT_ADVERTISED_EVENT_SIG = "SeatAdvertised(uint32,uint32,bytes32,uint8,uint32,uint128,uint32,bytes32)";
|
|
1410
|
+
var SEAT_APPLIED_EVENT_SIG = "SeatApplied(uint32,uint32,bytes32,address,uint128)";
|
|
1411
|
+
var SEAT_FILLED_EVENT_SIG = "SeatFilled(uint32,uint32,bytes32,uint16,uint16)";
|
|
1412
|
+
var SEAT_CLOSED_EVENT_SIG = "SeatClosed(uint32,uint32,uint8)";
|
|
1413
|
+
function encodeAdvertiseSeatCalldata(args) {
|
|
1414
|
+
const kindByte = typeof args.kind === "number" ? args.kind : seatKindToByte(args.kind);
|
|
1415
|
+
if (!Number.isInteger(kindByte) || kindByte < 0 || kindByte > 255) {
|
|
1416
|
+
throw new NodeRegistryError("kind must be a u8 seat kind (0 = active, 1 = standby)");
|
|
1417
|
+
}
|
|
1418
|
+
return bytesToHex(
|
|
1419
|
+
concatBytes(
|
|
1420
|
+
hexToBytes(NODE_REGISTRY_SELECTORS.advertiseSeat),
|
|
1421
|
+
uint32Word(toUint32(args.clusterId, "clusterId")),
|
|
1422
|
+
uint8Word(kindByte),
|
|
1423
|
+
uint32Word(toUint32(args.seatCount, "seatCount")),
|
|
1424
|
+
uint128Word(args.minBondLythoshi, "minBondLythoshi"),
|
|
1425
|
+
uint32Word(toUint32(args.capabilityMask, "capabilityMask")),
|
|
1426
|
+
expectLength2(toBytes(args.termsHash), 32, "termsHash")
|
|
1427
|
+
)
|
|
1428
|
+
);
|
|
1429
|
+
}
|
|
1430
|
+
function encodeApplyForSeatCalldata(args) {
|
|
1431
|
+
const operatorPubkey = expectLength2(
|
|
1432
|
+
toBytes(args.operatorPubkey),
|
|
1433
|
+
NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES,
|
|
1434
|
+
"operatorPubkey"
|
|
1435
|
+
);
|
|
1436
|
+
const operatorPubkeyPadded = padToWord(operatorPubkey);
|
|
1437
|
+
return bytesToHex(
|
|
1438
|
+
concatBytes(
|
|
1439
|
+
hexToBytes(NODE_REGISTRY_SELECTORS.applyForSeat),
|
|
1440
|
+
uint32Word(toUint32(args.clusterId, "clusterId")),
|
|
1441
|
+
uint32Word(toUint32(args.seatId, "seatId")),
|
|
1442
|
+
uint64Word(3n * 32n, "operatorPubkeyOffset"),
|
|
1443
|
+
uint64Word(BigInt(operatorPubkey.length), "operatorPubkeyLength"),
|
|
1444
|
+
operatorPubkeyPadded
|
|
1445
|
+
)
|
|
1446
|
+
);
|
|
1447
|
+
}
|
|
1448
|
+
function encodeVoteSeatAdmitCalldata(args) {
|
|
1449
|
+
const appKey = expectLength2(toBytes(args.appKey), 32, "appKey");
|
|
1450
|
+
const voterPubkey = expectLength2(
|
|
1451
|
+
toBytes(args.voterPubkey),
|
|
1452
|
+
NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES,
|
|
1453
|
+
"voterPubkey"
|
|
1454
|
+
);
|
|
1455
|
+
const voterPubkeyPadded = padToWord(voterPubkey);
|
|
1456
|
+
return bytesToHex(
|
|
1457
|
+
concatBytes(
|
|
1458
|
+
hexToBytes(NODE_REGISTRY_SELECTORS.voteSeatAdmit),
|
|
1459
|
+
uint32Word(toUint32(args.clusterId, "clusterId")),
|
|
1460
|
+
appKey,
|
|
1461
|
+
uint64Word(3n * 32n, "voterPubkeyOffset"),
|
|
1462
|
+
uint64Word(BigInt(voterPubkey.length), "voterPubkeyLength"),
|
|
1463
|
+
voterPubkeyPadded
|
|
1464
|
+
)
|
|
1465
|
+
);
|
|
1466
|
+
}
|
|
1467
|
+
function encodeWithdrawSeatApplicationCalldata(args) {
|
|
1468
|
+
return bytesToHex(
|
|
1469
|
+
concatBytes(
|
|
1470
|
+
hexToBytes(NODE_REGISTRY_SELECTORS.withdrawSeatApplication),
|
|
1471
|
+
uint32Word(toUint32(args.clusterId, "clusterId")),
|
|
1472
|
+
expectLength2(toBytes(args.appKey), 32, "appKey")
|
|
1473
|
+
)
|
|
1474
|
+
);
|
|
1475
|
+
}
|
|
1476
|
+
function encodeCloseSeatCalldata(args) {
|
|
1477
|
+
return bytesToHex(
|
|
1478
|
+
concatBytes(
|
|
1479
|
+
hexToBytes(NODE_REGISTRY_SELECTORS.closeSeat),
|
|
1480
|
+
uint32Word(toUint32(args.clusterId, "clusterId")),
|
|
1481
|
+
uint32Word(toUint32(args.seatId, "seatId"))
|
|
1482
|
+
)
|
|
1483
|
+
);
|
|
1484
|
+
}
|
|
1485
|
+
function deriveSeatApplicationKey(operatorPubkey) {
|
|
1486
|
+
return bytesToHex(
|
|
1487
|
+
blake3(expectLength2(toBytes(operatorPubkey), NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES, "operatorPubkey"))
|
|
1488
|
+
);
|
|
1489
|
+
}
|
|
1490
|
+
function decodeSeatAdvertisedEvent(topics, data) {
|
|
1491
|
+
const { clusterId, seatId } = decodeSeatClusterSeatTopics(topics, SEAT_ADVERTISED_EVENT_SIG, 3);
|
|
1492
|
+
const body = toBytes(data);
|
|
1493
|
+
if (body.length < 6 * 32) {
|
|
1494
|
+
throw new NodeRegistryError("SeatAdvertised data shorter than the 6-word body");
|
|
1495
|
+
}
|
|
1496
|
+
const word = (i) => body.slice(i * 32, (i + 1) * 32);
|
|
1497
|
+
return {
|
|
1498
|
+
clusterId,
|
|
1499
|
+
seatId,
|
|
1500
|
+
advertiser: bytesToHex(word(0)),
|
|
1501
|
+
kind: numberFromWord(word(1), "kind", 255),
|
|
1502
|
+
seatCount: u32FromWord(word(2)),
|
|
1503
|
+
minBondLythoshi: uintFromWord(word(3)),
|
|
1504
|
+
capabilityMask: u32FromWord(word(4)),
|
|
1505
|
+
termsHash: bytesToHex(word(5))
|
|
1506
|
+
};
|
|
1507
|
+
}
|
|
1508
|
+
function decodeSeatAppliedEvent(topics, data) {
|
|
1509
|
+
const { clusterId, seatId, operatorId } = decodeSeatClusterSeatOperatorTopics(
|
|
1510
|
+
topics,
|
|
1511
|
+
SEAT_APPLIED_EVENT_SIG
|
|
1512
|
+
);
|
|
1513
|
+
const body = toBytes(data);
|
|
1514
|
+
if (body.length < 2 * 32) {
|
|
1515
|
+
throw new NodeRegistryError("SeatApplied data shorter than the 2-word body");
|
|
1516
|
+
}
|
|
1517
|
+
return {
|
|
1518
|
+
clusterId,
|
|
1519
|
+
seatId,
|
|
1520
|
+
operatorId,
|
|
1521
|
+
owner: bytesToHex(body.slice(12, 32)),
|
|
1522
|
+
escrowLythoshi: uintFromWord(body.slice(32, 64))
|
|
1523
|
+
};
|
|
1524
|
+
}
|
|
1525
|
+
function decodeSeatFilledEvent(topics, data) {
|
|
1526
|
+
const { clusterId, seatId, operatorId } = decodeSeatClusterSeatOperatorTopics(
|
|
1527
|
+
topics,
|
|
1528
|
+
SEAT_FILLED_EVENT_SIG
|
|
1529
|
+
);
|
|
1530
|
+
const body = toBytes(data);
|
|
1531
|
+
if (body.length < 2 * 32) {
|
|
1532
|
+
throw new NodeRegistryError("SeatFilled data shorter than the 2-word body");
|
|
1533
|
+
}
|
|
1534
|
+
return {
|
|
1535
|
+
clusterId,
|
|
1536
|
+
seatId,
|
|
1537
|
+
operatorId,
|
|
1538
|
+
filledCount: numberFromWord(body.slice(0, 32), "filledCount", 65535),
|
|
1539
|
+
seatCount: numberFromWord(body.slice(32, 64), "seatCount", 65535)
|
|
1540
|
+
};
|
|
1541
|
+
}
|
|
1542
|
+
function decodeSeatClosedEvent(topics, data) {
|
|
1543
|
+
const { clusterId, seatId } = decodeSeatClusterSeatTopics(topics, SEAT_CLOSED_EVENT_SIG, 3);
|
|
1544
|
+
const body = toBytes(data);
|
|
1545
|
+
if (body.length < 32) {
|
|
1546
|
+
throw new NodeRegistryError("SeatClosed data shorter than the 1-word body");
|
|
1547
|
+
}
|
|
1548
|
+
return {
|
|
1549
|
+
clusterId,
|
|
1550
|
+
seatId,
|
|
1551
|
+
status: numberFromWord(body.slice(0, 32), "status", 255)
|
|
1552
|
+
};
|
|
1553
|
+
}
|
|
1554
|
+
function openSeatFromAdvertised(event) {
|
|
1555
|
+
return {
|
|
1556
|
+
clusterId: event.clusterId,
|
|
1557
|
+
seatId: event.seatId,
|
|
1558
|
+
advertiser: event.advertiser,
|
|
1559
|
+
kind: seatKindFromByte(event.kind),
|
|
1560
|
+
seatCount: event.seatCount,
|
|
1561
|
+
filledCount: 0,
|
|
1562
|
+
minBondLythoshi: event.minBondLythoshi,
|
|
1563
|
+
capabilityMask: event.capabilityMask,
|
|
1564
|
+
termsHash: event.termsHash,
|
|
1565
|
+
status: "open"
|
|
1566
|
+
};
|
|
1567
|
+
}
|
|
1568
|
+
function decodeSeatClusterSeatTopics(topics, sig, expectedCount) {
|
|
1569
|
+
if (topics.length !== expectedCount) {
|
|
1570
|
+
throw new NodeRegistryError(`${sig} expects ${expectedCount} topics, got ${topics.length}`);
|
|
1571
|
+
}
|
|
1572
|
+
assertEventTopic0(topics[0], sig);
|
|
1573
|
+
return {
|
|
1574
|
+
clusterId: u32FromWord(expectLength2(toBytes(topics[1]), 32, "clusterId topic")),
|
|
1575
|
+
seatId: u32FromWord(expectLength2(toBytes(topics[2]), 32, "seatId topic"))
|
|
1576
|
+
};
|
|
1577
|
+
}
|
|
1578
|
+
function decodeSeatClusterSeatOperatorTopics(topics, sig) {
|
|
1579
|
+
if (topics.length !== 4) {
|
|
1580
|
+
throw new NodeRegistryError(`${sig} expects 4 topics, got ${topics.length}`);
|
|
1581
|
+
}
|
|
1582
|
+
assertEventTopic0(topics[0], sig);
|
|
1583
|
+
return {
|
|
1584
|
+
clusterId: u32FromWord(expectLength2(toBytes(topics[1]), 32, "clusterId topic")),
|
|
1585
|
+
seatId: u32FromWord(expectLength2(toBytes(topics[2]), 32, "seatId topic")),
|
|
1586
|
+
operatorId: bytesToHex(expectLength2(toBytes(topics[3]), 32, "operatorId topic"))
|
|
1587
|
+
};
|
|
1588
|
+
}
|
|
1589
|
+
function assertEventTopic0(topic0, sig) {
|
|
1590
|
+
const got = bytesToHex(expectLength2(toBytes(topic0), 32, "topic0"));
|
|
1591
|
+
const want = bytesToHex(keccak_256(new TextEncoder().encode(sig)));
|
|
1592
|
+
if (got !== want) {
|
|
1593
|
+
throw new NodeRegistryError(`unexpected topic0 for ${sig}`);
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
function uint128Word(value, name) {
|
|
1597
|
+
const n = toUint128(value, name);
|
|
1598
|
+
const out = new Uint8Array(32);
|
|
1599
|
+
let rest = n;
|
|
1600
|
+
for (let i = 31; i >= 16; i--) {
|
|
1601
|
+
out[i] = Number(rest & 0xffn);
|
|
1602
|
+
rest >>= 8n;
|
|
1603
|
+
}
|
|
1604
|
+
return out;
|
|
1605
|
+
}
|
|
1606
|
+
function toUint128(value, name) {
|
|
1607
|
+
let parsed;
|
|
1608
|
+
if (typeof value === "bigint") {
|
|
1609
|
+
parsed = value;
|
|
1610
|
+
} else if (typeof value === "number") {
|
|
1611
|
+
if (!Number.isSafeInteger(value)) {
|
|
1612
|
+
throw new NodeRegistryError(`${name} must be a safe integer`);
|
|
1613
|
+
}
|
|
1614
|
+
parsed = BigInt(value);
|
|
1615
|
+
} else {
|
|
1616
|
+
const trimmed = value.trim();
|
|
1617
|
+
if (!/^\d+$/u.test(trimmed)) {
|
|
1618
|
+
throw new NodeRegistryError(`${name} must be a decimal uint128`);
|
|
1619
|
+
}
|
|
1620
|
+
parsed = BigInt(trimmed);
|
|
1621
|
+
}
|
|
1622
|
+
if (parsed < 0n || parsed >= 1n << 128n) {
|
|
1623
|
+
throw new NodeRegistryError(`${name} must fit uint128`);
|
|
1624
|
+
}
|
|
1625
|
+
return parsed;
|
|
1626
|
+
}
|
|
1397
1627
|
function selectorHex(sig) {
|
|
1398
1628
|
return [...keccak_256(new TextEncoder().encode(sig)).slice(0, 4)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1399
1629
|
}
|
|
@@ -1649,30 +1879,6 @@ function expectLength2(value, len, name) {
|
|
|
1649
1879
|
}
|
|
1650
1880
|
return value;
|
|
1651
1881
|
}
|
|
1652
|
-
function expectNonZeroBytes(value, name) {
|
|
1653
|
-
if (value.every((byte) => byte === 0)) {
|
|
1654
|
-
throw new NodeRegistryError(`${name} must not be all-zero`);
|
|
1655
|
-
}
|
|
1656
|
-
return value;
|
|
1657
|
-
}
|
|
1658
|
-
function decodeDynamicBytesResult(bytes, expectedLength, label) {
|
|
1659
|
-
if (bytes.length < 64) {
|
|
1660
|
-
throw new NodeRegistryError(`${label} return must be ABI-encoded dynamic bytes`);
|
|
1661
|
-
}
|
|
1662
|
-
const offset = uintFromWord(bytes.slice(0, 32));
|
|
1663
|
-
if (offset !== 32n) {
|
|
1664
|
-
throw new NodeRegistryError(`${label} return offset must be 0x20`);
|
|
1665
|
-
}
|
|
1666
|
-
const len = uintFromWord(bytes.slice(32, 64));
|
|
1667
|
-
if (len !== BigInt(expectedLength)) {
|
|
1668
|
-
throw new NodeRegistryError(`${label} must be ${expectedLength} bytes, got ${len}`);
|
|
1669
|
-
}
|
|
1670
|
-
const paddedLen = Math.ceil(expectedLength / 32) * 32;
|
|
1671
|
-
if (bytes.length < 64 + paddedLen) {
|
|
1672
|
-
throw new NodeRegistryError(`${label} body is truncated`);
|
|
1673
|
-
}
|
|
1674
|
-
return bytes.slice(64, 64 + expectedLength);
|
|
1675
|
-
}
|
|
1676
1882
|
|
|
1677
1883
|
// src/native-events.ts
|
|
1678
1884
|
var NATIVE_MARKET_EVENT_FAMILY = "market";
|
|
@@ -1814,6 +2020,40 @@ function parseBigint(value, label) {
|
|
|
1814
2020
|
return BigInt(value);
|
|
1815
2021
|
}
|
|
1816
2022
|
|
|
2023
|
+
// src/crypto/submission.ts
|
|
2024
|
+
function buildPlaintextSubmission(args) {
|
|
2025
|
+
const signed = args.backend.signEvmTx(args.tx);
|
|
2026
|
+
return {
|
|
2027
|
+
signedTxWireHex: `0x${signed.wireHex}`,
|
|
2028
|
+
innerTxHashHex: bytesToHex2(signed.txHash),
|
|
2029
|
+
innerSighashHex: bytesToHex2(signed.sighash),
|
|
2030
|
+
innerWireBytes: signed.wireBytes.length
|
|
2031
|
+
};
|
|
2032
|
+
}
|
|
2033
|
+
async function submitPlaintextTransaction(client, signedTxWireHex, expectedTxHashHex) {
|
|
2034
|
+
const returned = await client.call("mesh_submitTx", [signedTxWireHex]);
|
|
2035
|
+
const returnedBytes = hexToBytes2(returned, "mesh_submitTx tx hash");
|
|
2036
|
+
if (returnedBytes.length !== 32) {
|
|
2037
|
+
throw new Error(
|
|
2038
|
+
`mesh_submitTx tx hash must be 32 bytes, got ${returnedBytes.length}`
|
|
2039
|
+
);
|
|
2040
|
+
}
|
|
2041
|
+
const expectedBytes = hexToBytes2(expectedTxHashHex, "expected tx hash");
|
|
2042
|
+
if (!bytesEqual(returnedBytes, expectedBytes)) {
|
|
2043
|
+
throw new Error(
|
|
2044
|
+
`mesh_submitTx returned tx hash ${bytesToHex2(returnedBytes)} but the locally computed canonical hash is ${bytesToHex2(expectedBytes)}`
|
|
2045
|
+
);
|
|
2046
|
+
}
|
|
2047
|
+
return bytesToHex2(returnedBytes);
|
|
2048
|
+
}
|
|
2049
|
+
function bytesEqual(a, b) {
|
|
2050
|
+
if (a.length !== b.length) return false;
|
|
2051
|
+
for (let i = 0; i < a.length; i++) {
|
|
2052
|
+
if (a[i] !== b[i]) return false;
|
|
2053
|
+
}
|
|
2054
|
+
return true;
|
|
2055
|
+
}
|
|
2056
|
+
|
|
1817
2057
|
// src/crypto/bincode.ts
|
|
1818
2058
|
var BincodeWriter = class {
|
|
1819
2059
|
#chunks = [];
|
|
@@ -1873,673 +2113,6 @@ var BincodeWriter = class {
|
|
|
1873
2113
|
}
|
|
1874
2114
|
};
|
|
1875
2115
|
|
|
1876
|
-
// src/crypto/tx.ts
|
|
1877
|
-
function encodeTransactionForHash(fields, tag) {
|
|
1878
|
-
const n = normalizeTxFields(fields);
|
|
1879
|
-
return concatBytes2(
|
|
1880
|
-
Uint8Array.of(tag),
|
|
1881
|
-
bigintToBeBytes(n.chainId, 8, "chainId"),
|
|
1882
|
-
bigintToBeBytes(n.nonce, 8, "nonce"),
|
|
1883
|
-
bigintToBeBytes(n.maxPriorityFeePerGas, 32, "maxPriorityFeePerGas"),
|
|
1884
|
-
bigintToBeBytes(n.maxFeePerGas, 32, "maxFeePerGas"),
|
|
1885
|
-
bigintToBeBytes(n.gasLimit, 8, "gasLimit"),
|
|
1886
|
-
n.to === null ? Uint8Array.of(0) : concatBytes2(Uint8Array.of(1), n.to),
|
|
1887
|
-
bigintToBeBytes(n.value, 32, "value"),
|
|
1888
|
-
bigintToBeBytes(BigInt(n.input.length), 4, "input.length"),
|
|
1889
|
-
n.input,
|
|
1890
|
-
new Uint8Array(4),
|
|
1891
|
-
// access_list length
|
|
1892
|
-
encodeExtensionsForHash(n.extensions)
|
|
1893
|
-
);
|
|
1894
|
-
}
|
|
1895
|
-
function bincodeSignedTransaction(fields, signature, publicKey) {
|
|
1896
|
-
const n = normalizeTxFields(fields);
|
|
1897
|
-
const sig = expectBytes(signature, ML_DSA_65_SIGNATURE_LEN, "ML-DSA-65 signature");
|
|
1898
|
-
const pk = expectBytes(publicKey, ML_DSA_65_PUBLIC_KEY_LEN, "ML-DSA-65 public key");
|
|
1899
|
-
const w = new BincodeWriter();
|
|
1900
|
-
w.u64(n.chainId);
|
|
1901
|
-
w.u64(n.nonce);
|
|
1902
|
-
w.bytes(uint256Be(n.maxPriorityFeePerGas, "maxPriorityFeePerGas"));
|
|
1903
|
-
w.bytes(uint256Be(n.maxFeePerGas, "maxFeePerGas"));
|
|
1904
|
-
w.u64(n.gasLimit);
|
|
1905
|
-
if (n.to === null) {
|
|
1906
|
-
w.u8(0);
|
|
1907
|
-
} else {
|
|
1908
|
-
w.u8(1);
|
|
1909
|
-
w.bytes(n.to);
|
|
1910
|
-
}
|
|
1911
|
-
w.bytes(uint256Be(n.value, "value"));
|
|
1912
|
-
w.bytes(n.input);
|
|
1913
|
-
w.u64(0n);
|
|
1914
|
-
w.u64(BigInt(n.extensions.length));
|
|
1915
|
-
for (const ext of n.extensions) bincodeTypedExtensionInto(w, ext);
|
|
1916
|
-
bincodeMlDsa65OpaqueInto(w, sig);
|
|
1917
|
-
bincodeMlDsa65OpaqueInto(w, pk);
|
|
1918
|
-
return w.toBytes();
|
|
1919
|
-
}
|
|
1920
|
-
function normalizeTxFields(fields) {
|
|
1921
|
-
return {
|
|
1922
|
-
chainId: parseBigint(fields.chainId, "chainId"),
|
|
1923
|
-
nonce: parseBigint(fields.nonce, "nonce"),
|
|
1924
|
-
maxPriorityFeePerGas: parseBigint(fields.maxPriorityFeePerGas, "maxPriorityFeePerGas"),
|
|
1925
|
-
maxFeePerGas: parseBigint(fields.maxFeePerGas, "maxFeePerGas"),
|
|
1926
|
-
gasLimit: parseBigint(fields.gasLimit, "gasLimit"),
|
|
1927
|
-
to: normalizeTo(fields.to),
|
|
1928
|
-
value: parseBigint(fields.value, "value"),
|
|
1929
|
-
input: normalizeBytes(fields.input ?? new Uint8Array(0), "input"),
|
|
1930
|
-
extensions: normalizeExtensions(fields.extensions)
|
|
1931
|
-
};
|
|
1932
|
-
}
|
|
1933
|
-
function normalizeTo(value) {
|
|
1934
|
-
if (value === null) return null;
|
|
1935
|
-
const bytes = normalizeBytes(value, "to");
|
|
1936
|
-
return expectBytes(bytes, 20, "to");
|
|
1937
|
-
}
|
|
1938
|
-
function normalizeBytes(value, label) {
|
|
1939
|
-
if (typeof value === "string") return hexToBytes2(value, label);
|
|
1940
|
-
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
1941
|
-
}
|
|
1942
|
-
function normalizeExtensions(value) {
|
|
1943
|
-
if (value === void 0) return [];
|
|
1944
|
-
return value.map((ext, index) => {
|
|
1945
|
-
if (!Number.isInteger(ext.kind) || ext.kind < 0 || ext.kind > 255) {
|
|
1946
|
-
throw new Error(`extensions[${index}].kind out of u8 range`);
|
|
1947
|
-
}
|
|
1948
|
-
const body = normalizeBytes("bodyHex" in ext ? ext.bodyHex : ext.body, `extensions[${index}].body`);
|
|
1949
|
-
if (body.length > 4294967295) {
|
|
1950
|
-
throw new Error(`extensions[${index}].body exceeds u32 length`);
|
|
1951
|
-
}
|
|
1952
|
-
return { kind: ext.kind, body };
|
|
1953
|
-
});
|
|
1954
|
-
}
|
|
1955
|
-
function encodeExtensionsForHash(extensions) {
|
|
1956
|
-
const chunks = [bigintToBeBytes(BigInt(extensions.length), 4, "extensions.length")];
|
|
1957
|
-
for (const ext of extensions) {
|
|
1958
|
-
chunks.push(
|
|
1959
|
-
Uint8Array.of(ext.kind),
|
|
1960
|
-
bigintToBeBytes(BigInt(ext.body.length), 4, "extension.body.length"),
|
|
1961
|
-
ext.body
|
|
1962
|
-
);
|
|
1963
|
-
}
|
|
1964
|
-
return concatBytes2(...chunks);
|
|
1965
|
-
}
|
|
1966
|
-
function uint256Be(value, label) {
|
|
1967
|
-
if (value < 0n || value >= 1n << 256n) throw new Error(`${label} out of u256 range`);
|
|
1968
|
-
const out = new Uint8Array(32);
|
|
1969
|
-
let v = value;
|
|
1970
|
-
for (let i = 31; i >= 0; i--) {
|
|
1971
|
-
out[i] = Number(v & 0xffn);
|
|
1972
|
-
v >>= 8n;
|
|
1973
|
-
}
|
|
1974
|
-
return out;
|
|
1975
|
-
}
|
|
1976
|
-
function bincodeMlDsa65OpaqueInto(w, raw) {
|
|
1977
|
-
w.enumVariant(ENUM_VARIANT_INDEX_ML_DSA_65);
|
|
1978
|
-
w.u16(STANDARD_ALGO_NUMBER_ML_DSA_65);
|
|
1979
|
-
w.bytes(raw);
|
|
1980
|
-
}
|
|
1981
|
-
function bincodeTypedExtensionInto(w, ext) {
|
|
1982
|
-
w.u8(ext.kind);
|
|
1983
|
-
w.bytes(ext.body);
|
|
1984
|
-
}
|
|
1985
|
-
|
|
1986
|
-
// src/crypto/ml-dsa.ts
|
|
1987
|
-
var ML_DSA_65_SEED_LEN = 32;
|
|
1988
|
-
var ML_DSA_65_SIGNING_KEY_LEN = 4032;
|
|
1989
|
-
var ML_DSA_65_PUBLIC_KEY_LEN = 1952;
|
|
1990
|
-
var ML_DSA_65_SIGNATURE_LEN = 3309;
|
|
1991
|
-
var STANDARD_ALGO_NUMBER_ML_DSA_65 = 1001;
|
|
1992
|
-
var ENUM_VARIANT_INDEX_ML_DSA_65 = 3;
|
|
1993
|
-
var ADDRESS_DERIVATION_DOMAIN = "MONO_ADDRESS_BLAKE3_20_V1";
|
|
1994
|
-
var ADDRESS_DERIVATION_DOMAIN_BYTES = new TextEncoder().encode(ADDRESS_DERIVATION_DOMAIN);
|
|
1995
|
-
var MlDsa65Backend = class _MlDsa65Backend {
|
|
1996
|
-
#secretKey;
|
|
1997
|
-
#publicKey;
|
|
1998
|
-
#addressBytes;
|
|
1999
|
-
#disposed = false;
|
|
2000
|
-
constructor(secretKey, publicKey) {
|
|
2001
|
-
this.#secretKey = expectBytes(secretKey, ML_DSA_65_SIGNING_KEY_LEN, "ML-DSA-65 secret key").slice();
|
|
2002
|
-
this.#publicKey = expectBytes(publicKey, ML_DSA_65_PUBLIC_KEY_LEN, "ML-DSA-65 public key").slice();
|
|
2003
|
-
this.#addressBytes = mlDsa65AddressBytes(this.#publicKey);
|
|
2004
|
-
}
|
|
2005
|
-
static fromSeed(seed) {
|
|
2006
|
-
const kp = ml_dsa65.keygen(expectBytes(seed, ML_DSA_65_SEED_LEN, "ML-DSA-65 seed"));
|
|
2007
|
-
return new _MlDsa65Backend(kp.secretKey, kp.publicKey);
|
|
2008
|
-
}
|
|
2009
|
-
publicKey() {
|
|
2010
|
-
return this.#publicKey.slice();
|
|
2011
|
-
}
|
|
2012
|
-
addressBytes() {
|
|
2013
|
-
return this.#addressBytes.slice();
|
|
2014
|
-
}
|
|
2015
|
-
getAddress() {
|
|
2016
|
-
return bytesToHex2(this.#addressBytes);
|
|
2017
|
-
}
|
|
2018
|
-
sign(message) {
|
|
2019
|
-
if (this.#disposed) {
|
|
2020
|
-
throw new Error("MlDsa65Backend disposed");
|
|
2021
|
-
}
|
|
2022
|
-
return ml_dsa65.sign(message, this.#secretKey, { extraEntropy: false });
|
|
2023
|
-
}
|
|
2024
|
-
/**
|
|
2025
|
-
* Best-effort deterministic wipe of the in-memory secret key. Zeroes the
|
|
2026
|
-
* SDK-held `#secretKey` copy and makes any subsequent `sign()` /
|
|
2027
|
-
* `signPrehash()` / `signEvmTx()` throw `"MlDsa65Backend disposed"` rather
|
|
2028
|
-
* than signing with a zeroed key. Idempotent. Public material
|
|
2029
|
-
* (`publicKey()` / `getAddress()` / `verify()`) stays usable.
|
|
2030
|
-
*
|
|
2031
|
-
* Defense-in-depth (S1-01): narrows the post-lock residency window of the
|
|
2032
|
-
* ML-DSA-65 secret in the JS heap. `@noble/post-quantum`'s internal
|
|
2033
|
-
* transient keygen/sign buffers are out of scope; the SDK-held copy is the
|
|
2034
|
-
* meaningful residency win.
|
|
2035
|
-
*/
|
|
2036
|
-
dispose() {
|
|
2037
|
-
this.#secretKey.fill(0);
|
|
2038
|
-
this.#disposed = true;
|
|
2039
|
-
}
|
|
2040
|
-
/** Alias for {@link dispose}. */
|
|
2041
|
-
zeroize() {
|
|
2042
|
-
this.dispose();
|
|
2043
|
-
}
|
|
2044
|
-
/** Whether {@link dispose} has been called (the secret key is wiped). */
|
|
2045
|
-
get disposed() {
|
|
2046
|
-
return this.#disposed;
|
|
2047
|
-
}
|
|
2048
|
-
signPrehash(digest) {
|
|
2049
|
-
return this.sign(expectBytes(digest, 32, "prehash"));
|
|
2050
|
-
}
|
|
2051
|
-
verify(message, signature) {
|
|
2052
|
-
return ml_dsa65.verify(
|
|
2053
|
-
expectBytes(signature, ML_DSA_65_SIGNATURE_LEN, "ML-DSA-65 signature"),
|
|
2054
|
-
message,
|
|
2055
|
-
this.#publicKey
|
|
2056
|
-
);
|
|
2057
|
-
}
|
|
2058
|
-
signEvmTx(fields) {
|
|
2059
|
-
const txHashPreimage = encodeTransactionForHash(fields, 1);
|
|
2060
|
-
const sighash = keccak_256(txHashPreimage);
|
|
2061
|
-
const signature = this.sign(sighash);
|
|
2062
|
-
const wireBytes = bincodeSignedTransaction(fields, signature, this.#publicKey);
|
|
2063
|
-
const txHash = keccak_256(
|
|
2064
|
-
concatBytes2(
|
|
2065
|
-
encodeTransactionForHash(fields, 2),
|
|
2066
|
-
signature,
|
|
2067
|
-
this.#publicKey
|
|
2068
|
-
)
|
|
2069
|
-
);
|
|
2070
|
-
return {
|
|
2071
|
-
wireHex: bytesToHex2(wireBytes).slice(2),
|
|
2072
|
-
wireBytes,
|
|
2073
|
-
sighash,
|
|
2074
|
-
txHash
|
|
2075
|
-
};
|
|
2076
|
-
}
|
|
2077
|
-
};
|
|
2078
|
-
function mlDsa65AddressFromPublicKey(publicKey) {
|
|
2079
|
-
return bytesToHex2(mlDsa65AddressBytes(publicKey));
|
|
2080
|
-
}
|
|
2081
|
-
function mlDsa65AddressBytes(publicKey) {
|
|
2082
|
-
const bytes = expectBytes(publicKey, ML_DSA_65_PUBLIC_KEY_LEN, "ML-DSA-65 public key");
|
|
2083
|
-
return blake3(concatBytes2(
|
|
2084
|
-
ADDRESS_DERIVATION_DOMAIN_BYTES,
|
|
2085
|
-
bigintToBeBytes(BigInt(STANDARD_ALGO_NUMBER_ML_DSA_65), 2, "ML-DSA-65 algo id"),
|
|
2086
|
-
bytes
|
|
2087
|
-
)).slice(0, 20);
|
|
2088
|
-
}
|
|
2089
|
-
|
|
2090
|
-
// src/crypto/envelope.ts
|
|
2091
|
-
new TextEncoder().encode("protocore/v2/mempool/dkg-mlkem768/1");
|
|
2092
|
-
var MempoolClass = {
|
|
2093
|
-
Transfer: 0,
|
|
2094
|
-
ContractCall: 1,
|
|
2095
|
-
CLOBOp: 3};
|
|
2096
|
-
function bincodeNonceAad(aad) {
|
|
2097
|
-
const w = new BincodeWriter();
|
|
2098
|
-
w.bytes(expectBytes(aad.sender, 20, "NonceAad.sender"));
|
|
2099
|
-
w.u64(aad.nonce);
|
|
2100
|
-
w.u64(aad.chainId);
|
|
2101
|
-
w.enumVariant(aad.class);
|
|
2102
|
-
w.u128(aad.maxFeePerGas);
|
|
2103
|
-
w.u128(aad.maxPriorityFeePerGas);
|
|
2104
|
-
w.u64(aad.gasLimit);
|
|
2105
|
-
return w.toBytes();
|
|
2106
|
-
}
|
|
2107
|
-
function bincodeDecryptHint(hint) {
|
|
2108
|
-
const w = new BincodeWriter();
|
|
2109
|
-
w.u64(hint.epoch);
|
|
2110
|
-
w.u16(hint.scheme);
|
|
2111
|
-
return w.toBytes();
|
|
2112
|
-
}
|
|
2113
|
-
function bincodeEncryptedEnvelope(env) {
|
|
2114
|
-
const w = new BincodeWriter();
|
|
2115
|
-
w.rawBytes(bincodeNonceAad(env.nonceAad));
|
|
2116
|
-
w.bytes(env.ciphertext);
|
|
2117
|
-
w.rawBytes(bincodeDecryptHint(env.decryptionHint));
|
|
2118
|
-
bincodeMlDsa65OpaqueInto2(w, expectBytes(env.senderPubkey, ML_DSA_65_PUBLIC_KEY_LEN, "senderPubkey"));
|
|
2119
|
-
bincodeMlDsa65OpaqueInto2(w, expectBytes(env.outerSignature, ML_DSA_65_SIGNATURE_LEN, "outerSignature"));
|
|
2120
|
-
w.bytes(expectBytes(env.sender, 20, "sender"));
|
|
2121
|
-
return w.toBytes();
|
|
2122
|
-
}
|
|
2123
|
-
function outerSigDigest(nonceAad, ciphertext, decryptionHint, senderPubkey) {
|
|
2124
|
-
const aad = bincodeNonceAad(nonceAad);
|
|
2125
|
-
const hint = bincodeDecryptHint(decryptionHint);
|
|
2126
|
-
return keccak_256(concatBytes2(aad, ciphertext, hint, expectBytes(senderPubkey, ML_DSA_65_PUBLIC_KEY_LEN, "senderPubkey")));
|
|
2127
|
-
}
|
|
2128
|
-
function bincodeMlDsa65OpaqueInto2(w, raw) {
|
|
2129
|
-
w.enumVariant(ENUM_VARIANT_INDEX_ML_DSA_65);
|
|
2130
|
-
w.u16(STANDARD_ALGO_NUMBER_ML_DSA_65);
|
|
2131
|
-
w.bytes(raw);
|
|
2132
|
-
}
|
|
2133
|
-
var SEAL_EK_LEN = 1184;
|
|
2134
|
-
var SEAL_KEY_LEN = 32;
|
|
2135
|
-
var SEAL_NONCE_LEN = 12;
|
|
2136
|
-
var SEAL_COMMIT_LEN = 32;
|
|
2137
|
-
var SEAL_SECRET_LEN = 32;
|
|
2138
|
-
var SEAL_SHARE_LEN = 1 + SEAL_SECRET_LEN;
|
|
2139
|
-
var CLUSTER_MLKEM_SHAMIR = 3;
|
|
2140
|
-
var COMMIT_DOMAIN = new TextEncoder().encode("lythiumseal/commit/v1");
|
|
2141
|
-
var KEK_DOMAIN = new TextEncoder().encode("lythiumseal/kek/v1");
|
|
2142
|
-
var NONCE_DOMAIN = new TextEncoder().encode("lythiumseal/nonce/v1");
|
|
2143
|
-
var BODY_AAD_DOMAIN = new TextEncoder().encode("lythiumseal/body/v1");
|
|
2144
|
-
var SHARE_AAD_DOMAIN = new TextEncoder().encode("lythiumseal/share/v1");
|
|
2145
|
-
var ROSTER_DOMAIN = new TextEncoder().encode("lythiumseal/roster/v1");
|
|
2146
|
-
function cryptoRandomSource() {
|
|
2147
|
-
return {
|
|
2148
|
-
fillBytes(dest) {
|
|
2149
|
-
crypto.getRandomValues(dest);
|
|
2150
|
-
}
|
|
2151
|
-
};
|
|
2152
|
-
}
|
|
2153
|
-
function u32le(n) {
|
|
2154
|
-
const out = new Uint8Array(4);
|
|
2155
|
-
out[0] = n & 255;
|
|
2156
|
-
out[1] = n >>> 8 & 255;
|
|
2157
|
-
out[2] = n >>> 16 & 255;
|
|
2158
|
-
out[3] = n >>> 24 & 255;
|
|
2159
|
-
return out;
|
|
2160
|
-
}
|
|
2161
|
-
function u64le(n) {
|
|
2162
|
-
const out = new Uint8Array(8);
|
|
2163
|
-
let v = n;
|
|
2164
|
-
for (let i = 0; i < 8; i++) {
|
|
2165
|
-
out[i] = Number(v & 0xffn);
|
|
2166
|
-
v >>= 8n;
|
|
2167
|
-
}
|
|
2168
|
-
return out;
|
|
2169
|
-
}
|
|
2170
|
-
function framed(field2) {
|
|
2171
|
-
return concatBytes2(u32le(field2.length), field2);
|
|
2172
|
-
}
|
|
2173
|
-
function keyCommitment(key) {
|
|
2174
|
-
return shake256(concatBytes2(framed(COMMIT_DOMAIN), key), { dkLen: SEAL_COMMIT_LEN });
|
|
2175
|
-
}
|
|
2176
|
-
function deriveKek(sharedSecret, domain, clusterId, epoch, opIndex) {
|
|
2177
|
-
const input = concatBytes2(
|
|
2178
|
-
framed(KEK_DOMAIN),
|
|
2179
|
-
framed(sharedSecret),
|
|
2180
|
-
framed(domain),
|
|
2181
|
-
u32le(clusterId),
|
|
2182
|
-
u64le(epoch),
|
|
2183
|
-
Uint8Array.of(opIndex)
|
|
2184
|
-
);
|
|
2185
|
-
return shake256(input, { dkLen: SEAL_KEY_LEN });
|
|
2186
|
-
}
|
|
2187
|
-
function deriveNonce(domain, context) {
|
|
2188
|
-
const input = concatBytes2(framed(NONCE_DOMAIN), framed(domain), framed(context));
|
|
2189
|
-
return shake256(input, { dkLen: SEAL_NONCE_LEN });
|
|
2190
|
-
}
|
|
2191
|
-
function bodyAad(ctx, k, n) {
|
|
2192
|
-
return concatBytes2(
|
|
2193
|
-
BODY_AAD_DOMAIN,
|
|
2194
|
-
u32le(ctx.clusterId),
|
|
2195
|
-
u64le(ctx.epoch),
|
|
2196
|
-
Uint8Array.of(k),
|
|
2197
|
-
Uint8Array.of(n),
|
|
2198
|
-
ctx.rosterHash
|
|
2199
|
-
);
|
|
2200
|
-
}
|
|
2201
|
-
function shareAad(ctx, opIndex) {
|
|
2202
|
-
return concatBytes2(
|
|
2203
|
-
SHARE_AAD_DOMAIN,
|
|
2204
|
-
u32le(ctx.clusterId),
|
|
2205
|
-
u64le(ctx.epoch),
|
|
2206
|
-
Uint8Array.of(opIndex),
|
|
2207
|
-
ctx.rosterHash
|
|
2208
|
-
);
|
|
2209
|
-
}
|
|
2210
|
-
function aeadSeal(key, nonce, plaintext, aad) {
|
|
2211
|
-
const cipher = chacha20poly1305(key, nonce, aad);
|
|
2212
|
-
const ct = cipher.encrypt(plaintext);
|
|
2213
|
-
return { nonce, ct, commitment: keyCommitment(key) };
|
|
2214
|
-
}
|
|
2215
|
-
function gfMul(a, b) {
|
|
2216
|
-
let product = 0;
|
|
2217
|
-
let x = a & 255;
|
|
2218
|
-
let y = b & 255;
|
|
2219
|
-
for (let i = 0; i < 8; i++) {
|
|
2220
|
-
const mask = -(y & 1) & 255;
|
|
2221
|
-
product ^= x & mask;
|
|
2222
|
-
const high = -(x >> 7 & 1) & 255;
|
|
2223
|
-
x = x << 1 & 255;
|
|
2224
|
-
x ^= 27 & high;
|
|
2225
|
-
y >>= 1;
|
|
2226
|
-
}
|
|
2227
|
-
return product & 255;
|
|
2228
|
-
}
|
|
2229
|
-
function polyEval(coeffs, x) {
|
|
2230
|
-
let acc = 0;
|
|
2231
|
-
for (let i = coeffs.length - 1; i >= 0; i--) {
|
|
2232
|
-
acc = gfMul(acc, x) ^ coeffs[i];
|
|
2233
|
-
}
|
|
2234
|
-
return acc & 255;
|
|
2235
|
-
}
|
|
2236
|
-
function shamirSplit(secret, t, n, rng) {
|
|
2237
|
-
const byteCoeffs = [];
|
|
2238
|
-
for (let j = 0; j < SEAL_SECRET_LEN; j++) {
|
|
2239
|
-
const c = new Uint8Array(t);
|
|
2240
|
-
c[0] = secret[j];
|
|
2241
|
-
if (t > 1) {
|
|
2242
|
-
const tail = new Uint8Array(t - 1);
|
|
2243
|
-
rng.fillBytes(tail);
|
|
2244
|
-
c.set(tail, 1);
|
|
2245
|
-
}
|
|
2246
|
-
byteCoeffs.push(c);
|
|
2247
|
-
}
|
|
2248
|
-
const shares = [];
|
|
2249
|
-
for (let k = 0; k < n; k++) {
|
|
2250
|
-
const x = k + 1 & 255;
|
|
2251
|
-
const value = new Uint8Array(SEAL_SECRET_LEN);
|
|
2252
|
-
for (let j = 0; j < SEAL_SECRET_LEN; j++) {
|
|
2253
|
-
value[j] = polyEval(byteCoeffs[j], x);
|
|
2254
|
-
}
|
|
2255
|
-
shares.push({ index: x, value });
|
|
2256
|
-
}
|
|
2257
|
-
return shares;
|
|
2258
|
-
}
|
|
2259
|
-
function shareToBytes(s) {
|
|
2260
|
-
const out = new Uint8Array(SEAL_SHARE_LEN);
|
|
2261
|
-
out[0] = s.index;
|
|
2262
|
-
out.set(s.value, 1);
|
|
2263
|
-
return out;
|
|
2264
|
-
}
|
|
2265
|
-
function sealRosterHash(keccak2562, clusterId, t, n, roster) {
|
|
2266
|
-
const chunks = [ROSTER_DOMAIN, u32le(clusterId), Uint8Array.of(t), Uint8Array.of(n)];
|
|
2267
|
-
for (const { operatorIndex, ek } of roster) {
|
|
2268
|
-
chunks.push(Uint8Array.of(operatorIndex), ek);
|
|
2269
|
-
}
|
|
2270
|
-
return keccak2562(concatBytes2(...chunks));
|
|
2271
|
-
}
|
|
2272
|
-
function encodeSealEnvelope(env) {
|
|
2273
|
-
const chunks = [];
|
|
2274
|
-
chunks.push(u32le(env.clusterId));
|
|
2275
|
-
chunks.push(u64le(env.epoch));
|
|
2276
|
-
chunks.push(expectBytes(env.rosterHash, 32, "rosterHash"));
|
|
2277
|
-
chunks.push(Uint8Array.of(env.t));
|
|
2278
|
-
chunks.push(Uint8Array.of(env.n));
|
|
2279
|
-
pushAeadBody(chunks, env.aeadBody);
|
|
2280
|
-
chunks.push(u64le(BigInt(env.recipients.length)));
|
|
2281
|
-
for (const r of env.recipients) {
|
|
2282
|
-
chunks.push(Uint8Array.of(r.operatorIndex));
|
|
2283
|
-
chunks.push(u64le(BigInt(r.kemCt.length)));
|
|
2284
|
-
chunks.push(r.kemCt);
|
|
2285
|
-
pushAeadBody(chunks, r.wrapped);
|
|
2286
|
-
}
|
|
2287
|
-
return concatBytes2(...chunks);
|
|
2288
|
-
}
|
|
2289
|
-
function pushAeadBody(chunks, body) {
|
|
2290
|
-
chunks.push(expectBytes(body.nonce, SEAL_NONCE_LEN, "aead nonce"));
|
|
2291
|
-
chunks.push(u64le(BigInt(body.ct.length)));
|
|
2292
|
-
chunks.push(body.ct);
|
|
2293
|
-
chunks.push(expectBytes(body.commitment, SEAL_COMMIT_LEN, "aead commitment"));
|
|
2294
|
-
}
|
|
2295
|
-
function sealToCluster(args) {
|
|
2296
|
-
const { plaintext, recipientEks, t, clusterId } = args;
|
|
2297
|
-
const epoch = args.epoch;
|
|
2298
|
-
const rosterHash = expectBytes(args.rosterHash, 32, "rosterHash");
|
|
2299
|
-
const rng = args.rng ?? cryptoRandomSource();
|
|
2300
|
-
const n = recipientEks.length;
|
|
2301
|
-
if (!Number.isInteger(t) || t < 1 || t > n || n < 1 || n > 255) {
|
|
2302
|
-
throw new Error(`invalid threshold/recipient count: t=${t} n=${n}`);
|
|
2303
|
-
}
|
|
2304
|
-
for (let i = 0; i < n; i++) {
|
|
2305
|
-
expectBytes(recipientEks[i], SEAL_EK_LEN, `recipientEks[${i}]`);
|
|
2306
|
-
}
|
|
2307
|
-
const ctx = { clusterId, epoch, rosterHash };
|
|
2308
|
-
const bodyKey = new Uint8Array(SEAL_KEY_LEN);
|
|
2309
|
-
rng.fillBytes(bodyKey);
|
|
2310
|
-
const aad = bodyAad(ctx, t, n);
|
|
2311
|
-
const bodyNonce = deriveNonce(new TextEncoder().encode("body"), aad);
|
|
2312
|
-
const aeadBody = aeadSeal(bodyKey, bodyNonce, plaintext, aad);
|
|
2313
|
-
const shares = shamirSplit(bodyKey, t, n, rng);
|
|
2314
|
-
const recipients = [];
|
|
2315
|
-
for (let i = 0; i < n; i++) {
|
|
2316
|
-
const opIndex = i + 1 & 255;
|
|
2317
|
-
const m = new Uint8Array(32);
|
|
2318
|
-
rng.fillBytes(m);
|
|
2319
|
-
const { cipherText: kemCt, sharedSecret } = ml_kem768.encapsulate(recipientEks[i], m);
|
|
2320
|
-
const kek = deriveKek(sharedSecret, rosterHash, clusterId, epoch, opIndex);
|
|
2321
|
-
const sAad = shareAad(ctx, opIndex);
|
|
2322
|
-
const wrapNonce = deriveNonce(new TextEncoder().encode("share"), sAad);
|
|
2323
|
-
const wrapped = aeadSeal(kek, wrapNonce, shareToBytes(shares[i]), sAad);
|
|
2324
|
-
recipients.push({ operatorIndex: opIndex, kemCt, wrapped });
|
|
2325
|
-
sharedSecret.fill(0);
|
|
2326
|
-
kek.fill(0);
|
|
2327
|
-
}
|
|
2328
|
-
bodyKey.fill(0);
|
|
2329
|
-
return {
|
|
2330
|
-
clusterId,
|
|
2331
|
-
epoch,
|
|
2332
|
-
rosterHash,
|
|
2333
|
-
t,
|
|
2334
|
-
n,
|
|
2335
|
-
aeadBody,
|
|
2336
|
-
recipients
|
|
2337
|
-
};
|
|
2338
|
-
}
|
|
2339
|
-
|
|
2340
|
-
// src/crypto/seal.ts
|
|
2341
|
-
var CLUSTER_MLKEM_SHAMIR_ALGO = "cluster-mlkem768-shamir";
|
|
2342
|
-
function parseClusterSealKeys(source) {
|
|
2343
|
-
const n = source.roster.length;
|
|
2344
|
-
if (n === 0) {
|
|
2345
|
-
throw new Error("cluster seal roster is empty");
|
|
2346
|
-
}
|
|
2347
|
-
if (source.n !== n) {
|
|
2348
|
-
throw new Error(`cluster seal roster n=${source.n} disagrees with ${n} entries`);
|
|
2349
|
-
}
|
|
2350
|
-
if (!Number.isInteger(source.t) || source.t < 2 || source.t > n) {
|
|
2351
|
-
throw new Error(`cluster seal threshold t=${source.t} out of range 2..=${n}`);
|
|
2352
|
-
}
|
|
2353
|
-
const sorted = [...source.roster].sort((a, b) => a.operatorIndex - b.operatorIndex);
|
|
2354
|
-
const recipientEks = [];
|
|
2355
|
-
const hashInput = [];
|
|
2356
|
-
for (let i = 0; i < n; i++) {
|
|
2357
|
-
const entry = sorted[i];
|
|
2358
|
-
if (entry.operatorIndex !== i + 1) {
|
|
2359
|
-
throw new Error(
|
|
2360
|
-
`cluster seal roster operator indices must be 1..=${n}; got ${entry.operatorIndex} at slot ${i + 1}`
|
|
2361
|
-
);
|
|
2362
|
-
}
|
|
2363
|
-
const ek = expectBytes(hexToBytes2(entry.mlKemEk, `operator ${entry.operatorIndex} mlKemEk`), SEAL_EK_LEN, `operator ${entry.operatorIndex} ek`);
|
|
2364
|
-
recipientEks.push(ek);
|
|
2365
|
-
hashInput.push({ operatorIndex: entry.operatorIndex, ek });
|
|
2366
|
-
}
|
|
2367
|
-
const recomputed = sealRosterHash(keccak256, source.clusterId, source.t, n, hashInput);
|
|
2368
|
-
if (source.rosterHash !== void 0) {
|
|
2369
|
-
const supplied = expectBytes(hexToBytes2(source.rosterHash, "rosterHash"), 32, "rosterHash");
|
|
2370
|
-
if (!bytesEqual(supplied, recomputed)) {
|
|
2371
|
-
throw new Error(
|
|
2372
|
-
`cluster seal roster hash mismatch: source ${bytesToHex2(supplied)} != recomputed ${bytesToHex2(recomputed)} (the roster hash does not commit to this ek set)`
|
|
2373
|
-
);
|
|
2374
|
-
}
|
|
2375
|
-
}
|
|
2376
|
-
return {
|
|
2377
|
-
algo: source.algo ?? CLUSTER_MLKEM_SHAMIR_ALGO,
|
|
2378
|
-
clusterId: source.clusterId,
|
|
2379
|
-
epoch: toBigInt(source.epoch),
|
|
2380
|
-
rosterHash: recomputed,
|
|
2381
|
-
t: source.t,
|
|
2382
|
-
n,
|
|
2383
|
-
recipientEks
|
|
2384
|
-
};
|
|
2385
|
-
}
|
|
2386
|
-
async function sealTransaction(args) {
|
|
2387
|
-
const keys = args.clusterSealKeys;
|
|
2388
|
-
const senderPubkey = expectBytes(args.senderPubkey, ML_DSA_65_PUBLIC_KEY_LEN, "senderPubkey");
|
|
2389
|
-
const senderAddress = expectBytes(args.senderAddress, 20, "senderAddress");
|
|
2390
|
-
const env = sealToCluster({
|
|
2391
|
-
plaintext: args.signedTxBincode,
|
|
2392
|
-
recipientEks: keys.recipientEks,
|
|
2393
|
-
t: keys.t,
|
|
2394
|
-
clusterId: keys.clusterId,
|
|
2395
|
-
epoch: keys.epoch,
|
|
2396
|
-
rosterHash: keys.rosterHash,
|
|
2397
|
-
rng: args.rng
|
|
2398
|
-
});
|
|
2399
|
-
const ciphertext = encodeSealEnvelope(env);
|
|
2400
|
-
const decryptionHint = { epoch: keys.epoch, scheme: CLUSTER_MLKEM_SHAMIR };
|
|
2401
|
-
const digest = outerSigDigest(args.aad, ciphertext, decryptionHint, senderPubkey);
|
|
2402
|
-
const outerSignature = expectBytes(
|
|
2403
|
-
await args.signOuterDigest(digest),
|
|
2404
|
-
ML_DSA_65_SIGNATURE_LEN,
|
|
2405
|
-
"outerSignature"
|
|
2406
|
-
);
|
|
2407
|
-
const envelope = {
|
|
2408
|
-
nonceAad: args.aad,
|
|
2409
|
-
ciphertext,
|
|
2410
|
-
decryptionHint,
|
|
2411
|
-
senderPubkey,
|
|
2412
|
-
outerSignature,
|
|
2413
|
-
sender: senderAddress
|
|
2414
|
-
};
|
|
2415
|
-
const envelopeWireBytes = bincodeEncryptedEnvelope(envelope);
|
|
2416
|
-
return {
|
|
2417
|
-
envelopeWireHex: `0x${bytesToHex2(envelopeWireBytes).slice(2)}`,
|
|
2418
|
-
envelopeWireBytes,
|
|
2419
|
-
ciphertextBytes: ciphertext.length
|
|
2420
|
-
};
|
|
2421
|
-
}
|
|
2422
|
-
function keccak256(input) {
|
|
2423
|
-
return keccak_256(input);
|
|
2424
|
-
}
|
|
2425
|
-
function toBigInt(value) {
|
|
2426
|
-
if (typeof value === "bigint") return value;
|
|
2427
|
-
return BigInt(value);
|
|
2428
|
-
}
|
|
2429
|
-
function bytesEqual(a, b) {
|
|
2430
|
-
if (a.length !== b.length) return false;
|
|
2431
|
-
for (let i = 0; i < a.length; i++) {
|
|
2432
|
-
if (a[i] !== b[i]) return false;
|
|
2433
|
-
}
|
|
2434
|
-
return true;
|
|
2435
|
-
}
|
|
2436
|
-
|
|
2437
|
-
// src/crypto/submission.ts
|
|
2438
|
-
async function fetchEncryptionKey(client) {
|
|
2439
|
-
const result = await client.call(
|
|
2440
|
-
"lyth_getEncryptionKey",
|
|
2441
|
-
[]
|
|
2442
|
-
);
|
|
2443
|
-
return {
|
|
2444
|
-
algo: result.algo ?? "ml-kem-768",
|
|
2445
|
-
epoch: typeof result.epoch === "string" ? BigInt(result.epoch) : BigInt(result.epoch),
|
|
2446
|
-
encapsulationKey: hexToBytes2(result.encapsulationKey, "encapsulationKey")
|
|
2447
|
-
};
|
|
2448
|
-
}
|
|
2449
|
-
var ENCRYPTED_SUBMISSION_UNAVAILABLE_MESSAGE = "private submission requires cluster seal keys; pass clusterSealKeysSource or enable lyth_getClusterSealKeys";
|
|
2450
|
-
async function buildEncryptedSubmission(args) {
|
|
2451
|
-
const signed = args.backend.signEvmTx(args.tx);
|
|
2452
|
-
const clusterSealKeys = await resolveClusterSealKeys(args);
|
|
2453
|
-
const aad = nonceAadForTx(args.tx, args.backend.addressBytes(), args.class);
|
|
2454
|
-
const sealed = await sealTransaction({
|
|
2455
|
-
signedTxBincode: signed.wireBytes,
|
|
2456
|
-
clusterSealKeys,
|
|
2457
|
-
aad,
|
|
2458
|
-
senderAddress: args.backend.addressBytes(),
|
|
2459
|
-
senderPubkey: args.backend.publicKey(),
|
|
2460
|
-
signOuterDigest: (digest) => args.backend.signPrehash(digest)
|
|
2461
|
-
});
|
|
2462
|
-
return {
|
|
2463
|
-
envelopeWireHex: sealed.envelopeWireHex,
|
|
2464
|
-
innerSighashHex: bytesToHex2(signed.sighash),
|
|
2465
|
-
innerTxHashHex: bytesToHex2(signed.txHash),
|
|
2466
|
-
innerWireBytes: signed.wireBytes.length
|
|
2467
|
-
};
|
|
2468
|
-
}
|
|
2469
|
-
async function submitEncryptedEnvelope(client, envelopeWireHex) {
|
|
2470
|
-
return client.call("lyth_submitEncrypted", [envelopeWireHex]);
|
|
2471
|
-
}
|
|
2472
|
-
function buildPlaintextSubmission(args) {
|
|
2473
|
-
const signed = args.backend.signEvmTx(args.tx);
|
|
2474
|
-
return {
|
|
2475
|
-
signedTxWireHex: `0x${signed.wireHex}`,
|
|
2476
|
-
innerTxHashHex: bytesToHex2(signed.txHash),
|
|
2477
|
-
innerSighashHex: bytesToHex2(signed.sighash),
|
|
2478
|
-
innerWireBytes: signed.wireBytes.length
|
|
2479
|
-
};
|
|
2480
|
-
}
|
|
2481
|
-
async function submitPlaintextTransaction(client, signedTxWireHex, expectedTxHashHex) {
|
|
2482
|
-
const returned = await client.call("mesh_submitTx", [signedTxWireHex]);
|
|
2483
|
-
const returnedBytes = hexToBytes2(returned, "mesh_submitTx tx hash");
|
|
2484
|
-
if (returnedBytes.length !== 32) {
|
|
2485
|
-
throw new Error(
|
|
2486
|
-
`mesh_submitTx tx hash must be 32 bytes, got ${returnedBytes.length}`
|
|
2487
|
-
);
|
|
2488
|
-
}
|
|
2489
|
-
const expectedBytes = hexToBytes2(expectedTxHashHex, "expected tx hash");
|
|
2490
|
-
if (!bytesEqual2(returnedBytes, expectedBytes)) {
|
|
2491
|
-
throw new Error(
|
|
2492
|
-
`mesh_submitTx returned tx hash ${bytesToHex2(returnedBytes)} but the locally computed canonical hash is ${bytesToHex2(expectedBytes)}`
|
|
2493
|
-
);
|
|
2494
|
-
}
|
|
2495
|
-
return bytesToHex2(returnedBytes);
|
|
2496
|
-
}
|
|
2497
|
-
function bytesEqual2(a, b) {
|
|
2498
|
-
if (a.length !== b.length) return false;
|
|
2499
|
-
for (let i = 0; i < a.length; i++) {
|
|
2500
|
-
if (a[i] !== b[i]) return false;
|
|
2501
|
-
}
|
|
2502
|
-
return true;
|
|
2503
|
-
}
|
|
2504
|
-
async function resolveClusterSealKeys(args) {
|
|
2505
|
-
if (args.clusterSealKeys !== void 0) return args.clusterSealKeys;
|
|
2506
|
-
if (args.clusterSealKeysSource !== void 0) {
|
|
2507
|
-
return parseClusterSealKeys(args.clusterSealKeysSource);
|
|
2508
|
-
}
|
|
2509
|
-
if (args.client === void 0) {
|
|
2510
|
-
throw new Error(ENCRYPTED_SUBMISSION_UNAVAILABLE_MESSAGE);
|
|
2511
|
-
}
|
|
2512
|
-
const clusterId = args.clusterId ?? 0;
|
|
2513
|
-
const result = await args.client.call(
|
|
2514
|
-
"lyth_getClusterSealKeys",
|
|
2515
|
-
[clusterId]
|
|
2516
|
-
);
|
|
2517
|
-
return parseClusterSealKeys({ ...result, clusterId: result.clusterId ?? clusterId });
|
|
2518
|
-
}
|
|
2519
|
-
function nonceAadForTx(tx, sender, mempoolClass) {
|
|
2520
|
-
return {
|
|
2521
|
-
sender,
|
|
2522
|
-
nonce: parseBigint(tx.nonce, "nonce"),
|
|
2523
|
-
chainId: parseBigint(tx.chainId, "chainId"),
|
|
2524
|
-
class: mempoolClass ?? inferMempoolClass(tx),
|
|
2525
|
-
maxFeePerGas: parseBigint(tx.maxFeePerGas, "maxFeePerGas"),
|
|
2526
|
-
maxPriorityFeePerGas: parseBigint(tx.maxPriorityFeePerGas, "maxPriorityFeePerGas"),
|
|
2527
|
-
gasLimit: parseBigint(tx.gasLimit, "gasLimit")
|
|
2528
|
-
};
|
|
2529
|
-
}
|
|
2530
|
-
function inferMempoolClass(tx) {
|
|
2531
|
-
if (tx.to === null || hasInput(tx.input)) return MempoolClass.ContractCall;
|
|
2532
|
-
return MempoolClass.Transfer;
|
|
2533
|
-
}
|
|
2534
|
-
function hasInput(input) {
|
|
2535
|
-
if (input === void 0) return false;
|
|
2536
|
-
if (typeof input === "string") {
|
|
2537
|
-
const stripped = input.startsWith("0x") || input.startsWith("0X") ? input.slice(2) : input;
|
|
2538
|
-
return stripped.length > 0;
|
|
2539
|
-
}
|
|
2540
|
-
return input.length > 0;
|
|
2541
|
-
}
|
|
2542
|
-
|
|
2543
2116
|
// src/mrv.ts
|
|
2544
2117
|
var MRV_FORMAT_VERSION = 1;
|
|
2545
2118
|
var MRV_DEPLOY_PAYLOAD_VERSION = 1;
|
|
@@ -3027,29 +2600,28 @@ function buildMrvNativeFeePreview(executionUnitLimit, maxExecutionFeeLythoshi, p
|
|
|
3027
2600
|
async function submitMrvDeployNativeTx(client, backend, artifactBytes, options) {
|
|
3028
2601
|
const plan = buildMrvDeployNativeTxPlan(artifactBytes, options);
|
|
3029
2602
|
assertMrvDeployNativeSubmissionPlan(plan);
|
|
3030
|
-
return
|
|
2603
|
+
return submitMrvPlaintextNativeTx(client, backend, plan);
|
|
3031
2604
|
}
|
|
3032
2605
|
async function submitMrvDeployPayloadNativeTx(client, backend, artifactBytes, options) {
|
|
3033
2606
|
const plan = buildMrvDeployPayloadNativeTxPlan(artifactBytes, options);
|
|
3034
2607
|
assertMrvDeployNativeSubmissionPlan(plan);
|
|
3035
|
-
return
|
|
2608
|
+
return submitMrvPlaintextNativeTx(client, backend, plan);
|
|
3036
2609
|
}
|
|
3037
2610
|
async function submitMrvCallNativeTx(client, backend, contractAddress, input, options) {
|
|
3038
2611
|
const plan = buildMrvCallNativeTxPlan(contractAddress, input, options);
|
|
3039
2612
|
assertMrvCallNativeSubmissionPlan(plan);
|
|
3040
|
-
return
|
|
3041
|
-
}
|
|
3042
|
-
async function
|
|
3043
|
-
const submission =
|
|
3044
|
-
backend,
|
|
3045
|
-
tx: plan.tx,
|
|
3046
|
-
encryptionKey: options.encryptionKey ?? await fetchEncryptionKey(client),
|
|
3047
|
-
class: options.class
|
|
3048
|
-
});
|
|
2613
|
+
return submitMrvPlaintextNativeTx(client, backend, plan);
|
|
2614
|
+
}
|
|
2615
|
+
async function submitMrvPlaintextNativeTx(client, backend, plan) {
|
|
2616
|
+
const submission = buildPlaintextSubmission({ backend, tx: plan.tx });
|
|
3049
2617
|
return {
|
|
3050
2618
|
...plan,
|
|
3051
2619
|
...submission,
|
|
3052
|
-
txHash: await
|
|
2620
|
+
txHash: await submitPlaintextTransaction(
|
|
2621
|
+
client,
|
|
2622
|
+
submission.signedTxWireHex,
|
|
2623
|
+
submission.innerTxHashHex
|
|
2624
|
+
)
|
|
3053
2625
|
};
|
|
3054
2626
|
}
|
|
3055
2627
|
function assertMrvNativeSubmissionEnvelope(plan) {
|
|
@@ -3353,50 +2925,264 @@ function validateExecutionUnitLimit(field2, value) {
|
|
|
3353
2925
|
if (value !== void 0 && BigInt(value) === 0n) {
|
|
3354
2926
|
throw new MrvValidationError(`${field2} must be greater than zero`);
|
|
3355
2927
|
}
|
|
3356
|
-
}
|
|
3357
|
-
function normalizeU64(value, field2) {
|
|
3358
|
-
if (typeof value === "number" && !Number.isSafeInteger(value)) {
|
|
3359
|
-
throw new MrvValidationError(`${field2} must be a safe unsigned integer`);
|
|
2928
|
+
}
|
|
2929
|
+
function normalizeU64(value, field2) {
|
|
2930
|
+
if (typeof value === "number" && !Number.isSafeInteger(value)) {
|
|
2931
|
+
throw new MrvValidationError(`${field2} must be a safe unsigned integer`);
|
|
2932
|
+
}
|
|
2933
|
+
const out = BigInt(value);
|
|
2934
|
+
if (out < 0n || out > 0xffffffffffffffffn) {
|
|
2935
|
+
throw new MrvValidationError(`${field2} must fit in u64`);
|
|
2936
|
+
}
|
|
2937
|
+
return out;
|
|
2938
|
+
}
|
|
2939
|
+
function validateHexLength(field2, value, expected) {
|
|
2940
|
+
const bytes = hexToBytes3(value, field2);
|
|
2941
|
+
if (bytes.length !== expected) throw new MrvValidationError(`${field2} must be ${expected} bytes`);
|
|
2942
|
+
}
|
|
2943
|
+
function bytesFrom(value, field2) {
|
|
2944
|
+
if (typeof value === "string") return hexToBytes3(value, field2);
|
|
2945
|
+
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
2946
|
+
}
|
|
2947
|
+
function hexToBytes3(value, field2) {
|
|
2948
|
+
if (!/^0x(?:[0-9a-fA-F]{2})*$/.test(value)) {
|
|
2949
|
+
throw new MrvValidationError(`${field2} must be 0x-prefixed even-length hex`);
|
|
2950
|
+
}
|
|
2951
|
+
const out = new Uint8Array((value.length - 2) / 2);
|
|
2952
|
+
for (let i = 0; i < out.length; i++) {
|
|
2953
|
+
out[i] = Number.parseInt(value.slice(2 + i * 2, 4 + i * 2), 16);
|
|
2954
|
+
}
|
|
2955
|
+
return out;
|
|
2956
|
+
}
|
|
2957
|
+
function bytesToHex3(bytes) {
|
|
2958
|
+
return `0x${[...bytes].map((b) => b.toString(16).padStart(2, "0")).join("")}`;
|
|
2959
|
+
}
|
|
2960
|
+
function concatBytes3(...parts) {
|
|
2961
|
+
const len = parts.reduce((sum, item) => sum + item.length, 0);
|
|
2962
|
+
const out = new Uint8Array(len);
|
|
2963
|
+
let offset = 0;
|
|
2964
|
+
for (const part of parts) {
|
|
2965
|
+
out.set(part, offset);
|
|
2966
|
+
offset += part.length;
|
|
2967
|
+
}
|
|
2968
|
+
return out;
|
|
2969
|
+
}
|
|
2970
|
+
function isIdentifier(value) {
|
|
2971
|
+
return /^[a-z][a-z0-9_]*$/.test(value);
|
|
2972
|
+
}
|
|
2973
|
+
|
|
2974
|
+
// src/crypto/tx.ts
|
|
2975
|
+
function encodeTransactionForHash(fields, tag) {
|
|
2976
|
+
const n = normalizeTxFields(fields);
|
|
2977
|
+
return concatBytes2(
|
|
2978
|
+
Uint8Array.of(tag),
|
|
2979
|
+
bigintToBeBytes(n.chainId, 8, "chainId"),
|
|
2980
|
+
bigintToBeBytes(n.nonce, 8, "nonce"),
|
|
2981
|
+
bigintToBeBytes(n.maxPriorityFeePerGas, 32, "maxPriorityFeePerGas"),
|
|
2982
|
+
bigintToBeBytes(n.maxFeePerGas, 32, "maxFeePerGas"),
|
|
2983
|
+
bigintToBeBytes(n.gasLimit, 8, "gasLimit"),
|
|
2984
|
+
n.to === null ? Uint8Array.of(0) : concatBytes2(Uint8Array.of(1), n.to),
|
|
2985
|
+
bigintToBeBytes(n.value, 32, "value"),
|
|
2986
|
+
bigintToBeBytes(BigInt(n.input.length), 4, "input.length"),
|
|
2987
|
+
n.input,
|
|
2988
|
+
new Uint8Array(4),
|
|
2989
|
+
// access_list length
|
|
2990
|
+
encodeExtensionsForHash(n.extensions)
|
|
2991
|
+
);
|
|
2992
|
+
}
|
|
2993
|
+
function bincodeSignedTransaction(fields, signature, publicKey) {
|
|
2994
|
+
const n = normalizeTxFields(fields);
|
|
2995
|
+
const sig = expectBytes(signature, ML_DSA_65_SIGNATURE_LEN, "ML-DSA-65 signature");
|
|
2996
|
+
const pk = expectBytes(publicKey, ML_DSA_65_PUBLIC_KEY_LEN, "ML-DSA-65 public key");
|
|
2997
|
+
const w = new BincodeWriter();
|
|
2998
|
+
w.u64(n.chainId);
|
|
2999
|
+
w.u64(n.nonce);
|
|
3000
|
+
w.bytes(uint256Be(n.maxPriorityFeePerGas, "maxPriorityFeePerGas"));
|
|
3001
|
+
w.bytes(uint256Be(n.maxFeePerGas, "maxFeePerGas"));
|
|
3002
|
+
w.u64(n.gasLimit);
|
|
3003
|
+
if (n.to === null) {
|
|
3004
|
+
w.u8(0);
|
|
3005
|
+
} else {
|
|
3006
|
+
w.u8(1);
|
|
3007
|
+
w.bytes(n.to);
|
|
3008
|
+
}
|
|
3009
|
+
w.bytes(uint256Be(n.value, "value"));
|
|
3010
|
+
w.bytes(n.input);
|
|
3011
|
+
w.u64(0n);
|
|
3012
|
+
w.u64(BigInt(n.extensions.length));
|
|
3013
|
+
for (const ext of n.extensions) bincodeTypedExtensionInto(w, ext);
|
|
3014
|
+
bincodeMlDsa65OpaqueInto(w, sig);
|
|
3015
|
+
bincodeMlDsa65OpaqueInto(w, pk);
|
|
3016
|
+
return w.toBytes();
|
|
3017
|
+
}
|
|
3018
|
+
function normalizeTxFields(fields) {
|
|
3019
|
+
return {
|
|
3020
|
+
chainId: parseBigint(fields.chainId, "chainId"),
|
|
3021
|
+
nonce: parseBigint(fields.nonce, "nonce"),
|
|
3022
|
+
maxPriorityFeePerGas: parseBigint(fields.maxPriorityFeePerGas, "maxPriorityFeePerGas"),
|
|
3023
|
+
maxFeePerGas: parseBigint(fields.maxFeePerGas, "maxFeePerGas"),
|
|
3024
|
+
gasLimit: parseBigint(fields.gasLimit, "gasLimit"),
|
|
3025
|
+
to: normalizeTo(fields.to),
|
|
3026
|
+
value: parseBigint(fields.value, "value"),
|
|
3027
|
+
input: normalizeBytes(fields.input ?? new Uint8Array(0), "input"),
|
|
3028
|
+
extensions: normalizeExtensions(fields.extensions)
|
|
3029
|
+
};
|
|
3030
|
+
}
|
|
3031
|
+
function normalizeTo(value) {
|
|
3032
|
+
if (value === null) return null;
|
|
3033
|
+
const bytes = normalizeBytes(value, "to");
|
|
3034
|
+
return expectBytes(bytes, 20, "to");
|
|
3035
|
+
}
|
|
3036
|
+
function normalizeBytes(value, label) {
|
|
3037
|
+
if (typeof value === "string") return hexToBytes2(value, label);
|
|
3038
|
+
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
3039
|
+
}
|
|
3040
|
+
function normalizeExtensions(value) {
|
|
3041
|
+
if (value === void 0) return [];
|
|
3042
|
+
return value.map((ext, index) => {
|
|
3043
|
+
if (!Number.isInteger(ext.kind) || ext.kind < 0 || ext.kind > 255) {
|
|
3044
|
+
throw new Error(`extensions[${index}].kind out of u8 range`);
|
|
3045
|
+
}
|
|
3046
|
+
const body = normalizeBytes("bodyHex" in ext ? ext.bodyHex : ext.body, `extensions[${index}].body`);
|
|
3047
|
+
if (body.length > 4294967295) {
|
|
3048
|
+
throw new Error(`extensions[${index}].body exceeds u32 length`);
|
|
3049
|
+
}
|
|
3050
|
+
return { kind: ext.kind, body };
|
|
3051
|
+
});
|
|
3052
|
+
}
|
|
3053
|
+
function encodeExtensionsForHash(extensions) {
|
|
3054
|
+
const chunks = [bigintToBeBytes(BigInt(extensions.length), 4, "extensions.length")];
|
|
3055
|
+
for (const ext of extensions) {
|
|
3056
|
+
chunks.push(
|
|
3057
|
+
Uint8Array.of(ext.kind),
|
|
3058
|
+
bigintToBeBytes(BigInt(ext.body.length), 4, "extension.body.length"),
|
|
3059
|
+
ext.body
|
|
3060
|
+
);
|
|
3061
|
+
}
|
|
3062
|
+
return concatBytes2(...chunks);
|
|
3063
|
+
}
|
|
3064
|
+
function uint256Be(value, label) {
|
|
3065
|
+
if (value < 0n || value >= 1n << 256n) throw new Error(`${label} out of u256 range`);
|
|
3066
|
+
const out = new Uint8Array(32);
|
|
3067
|
+
let v = value;
|
|
3068
|
+
for (let i = 31; i >= 0; i--) {
|
|
3069
|
+
out[i] = Number(v & 0xffn);
|
|
3070
|
+
v >>= 8n;
|
|
3071
|
+
}
|
|
3072
|
+
return out;
|
|
3073
|
+
}
|
|
3074
|
+
function bincodeMlDsa65OpaqueInto(w, raw) {
|
|
3075
|
+
w.enumVariant(ENUM_VARIANT_INDEX_ML_DSA_65);
|
|
3076
|
+
w.u16(STANDARD_ALGO_NUMBER_ML_DSA_65);
|
|
3077
|
+
w.bytes(raw);
|
|
3078
|
+
}
|
|
3079
|
+
function bincodeTypedExtensionInto(w, ext) {
|
|
3080
|
+
w.u8(ext.kind);
|
|
3081
|
+
w.bytes(ext.body);
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3084
|
+
// src/crypto/ml-dsa.ts
|
|
3085
|
+
var ML_DSA_65_SEED_LEN = 32;
|
|
3086
|
+
var ML_DSA_65_SIGNING_KEY_LEN = 4032;
|
|
3087
|
+
var ML_DSA_65_PUBLIC_KEY_LEN = 1952;
|
|
3088
|
+
var ML_DSA_65_SIGNATURE_LEN = 3309;
|
|
3089
|
+
var STANDARD_ALGO_NUMBER_ML_DSA_65 = 1001;
|
|
3090
|
+
var ENUM_VARIANT_INDEX_ML_DSA_65 = 3;
|
|
3091
|
+
var ADDRESS_DERIVATION_DOMAIN = "MONO_ADDRESS_BLAKE3_20_V1";
|
|
3092
|
+
var ADDRESS_DERIVATION_DOMAIN_BYTES = new TextEncoder().encode(ADDRESS_DERIVATION_DOMAIN);
|
|
3093
|
+
var MlDsa65Backend = class _MlDsa65Backend {
|
|
3094
|
+
#secretKey;
|
|
3095
|
+
#publicKey;
|
|
3096
|
+
#addressBytes;
|
|
3097
|
+
#disposed = false;
|
|
3098
|
+
constructor(secretKey, publicKey) {
|
|
3099
|
+
this.#secretKey = expectBytes(secretKey, ML_DSA_65_SIGNING_KEY_LEN, "ML-DSA-65 secret key").slice();
|
|
3100
|
+
this.#publicKey = expectBytes(publicKey, ML_DSA_65_PUBLIC_KEY_LEN, "ML-DSA-65 public key").slice();
|
|
3101
|
+
this.#addressBytes = mlDsa65AddressBytes(this.#publicKey);
|
|
3102
|
+
}
|
|
3103
|
+
static fromSeed(seed) {
|
|
3104
|
+
const kp = ml_dsa65.keygen(expectBytes(seed, ML_DSA_65_SEED_LEN, "ML-DSA-65 seed"));
|
|
3105
|
+
return new _MlDsa65Backend(kp.secretKey, kp.publicKey);
|
|
3106
|
+
}
|
|
3107
|
+
publicKey() {
|
|
3108
|
+
return this.#publicKey.slice();
|
|
3109
|
+
}
|
|
3110
|
+
addressBytes() {
|
|
3111
|
+
return this.#addressBytes.slice();
|
|
3112
|
+
}
|
|
3113
|
+
getAddress() {
|
|
3114
|
+
return bytesToHex2(this.#addressBytes);
|
|
3115
|
+
}
|
|
3116
|
+
sign(message) {
|
|
3117
|
+
if (this.#disposed) {
|
|
3118
|
+
throw new Error("MlDsa65Backend disposed");
|
|
3119
|
+
}
|
|
3120
|
+
return ml_dsa65.sign(message, this.#secretKey, { extraEntropy: false });
|
|
3121
|
+
}
|
|
3122
|
+
/**
|
|
3123
|
+
* Best-effort deterministic wipe of the in-memory secret key. Zeroes the
|
|
3124
|
+
* SDK-held `#secretKey` copy and makes any subsequent `sign()` /
|
|
3125
|
+
* `signPrehash()` / `signEvmTx()` throw `"MlDsa65Backend disposed"` rather
|
|
3126
|
+
* than signing with a zeroed key. Idempotent. Public material
|
|
3127
|
+
* (`publicKey()` / `getAddress()` / `verify()`) stays usable.
|
|
3128
|
+
*
|
|
3129
|
+
* Defense-in-depth (S1-01): narrows the post-lock residency window of the
|
|
3130
|
+
* ML-DSA-65 secret in the JS heap. `@noble/post-quantum`'s internal
|
|
3131
|
+
* transient keygen/sign buffers are out of scope; the SDK-held copy is the
|
|
3132
|
+
* meaningful residency win.
|
|
3133
|
+
*/
|
|
3134
|
+
dispose() {
|
|
3135
|
+
this.#secretKey.fill(0);
|
|
3136
|
+
this.#disposed = true;
|
|
3137
|
+
}
|
|
3138
|
+
/** Alias for {@link dispose}. */
|
|
3139
|
+
zeroize() {
|
|
3140
|
+
this.dispose();
|
|
3360
3141
|
}
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3142
|
+
/** Whether {@link dispose} has been called (the secret key is wiped). */
|
|
3143
|
+
get disposed() {
|
|
3144
|
+
return this.#disposed;
|
|
3364
3145
|
}
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
function validateHexLength(field2, value, expected) {
|
|
3368
|
-
const bytes = hexToBytes3(value, field2);
|
|
3369
|
-
if (bytes.length !== expected) throw new MrvValidationError(`${field2} must be ${expected} bytes`);
|
|
3370
|
-
}
|
|
3371
|
-
function bytesFrom(value, field2) {
|
|
3372
|
-
if (typeof value === "string") return hexToBytes3(value, field2);
|
|
3373
|
-
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
3374
|
-
}
|
|
3375
|
-
function hexToBytes3(value, field2) {
|
|
3376
|
-
if (!/^0x(?:[0-9a-fA-F]{2})*$/.test(value)) {
|
|
3377
|
-
throw new MrvValidationError(`${field2} must be 0x-prefixed even-length hex`);
|
|
3146
|
+
signPrehash(digest) {
|
|
3147
|
+
return this.sign(expectBytes(digest, 32, "prehash"));
|
|
3378
3148
|
}
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3149
|
+
verify(message, signature) {
|
|
3150
|
+
return ml_dsa65.verify(
|
|
3151
|
+
expectBytes(signature, ML_DSA_65_SIGNATURE_LEN, "ML-DSA-65 signature"),
|
|
3152
|
+
message,
|
|
3153
|
+
this.#publicKey
|
|
3154
|
+
);
|
|
3382
3155
|
}
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3156
|
+
signEvmTx(fields) {
|
|
3157
|
+
const txHashPreimage = encodeTransactionForHash(fields, 1);
|
|
3158
|
+
const sighash = keccak_256(txHashPreimage);
|
|
3159
|
+
const signature = this.sign(sighash);
|
|
3160
|
+
const wireBytes = bincodeSignedTransaction(fields, signature, this.#publicKey);
|
|
3161
|
+
const txHash = keccak_256(
|
|
3162
|
+
concatBytes2(
|
|
3163
|
+
encodeTransactionForHash(fields, 2),
|
|
3164
|
+
signature,
|
|
3165
|
+
this.#publicKey
|
|
3166
|
+
)
|
|
3167
|
+
);
|
|
3168
|
+
return {
|
|
3169
|
+
wireHex: bytesToHex2(wireBytes).slice(2),
|
|
3170
|
+
wireBytes,
|
|
3171
|
+
sighash,
|
|
3172
|
+
txHash
|
|
3173
|
+
};
|
|
3395
3174
|
}
|
|
3396
|
-
|
|
3175
|
+
};
|
|
3176
|
+
function mlDsa65AddressFromPublicKey(publicKey) {
|
|
3177
|
+
return bytesToHex2(mlDsa65AddressBytes(publicKey));
|
|
3397
3178
|
}
|
|
3398
|
-
function
|
|
3399
|
-
|
|
3179
|
+
function mlDsa65AddressBytes(publicKey) {
|
|
3180
|
+
const bytes = expectBytes(publicKey, ML_DSA_65_PUBLIC_KEY_LEN, "ML-DSA-65 public key");
|
|
3181
|
+
return blake3(concatBytes2(
|
|
3182
|
+
ADDRESS_DERIVATION_DOMAIN_BYTES,
|
|
3183
|
+
bigintToBeBytes(BigInt(STANDARD_ALGO_NUMBER_ML_DSA_65), 2, "ML-DSA-65 algo id"),
|
|
3184
|
+
bytes
|
|
3185
|
+
)).slice(0, 20);
|
|
3400
3186
|
}
|
|
3401
3187
|
|
|
3402
3188
|
// src/registry.ts
|
|
@@ -3406,8 +3192,8 @@ var TESTNET_69420 = {
|
|
|
3406
3192
|
network: "testnet-69420",
|
|
3407
3193
|
display_name: "Monolythium Testnet",
|
|
3408
3194
|
description: "Public Monolythium testnet. Testnet state may reset without notice; do not store value on this network.",
|
|
3409
|
-
genesis_hash: "
|
|
3410
|
-
binary_sha: "
|
|
3195
|
+
genesis_hash: "0xb52b59d667a0ad97c531607b840b7082547ba3151aa11a819eb6916b080b1ca9",
|
|
3196
|
+
binary_sha: "6f33aa30",
|
|
3411
3197
|
rpc: [
|
|
3412
3198
|
{
|
|
3413
3199
|
url: "http://178.105.12.9:8545",
|
|
@@ -4987,14 +4773,6 @@ var RpcClient = class _RpcClient {
|
|
|
4987
4773
|
async lythSubmitPendingChange(envelope) {
|
|
4988
4774
|
return this.call("lyth_submitPendingChange", [envelope]);
|
|
4989
4775
|
}
|
|
4990
|
-
/** `lyth_submitEncrypted` — submit a bincode-encoded encrypted envelope hex. */
|
|
4991
|
-
async lythSubmitEncrypted(envelopeHex) {
|
|
4992
|
-
return this.call("lyth_submitEncrypted", [envelopeHex]);
|
|
4993
|
-
}
|
|
4994
|
-
/** `lyth_getEncryptionKey` — cluster ML-KEM encapsulation key. */
|
|
4995
|
-
async lythGetEncryptionKey() {
|
|
4996
|
-
return this.call("lyth_getEncryptionKey", []);
|
|
4997
|
-
}
|
|
4998
4776
|
/** `lyth_syncStatus` — DAG-sync driver snapshot. */
|
|
4999
4777
|
async lythSyncStatus() {
|
|
5000
4778
|
const v = await this.call("lyth_syncStatus", []);
|
|
@@ -8151,7 +7929,7 @@ function verifyBoundedReceiptProof(proof) {
|
|
|
8151
7929
|
}
|
|
8152
7930
|
const actualRoot = computeNoEvmReceiptsRoot(receipts);
|
|
8153
7931
|
const expectedRoot = decodeHash(proof.receiptsRoot, "receiptsRoot");
|
|
8154
|
-
if (!
|
|
7932
|
+
if (!bytesEqual2(expectedRoot, decodeHash(actualRoot, "computedReceiptsRoot"))) {
|
|
8155
7933
|
throw new NoEvmReceiptProofError(
|
|
8156
7934
|
"receipts_root_mismatch",
|
|
8157
7935
|
`receiptsRoot mismatch: expected ${proof.receiptsRoot}, computed ${actualRoot}`
|
|
@@ -8159,7 +7937,7 @@ function verifyBoundedReceiptProof(proof) {
|
|
|
8159
7937
|
}
|
|
8160
7938
|
const actualTargetHash = computeNoEvmTargetReceiptHash(targetReceipt);
|
|
8161
7939
|
const expectedTargetHash = decodeHash(proof.targetReceiptHash, "targetReceiptHash");
|
|
8162
|
-
if (!
|
|
7940
|
+
if (!bytesEqual2(expectedTargetHash, decodeHash(actualTargetHash, "computedTargetReceiptHash"))) {
|
|
8163
7941
|
throw new NoEvmReceiptProofError(
|
|
8164
7942
|
"target_receipt_hash_mismatch",
|
|
8165
7943
|
`targetReceiptHash mismatch: expected ${proof.targetReceiptHash}, computed ${actualTargetHash}`
|
|
@@ -8216,7 +7994,7 @@ function verifyCompactReceiptProof(proof) {
|
|
|
8216
7994
|
const targetReceipt = decodeHexBytes(targetReceiptBytes, "targetReceiptBytes");
|
|
8217
7995
|
const actualTargetHash = computeNoEvmTargetReceiptHash(targetReceipt);
|
|
8218
7996
|
const expectedTargetHash = decodeHash(proof.targetReceiptHash, "targetReceiptHash");
|
|
8219
|
-
if (!
|
|
7997
|
+
if (!bytesEqual2(expectedTargetHash, decodeHash(actualTargetHash, "computedTargetReceiptHash"))) {
|
|
8220
7998
|
throw new NoEvmReceiptProofError(
|
|
8221
7999
|
"target_receipt_hash_mismatch",
|
|
8222
8000
|
`targetReceiptHash mismatch: expected ${proof.targetReceiptHash}, computed ${actualTargetHash}`
|
|
@@ -8227,7 +8005,7 @@ function verifyCompactReceiptProof(proof) {
|
|
|
8227
8005
|
compactProof.leafHash,
|
|
8228
8006
|
"compactInclusionProof.leafHash"
|
|
8229
8007
|
);
|
|
8230
|
-
if (!
|
|
8008
|
+
if (!bytesEqual2(expectedLeafHashBytes, actualLeafHashBytes)) {
|
|
8231
8009
|
throw new NoEvmReceiptProofError(
|
|
8232
8010
|
"compact_leaf_hash_mismatch",
|
|
8233
8011
|
`compactInclusionProof.leafHash mismatch: expected ${compactProof.leafHash}, computed ${bytesToHex6(
|
|
@@ -8237,7 +8015,7 @@ function verifyCompactReceiptProof(proof) {
|
|
|
8237
8015
|
}
|
|
8238
8016
|
const compactRootBytes = decodeHash(compactProof.root, "compactInclusionProof.root");
|
|
8239
8017
|
const receiptsRootBytes = decodeHash(proof.receiptsRoot, "receiptsRoot");
|
|
8240
|
-
if (!
|
|
8018
|
+
if (!bytesEqual2(receiptsRootBytes, compactRootBytes)) {
|
|
8241
8019
|
throw new NoEvmReceiptProofError(
|
|
8242
8020
|
"compact_root_mismatch",
|
|
8243
8021
|
`receiptsRoot must equal compactInclusionProof.root: receiptsRoot ${proof.receiptsRoot}, compact root ${compactProof.root}`
|
|
@@ -8260,7 +8038,7 @@ function verifyCompactReceiptProof(proof) {
|
|
|
8260
8038
|
siblingHashes,
|
|
8261
8039
|
pathSides
|
|
8262
8040
|
);
|
|
8263
|
-
if (!
|
|
8041
|
+
if (!bytesEqual2(actualRootBytes, compactRootBytes)) {
|
|
8264
8042
|
throw new NoEvmReceiptProofError(
|
|
8265
8043
|
"compact_path_mismatch",
|
|
8266
8044
|
`compact inclusion path mismatch: expected ${compactProof.root}, computed ${bytesToHex6(
|
|
@@ -8414,7 +8192,7 @@ function validateCoveringSnapshotObject(snapshot, archiveContentHash, proofBlock
|
|
|
8414
8192
|
"archiveProof.coveringSnapshot.checkpointTo must match blockHeight"
|
|
8415
8193
|
);
|
|
8416
8194
|
}
|
|
8417
|
-
if (!
|
|
8195
|
+
if (!bytesEqual2(checkpointContentHash, archiveContentHash)) {
|
|
8418
8196
|
throw new NoEvmReceiptProofError(
|
|
8419
8197
|
"invalid_proof_shape",
|
|
8420
8198
|
"archiveProof.coveringSnapshot.checkpointContentHash must match archiveProof.contentHash"
|
|
@@ -8613,7 +8391,7 @@ function validateFinalityBlockReference(blockReference, round, proofBlockHash) {
|
|
|
8613
8391
|
);
|
|
8614
8392
|
if (proofBlockHash !== void 0) {
|
|
8615
8393
|
const blockHash = decodeHash(proofBlockHash, "blockHash");
|
|
8616
|
-
if (!
|
|
8394
|
+
if (!bytesEqual2(digest, blockHash)) {
|
|
8617
8395
|
throw new NoEvmReceiptProofError(
|
|
8618
8396
|
"invalid_proof_shape",
|
|
8619
8397
|
"finalityEvidence.blockReference.digest must match blockHash"
|
|
@@ -8963,7 +8741,7 @@ function assertHashBytes(value, field2) {
|
|
|
8963
8741
|
function isRecord3(value) {
|
|
8964
8742
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8965
8743
|
}
|
|
8966
|
-
function
|
|
8744
|
+
function bytesEqual2(a, b) {
|
|
8967
8745
|
if (a.length !== b.length) return false;
|
|
8968
8746
|
let diff = 0;
|
|
8969
8747
|
for (let index = 0; index < a.length; index++) {
|
|
@@ -8978,6 +8756,191 @@ function bytesToHex6(bytes) {
|
|
|
8978
8756
|
}
|
|
8979
8757
|
return out;
|
|
8980
8758
|
}
|
|
8759
|
+
var TREE_TAG_LEAF = 0;
|
|
8760
|
+
var TREE_TAG_INTERNAL = 1;
|
|
8761
|
+
var TREE_TERMINATOR = new Uint8Array(32);
|
|
8762
|
+
var HASH_BYTE_LENGTH2 = 32;
|
|
8763
|
+
var PROOF_KIND_BINARY = "binary";
|
|
8764
|
+
var ProofVerifyError = class extends Error {
|
|
8765
|
+
constructor(code, message) {
|
|
8766
|
+
super(message);
|
|
8767
|
+
this.code = code;
|
|
8768
|
+
this.name = "ProofVerifyError";
|
|
8769
|
+
}
|
|
8770
|
+
code;
|
|
8771
|
+
};
|
|
8772
|
+
function hashValue(data) {
|
|
8773
|
+
return blake3(data);
|
|
8774
|
+
}
|
|
8775
|
+
function hashLeaf(path, valueHash) {
|
|
8776
|
+
const buf = new Uint8Array(1 + 32 + 32);
|
|
8777
|
+
buf[0] = TREE_TAG_LEAF;
|
|
8778
|
+
buf.set(path, 1);
|
|
8779
|
+
buf.set(valueHash, 33);
|
|
8780
|
+
return blake3(buf);
|
|
8781
|
+
}
|
|
8782
|
+
function compress(left, right) {
|
|
8783
|
+
if (isTerminator(left) && isTerminator(right)) {
|
|
8784
|
+
return TREE_TERMINATOR;
|
|
8785
|
+
}
|
|
8786
|
+
const buf = new Uint8Array(1 + 32 + 32);
|
|
8787
|
+
buf[0] = TREE_TAG_INTERNAL;
|
|
8788
|
+
buf.set(left, 1);
|
|
8789
|
+
buf.set(right, 33);
|
|
8790
|
+
return blake3(buf);
|
|
8791
|
+
}
|
|
8792
|
+
function isTerminator(hash) {
|
|
8793
|
+
for (let i = 0; i < hash.length; i++) {
|
|
8794
|
+
if (hash[i] !== 0) return false;
|
|
8795
|
+
}
|
|
8796
|
+
return true;
|
|
8797
|
+
}
|
|
8798
|
+
function pathBit(path, depth) {
|
|
8799
|
+
const byte = path[depth >>> 3];
|
|
8800
|
+
return byte >>> 7 - (depth & 7) & 1;
|
|
8801
|
+
}
|
|
8802
|
+
function foldToRoot(target, current, siblings) {
|
|
8803
|
+
const depth = siblings.length;
|
|
8804
|
+
let node = current;
|
|
8805
|
+
for (let i = 0; i < depth; i++) {
|
|
8806
|
+
const level = depth - 1 - i;
|
|
8807
|
+
const sibling = siblings[i];
|
|
8808
|
+
node = pathBit(target, level) === 0 ? compress(node, sibling) : compress(sibling, node);
|
|
8809
|
+
}
|
|
8810
|
+
return node;
|
|
8811
|
+
}
|
|
8812
|
+
function bytesEqual3(a, b) {
|
|
8813
|
+
if (a.length !== b.length) return false;
|
|
8814
|
+
for (let i = 0; i < a.length; i++) {
|
|
8815
|
+
if (a[i] !== b[i]) return false;
|
|
8816
|
+
}
|
|
8817
|
+
return true;
|
|
8818
|
+
}
|
|
8819
|
+
function decodeHash2(value, field2) {
|
|
8820
|
+
let bytes;
|
|
8821
|
+
try {
|
|
8822
|
+
bytes = hexToBytes2(value, field2);
|
|
8823
|
+
} catch (cause) {
|
|
8824
|
+
throw new ProofVerifyError("invalid_hex", `${field2} is not valid hex: ${String(cause)}`);
|
|
8825
|
+
}
|
|
8826
|
+
if (bytes.length !== HASH_BYTE_LENGTH2) {
|
|
8827
|
+
throw new ProofVerifyError(
|
|
8828
|
+
"invalid_hash_length",
|
|
8829
|
+
`${field2} must be ${HASH_BYTE_LENGTH2} bytes, got ${bytes.length}`
|
|
8830
|
+
);
|
|
8831
|
+
}
|
|
8832
|
+
return bytes;
|
|
8833
|
+
}
|
|
8834
|
+
function decodeSiblings(siblings) {
|
|
8835
|
+
return siblings.map((sib, index) => decodeHash2(sib, `siblings[${index}]`));
|
|
8836
|
+
}
|
|
8837
|
+
function assertBinaryKind(proofKind) {
|
|
8838
|
+
if (proofKind !== PROOF_KIND_BINARY) {
|
|
8839
|
+
throw new ProofVerifyError(
|
|
8840
|
+
"unsupported_proof_kind",
|
|
8841
|
+
`unsupported proofKind: ${proofKind} (expected ${PROOF_KIND_BINARY})`
|
|
8842
|
+
);
|
|
8843
|
+
}
|
|
8844
|
+
}
|
|
8845
|
+
var ProofVerifier = class {
|
|
8846
|
+
/**
|
|
8847
|
+
* Verify a {@link ProofEnvelope} inclusion proof against `stateRoot`.
|
|
8848
|
+
*
|
|
8849
|
+
* @returns `true` when the proof binds `(key, value)` to `stateRoot`.
|
|
8850
|
+
*/
|
|
8851
|
+
verifyInclusion(stateRoot, proof) {
|
|
8852
|
+
assertBinaryKind(proof.proofKind);
|
|
8853
|
+
const root = toHashBytes(stateRoot, "stateRoot");
|
|
8854
|
+
const key = decodeHex(proof.key, "proof.key");
|
|
8855
|
+
const value = decodeHex(proof.value, "proof.value");
|
|
8856
|
+
const siblings = decodeSiblings(proof.siblings);
|
|
8857
|
+
const target = hashValue(key);
|
|
8858
|
+
const leaf = hashLeaf(target, hashValue(value));
|
|
8859
|
+
return bytesEqual3(foldToRoot(target, leaf, siblings), root);
|
|
8860
|
+
}
|
|
8861
|
+
/**
|
|
8862
|
+
* Verify a {@link ProofEnvelope} inclusion proof, throwing a
|
|
8863
|
+
* {@link ProofVerifyError} on failure (the loud variant for wallets).
|
|
8864
|
+
*/
|
|
8865
|
+
assertInclusion(stateRoot, proof) {
|
|
8866
|
+
if (!this.verifyInclusion(stateRoot, proof)) {
|
|
8867
|
+
throw new ProofVerifyError(
|
|
8868
|
+
"proof_verify_failed",
|
|
8869
|
+
`inclusion proof for key ${proof.key} does not verify against the state root`
|
|
8870
|
+
);
|
|
8871
|
+
}
|
|
8872
|
+
}
|
|
8873
|
+
/**
|
|
8874
|
+
* Verify a {@link NonInclusionProofEnvelope} against `stateRoot`.
|
|
8875
|
+
*
|
|
8876
|
+
* Returns `false` for a `found` endpoint (that is an inclusion, not
|
|
8877
|
+
* absence) or an `otherLeaf` whose path equals the queried key. Mirrors
|
|
8878
|
+
* `protocore_state::verify_binary_non_inclusion`.
|
|
8879
|
+
*/
|
|
8880
|
+
verifyNonInclusion(stateRoot, proof) {
|
|
8881
|
+
assertBinaryKind(proof.proofKind);
|
|
8882
|
+
const root = toHashBytes(stateRoot, "stateRoot");
|
|
8883
|
+
const key = decodeHex(proof.key, "proof.key");
|
|
8884
|
+
const siblings = decodeSiblings(proof.siblings);
|
|
8885
|
+
const target = hashValue(key);
|
|
8886
|
+
let endpointHash;
|
|
8887
|
+
switch (proof.endpoint.kind) {
|
|
8888
|
+
case "found":
|
|
8889
|
+
return false;
|
|
8890
|
+
case "terminator":
|
|
8891
|
+
endpointHash = TREE_TERMINATOR;
|
|
8892
|
+
break;
|
|
8893
|
+
case "otherLeaf": {
|
|
8894
|
+
const path = decodeHash2(proof.endpoint.path, "endpoint.path");
|
|
8895
|
+
if (bytesEqual3(path, target)) return false;
|
|
8896
|
+
endpointHash = hashLeaf(path, decodeHash2(proof.endpoint.valueHash, "endpoint.valueHash"));
|
|
8897
|
+
break;
|
|
8898
|
+
}
|
|
8899
|
+
}
|
|
8900
|
+
return bytesEqual3(foldToRoot(target, endpointHash, siblings), root);
|
|
8901
|
+
}
|
|
8902
|
+
/**
|
|
8903
|
+
* Verify a non-inclusion proof, throwing a {@link ProofVerifyError} on
|
|
8904
|
+
* failure.
|
|
8905
|
+
*/
|
|
8906
|
+
assertNonInclusion(stateRoot, proof) {
|
|
8907
|
+
if (!this.verifyNonInclusion(stateRoot, proof)) {
|
|
8908
|
+
throw new ProofVerifyError(
|
|
8909
|
+
"non_inclusion_verify_failed",
|
|
8910
|
+
`non-inclusion proof for key ${proof.key} does not verify against the state root`
|
|
8911
|
+
);
|
|
8912
|
+
}
|
|
8913
|
+
}
|
|
8914
|
+
};
|
|
8915
|
+
var proofVerifier = new ProofVerifier();
|
|
8916
|
+
function toHashBytes(value, field2) {
|
|
8917
|
+
if (typeof value === "string") return decodeHash2(value, field2);
|
|
8918
|
+
return expectBytes(value, HASH_BYTE_LENGTH2, field2);
|
|
8919
|
+
}
|
|
8920
|
+
function decodeHex(value, field2) {
|
|
8921
|
+
try {
|
|
8922
|
+
return hexToBytes2(value, field2);
|
|
8923
|
+
} catch (cause) {
|
|
8924
|
+
throw new ProofVerifyError("invalid_hex", `${field2} is not valid hex: ${String(cause)}`);
|
|
8925
|
+
}
|
|
8926
|
+
}
|
|
8927
|
+
function asBinaryProofEnvelope(proof) {
|
|
8928
|
+
if (proof == null || typeof proof !== "object") return null;
|
|
8929
|
+
const obj = proof;
|
|
8930
|
+
if (obj.proofKind !== PROOF_KIND_BINARY) return null;
|
|
8931
|
+
if (typeof obj.key !== "string" || typeof obj.value !== "string" || !Array.isArray(obj.siblings) || obj.siblings.some((s) => typeof s !== "string")) {
|
|
8932
|
+
return null;
|
|
8933
|
+
}
|
|
8934
|
+
return {
|
|
8935
|
+
proofKind: PROOF_KIND_BINARY,
|
|
8936
|
+
siblings: obj.siblings,
|
|
8937
|
+
key: obj.key,
|
|
8938
|
+
value: obj.value
|
|
8939
|
+
};
|
|
8940
|
+
}
|
|
8941
|
+
function hashToHex(hash) {
|
|
8942
|
+
return bytesToHex2(hash);
|
|
8943
|
+
}
|
|
8981
8944
|
|
|
8982
8945
|
// src/native-dev.ts
|
|
8983
8946
|
var NATIVE_DEV_HOST_API_VERSION = "0.1.0";
|
|
@@ -9171,72 +9134,47 @@ function assertWholeNumber(field2, value) {
|
|
|
9171
9134
|
throw new Error(`${field2} must be a whole number`);
|
|
9172
9135
|
}
|
|
9173
9136
|
}
|
|
9174
|
-
var
|
|
9175
|
-
var
|
|
9176
|
-
var
|
|
9177
|
-
var
|
|
9178
|
-
var PQM1_V1_MLDSA65_DOMAIN_TAG = "monolythium.pqm1.v1.mldsa65";
|
|
9179
|
-
var Pqm1Error = class extends Error {
|
|
9137
|
+
var MLDSA65_MNEMONIC_WORDS = 24;
|
|
9138
|
+
var MLDSA65_SEED_DOMAIN = "monolythium.mldsa65.v1";
|
|
9139
|
+
var DOMAIN_BYTES = new TextEncoder().encode(MLDSA65_SEED_DOMAIN);
|
|
9140
|
+
var MnemonicError = class extends Error {
|
|
9180
9141
|
constructor(kind, message) {
|
|
9181
9142
|
super(message);
|
|
9182
9143
|
this.kind = kind;
|
|
9183
|
-
this.name = "
|
|
9144
|
+
this.name = "MnemonicError";
|
|
9184
9145
|
}
|
|
9185
9146
|
kind;
|
|
9186
9147
|
};
|
|
9187
|
-
var DOMAIN_BYTES = new TextEncoder().encode(PQM1_V1_MLDSA65_DOMAIN_TAG);
|
|
9188
9148
|
function normalizeMnemonic(mnemonic) {
|
|
9189
9149
|
return mnemonic.trim().toLowerCase().replace(/\s+/g, " ");
|
|
9190
9150
|
}
|
|
9191
|
-
function
|
|
9192
|
-
|
|
9193
|
-
throw new Pqm1Error("badPayloadLength", `PQM-1 payload must be ${PQM1_PAYLOAD_LEN} bytes, got ${bytes.length}`);
|
|
9194
|
-
}
|
|
9195
|
-
if (bytes[0] !== PQM1_ALGO_TAG_MLDSA65) {
|
|
9196
|
-
throw new Pqm1Error("unsupportedAlgorithm", `unsupported PQM-1 algorithm tag 0x${bytes[0].toString(16).padStart(2, "0")}`);
|
|
9197
|
-
}
|
|
9198
|
-
if (bytes[1] !== PQM1_VERSION_V1) {
|
|
9199
|
-
throw new Pqm1Error("unsupportedVersion", `unsupported PQM-1 version 0x${bytes[1].toString(16).padStart(2, "0")}`);
|
|
9200
|
-
}
|
|
9201
|
-
}
|
|
9202
|
-
function parsePqm1Payload(payload) {
|
|
9203
|
-
const bytes = expectBytes(payload, PQM1_PAYLOAD_LEN, "PQM-1 payload").slice();
|
|
9204
|
-
ensureSupportedPayload(bytes);
|
|
9205
|
-
return {
|
|
9206
|
-
algoTag: PQM1_ALGO_TAG_MLDSA65,
|
|
9207
|
-
version: PQM1_VERSION_V1,
|
|
9208
|
-
entropy: bytes.slice(2),
|
|
9209
|
-
bytes
|
|
9210
|
-
};
|
|
9151
|
+
function wordCount(normalized) {
|
|
9152
|
+
return normalized.length === 0 ? 0 : normalized.split(" ").length;
|
|
9211
9153
|
}
|
|
9212
|
-
function
|
|
9154
|
+
function mnemonicToMlDsa65Seed(mnemonic) {
|
|
9213
9155
|
const normalized = normalizeMnemonic(mnemonic);
|
|
9214
|
-
const words = normalized
|
|
9215
|
-
if (words
|
|
9216
|
-
throw new
|
|
9156
|
+
const words = wordCount(normalized);
|
|
9157
|
+
if (words !== MLDSA65_MNEMONIC_WORDS) {
|
|
9158
|
+
throw new MnemonicError(
|
|
9159
|
+
"badWordCount",
|
|
9160
|
+
`mnemonic must be ${MLDSA65_MNEMONIC_WORDS} words, got ${words}`
|
|
9161
|
+
);
|
|
9217
9162
|
}
|
|
9218
|
-
|
|
9219
|
-
|
|
9220
|
-
|
|
9221
|
-
|
|
9222
|
-
|
|
9163
|
+
if (!validateMnemonic(normalized, wordlist)) {
|
|
9164
|
+
throw new MnemonicError(
|
|
9165
|
+
"bip39Decode",
|
|
9166
|
+
"invalid BIP-39 mnemonic (unknown word or bad checksum)"
|
|
9167
|
+
);
|
|
9223
9168
|
}
|
|
9224
|
-
|
|
9225
|
-
}
|
|
9226
|
-
function derivePqm1MlDsa65SeedFromPayload(payload) {
|
|
9227
|
-
const parsed = parsePqm1Payload(payload);
|
|
9228
|
-
return shake256(concatBytes2(DOMAIN_BYTES, parsed.bytes), { dkLen: ML_DSA_65_SEED_LEN });
|
|
9169
|
+
const seed64 = mnemonicToSeedSync(normalized, "");
|
|
9170
|
+
return shake256(concatBytes2(DOMAIN_BYTES, seed64), { dkLen: ML_DSA_65_SEED_LEN });
|
|
9229
9171
|
}
|
|
9230
|
-
function
|
|
9231
|
-
return
|
|
9232
|
-
}
|
|
9233
|
-
function pqm1MnemonicToMlDsa65Backend(mnemonic) {
|
|
9234
|
-
return MlDsa65Backend.fromSeed(pqm1MnemonicToMlDsa65Seed(mnemonic));
|
|
9172
|
+
function mnemonicToMlDsa65Backend(mnemonic) {
|
|
9173
|
+
return MlDsa65Backend.fromSeed(mnemonicToMlDsa65Seed(mnemonic));
|
|
9235
9174
|
}
|
|
9236
9175
|
|
|
9237
9176
|
// src/cluster-join.ts
|
|
9238
9177
|
var DEFAULT_CLUSTER_JOIN_EXECUTION_UNIT_LIMIT = REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT;
|
|
9239
|
-
var DEFAULT_OPERATOR_SEAL_KEY_EXECUTION_UNIT_LIMIT = REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT;
|
|
9240
9178
|
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
9241
9179
|
var MAX_UINT32 = (1n << 32n) - 1n;
|
|
9242
9180
|
function deriveClusterJoinOperatorId(operatorPubkey) {
|
|
@@ -9344,29 +9282,11 @@ function buildVoteClusterAdmitTxFields(args) {
|
|
|
9344
9282
|
})
|
|
9345
9283
|
};
|
|
9346
9284
|
}
|
|
9347
|
-
function buildPublishOperatorSealKeyTxFields(args) {
|
|
9348
|
-
return {
|
|
9349
|
-
chainId: args.chainId,
|
|
9350
|
-
nonce: args.nonce,
|
|
9351
|
-
maxFeePerGas: parseBigint(args.fee.maxFeePerGas, "maxFeePerGas"),
|
|
9352
|
-
maxPriorityFeePerGas: parseBigint(args.fee.maxPriorityFeePerGas, "maxPriorityFeePerGas"),
|
|
9353
|
-
gasLimit: parseBigint(
|
|
9354
|
-
args.fee.gasLimit ?? DEFAULT_OPERATOR_SEAL_KEY_EXECUTION_UNIT_LIMIT,
|
|
9355
|
-
"gasLimit"
|
|
9356
|
-
),
|
|
9357
|
-
to: nodeRegistryAddressHex(),
|
|
9358
|
-
value: 0n,
|
|
9359
|
-
input: encodePublishOperatorSealKeyCalldata({
|
|
9360
|
-
peerId: normalizeOperatorId(args.peerId),
|
|
9361
|
-
sealEk: normalizeOperatorSealEk(args.sealEk)
|
|
9362
|
-
})
|
|
9363
|
-
};
|
|
9364
|
-
}
|
|
9365
9285
|
async function submitRequestClusterJoin(args) {
|
|
9366
9286
|
const clusterId = parseUint32(args.clusterId, "clusterId");
|
|
9367
9287
|
const operatorPubkey = normalizeConsensusPubkey(args.operatorPubkey, "operatorPubkey");
|
|
9368
9288
|
const operatorIdHex = deriveClusterJoinOperatorId(operatorPubkey);
|
|
9369
|
-
const backend =
|
|
9289
|
+
const backend = mnemonicToMlDsa65Backend(args.mnemonic);
|
|
9370
9290
|
const senderAddress = addressToTypedBech32("user", backend.addressBytes());
|
|
9371
9291
|
const preview = await previewRequestClusterJoin(args.client, {
|
|
9372
9292
|
from: senderAddress,
|
|
@@ -9388,12 +9308,12 @@ async function submitRequestClusterJoin(args) {
|
|
|
9388
9308
|
operatorPubkey,
|
|
9389
9309
|
bondLythoshi: args.bondLythoshi
|
|
9390
9310
|
});
|
|
9391
|
-
return submitClusterJoinTx(args.client, backend, tx, clusterId, operatorIdHex
|
|
9311
|
+
return submitClusterJoinTx(args.client, backend, tx, clusterId, operatorIdHex);
|
|
9392
9312
|
}
|
|
9393
9313
|
async function submitVoteClusterAdmit(args) {
|
|
9394
9314
|
const clusterId = parseUint32(args.clusterId, "clusterId");
|
|
9395
9315
|
const operatorIdHex = normalizeOperatorId(args.operatorId);
|
|
9396
|
-
const backend =
|
|
9316
|
+
const backend = mnemonicToMlDsa65Backend(args.mnemonic);
|
|
9397
9317
|
const senderAddress = addressToTypedBech32("user", backend.addressBytes());
|
|
9398
9318
|
const preview = await previewVoteClusterAdmit(args.client, {
|
|
9399
9319
|
from: senderAddress,
|
|
@@ -9415,62 +9335,9 @@ async function submitVoteClusterAdmit(args) {
|
|
|
9415
9335
|
operatorId: operatorIdHex,
|
|
9416
9336
|
voterPubkey: args.voterPubkey
|
|
9417
9337
|
});
|
|
9418
|
-
return submitClusterJoinTx(args.client, backend, tx, clusterId, operatorIdHex
|
|
9419
|
-
}
|
|
9420
|
-
async function submitPublishOperatorSealKey(args) {
|
|
9421
|
-
const operatorIdHex = normalizeOperatorId(args.peerId);
|
|
9422
|
-
const sealEk = normalizeOperatorSealEk(args.sealEk);
|
|
9423
|
-
const backend = pqm1MnemonicToMlDsa65Backend(args.mnemonic);
|
|
9424
|
-
const senderAddress = addressToTypedBech32("user", backend.addressBytes());
|
|
9425
|
-
const [chainId, nonce, quote] = await Promise.all([
|
|
9426
|
-
args.client.ethChainId(),
|
|
9427
|
-
args.client.lythGetTransactionCount(senderAddress),
|
|
9428
|
-
args.client.lythExecutionUnitPrice()
|
|
9429
|
-
]);
|
|
9430
|
-
const tx = buildPublishOperatorSealKeyTxFields({
|
|
9431
|
-
chainId,
|
|
9432
|
-
nonce,
|
|
9433
|
-
fee: resolveClusterJoinExecutionFee(quote, {
|
|
9434
|
-
...args,
|
|
9435
|
-
executionUnitLimit: args.executionUnitLimit ?? DEFAULT_OPERATOR_SEAL_KEY_EXECUTION_UNIT_LIMIT
|
|
9436
|
-
}),
|
|
9437
|
-
peerId: operatorIdHex,
|
|
9438
|
-
sealEk
|
|
9439
|
-
});
|
|
9440
|
-
const plaintext = buildPlaintextSubmission({ backend, tx });
|
|
9441
|
-
const txHash = await submitPlaintextTransaction(
|
|
9442
|
-
args.client,
|
|
9443
|
-
plaintext.signedTxWireHex,
|
|
9444
|
-
plaintext.innerTxHashHex
|
|
9445
|
-
);
|
|
9446
|
-
return {
|
|
9447
|
-
txHash,
|
|
9448
|
-
operatorIdHex,
|
|
9449
|
-
innerSighashHex: plaintext.innerSighashHex,
|
|
9450
|
-
signedTxWireBytes: plaintext.innerWireBytes
|
|
9451
|
-
};
|
|
9338
|
+
return submitClusterJoinTx(args.client, backend, tx, clusterId, operatorIdHex);
|
|
9452
9339
|
}
|
|
9453
|
-
async function submitClusterJoinTx(client, backend, tx, clusterId, operatorIdHex
|
|
9454
|
-
if (options.private !== false) {
|
|
9455
|
-
const encrypted = await buildEncryptedSubmission({
|
|
9456
|
-
client,
|
|
9457
|
-
backend,
|
|
9458
|
-
tx,
|
|
9459
|
-
clusterId: Number(clusterId),
|
|
9460
|
-
clusterSealKeys: options.clusterSealKeys,
|
|
9461
|
-
clusterSealKeysSource: options.clusterSealKeysSource,
|
|
9462
|
-
class: MempoolClass.ContractCall
|
|
9463
|
-
});
|
|
9464
|
-
assertRpcHash(await submitEncryptedEnvelope(client, encrypted.envelopeWireHex));
|
|
9465
|
-
return {
|
|
9466
|
-
txHash: encrypted.innerTxHashHex,
|
|
9467
|
-
clusterId: clusterId.toString(10),
|
|
9468
|
-
operatorIdHex,
|
|
9469
|
-
innerSighashHex: encrypted.innerSighashHex,
|
|
9470
|
-
signedTxWireBytes: encrypted.innerWireBytes,
|
|
9471
|
-
envelopeWireBytes: hexByteLength(encrypted.envelopeWireHex)
|
|
9472
|
-
};
|
|
9473
|
-
}
|
|
9340
|
+
async function submitClusterJoinTx(client, backend, tx, clusterId, operatorIdHex) {
|
|
9474
9341
|
const plaintext = buildPlaintextSubmission({ backend, tx });
|
|
9475
9342
|
const txHash = await submitPlaintextTransaction(
|
|
9476
9343
|
client,
|
|
@@ -9485,16 +9352,6 @@ async function submitClusterJoinTx(client, backend, tx, clusterId, operatorIdHex
|
|
|
9485
9352
|
signedTxWireBytes: plaintext.innerWireBytes
|
|
9486
9353
|
};
|
|
9487
9354
|
}
|
|
9488
|
-
function hexByteLength(value) {
|
|
9489
|
-
const clean = value.startsWith("0x") || value.startsWith("0X") ? value.slice(2) : value;
|
|
9490
|
-
return clean.length / 2;
|
|
9491
|
-
}
|
|
9492
|
-
function assertRpcHash(value) {
|
|
9493
|
-
const bytes = hexToBytes2(value, "lyth_submitEncrypted tx hash");
|
|
9494
|
-
if (bytes.length !== 32) {
|
|
9495
|
-
throw new Error(`lyth_submitEncrypted tx hash must be 32 bytes, got ${bytes.length}`);
|
|
9496
|
-
}
|
|
9497
|
-
}
|
|
9498
9355
|
function adaptNativeClusterJoinRequest(request) {
|
|
9499
9356
|
return {
|
|
9500
9357
|
owner: request.owner ?? ZERO_ADDRESS,
|
|
@@ -9537,10 +9394,6 @@ function normalizeOperatorId(value) {
|
|
|
9537
9394
|
const bytes = typeof value === "string" ? hexToBytes2(value, "operatorId") : value;
|
|
9538
9395
|
return bytesToHex2(expectBytes(bytes, 32, "operatorId"));
|
|
9539
9396
|
}
|
|
9540
|
-
function normalizeOperatorSealEk(value) {
|
|
9541
|
-
const bytes = typeof value === "string" ? hexToBytes2(value, "sealEk") : value;
|
|
9542
|
-
return expectBytes(bytes, NODE_REGISTRY_OPERATOR_SEAL_EK_BYTES, "sealEk").slice();
|
|
9543
|
-
}
|
|
9544
9397
|
function parseUint32(value, label) {
|
|
9545
9398
|
const parsed = parseBigint(value, label);
|
|
9546
9399
|
if (parsed < 0n || parsed > MAX_UINT32) {
|
|
@@ -9558,6 +9411,77 @@ function parseU256(value, label) {
|
|
|
9558
9411
|
function errorMessage(cause) {
|
|
9559
9412
|
return cause instanceof Error ? cause.message : String(cause);
|
|
9560
9413
|
}
|
|
9414
|
+
|
|
9415
|
+
// src/cluster-seat.ts
|
|
9416
|
+
var DEFAULT_SEAT_EXECUTION_UNIT_LIMIT = REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT;
|
|
9417
|
+
function resolveSeatExecutionFee(quote, options = {}) {
|
|
9418
|
+
const quoted = parseBigint(quote.executionUnitPriceLythoshi, "executionUnitPriceLythoshi");
|
|
9419
|
+
const floor = options.minPriceLythoshi === void 0 ? MIN_EXECUTION_UNIT_PRICE_LYTHOSHI : parseBigint(options.minPriceLythoshi, "minPriceLythoshi");
|
|
9420
|
+
const multiplier = options.safetyMultiplier === void 0 ? EXECUTION_UNIT_PRICE_SAFETY_MULTIPLIER : parseBigint(options.safetyMultiplier, "safetyMultiplier");
|
|
9421
|
+
if (multiplier <= 0n) throw new Error("safetyMultiplier must be greater than zero");
|
|
9422
|
+
const base = quoted > floor ? quoted : floor;
|
|
9423
|
+
const maxFeePerGas = base * multiplier;
|
|
9424
|
+
const tip = options.priorityTipLythoshi === void 0 ? maxFeePerGas : clampPriorityTip(options.priorityTipLythoshi, maxFeePerGas);
|
|
9425
|
+
return {
|
|
9426
|
+
maxFeePerGas,
|
|
9427
|
+
maxPriorityFeePerGas: tip,
|
|
9428
|
+
gasLimit: options.executionUnitLimit ?? DEFAULT_SEAT_EXECUTION_UNIT_LIMIT
|
|
9429
|
+
};
|
|
9430
|
+
}
|
|
9431
|
+
function buildAdvertiseSeatTxFields(args) {
|
|
9432
|
+
return {
|
|
9433
|
+
...seatTxEnvelope(args.chainId, args.nonce, args.fee),
|
|
9434
|
+
value: 0n,
|
|
9435
|
+
input: encodeAdvertiseSeatCalldata(args)
|
|
9436
|
+
};
|
|
9437
|
+
}
|
|
9438
|
+
function buildApplyForSeatTxFields(args) {
|
|
9439
|
+
const escrow = args.escrowLythoshi === void 0 ? NODE_REGISTRY_SEAT_APPLICATION_ESCROW_LYTHOSHI : parseU2562(args.escrowLythoshi, "escrowLythoshi");
|
|
9440
|
+
return {
|
|
9441
|
+
...seatTxEnvelope(args.chainId, args.nonce, args.fee),
|
|
9442
|
+
value: escrow,
|
|
9443
|
+
input: encodeApplyForSeatCalldata(args)
|
|
9444
|
+
};
|
|
9445
|
+
}
|
|
9446
|
+
function buildVoteSeatAdmitTxFields(args) {
|
|
9447
|
+
return {
|
|
9448
|
+
...seatTxEnvelope(args.chainId, args.nonce, args.fee),
|
|
9449
|
+
value: 0n,
|
|
9450
|
+
input: encodeVoteSeatAdmitCalldata(args)
|
|
9451
|
+
};
|
|
9452
|
+
}
|
|
9453
|
+
function buildWithdrawSeatApplicationTxFields(args) {
|
|
9454
|
+
return {
|
|
9455
|
+
...seatTxEnvelope(args.chainId, args.nonce, args.fee),
|
|
9456
|
+
value: 0n,
|
|
9457
|
+
input: encodeWithdrawSeatApplicationCalldata(args)
|
|
9458
|
+
};
|
|
9459
|
+
}
|
|
9460
|
+
function buildCloseSeatTxFields(args) {
|
|
9461
|
+
return {
|
|
9462
|
+
...seatTxEnvelope(args.chainId, args.nonce, args.fee),
|
|
9463
|
+
value: 0n,
|
|
9464
|
+
input: encodeCloseSeatCalldata(args)
|
|
9465
|
+
};
|
|
9466
|
+
}
|
|
9467
|
+
var SEAT_KINDS = ["active", "standby"];
|
|
9468
|
+
function seatTxEnvelope(chainId, nonce, fee) {
|
|
9469
|
+
return {
|
|
9470
|
+
chainId,
|
|
9471
|
+
nonce,
|
|
9472
|
+
maxFeePerGas: parseBigint(fee.maxFeePerGas, "maxFeePerGas"),
|
|
9473
|
+
maxPriorityFeePerGas: parseBigint(fee.maxPriorityFeePerGas, "maxPriorityFeePerGas"),
|
|
9474
|
+
gasLimit: parseBigint(fee.gasLimit ?? DEFAULT_SEAT_EXECUTION_UNIT_LIMIT, "gasLimit"),
|
|
9475
|
+
to: nodeRegistryAddressHex()
|
|
9476
|
+
};
|
|
9477
|
+
}
|
|
9478
|
+
function parseU2562(value, label) {
|
|
9479
|
+
const parsed = parseBigint(value, label);
|
|
9480
|
+
if (parsed < 0n || parsed >= 1n << 256n) {
|
|
9481
|
+
throw new Error(`${label} out of 256-bit range`);
|
|
9482
|
+
}
|
|
9483
|
+
return parsed;
|
|
9484
|
+
}
|
|
9561
9485
|
var ORACLE_EVENT_SIGS = {
|
|
9562
9486
|
oracleRoundFinalized: "OracleRoundFinalized(bytes32,uint64,uint256,uint64,uint32)",
|
|
9563
9487
|
observationSubmitted: "ObservationSubmitted(bytes32,uint64,address,uint256,uint64)",
|
|
@@ -11049,6 +10973,12 @@ function wordToBigint(word) {
|
|
|
11049
10973
|
}
|
|
11050
10974
|
return out;
|
|
11051
10975
|
}
|
|
10976
|
+
|
|
10977
|
+
// src/crypto/envelope.ts
|
|
10978
|
+
var MempoolClass = {
|
|
10979
|
+
CLOBOp: 3};
|
|
10980
|
+
|
|
10981
|
+
// src/market-actions.ts
|
|
11052
10982
|
var CLOB_MARKET_ID_DOMAIN_TAG = 193;
|
|
11053
10983
|
var NATIVE_MARKET_MODULE_ADDRESS_BYTES = "0x4d41524b45545f4e41544956455f4d4f445f5631";
|
|
11054
10984
|
var NATIVE_MARKET_MODULE_ADDRESS = addressToTypedBech32(
|
|
@@ -12381,6 +12311,6 @@ var MONOLYTHIUM_NETWORKS = {
|
|
|
12381
12311
|
// src/index.ts
|
|
12382
12312
|
var version = "0.4.18";
|
|
12383
12313
|
|
|
12384
|
-
export { ADDRESS_HRP, ADDRESS_KIND_HRPS, API_STREAM_TOPICS, AddressError, AgentActionError, ApiClient, BRIDGE_QUOTE_API_BLOCKED_REASON, BRIDGE_REVERT_TAGS, BRIDGE_SELECTORS, BRIDGE_SUBMIT_API_BLOCKED_REASON, BURN_ADDR, BridgePrecompileError, BridgeRouteCatalogueError, CHAIN_REGISTRY, CHAIN_REGISTRY_RAW_BASE, CLOB_MARKET_ID_DOMAIN_TAG, CLOB_SELECTORS, CLUSTER_FORMED_EVENT_SIG, DEFAULT_CLUSTER_JOIN_EXECUTION_UNIT_LIMIT, DEFAULT_OPERATOR_SEAL_KEY_EXECUTION_UNIT_LIMIT, DELEGATION_REVERT_TAGS, DELEGATION_SELECTORS, DIVERSITY_SCORE_MAX, DelegationPrecompileError, EMPTY_ROOT, EXECUTION_UNIT_PRICE_SAFETY_MULTIPLIER, FEED_ID_DOMAIN_TAG, LYTHOSHI_PER_LYTH, LYTH_DECIMALS, MAX_MULTISIG_MEMBERS, MAX_NATIVE_CALL_FORWARDER_REQUEST_BYTES, MAX_NATIVE_RECEIPT_EVENTS, MIN_EXECUTION_UNIT_PRICE_LYTHOSHI, MIN_MULTISIG_MEMBERS, 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, MULTISIG_ADDRESS_DERIVATION_DOMAIN2 as MULTISIG_WITNESS_ADDRESS_DERIVATION_DOMAIN, MULTISIG_WITNESS_DOMAIN, MarketActionError, MrvValidationError, MultisigError, 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_ARCHIVE_CHALLENGE_DOMAIN, NODE_REGISTRY_ARCHIVE_KIND_EPOCH_SEED, NODE_REGISTRY_ARCHIVE_NONCE_DOMAIN, NODE_REGISTRY_BLS_PUBKEY_BYTES, NODE_REGISTRY_CAPABILITIES, NODE_REGISTRY_CAPABILITY_MASK, NODE_REGISTRY_CHALLENGE_EPOCH_WINDOW, NODE_REGISTRY_CHARTER_COOLDOWN_EPOCHS, NODE_REGISTRY_CLUSTER_CHARTER_BYTES, NODE_REGISTRY_CLUSTER_CHARTER_DELEGATOR_FLOOR_BPS, NODE_REGISTRY_CLUSTER_CHARTER_SHARE_DENOM_BPS, NODE_REGISTRY_CLUSTER_MEMBER_REF_BYTES, NODE_REGISTRY_CONSENSUS_POP_BYTES, NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES, NODE_REGISTRY_CONSENSUS_SIGNATURE_BYTES, NODE_REGISTRY_DKG_ATTESTATION_SIG_BYTES, NODE_REGISTRY_DKG_RESHARE_MAX_SIGNERS, NODE_REGISTRY_DKG_RESHARE_MIN_SIGNERS, NODE_REGISTRY_DKG_THRESHOLD_SIG_BYTES, NODE_REGISTRY_FORM_CLUSTER_ACTIVE_COUNT, NODE_REGISTRY_FORM_CLUSTER_MEMBER_COUNT, NODE_REGISTRY_FORM_CLUSTER_MESSAGE_DOMAIN, NODE_REGISTRY_FORM_CLUSTER_MESSAGE_DOMAIN_V2, NODE_REGISTRY_FORM_CLUSTER_STANDBY_COUNT, NODE_REGISTRY_FORM_CLUSTER_THRESHOLD, NODE_REGISTRY_LEGACY_CLUSTER_MEMBER_PUBKEY_BYTES, NODE_REGISTRY_MAX_MERKLE_PROOF_DEPTH, NODE_REGISTRY_MERKLE_INNER_DOMAIN, NODE_REGISTRY_MERKLE_LEAF_DOMAIN, NODE_REGISTRY_MIN_ARCHIVE_LEAF_COUNT, NODE_REGISTRY_OPERATOR_ALIAS_MAX_BYTES, NODE_REGISTRY_OPERATOR_MONIKER_MAX_BYTES, NODE_REGISTRY_OPERATOR_SEAL_EK_BYTES, NODE_REGISTRY_PENDING_CHANGE_MAX_INTENT_ID, NODE_REGISTRY_PUBLIC_SERVICE_MASK, NODE_REGISTRY_SELECTORS, NODE_REGISTRY_SUBKIND_CHARTER_DELEGATOR_BPS, NODE_REGISTRY_SUBKIND_CHARTER_MEMBER_SHARES, NODE_REGISTRY_TAG_ARCHIVE_CHALLENGE, NODE_REGISTRY_TAG_CLUSTER_CHARTER, NODE_REGISTRY_TAG_SERVICE_SCORE, NODE_REGISTRY_TAG_TREASURY, NODE_REGISTRY_UPDATE_CHARTER_MESSAGE_DOMAIN, NODE_REGISTRY_UPDATE_CHARTER_THRESHOLD, 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, OperatorTrustError, 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, QUARANTINED_RPC_CODE, REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT, RESERVED_ADDRESS_HRPS, RpcClient, SERVES_GPU_PROVE, SERVICE_PROBE_STATUS, SET_POLICY_CLAIM_DOMAIN_TAG, SPENDING_POLICY_SELECTORS, SdkError, SpendingPolicyError, TESTNET_69420, TOKEN_FACTORY_CREATE_DEPOSIT_LYTHOSHI, TOKEN_FACTORY_FLAGS, TOKEN_FACTORY_KNOWN_FLAG_MASK, TOKEN_FACTORY_MAX_CREATOR_FEE_BPS, TOKEN_FACTORY_MAX_DECIMALS, TOKEN_FACTORY_NAME_MAX_BYTES, TOKEN_FACTORY_SELECTORS, TOKEN_FACTORY_SIGS, TOKEN_FACTORY_SYMBOL_MAX_BYTES, TOKEN_FACTORY_TOKEN_ID_DOMAIN_TAG, TRANSFER_DEFAULT_EXECUTION_UNIT_LIMIT, TX_EXTENSION_KIND_MULTISIG, TX_EXTENSION_MULTISIG_V1, TokenFactoryError, V1_BRIDGE_ALLOWED_FEE_TOKEN, V1_BRIDGE_ALLOWED_PROTOCOL, VRF_DOMAIN_TAG_MAX_BYTES, VRF_HEIGHT_NOT_FINALIZED_REVERT, VRF_OUTPUT_BYTES, VrfCallError, addressBytesToHex, addressToBech32, addressToTypedBech32, allowRootFor, apiEndpointFromRpcEndpoint, archiveMerkleInnerHash, archiveMerkleLeafHash, assembleMultisigSigned, assembleMultisigWitness, assertMrvCallNativeSubmissionPlan, assertMrvDeployNativeSubmissionPlan, assertMrvFeeDisplayConformance, assertMrvStructuredFeeConformance, assertNativeDevMrcTokenPlan, assertNativeDevMrvDeployPlan, assertNativeDevWalletApprovalRequest, assertNativeMarketOrderBookStreamPayload, assessBridgeRoute, bech32ToAddress, bech32ToAddressBytes, bidSighash, bridgeAddressHex, bridgeDrainRemaining, bridgeQuoteSubmitReadiness, bridgeRoutesReadiness, bridgeTransferCandidates, buildBridgeRouteCatalogue, buildCancelSpotOrderPlan, buildMrvCallNativeTxPlan, buildMrvCallPlan, buildMrvCallRequest, buildMrvDeployNativeTxPlan, buildMrvDeployPayloadNativeTxPlan, buildMrvDeployPayloadPlan, buildMrvDeployPayloadRequest, buildMrvDeployPlan, buildMrvDeployRequest, buildNativeAgentCreateEscrowForwarderInput, buildNativeAgentCreateEscrowModuleCall, buildNativeAgentModuleCallEnvelope, buildNativeAgentRecordReputationForwarderInput, buildNativeAgentRecordReputationModuleCall, buildNativeAgentSetSpendingPolicyForwarderInput, buildNativeAgentSetSpendingPolicyModuleCall, buildNativeCallForwarderArtifact, buildNativeMarketModuleCallEnvelope, buildNativeNftBuyListingForwarderInput, buildNativeNftBuyListingModuleCall, buildNativeNftCancelListingForwarderInput, buildNativeNftCancelListingModuleCall, buildNativeNftCreateListingForwarderInput, buildNativeNftCreateListingModuleCall, buildNativeNftPlaceAuctionBidForwarderInput, buildNativeNftPlaceAuctionBidModuleCall, buildNativeNftSettleAuctionForwarderInput, buildNativeNftSettleAuctionModuleCall, buildNativeNftSweepExpiredListingsForwarderInput, buildNativeNftSweepExpiredListingsModuleCall, buildNativeSpotCancelOrderForwarderInput, buildNativeSpotCancelOrderModuleCall, buildNativeSpotCreateMarketForwarderInput, buildNativeSpotCreateMarketModuleCall, buildNativeSpotLimitOrderForwarderInput, buildNativeSpotLimitOrderModuleCall, buildNativeSpotSettleLimitOrderForwarderInput, buildNativeSpotSettleLimitOrderModuleCall, buildNativeSpotSettleRoutedLimitOrderForwarderInput, buildNativeSpotSettleRoutedLimitOrderModuleCall, buildPlaceLimitOrderViaPlan, buildPlaceSpotLimitOrderPlan, buildPlaceSpotMarketOrderExPlan, buildPlaceSpotMarketOrderPlan, buildPublishOperatorSealKeyTxFields, buildRequestClusterJoinTxFields, buildVoteClusterAdmitTxFields, categoryRoot, checkMrvFeeDisplayConformance, checkMrvStructuredFeeConformance, checkNativeDevkitCompatibility, clampPriorityTip, clobAddressHex, clusterApyPercent, clusterJoinRequestExists, compareNativeDevVersions, composeClaimBoundMessage, computeNoEvmDacFinalityMessage, computeNoEvmLeaderFinalityMessage, computeNoEvmReceiptsRoot, computeNoEvmRoundFinalityMessage, computeNoEvmTargetReceiptHash, computeQuoteLiquidity, consumeNativeEvents, decodeActiveCharter, decodeClusterCharter, decodeClusterDiversity, decodeClusterFormedEvent, decodeClusterJoinRequest, decodeHasPubkeyReturn, decodeLookupPubkeyReturn, decodeNativeAgentStateResponse, decodeNativeMarketOrderBookDeltasResponse, decodeNativeReceiptResponse, decodeNoEvmReceiptTranscript, decodeOperatorFeeChargedEvent, decodeOperatorNetworkMetadata, decodeOperatorSealKey, decodeOracleEvent, decodePendingCharter, decodeProbeAuthority, decodeScoreServiceProbe, decodeTimeWindow, decodeTokenFactoryTokenId, decodeTxFeedResponse, decodeVrfOutput, delegationAddressHex, denyRootFor, deriveArchiveChallenge, deriveClobMarketId, deriveClusterAnchorAddress, deriveClusterJoinOperatorId, deriveFeedId, deriveMrvContractAddress, deriveMultisigAddress, deriveMultisigAddressBytes, deriveNativeSpotMarketId, deriveNativeSpotOrderId, deriveTokenFactoryTokenId, destinationRoot, encodeAnswerArchiveChallengeCalldata, encodeAttestDkgReshareCalldata, encodeAttestServiceProbeCalldata, encodeBlockSelector, encodeBridgeChallengeCalldata, encodeBridgeClaimCalldata, encodeCancelClusterJoinCalldata, encodeCancelOrderCalldata, encodeCancelPendingChangeCalldata, encodeClaimCalldata, encodeClaimPolicyByAddressCalldata, encodeClusterCharter, encodeCommitArchiveRootCalldata, encodeCreateFixedSupplyMrc20Calldata, encodeCreateRequestCalldata, encodeCreateRequestCanonical, encodeCreateTokenCalldata, encodeDelegateCalldata, encodeDisableCalldata, encodeEnableCalldata, encodeExpireClusterJoinCalldata, encodeFormClusterCalldata, encodeFormClusterV2Calldata, encodeGetClusterJoinRequestCalldata, encodeGetOperatorSealKeyCalldata, encodeGetPendingCharterCalldata, encodeGetProbeAuthorityCalldata, encodeHasPubkeyCalldata, encodeLockBridgeConfigCalldata, encodeLookupPubkeyCalldata, encodeMrvDeployPayload, encodeMultisigWitnessBody, encodeNameAcceptTransferCall, encodeNameProposeTransferCall, encodeNameRegisterCall, encodeNativeAgentAcceptEscrowCall, encodeNativeAgentApproveEscrowCall, encodeNativeAgentArbiterGetCall, encodeNativeAgentAttestationGetCall, encodeNativeAgentAvailabilityGetCall, encodeNativeAgentCancelEscrowCall, encodeNativeAgentCloseAvailabilityCall, encodeNativeAgentConsentGetCall, encodeNativeAgentCounterEscrowCall, encodeNativeAgentCreateEscrowCall, encodeNativeAgentDeactivateServiceCall, encodeNativeAgentDisputeEscrowCall, encodeNativeAgentEscrowGetCall, encodeNativeAgentGrantConsentCall, encodeNativeAgentIssueAttestationCall, encodeNativeAgentIssuerGetCall, encodeNativeAgentListServiceCall, encodeNativeAgentModuleForwarderInput, encodeNativeAgentOpenAvailabilityCall, encodeNativeAgentRecordPolicySpendCall, encodeNativeAgentRecordReputationCall, encodeNativeAgentRegisterArbiterCall, encodeNativeAgentRegisterIssuerCall, encodeNativeAgentReputationGetCall, encodeNativeAgentResolveEscrowCall, encodeNativeAgentRevokeAttestationCall, encodeNativeAgentRevokeConsentCall, encodeNativeAgentServiceGetCall, encodeNativeAgentSetAvailabilityCall, encodeNativeAgentSetSpendingPolicyCall, encodeNativeAgentSpendingPolicyGetCall, encodeNativeAgentStartEscrowCall, encodeNativeAgentSubmitEscrowCall, encodeNativeMarketModuleForwarderInput, encodeNativeNftBuyListingCall, encodeNativeNftCancelListingCall, encodeNativeNftCreateListingCall, encodeNativeNftPlaceAuctionBidCall, encodeNativeNftSettleAuctionCall, encodeNativeNftSweepExpiredListingsCall, encodeNativeSpotCancelOrderCall, encodeNativeSpotCreateMarketCall, encodeNativeSpotLimitOrderCall, encodeNativeSpotSettleLimitOrderCall, encodeNativeSpotSettleRoutedLimitOrderCall, encodePlaceLimitOrderCalldata, encodePlaceLimitOrderViaCalldata, encodePlaceMarketOrderCalldata, encodePlaceMarketOrderExCalldata, encodePublishOperatorSealKeyCalldata, encodeRecoverOperatorNodeCalldata, encodeRedelegateCalldata, encodeRegisterPubkeyCalldata, encodeReportServiceProbeCalldata, encodeRequestClusterJoinCalldata, encodeSetAutoCompoundCalldata, encodeSetBridgeResumeCooldownCalldata, encodeSetBridgeRouteFinalityCalldata, encodeSetLotSizeCalldata, encodeSetMinNotionalCalldata, encodeSetOperatorDisplayCalldata, encodeSetPolicyCalldata, encodeSetPolicyClaimCalldata, encodeSetProbeAuthorityCalldata, encodeSetTickSizeCalldata, encodeSubmitBridgeProofCalldata, encodeSubmitPendingChangeCalldata, encodeTokenFactoryAllowanceCalldata, encodeTokenFactoryApproveCalldata, encodeTokenFactoryBalanceOfCalldata, encodeTokenFactoryBurnCalldata, encodeTokenFactoryDecreaseAllowanceCalldata, encodeTokenFactoryDestroyCalldata, encodeTokenFactoryIncreaseAllowanceCalldata, encodeTokenFactoryMetadataCalldata, encodeTokenFactoryMintCalldata, encodeTokenFactorySetPausedCalldata, encodeTokenFactoryTotalSupplyCalldata, encodeTokenFactoryTransferCalldata, encodeTokenFactoryTransferFromCalldata, encodeTokenFactoryTransferOwnershipCalldata, encodeUndelegateCalldata, encodeUpdateCharterCalldata, encodeVoteClusterAdmitCalldata, encodeVrfEvaluateCalldata, exportBridgeRouteCatalogueJson, fetchChainInfoLatest, fetchChainRegistryLatest, formClusterMessage, formClusterMessageHex, formClusterMessageV2, formClusterMessageV2Hex, formatLyth, formatLythoshi, formatNativeReceiptFeeDisplay, formatOraclePrice, getChainInfo, getNoEvmReceiptTrustPolicy, getP2pSeeds, getRpcEndpoints, hexToAddressBytes, isBridgeAdminLockedRevert, isBridgeCooldownZeroRevert, isBridgeFinalityZeroRevert, isBridgeResumeCooldownActiveRevert, isConcreteServiceProbeStatus, isNativeDecodedEvent, isNativeMarketOrderBookStreamPayload, isQuarantineError, isSinglePublicServiceProbeMask, isUnexpectedValueRevert, isValidNodeRegistryCapabilities, isValidPublicServiceProbeMask, mrvAddressToBech32, mrvBech32ToAddress, mrvCodeHashHex, mrvV1TransactionExtension, multisigBaseSighash, multisigMemberIndex, nameLengthModifierX10, nameRegistrationCost, nameRegistryAddressHex, nativeAgentStateFilterParams, nativeDevSchemaFieldNames, nativeDevUiStrings, nativeEventMatches, nativeEventsFilterParams, nativeEventsFromHistory, nativeEventsFromReceipt, nativeMarketEventFilter, nativeMarketEventsFromHistory, nativeMarketEventsFromReceipt, nativeMarketStateFilterParams, noEvmReceiptTrustPolicyFromChainInfo, nodeHostingClassFromByte, nodeHostingClassToByte, nodeRegistryAddressHex, normalizeAddressHex, normalizeBridgeRouteCatalogue, normalizePendingChangeKind, oracleAddressHex, oraclePriceToNumber, packTimeWindow, parseAddress, parseBridgeRouteCatalogueJson, parseChainRegistryToml, parseDkgResharePublicKeys, parseLythToLythoshi, parseNameCategory, parseNativeDecodedEvent, parseQuantity, parseQuantityBig, preflightClusterJoinRequest, previewRequestClusterJoin, previewVoteClusterAdmit, protocolNonceForEpoch, proverMarketStateFromByte, pubkeyRegistryAddressHex, quoteOperatorFee, rankBridgeRoutes, rankMarketsByVolume, readClusterJoinRequest, requestSighash, requireTypedAddress, resolveClusterJoinExecutionFee, resolveExecutionFee, resolveMaxExecutionUnitPrice, resolveRegistryExecutionFee, resolveStudioHostStatus, selectBridgeTransferRoute, selectTrustedOperator, selectTrustedOperatorForNetwork, serviceMaskToBitIndex, serviceProbeStatusLabel, setDestinationRoot, slotArchiveChallengePass, slotClusterCharter, slotClusterCharterDelegator, slotClusterCharterMembers, slotClusterServiceScore, slotEpochChallengeSeed, slotProbeAuthority, slotScoreServiceProbe, sortMultisigMembers, spendingPolicyAddressHex, submitMrvCallNativeTx, submitMrvDeployNativeTx, submitMrvDeployPayloadNativeTx, submitPublishOperatorSealKey, submitRequestClusterJoin, submitSighash, submitVoteClusterAdmit, tokenFactoryAddressHex, transactionFeeExposure, typedBech32ToAddress, updateCharterMessage, updateCharterMessageHex, validateAddress, validateBridgeRouteCatalogue, validateMrvArtifactMetadata, validateMrvCallRequest, validateMrvDeployRequest, validateMultisigRoster, validateTokenFactoryFlags, verifyNoEvmArchiveProofSignatures, verifyNoEvmBlockFinalityEvidenceMultisig, verifyNoEvmBlockFinalityEvidenceThreshold, verifyNoEvmFinalityEvidenceMultisig, verifyNoEvmFinalityEvidenceThreshold, verifyNoEvmReceiptProof, verifyNoEvmReceiptProofTrust, verifyOperatorGenesis, version, vrfAddressHex };
|
|
12314
|
+
export { ADDRESS_HRP, ADDRESS_KIND_HRPS, API_STREAM_TOPICS, AddressError, AgentActionError, ApiClient, BRIDGE_QUOTE_API_BLOCKED_REASON, BRIDGE_REVERT_TAGS, BRIDGE_SELECTORS, BRIDGE_SUBMIT_API_BLOCKED_REASON, BURN_ADDR, BridgePrecompileError, BridgeRouteCatalogueError, CHAIN_REGISTRY, CHAIN_REGISTRY_RAW_BASE, CLOB_MARKET_ID_DOMAIN_TAG, CLOB_SELECTORS, CLUSTER_FORMED_EVENT_SIG, DEFAULT_CLUSTER_JOIN_EXECUTION_UNIT_LIMIT, DEFAULT_SEAT_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_MULTISIG_MEMBERS, MAX_NATIVE_CALL_FORWARDER_REQUEST_BYTES, MAX_NATIVE_RECEIPT_EVENTS, MIN_EXECUTION_UNIT_PRICE_LYTHOSHI, MIN_MULTISIG_MEMBERS, 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, MULTISIG_ADDRESS_DERIVATION_DOMAIN2 as MULTISIG_WITNESS_ADDRESS_DERIVATION_DOMAIN, MULTISIG_WITNESS_DOMAIN, MarketActionError, MrvValidationError, MultisigError, 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_ARCHIVE_CHALLENGE_DOMAIN, NODE_REGISTRY_ARCHIVE_KIND_EPOCH_SEED, NODE_REGISTRY_ARCHIVE_NONCE_DOMAIN, NODE_REGISTRY_BLS_PUBKEY_BYTES, NODE_REGISTRY_CAPABILITIES, NODE_REGISTRY_CAPABILITY_MASK, NODE_REGISTRY_CHALLENGE_EPOCH_WINDOW, NODE_REGISTRY_CHARTER_COOLDOWN_EPOCHS, NODE_REGISTRY_CLUSTER_CHARTER_BYTES, NODE_REGISTRY_CLUSTER_CHARTER_DELEGATOR_FLOOR_BPS, NODE_REGISTRY_CLUSTER_CHARTER_SHARE_DENOM_BPS, NODE_REGISTRY_CLUSTER_MEMBER_REF_BYTES, NODE_REGISTRY_CONSENSUS_POP_BYTES, NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES, NODE_REGISTRY_CONSENSUS_SIGNATURE_BYTES, NODE_REGISTRY_DKG_ATTESTATION_SIG_BYTES, NODE_REGISTRY_DKG_RESHARE_MAX_SIGNERS, NODE_REGISTRY_DKG_RESHARE_MIN_SIGNERS, NODE_REGISTRY_DKG_THRESHOLD_SIG_BYTES, NODE_REGISTRY_FORM_CLUSTER_ACTIVE_COUNT, NODE_REGISTRY_FORM_CLUSTER_MEMBER_COUNT, NODE_REGISTRY_FORM_CLUSTER_MESSAGE_DOMAIN, NODE_REGISTRY_FORM_CLUSTER_MESSAGE_DOMAIN_V2, NODE_REGISTRY_FORM_CLUSTER_STANDBY_COUNT, NODE_REGISTRY_FORM_CLUSTER_THRESHOLD, NODE_REGISTRY_LEGACY_CLUSTER_MEMBER_PUBKEY_BYTES, NODE_REGISTRY_MAX_MERKLE_PROOF_DEPTH, NODE_REGISTRY_MERKLE_INNER_DOMAIN, NODE_REGISTRY_MERKLE_LEAF_DOMAIN, NODE_REGISTRY_MIN_ARCHIVE_LEAF_COUNT, NODE_REGISTRY_MIN_SELF_BOND_LYTHOSHI, NODE_REGISTRY_OPERATOR_ALIAS_MAX_BYTES, NODE_REGISTRY_OPERATOR_MONIKER_MAX_BYTES, NODE_REGISTRY_PENDING_CHANGE_MAX_INTENT_ID, NODE_REGISTRY_PUBLIC_SERVICE_MASK, NODE_REGISTRY_SEAT_APPLICATION_ESCROW_LYTHOSHI, NODE_REGISTRY_SEAT_KIND_ACTIVE, NODE_REGISTRY_SEAT_KIND_STANDBY, NODE_REGISTRY_SELECTORS, NODE_REGISTRY_SUBKIND_CHARTER_DELEGATOR_BPS, NODE_REGISTRY_SUBKIND_CHARTER_MEMBER_SHARES, NODE_REGISTRY_TAG_ARCHIVE_CHALLENGE, NODE_REGISTRY_TAG_CLUSTER_CHARTER, NODE_REGISTRY_TAG_CLUSTER_SEAT, NODE_REGISTRY_TAG_SERVICE_SCORE, NODE_REGISTRY_TAG_TREASURY, NODE_REGISTRY_UPDATE_CHARTER_MESSAGE_DOMAIN, NODE_REGISTRY_UPDATE_CHARTER_THRESHOLD, 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, OperatorTrustError, OracleEventError, PENDING_CHANGE_KIND_CODES, PRECOMPILE_ADDRESSES, PROOF_KIND_BINARY, 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, ProofVerifier, ProofVerifyError, ProverMarketError, PubkeyRegistryError, QUARANTINED_RPC_CODE, REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT, RESERVED_ADDRESS_HRPS, RpcClient, SEAT_ADVERTISED_EVENT_SIG, SEAT_APPLIED_EVENT_SIG, SEAT_CLOSED_EVENT_SIG, SEAT_FILLED_EVENT_SIG, SEAT_KINDS, SEAT_STATUS_CODES, SERVES_GPU_PROVE, SERVICE_PROBE_STATUS, SET_POLICY_CLAIM_DOMAIN_TAG, SPENDING_POLICY_SELECTORS, SdkError, SpendingPolicyError, TESTNET_69420, TOKEN_FACTORY_CREATE_DEPOSIT_LYTHOSHI, TOKEN_FACTORY_FLAGS, TOKEN_FACTORY_KNOWN_FLAG_MASK, TOKEN_FACTORY_MAX_CREATOR_FEE_BPS, TOKEN_FACTORY_MAX_DECIMALS, TOKEN_FACTORY_NAME_MAX_BYTES, TOKEN_FACTORY_SELECTORS, TOKEN_FACTORY_SIGS, TOKEN_FACTORY_SYMBOL_MAX_BYTES, TOKEN_FACTORY_TOKEN_ID_DOMAIN_TAG, TRANSFER_DEFAULT_EXECUTION_UNIT_LIMIT, TX_EXTENSION_KIND_MULTISIG, TX_EXTENSION_MULTISIG_V1, TokenFactoryError, V1_BRIDGE_ALLOWED_FEE_TOKEN, V1_BRIDGE_ALLOWED_PROTOCOL, VRF_DOMAIN_TAG_MAX_BYTES, VRF_HEIGHT_NOT_FINALIZED_REVERT, VRF_OUTPUT_BYTES, VrfCallError, addressBytesToHex, addressToBech32, addressToTypedBech32, allowRootFor, apiEndpointFromRpcEndpoint, archiveMerkleInnerHash, archiveMerkleLeafHash, asBinaryProofEnvelope, assembleMultisigSigned, assembleMultisigWitness, assertMrvCallNativeSubmissionPlan, assertMrvDeployNativeSubmissionPlan, assertMrvFeeDisplayConformance, assertMrvStructuredFeeConformance, assertNativeDevMrcTokenPlan, assertNativeDevMrvDeployPlan, assertNativeDevWalletApprovalRequest, assertNativeMarketOrderBookStreamPayload, assessBridgeRoute, bech32ToAddress, bech32ToAddressBytes, bidSighash, bridgeAddressHex, bridgeDrainRemaining, bridgeQuoteSubmitReadiness, bridgeRoutesReadiness, bridgeTransferCandidates, buildAdvertiseSeatTxFields, buildApplyForSeatTxFields, buildBridgeRouteCatalogue, buildCancelSpotOrderPlan, buildCloseSeatTxFields, 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, buildVoteSeatAdmitTxFields, buildWithdrawSeatApplicationTxFields, categoryRoot, checkMrvFeeDisplayConformance, checkMrvStructuredFeeConformance, checkNativeDevkitCompatibility, clampPriorityTip, clobAddressHex, clusterApyPercent, clusterJoinRequestExists, compareNativeDevVersions, composeClaimBoundMessage, computeNoEvmDacFinalityMessage, computeNoEvmLeaderFinalityMessage, computeNoEvmReceiptsRoot, computeNoEvmRoundFinalityMessage, computeNoEvmTargetReceiptHash, computeQuoteLiquidity, consumeNativeEvents, decodeActiveCharter, decodeClusterCharter, decodeClusterDiversity, decodeClusterFormedEvent, decodeClusterJoinRequest, decodeHasPubkeyReturn, decodeLookupPubkeyReturn, decodeNativeAgentStateResponse, decodeNativeMarketOrderBookDeltasResponse, decodeNativeReceiptResponse, decodeNoEvmReceiptTranscript, decodeOperatorFeeChargedEvent, decodeOperatorNetworkMetadata, decodeOracleEvent, decodePendingCharter, decodeProbeAuthority, decodeScoreServiceProbe, decodeSeatAdvertisedEvent, decodeSeatAppliedEvent, decodeSeatClosedEvent, decodeSeatFilledEvent, decodeTimeWindow, decodeTokenFactoryTokenId, decodeTxFeedResponse, decodeVrfOutput, delegationAddressHex, denyRootFor, deriveArchiveChallenge, deriveClobMarketId, deriveClusterAnchorAddress, deriveClusterJoinOperatorId, deriveFeedId, deriveMrvContractAddress, deriveMultisigAddress, deriveMultisigAddressBytes, deriveNativeSpotMarketId, deriveNativeSpotOrderId, deriveSeatApplicationKey, deriveTokenFactoryTokenId, destinationRoot, encodeAdvertiseSeatCalldata, encodeAnswerArchiveChallengeCalldata, encodeApplyForSeatCalldata, encodeAttestDkgReshareCalldata, encodeAttestServiceProbeCalldata, encodeBlockSelector, encodeBridgeChallengeCalldata, encodeBridgeClaimCalldata, encodeCancelClusterJoinCalldata, encodeCancelOrderCalldata, encodeCancelPendingChangeCalldata, encodeClaimCalldata, encodeClaimPolicyByAddressCalldata, encodeCloseSeatCalldata, encodeClusterCharter, encodeCommitArchiveRootCalldata, encodeCreateFixedSupplyMrc20Calldata, encodeCreateRequestCalldata, encodeCreateRequestCanonical, encodeCreateTokenCalldata, encodeDelegateCalldata, encodeDisableCalldata, encodeEnableCalldata, encodeExpireClusterJoinCalldata, encodeFormClusterCalldata, encodeFormClusterV2Calldata, encodeGetClusterJoinRequestCalldata, encodeGetPendingCharterCalldata, encodeGetProbeAuthorityCalldata, encodeHasPubkeyCalldata, encodeLockBridgeConfigCalldata, encodeLookupPubkeyCalldata, encodeMrvDeployPayload, encodeMultisigWitnessBody, 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, encodeSetOperatorDisplayCalldata, encodeSetPolicyCalldata, encodeSetPolicyClaimCalldata, encodeSetProbeAuthorityCalldata, encodeSetTickSizeCalldata, encodeSubmitBridgeProofCalldata, encodeSubmitPendingChangeCalldata, encodeTokenFactoryAllowanceCalldata, encodeTokenFactoryApproveCalldata, encodeTokenFactoryBalanceOfCalldata, encodeTokenFactoryBurnCalldata, encodeTokenFactoryDecreaseAllowanceCalldata, encodeTokenFactoryDestroyCalldata, encodeTokenFactoryIncreaseAllowanceCalldata, encodeTokenFactoryMetadataCalldata, encodeTokenFactoryMintCalldata, encodeTokenFactorySetPausedCalldata, encodeTokenFactoryTotalSupplyCalldata, encodeTokenFactoryTransferCalldata, encodeTokenFactoryTransferFromCalldata, encodeTokenFactoryTransferOwnershipCalldata, encodeUndelegateCalldata, encodeUpdateCharterCalldata, encodeVoteClusterAdmitCalldata, encodeVoteSeatAdmitCalldata, encodeVrfEvaluateCalldata, encodeWithdrawSeatApplicationCalldata, exportBridgeRouteCatalogueJson, fetchChainInfoLatest, fetchChainRegistryLatest, formClusterMessage, formClusterMessageHex, formClusterMessageV2, formClusterMessageV2Hex, formatLyth, formatLythoshi, formatNativeReceiptFeeDisplay, formatOraclePrice, getChainInfo, getNoEvmReceiptTrustPolicy, getP2pSeeds, getRpcEndpoints, hashToHex, hexToAddressBytes, isBridgeAdminLockedRevert, isBridgeCooldownZeroRevert, isBridgeFinalityZeroRevert, isBridgeResumeCooldownActiveRevert, isConcreteServiceProbeStatus, isNativeDecodedEvent, isNativeMarketOrderBookStreamPayload, isQuarantineError, isSinglePublicServiceProbeMask, isUnexpectedValueRevert, isValidNodeRegistryCapabilities, isValidPublicServiceProbeMask, mrvAddressToBech32, mrvBech32ToAddress, mrvCodeHashHex, mrvV1TransactionExtension, multisigBaseSighash, multisigMemberIndex, nameLengthModifierX10, nameRegistrationCost, nameRegistryAddressHex, nativeAgentStateFilterParams, nativeDevSchemaFieldNames, nativeDevUiStrings, nativeEventMatches, nativeEventsFilterParams, nativeEventsFromHistory, nativeEventsFromReceipt, nativeMarketEventFilter, nativeMarketEventsFromHistory, nativeMarketEventsFromReceipt, nativeMarketStateFilterParams, noEvmReceiptTrustPolicyFromChainInfo, nodeHostingClassFromByte, nodeHostingClassToByte, nodeRegistryAddressHex, normalizeAddressHex, normalizeBridgeRouteCatalogue, normalizePendingChangeKind, openSeatFromAdvertised, oracleAddressHex, oraclePriceToNumber, packTimeWindow, parseAddress, parseBridgeRouteCatalogueJson, parseChainRegistryToml, parseDkgResharePublicKeys, parseLythToLythoshi, parseNameCategory, parseNativeDecodedEvent, parseQuantity, parseQuantityBig, preflightClusterJoinRequest, previewRequestClusterJoin, previewVoteClusterAdmit, proofVerifier, protocolNonceForEpoch, proverMarketStateFromByte, pubkeyRegistryAddressHex, quoteOperatorFee, rankBridgeRoutes, rankMarketsByVolume, readClusterJoinRequest, requestSighash, requireTypedAddress, resolveClusterJoinExecutionFee, resolveExecutionFee, resolveMaxExecutionUnitPrice, resolveRegistryExecutionFee, resolveSeatExecutionFee, resolveStudioHostStatus, seatKindFromByte, seatKindToByte, seatStatusFromByte, selectBridgeTransferRoute, selectTrustedOperator, selectTrustedOperatorForNetwork, serviceMaskToBitIndex, serviceProbeStatusLabel, setDestinationRoot, slotArchiveChallengePass, slotClusterCharter, slotClusterCharterDelegator, slotClusterCharterMembers, slotClusterServiceScore, slotEpochChallengeSeed, slotProbeAuthority, slotScoreServiceProbe, sortMultisigMembers, spendingPolicyAddressHex, submitMrvCallNativeTx, submitMrvDeployNativeTx, submitMrvDeployPayloadNativeTx, submitRequestClusterJoin, submitSighash, submitVoteClusterAdmit, tokenFactoryAddressHex, transactionFeeExposure, typedBech32ToAddress, updateCharterMessage, updateCharterMessageHex, validateAddress, validateBridgeRouteCatalogue, validateMrvArtifactMetadata, validateMrvCallRequest, validateMrvDeployRequest, validateMultisigRoster, validateTokenFactoryFlags, verifyNoEvmArchiveProofSignatures, verifyNoEvmBlockFinalityEvidenceMultisig, verifyNoEvmBlockFinalityEvidenceThreshold, verifyNoEvmFinalityEvidenceMultisig, verifyNoEvmFinalityEvidenceThreshold, verifyNoEvmReceiptProof, verifyNoEvmReceiptProofTrust, verifyOperatorGenesis, version, vrfAddressHex };
|
|
12385
12315
|
//# sourceMappingURL=index.js.map
|
|
12386
12316
|
//# sourceMappingURL=index.js.map
|