@monolythium/core-sdk 0.4.16 → 0.4.18
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/crypto/index.d.cts +2 -2
- package/dist/crypto/index.d.ts +2 -2
- package/dist/index.cjs +257 -99
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +251 -100
- package/dist/index.js.map +1 -1
- package/dist/{submission-BdBhOdg7.d.cts → submission-Cr6u_2he.d.cts} +135 -4
- package/dist/{submission-BdBhOdg7.d.ts → submission-Cr6u_2he.d.ts} +135 -4
- package/package.json +1 -1
package/dist/crypto/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as MlDsa65Backend } from '../submission-
|
|
2
|
-
export {
|
|
1
|
+
import { I as MlDsa65Backend } from '../submission-Cr6u_2he.cjs';
|
|
2
|
+
export { kb as ADDRESS_DERIVATION_DOMAIN, kc as CLUSTER_MLKEM_SHAMIR, kd as CLUSTER_MLKEM_SHAMIR_ALGO, ke as ClusterSealKeyEntryInput, K as ClusterSealKeys, L as ClusterSealKeysSource, kf as DKG_AEAD_TAG_LEN, kg as DKG_NONCE_LEN, kh as DecryptHint, ki as ENCRYPTED_SUBMISSION_UNAVAILABLE_MESSAGE, kj as ENUM_VARIANT_INDEX_ML_DSA_65, kk as EncryptedEnvelope, kl as EncryptedSubmission, E as EncryptionKey, km as JsonRpcCallClient, kn as LythiumSealEnvelope, ko as ML_DSA_65_PUBLIC_KEY_LEN, kp as ML_DSA_65_SEED_LEN, kq as ML_DSA_65_SIGNATURE_LEN, kr as ML_DSA_65_SIGNING_KEY_LEN, ks as ML_KEM_768_CIPHERTEXT_LEN, kt as ML_KEM_768_ENCAPSULATION_KEY_LEN, ku as ML_KEM_768_SHARED_SECRET_LEN, F as MempoolClass, D as NativeEvmTxFields, kv as NativeTxExtension, kw as NativeTxExtensionDescriptor, kx as NativeTxExtensionLike, ky as NonceAad, kz as OperatorSealKeypair, kA as PlaintextSubmission, kB as SEAL_COMMIT_LEN, kC as SEAL_DK_LEN, kD as SEAL_EK_LEN, kE as SEAL_KEM_CT_LEN, kF as SEAL_KEM_SEED_LEN, kG as SEAL_KEY_LEN, kH as SEAL_NONCE_LEN, kI as SEAL_SHARE_LEN, kJ as SEAL_TAG_LEN, kK as STANDARD_ALGO_NUMBER_ML_DSA_65, kL as SealRandomSource, kM as SealRecipient, kN as SealedSubmission, kO as bincodeDecryptHint, kP as bincodeEncryptedEnvelope, kQ as bincodeNonceAad, kR as bincodeSignedTransaction, kS as buildEncryptedEnvelope, kT as buildEncryptedSubmission, kU as buildPlaintextSubmission, kV as cryptoRandomSource, kW as encodeMlDsa65Opaque, kX as encodeSealEnvelope, kY as encodeTransactionForHash, kZ as encryptInnerTx, k_ as fetchEncryptionKey, k$ as generateOperatorSealKeypair, l0 as getClusterSealKeys, l1 as mlDsa65AddressBytes, l2 as mlDsa65AddressFromPublicKey, l3 as outerSigDigest, l4 as parseClusterSealKeys, l5 as sealRosterHash, l6 as sealToCluster, l7 as sealTransaction, l8 as submitEncryptedEnvelope, l9 as submitPlaintextTransaction, la as submitSealedTransaction, lb as submitTransactionWithPrivacy } from '../submission-Cr6u_2he.cjs';
|
|
3
3
|
|
|
4
4
|
declare class BincodeWriter {
|
|
5
5
|
#private;
|
package/dist/crypto/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as MlDsa65Backend } from '../submission-
|
|
2
|
-
export {
|
|
1
|
+
import { I as MlDsa65Backend } from '../submission-Cr6u_2he.js';
|
|
2
|
+
export { kb as ADDRESS_DERIVATION_DOMAIN, kc as CLUSTER_MLKEM_SHAMIR, kd as CLUSTER_MLKEM_SHAMIR_ALGO, ke as ClusterSealKeyEntryInput, K as ClusterSealKeys, L as ClusterSealKeysSource, kf as DKG_AEAD_TAG_LEN, kg as DKG_NONCE_LEN, kh as DecryptHint, ki as ENCRYPTED_SUBMISSION_UNAVAILABLE_MESSAGE, kj as ENUM_VARIANT_INDEX_ML_DSA_65, kk as EncryptedEnvelope, kl as EncryptedSubmission, E as EncryptionKey, km as JsonRpcCallClient, kn as LythiumSealEnvelope, ko as ML_DSA_65_PUBLIC_KEY_LEN, kp as ML_DSA_65_SEED_LEN, kq as ML_DSA_65_SIGNATURE_LEN, kr as ML_DSA_65_SIGNING_KEY_LEN, ks as ML_KEM_768_CIPHERTEXT_LEN, kt as ML_KEM_768_ENCAPSULATION_KEY_LEN, ku as ML_KEM_768_SHARED_SECRET_LEN, F as MempoolClass, D as NativeEvmTxFields, kv as NativeTxExtension, kw as NativeTxExtensionDescriptor, kx as NativeTxExtensionLike, ky as NonceAad, kz as OperatorSealKeypair, kA as PlaintextSubmission, kB as SEAL_COMMIT_LEN, kC as SEAL_DK_LEN, kD as SEAL_EK_LEN, kE as SEAL_KEM_CT_LEN, kF as SEAL_KEM_SEED_LEN, kG as SEAL_KEY_LEN, kH as SEAL_NONCE_LEN, kI as SEAL_SHARE_LEN, kJ as SEAL_TAG_LEN, kK as STANDARD_ALGO_NUMBER_ML_DSA_65, kL as SealRandomSource, kM as SealRecipient, kN as SealedSubmission, kO as bincodeDecryptHint, kP as bincodeEncryptedEnvelope, kQ as bincodeNonceAad, kR as bincodeSignedTransaction, kS as buildEncryptedEnvelope, kT as buildEncryptedSubmission, kU as buildPlaintextSubmission, kV as cryptoRandomSource, kW as encodeMlDsa65Opaque, kX as encodeSealEnvelope, kY as encodeTransactionForHash, kZ as encryptInnerTx, k_ as fetchEncryptionKey, k$ as generateOperatorSealKeypair, l0 as getClusterSealKeys, l1 as mlDsa65AddressBytes, l2 as mlDsa65AddressFromPublicKey, l3 as outerSigDigest, l4 as parseClusterSealKeys, l5 as sealRosterHash, l6 as sealToCluster, l7 as sealTransaction, l8 as submitEncryptedEnvelope, l9 as submitPlaintextTransaction, la as submitSealedTransaction, lb as submitTransactionWithPrivacy } from '../submission-Cr6u_2he.js';
|
|
3
3
|
|
|
4
4
|
declare class BincodeWriter {
|
|
5
5
|
#private;
|
package/dist/index.cjs
CHANGED
|
@@ -266,84 +266,6 @@ function expectLength(value, len, name) {
|
|
|
266
266
|
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
// src/native-events.ts
|
|
270
|
-
var NATIVE_MARKET_EVENT_FAMILY = "market";
|
|
271
|
-
function nativeMarketEventFilter(filter = {}) {
|
|
272
|
-
return { ...filter, family: NATIVE_MARKET_EVENT_FAMILY };
|
|
273
|
-
}
|
|
274
|
-
function isNativeDecodedEvent(value) {
|
|
275
|
-
const row = asRecord(value);
|
|
276
|
-
return row !== null && typeof row["block_height"] === "number" && typeof row["tx_index"] === "number" && typeof row["sequence"] === "number" && typeof row["family"] === "string" && typeof row["event_name"] === "string" && typeof row["payload_hash"] === "string";
|
|
277
|
-
}
|
|
278
|
-
function parseNativeDecodedEvent(event) {
|
|
279
|
-
if (isNativeDecodedEvent(event.decoded)) {
|
|
280
|
-
return event.decoded;
|
|
281
|
-
}
|
|
282
|
-
try {
|
|
283
|
-
const parsed = JSON.parse(event.decodedJson);
|
|
284
|
-
if (isNativeDecodedEvent(parsed)) {
|
|
285
|
-
return parsed;
|
|
286
|
-
}
|
|
287
|
-
} catch {
|
|
288
|
-
}
|
|
289
|
-
throw SdkError.malformed(
|
|
290
|
-
`native event ${event.eventTopic} at logIndex ${event.logIndex} is missing a typed decoded payload`
|
|
291
|
-
);
|
|
292
|
-
}
|
|
293
|
-
function nativeEventMatches(event, filter = {}) {
|
|
294
|
-
if (filter.address !== void 0 && event.address !== filter.address) return false;
|
|
295
|
-
if (filter.eventTopic !== void 0 && event.eventTopic !== filter.eventTopic) return false;
|
|
296
|
-
if (filter.family === void 0 && filter.eventName === void 0) return true;
|
|
297
|
-
let decoded;
|
|
298
|
-
try {
|
|
299
|
-
decoded = parseNativeDecodedEvent(event);
|
|
300
|
-
} catch {
|
|
301
|
-
return false;
|
|
302
|
-
}
|
|
303
|
-
if (filter.family !== void 0 && decoded.family !== filter.family) return false;
|
|
304
|
-
if (filter.eventName !== void 0 && decoded.event_name !== filter.eventName) return false;
|
|
305
|
-
return true;
|
|
306
|
-
}
|
|
307
|
-
function nativeEventsFromReceipt(receipt, filter = {}) {
|
|
308
|
-
return receipt.events.filter((event) => nativeEventMatches(event, filter)).map((event) => ({
|
|
309
|
-
...event,
|
|
310
|
-
decoded: parseNativeDecodedEvent(event)
|
|
311
|
-
}));
|
|
312
|
-
}
|
|
313
|
-
function nativeMarketEventsFromReceipt(receipt, filter = {}) {
|
|
314
|
-
return nativeEventsFromReceipt(receipt, nativeMarketEventFilter(filter));
|
|
315
|
-
}
|
|
316
|
-
function nativeEventsFromHistory(response) {
|
|
317
|
-
return {
|
|
318
|
-
...response,
|
|
319
|
-
events: response.events.map((event) => ({
|
|
320
|
-
...event,
|
|
321
|
-
decoded: parseNativeDecodedEvent(event)
|
|
322
|
-
}))
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
function nativeMarketEventsFromHistory(response) {
|
|
326
|
-
return {
|
|
327
|
-
...response,
|
|
328
|
-
filters: { ...response.filters, family: NATIVE_MARKET_EVENT_FAMILY },
|
|
329
|
-
events: response.events.filter((event) => nativeEventMatches(event, { family: NATIVE_MARKET_EVENT_FAMILY })).map((event) => ({
|
|
330
|
-
...event,
|
|
331
|
-
decoded: parseNativeDecodedEvent(event)
|
|
332
|
-
}))
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
async function consumeNativeEvents(receipt, consumer, filter = {}) {
|
|
336
|
-
const events = nativeEventsFromReceipt(receipt, filter);
|
|
337
|
-
for (const event of events) {
|
|
338
|
-
await consumer(event);
|
|
339
|
-
}
|
|
340
|
-
return events.length;
|
|
341
|
-
}
|
|
342
|
-
function asRecord(value) {
|
|
343
|
-
if (value === null || typeof value !== "object" || Array.isArray(value)) return null;
|
|
344
|
-
return value;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
269
|
// src/consts.ts
|
|
348
270
|
var BURN_ADDR = "0x0000000000000000000000000000000000000000";
|
|
349
271
|
var PRECOMPILE_ADDRESSES = {
|
|
@@ -528,6 +450,9 @@ var NODE_REGISTRY_ARCHIVE_KIND_EPOCH_SEED = 3;
|
|
|
528
450
|
var NODE_REGISTRY_TAG_ARCHIVE_CHALLENGE = 50;
|
|
529
451
|
var NODE_REGISTRY_TAG_SERVICE_SCORE = 36;
|
|
530
452
|
var NODE_REGISTRY_TAG_TREASURY = 31;
|
|
453
|
+
var NODE_REGISTRY_TAG_CLUSTER_CHARTER = 49;
|
|
454
|
+
var NODE_REGISTRY_SUBKIND_CHARTER_DELEGATOR_BPS = 0;
|
|
455
|
+
var NODE_REGISTRY_SUBKIND_CHARTER_MEMBER_SHARES = 1;
|
|
531
456
|
var PENDING_CHANGE_KIND_CODES = {
|
|
532
457
|
add: 1,
|
|
533
458
|
remove: 2,
|
|
@@ -1321,6 +1246,40 @@ function slotProbeAuthority() {
|
|
|
1321
1246
|
buf[33] = 10;
|
|
1322
1247
|
return bytesToHex(sha3_js.keccak_256(buf));
|
|
1323
1248
|
}
|
|
1249
|
+
function slotClusterCharter(clusterId, subkind) {
|
|
1250
|
+
if (!Number.isInteger(subkind) || subkind < 0 || subkind > 255) {
|
|
1251
|
+
throw new NodeRegistryError("charter subkind must be a u8");
|
|
1252
|
+
}
|
|
1253
|
+
const buf = new Uint8Array(1 + 4 + 1);
|
|
1254
|
+
buf[0] = NODE_REGISTRY_TAG_CLUSTER_CHARTER;
|
|
1255
|
+
buf.set(u32BeBytes(toUint32(clusterId, "clusterId")), 1);
|
|
1256
|
+
buf[5] = subkind;
|
|
1257
|
+
return bytesToHex(sha3_js.keccak_256(buf));
|
|
1258
|
+
}
|
|
1259
|
+
function slotClusterCharterDelegator(clusterId) {
|
|
1260
|
+
return slotClusterCharter(clusterId, NODE_REGISTRY_SUBKIND_CHARTER_DELEGATOR_BPS);
|
|
1261
|
+
}
|
|
1262
|
+
function slotClusterCharterMembers(clusterId) {
|
|
1263
|
+
return slotClusterCharter(clusterId, NODE_REGISTRY_SUBKIND_CHARTER_MEMBER_SHARES);
|
|
1264
|
+
}
|
|
1265
|
+
function decodeActiveCharter(delegatorWord, membersWord) {
|
|
1266
|
+
const presence = leftPadToWord(toBytes(delegatorWord), "charterDelegatorWord");
|
|
1267
|
+
let raw = 0n;
|
|
1268
|
+
for (const b of presence) {
|
|
1269
|
+
raw = raw << 8n | BigInt(b);
|
|
1270
|
+
}
|
|
1271
|
+
if (raw === 0n) {
|
|
1272
|
+
return { present: false, delegatorShareBps: 0, memberShareBps: [] };
|
|
1273
|
+
}
|
|
1274
|
+
const delegatorShareBps = Number(raw - 1n > 0xffffn ? 0xffffn : raw - 1n);
|
|
1275
|
+
const packed = leftPadToWord(toBytes(membersWord), "charterMembersWord");
|
|
1276
|
+
const memberShareBps = [];
|
|
1277
|
+
for (let i = 0; i < NODE_REGISTRY_FORM_CLUSTER_MEMBER_COUNT; i += 1) {
|
|
1278
|
+
const at = 12 + 2 * i;
|
|
1279
|
+
memberShareBps.push(packed[at] << 8 | packed[at + 1]);
|
|
1280
|
+
}
|
|
1281
|
+
return { present: true, delegatorShareBps, memberShareBps };
|
|
1282
|
+
}
|
|
1324
1283
|
function decodeClusterJoinRequest(returnData) {
|
|
1325
1284
|
const bytes = expectLength2(toBytes(returnData), 8 * 32, "clusterJoinRequest");
|
|
1326
1285
|
const word = (i) => bytes.slice(i * 32, (i + 1) * 32);
|
|
@@ -1634,6 +1593,15 @@ function padToWord(bytes) {
|
|
|
1634
1593
|
out.set(bytes);
|
|
1635
1594
|
return out;
|
|
1636
1595
|
}
|
|
1596
|
+
function leftPadToWord(bytes, name) {
|
|
1597
|
+
if (bytes.length === 32) return bytes;
|
|
1598
|
+
if (bytes.length > 32) {
|
|
1599
|
+
throw new NodeRegistryError(`${name} must be <= 32 bytes, got ${bytes.length}`);
|
|
1600
|
+
}
|
|
1601
|
+
const out = new Uint8Array(32);
|
|
1602
|
+
out.set(bytes, 32 - bytes.length);
|
|
1603
|
+
return out;
|
|
1604
|
+
}
|
|
1637
1605
|
function toBytes(value) {
|
|
1638
1606
|
if (typeof value === "string") {
|
|
1639
1607
|
return hexToBytes(value);
|
|
@@ -1654,10 +1622,11 @@ function displayTextBytes(value, maxBytes, name) {
|
|
|
1654
1622
|
return bytes;
|
|
1655
1623
|
}
|
|
1656
1624
|
function hexToBytes(hex) {
|
|
1657
|
-
const
|
|
1658
|
-
if (
|
|
1625
|
+
const raw = hex.startsWith("0x") || hex.startsWith("0X") ? hex.slice(2) : hex;
|
|
1626
|
+
if (!/^[0-9a-fA-F]*$/.test(raw)) {
|
|
1659
1627
|
throw new NodeRegistryError("invalid hex bytes");
|
|
1660
1628
|
}
|
|
1629
|
+
const body = raw.length % 2 !== 0 ? `0${raw}` : raw;
|
|
1661
1630
|
const out = new Uint8Array(body.length / 2);
|
|
1662
1631
|
for (let i = 0; i < out.length; i++) {
|
|
1663
1632
|
out[i] = Number.parseInt(body.slice(i * 2, i * 2 + 2), 16);
|
|
@@ -1707,6 +1676,84 @@ function decodeDynamicBytesResult(bytes, expectedLength, label) {
|
|
|
1707
1676
|
return bytes.slice(64, 64 + expectedLength);
|
|
1708
1677
|
}
|
|
1709
1678
|
|
|
1679
|
+
// src/native-events.ts
|
|
1680
|
+
var NATIVE_MARKET_EVENT_FAMILY = "market";
|
|
1681
|
+
function nativeMarketEventFilter(filter = {}) {
|
|
1682
|
+
return { ...filter, family: NATIVE_MARKET_EVENT_FAMILY };
|
|
1683
|
+
}
|
|
1684
|
+
function isNativeDecodedEvent(value) {
|
|
1685
|
+
const row = asRecord(value);
|
|
1686
|
+
return row !== null && typeof row["block_height"] === "number" && typeof row["tx_index"] === "number" && typeof row["sequence"] === "number" && typeof row["family"] === "string" && typeof row["event_name"] === "string" && typeof row["payload_hash"] === "string";
|
|
1687
|
+
}
|
|
1688
|
+
function parseNativeDecodedEvent(event) {
|
|
1689
|
+
if (isNativeDecodedEvent(event.decoded)) {
|
|
1690
|
+
return event.decoded;
|
|
1691
|
+
}
|
|
1692
|
+
try {
|
|
1693
|
+
const parsed = JSON.parse(event.decodedJson);
|
|
1694
|
+
if (isNativeDecodedEvent(parsed)) {
|
|
1695
|
+
return parsed;
|
|
1696
|
+
}
|
|
1697
|
+
} catch {
|
|
1698
|
+
}
|
|
1699
|
+
throw SdkError.malformed(
|
|
1700
|
+
`native event ${event.eventTopic} at logIndex ${event.logIndex} is missing a typed decoded payload`
|
|
1701
|
+
);
|
|
1702
|
+
}
|
|
1703
|
+
function nativeEventMatches(event, filter = {}) {
|
|
1704
|
+
if (filter.address !== void 0 && event.address !== filter.address) return false;
|
|
1705
|
+
if (filter.eventTopic !== void 0 && event.eventTopic !== filter.eventTopic) return false;
|
|
1706
|
+
if (filter.family === void 0 && filter.eventName === void 0) return true;
|
|
1707
|
+
let decoded;
|
|
1708
|
+
try {
|
|
1709
|
+
decoded = parseNativeDecodedEvent(event);
|
|
1710
|
+
} catch {
|
|
1711
|
+
return false;
|
|
1712
|
+
}
|
|
1713
|
+
if (filter.family !== void 0 && decoded.family !== filter.family) return false;
|
|
1714
|
+
if (filter.eventName !== void 0 && decoded.event_name !== filter.eventName) return false;
|
|
1715
|
+
return true;
|
|
1716
|
+
}
|
|
1717
|
+
function nativeEventsFromReceipt(receipt, filter = {}) {
|
|
1718
|
+
return receipt.events.filter((event) => nativeEventMatches(event, filter)).map((event) => ({
|
|
1719
|
+
...event,
|
|
1720
|
+
decoded: parseNativeDecodedEvent(event)
|
|
1721
|
+
}));
|
|
1722
|
+
}
|
|
1723
|
+
function nativeMarketEventsFromReceipt(receipt, filter = {}) {
|
|
1724
|
+
return nativeEventsFromReceipt(receipt, nativeMarketEventFilter(filter));
|
|
1725
|
+
}
|
|
1726
|
+
function nativeEventsFromHistory(response) {
|
|
1727
|
+
return {
|
|
1728
|
+
...response,
|
|
1729
|
+
events: response.events.map((event) => ({
|
|
1730
|
+
...event,
|
|
1731
|
+
decoded: parseNativeDecodedEvent(event)
|
|
1732
|
+
}))
|
|
1733
|
+
};
|
|
1734
|
+
}
|
|
1735
|
+
function nativeMarketEventsFromHistory(response) {
|
|
1736
|
+
return {
|
|
1737
|
+
...response,
|
|
1738
|
+
filters: { ...response.filters, family: NATIVE_MARKET_EVENT_FAMILY },
|
|
1739
|
+
events: response.events.filter((event) => nativeEventMatches(event, { family: NATIVE_MARKET_EVENT_FAMILY })).map((event) => ({
|
|
1740
|
+
...event,
|
|
1741
|
+
decoded: parseNativeDecodedEvent(event)
|
|
1742
|
+
}))
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1745
|
+
async function consumeNativeEvents(receipt, consumer, filter = {}) {
|
|
1746
|
+
const events = nativeEventsFromReceipt(receipt, filter);
|
|
1747
|
+
for (const event of events) {
|
|
1748
|
+
await consumer(event);
|
|
1749
|
+
}
|
|
1750
|
+
return events.length;
|
|
1751
|
+
}
|
|
1752
|
+
function asRecord(value) {
|
|
1753
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return null;
|
|
1754
|
+
return value;
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1710
1757
|
// src/crypto/bytes.ts
|
|
1711
1758
|
function concatBytes2(...chunks) {
|
|
1712
1759
|
const len = chunks.reduce((n, c) => n + c.length, 0);
|
|
@@ -3361,8 +3408,8 @@ var TESTNET_69420 = {
|
|
|
3361
3408
|
network: "testnet-69420",
|
|
3362
3409
|
display_name: "Monolythium Testnet",
|
|
3363
3410
|
description: "Public Monolythium testnet. Testnet state may reset without notice; do not store value on this network.",
|
|
3364
|
-
genesis_hash: "
|
|
3365
|
-
binary_sha: "
|
|
3411
|
+
genesis_hash: "0x11774775b5c3bfc36ecb9c37e7252b49898caaacdb55668de3913fe60c660258",
|
|
3412
|
+
binary_sha: "b4257f14",
|
|
3366
3413
|
rpc: [
|
|
3367
3414
|
{
|
|
3368
3415
|
url: "http://178.105.12.9:8545",
|
|
@@ -3421,18 +3468,18 @@ var TESTNET_69420 = {
|
|
|
3421
3468
|
notes: "operator-8"
|
|
3422
3469
|
},
|
|
3423
3470
|
{
|
|
3424
|
-
url: "http://
|
|
3471
|
+
url: "http://95.217.156.190:8545",
|
|
3425
3472
|
provider: "monolythium-foundation",
|
|
3426
|
-
region: "
|
|
3473
|
+
region: "hel1",
|
|
3427
3474
|
tier: "official",
|
|
3428
|
-
notes: "operator-
|
|
3475
|
+
notes: "operator-10"
|
|
3429
3476
|
},
|
|
3430
3477
|
{
|
|
3431
|
-
url: "http://
|
|
3478
|
+
url: "http://162.55.54.198:8545",
|
|
3432
3479
|
provider: "monolythium-foundation",
|
|
3433
|
-
region: "
|
|
3480
|
+
region: "fsn1",
|
|
3434
3481
|
tier: "official",
|
|
3435
|
-
notes: "operator-
|
|
3482
|
+
notes: "operator-9"
|
|
3436
3483
|
},
|
|
3437
3484
|
{
|
|
3438
3485
|
url: "http://178.105.45.210:8545",
|
|
@@ -4268,17 +4315,35 @@ var RpcClient = class _RpcClient {
|
|
|
4268
4315
|
async ethBlockNumber() {
|
|
4269
4316
|
return parseQuantityBig(await this.call(ethCompatMethod("blockNumber"), []));
|
|
4270
4317
|
}
|
|
4271
|
-
/**
|
|
4318
|
+
/**
|
|
4319
|
+
* `eth_getBalance` — balance + Merkle proof envelope.
|
|
4320
|
+
*
|
|
4321
|
+
* The node may answer with a bare `0x…` hex word or a proof-wrapped
|
|
4322
|
+
* object; both are normalized to a consistent {@link AccountProofResponse}
|
|
4323
|
+
* via {@link normalizeAccountProof} so `.value` is always the bare word.
|
|
4324
|
+
*/
|
|
4272
4325
|
async ethGetBalance(address, block = "latest") {
|
|
4273
|
-
return
|
|
4326
|
+
return normalizeAccountProof(
|
|
4327
|
+
await this.call("eth_getBalance", [address, encodeBlockSelector(block)])
|
|
4328
|
+
);
|
|
4274
4329
|
}
|
|
4275
|
-
/**
|
|
4330
|
+
/**
|
|
4331
|
+
* `eth_getStorageAt` — storage word + Merkle proof.
|
|
4332
|
+
*
|
|
4333
|
+
* The node returns a proof-wrapped object
|
|
4334
|
+
* `{ value, proof, stateRoot, blockNumber }` (some builds use a bare
|
|
4335
|
+
* `0x…` hex word). Both shapes are normalized to a consistent
|
|
4336
|
+
* {@link AccountProofResponse} via {@link normalizeAccountProof}; `.value`
|
|
4337
|
+
* is always the bare storage word (even-length hex, `0x0` when zero).
|
|
4338
|
+
*/
|
|
4276
4339
|
async ethGetStorageAt(address, slot, block = "latest") {
|
|
4277
|
-
return
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4340
|
+
return normalizeAccountProof(
|
|
4341
|
+
await this.call("eth_getStorageAt", [
|
|
4342
|
+
address,
|
|
4343
|
+
slot,
|
|
4344
|
+
encodeBlockSelector(block)
|
|
4345
|
+
])
|
|
4346
|
+
);
|
|
4282
4347
|
}
|
|
4283
4348
|
/** `eth_getTransactionCount` — sender nonce. */
|
|
4284
4349
|
async ethGetTransactionCount(address, block = "latest") {
|
|
@@ -4387,9 +4452,14 @@ var RpcClient = class _RpcClient {
|
|
|
4387
4452
|
async lythGetRegistration(peerId) {
|
|
4388
4453
|
return this.call("lyth_getRegistration", [peerId]);
|
|
4389
4454
|
}
|
|
4390
|
-
/**
|
|
4455
|
+
/**
|
|
4456
|
+
* `lyth_registryStateProof` — Merkle proof for a registry entry.
|
|
4457
|
+
*
|
|
4458
|
+
* Normalized through {@link normalizeAccountProof} so a bare-hex or
|
|
4459
|
+
* proof-wrapped answer both yield a consistent {@link AccountProofResponse}.
|
|
4460
|
+
*/
|
|
4391
4461
|
async lythRegistryStateProof(peerId) {
|
|
4392
|
-
return this.call("lyth_registryStateProof", [peerId]);
|
|
4462
|
+
return normalizeAccountProof(await this.call("lyth_registryStateProof", [peerId]));
|
|
4393
4463
|
}
|
|
4394
4464
|
/** `lyth_getAccountPolicy` — privacy posture for an account. */
|
|
4395
4465
|
async lythGetAccountPolicy(address) {
|
|
@@ -4765,6 +4835,55 @@ var RpcClient = class _RpcClient {
|
|
|
4765
4835
|
async lythGetClusterDiversity(clusterId) {
|
|
4766
4836
|
return this.call("lyth_getClusterDiversity", [clusterId]);
|
|
4767
4837
|
}
|
|
4838
|
+
/**
|
|
4839
|
+
* Component H — read a cluster's ACTIVE economics charter (Law §6.8).
|
|
4840
|
+
*
|
|
4841
|
+
* There is no `lyth_*` / view-selector for the active charter, so this
|
|
4842
|
+
* SLOADs the two `TAG_CLUSTER_CHARTER` (`0x31`) storage words from the
|
|
4843
|
+
* node-registry account `0x1005` via `eth_getStorageAt` and decodes them
|
|
4844
|
+
* with {@link decodeActiveCharter}. Returns `{ present: false }` (zeroed
|
|
4845
|
+
* shares) for genesis / 3-arg-formCluster clusters that never adopted a
|
|
4846
|
+
* charter. The active record carries no `effectiveEpoch` — that lives on
|
|
4847
|
+
* the pending amendment ({@link lythGetPendingCharter}).
|
|
4848
|
+
*/
|
|
4849
|
+
async lythGetClusterCharter(clusterId, block = "latest") {
|
|
4850
|
+
const registry = nodeRegistryAddressHex();
|
|
4851
|
+
const [delegator, members] = await Promise.all([
|
|
4852
|
+
this.ethGetStorageAt(registry, slotClusterCharterDelegator(clusterId), block),
|
|
4853
|
+
this.ethGetStorageAt(registry, slotClusterCharterMembers(clusterId), block)
|
|
4854
|
+
]);
|
|
4855
|
+
return decodeActiveCharter(delegator.value, members.value);
|
|
4856
|
+
}
|
|
4857
|
+
/**
|
|
4858
|
+
* Component H — read a cluster's PENDING charter amendment (Law §6.8).
|
|
4859
|
+
*
|
|
4860
|
+
* Calls the `getPendingCharter(uint32)` view on the node-registry account
|
|
4861
|
+
* `0x1005` over `eth_call` and decodes the return with
|
|
4862
|
+
* {@link decodePendingCharter}. Returns `{ present: false }` when no
|
|
4863
|
+
* amendment is posted; otherwise carries the proposed shares plus the
|
|
4864
|
+
* `effectiveEpoch` at which the delegator-protective cooldown lands.
|
|
4865
|
+
*/
|
|
4866
|
+
async lythGetPendingCharter(clusterId, block = "latest") {
|
|
4867
|
+
const data = await this.ethCall(
|
|
4868
|
+
{ to: nodeRegistryAddressHex(), data: encodeGetPendingCharterCalldata(clusterId) },
|
|
4869
|
+
block
|
|
4870
|
+
);
|
|
4871
|
+
return decodePendingCharter(data);
|
|
4872
|
+
}
|
|
4873
|
+
/**
|
|
4874
|
+
* Component A — read a cluster's settled per-cluster ServiceScore (the
|
|
4875
|
+
* `u64` the reward path reads each block). SLOADs the `TAG_SERVICE_SCORE`
|
|
4876
|
+
* (`0x24`) score slot from `0x1005` via `eth_getStorageAt`; `0n` means the
|
|
4877
|
+
* cluster has never been scored.
|
|
4878
|
+
*/
|
|
4879
|
+
async lythGetClusterServiceScore(clusterId, block = "latest") {
|
|
4880
|
+
const word = await this.ethGetStorageAt(
|
|
4881
|
+
nodeRegistryAddressHex(),
|
|
4882
|
+
slotClusterServiceScore(clusterId),
|
|
4883
|
+
block
|
|
4884
|
+
);
|
|
4885
|
+
return parseQuantityBig(word.value);
|
|
4886
|
+
}
|
|
4768
4887
|
/**
|
|
4769
4888
|
* PF-6 — `lyth_getOperatorNetworkMetadata`: ASN/geo/hosting-class/IP/PCR
|
|
4770
4889
|
* for a peer. `operatorId` is the 32-byte operator/peer id as `0x…` hex
|
|
@@ -5262,6 +5381,38 @@ function parseQuantity(hex) {
|
|
|
5262
5381
|
}
|
|
5263
5382
|
return Number(big);
|
|
5264
5383
|
}
|
|
5384
|
+
function normalizeStorageWord(value) {
|
|
5385
|
+
if (value === null || value === void 0 || value === "") return "0x0";
|
|
5386
|
+
if (typeof value !== "string") {
|
|
5387
|
+
throw SdkError.malformed(`storage word is not a string: ${typeof value}`);
|
|
5388
|
+
}
|
|
5389
|
+
const body = value.startsWith("0x") || value.startsWith("0X") ? value.slice(2) : value;
|
|
5390
|
+
if (body.length === 0) return "0x0";
|
|
5391
|
+
if (!/^[0-9a-fA-F]+$/.test(body)) {
|
|
5392
|
+
throw SdkError.malformed(`invalid hex storage word: ${value}`);
|
|
5393
|
+
}
|
|
5394
|
+
return body.length % 2 === 0 ? `0x${body}` : `0x0${body}`;
|
|
5395
|
+
}
|
|
5396
|
+
function normalizeAccountProof(result) {
|
|
5397
|
+
if (typeof result === "string" || result === null || result === void 0) {
|
|
5398
|
+
return { value: normalizeStorageWord(result), state_root: "0x", block_number: 0n };
|
|
5399
|
+
}
|
|
5400
|
+
const obj = result;
|
|
5401
|
+
const stateRoot = obj.state_root ?? obj.stateRoot ?? "0x";
|
|
5402
|
+
const rawBlock = obj.block_number ?? obj.blockNumber ?? 0;
|
|
5403
|
+
let blockNumber;
|
|
5404
|
+
try {
|
|
5405
|
+
blockNumber = typeof rawBlock === "bigint" ? rawBlock : BigInt(rawBlock);
|
|
5406
|
+
} catch {
|
|
5407
|
+
blockNumber = 0n;
|
|
5408
|
+
}
|
|
5409
|
+
return {
|
|
5410
|
+
value: normalizeStorageWord(obj.value),
|
|
5411
|
+
state_root: stateRoot,
|
|
5412
|
+
block_number: blockNumber,
|
|
5413
|
+
proof: obj.proof ?? null
|
|
5414
|
+
};
|
|
5415
|
+
}
|
|
5265
5416
|
function encodeRpcInteger(v) {
|
|
5266
5417
|
if (typeof v === "bigint") return `0x${v.toString(16)}`;
|
|
5267
5418
|
return v;
|
|
@@ -12144,7 +12295,7 @@ var MONOLYTHIUM_NETWORKS = {
|
|
|
12144
12295
|
};
|
|
12145
12296
|
|
|
12146
12297
|
// src/index.ts
|
|
12147
|
-
var version = "0.4.
|
|
12298
|
+
var version = "0.4.18";
|
|
12148
12299
|
|
|
12149
12300
|
exports.ADDRESS_HRP = ADDRESS_HRP;
|
|
12150
12301
|
exports.ADDRESS_KIND_HRPS = ADDRESS_KIND_HRPS;
|
|
@@ -12258,7 +12409,10 @@ exports.NODE_REGISTRY_OPERATOR_SEAL_EK_BYTES = NODE_REGISTRY_OPERATOR_SEAL_EK_BY
|
|
|
12258
12409
|
exports.NODE_REGISTRY_PENDING_CHANGE_MAX_INTENT_ID = NODE_REGISTRY_PENDING_CHANGE_MAX_INTENT_ID;
|
|
12259
12410
|
exports.NODE_REGISTRY_PUBLIC_SERVICE_MASK = NODE_REGISTRY_PUBLIC_SERVICE_MASK;
|
|
12260
12411
|
exports.NODE_REGISTRY_SELECTORS = NODE_REGISTRY_SELECTORS;
|
|
12412
|
+
exports.NODE_REGISTRY_SUBKIND_CHARTER_DELEGATOR_BPS = NODE_REGISTRY_SUBKIND_CHARTER_DELEGATOR_BPS;
|
|
12413
|
+
exports.NODE_REGISTRY_SUBKIND_CHARTER_MEMBER_SHARES = NODE_REGISTRY_SUBKIND_CHARTER_MEMBER_SHARES;
|
|
12261
12414
|
exports.NODE_REGISTRY_TAG_ARCHIVE_CHALLENGE = NODE_REGISTRY_TAG_ARCHIVE_CHALLENGE;
|
|
12415
|
+
exports.NODE_REGISTRY_TAG_CLUSTER_CHARTER = NODE_REGISTRY_TAG_CLUSTER_CHARTER;
|
|
12262
12416
|
exports.NODE_REGISTRY_TAG_SERVICE_SCORE = NODE_REGISTRY_TAG_SERVICE_SCORE;
|
|
12263
12417
|
exports.NODE_REGISTRY_TAG_TREASURY = NODE_REGISTRY_TAG_TREASURY;
|
|
12264
12418
|
exports.NODE_REGISTRY_UPDATE_CHARTER_MESSAGE_DOMAIN = NODE_REGISTRY_UPDATE_CHARTER_MESSAGE_DOMAIN;
|
|
@@ -12418,6 +12572,7 @@ exports.computeNoEvmRoundFinalityMessage = computeNoEvmRoundFinalityMessage;
|
|
|
12418
12572
|
exports.computeNoEvmTargetReceiptHash = computeNoEvmTargetReceiptHash;
|
|
12419
12573
|
exports.computeQuoteLiquidity = computeQuoteLiquidity;
|
|
12420
12574
|
exports.consumeNativeEvents = consumeNativeEvents;
|
|
12575
|
+
exports.decodeActiveCharter = decodeActiveCharter;
|
|
12421
12576
|
exports.decodeClusterCharter = decodeClusterCharter;
|
|
12422
12577
|
exports.decodeClusterDiversity = decodeClusterDiversity;
|
|
12423
12578
|
exports.decodeClusterFormedEvent = decodeClusterFormedEvent;
|
|
@@ -12661,6 +12816,9 @@ exports.serviceMaskToBitIndex = serviceMaskToBitIndex;
|
|
|
12661
12816
|
exports.serviceProbeStatusLabel = serviceProbeStatusLabel;
|
|
12662
12817
|
exports.setDestinationRoot = setDestinationRoot;
|
|
12663
12818
|
exports.slotArchiveChallengePass = slotArchiveChallengePass;
|
|
12819
|
+
exports.slotClusterCharter = slotClusterCharter;
|
|
12820
|
+
exports.slotClusterCharterDelegator = slotClusterCharterDelegator;
|
|
12821
|
+
exports.slotClusterCharterMembers = slotClusterCharterMembers;
|
|
12664
12822
|
exports.slotClusterServiceScore = slotClusterServiceScore;
|
|
12665
12823
|
exports.slotEpochChallengeSeed = slotEpochChallengeSeed;
|
|
12666
12824
|
exports.slotProbeAuthority = slotProbeAuthority;
|