@monolythium/core-sdk 0.4.24 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.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` escrows the full operator self-bond at
417
+ * apply ({@link NODE_REGISTRY_MIN_SELF_BOND_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,252 @@ 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_MIN_SELF_BOND_LYTHOSHI = 5000n * 1000000000000000000n;
1384
+ var NODE_REGISTRY_SEAT_KIND_ACTIVE = 0;
1385
+ var NODE_REGISTRY_SEAT_KIND_STANDBY = 1;
1386
+ function seatKindFromByte(b) {
1387
+ return b === NODE_REGISTRY_SEAT_KIND_STANDBY ? "standby" : "active";
1388
+ }
1389
+ function seatKindToByte(kind) {
1390
+ return kind === "standby" ? NODE_REGISTRY_SEAT_KIND_STANDBY : NODE_REGISTRY_SEAT_KIND_ACTIVE;
1391
+ }
1392
+ var SEAT_STATUS_CODES = {
1393
+ none: 0,
1394
+ open: 1,
1395
+ filled: 2,
1396
+ closed: 3
1397
+ };
1398
+ function seatStatusFromByte(b) {
1399
+ switch (b) {
1400
+ case 1:
1401
+ return "open";
1402
+ case 2:
1403
+ return "filled";
1404
+ case 3:
1405
+ return "closed";
1406
+ default:
1407
+ return "none";
1408
+ }
1409
+ }
1410
+ var SEAT_ADVERTISED_EVENT_SIG = "SeatAdvertised(uint32,uint32,bytes32,uint8,uint32,uint128,uint32,bytes32)";
1411
+ var SEAT_APPLIED_EVENT_SIG = "SeatApplied(uint32,uint32,bytes32,address,uint128)";
1412
+ var SEAT_FILLED_EVENT_SIG = "SeatFilled(uint32,uint32,bytes32,uint16,uint16)";
1413
+ var SEAT_CLOSED_EVENT_SIG = "SeatClosed(uint32,uint32,uint8)";
1414
+ function encodeAdvertiseSeatCalldata(args) {
1415
+ const kindByte = typeof args.kind === "number" ? args.kind : seatKindToByte(args.kind);
1416
+ if (!Number.isInteger(kindByte) || kindByte < 0 || kindByte > 255) {
1417
+ throw new NodeRegistryError("kind must be a u8 seat kind (0 = active, 1 = standby)");
1418
+ }
1419
+ return bytesToHex(
1420
+ concatBytes(
1421
+ hexToBytes(NODE_REGISTRY_SELECTORS.advertiseSeat),
1422
+ uint32Word(toUint32(args.clusterId, "clusterId")),
1423
+ uint8Word(kindByte),
1424
+ uint32Word(toUint32(args.seatCount, "seatCount")),
1425
+ uint128Word(args.minBondLythoshi, "minBondLythoshi"),
1426
+ uint32Word(toUint32(args.capabilityMask, "capabilityMask")),
1427
+ expectLength2(toBytes(args.termsHash), 32, "termsHash")
1428
+ )
1429
+ );
1430
+ }
1431
+ function encodeApplyForSeatCalldata(args) {
1432
+ const operatorPubkey = expectLength2(
1433
+ toBytes(args.operatorPubkey),
1434
+ NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES,
1435
+ "operatorPubkey"
1436
+ );
1437
+ const operatorPubkeyPadded = padToWord(operatorPubkey);
1438
+ return bytesToHex(
1439
+ concatBytes(
1440
+ hexToBytes(NODE_REGISTRY_SELECTORS.applyForSeat),
1441
+ uint32Word(toUint32(args.clusterId, "clusterId")),
1442
+ uint32Word(toUint32(args.seatId, "seatId")),
1443
+ uint64Word(3n * 32n, "operatorPubkeyOffset"),
1444
+ uint64Word(BigInt(operatorPubkey.length), "operatorPubkeyLength"),
1445
+ operatorPubkeyPadded
1446
+ )
1447
+ );
1448
+ }
1449
+ function encodeVoteSeatAdmitCalldata(args) {
1450
+ const appKey = expectLength2(toBytes(args.appKey), 32, "appKey");
1451
+ const voterPubkey = expectLength2(
1452
+ toBytes(args.voterPubkey),
1453
+ NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES,
1454
+ "voterPubkey"
1455
+ );
1456
+ const voterPubkeyPadded = padToWord(voterPubkey);
1457
+ return bytesToHex(
1458
+ concatBytes(
1459
+ hexToBytes(NODE_REGISTRY_SELECTORS.voteSeatAdmit),
1460
+ uint32Word(toUint32(args.clusterId, "clusterId")),
1461
+ appKey,
1462
+ uint64Word(3n * 32n, "voterPubkeyOffset"),
1463
+ uint64Word(BigInt(voterPubkey.length), "voterPubkeyLength"),
1464
+ voterPubkeyPadded
1465
+ )
1466
+ );
1467
+ }
1468
+ function encodeWithdrawSeatApplicationCalldata(args) {
1469
+ return bytesToHex(
1470
+ concatBytes(
1471
+ hexToBytes(NODE_REGISTRY_SELECTORS.withdrawSeatApplication),
1472
+ uint32Word(toUint32(args.clusterId, "clusterId")),
1473
+ expectLength2(toBytes(args.appKey), 32, "appKey")
1474
+ )
1475
+ );
1476
+ }
1477
+ function encodeCloseSeatCalldata(args) {
1478
+ return bytesToHex(
1479
+ concatBytes(
1480
+ hexToBytes(NODE_REGISTRY_SELECTORS.closeSeat),
1481
+ uint32Word(toUint32(args.clusterId, "clusterId")),
1482
+ uint32Word(toUint32(args.seatId, "seatId"))
1483
+ )
1484
+ );
1485
+ }
1486
+ function deriveSeatApplicationKey(operatorPubkey) {
1487
+ return bytesToHex(
1488
+ blake3_js.blake3(expectLength2(toBytes(operatorPubkey), NODE_REGISTRY_CONSENSUS_PUBKEY_BYTES, "operatorPubkey"))
1489
+ );
1490
+ }
1491
+ function decodeSeatAdvertisedEvent(topics, data) {
1492
+ const { clusterId, seatId } = decodeSeatClusterSeatTopics(topics, SEAT_ADVERTISED_EVENT_SIG, 3);
1493
+ const body = toBytes(data);
1494
+ if (body.length < 6 * 32) {
1495
+ throw new NodeRegistryError("SeatAdvertised data shorter than the 6-word body");
1496
+ }
1497
+ const word = (i) => body.slice(i * 32, (i + 1) * 32);
1498
+ return {
1499
+ clusterId,
1500
+ seatId,
1501
+ advertiser: bytesToHex(word(0)),
1502
+ kind: numberFromWord(word(1), "kind", 255),
1503
+ seatCount: u32FromWord(word(2)),
1504
+ minBondLythoshi: uintFromWord(word(3)),
1505
+ capabilityMask: u32FromWord(word(4)),
1506
+ termsHash: bytesToHex(word(5))
1507
+ };
1508
+ }
1509
+ function decodeSeatAppliedEvent(topics, data) {
1510
+ const { clusterId, seatId, operatorId } = decodeSeatClusterSeatOperatorTopics(
1511
+ topics,
1512
+ SEAT_APPLIED_EVENT_SIG
1513
+ );
1514
+ const body = toBytes(data);
1515
+ if (body.length < 2 * 32) {
1516
+ throw new NodeRegistryError("SeatApplied data shorter than the 2-word body");
1517
+ }
1518
+ return {
1519
+ clusterId,
1520
+ seatId,
1521
+ operatorId,
1522
+ owner: bytesToHex(body.slice(12, 32)),
1523
+ bondLythoshi: uintFromWord(body.slice(32, 64))
1524
+ };
1525
+ }
1526
+ function decodeSeatFilledEvent(topics, data) {
1527
+ const { clusterId, seatId, operatorId } = decodeSeatClusterSeatOperatorTopics(
1528
+ topics,
1529
+ SEAT_FILLED_EVENT_SIG
1530
+ );
1531
+ const body = toBytes(data);
1532
+ if (body.length < 2 * 32) {
1533
+ throw new NodeRegistryError("SeatFilled data shorter than the 2-word body");
1534
+ }
1535
+ return {
1536
+ clusterId,
1537
+ seatId,
1538
+ operatorId,
1539
+ filledCount: numberFromWord(body.slice(0, 32), "filledCount", 65535),
1540
+ seatCount: numberFromWord(body.slice(32, 64), "seatCount", 65535)
1541
+ };
1542
+ }
1543
+ function decodeSeatClosedEvent(topics, data) {
1544
+ const { clusterId, seatId } = decodeSeatClusterSeatTopics(topics, SEAT_CLOSED_EVENT_SIG, 3);
1545
+ const body = toBytes(data);
1546
+ if (body.length < 32) {
1547
+ throw new NodeRegistryError("SeatClosed data shorter than the 1-word body");
1548
+ }
1549
+ return {
1550
+ clusterId,
1551
+ seatId,
1552
+ status: numberFromWord(body.slice(0, 32), "status", 255)
1553
+ };
1554
+ }
1555
+ function openSeatFromAdvertised(event) {
1556
+ return {
1557
+ clusterId: event.clusterId,
1558
+ seatId: event.seatId,
1559
+ advertiser: event.advertiser,
1560
+ kind: seatKindFromByte(event.kind),
1561
+ seatCount: event.seatCount,
1562
+ filledCount: 0,
1563
+ minBondLythoshi: event.minBondLythoshi,
1564
+ capabilityMask: event.capabilityMask,
1565
+ termsHash: event.termsHash,
1566
+ status: "open"
1567
+ };
1568
+ }
1569
+ function decodeSeatClusterSeatTopics(topics, sig, expectedCount) {
1570
+ if (topics.length !== expectedCount) {
1571
+ throw new NodeRegistryError(`${sig} expects ${expectedCount} topics, got ${topics.length}`);
1572
+ }
1573
+ assertEventTopic0(topics[0], sig);
1574
+ return {
1575
+ clusterId: u32FromWord(expectLength2(toBytes(topics[1]), 32, "clusterId topic")),
1576
+ seatId: u32FromWord(expectLength2(toBytes(topics[2]), 32, "seatId topic"))
1577
+ };
1578
+ }
1579
+ function decodeSeatClusterSeatOperatorTopics(topics, sig) {
1580
+ if (topics.length !== 4) {
1581
+ throw new NodeRegistryError(`${sig} expects 4 topics, got ${topics.length}`);
1582
+ }
1583
+ assertEventTopic0(topics[0], sig);
1584
+ return {
1585
+ clusterId: u32FromWord(expectLength2(toBytes(topics[1]), 32, "clusterId topic")),
1586
+ seatId: u32FromWord(expectLength2(toBytes(topics[2]), 32, "seatId topic")),
1587
+ operatorId: bytesToHex(expectLength2(toBytes(topics[3]), 32, "operatorId topic"))
1588
+ };
1589
+ }
1590
+ function assertEventTopic0(topic0, sig) {
1591
+ const got = bytesToHex(expectLength2(toBytes(topic0), 32, "topic0"));
1592
+ const want = bytesToHex(sha3_js.keccak_256(new TextEncoder().encode(sig)));
1593
+ if (got !== want) {
1594
+ throw new NodeRegistryError(`unexpected topic0 for ${sig}`);
1595
+ }
1596
+ }
1597
+ function uint128Word(value, name) {
1598
+ const n = toUint128(value, name);
1599
+ const out = new Uint8Array(32);
1600
+ let rest = n;
1601
+ for (let i = 31; i >= 16; i--) {
1602
+ out[i] = Number(rest & 0xffn);
1603
+ rest >>= 8n;
1604
+ }
1605
+ return out;
1606
+ }
1607
+ function toUint128(value, name) {
1608
+ let parsed;
1609
+ if (typeof value === "bigint") {
1610
+ parsed = value;
1611
+ } else if (typeof value === "number") {
1612
+ if (!Number.isSafeInteger(value)) {
1613
+ throw new NodeRegistryError(`${name} must be a safe integer`);
1614
+ }
1615
+ parsed = BigInt(value);
1616
+ } else {
1617
+ const trimmed = value.trim();
1618
+ if (!/^\d+$/u.test(trimmed)) {
1619
+ throw new NodeRegistryError(`${name} must be a decimal uint128`);
1620
+ }
1621
+ parsed = BigInt(trimmed);
1622
+ }
1623
+ if (parsed < 0n || parsed >= 1n << 128n) {
1624
+ throw new NodeRegistryError(`${name} must fit uint128`);
1625
+ }
1626
+ return parsed;
1627
+ }
1354
1628
  function selectorHex(sig) {
1355
1629
  return [...sha3_js.keccak_256(new TextEncoder().encode(sig)).slice(0, 4)].map((b) => b.toString(16).padStart(2, "0")).join("");
1356
1630
  }
@@ -8861,67 +9135,43 @@ function assertWholeNumber(field2, value) {
8861
9135
  throw new Error(`${field2} must be a whole number`);
8862
9136
  }
8863
9137
  }
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 {
9138
+ var MLDSA65_MNEMONIC_WORDS = 24;
9139
+ var MLDSA65_SEED_DOMAIN = "monolythium.mldsa65.v1";
9140
+ var DOMAIN_BYTES = new TextEncoder().encode(MLDSA65_SEED_DOMAIN);
9141
+ var MnemonicError = class extends Error {
8870
9142
  constructor(kind, message) {
8871
9143
  super(message);
8872
9144
  this.kind = kind;
8873
- this.name = "Pqm1Error";
9145
+ this.name = "MnemonicError";
8874
9146
  }
8875
9147
  kind;
8876
9148
  };
8877
- var DOMAIN_BYTES = new TextEncoder().encode(PQM1_V1_MLDSA65_DOMAIN_TAG);
8878
9149
  function normalizeMnemonic(mnemonic) {
8879
9150
  return mnemonic.trim().toLowerCase().replace(/\s+/g, " ");
8880
9151
  }
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
- };
9152
+ function wordCount(normalized) {
9153
+ return normalized.length === 0 ? 0 : normalized.split(" ").length;
8901
9154
  }
8902
- function pqm1MnemonicToPayload(mnemonic) {
9155
+ function mnemonicToMlDsa65Seed(mnemonic) {
8903
9156
  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}`);
9157
+ const words = wordCount(normalized);
9158
+ if (words !== MLDSA65_MNEMONIC_WORDS) {
9159
+ throw new MnemonicError(
9160
+ "badWordCount",
9161
+ `mnemonic must be ${MLDSA65_MNEMONIC_WORDS} words, got ${words}`
9162
+ );
8907
9163
  }
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}`);
9164
+ if (!bip39.validateMnemonic(normalized, english_js.wordlist)) {
9165
+ throw new MnemonicError(
9166
+ "bip39Decode",
9167
+ "invalid BIP-39 mnemonic (unknown word or bad checksum)"
9168
+ );
8913
9169
  }
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 });
9170
+ const seed64 = bip39.mnemonicToSeedSync(normalized, "");
9171
+ return sha3_js.shake256(concatBytes2(DOMAIN_BYTES, seed64), { dkLen: ML_DSA_65_SEED_LEN });
8919
9172
  }
8920
- function pqm1MnemonicToMlDsa65Seed(mnemonic) {
8921
- return derivePqm1MlDsa65SeedFromPayload(pqm1MnemonicToPayload(mnemonic).bytes);
8922
- }
8923
- function pqm1MnemonicToMlDsa65Backend(mnemonic) {
8924
- return MlDsa65Backend.fromSeed(pqm1MnemonicToMlDsa65Seed(mnemonic));
9173
+ function mnemonicToMlDsa65Backend(mnemonic) {
9174
+ return MlDsa65Backend.fromSeed(mnemonicToMlDsa65Seed(mnemonic));
8925
9175
  }
8926
9176
 
8927
9177
  // src/cluster-join.ts
@@ -9037,7 +9287,7 @@ async function submitRequestClusterJoin(args) {
9037
9287
  const clusterId = parseUint32(args.clusterId, "clusterId");
9038
9288
  const operatorPubkey = normalizeConsensusPubkey(args.operatorPubkey, "operatorPubkey");
9039
9289
  const operatorIdHex = deriveClusterJoinOperatorId(operatorPubkey);
9040
- const backend = pqm1MnemonicToMlDsa65Backend(args.mnemonic);
9290
+ const backend = mnemonicToMlDsa65Backend(args.mnemonic);
9041
9291
  const senderAddress = addressToTypedBech32("user", backend.addressBytes());
9042
9292
  const preview = await previewRequestClusterJoin(args.client, {
9043
9293
  from: senderAddress,
@@ -9064,7 +9314,7 @@ async function submitRequestClusterJoin(args) {
9064
9314
  async function submitVoteClusterAdmit(args) {
9065
9315
  const clusterId = parseUint32(args.clusterId, "clusterId");
9066
9316
  const operatorIdHex = normalizeOperatorId(args.operatorId);
9067
- const backend = pqm1MnemonicToMlDsa65Backend(args.mnemonic);
9317
+ const backend = mnemonicToMlDsa65Backend(args.mnemonic);
9068
9318
  const senderAddress = addressToTypedBech32("user", backend.addressBytes());
9069
9319
  const preview = await previewVoteClusterAdmit(args.client, {
9070
9320
  from: senderAddress,
@@ -9162,6 +9412,77 @@ function parseU256(value, label) {
9162
9412
  function errorMessage(cause) {
9163
9413
  return cause instanceof Error ? cause.message : String(cause);
9164
9414
  }
9415
+
9416
+ // src/cluster-seat.ts
9417
+ var DEFAULT_SEAT_EXECUTION_UNIT_LIMIT = REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT;
9418
+ function resolveSeatExecutionFee(quote, options = {}) {
9419
+ const quoted = parseBigint(quote.executionUnitPriceLythoshi, "executionUnitPriceLythoshi");
9420
+ const floor = options.minPriceLythoshi === void 0 ? MIN_EXECUTION_UNIT_PRICE_LYTHOSHI : parseBigint(options.minPriceLythoshi, "minPriceLythoshi");
9421
+ const multiplier = options.safetyMultiplier === void 0 ? EXECUTION_UNIT_PRICE_SAFETY_MULTIPLIER : parseBigint(options.safetyMultiplier, "safetyMultiplier");
9422
+ if (multiplier <= 0n) throw new Error("safetyMultiplier must be greater than zero");
9423
+ const base = quoted > floor ? quoted : floor;
9424
+ const maxFeePerGas = base * multiplier;
9425
+ const tip = options.priorityTipLythoshi === void 0 ? maxFeePerGas : clampPriorityTip(options.priorityTipLythoshi, maxFeePerGas);
9426
+ return {
9427
+ maxFeePerGas,
9428
+ maxPriorityFeePerGas: tip,
9429
+ gasLimit: options.executionUnitLimit ?? DEFAULT_SEAT_EXECUTION_UNIT_LIMIT
9430
+ };
9431
+ }
9432
+ function buildAdvertiseSeatTxFields(args) {
9433
+ return {
9434
+ ...seatTxEnvelope(args.chainId, args.nonce, args.fee),
9435
+ value: 0n,
9436
+ input: encodeAdvertiseSeatCalldata(args)
9437
+ };
9438
+ }
9439
+ function buildApplyForSeatTxFields(args) {
9440
+ const selfBond = args.selfBondLythoshi === void 0 ? NODE_REGISTRY_MIN_SELF_BOND_LYTHOSHI : parseU2562(args.selfBondLythoshi, "selfBondLythoshi");
9441
+ return {
9442
+ ...seatTxEnvelope(args.chainId, args.nonce, args.fee),
9443
+ value: selfBond,
9444
+ input: encodeApplyForSeatCalldata(args)
9445
+ };
9446
+ }
9447
+ function buildVoteSeatAdmitTxFields(args) {
9448
+ return {
9449
+ ...seatTxEnvelope(args.chainId, args.nonce, args.fee),
9450
+ value: 0n,
9451
+ input: encodeVoteSeatAdmitCalldata(args)
9452
+ };
9453
+ }
9454
+ function buildWithdrawSeatApplicationTxFields(args) {
9455
+ return {
9456
+ ...seatTxEnvelope(args.chainId, args.nonce, args.fee),
9457
+ value: 0n,
9458
+ input: encodeWithdrawSeatApplicationCalldata(args)
9459
+ };
9460
+ }
9461
+ function buildCloseSeatTxFields(args) {
9462
+ return {
9463
+ ...seatTxEnvelope(args.chainId, args.nonce, args.fee),
9464
+ value: 0n,
9465
+ input: encodeCloseSeatCalldata(args)
9466
+ };
9467
+ }
9468
+ var SEAT_KINDS = ["active", "standby"];
9469
+ function seatTxEnvelope(chainId, nonce, fee) {
9470
+ return {
9471
+ chainId,
9472
+ nonce,
9473
+ maxFeePerGas: parseBigint(fee.maxFeePerGas, "maxFeePerGas"),
9474
+ maxPriorityFeePerGas: parseBigint(fee.maxPriorityFeePerGas, "maxPriorityFeePerGas"),
9475
+ gasLimit: parseBigint(fee.gasLimit ?? DEFAULT_SEAT_EXECUTION_UNIT_LIMIT, "gasLimit"),
9476
+ to: nodeRegistryAddressHex()
9477
+ };
9478
+ }
9479
+ function parseU2562(value, label) {
9480
+ const parsed = parseBigint(value, label);
9481
+ if (parsed < 0n || parsed >= 1n << 256n) {
9482
+ throw new Error(`${label} out of 256-bit range`);
9483
+ }
9484
+ return parsed;
9485
+ }
9165
9486
  var ORACLE_EVENT_SIGS = {
9166
9487
  oracleRoundFinalized: "OracleRoundFinalized(bytes32,uint64,uint256,uint64,uint32)",
9167
9488
  observationSubmitted: "ObservationSubmitted(bytes32,uint64,address,uint256,uint64)",
@@ -12010,6 +12331,7 @@ exports.CLOB_MARKET_ID_DOMAIN_TAG = CLOB_MARKET_ID_DOMAIN_TAG;
12010
12331
  exports.CLOB_SELECTORS = CLOB_SELECTORS;
12011
12332
  exports.CLUSTER_FORMED_EVENT_SIG = CLUSTER_FORMED_EVENT_SIG;
12012
12333
  exports.DEFAULT_CLUSTER_JOIN_EXECUTION_UNIT_LIMIT = DEFAULT_CLUSTER_JOIN_EXECUTION_UNIT_LIMIT;
12334
+ exports.DEFAULT_SEAT_EXECUTION_UNIT_LIMIT = DEFAULT_SEAT_EXECUTION_UNIT_LIMIT;
12013
12335
  exports.DELEGATION_REVERT_TAGS = DELEGATION_REVERT_TAGS;
12014
12336
  exports.DELEGATION_SELECTORS = DELEGATION_SELECTORS;
12015
12337
  exports.DIVERSITY_SCORE_MAX = DIVERSITY_SCORE_MAX;
@@ -12096,15 +12418,19 @@ exports.NODE_REGISTRY_MAX_MERKLE_PROOF_DEPTH = NODE_REGISTRY_MAX_MERKLE_PROOF_DE
12096
12418
  exports.NODE_REGISTRY_MERKLE_INNER_DOMAIN = NODE_REGISTRY_MERKLE_INNER_DOMAIN;
12097
12419
  exports.NODE_REGISTRY_MERKLE_LEAF_DOMAIN = NODE_REGISTRY_MERKLE_LEAF_DOMAIN;
12098
12420
  exports.NODE_REGISTRY_MIN_ARCHIVE_LEAF_COUNT = NODE_REGISTRY_MIN_ARCHIVE_LEAF_COUNT;
12421
+ exports.NODE_REGISTRY_MIN_SELF_BOND_LYTHOSHI = NODE_REGISTRY_MIN_SELF_BOND_LYTHOSHI;
12099
12422
  exports.NODE_REGISTRY_OPERATOR_ALIAS_MAX_BYTES = NODE_REGISTRY_OPERATOR_ALIAS_MAX_BYTES;
12100
12423
  exports.NODE_REGISTRY_OPERATOR_MONIKER_MAX_BYTES = NODE_REGISTRY_OPERATOR_MONIKER_MAX_BYTES;
12101
12424
  exports.NODE_REGISTRY_PENDING_CHANGE_MAX_INTENT_ID = NODE_REGISTRY_PENDING_CHANGE_MAX_INTENT_ID;
12102
12425
  exports.NODE_REGISTRY_PUBLIC_SERVICE_MASK = NODE_REGISTRY_PUBLIC_SERVICE_MASK;
12426
+ exports.NODE_REGISTRY_SEAT_KIND_ACTIVE = NODE_REGISTRY_SEAT_KIND_ACTIVE;
12427
+ exports.NODE_REGISTRY_SEAT_KIND_STANDBY = NODE_REGISTRY_SEAT_KIND_STANDBY;
12103
12428
  exports.NODE_REGISTRY_SELECTORS = NODE_REGISTRY_SELECTORS;
12104
12429
  exports.NODE_REGISTRY_SUBKIND_CHARTER_DELEGATOR_BPS = NODE_REGISTRY_SUBKIND_CHARTER_DELEGATOR_BPS;
12105
12430
  exports.NODE_REGISTRY_SUBKIND_CHARTER_MEMBER_SHARES = NODE_REGISTRY_SUBKIND_CHARTER_MEMBER_SHARES;
12106
12431
  exports.NODE_REGISTRY_TAG_ARCHIVE_CHALLENGE = NODE_REGISTRY_TAG_ARCHIVE_CHALLENGE;
12107
12432
  exports.NODE_REGISTRY_TAG_CLUSTER_CHARTER = NODE_REGISTRY_TAG_CLUSTER_CHARTER;
12433
+ exports.NODE_REGISTRY_TAG_CLUSTER_SEAT = NODE_REGISTRY_TAG_CLUSTER_SEAT;
12108
12434
  exports.NODE_REGISTRY_TAG_SERVICE_SCORE = NODE_REGISTRY_TAG_SERVICE_SCORE;
12109
12435
  exports.NODE_REGISTRY_TAG_TREASURY = NODE_REGISTRY_TAG_TREASURY;
12110
12436
  exports.NODE_REGISTRY_UPDATE_CHARTER_MESSAGE_DOMAIN = NODE_REGISTRY_UPDATE_CHARTER_MESSAGE_DOMAIN;
@@ -12150,6 +12476,12 @@ exports.QUARANTINED_RPC_CODE = QUARANTINED_RPC_CODE;
12150
12476
  exports.REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT = REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT;
12151
12477
  exports.RESERVED_ADDRESS_HRPS = RESERVED_ADDRESS_HRPS;
12152
12478
  exports.RpcClient = RpcClient;
12479
+ exports.SEAT_ADVERTISED_EVENT_SIG = SEAT_ADVERTISED_EVENT_SIG;
12480
+ exports.SEAT_APPLIED_EVENT_SIG = SEAT_APPLIED_EVENT_SIG;
12481
+ exports.SEAT_CLOSED_EVENT_SIG = SEAT_CLOSED_EVENT_SIG;
12482
+ exports.SEAT_FILLED_EVENT_SIG = SEAT_FILLED_EVENT_SIG;
12483
+ exports.SEAT_KINDS = SEAT_KINDS;
12484
+ exports.SEAT_STATUS_CODES = SEAT_STATUS_CODES;
12153
12485
  exports.SERVES_GPU_PROVE = SERVES_GPU_PROVE;
12154
12486
  exports.SERVICE_PROBE_STATUS = SERVICE_PROBE_STATUS;
12155
12487
  exports.SET_POLICY_CLAIM_DOMAIN_TAG = SET_POLICY_CLAIM_DOMAIN_TAG;
@@ -12204,8 +12536,11 @@ exports.bridgeDrainRemaining = bridgeDrainRemaining;
12204
12536
  exports.bridgeQuoteSubmitReadiness = bridgeQuoteSubmitReadiness;
12205
12537
  exports.bridgeRoutesReadiness = bridgeRoutesReadiness;
12206
12538
  exports.bridgeTransferCandidates = bridgeTransferCandidates;
12539
+ exports.buildAdvertiseSeatTxFields = buildAdvertiseSeatTxFields;
12540
+ exports.buildApplyForSeatTxFields = buildApplyForSeatTxFields;
12207
12541
  exports.buildBridgeRouteCatalogue = buildBridgeRouteCatalogue;
12208
12542
  exports.buildCancelSpotOrderPlan = buildCancelSpotOrderPlan;
12543
+ exports.buildCloseSeatTxFields = buildCloseSeatTxFields;
12209
12544
  exports.buildMrvCallNativeTxPlan = buildMrvCallNativeTxPlan;
12210
12545
  exports.buildMrvCallPlan = buildMrvCallPlan;
12211
12546
  exports.buildMrvCallRequest = buildMrvCallRequest;
@@ -12252,6 +12587,8 @@ exports.buildPlaceSpotMarketOrderExPlan = buildPlaceSpotMarketOrderExPlan;
12252
12587
  exports.buildPlaceSpotMarketOrderPlan = buildPlaceSpotMarketOrderPlan;
12253
12588
  exports.buildRequestClusterJoinTxFields = buildRequestClusterJoinTxFields;
12254
12589
  exports.buildVoteClusterAdmitTxFields = buildVoteClusterAdmitTxFields;
12590
+ exports.buildVoteSeatAdmitTxFields = buildVoteSeatAdmitTxFields;
12591
+ exports.buildWithdrawSeatApplicationTxFields = buildWithdrawSeatApplicationTxFields;
12255
12592
  exports.categoryRoot = categoryRoot;
12256
12593
  exports.checkMrvFeeDisplayConformance = checkMrvFeeDisplayConformance;
12257
12594
  exports.checkMrvStructuredFeeConformance = checkMrvStructuredFeeConformance;
@@ -12286,6 +12623,10 @@ exports.decodeOracleEvent = decodeOracleEvent;
12286
12623
  exports.decodePendingCharter = decodePendingCharter;
12287
12624
  exports.decodeProbeAuthority = decodeProbeAuthority;
12288
12625
  exports.decodeScoreServiceProbe = decodeScoreServiceProbe;
12626
+ exports.decodeSeatAdvertisedEvent = decodeSeatAdvertisedEvent;
12627
+ exports.decodeSeatAppliedEvent = decodeSeatAppliedEvent;
12628
+ exports.decodeSeatClosedEvent = decodeSeatClosedEvent;
12629
+ exports.decodeSeatFilledEvent = decodeSeatFilledEvent;
12289
12630
  exports.decodeTimeWindow = decodeTimeWindow;
12290
12631
  exports.decodeTokenFactoryTokenId = decodeTokenFactoryTokenId;
12291
12632
  exports.decodeTxFeedResponse = decodeTxFeedResponse;
@@ -12302,9 +12643,12 @@ exports.deriveMultisigAddress = deriveMultisigAddress;
12302
12643
  exports.deriveMultisigAddressBytes = deriveMultisigAddressBytes;
12303
12644
  exports.deriveNativeSpotMarketId = deriveNativeSpotMarketId;
12304
12645
  exports.deriveNativeSpotOrderId = deriveNativeSpotOrderId;
12646
+ exports.deriveSeatApplicationKey = deriveSeatApplicationKey;
12305
12647
  exports.deriveTokenFactoryTokenId = deriveTokenFactoryTokenId;
12306
12648
  exports.destinationRoot = destinationRoot;
12649
+ exports.encodeAdvertiseSeatCalldata = encodeAdvertiseSeatCalldata;
12307
12650
  exports.encodeAnswerArchiveChallengeCalldata = encodeAnswerArchiveChallengeCalldata;
12651
+ exports.encodeApplyForSeatCalldata = encodeApplyForSeatCalldata;
12308
12652
  exports.encodeAttestDkgReshareCalldata = encodeAttestDkgReshareCalldata;
12309
12653
  exports.encodeAttestServiceProbeCalldata = encodeAttestServiceProbeCalldata;
12310
12654
  exports.encodeBlockSelector = encodeBlockSelector;
@@ -12315,6 +12659,7 @@ exports.encodeCancelOrderCalldata = encodeCancelOrderCalldata;
12315
12659
  exports.encodeCancelPendingChangeCalldata = encodeCancelPendingChangeCalldata;
12316
12660
  exports.encodeClaimCalldata = encodeClaimCalldata;
12317
12661
  exports.encodeClaimPolicyByAddressCalldata = encodeClaimPolicyByAddressCalldata;
12662
+ exports.encodeCloseSeatCalldata = encodeCloseSeatCalldata;
12318
12663
  exports.encodeClusterCharter = encodeClusterCharter;
12319
12664
  exports.encodeCommitArchiveRootCalldata = encodeCommitArchiveRootCalldata;
12320
12665
  exports.encodeCreateFixedSupplyMrc20Calldata = encodeCreateFixedSupplyMrc20Calldata;
@@ -12421,7 +12766,9 @@ exports.encodeTokenFactoryTransferOwnershipCalldata = encodeTokenFactoryTransfer
12421
12766
  exports.encodeUndelegateCalldata = encodeUndelegateCalldata;
12422
12767
  exports.encodeUpdateCharterCalldata = encodeUpdateCharterCalldata;
12423
12768
  exports.encodeVoteClusterAdmitCalldata = encodeVoteClusterAdmitCalldata;
12769
+ exports.encodeVoteSeatAdmitCalldata = encodeVoteSeatAdmitCalldata;
12424
12770
  exports.encodeVrfEvaluateCalldata = encodeVrfEvaluateCalldata;
12771
+ exports.encodeWithdrawSeatApplicationCalldata = encodeWithdrawSeatApplicationCalldata;
12425
12772
  exports.exportBridgeRouteCatalogueJson = exportBridgeRouteCatalogueJson;
12426
12773
  exports.fetchChainInfoLatest = fetchChainInfoLatest;
12427
12774
  exports.fetchChainRegistryLatest = fetchChainRegistryLatest;
@@ -12478,6 +12825,7 @@ exports.nodeRegistryAddressHex = nodeRegistryAddressHex;
12478
12825
  exports.normalizeAddressHex = normalizeAddressHex;
12479
12826
  exports.normalizeBridgeRouteCatalogue = normalizeBridgeRouteCatalogue;
12480
12827
  exports.normalizePendingChangeKind = normalizePendingChangeKind;
12828
+ exports.openSeatFromAdvertised = openSeatFromAdvertised;
12481
12829
  exports.oracleAddressHex = oracleAddressHex;
12482
12830
  exports.oraclePriceToNumber = oraclePriceToNumber;
12483
12831
  exports.packTimeWindow = packTimeWindow;
@@ -12507,7 +12855,11 @@ exports.resolveClusterJoinExecutionFee = resolveClusterJoinExecutionFee;
12507
12855
  exports.resolveExecutionFee = resolveExecutionFee;
12508
12856
  exports.resolveMaxExecutionUnitPrice = resolveMaxExecutionUnitPrice;
12509
12857
  exports.resolveRegistryExecutionFee = resolveRegistryExecutionFee;
12858
+ exports.resolveSeatExecutionFee = resolveSeatExecutionFee;
12510
12859
  exports.resolveStudioHostStatus = resolveStudioHostStatus;
12860
+ exports.seatKindFromByte = seatKindFromByte;
12861
+ exports.seatKindToByte = seatKindToByte;
12862
+ exports.seatStatusFromByte = seatStatusFromByte;
12511
12863
  exports.selectBridgeTransferRoute = selectBridgeTransferRoute;
12512
12864
  exports.selectTrustedOperator = selectTrustedOperator;
12513
12865
  exports.selectTrustedOperatorForNetwork = selectTrustedOperatorForNetwork;