@monolythium/core-sdk 0.3.14 → 0.3.15
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.cjs +5 -73
- package/dist/crypto/index.cjs.map +1 -1
- package/dist/crypto/index.d.cts +2 -2
- package/dist/crypto/index.d.ts +2 -2
- package/dist/crypto/index.js +5 -74
- package/dist/crypto/index.js.map +1 -1
- package/dist/index.cjs +75 -201
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +75 -201
- package/dist/index.js.map +1 -1
- package/dist/{submission-vhPqAwkD.d.cts → submission-BeEYbbGi.d.cts} +66 -17
- package/dist/{submission-vhPqAwkD.d.ts → submission-BeEYbbGi.d.ts} +66 -17
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var blake3_js = require('@noble/hashes/blake3.js');
|
|
4
4
|
var sha3_js = require('@noble/hashes/sha3.js');
|
|
5
|
-
var mlKem_js = require('@noble/post-quantum/ml-kem.js');
|
|
6
|
-
var chacha_js = require('@noble/ciphers/chacha.js');
|
|
7
|
-
var utils_js = require('@noble/hashes/utils.js');
|
|
8
5
|
var mlDsa_js = require('@noble/post-quantum/ml-dsa.js');
|
|
9
6
|
var bls12381_js = require('@noble/curves/bls12-381.js');
|
|
7
|
+
require('@noble/post-quantum/ml-kem.js');
|
|
8
|
+
require('@noble/ciphers/chacha.js');
|
|
9
|
+
require('@noble/hashes/utils.js');
|
|
10
10
|
|
|
11
11
|
// src/error.ts
|
|
12
12
|
var SdkError = class _SdkError extends Error {
|
|
@@ -897,15 +897,26 @@ function bigintToBeBytes(value, bytes, label) {
|
|
|
897
897
|
}
|
|
898
898
|
return out;
|
|
899
899
|
}
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
900
|
+
|
|
901
|
+
// src/crypto/submission.ts
|
|
902
|
+
async function fetchEncryptionKey(client) {
|
|
903
|
+
const result = await client.call(
|
|
904
|
+
"lyth_getEncryptionKey",
|
|
905
|
+
[]
|
|
906
|
+
);
|
|
907
|
+
return {
|
|
908
|
+
algo: result.algo ?? "ml-kem-768",
|
|
909
|
+
epoch: typeof result.epoch === "string" ? BigInt(result.epoch) : BigInt(result.epoch),
|
|
910
|
+
encapsulationKey: hexToBytes2(result.encapsulationKey, "encapsulationKey")
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
var ENCRYPTED_SUBMISSION_UNAVAILABLE_MESSAGE = "encrypted mempool submission unavailable until MB-3 threshold decryption is active";
|
|
914
|
+
async function buildEncryptedSubmission(_args) {
|
|
915
|
+
await Promise.resolve();
|
|
916
|
+
throw new Error(ENCRYPTED_SUBMISSION_UNAVAILABLE_MESSAGE);
|
|
917
|
+
}
|
|
918
|
+
async function submitEncryptedEnvelope(client, envelopeWireHex) {
|
|
919
|
+
return client.call("lyth_submitEncrypted", [envelopeWireHex]);
|
|
909
920
|
}
|
|
910
921
|
|
|
911
922
|
// src/crypto/bincode.ts
|
|
@@ -966,164 +977,6 @@ var BincodeWriter = class {
|
|
|
966
977
|
}
|
|
967
978
|
}
|
|
968
979
|
};
|
|
969
|
-
var ML_DSA_65_PUBLIC_KEY_LEN = 1952;
|
|
970
|
-
var ML_DSA_65_SIGNATURE_LEN = 3309;
|
|
971
|
-
var STANDARD_ALGO_NUMBER_ML_DSA_65 = 1001;
|
|
972
|
-
var ENUM_VARIANT_INDEX_ML_DSA_65 = 5;
|
|
973
|
-
var ADDRESS_DERIVATION_DOMAIN = "MONO_ADDRESS_BLAKE3_20_V1";
|
|
974
|
-
var ADDRESS_DERIVATION_DOMAIN_BYTES = new TextEncoder().encode(ADDRESS_DERIVATION_DOMAIN);
|
|
975
|
-
function mlDsa65AddressFromPublicKey(publicKey) {
|
|
976
|
-
return bytesToHex2(mlDsa65AddressBytes(publicKey));
|
|
977
|
-
}
|
|
978
|
-
function mlDsa65AddressBytes(publicKey) {
|
|
979
|
-
const bytes = expectBytes(publicKey, ML_DSA_65_PUBLIC_KEY_LEN, "ML-DSA-65 public key");
|
|
980
|
-
return blake3_js.blake3(concatBytes2(
|
|
981
|
-
ADDRESS_DERIVATION_DOMAIN_BYTES,
|
|
982
|
-
bigintToBeBytes(BigInt(STANDARD_ALGO_NUMBER_ML_DSA_65), 2, "ML-DSA-65 algo id"),
|
|
983
|
-
bytes
|
|
984
|
-
)).slice(0, 20);
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
// src/crypto/envelope.ts
|
|
988
|
-
var DKG_AEAD_DOMAIN_TAG = new TextEncoder().encode("protocore/v2/mempool/dkg-mlkem768/1");
|
|
989
|
-
var ML_KEM_768_ENCAPSULATION_KEY_LEN = 1184;
|
|
990
|
-
var DKG_NONCE_LEN = 12;
|
|
991
|
-
var MempoolClass = {
|
|
992
|
-
Transfer: 0,
|
|
993
|
-
ContractCall: 1,
|
|
994
|
-
CLOBOp: 3};
|
|
995
|
-
function bincodeNonceAad(aad) {
|
|
996
|
-
const w = new BincodeWriter();
|
|
997
|
-
w.bytes(expectBytes(aad.sender, 20, "NonceAad.sender"));
|
|
998
|
-
w.u64(aad.nonce);
|
|
999
|
-
w.u64(aad.chainId);
|
|
1000
|
-
w.enumVariant(aad.class);
|
|
1001
|
-
w.u128(aad.maxFeePerGas);
|
|
1002
|
-
w.u128(aad.maxPriorityFeePerGas);
|
|
1003
|
-
w.u64(aad.gasLimit);
|
|
1004
|
-
return w.toBytes();
|
|
1005
|
-
}
|
|
1006
|
-
function bincodeDecryptHint(hint) {
|
|
1007
|
-
const w = new BincodeWriter();
|
|
1008
|
-
w.u64(hint.epoch);
|
|
1009
|
-
w.u16(hint.scheme);
|
|
1010
|
-
return w.toBytes();
|
|
1011
|
-
}
|
|
1012
|
-
function bincodeEncryptedEnvelope(env) {
|
|
1013
|
-
const w = new BincodeWriter();
|
|
1014
|
-
w.rawBytes(bincodeNonceAad(env.nonceAad));
|
|
1015
|
-
w.bytes(env.ciphertext);
|
|
1016
|
-
w.rawBytes(bincodeDecryptHint(env.decryptionHint));
|
|
1017
|
-
bincodeMlDsa65OpaqueInto(w, expectBytes(env.senderPubkey, ML_DSA_65_PUBLIC_KEY_LEN, "senderPubkey"));
|
|
1018
|
-
bincodeMlDsa65OpaqueInto(w, expectBytes(env.outerSignature, ML_DSA_65_SIGNATURE_LEN, "outerSignature"));
|
|
1019
|
-
w.bytes(expectBytes(env.sender, 20, "sender"));
|
|
1020
|
-
return w.toBytes();
|
|
1021
|
-
}
|
|
1022
|
-
function encryptInnerTx(signedInnerTxBincode, nonceAad, kemEncapsulationKey) {
|
|
1023
|
-
expectBytes(kemEncapsulationKey, ML_KEM_768_ENCAPSULATION_KEY_LEN, "kemEncapsulationKey");
|
|
1024
|
-
const { cipherText: kemCt, sharedSecret } = mlKem_js.ml_kem768.encapsulate(kemEncapsulationKey);
|
|
1025
|
-
const nonce = utils_js.randomBytes(DKG_NONCE_LEN);
|
|
1026
|
-
const cipher = chacha_js.chacha20poly1305(sharedSecret, nonce, aadFor(nonceAad));
|
|
1027
|
-
const aeadCt = cipher.encrypt(signedInnerTxBincode);
|
|
1028
|
-
sharedSecret.fill(0);
|
|
1029
|
-
return concatBytes2(kemCt, nonce, aeadCt);
|
|
1030
|
-
}
|
|
1031
|
-
function outerSigDigest(nonceAad, ciphertext, decryptionHint, senderPubkey) {
|
|
1032
|
-
const aad = bincodeNonceAad(nonceAad);
|
|
1033
|
-
const hint = bincodeDecryptHint(decryptionHint);
|
|
1034
|
-
return sha3_js.keccak_256(concatBytes2(aad, ciphertext, hint, expectBytes(senderPubkey, ML_DSA_65_PUBLIC_KEY_LEN, "senderPubkey")));
|
|
1035
|
-
}
|
|
1036
|
-
async function buildEncryptedEnvelope(args) {
|
|
1037
|
-
const ciphertext = encryptInnerTx(args.signedInnerTxBincode, args.nonceAad, args.kemEncapsulationKey);
|
|
1038
|
-
const digest = outerSigDigest(args.nonceAad, ciphertext, args.decryptionHint, args.senderPubkey);
|
|
1039
|
-
const outerSignature = await args.signOuterDigest(digest);
|
|
1040
|
-
const envelope = {
|
|
1041
|
-
nonceAad: args.nonceAad,
|
|
1042
|
-
ciphertext,
|
|
1043
|
-
decryptionHint: args.decryptionHint,
|
|
1044
|
-
senderPubkey: expectBytes(args.senderPubkey, ML_DSA_65_PUBLIC_KEY_LEN, "senderPubkey"),
|
|
1045
|
-
outerSignature: expectBytes(outerSignature, ML_DSA_65_SIGNATURE_LEN, "outerSignature"),
|
|
1046
|
-
sender: expectBytes(args.senderAddress, 20, "senderAddress")
|
|
1047
|
-
};
|
|
1048
|
-
const wireBytes = bincodeEncryptedEnvelope(envelope);
|
|
1049
|
-
return { envelope, wireBytes, wireHex: bytesToHex2(wireBytes) };
|
|
1050
|
-
}
|
|
1051
|
-
function aadFor(aad) {
|
|
1052
|
-
return concatBytes2(DKG_AEAD_DOMAIN_TAG, bincodeNonceAad(aad));
|
|
1053
|
-
}
|
|
1054
|
-
function bincodeMlDsa65OpaqueInto(w, raw) {
|
|
1055
|
-
w.enumVariant(ENUM_VARIANT_INDEX_ML_DSA_65);
|
|
1056
|
-
w.u16(STANDARD_ALGO_NUMBER_ML_DSA_65);
|
|
1057
|
-
w.bytes(raw);
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
// src/crypto/submission.ts
|
|
1061
|
-
async function fetchEncryptionKey(client) {
|
|
1062
|
-
const result = await client.call(
|
|
1063
|
-
"lyth_getEncryptionKey",
|
|
1064
|
-
[]
|
|
1065
|
-
);
|
|
1066
|
-
return {
|
|
1067
|
-
algo: result.algo ?? "ml-kem-768",
|
|
1068
|
-
epoch: typeof result.epoch === "string" ? BigInt(result.epoch) : BigInt(result.epoch),
|
|
1069
|
-
encapsulationKey: hexToBytes2(result.encapsulationKey, "encapsulationKey")
|
|
1070
|
-
};
|
|
1071
|
-
}
|
|
1072
|
-
async function buildEncryptedSubmission(args) {
|
|
1073
|
-
const input = normalizeInput(args.tx.input);
|
|
1074
|
-
const to = normalizeTo(args.tx.to);
|
|
1075
|
-
const nonceAad = {
|
|
1076
|
-
sender: args.backend.addressBytes(),
|
|
1077
|
-
nonce: parseBigint(args.tx.nonce, "nonce"),
|
|
1078
|
-
chainId: parseBigint(args.tx.chainId, "chainId"),
|
|
1079
|
-
class: args.class ?? (to !== null && input.length === 0 ? MempoolClass.Transfer : MempoolClass.ContractCall),
|
|
1080
|
-
maxFeePerGas: u128Checked(parseBigint(args.tx.maxFeePerGas, "maxFeePerGas"), "maxFeePerGas"),
|
|
1081
|
-
maxPriorityFeePerGas: u128Checked(
|
|
1082
|
-
parseBigint(args.tx.maxPriorityFeePerGas, "maxPriorityFeePerGas"),
|
|
1083
|
-
"maxPriorityFeePerGas"
|
|
1084
|
-
),
|
|
1085
|
-
gasLimit: parseBigint(args.tx.gasLimit, "gasLimit")
|
|
1086
|
-
};
|
|
1087
|
-
const signed = args.backend.signEvmTx(args.tx);
|
|
1088
|
-
const decryptionHint = { epoch: args.encryptionKey.epoch, scheme: 0 };
|
|
1089
|
-
const built = await buildEncryptedEnvelope({
|
|
1090
|
-
signedInnerTxBincode: signed.wireBytes,
|
|
1091
|
-
nonceAad,
|
|
1092
|
-
decryptionHint,
|
|
1093
|
-
kemEncapsulationKey: args.encryptionKey.encapsulationKey,
|
|
1094
|
-
senderAddress: args.backend.addressBytes(),
|
|
1095
|
-
senderPubkey: args.backend.publicKey(),
|
|
1096
|
-
signOuterDigest: (digest) => args.backend.signPrehash(digest)
|
|
1097
|
-
});
|
|
1098
|
-
return {
|
|
1099
|
-
envelopeWireHex: built.wireHex,
|
|
1100
|
-
innerSighashHex: `0x${[...signed.sighash].map((b) => b.toString(16).padStart(2, "0")).join("")}`,
|
|
1101
|
-
innerTxHashHex: bytesToHex2(signed.txHash),
|
|
1102
|
-
innerWireBytes: signed.wireBytes.length
|
|
1103
|
-
};
|
|
1104
|
-
}
|
|
1105
|
-
async function submitEncryptedEnvelope(client, envelopeWireHex) {
|
|
1106
|
-
return client.call("lyth_submitEncrypted", [envelopeWireHex]);
|
|
1107
|
-
}
|
|
1108
|
-
function u128Checked(value, field2) {
|
|
1109
|
-
const cap = (1n << 128n) - 1n;
|
|
1110
|
-
if (value < 0n || value > cap) {
|
|
1111
|
-
throw new Error(`${field2} must fit in u128 for encrypted nonce AAD`);
|
|
1112
|
-
}
|
|
1113
|
-
return value;
|
|
1114
|
-
}
|
|
1115
|
-
function normalizeTo(value) {
|
|
1116
|
-
if (value === null) return null;
|
|
1117
|
-
if (typeof value === "string") return hexToAddressBytes(value);
|
|
1118
|
-
const bytes = value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
1119
|
-
if (bytes.length !== 20) throw new Error("to must be 20 bytes");
|
|
1120
|
-
return bytes;
|
|
1121
|
-
}
|
|
1122
|
-
function normalizeInput(value) {
|
|
1123
|
-
if (value === void 0) return new Uint8Array(0);
|
|
1124
|
-
if (typeof value === "string") return hexToBytes2(value, "input");
|
|
1125
|
-
return value instanceof Uint8Array ? value : Uint8Array.from(value);
|
|
1126
|
-
}
|
|
1127
980
|
|
|
1128
981
|
// src/mrv.ts
|
|
1129
982
|
var MRV_FORMAT_VERSION = 1;
|
|
@@ -1135,9 +988,9 @@ var MRV_MAX_DEBUG_BYTES = 16 * 1024 * 1024;
|
|
|
1135
988
|
var MRV_MAX_MEMORY_PAGES = 1024;
|
|
1136
989
|
var MRV_MAX_ABI_SYMBOLS = 1024;
|
|
1137
990
|
var MRV_MAX_STORAGE_NAMESPACE_BYTES = 64;
|
|
1138
|
-
var LYTH_DECIMALS =
|
|
991
|
+
var LYTH_DECIMALS = 18;
|
|
1139
992
|
var NATIVE_LYTH_DECIMALS = LYTH_DECIMALS;
|
|
1140
|
-
var LYTHOSHI_PER_LYTH =
|
|
993
|
+
var LYTHOSHI_PER_LYTH = 1000000000000000000n;
|
|
1141
994
|
var MRV_TX_EXTENSION_KIND = 48;
|
|
1142
995
|
var MRV_TX_EXTENSION_V1 = 1;
|
|
1143
996
|
var MRV_CODE_HASH_DOMAIN = new TextEncoder().encode("MONO_MRV_CODE_V1");
|
|
@@ -1204,7 +1057,7 @@ function parseLythToLythoshi(input) {
|
|
|
1204
1057
|
throw new MrvValidationError("lyth amount must be a canonical LYTH decimal");
|
|
1205
1058
|
}
|
|
1206
1059
|
if (fractionRaw.length > NATIVE_LYTH_DECIMALS || !/^[0-9]*$/.test(fractionRaw)) {
|
|
1207
|
-
throw new MrvValidationError(
|
|
1060
|
+
throw new MrvValidationError(`lyth amount supports at most ${NATIVE_LYTH_DECIMALS} decimal places`);
|
|
1208
1061
|
}
|
|
1209
1062
|
const whole = BigInt(wholeRaw.replaceAll(",", ""));
|
|
1210
1063
|
const fraction = fractionRaw === "" ? 0n : BigInt(fractionRaw.padEnd(NATIVE_LYTH_DECIMALS, "0"));
|
|
@@ -1228,7 +1081,7 @@ function checkMrvFeeDisplayConformance(input) {
|
|
|
1228
1081
|
failures.push(`defaultFeeText fee must total ${expectedTotalLythoshi} lythoshi`);
|
|
1229
1082
|
}
|
|
1230
1083
|
} catch {
|
|
1231
|
-
failures.push(
|
|
1084
|
+
failures.push(`defaultFeeText fee must be a canonical ${NATIVE_LYTH_DECIMALS}-decimal LYTH amount`);
|
|
1232
1085
|
}
|
|
1233
1086
|
}
|
|
1234
1087
|
const defaultForbidden = firstForbiddenDefaultFeeTerm(input.defaultFeeText);
|
|
@@ -1612,38 +1465,20 @@ function buildMrvNativeFeePreview(executionUnitLimit, maxExecutionFeeLythoshi, p
|
|
|
1612
1465
|
async function submitMrvDeployNativeTx(client, backend, artifactBytes, options) {
|
|
1613
1466
|
const plan = buildMrvDeployNativeTxPlan(artifactBytes, options);
|
|
1614
1467
|
assertMrvDeployNativeSubmissionPlan(plan);
|
|
1615
|
-
|
|
1616
|
-
backend,
|
|
1617
|
-
tx: plan.tx,
|
|
1618
|
-
encryptionKey: options.encryptionKey ?? await fetchEncryptionKey(client),
|
|
1619
|
-
class: options.class
|
|
1620
|
-
});
|
|
1621
|
-
return {
|
|
1622
|
-
...plan,
|
|
1623
|
-
...submission,
|
|
1624
|
-
txHash: await submitEncryptedEnvelope(client, submission.envelopeWireHex)
|
|
1625
|
-
};
|
|
1468
|
+
return submitMrvEncryptedNativeTxGated(client, backend, plan, options);
|
|
1626
1469
|
}
|
|
1627
1470
|
async function submitMrvDeployPayloadNativeTx(client, backend, artifactBytes, options) {
|
|
1628
1471
|
const plan = buildMrvDeployPayloadNativeTxPlan(artifactBytes, options);
|
|
1629
1472
|
assertMrvDeployNativeSubmissionPlan(plan);
|
|
1630
|
-
|
|
1631
|
-
backend,
|
|
1632
|
-
tx: plan.tx,
|
|
1633
|
-
encryptionKey: options.encryptionKey ?? await fetchEncryptionKey(client),
|
|
1634
|
-
class: options.class
|
|
1635
|
-
});
|
|
1636
|
-
return {
|
|
1637
|
-
...plan,
|
|
1638
|
-
...submission,
|
|
1639
|
-
txHash: await submitEncryptedEnvelope(client, submission.envelopeWireHex)
|
|
1640
|
-
};
|
|
1473
|
+
return submitMrvEncryptedNativeTxGated(client, backend, plan, options);
|
|
1641
1474
|
}
|
|
1642
1475
|
async function submitMrvCallNativeTx(client, backend, contractAddress, input, options) {
|
|
1643
1476
|
const plan = buildMrvCallNativeTxPlan(contractAddress, input, options);
|
|
1644
1477
|
assertMrvCallNativeSubmissionPlan(plan);
|
|
1478
|
+
return submitMrvEncryptedNativeTxGated(client, backend, plan, options);
|
|
1479
|
+
}
|
|
1480
|
+
async function submitMrvEncryptedNativeTxGated(client, backend, plan, options) {
|
|
1645
1481
|
const submission = await buildEncryptedSubmission({
|
|
1646
|
-
backend,
|
|
1647
1482
|
tx: plan.tx,
|
|
1648
1483
|
encryptionKey: options.encryptionKey ?? await fetchEncryptionKey(client),
|
|
1649
1484
|
class: options.class
|
|
@@ -2000,6 +1835,22 @@ function concatBytes3(...parts) {
|
|
|
2000
1835
|
function isIdentifier(value) {
|
|
2001
1836
|
return /^[a-z][a-z0-9_]*$/.test(value);
|
|
2002
1837
|
}
|
|
1838
|
+
var ML_DSA_65_PUBLIC_KEY_LEN = 1952;
|
|
1839
|
+
var ML_DSA_65_SIGNATURE_LEN = 3309;
|
|
1840
|
+
var STANDARD_ALGO_NUMBER_ML_DSA_65 = 1001;
|
|
1841
|
+
var ADDRESS_DERIVATION_DOMAIN = "MONO_ADDRESS_BLAKE3_20_V1";
|
|
1842
|
+
var ADDRESS_DERIVATION_DOMAIN_BYTES = new TextEncoder().encode(ADDRESS_DERIVATION_DOMAIN);
|
|
1843
|
+
function mlDsa65AddressFromPublicKey(publicKey) {
|
|
1844
|
+
return bytesToHex2(mlDsa65AddressBytes(publicKey));
|
|
1845
|
+
}
|
|
1846
|
+
function mlDsa65AddressBytes(publicKey) {
|
|
1847
|
+
const bytes = expectBytes(publicKey, ML_DSA_65_PUBLIC_KEY_LEN, "ML-DSA-65 public key");
|
|
1848
|
+
return blake3_js.blake3(concatBytes2(
|
|
1849
|
+
ADDRESS_DERIVATION_DOMAIN_BYTES,
|
|
1850
|
+
bigintToBeBytes(BigInt(STANDARD_ALGO_NUMBER_ML_DSA_65), 2, "ML-DSA-65 algo id"),
|
|
1851
|
+
bytes
|
|
1852
|
+
)).slice(0, 20);
|
|
1853
|
+
}
|
|
2003
1854
|
|
|
2004
1855
|
// src/registry.ts
|
|
2005
1856
|
var BLS_PUBLIC_KEY_BYTE_LENGTH = 48;
|
|
@@ -2633,7 +2484,7 @@ var NAME_BASE_MULTIPLIER = {
|
|
|
2633
2484
|
cluster: 20,
|
|
2634
2485
|
contract: 10
|
|
2635
2486
|
};
|
|
2636
|
-
var NAME_FALLBACK_FEE_UNIT_LYTHOSHI =
|
|
2487
|
+
var NAME_FALLBACK_FEE_UNIT_LYTHOSHI = 1000000000000n;
|
|
2637
2488
|
var NAME_MAX_LEN = 80;
|
|
2638
2489
|
var NAME_LABEL_MIN_LEN = 1;
|
|
2639
2490
|
var NAME_LABEL_MAX_LEN = 63;
|
|
@@ -2977,13 +2828,31 @@ var RpcClient = class _RpcClient {
|
|
|
2977
2828
|
async ethGasPrice() {
|
|
2978
2829
|
return parseQuantityBig(await this.call("eth_gasPrice", []));
|
|
2979
2830
|
}
|
|
2980
|
-
/**
|
|
2831
|
+
/**
|
|
2832
|
+
* `eth_feeHistory` — base-fee + gas-used history.
|
|
2833
|
+
*
|
|
2834
|
+
* The chain's eth-compat surface serializes the base-fee window under the
|
|
2835
|
+
* camelCase key `baseFeePerGas`. Internally the chain header field is
|
|
2836
|
+
* `base_fee_per_gas`; this method asserts the on-the-wire response actually
|
|
2837
|
+
* carries the expected `baseFeePerGas` array and fails LOUD if the field is
|
|
2838
|
+
* missing or has drifted to snake_case `base_fee_per_gas`. Without this
|
|
2839
|
+
* guard a future rename would silently collapse the base fee to an empty
|
|
2840
|
+
* array and over-/under-quote fees (e.g. name registration would fall back
|
|
2841
|
+
* to the placeholder fee unit and revert `IncorrectFee` on submit).
|
|
2842
|
+
*/
|
|
2981
2843
|
async ethFeeHistory(blockCount, newestBlock = "latest", rewardPercentiles = []) {
|
|
2982
|
-
|
|
2844
|
+
const result = await this.call("eth_feeHistory", [
|
|
2983
2845
|
`0x${blockCount.toString(16)}`,
|
|
2984
2846
|
encodeBlockSelector(newestBlock),
|
|
2985
2847
|
rewardPercentiles
|
|
2986
2848
|
]);
|
|
2849
|
+
if (result !== null && typeof result === "object" && !Array.isArray(result.baseFeePerGas)) {
|
|
2850
|
+
const drifted = "base_fee_per_gas" in result ? " (found snake_case 'base_fee_per_gas')" : "";
|
|
2851
|
+
throw SdkError.malformed(
|
|
2852
|
+
`eth_feeHistory response is missing the camelCase 'baseFeePerGas' array${drifted}; the base-fee field contract changed`
|
|
2853
|
+
);
|
|
2854
|
+
}
|
|
2855
|
+
return result;
|
|
2987
2856
|
}
|
|
2988
2857
|
/** `eth_syncing` — `null` when caught up. */
|
|
2989
2858
|
async ethSyncing() {
|
|
@@ -8523,6 +8392,11 @@ function wordToBigint(word) {
|
|
|
8523
8392
|
}
|
|
8524
8393
|
return out;
|
|
8525
8394
|
}
|
|
8395
|
+
new TextEncoder().encode("protocore/v2/mempool/dkg-mlkem768/1");
|
|
8396
|
+
var MempoolClass = {
|
|
8397
|
+
CLOBOp: 3};
|
|
8398
|
+
|
|
8399
|
+
// src/market-actions.ts
|
|
8526
8400
|
var CLOB_MARKET_ID_DOMAIN_TAG = 193;
|
|
8527
8401
|
var NATIVE_MARKET_MODULE_ADDRESS_BYTES = "0x4d41524b45545f4e41544956455f4d4f445f5631";
|
|
8528
8402
|
var NATIVE_MARKET_MODULE_ADDRESS = addressToTypedBech32(
|
|
@@ -9853,7 +9727,7 @@ var MONOLYTHIUM_NETWORKS = {
|
|
|
9853
9727
|
};
|
|
9854
9728
|
|
|
9855
9729
|
// src/index.ts
|
|
9856
|
-
var version = "0.
|
|
9730
|
+
var version = "0.3.15";
|
|
9857
9731
|
|
|
9858
9732
|
exports.ADDRESS_HRP = ADDRESS_HRP;
|
|
9859
9733
|
exports.ADDRESS_KIND_HRPS = ADDRESS_KIND_HRPS;
|