@monolythium/core-sdk 0.4.24 → 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/dist/index.cjs CHANGED
@@ -404,7 +404,35 @@ var NODE_REGISTRY_SELECTORS = {
404
404
  /** `getProbeAuthority()` view — Component C configured probe-authority address. */
405
405
  getProbeAuthority: "0x" + selectorHex("getProbeAuthority()"),
406
406
  /** `attestServiceProbe(bytes32,uint32,uint8,uint64)` — Component C attested score-eligibility path. */
407
- attestServiceProbe: "0x" + selectorHex("attestServiceProbe(bytes32,uint32,uint8,uint64)")
407
+ attestServiceProbe: "0x" + selectorHex("attestServiceProbe(bytes32,uint32,uint8,uint64)"),
408
+ /**
409
+ * `advertiseSeat(uint32,uint8,uint32,uint128,uint32,bytes32)` returns
410
+ * `uint32 seatId` (L6 open-seat marketplace). Publishes a vacancy
411
+ * listing; caller must own an active member op-hash of the cluster.
412
+ */
413
+ advertiseSeat: "0x" + selectorHex("advertiseSeat(uint32,uint8,uint32,uint128,uint32,bytes32)"),
414
+ /**
415
+ * `applyForSeat(uint32,uint32,bytes)` returns `bytes32 appKey` (L6).
416
+ * Payable — the native `value` carries the refundable application
417
+ * escrow ({@link NODE_REGISTRY_SEAT_APPLICATION_ESCROW_LYTHOSHI}).
418
+ */
419
+ applyForSeat: "0x" + selectorHex("applyForSeat(uint32,uint32,bytes)"),
420
+ /**
421
+ * `voteSeatAdmit(uint32,bytes32,bytes)` returns `uint16 voteCount`
422
+ * (L6). Active-member admission vote; the 7-of-10 threshold-reaching
423
+ * vote fills the seat and admits the operator.
424
+ */
425
+ voteSeatAdmit: "0x" + selectorHex("voteSeatAdmit(uint32,bytes32,bytes)"),
426
+ /**
427
+ * `withdrawSeatApplication(uint32,bytes32)` returns `bool` (L6) —
428
+ * applicant withdrawal that refunds the escrow.
429
+ */
430
+ withdrawSeatApplication: "0x" + selectorHex("withdrawSeatApplication(uint32,bytes32)"),
431
+ /**
432
+ * `closeSeat(uint32,uint32)` returns `bool` (L6) — advertiser rescind
433
+ * of an `Open` listing.
434
+ */
435
+ closeSeat: "0x" + selectorHex("closeSeat(uint32,uint32)")
408
436
  };
409
437
  var NODE_REGISTRY_CLUSTER_MEMBER_REF_BYTES = 48;
410
438
  var NODE_REGISTRY_LEGACY_CLUSTER_MEMBER_PUBKEY_BYTES = NODE_REGISTRY_CLUSTER_MEMBER_REF_BYTES;
@@ -1351,6 +1379,253 @@ function deriveClusterAnchorAddress(roster, threshold) {
1351
1379
  }
1352
1380
  return bytesToHex(blake3_js.blake3(concatBytes(...parts)).slice(0, 20));
1353
1381
  }
1382
+ var NODE_REGISTRY_TAG_CLUSTER_SEAT = 50;
1383
+ var NODE_REGISTRY_SEAT_APPLICATION_ESCROW_LYTHOSHI = 100n * 1000000000000000000n;
1384
+ var NODE_REGISTRY_MIN_SELF_BOND_LYTHOSHI = 5000n * 1000000000000000000n;
1385
+ var NODE_REGISTRY_SEAT_KIND_ACTIVE = 0;
1386
+ var NODE_REGISTRY_SEAT_KIND_STANDBY = 1;
1387
+ function seatKindFromByte(b) {
1388
+ return b === NODE_REGISTRY_SEAT_KIND_STANDBY ? "standby" : "active";
1389
+ }
1390
+ function seatKindToByte(kind) {
1391
+ return kind === "standby" ? NODE_REGISTRY_SEAT_KIND_STANDBY : NODE_REGISTRY_SEAT_KIND_ACTIVE;
1392
+ }
1393
+ var SEAT_STATUS_CODES = {
1394
+ none: 0,
1395
+ open: 1,
1396
+ filled: 2,
1397
+ closed: 3
1398
+ };
1399
+ function seatStatusFromByte(b) {
1400
+ switch (b) {
1401
+ case 1:
1402
+ return "open";
1403
+ case 2:
1404
+ return "filled";
1405
+ case 3:
1406
+ return "closed";
1407
+ default:
1408
+ return "none";
1409
+ }
1410
+ }
1411
+ var SEAT_ADVERTISED_EVENT_SIG = "SeatAdvertised(uint32,uint32,bytes32,uint8,uint32,uint128,uint32,bytes32)";
1412
+ var SEAT_APPLIED_EVENT_SIG = "SeatApplied(uint32,uint32,bytes32,address,uint128)";
1413
+ var SEAT_FILLED_EVENT_SIG = "SeatFilled(uint32,uint32,bytes32,uint16,uint16)";
1414
+ var SEAT_CLOSED_EVENT_SIG = "SeatClosed(uint32,uint32,uint8)";
1415
+ function encodeAdvertiseSeatCalldata(args) {
1416
+ const kindByte = typeof args.kind === "number" ? args.kind : seatKindToByte(args.kind);
1417
+ if (!Number.isInteger(kindByte) || kindByte < 0 || kindByte > 255) {
1418
+ throw new NodeRegistryError("kind must be a u8 seat kind (0 = active, 1 = standby)");
1419
+ }
1420
+ return bytesToHex(
1421
+ concatBytes(
1422
+ hexToBytes(NODE_REGISTRY_SELECTORS.advertiseSeat),
1423
+ uint32Word(toUint32(args.clusterId, "clusterId")),
1424
+ uint8Word(kindByte),
1425
+ uint32Word(toUint32(args.seatCount, "seatCount")),
1426
+ uint128Word(args.minBondLythoshi, "minBondLythoshi"),
1427
+ uint32Word(toUint32(args.capabilityMask, "capabilityMask")),
1428
+ expectLength2(toBytes(args.termsHash), 32, "termsHash")
1429
+ )
1430
+ );
1431
+ }
1432
+ function encodeApplyForSeatCalldata(args) {
1433
+ const operatorPubkey = expectLength2(
1434
+ toBytes(args.operatorPubkey),
1435
+ NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES,
1436
+ "operatorPubkey"
1437
+ );
1438
+ const operatorPubkeyPadded = padToWord(operatorPubkey);
1439
+ return bytesToHex(
1440
+ concatBytes(
1441
+ hexToBytes(NODE_REGISTRY_SELECTORS.applyForSeat),
1442
+ uint32Word(toUint32(args.clusterId, "clusterId")),
1443
+ uint32Word(toUint32(args.seatId, "seatId")),
1444
+ uint64Word(3n * 32n, "operatorPubkeyOffset"),
1445
+ uint64Word(BigInt(operatorPubkey.length), "operatorPubkeyLength"),
1446
+ operatorPubkeyPadded
1447
+ )
1448
+ );
1449
+ }
1450
+ function encodeVoteSeatAdmitCalldata(args) {
1451
+ const appKey = expectLength2(toBytes(args.appKey), 32, "appKey");
1452
+ const voterPubkey = expectLength2(
1453
+ toBytes(args.voterPubkey),
1454
+ NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES,
1455
+ "voterPubkey"
1456
+ );
1457
+ const voterPubkeyPadded = padToWord(voterPubkey);
1458
+ return bytesToHex(
1459
+ concatBytes(
1460
+ hexToBytes(NODE_REGISTRY_SELECTORS.voteSeatAdmit),
1461
+ uint32Word(toUint32(args.clusterId, "clusterId")),
1462
+ appKey,
1463
+ uint64Word(3n * 32n, "voterPubkeyOffset"),
1464
+ uint64Word(BigInt(voterPubkey.length), "voterPubkeyLength"),
1465
+ voterPubkeyPadded
1466
+ )
1467
+ );
1468
+ }
1469
+ function encodeWithdrawSeatApplicationCalldata(args) {
1470
+ return bytesToHex(
1471
+ concatBytes(
1472
+ hexToBytes(NODE_REGISTRY_SELECTORS.withdrawSeatApplication),
1473
+ uint32Word(toUint32(args.clusterId, "clusterId")),
1474
+ expectLength2(toBytes(args.appKey), 32, "appKey")
1475
+ )
1476
+ );
1477
+ }
1478
+ function encodeCloseSeatCalldata(args) {
1479
+ return bytesToHex(
1480
+ concatBytes(
1481
+ hexToBytes(NODE_REGISTRY_SELECTORS.closeSeat),
1482
+ uint32Word(toUint32(args.clusterId, "clusterId")),
1483
+ uint32Word(toUint32(args.seatId, "seatId"))
1484
+ )
1485
+ );
1486
+ }
1487
+ function deriveSeatApplicationKey(operatorPubkey) {
1488
+ return bytesToHex(
1489
+ blake3_js.blake3(expectLength2(toBytes(operatorPubkey), NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES, "operatorPubkey"))
1490
+ );
1491
+ }
1492
+ function decodeSeatAdvertisedEvent(topics, data) {
1493
+ const { clusterId, seatId } = decodeSeatClusterSeatTopics(topics, SEAT_ADVERTISED_EVENT_SIG, 3);
1494
+ const body = toBytes(data);
1495
+ if (body.length < 6 * 32) {
1496
+ throw new NodeRegistryError("SeatAdvertised data shorter than the 6-word body");
1497
+ }
1498
+ const word = (i) => body.slice(i * 32, (i + 1) * 32);
1499
+ return {
1500
+ clusterId,
1501
+ seatId,
1502
+ advertiser: bytesToHex(word(0)),
1503
+ kind: numberFromWord(word(1), "kind", 255),
1504
+ seatCount: u32FromWord(word(2)),
1505
+ minBondLythoshi: uintFromWord(word(3)),
1506
+ capabilityMask: u32FromWord(word(4)),
1507
+ termsHash: bytesToHex(word(5))
1508
+ };
1509
+ }
1510
+ function decodeSeatAppliedEvent(topics, data) {
1511
+ const { clusterId, seatId, operatorId } = decodeSeatClusterSeatOperatorTopics(
1512
+ topics,
1513
+ SEAT_APPLIED_EVENT_SIG
1514
+ );
1515
+ const body = toBytes(data);
1516
+ if (body.length < 2 * 32) {
1517
+ throw new NodeRegistryError("SeatApplied data shorter than the 2-word body");
1518
+ }
1519
+ return {
1520
+ clusterId,
1521
+ seatId,
1522
+ operatorId,
1523
+ owner: bytesToHex(body.slice(12, 32)),
1524
+ escrowLythoshi: uintFromWord(body.slice(32, 64))
1525
+ };
1526
+ }
1527
+ function decodeSeatFilledEvent(topics, data) {
1528
+ const { clusterId, seatId, operatorId } = decodeSeatClusterSeatOperatorTopics(
1529
+ topics,
1530
+ SEAT_FILLED_EVENT_SIG
1531
+ );
1532
+ const body = toBytes(data);
1533
+ if (body.length < 2 * 32) {
1534
+ throw new NodeRegistryError("SeatFilled data shorter than the 2-word body");
1535
+ }
1536
+ return {
1537
+ clusterId,
1538
+ seatId,
1539
+ operatorId,
1540
+ filledCount: numberFromWord(body.slice(0, 32), "filledCount", 65535),
1541
+ seatCount: numberFromWord(body.slice(32, 64), "seatCount", 65535)
1542
+ };
1543
+ }
1544
+ function decodeSeatClosedEvent(topics, data) {
1545
+ const { clusterId, seatId } = decodeSeatClusterSeatTopics(topics, SEAT_CLOSED_EVENT_SIG, 3);
1546
+ const body = toBytes(data);
1547
+ if (body.length < 32) {
1548
+ throw new NodeRegistryError("SeatClosed data shorter than the 1-word body");
1549
+ }
1550
+ return {
1551
+ clusterId,
1552
+ seatId,
1553
+ status: numberFromWord(body.slice(0, 32), "status", 255)
1554
+ };
1555
+ }
1556
+ function openSeatFromAdvertised(event) {
1557
+ return {
1558
+ clusterId: event.clusterId,
1559
+ seatId: event.seatId,
1560
+ advertiser: event.advertiser,
1561
+ kind: seatKindFromByte(event.kind),
1562
+ seatCount: event.seatCount,
1563
+ filledCount: 0,
1564
+ minBondLythoshi: event.minBondLythoshi,
1565
+ capabilityMask: event.capabilityMask,
1566
+ termsHash: event.termsHash,
1567
+ status: "open"
1568
+ };
1569
+ }
1570
+ function decodeSeatClusterSeatTopics(topics, sig, expectedCount) {
1571
+ if (topics.length !== expectedCount) {
1572
+ throw new NodeRegistryError(`${sig} expects ${expectedCount} topics, got ${topics.length}`);
1573
+ }
1574
+ assertEventTopic0(topics[0], sig);
1575
+ return {
1576
+ clusterId: u32FromWord(expectLength2(toBytes(topics[1]), 32, "clusterId topic")),
1577
+ seatId: u32FromWord(expectLength2(toBytes(topics[2]), 32, "seatId topic"))
1578
+ };
1579
+ }
1580
+ function decodeSeatClusterSeatOperatorTopics(topics, sig) {
1581
+ if (topics.length !== 4) {
1582
+ throw new NodeRegistryError(`${sig} expects 4 topics, got ${topics.length}`);
1583
+ }
1584
+ assertEventTopic0(topics[0], sig);
1585
+ return {
1586
+ clusterId: u32FromWord(expectLength2(toBytes(topics[1]), 32, "clusterId topic")),
1587
+ seatId: u32FromWord(expectLength2(toBytes(topics[2]), 32, "seatId topic")),
1588
+ operatorId: bytesToHex(expectLength2(toBytes(topics[3]), 32, "operatorId topic"))
1589
+ };
1590
+ }
1591
+ function assertEventTopic0(topic0, sig) {
1592
+ const got = bytesToHex(expectLength2(toBytes(topic0), 32, "topic0"));
1593
+ const want = bytesToHex(sha3_js.keccak_256(new TextEncoder().encode(sig)));
1594
+ if (got !== want) {
1595
+ throw new NodeRegistryError(`unexpected topic0 for ${sig}`);
1596
+ }
1597
+ }
1598
+ function uint128Word(value, name) {
1599
+ const n = toUint128(value, name);
1600
+ const out = new Uint8Array(32);
1601
+ let rest = n;
1602
+ for (let i = 31; i >= 16; i--) {
1603
+ out[i] = Number(rest & 0xffn);
1604
+ rest >>= 8n;
1605
+ }
1606
+ return out;
1607
+ }
1608
+ function toUint128(value, name) {
1609
+ let parsed;
1610
+ if (typeof value === "bigint") {
1611
+ parsed = value;
1612
+ } else if (typeof value === "number") {
1613
+ if (!Number.isSafeInteger(value)) {
1614
+ throw new NodeRegistryError(`${name} must be a safe integer`);
1615
+ }
1616
+ parsed = BigInt(value);
1617
+ } else {
1618
+ const trimmed = value.trim();
1619
+ if (!/^\d+$/u.test(trimmed)) {
1620
+ throw new NodeRegistryError(`${name} must be a decimal uint128`);
1621
+ }
1622
+ parsed = BigInt(trimmed);
1623
+ }
1624
+ if (parsed < 0n || parsed >= 1n << 128n) {
1625
+ throw new NodeRegistryError(`${name} must fit uint128`);
1626
+ }
1627
+ return parsed;
1628
+ }
1354
1629
  function selectorHex(sig) {
1355
1630
  return [...sha3_js.keccak_256(new TextEncoder().encode(sig)).slice(0, 4)].map((b) => b.toString(16).padStart(2, "0")).join("");
1356
1631
  }
@@ -8861,67 +9136,43 @@ function assertWholeNumber(field2, value) {
8861
9136
  throw new Error(`${field2} must be a whole number`);
8862
9137
  }
8863
9138
  }
8864
- var PQM1_ALGO_TAG_MLDSA65 = 1;
8865
- var PQM1_VERSION_V1 = 1;
8866
- var PQM1_PAYLOAD_LEN = 32;
8867
- var PQM1_V1_MNEMONIC_WORDS = 24;
8868
- var PQM1_V1_MLDSA65_DOMAIN_TAG = "monolythium.pqm1.v1.mldsa65";
8869
- var Pqm1Error = class extends Error {
9139
+ var MLDSA65_MNEMONIC_WORDS = 24;
9140
+ var MLDSA65_SEED_DOMAIN = "monolythium.mldsa65.v1";
9141
+ var DOMAIN_BYTES = new TextEncoder().encode(MLDSA65_SEED_DOMAIN);
9142
+ var MnemonicError = class extends Error {
8870
9143
  constructor(kind, message) {
8871
9144
  super(message);
8872
9145
  this.kind = kind;
8873
- this.name = "Pqm1Error";
9146
+ this.name = "MnemonicError";
8874
9147
  }
8875
9148
  kind;
8876
9149
  };
8877
- var DOMAIN_BYTES = new TextEncoder().encode(PQM1_V1_MLDSA65_DOMAIN_TAG);
8878
9150
  function normalizeMnemonic(mnemonic) {
8879
9151
  return mnemonic.trim().toLowerCase().replace(/\s+/g, " ");
8880
9152
  }
8881
- function ensureSupportedPayload(bytes) {
8882
- if (bytes.length !== PQM1_PAYLOAD_LEN) {
8883
- throw new Pqm1Error("badPayloadLength", `PQM-1 payload must be ${PQM1_PAYLOAD_LEN} bytes, got ${bytes.length}`);
8884
- }
8885
- if (bytes[0] !== PQM1_ALGO_TAG_MLDSA65) {
8886
- throw new Pqm1Error("unsupportedAlgorithm", `unsupported PQM-1 algorithm tag 0x${bytes[0].toString(16).padStart(2, "0")}`);
8887
- }
8888
- if (bytes[1] !== PQM1_VERSION_V1) {
8889
- throw new Pqm1Error("unsupportedVersion", `unsupported PQM-1 version 0x${bytes[1].toString(16).padStart(2, "0")}`);
8890
- }
8891
- }
8892
- function parsePqm1Payload(payload) {
8893
- const bytes = expectBytes(payload, PQM1_PAYLOAD_LEN, "PQM-1 payload").slice();
8894
- ensureSupportedPayload(bytes);
8895
- return {
8896
- algoTag: PQM1_ALGO_TAG_MLDSA65,
8897
- version: PQM1_VERSION_V1,
8898
- entropy: bytes.slice(2),
8899
- bytes
8900
- };
9153
+ function wordCount(normalized) {
9154
+ return normalized.length === 0 ? 0 : normalized.split(" ").length;
8901
9155
  }
8902
- function pqm1MnemonicToPayload(mnemonic) {
9156
+ function mnemonicToMlDsa65Seed(mnemonic) {
8903
9157
  const normalized = normalizeMnemonic(mnemonic);
8904
- const words = normalized.length === 0 ? [] : normalized.split(" ");
8905
- if (words.length !== PQM1_V1_MNEMONIC_WORDS) {
8906
- throw new Pqm1Error("badWordCount", `PQM-1 mnemonic must be ${PQM1_V1_MNEMONIC_WORDS} words, got ${words.length}`);
9158
+ const words = wordCount(normalized);
9159
+ if (words !== MLDSA65_MNEMONIC_WORDS) {
9160
+ throw new MnemonicError(
9161
+ "badWordCount",
9162
+ `mnemonic must be ${MLDSA65_MNEMONIC_WORDS} words, got ${words}`
9163
+ );
8907
9164
  }
8908
- let payload;
8909
- try {
8910
- payload = bip39.mnemonicToEntropy(normalized, english_js.wordlist);
8911
- } catch (e) {
8912
- throw new Pqm1Error("bip39Decode", `invalid PQM-1 mnemonic: ${e.message}`);
9165
+ if (!bip39.validateMnemonic(normalized, english_js.wordlist)) {
9166
+ throw new MnemonicError(
9167
+ "bip39Decode",
9168
+ "invalid BIP-39 mnemonic (unknown word or bad checksum)"
9169
+ );
8913
9170
  }
8914
- return parsePqm1Payload(payload);
8915
- }
8916
- function derivePqm1MlDsa65SeedFromPayload(payload) {
8917
- const parsed = parsePqm1Payload(payload);
8918
- return sha3_js.shake256(concatBytes2(DOMAIN_BYTES, parsed.bytes), { dkLen: ML_DSA_65_SEED_LEN });
9171
+ const seed64 = bip39.mnemonicToSeedSync(normalized, "");
9172
+ return sha3_js.shake256(concatBytes2(DOMAIN_BYTES, seed64), { dkLen: ML_DSA_65_SEED_LEN });
8919
9173
  }
8920
- function pqm1MnemonicToMlDsa65Seed(mnemonic) {
8921
- return derivePqm1MlDsa65SeedFromPayload(pqm1MnemonicToPayload(mnemonic).bytes);
8922
- }
8923
- function pqm1MnemonicToMlDsa65Backend(mnemonic) {
8924
- return MlDsa65Backend.fromSeed(pqm1MnemonicToMlDsa65Seed(mnemonic));
9174
+ function mnemonicToMlDsa65Backend(mnemonic) {
9175
+ return MlDsa65Backend.fromSeed(mnemonicToMlDsa65Seed(mnemonic));
8925
9176
  }
8926
9177
 
8927
9178
  // src/cluster-join.ts
@@ -9037,7 +9288,7 @@ async function submitRequestClusterJoin(args) {
9037
9288
  const clusterId = parseUint32(args.clusterId, "clusterId");
9038
9289
  const operatorPubkey = normalizeConsensusPubkey(args.operatorPubkey, "operatorPubkey");
9039
9290
  const operatorIdHex = deriveClusterJoinOperatorId(operatorPubkey);
9040
- const backend = pqm1MnemonicToMlDsa65Backend(args.mnemonic);
9291
+ const backend = mnemonicToMlDsa65Backend(args.mnemonic);
9041
9292
  const senderAddress = addressToTypedBech32("user", backend.addressBytes());
9042
9293
  const preview = await previewRequestClusterJoin(args.client, {
9043
9294
  from: senderAddress,
@@ -9064,7 +9315,7 @@ async function submitRequestClusterJoin(args) {
9064
9315
  async function submitVoteClusterAdmit(args) {
9065
9316
  const clusterId = parseUint32(args.clusterId, "clusterId");
9066
9317
  const operatorIdHex = normalizeOperatorId(args.operatorId);
9067
- const backend = pqm1MnemonicToMlDsa65Backend(args.mnemonic);
9318
+ const backend = mnemonicToMlDsa65Backend(args.mnemonic);
9068
9319
  const senderAddress = addressToTypedBech32("user", backend.addressBytes());
9069
9320
  const preview = await previewVoteClusterAdmit(args.client, {
9070
9321
  from: senderAddress,
@@ -9162,6 +9413,77 @@ function parseU256(value, label) {
9162
9413
  function errorMessage(cause) {
9163
9414
  return cause instanceof Error ? cause.message : String(cause);
9164
9415
  }
9416
+
9417
+ // src/cluster-seat.ts
9418
+ var DEFAULT_SEAT_EXECUTION_UNIT_LIMIT = REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT;
9419
+ function resolveSeatExecutionFee(quote, options = {}) {
9420
+ const quoted = parseBigint(quote.executionUnitPriceLythoshi, "executionUnitPriceLythoshi");
9421
+ const floor = options.minPriceLythoshi === void 0 ? MIN_EXECUTION_UNIT_PRICE_LYTHOSHI : parseBigint(options.minPriceLythoshi, "minPriceLythoshi");
9422
+ const multiplier = options.safetyMultiplier === void 0 ? EXECUTION_UNIT_PRICE_SAFETY_MULTIPLIER : parseBigint(options.safetyMultiplier, "safetyMultiplier");
9423
+ if (multiplier <= 0n) throw new Error("safetyMultiplier must be greater than zero");
9424
+ const base = quoted > floor ? quoted : floor;
9425
+ const maxFeePerGas = base * multiplier;
9426
+ const tip = options.priorityTipLythoshi === void 0 ? maxFeePerGas : clampPriorityTip(options.priorityTipLythoshi, maxFeePerGas);
9427
+ return {
9428
+ maxFeePerGas,
9429
+ maxPriorityFeePerGas: tip,
9430
+ gasLimit: options.executionUnitLimit ?? DEFAULT_SEAT_EXECUTION_UNIT_LIMIT
9431
+ };
9432
+ }
9433
+ function buildAdvertiseSeatTxFields(args) {
9434
+ return {
9435
+ ...seatTxEnvelope(args.chainId, args.nonce, args.fee),
9436
+ value: 0n,
9437
+ input: encodeAdvertiseSeatCalldata(args)
9438
+ };
9439
+ }
9440
+ function buildApplyForSeatTxFields(args) {
9441
+ const escrow = args.escrowLythoshi === void 0 ? NODE_REGISTRY_SEAT_APPLICATION_ESCROW_LYTHOSHI : parseU2562(args.escrowLythoshi, "escrowLythoshi");
9442
+ return {
9443
+ ...seatTxEnvelope(args.chainId, args.nonce, args.fee),
9444
+ value: escrow,
9445
+ input: encodeApplyForSeatCalldata(args)
9446
+ };
9447
+ }
9448
+ function buildVoteSeatAdmitTxFields(args) {
9449
+ return {
9450
+ ...seatTxEnvelope(args.chainId, args.nonce, args.fee),
9451
+ value: 0n,
9452
+ input: encodeVoteSeatAdmitCalldata(args)
9453
+ };
9454
+ }
9455
+ function buildWithdrawSeatApplicationTxFields(args) {
9456
+ return {
9457
+ ...seatTxEnvelope(args.chainId, args.nonce, args.fee),
9458
+ value: 0n,
9459
+ input: encodeWithdrawSeatApplicationCalldata(args)
9460
+ };
9461
+ }
9462
+ function buildCloseSeatTxFields(args) {
9463
+ return {
9464
+ ...seatTxEnvelope(args.chainId, args.nonce, args.fee),
9465
+ value: 0n,
9466
+ input: encodeCloseSeatCalldata(args)
9467
+ };
9468
+ }
9469
+ var SEAT_KINDS = ["active", "standby"];
9470
+ function seatTxEnvelope(chainId, nonce, fee) {
9471
+ return {
9472
+ chainId,
9473
+ nonce,
9474
+ maxFeePerGas: parseBigint(fee.maxFeePerGas, "maxFeePerGas"),
9475
+ maxPriorityFeePerGas: parseBigint(fee.maxPriorityFeePerGas, "maxPriorityFeePerGas"),
9476
+ gasLimit: parseBigint(fee.gasLimit ?? DEFAULT_SEAT_EXECUTION_UNIT_LIMIT, "gasLimit"),
9477
+ to: nodeRegistryAddressHex()
9478
+ };
9479
+ }
9480
+ function parseU2562(value, label) {
9481
+ const parsed = parseBigint(value, label);
9482
+ if (parsed < 0n || parsed >= 1n << 256n) {
9483
+ throw new Error(`${label} out of 256-bit range`);
9484
+ }
9485
+ return parsed;
9486
+ }
9165
9487
  var ORACLE_EVENT_SIGS = {
9166
9488
  oracleRoundFinalized: "OracleRoundFinalized(bytes32,uint64,uint256,uint64,uint32)",
9167
9489
  observationSubmitted: "ObservationSubmitted(bytes32,uint64,address,uint256,uint64)",
@@ -12010,6 +12332,7 @@ exports.CLOB_MARKET_ID_DOMAIN_TAG = CLOB_MARKET_ID_DOMAIN_TAG;
12010
12332
  exports.CLOB_SELECTORS = CLOB_SELECTORS;
12011
12333
  exports.CLUSTER_FORMED_EVENT_SIG = CLUSTER_FORMED_EVENT_SIG;
12012
12334
  exports.DEFAULT_CLUSTER_JOIN_EXECUTION_UNIT_LIMIT = DEFAULT_CLUSTER_JOIN_EXECUTION_UNIT_LIMIT;
12335
+ exports.DEFAULT_SEAT_EXECUTION_UNIT_LIMIT = DEFAULT_SEAT_EXECUTION_UNIT_LIMIT;
12013
12336
  exports.DELEGATION_REVERT_TAGS = DELEGATION_REVERT_TAGS;
12014
12337
  exports.DELEGATION_SELECTORS = DELEGATION_SELECTORS;
12015
12338
  exports.DIVERSITY_SCORE_MAX = DIVERSITY_SCORE_MAX;
@@ -12096,15 +12419,20 @@ exports.NODE_REGISTRY_MAX_MERKLE_PROOF_DEPTH = NODE_REGISTRY_MAX_MERKLE_PROOF_DE
12096
12419
  exports.NODE_REGISTRY_MERKLE_INNER_DOMAIN = NODE_REGISTRY_MERKLE_INNER_DOMAIN;
12097
12420
  exports.NODE_REGISTRY_MERKLE_LEAF_DOMAIN = NODE_REGISTRY_MERKLE_LEAF_DOMAIN;
12098
12421
  exports.NODE_REGISTRY_MIN_ARCHIVE_LEAF_COUNT = NODE_REGISTRY_MIN_ARCHIVE_LEAF_COUNT;
12422
+ exports.NODE_REGISTRY_MIN_SELF_BOND_LYTHOSHI = NODE_REGISTRY_MIN_SELF_BOND_LYTHOSHI;
12099
12423
  exports.NODE_REGISTRY_OPERATOR_ALIAS_MAX_BYTES = NODE_REGISTRY_OPERATOR_ALIAS_MAX_BYTES;
12100
12424
  exports.NODE_REGISTRY_OPERATOR_MONIKER_MAX_BYTES = NODE_REGISTRY_OPERATOR_MONIKER_MAX_BYTES;
12101
12425
  exports.NODE_REGISTRY_PENDING_CHANGE_MAX_INTENT_ID = NODE_REGISTRY_PENDING_CHANGE_MAX_INTENT_ID;
12102
12426
  exports.NODE_REGISTRY_PUBLIC_SERVICE_MASK = NODE_REGISTRY_PUBLIC_SERVICE_MASK;
12427
+ exports.NODE_REGISTRY_SEAT_APPLICATION_ESCROW_LYTHOSHI = NODE_REGISTRY_SEAT_APPLICATION_ESCROW_LYTHOSHI;
12428
+ exports.NODE_REGISTRY_SEAT_KIND_ACTIVE = NODE_REGISTRY_SEAT_KIND_ACTIVE;
12429
+ exports.NODE_REGISTRY_SEAT_KIND_STANDBY = NODE_REGISTRY_SEAT_KIND_STANDBY;
12103
12430
  exports.NODE_REGISTRY_SELECTORS = NODE_REGISTRY_SELECTORS;
12104
12431
  exports.NODE_REGISTRY_SUBKIND_CHARTER_DELEGATOR_BPS = NODE_REGISTRY_SUBKIND_CHARTER_DELEGATOR_BPS;
12105
12432
  exports.NODE_REGISTRY_SUBKIND_CHARTER_MEMBER_SHARES = NODE_REGISTRY_SUBKIND_CHARTER_MEMBER_SHARES;
12106
12433
  exports.NODE_REGISTRY_TAG_ARCHIVE_CHALLENGE = NODE_REGISTRY_TAG_ARCHIVE_CHALLENGE;
12107
12434
  exports.NODE_REGISTRY_TAG_CLUSTER_CHARTER = NODE_REGISTRY_TAG_CLUSTER_CHARTER;
12435
+ exports.NODE_REGISTRY_TAG_CLUSTER_SEAT = NODE_REGISTRY_TAG_CLUSTER_SEAT;
12108
12436
  exports.NODE_REGISTRY_TAG_SERVICE_SCORE = NODE_REGISTRY_TAG_SERVICE_SCORE;
12109
12437
  exports.NODE_REGISTRY_TAG_TREASURY = NODE_REGISTRY_TAG_TREASURY;
12110
12438
  exports.NODE_REGISTRY_UPDATE_CHARTER_MESSAGE_DOMAIN = NODE_REGISTRY_UPDATE_CHARTER_MESSAGE_DOMAIN;
@@ -12150,6 +12478,12 @@ exports.QUARANTINED_RPC_CODE = QUARANTINED_RPC_CODE;
12150
12478
  exports.REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT = REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT;
12151
12479
  exports.RESERVED_ADDRESS_HRPS = RESERVED_ADDRESS_HRPS;
12152
12480
  exports.RpcClient = RpcClient;
12481
+ exports.SEAT_ADVERTISED_EVENT_SIG = SEAT_ADVERTISED_EVENT_SIG;
12482
+ exports.SEAT_APPLIED_EVENT_SIG = SEAT_APPLIED_EVENT_SIG;
12483
+ exports.SEAT_CLOSED_EVENT_SIG = SEAT_CLOSED_EVENT_SIG;
12484
+ exports.SEAT_FILLED_EVENT_SIG = SEAT_FILLED_EVENT_SIG;
12485
+ exports.SEAT_KINDS = SEAT_KINDS;
12486
+ exports.SEAT_STATUS_CODES = SEAT_STATUS_CODES;
12153
12487
  exports.SERVES_GPU_PROVE = SERVES_GPU_PROVE;
12154
12488
  exports.SERVICE_PROBE_STATUS = SERVICE_PROBE_STATUS;
12155
12489
  exports.SET_POLICY_CLAIM_DOMAIN_TAG = SET_POLICY_CLAIM_DOMAIN_TAG;
@@ -12204,8 +12538,11 @@ exports.bridgeDrainRemaining = bridgeDrainRemaining;
12204
12538
  exports.bridgeQuoteSubmitReadiness = bridgeQuoteSubmitReadiness;
12205
12539
  exports.bridgeRoutesReadiness = bridgeRoutesReadiness;
12206
12540
  exports.bridgeTransferCandidates = bridgeTransferCandidates;
12541
+ exports.buildAdvertiseSeatTxFields = buildAdvertiseSeatTxFields;
12542
+ exports.buildApplyForSeatTxFields = buildApplyForSeatTxFields;
12207
12543
  exports.buildBridgeRouteCatalogue = buildBridgeRouteCatalogue;
12208
12544
  exports.buildCancelSpotOrderPlan = buildCancelSpotOrderPlan;
12545
+ exports.buildCloseSeatTxFields = buildCloseSeatTxFields;
12209
12546
  exports.buildMrvCallNativeTxPlan = buildMrvCallNativeTxPlan;
12210
12547
  exports.buildMrvCallPlan = buildMrvCallPlan;
12211
12548
  exports.buildMrvCallRequest = buildMrvCallRequest;
@@ -12252,6 +12589,8 @@ exports.buildPlaceSpotMarketOrderExPlan = buildPlaceSpotMarketOrderExPlan;
12252
12589
  exports.buildPlaceSpotMarketOrderPlan = buildPlaceSpotMarketOrderPlan;
12253
12590
  exports.buildRequestClusterJoinTxFields = buildRequestClusterJoinTxFields;
12254
12591
  exports.buildVoteClusterAdmitTxFields = buildVoteClusterAdmitTxFields;
12592
+ exports.buildVoteSeatAdmitTxFields = buildVoteSeatAdmitTxFields;
12593
+ exports.buildWithdrawSeatApplicationTxFields = buildWithdrawSeatApplicationTxFields;
12255
12594
  exports.categoryRoot = categoryRoot;
12256
12595
  exports.checkMrvFeeDisplayConformance = checkMrvFeeDisplayConformance;
12257
12596
  exports.checkMrvStructuredFeeConformance = checkMrvStructuredFeeConformance;
@@ -12286,6 +12625,10 @@ exports.decodeOracleEvent = decodeOracleEvent;
12286
12625
  exports.decodePendingCharter = decodePendingCharter;
12287
12626
  exports.decodeProbeAuthority = decodeProbeAuthority;
12288
12627
  exports.decodeScoreServiceProbe = decodeScoreServiceProbe;
12628
+ exports.decodeSeatAdvertisedEvent = decodeSeatAdvertisedEvent;
12629
+ exports.decodeSeatAppliedEvent = decodeSeatAppliedEvent;
12630
+ exports.decodeSeatClosedEvent = decodeSeatClosedEvent;
12631
+ exports.decodeSeatFilledEvent = decodeSeatFilledEvent;
12289
12632
  exports.decodeTimeWindow = decodeTimeWindow;
12290
12633
  exports.decodeTokenFactoryTokenId = decodeTokenFactoryTokenId;
12291
12634
  exports.decodeTxFeedResponse = decodeTxFeedResponse;
@@ -12302,9 +12645,12 @@ exports.deriveMultisigAddress = deriveMultisigAddress;
12302
12645
  exports.deriveMultisigAddressBytes = deriveMultisigAddressBytes;
12303
12646
  exports.deriveNativeSpotMarketId = deriveNativeSpotMarketId;
12304
12647
  exports.deriveNativeSpotOrderId = deriveNativeSpotOrderId;
12648
+ exports.deriveSeatApplicationKey = deriveSeatApplicationKey;
12305
12649
  exports.deriveTokenFactoryTokenId = deriveTokenFactoryTokenId;
12306
12650
  exports.destinationRoot = destinationRoot;
12651
+ exports.encodeAdvertiseSeatCalldata = encodeAdvertiseSeatCalldata;
12307
12652
  exports.encodeAnswerArchiveChallengeCalldata = encodeAnswerArchiveChallengeCalldata;
12653
+ exports.encodeApplyForSeatCalldata = encodeApplyForSeatCalldata;
12308
12654
  exports.encodeAttestDkgReshareCalldata = encodeAttestDkgReshareCalldata;
12309
12655
  exports.encodeAttestServiceProbeCalldata = encodeAttestServiceProbeCalldata;
12310
12656
  exports.encodeBlockSelector = encodeBlockSelector;
@@ -12315,6 +12661,7 @@ exports.encodeCancelOrderCalldata = encodeCancelOrderCalldata;
12315
12661
  exports.encodeCancelPendingChangeCalldata = encodeCancelPendingChangeCalldata;
12316
12662
  exports.encodeClaimCalldata = encodeClaimCalldata;
12317
12663
  exports.encodeClaimPolicyByAddressCalldata = encodeClaimPolicyByAddressCalldata;
12664
+ exports.encodeCloseSeatCalldata = encodeCloseSeatCalldata;
12318
12665
  exports.encodeClusterCharter = encodeClusterCharter;
12319
12666
  exports.encodeCommitArchiveRootCalldata = encodeCommitArchiveRootCalldata;
12320
12667
  exports.encodeCreateFixedSupplyMrc20Calldata = encodeCreateFixedSupplyMrc20Calldata;
@@ -12421,7 +12768,9 @@ exports.encodeTokenFactoryTransferOwnershipCalldata = encodeTokenFactoryTransfer
12421
12768
  exports.encodeUndelegateCalldata = encodeUndelegateCalldata;
12422
12769
  exports.encodeUpdateCharterCalldata = encodeUpdateCharterCalldata;
12423
12770
  exports.encodeVoteClusterAdmitCalldata = encodeVoteClusterAdmitCalldata;
12771
+ exports.encodeVoteSeatAdmitCalldata = encodeVoteSeatAdmitCalldata;
12424
12772
  exports.encodeVrfEvaluateCalldata = encodeVrfEvaluateCalldata;
12773
+ exports.encodeWithdrawSeatApplicationCalldata = encodeWithdrawSeatApplicationCalldata;
12425
12774
  exports.exportBridgeRouteCatalogueJson = exportBridgeRouteCatalogueJson;
12426
12775
  exports.fetchChainInfoLatest = fetchChainInfoLatest;
12427
12776
  exports.fetchChainRegistryLatest = fetchChainRegistryLatest;
@@ -12478,6 +12827,7 @@ exports.nodeRegistryAddressHex = nodeRegistryAddressHex;
12478
12827
  exports.normalizeAddressHex = normalizeAddressHex;
12479
12828
  exports.normalizeBridgeRouteCatalogue = normalizeBridgeRouteCatalogue;
12480
12829
  exports.normalizePendingChangeKind = normalizePendingChangeKind;
12830
+ exports.openSeatFromAdvertised = openSeatFromAdvertised;
12481
12831
  exports.oracleAddressHex = oracleAddressHex;
12482
12832
  exports.oraclePriceToNumber = oraclePriceToNumber;
12483
12833
  exports.packTimeWindow = packTimeWindow;
@@ -12507,7 +12857,11 @@ exports.resolveClusterJoinExecutionFee = resolveClusterJoinExecutionFee;
12507
12857
  exports.resolveExecutionFee = resolveExecutionFee;
12508
12858
  exports.resolveMaxExecutionUnitPrice = resolveMaxExecutionUnitPrice;
12509
12859
  exports.resolveRegistryExecutionFee = resolveRegistryExecutionFee;
12860
+ exports.resolveSeatExecutionFee = resolveSeatExecutionFee;
12510
12861
  exports.resolveStudioHostStatus = resolveStudioHostStatus;
12862
+ exports.seatKindFromByte = seatKindFromByte;
12863
+ exports.seatKindToByte = seatKindToByte;
12864
+ exports.seatStatusFromByte = seatStatusFromByte;
12511
12865
  exports.selectBridgeTransferRoute = selectBridgeTransferRoute;
12512
12866
  exports.selectTrustedOperator = selectTrustedOperator;
12513
12867
  exports.selectTrustedOperatorForNetwork = selectTrustedOperatorForNetwork;