@monolythium/core-sdk 0.2.0 → 0.2.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/crypto/index.cjs.map +1 -1
- package/dist/crypto/index.js.map +1 -1
- package/dist/ethers/index.cjs.map +1 -1
- package/dist/ethers/index.js.map +1 -1
- package/dist/index.cjs +40 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -9
- package/dist/index.d.ts +31 -9
- package/dist/index.js +40 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -128,6 +128,41 @@ function parseAddress(address) {
|
|
|
128
128
|
}
|
|
129
129
|
return bech32ToAddressBytes(address);
|
|
130
130
|
}
|
|
131
|
+
function validateAddress(address) {
|
|
132
|
+
if (typeof address !== "string" || address.length === 0) {
|
|
133
|
+
return { valid: false, reason: "address cannot be empty" };
|
|
134
|
+
}
|
|
135
|
+
const trimmed = address.trim();
|
|
136
|
+
if (trimmed.length === 0) {
|
|
137
|
+
return { valid: false, reason: "address cannot be empty" };
|
|
138
|
+
}
|
|
139
|
+
if (trimmed.startsWith("0x") || trimmed.startsWith("0X")) {
|
|
140
|
+
try {
|
|
141
|
+
const bytes = hexToAddressBytes(trimmed);
|
|
142
|
+
return {
|
|
143
|
+
valid: true,
|
|
144
|
+
normalized: addressToBech32(bytes),
|
|
145
|
+
kind: null,
|
|
146
|
+
format: "hex",
|
|
147
|
+
bytes
|
|
148
|
+
};
|
|
149
|
+
} catch (err) {
|
|
150
|
+
return { valid: false, reason: err instanceof Error ? err.message : String(err) };
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
try {
|
|
154
|
+
const typed = typedBech32ToAddress(trimmed);
|
|
155
|
+
return {
|
|
156
|
+
valid: true,
|
|
157
|
+
normalized: typed.address,
|
|
158
|
+
kind: typed.kind,
|
|
159
|
+
format: "bech32m",
|
|
160
|
+
bytes: typed.bytes
|
|
161
|
+
};
|
|
162
|
+
} catch (err) {
|
|
163
|
+
return { valid: false, reason: err instanceof Error ? err.message : String(err) };
|
|
164
|
+
}
|
|
165
|
+
}
|
|
131
166
|
function normalizeAddressHex(address) {
|
|
132
167
|
return addressBytesToHex(parseAddress(address));
|
|
133
168
|
}
|
|
@@ -320,8 +355,6 @@ var PRECOMPILE_ADDRESSES = {
|
|
|
320
355
|
PRIVACY: "0x0000000000000000000000000000000000001004",
|
|
321
356
|
/** Operator + RPC node registry — non-gateable consensus invariant. */
|
|
322
357
|
NODE_REGISTRY: "0x0000000000000000000000000000000000001005",
|
|
323
|
-
/** IBC light-client + packet routing — gateable. */
|
|
324
|
-
IBC: "0x0000000000000000000000000000000000001007",
|
|
325
358
|
/** Native zk-light-client bridge — gateable. */
|
|
326
359
|
BRIDGE: "0x0000000000000000000000000000000000001008",
|
|
327
360
|
/** Decentralized multi-signer oracle (OI-0036) — non-gateable. */
|
|
@@ -334,8 +367,6 @@ var PRECOMPILE_ADDRESSES = {
|
|
|
334
367
|
VRF: "0x0000000000000000000000000000000000001101",
|
|
335
368
|
/** Streaming-payments primitive (Law §5.4 / §5.7) — gateable. */
|
|
336
369
|
STREAMING_PAYMENTS: "0x0000000000000000000000000000000000001102",
|
|
337
|
-
/** Human-readable name registry (Law §5.4 / §5.8) — gateable. */
|
|
338
|
-
NAME_REGISTRY: "0x0000000000000000000000000000000000001103",
|
|
339
370
|
/** Cluster-name registry. */
|
|
340
371
|
CLUSTER_NAME_REGISTRY: "0x0000000000000000000000000000000000001104",
|
|
341
372
|
/** Agent-commerce attestation precompile. */
|
|
@@ -355,7 +386,9 @@ var PRECOMPILE_ADDRESSES = {
|
|
|
355
386
|
/** Agent spending policy — gateable, activated by Stage 7 milestones. */
|
|
356
387
|
SPENDING_POLICY: "0x000000000000000000000000000000000000110C",
|
|
357
388
|
/** Primary ML-DSA-65 pubkey registry — gateable, ADR-0034. */
|
|
358
|
-
PUBKEY_REGISTRY: "0x000000000000000000000000000000000000110D"
|
|
389
|
+
PUBKEY_REGISTRY: "0x000000000000000000000000000000000000110D",
|
|
390
|
+
/** Hierarchical name registry (Law §5.10, whitepaper §22.8) — gateable. */
|
|
391
|
+
NAME_REGISTRY: "0x000000000000000000000000000000000000110E"
|
|
359
392
|
};
|
|
360
393
|
|
|
361
394
|
// src/node-registry.ts
|
|
@@ -7854,7 +7887,7 @@ var MONOLYTHIUM_TESTNET_CHAIN_ID = 69420n;
|
|
|
7854
7887
|
var MONOLYTHIUM_TESTNET_NETWORK_NAME = "monolythium-testnet";
|
|
7855
7888
|
|
|
7856
7889
|
// src/index.ts
|
|
7857
|
-
var version = "0.2.
|
|
7890
|
+
var version = "0.2.1";
|
|
7858
7891
|
|
|
7859
7892
|
exports.ADDRESS_HRP = ADDRESS_HRP;
|
|
7860
7893
|
exports.ADDRESS_KIND_HRPS = ADDRESS_KIND_HRPS;
|
|
@@ -8149,6 +8182,7 @@ exports.submitMrvCallNativeTx = submitMrvCallNativeTx;
|
|
|
8149
8182
|
exports.submitMrvDeployNativeTx = submitMrvDeployNativeTx;
|
|
8150
8183
|
exports.submitMrvDeployPayloadNativeTx = submitMrvDeployPayloadNativeTx;
|
|
8151
8184
|
exports.typedBech32ToAddress = typedBech32ToAddress;
|
|
8185
|
+
exports.validateAddress = validateAddress;
|
|
8152
8186
|
exports.validateBridgeRouteCatalogue = validateBridgeRouteCatalogue;
|
|
8153
8187
|
exports.validateMrvArtifactMetadata = validateMrvArtifactMetadata;
|
|
8154
8188
|
exports.validateMrvCallRequest = validateMrvCallRequest;
|