@monolythium/core-sdk 0.4.18 → 0.4.20
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 +94 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +80 -23
- package/dist/index.d.ts +80 -23
- package/dist/index.js +89 -3
- package/dist/index.js.map +1 -1
- package/dist/{submission-Cr6u_2he.d.cts → submission-B4FmDnm_.d.cts} +1 -1
- package/dist/{submission-Cr6u_2he.d.ts → submission-B4FmDnm_.d.ts} +1 -1
- package/package.json +1 -1
package/dist/crypto/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { kb as ADDRESS_DERIVATION_DOMAIN, kc as CLUSTER_MLKEM_SHAMIR, kd as CLUSTER_MLKEM_SHAMIR_ALGO, ke as ClusterSealKeyEntryInput,
|
|
1
|
+
import { L as MlDsa65Backend } from '../submission-B4FmDnm_.cjs';
|
|
2
|
+
export { kb as ADDRESS_DERIVATION_DOMAIN, kc as CLUSTER_MLKEM_SHAMIR, kd as CLUSTER_MLKEM_SHAMIR_ALGO, ke as ClusterSealKeyEntryInput, U as ClusterSealKeys, V 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, I 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, J as MempoolClass, H 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-B4FmDnm_.cjs';
|
|
3
3
|
|
|
4
4
|
declare class BincodeWriter {
|
|
5
5
|
#private;
|
package/dist/crypto/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { kb as ADDRESS_DERIVATION_DOMAIN, kc as CLUSTER_MLKEM_SHAMIR, kd as CLUSTER_MLKEM_SHAMIR_ALGO, ke as ClusterSealKeyEntryInput,
|
|
1
|
+
import { L as MlDsa65Backend } from '../submission-B4FmDnm_.js';
|
|
2
|
+
export { kb as ADDRESS_DERIVATION_DOMAIN, kc as CLUSTER_MLKEM_SHAMIR, kd as CLUSTER_MLKEM_SHAMIR_ALGO, ke as ClusterSealKeyEntryInput, U as ClusterSealKeys, V 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, I 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, J as MempoolClass, H 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-B4FmDnm_.js';
|
|
3
3
|
|
|
4
4
|
declare class BincodeWriter {
|
|
5
5
|
#private;
|
package/dist/index.cjs
CHANGED
|
@@ -3408,8 +3408,8 @@ var TESTNET_69420 = {
|
|
|
3408
3408
|
network: "testnet-69420",
|
|
3409
3409
|
display_name: "Monolythium Testnet",
|
|
3410
3410
|
description: "Public Monolythium testnet. Testnet state may reset without notice; do not store value on this network.",
|
|
3411
|
-
genesis_hash: "
|
|
3412
|
-
binary_sha: "
|
|
3411
|
+
genesis_hash: "0x6c76fe490fab7195fc5821b052ca7a90b8fe96e0b18204d28430e97f57751943",
|
|
3412
|
+
binary_sha: "f2964a9c",
|
|
3413
3413
|
rpc: [
|
|
3414
3414
|
{
|
|
3415
3415
|
url: "http://178.105.12.9:8545",
|
|
@@ -7510,6 +7510,92 @@ function concatBytes5(...parts) {
|
|
|
7510
7510
|
}
|
|
7511
7511
|
return out;
|
|
7512
7512
|
}
|
|
7513
|
+
|
|
7514
|
+
// src/operator-trust.ts
|
|
7515
|
+
var GENESIS_HASH_RE = /^0x[0-9a-fA-F]{64}$/;
|
|
7516
|
+
var QUARANTINED_RPC_CODE = -32047;
|
|
7517
|
+
function normaliseHash(input) {
|
|
7518
|
+
return typeof input === "string" && GENESIS_HASH_RE.test(input) ? input.toLowerCase() : null;
|
|
7519
|
+
}
|
|
7520
|
+
function isQuarantineError(err) {
|
|
7521
|
+
if (err instanceof SdkError && err.code === QUARANTINED_RPC_CODE) return true;
|
|
7522
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
7523
|
+
return /quarantin/i.test(message);
|
|
7524
|
+
}
|
|
7525
|
+
async function verifyOperatorGenesis(client, expectedGenesisHash) {
|
|
7526
|
+
const pinned = normaliseHash(expectedGenesisHash);
|
|
7527
|
+
try {
|
|
7528
|
+
const stats = await client.lythChainStats();
|
|
7529
|
+
const observed = normaliseHash(stats.genesisHash);
|
|
7530
|
+
if (observed === null) {
|
|
7531
|
+
return { ok: false, observed: null, quarantined: false };
|
|
7532
|
+
}
|
|
7533
|
+
return { ok: pinned !== null && observed === pinned, observed, quarantined: false };
|
|
7534
|
+
} catch (err) {
|
|
7535
|
+
if (isQuarantineError(err)) {
|
|
7536
|
+
return { ok: false, observed: null, quarantined: true };
|
|
7537
|
+
}
|
|
7538
|
+
return { ok: false, observed: null, quarantined: false };
|
|
7539
|
+
}
|
|
7540
|
+
}
|
|
7541
|
+
var OperatorTrustError = class extends SdkError {
|
|
7542
|
+
reason;
|
|
7543
|
+
constructor(reason, message) {
|
|
7544
|
+
super("endpoint", message);
|
|
7545
|
+
this.name = "OperatorTrustError";
|
|
7546
|
+
this.reason = reason;
|
|
7547
|
+
}
|
|
7548
|
+
};
|
|
7549
|
+
async function selectTrustedOperator(chain, options = {}) {
|
|
7550
|
+
if (chain.rpc.length === 0) {
|
|
7551
|
+
throw new OperatorTrustError(
|
|
7552
|
+
"unreachable",
|
|
7553
|
+
`network ${chain.network} has no RPC endpoints`
|
|
7554
|
+
);
|
|
7555
|
+
}
|
|
7556
|
+
const expectedChainId = BigInt(chain.chain_id);
|
|
7557
|
+
let sawRegenesis = false;
|
|
7558
|
+
let sawWrongChain = false;
|
|
7559
|
+
let sawUntrusted = false;
|
|
7560
|
+
let sawQuarantined = false;
|
|
7561
|
+
const probes = chain.rpc.map(async (ep) => {
|
|
7562
|
+
const client = new RpcClient(ep.url, options);
|
|
7563
|
+
let chainId;
|
|
7564
|
+
try {
|
|
7565
|
+
chainId = await client.ethChainId();
|
|
7566
|
+
} catch (err) {
|
|
7567
|
+
if (isQuarantineError(err)) sawQuarantined = true;
|
|
7568
|
+
throw err;
|
|
7569
|
+
}
|
|
7570
|
+
if (chainId !== expectedChainId) {
|
|
7571
|
+
sawWrongChain = true;
|
|
7572
|
+
throw new SdkError("endpoint", `${ep.url}: chain id ${chainId} != ${chain.chain_id}`);
|
|
7573
|
+
}
|
|
7574
|
+
const verdict = await verifyOperatorGenesis(client, chain.genesis_hash);
|
|
7575
|
+
if (verdict.quarantined) {
|
|
7576
|
+
sawQuarantined = true;
|
|
7577
|
+
throw new SdkError("endpoint", `${ep.url}: quarantined`);
|
|
7578
|
+
}
|
|
7579
|
+
if (!verdict.ok) {
|
|
7580
|
+
if (verdict.observed !== null) sawRegenesis = true;
|
|
7581
|
+
else sawUntrusted = true;
|
|
7582
|
+
throw new SdkError("endpoint", `${ep.url}: genesis not trusted`);
|
|
7583
|
+
}
|
|
7584
|
+
return client;
|
|
7585
|
+
});
|
|
7586
|
+
try {
|
|
7587
|
+
return await Promise.any(probes);
|
|
7588
|
+
} catch {
|
|
7589
|
+
const reason = sawRegenesis ? "regenesis" : sawWrongChain ? "wrong-chain" : sawUntrusted ? "untrusted" : sawQuarantined ? "quarantined" : "unreachable";
|
|
7590
|
+
throw new OperatorTrustError(
|
|
7591
|
+
reason,
|
|
7592
|
+
`no trusted operator for ${chain.network} (${reason})`
|
|
7593
|
+
);
|
|
7594
|
+
}
|
|
7595
|
+
}
|
|
7596
|
+
async function selectTrustedOperatorForNetwork(network = "testnet-69420", options = {}) {
|
|
7597
|
+
return selectTrustedOperator(getChainInfo(network), options);
|
|
7598
|
+
}
|
|
7513
7599
|
var NO_EVM_RECEIPT_PROOF_SCHEMA = "mono.no_evm_receipt_proof.v1";
|
|
7514
7600
|
var NO_EVM_RECEIPT_PROOF_TYPE = "canonicalReceiptsTranscript";
|
|
7515
7601
|
var NO_EVM_RECEIPT_INCLUSION_PROOF_TYPE = "canonicalReceiptInclusion";
|
|
@@ -12434,6 +12520,7 @@ exports.OPERATOR_ROUTER_EVENT_SIGS = OPERATOR_ROUTER_EVENT_SIGS;
|
|
|
12434
12520
|
exports.OPERATOR_ROUTER_SELECTORS = OPERATOR_ROUTER_SELECTORS;
|
|
12435
12521
|
exports.OPERATOR_ROUTER_SIGS = OPERATOR_ROUTER_SIGS;
|
|
12436
12522
|
exports.ORACLE_EVENT_SIGS = ORACLE_EVENT_SIGS;
|
|
12523
|
+
exports.OperatorTrustError = OperatorTrustError;
|
|
12437
12524
|
exports.OracleEventError = OracleEventError;
|
|
12438
12525
|
exports.PENDING_CHANGE_KIND_CODES = PENDING_CHANGE_KIND_CODES;
|
|
12439
12526
|
exports.PRECOMPILE_ADDRESSES = PRECOMPILE_ADDRESSES;
|
|
@@ -12450,6 +12537,7 @@ exports.PUBKEY_REGISTRY_ML_DSA_65_PUBLIC_KEY_LEN = PUBKEY_REGISTRY_ML_DSA_65_PUB
|
|
|
12450
12537
|
exports.PUBKEY_REGISTRY_SELECTORS = PUBKEY_REGISTRY_SELECTORS;
|
|
12451
12538
|
exports.ProverMarketError = ProverMarketError;
|
|
12452
12539
|
exports.PubkeyRegistryError = PubkeyRegistryError;
|
|
12540
|
+
exports.QUARANTINED_RPC_CODE = QUARANTINED_RPC_CODE;
|
|
12453
12541
|
exports.REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT = REGISTRY_DEFAULT_EXECUTION_UNIT_LIMIT;
|
|
12454
12542
|
exports.RESERVED_ADDRESS_HRPS = RESERVED_ADDRESS_HRPS;
|
|
12455
12543
|
exports.RpcClient = RpcClient;
|
|
@@ -12751,6 +12839,7 @@ exports.isBridgeResumeCooldownActiveRevert = isBridgeResumeCooldownActiveRevert;
|
|
|
12751
12839
|
exports.isConcreteServiceProbeStatus = isConcreteServiceProbeStatus;
|
|
12752
12840
|
exports.isNativeDecodedEvent = isNativeDecodedEvent;
|
|
12753
12841
|
exports.isNativeMarketOrderBookStreamPayload = isNativeMarketOrderBookStreamPayload;
|
|
12842
|
+
exports.isQuarantineError = isQuarantineError;
|
|
12754
12843
|
exports.isSinglePublicServiceProbeMask = isSinglePublicServiceProbeMask;
|
|
12755
12844
|
exports.isUnexpectedValueRevert = isUnexpectedValueRevert;
|
|
12756
12845
|
exports.isValidNodeRegistryCapabilities = isValidNodeRegistryCapabilities;
|
|
@@ -12812,6 +12901,8 @@ exports.resolveMaxExecutionUnitPrice = resolveMaxExecutionUnitPrice;
|
|
|
12812
12901
|
exports.resolveRegistryExecutionFee = resolveRegistryExecutionFee;
|
|
12813
12902
|
exports.resolveStudioHostStatus = resolveStudioHostStatus;
|
|
12814
12903
|
exports.selectBridgeTransferRoute = selectBridgeTransferRoute;
|
|
12904
|
+
exports.selectTrustedOperator = selectTrustedOperator;
|
|
12905
|
+
exports.selectTrustedOperatorForNetwork = selectTrustedOperatorForNetwork;
|
|
12815
12906
|
exports.serviceMaskToBitIndex = serviceMaskToBitIndex;
|
|
12816
12907
|
exports.serviceProbeStatusLabel = serviceProbeStatusLabel;
|
|
12817
12908
|
exports.setDestinationRoot = setDestinationRoot;
|
|
@@ -12851,6 +12942,7 @@ exports.verifyNoEvmFinalityEvidenceMultisig = verifyNoEvmFinalityEvidenceMultisi
|
|
|
12851
12942
|
exports.verifyNoEvmFinalityEvidenceThreshold = verifyNoEvmFinalityEvidenceThreshold;
|
|
12852
12943
|
exports.verifyNoEvmReceiptProof = verifyNoEvmReceiptProof;
|
|
12853
12944
|
exports.verifyNoEvmReceiptProofTrust = verifyNoEvmReceiptProofTrust;
|
|
12945
|
+
exports.verifyOperatorGenesis = verifyOperatorGenesis;
|
|
12854
12946
|
exports.version = version;
|
|
12855
12947
|
exports.vrfAddressHex = vrfAddressHex;
|
|
12856
12948
|
//# sourceMappingURL=index.cjs.map
|