@certen.io/sdk 0.9.0 → 0.11.0
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/CHANGELOG.md +153 -0
- package/README.md +111 -0
- package/dist/address.d.ts +12 -0
- package/dist/address.d.ts.map +1 -0
- package/dist/address.js +48 -0
- package/dist/address.js.map +1 -0
- package/dist/agent.d.ts +8 -0
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +12 -0
- package/dist/agent.js.map +1 -1
- package/dist/browser.d.ts +47 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +55 -0
- package/dist/browser.js.map +1 -0
- package/dist/bytes.d.ts +14 -0
- package/dist/bytes.d.ts.map +1 -0
- package/dist/bytes.js +47 -0
- package/dist/bytes.js.map +1 -0
- package/dist/chains.d.ts +218 -0
- package/dist/chains.d.ts.map +1 -0
- package/dist/chains.js +295 -0
- package/dist/chains.js.map +1 -0
- package/dist/client.d.ts +17 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +54 -8
- package/dist/client.js.map +1 -1
- package/dist/defaults.d.ts +3 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/defaults.js +3 -0
- package/dist/defaults.js.map +1 -0
- package/dist/doctor.d.ts +10 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +42 -27
- package/dist/doctor.js.map +1 -1
- package/dist/effect.d.ts +99 -0
- package/dist/effect.d.ts.map +1 -0
- package/dist/effect.js +139 -0
- package/dist/effect.js.map +1 -0
- package/dist/error-codes.d.ts.map +1 -1
- package/dist/error-codes.js +17 -0
- package/dist/error-codes.js.map +1 -1
- package/dist/errors.d.ts +76 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +108 -0
- package/dist/errors.js.map +1 -1
- package/dist/evm-rpc.d.ts +55 -0
- package/dist/evm-rpc.d.ts.map +1 -0
- package/dist/evm-rpc.js +126 -0
- package/dist/evm-rpc.js.map +1 -0
- package/dist/execution-proof.d.ts.map +1 -1
- package/dist/execution-proof.js +2 -1
- package/dist/execution-proof.js.map +1 -1
- package/dist/funding.d.ts +214 -6
- package/dist/funding.d.ts.map +1 -1
- package/dist/funding.js +251 -29
- package/dist/funding.js.map +1 -1
- package/dist/header-fields.d.ts +68 -0
- package/dist/header-fields.d.ts.map +1 -0
- package/dist/header-fields.js +147 -0
- package/dist/header-fields.js.map +1 -0
- package/dist/index.d.ts +9 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -26
- package/dist/index.js.map +1 -1
- package/dist/intent-states.d.ts +75 -0
- package/dist/intent-states.d.ts.map +1 -0
- package/dist/intent-states.js +66 -0
- package/dist/intent-states.js.map +1 -0
- package/dist/internal.d.ts +18 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +44 -0
- package/dist/internal.js.map +1 -1
- package/dist/key-page.d.ts +67 -0
- package/dist/key-page.d.ts.map +1 -0
- package/dist/key-page.js +154 -0
- package/dist/key-page.js.map +1 -0
- package/dist/origin.d.ts +19 -0
- package/dist/origin.d.ts.map +1 -0
- package/dist/origin.js +80 -0
- package/dist/origin.js.map +1 -0
- package/dist/random.d.ts +27 -0
- package/dist/random.d.ts.map +1 -0
- package/dist/random.js +30 -0
- package/dist/random.js.map +1 -0
- package/dist/readiness.d.ts +133 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +467 -0
- package/dist/readiness.js.map +1 -0
- package/dist/reason-codes.d.ts +15 -0
- package/dist/reason-codes.d.ts.map +1 -0
- package/dist/reason-codes.js +30 -0
- package/dist/reason-codes.js.map +1 -0
- package/dist/receipt.d.ts +233 -0
- package/dist/receipt.d.ts.map +1 -0
- package/dist/receipt.js +318 -0
- package/dist/receipt.js.map +1 -0
- package/dist/resources/admin.d.ts +5 -2
- package/dist/resources/admin.d.ts.map +1 -1
- package/dist/resources/admin.js +8 -3
- package/dist/resources/admin.js.map +1 -1
- package/dist/resources/billing.d.ts.map +1 -1
- package/dist/resources/billing.js +5 -4
- package/dist/resources/billing.js.map +1 -1
- package/dist/resources/chains.d.ts +10 -0
- package/dist/resources/chains.d.ts.map +1 -1
- package/dist/resources/chains.js +15 -1
- package/dist/resources/chains.js.map +1 -1
- package/dist/resources/device.d.ts.map +1 -1
- package/dist/resources/device.js +2 -1
- package/dist/resources/device.js.map +1 -1
- package/dist/resources/execute.d.ts +110 -4
- package/dist/resources/execute.d.ts.map +1 -1
- package/dist/resources/execute.js +207 -35
- package/dist/resources/execute.js.map +1 -1
- package/dist/resources/governance.js +3 -3
- package/dist/resources/governance.js.map +1 -1
- package/dist/resources/identity.js +5 -5
- package/dist/resources/identity.js.map +1 -1
- package/dist/resources/oauth-clients.d.ts.map +1 -1
- package/dist/resources/oauth-clients.js +3 -2
- package/dist/resources/oauth-clients.js.map +1 -1
- package/dist/resources/proof.d.ts +10 -2
- package/dist/resources/proof.d.ts.map +1 -1
- package/dist/resources/proof.js +33 -11
- package/dist/resources/proof.js.map +1 -1
- package/dist/resources/registration-tokens.d.ts.map +1 -1
- package/dist/resources/registration-tokens.js +2 -1
- package/dist/resources/registration-tokens.js.map +1 -1
- package/dist/resources/sign.js +2 -2
- package/dist/resources/sign.js.map +1 -1
- package/dist/resources/transaction.d.ts.map +1 -1
- package/dist/resources/transaction.js +7 -3
- package/dist/resources/transaction.js.map +1 -1
- package/dist/resources/transparency.d.ts.map +1 -1
- package/dist/resources/transparency.js +3 -2
- package/dist/resources/transparency.js.map +1 -1
- package/dist/resources/webhooks.d.ts +5 -3
- package/dist/resources/webhooks.d.ts.map +1 -1
- package/dist/resources/webhooks.js +12 -8
- package/dist/resources/webhooks.js.map +1 -1
- package/dist/sha256.d.ts +10 -0
- package/dist/sha256.d.ts.map +1 -0
- package/dist/sha256.js +71 -0
- package/dist/sha256.js.map +1 -0
- package/dist/share-target.d.ts +10 -0
- package/dist/share-target.d.ts.map +1 -0
- package/dist/share-target.js +25 -0
- package/dist/share-target.js.map +1 -0
- package/dist/shared-proof.d.ts +1 -5
- package/dist/shared-proof.d.ts.map +1 -1
- package/dist/shared-proof.js +27 -21
- package/dist/shared-proof.js.map +1 -1
- package/dist/signing-check.d.ts +66 -0
- package/dist/signing-check.d.ts.map +1 -0
- package/dist/signing-check.js +171 -0
- package/dist/signing-check.js.map +1 -0
- package/dist/types.d.ts +139 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/verify-receipt.d.ts.map +1 -1
- package/dist/verify-receipt.js +68 -28
- package/dist/verify-receipt.js.map +1 -1
- package/dist/verify.d.ts +206 -0
- package/dist/verify.d.ts.map +1 -0
- package/dist/verify.js +369 -0
- package/dist/verify.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +4 -0
- package/dist/version.js.map +1 -0
- package/package.json +25 -7
package/dist/browser.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The browser-safe surface of the SDK: the client, its resources, the typed errors, the status table, the chain catalogue and every
|
|
3
|
+
* pure helper. Nothing reachable from here uses a Node built-in or a bare Node global (packages/sdk/test/browser-entry.test.ts
|
|
4
|
+
* bundles it for a browser and runs it with `process`, `Buffer` and `require` removed).
|
|
5
|
+
*
|
|
6
|
+
* `package.json` points the `browser` export condition here, and `@certen.io/sdk/browser` names it explicitly. The default entry
|
|
7
|
+
* (index.ts) is this plus the two modules that need Node: `CertenAgent` / `ed25519Signer` (local key handling with node:crypto) and
|
|
8
|
+
* `fetchSharedProof` / `decodeSharedBundle` (gunzip with node:zlib).
|
|
9
|
+
*/
|
|
10
|
+
export { CertenClient, paginate, paginateWithTotal, DEFAULT_BASE_URL } from './client.js';
|
|
11
|
+
export * from './types.js';
|
|
12
|
+
export { wholeUnitAmountProblem } from './resources/execute.js';
|
|
13
|
+
// EVM addresses (EIP-55), the caller's own node, and the receipt: what happened, whether the proof holds, whether the value arrived. The pure
|
|
14
|
+
// assembly is here; reading and verifying (`buildReceipt`) needs the verifier and is in `@certen.io/sdk/verify`. See receipt.ts.
|
|
15
|
+
export { toChecksumAddress, evmAddressProblem } from './address.js';
|
|
16
|
+
export { checkEvmRpcEndpoint, evmRpcCall, readEvmChainId, assertRpcChain, readEvmBalance, readEvmBlockHeader, } from './evm-rpc.js';
|
|
17
|
+
export { snapshotRecipient, checkNativeTransferEffect, noEffectToCheck } from './effect.js';
|
|
18
|
+
export { assembleReceipt, estimateFee, RECEIPT_VERSION, EXECUTION_SKU } from './receipt.js';
|
|
19
|
+
export { CertenError, CertenAuthError, CertenRateLimitError, CertenBadRequestError, CertenServerError, CertenPaymentRequiredError, CertenHeaderAuthorityNotExecutableError, CertenIntentFailedError, CertenWaitTimeoutError, CertenProofNotAvailableError, CertenForeignOriginError, HEADER_AUTHORITY_NOT_EXECUTABLE, } from './errors.js';
|
|
20
|
+
// Transaction-header fields (additional authorities, deadline): the validators the SDK runs before
|
|
21
|
+
// sending, exported so the CLI and MCP apply the identical rules. See header-fields.ts.
|
|
22
|
+
export { normalizeAdditionalAuthorities, normalizeExpiresAt, parseDuration, expiresIn, MAX_ADDITIONAL_AUTHORITIES, MAX_AUTHORITY_URL_LENGTH, GATEWAY_EXPIRY_MIN_S, GATEWAY_EXPIRY_MAX_S, LOCAL_EXPIRY_MIN_S, HEADER_FIELD_ERROR_CODES, } from './header-fields.js';
|
|
23
|
+
// Where an intent can be and what each status means: the one table wait(), the CLI and the MCP server share. See intent-states.ts.
|
|
24
|
+
export { INTENT_STATUS_CLASS, classifyIntentStatus, isTerminalIntentStatus, intentOutcome, EXECUTION_PROOF_UNAVAILABLE, } from './intent-states.js';
|
|
25
|
+
export { describeReasonCode, isTransactionReasonCode, REASON_CODE_DESCRIPTIONS } from './reason-codes.js';
|
|
26
|
+
export { runDoctor, CREDENTIALLED_CHECKS } from './doctor.js';
|
|
27
|
+
// Every error code this release knew the gateway to raise (the CLI uses it to tell a code `certen errors <CODE>` explains from one it cannot). See error-codes.ts.
|
|
28
|
+
export { VENDORED_ERROR_CODES } from './error-codes.js';
|
|
29
|
+
// Readiness for one identity on one chain, and the Accumulate key page read behind it. See readiness.ts and key-page.ts.
|
|
30
|
+
export { runReadiness, checkGas, summarizeReadiness, READINESS_CHECKS, CONTEXT_CHECKS } from './readiness.js';
|
|
31
|
+
export { readKeyPage, verifyKeyPageHolds, keyHashesOf } from './key-page.js';
|
|
32
|
+
// Splitting a share link into token and gateway is pure string work; fetching and decoding one (which gunzips) is Node-only. See
|
|
33
|
+
// share-target.ts and shared-proof.ts.
|
|
34
|
+
export { parseShareTarget } from './share-target.js';
|
|
35
|
+
// execution-proof.ts: verify a bundle's component 5 (the receipt and its trie proof) with no
|
|
36
|
+
// dependencies and no gateway — what a counterparty runs.
|
|
37
|
+
export { verifyExecutionProof, checkAgainstHeader, executionComponentOf, decodeReceipt, verifyTrieProof, keccak256, rlpDecode, rlpEncodeUint, bytesFrom, } from './execution-proof.js';
|
|
38
|
+
// Standalone for the same reason: these carry their credential in the body and need no API key,
|
|
39
|
+
// so a caller using OAuth is not made to hold one. See oauth.ts.
|
|
40
|
+
export { fetchOAuthToken, refreshOAuthToken, revokeOAuthToken } from './oauth.js';
|
|
41
|
+
// Exported so a caller can split `mnemonic_retrieval.url` the same way the SDK does, rather than
|
|
42
|
+
// writing their own regex against a string whose parts they cannot afford to get wrong.
|
|
43
|
+
export { parseMnemonicTarget } from './resources/identity.js';
|
|
44
|
+
// Standalone for the same reason as the OAuth helpers: the caller has no credential yet, and
|
|
45
|
+
// obtaining its first one is the entire purpose. See registration.ts.
|
|
46
|
+
export { redeemRegistrationToken } from './registration.js';
|
|
47
|
+
// Keypair-proof self-service signup — no browser, no email, nobody at CERTEN. Standalone for the
|
|
48
|
+
// same reason: the caller holds nothing yet. See self-signup.ts.
|
|
49
|
+
export { selfSignup, requestSignupChallenge, completeSignup } from './self-signup.js';
|
|
50
|
+
export { CertenUnfundedAccountError, CertenUnderfundedAccountError, CertenFundingUnverifiableError, movesValue, normalizeChainId, assessGas, nativeAmountOf, nativeTransferUri, gasFundingPlan, } from './funding.js';
|
|
51
|
+
// The chain catalogue: the single source the CLI and MCP derive every chain table from. See chains.ts.
|
|
52
|
+
export { CHAIN_CATALOGUE, chainInfo, chainSlug, nativeSymbolFor, faucetForChain, defaultEnabledChains, enablableChains, parseEnabledChains, ChainConfigurationError, gatewayServes, chainAvailability, resolveEnabledChains, readNativeBalance, describeUnverifiable, gasReserveFor, parseUnits, formatUnits, } from './chains.js';
|
|
53
|
+
// One resolver, shared by the CLI and MCP. Two copies of this would drift — see sign-target.ts.
|
|
54
|
+
export { resolveSignTarget } from './sign-target.js';
|
|
55
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC1F,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,8IAA8I;AAC9I,iIAAiI;AACjI,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EACL,mBAAmB,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,kBAAkB,GACpG,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE5F,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAK5F,OAAO,EACL,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,0BAA0B,EAC1B,uCAAuC,EACvC,uBAAuB,EACvB,sBAAsB,EACtB,4BAA4B,EAC5B,wBAAwB,EACxB,+BAA+B,GAChC,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AAC7F,sEAAsE;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,iGAAiG;AACjG,iEAAiE;AACjE,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EACL,0BAA0B,EAAE,6BAA6B,EAAE,8BAA8B,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,cAAc,EAClJ,iBAAiB,EAAE,cAAc,GAClC,MAAM,cAAc,CAAC;AAEtB,uGAAuG;AACvG,OAAO,EACL,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,oBAAoB,EAAE,eAAe,EAC7G,kBAAkB,EAAE,uBAAuB,EAAE,aAAa,EAAE,iBAAiB,EAAE,oBAAoB,EACnG,iBAAiB,EAAE,oBAAoB,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,GAChF,MAAM,aAAa,CAAC;AAIrB,gGAAgG;AAChG,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/bytes.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Byte helpers that work the same in Node and in a browser.
|
|
3
|
+
*
|
|
4
|
+
* The client used to reach for `Buffer`, which a browser does not have; `Uint8Array`, `TextEncoder` and `atob` are in every runtime
|
|
5
|
+
* this SDK supports (Node >= 22 and current browsers). Nothing here touches the network or any key.
|
|
6
|
+
*/
|
|
7
|
+
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
8
|
+
/** Parse hex into bytes. Odd length or a non-hex character throws, rather than silently dropping the tail as `Buffer.from(x, 'hex')` does. */
|
|
9
|
+
export declare function hexToBytes(hex: string): Uint8Array;
|
|
10
|
+
export declare function concatBytes(...parts: Uint8Array[]): Uint8Array;
|
|
11
|
+
export declare function utf8(text: string): Uint8Array;
|
|
12
|
+
/** Standard base64 (the alphabet `Buffer.from(x, 'base64')` accepts, including URL-safe `-` and `_`). Throws on anything else. */
|
|
13
|
+
export declare function base64ToBytes(b64: string): Uint8Array;
|
|
14
|
+
//# sourceMappingURL=bytes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../src/bytes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIpD;AAED,8IAA8I;AAC9I,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAMlD;AAED,wBAAgB,WAAW,CAAC,GAAG,KAAK,EAAE,UAAU,EAAE,GAAG,UAAU,CAK9D;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAE7C;AAED,kIAAkI;AAClI,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAOrD"}
|
package/dist/bytes.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Byte helpers that work the same in Node and in a browser.
|
|
3
|
+
*
|
|
4
|
+
* The client used to reach for `Buffer`, which a browser does not have; `Uint8Array`, `TextEncoder` and `atob` are in every runtime
|
|
5
|
+
* this SDK supports (Node >= 22 and current browsers). Nothing here touches the network or any key.
|
|
6
|
+
*/
|
|
7
|
+
const HEX = '0123456789abcdef';
|
|
8
|
+
export function bytesToHex(bytes) {
|
|
9
|
+
let out = '';
|
|
10
|
+
for (const b of bytes)
|
|
11
|
+
out += HEX[b >> 4] + HEX[b & 15];
|
|
12
|
+
return out;
|
|
13
|
+
}
|
|
14
|
+
/** Parse hex into bytes. Odd length or a non-hex character throws, rather than silently dropping the tail as `Buffer.from(x, 'hex')` does. */
|
|
15
|
+
export function hexToBytes(hex) {
|
|
16
|
+
const h = hex.startsWith('0x') || hex.startsWith('0X') ? hex.slice(2) : hex;
|
|
17
|
+
if (h.length % 2 !== 0 || /[^0-9a-fA-F]/.test(h))
|
|
18
|
+
throw new Error(`not valid hex (${h.length} characters)`);
|
|
19
|
+
const out = new Uint8Array(h.length / 2);
|
|
20
|
+
for (let i = 0; i < out.length; i++)
|
|
21
|
+
out[i] = parseInt(h.slice(i * 2, i * 2 + 2), 16);
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
export function concatBytes(...parts) {
|
|
25
|
+
const out = new Uint8Array(parts.reduce((n, p) => n + p.length, 0));
|
|
26
|
+
let at = 0;
|
|
27
|
+
for (const p of parts) {
|
|
28
|
+
out.set(p, at);
|
|
29
|
+
at += p.length;
|
|
30
|
+
}
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
export function utf8(text) {
|
|
34
|
+
return new TextEncoder().encode(text);
|
|
35
|
+
}
|
|
36
|
+
/** Standard base64 (the alphabet `Buffer.from(x, 'base64')` accepts, including URL-safe `-` and `_`). Throws on anything else. */
|
|
37
|
+
export function base64ToBytes(b64) {
|
|
38
|
+
const clean = b64.replace(/-/g, '+').replace(/_/g, '/').replace(/\s+/g, '');
|
|
39
|
+
if (/[^A-Za-z0-9+/=]/.test(clean))
|
|
40
|
+
throw new Error('not valid base64');
|
|
41
|
+
const bin = atob(clean.padEnd(Math.ceil(clean.length / 4) * 4, '='));
|
|
42
|
+
const out = new Uint8Array(bin.length);
|
|
43
|
+
for (let i = 0; i < bin.length; i++)
|
|
44
|
+
out[i] = bin.charCodeAt(i);
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=bytes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../src/bytes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,GAAG,GAAG,kBAAkB,CAAC;AAE/B,MAAM,UAAU,UAAU,CAAC,KAAiB;IAC1C,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,MAAM,CAAC,IAAI,KAAK;Q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AAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAAC,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC;IAAC,CAAC;IAC1D,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,IAAY;IAC/B,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAED,kIAAkI;AAClI,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC5E,IAAI,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACvE,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IACrE,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAChE,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/chains.d.ts
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chain catalogue: the one place this SDK, the CLI and the MCP server learn what a chain IS.
|
|
3
|
+
*
|
|
4
|
+
* Before this file the same facts lived in five tables — the CLI's supported list, its alias map,
|
|
5
|
+
* its numeric-id map, its block-time table and its faucet table, plus two copies of a numeric-id
|
|
6
|
+
* map in the SDK — and they had already drifted (the SDK knew five chains, the CLI three). Every
|
|
7
|
+
* native-balance check also assumed the gas token was called `ETH`, which on a chain whose gas is
|
|
8
|
+
* not ETH made the funding guards pass without looking. Each of those is now derived from here.
|
|
9
|
+
*
|
|
10
|
+
* **What this table is, and what it is not.**
|
|
11
|
+
*
|
|
12
|
+
* - It is static on purpose. Normalizing a numeric `chain_id`, naming the gas token, estimating a
|
|
13
|
+
* wait and validating a flag must all work offline and on a first run.
|
|
14
|
+
* - It does NOT decide what is enabled on its own. A chain is offered only when it is enabled in
|
|
15
|
+
* configuration AND the gateway serves it (`GET /v1/chains`): see {@link resolveEnabledChains}.
|
|
16
|
+
* The catalogue's `enabledByDefault` is only the configuration default.
|
|
17
|
+
* - A `retired` entry is kept for reading: an older gateway may still return its numeric id in a
|
|
18
|
+
* portfolio, and dropping it would make that row unrecognisable. A retired chain is never
|
|
19
|
+
* offered and cannot be enabled.
|
|
20
|
+
*/
|
|
21
|
+
export type ChainSupport = 'live' | 'opt-in' | 'retired';
|
|
22
|
+
export interface ChainCatalogueEntry {
|
|
23
|
+
/** Registry slug, as `GET /v1/chains` names it. */
|
|
24
|
+
readonly slug: string;
|
|
25
|
+
/** Numeric EVM chain id (EIP-155). */
|
|
26
|
+
readonly chainId: number;
|
|
27
|
+
readonly displayName: string;
|
|
28
|
+
readonly environment: 'testnet';
|
|
29
|
+
/** The native gas token's symbol as the gateway's portfolio reports it, e.g. `ETH`, `TEL`. */
|
|
30
|
+
readonly nativeSymbol: string;
|
|
31
|
+
readonly nativeDecimals: number;
|
|
32
|
+
/**
|
|
33
|
+
* Typical seconds per block, for turning a confirmation count into an estimate a person can plan
|
|
34
|
+
* around. Never a promise; see `blocksOnlyWithTraffic`.
|
|
35
|
+
*/
|
|
36
|
+
readonly blockSeconds: number;
|
|
37
|
+
/**
|
|
38
|
+
* The chain produces a block only when there is a transaction to put in it. A confirmation count
|
|
39
|
+
* on such a chain is not a measure of time at all when it is idle, so every estimate built on
|
|
40
|
+
* `blockSeconds` is a lower bound and must be presented as one.
|
|
41
|
+
*/
|
|
42
|
+
readonly blocksOnlyWithTraffic: boolean;
|
|
43
|
+
/** Where to get testnet gas. Absent rather than guessed. */
|
|
44
|
+
readonly faucet?: string;
|
|
45
|
+
/**
|
|
46
|
+
* The native balance, in whole units, an abstract account should hold on top of any amount it is about to move, for one execution
|
|
47
|
+
* to be plausible. **An estimate, never a quote**: the gateway publishes no per-execution gas figure (`/v1/quote` prices the
|
|
48
|
+
* platform's own legs in USD), so this is a planning figure chosen in the CLI UX Phase 2 work, not a measurement. Everything that
|
|
49
|
+
* shows it calls it an estimate, a caller can override it, and absent means "no estimate for this chain" - such a chain is checked on
|
|
50
|
+
* the amount alone and says so, rather than being given a number nobody has measured.
|
|
51
|
+
*/
|
|
52
|
+
readonly gasReserve?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Names people type for this chain that are NOT its slug. They SUGGEST and never substitute: a
|
|
55
|
+
* mainnet name mapped silently to a testnet would be the client deciding where money goes.
|
|
56
|
+
*/
|
|
57
|
+
readonly aliases: readonly string[];
|
|
58
|
+
readonly support: ChainSupport;
|
|
59
|
+
/** Enabled when configuration says nothing. True only for `live` chains. */
|
|
60
|
+
readonly enabledByDefault: boolean;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Every chain this SDK knows. Order is the order chains are listed to a person.
|
|
64
|
+
*
|
|
65
|
+
* Facts verified 2026-10-05 against chainid.network and, for Telcoin Adiri, against the chain's
|
|
66
|
+
* own RPC (`eth_chainId` = 0x7e1). Adiri's block cadence was measured over its last 6000 blocks:
|
|
67
|
+
* blocks appear only when there is a transaction, and active blocks cluster 7–16 s apart.
|
|
68
|
+
*/
|
|
69
|
+
export declare const CHAIN_CATALOGUE: readonly ChainCatalogueEntry[];
|
|
70
|
+
/** The catalogue entry for a slug or a numeric chain id (either spelling), or undefined. */
|
|
71
|
+
export declare function chainInfo(value: string | number | null | undefined): ChainCatalogueEntry | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Resolve whatever the gateway called a chain into its slug.
|
|
74
|
+
*
|
|
75
|
+
* A numeric id the catalogue knows becomes its slug. Anything else is returned unchanged (trimmed):
|
|
76
|
+
* a value we cannot map is still the best label we have for it, and inventing one would be worse.
|
|
77
|
+
*/
|
|
78
|
+
export declare function chainSlug(value: string | number | null | undefined): string;
|
|
79
|
+
/** The native gas token's symbol, or undefined when the catalogue does not know the chain. */
|
|
80
|
+
export declare function nativeSymbolFor(chain: string | number | null | undefined): string | undefined;
|
|
81
|
+
export declare function faucetForChain(chain: string | number | null | undefined): string | undefined;
|
|
82
|
+
/** The gas reserve estimate for a chain, in whole native units, or undefined when the catalogue has none. See {@link ChainCatalogueEntry.gasReserve}. */
|
|
83
|
+
export declare function gasReserveFor(chain: string | number | null | undefined): string | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* A non-negative decimal string ("0.0021", "3", "1.50") to base units, exactly, or undefined when it is not one.
|
|
86
|
+
*
|
|
87
|
+
* Returns undefined rather than throwing: a balance the gateway reported as "unavailable" or an amount typed with too many decimals is
|
|
88
|
+
* a fact to report as unknown, not an exception to unwind. Integer arithmetic only - `Number("0.1") * 10 ** 18` is wrong for values a
|
|
89
|
+
* wallet shows exactly.
|
|
90
|
+
*/
|
|
91
|
+
export declare function parseUnits(value: string | number | null | undefined, decimals: number): bigint | undefined;
|
|
92
|
+
/** Base units to a whole-unit decimal string with no trailing zeros ("1500000000000000" at 18 decimals -> "0.0015"). */
|
|
93
|
+
export declare function formatUnits(value: bigint, decimals: number): string;
|
|
94
|
+
/** Slugs the catalogue enables when configuration says nothing: the live chains, in order. */
|
|
95
|
+
export declare function defaultEnabledChains(): string[];
|
|
96
|
+
/** Slugs that configuration may enable: everything not retired. */
|
|
97
|
+
export declare function enablableChains(): string[];
|
|
98
|
+
/** Thrown when configuration names a chain that cannot be enabled. */
|
|
99
|
+
export declare class ChainConfigurationError extends Error {
|
|
100
|
+
readonly chain: string;
|
|
101
|
+
constructor(chain: string, message: string);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Parse an enabled-chains setting (e.g. `CERTEN_ENABLED_CHAINS`): a comma-separated list of slugs
|
|
105
|
+
* or numeric ids that REPLACES the default set.
|
|
106
|
+
*
|
|
107
|
+
* Unset or blank means the default set. Every name must be a catalogue chain that is not retired;
|
|
108
|
+
* anything else is refused by name — an enable switch that quietly ignored a typo would leave a
|
|
109
|
+
* person believing a chain was on.
|
|
110
|
+
*/
|
|
111
|
+
export declare function parseEnabledChains(setting: string | undefined | null): string[];
|
|
112
|
+
/** The part of a `GET /v1/chains` entry this module reads. */
|
|
113
|
+
export interface ServedChain {
|
|
114
|
+
id: string;
|
|
115
|
+
chainId?: number | null;
|
|
116
|
+
/**
|
|
117
|
+
* The gateway's enable switch for this chain. A gateway that follows the contract lists EVERY catalogue chain with an explicit
|
|
118
|
+
* boolean, so `false` means "exists, switched off" (`chain_not_enabled`) and a chain that is not listed at all means "the gateway
|
|
119
|
+
* does not know it" (`unknown_chain`). An entry with no `enabled` field comes from a gateway that listed only the chains it
|
|
120
|
+
* served, and is treated as enabled.
|
|
121
|
+
*/
|
|
122
|
+
enabled?: boolean;
|
|
123
|
+
}
|
|
124
|
+
/** Does the gateway serve this entry? Listed, and not explicitly disabled. */
|
|
125
|
+
export declare function gatewayServes(entry: ServedChain): boolean;
|
|
126
|
+
export type ChainAvailability = {
|
|
127
|
+
state: 'enabled';
|
|
128
|
+
chain: ChainCatalogueEntry;
|
|
129
|
+
} | {
|
|
130
|
+
state: 'unknown';
|
|
131
|
+
chain: string;
|
|
132
|
+
} | {
|
|
133
|
+
state: 'retired';
|
|
134
|
+
chain: ChainCatalogueEntry;
|
|
135
|
+
} | {
|
|
136
|
+
state: 'not-configured';
|
|
137
|
+
chain: ChainCatalogueEntry;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The gateway's list does not contain this chain. To the gateway it is an unknown chain (`unknown_chain`). This is NOT "disabled":
|
|
141
|
+
* omission and an explicit `enabled: false` are different facts and a caller acts differently on each.
|
|
142
|
+
*/
|
|
143
|
+
| {
|
|
144
|
+
state: 'unlisted';
|
|
145
|
+
chain: ChainCatalogueEntry;
|
|
146
|
+
code: 'unknown_chain';
|
|
147
|
+
}
|
|
148
|
+
/** The gateway lists this chain with `enabled: false`: it exists and is switched off (`chain_not_enabled`). */
|
|
149
|
+
| {
|
|
150
|
+
state: 'disabled';
|
|
151
|
+
chain: ChainCatalogueEntry;
|
|
152
|
+
code: 'chain_not_enabled';
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Is `chain` available to use, given the configured set and (when known) what the gateway serves?
|
|
156
|
+
*
|
|
157
|
+
* `served` undefined means "the gateway has not been asked": the configured set alone decides,
|
|
158
|
+
* which is what an offline client can know. Passing the gateway's list narrows it — the client
|
|
159
|
+
* never offers a chain the gateway does not serve.
|
|
160
|
+
*/
|
|
161
|
+
export declare function chainAvailability(chain: string | number, configured: readonly string[], served?: readonly ServedChain[]): ChainAvailability;
|
|
162
|
+
/**
|
|
163
|
+
* The chains to offer: configured ∩ served, in catalogue order.
|
|
164
|
+
*
|
|
165
|
+
* `served` undefined means the gateway was not consulted, and the configured set is returned.
|
|
166
|
+
*/
|
|
167
|
+
export declare function resolveEnabledChains(configured?: readonly string[], served?: readonly ServedChain[]): ChainCatalogueEntry[];
|
|
168
|
+
/** One balance row as the portfolio and identity endpoints report it. */
|
|
169
|
+
export interface BalanceRow {
|
|
170
|
+
token?: string;
|
|
171
|
+
balance: string;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* What the reported balances say about the gas on one chain account.
|
|
175
|
+
*
|
|
176
|
+
* - `funded` / `empty`: the native row was found and read.
|
|
177
|
+
* - `no-balances`: nothing was reported for the account (not yet deployed, or not yet indexed).
|
|
178
|
+
* - `unknown-native`: the catalogue does not know this chain's gas token, so no row can be
|
|
179
|
+
* identified as the gas — refused by name rather than guessed.
|
|
180
|
+
* - `native-not-reported`: rows were reported, but none is the chain's gas token (e.g. an `ETH`
|
|
181
|
+
* row on a chain whose gas is `TEL`). Treating any of them as gas would be reading the wrong
|
|
182
|
+
* number.
|
|
183
|
+
* - `unreadable`: the native row's balance is not a number (the gateway reports `unavailable` when
|
|
184
|
+
* its balance lookup failed).
|
|
185
|
+
*/
|
|
186
|
+
export type NativeBalanceReading = {
|
|
187
|
+
state: 'funded';
|
|
188
|
+
symbol: string;
|
|
189
|
+
balance: string;
|
|
190
|
+
} | {
|
|
191
|
+
state: 'empty';
|
|
192
|
+
symbol: string;
|
|
193
|
+
balance: string;
|
|
194
|
+
} | {
|
|
195
|
+
state: 'no-balances';
|
|
196
|
+
} | {
|
|
197
|
+
state: 'unknown-native';
|
|
198
|
+
chain: string;
|
|
199
|
+
} | {
|
|
200
|
+
state: 'native-not-reported';
|
|
201
|
+
chain: string;
|
|
202
|
+
symbol: string;
|
|
203
|
+
reported: string[];
|
|
204
|
+
} | {
|
|
205
|
+
state: 'unreadable';
|
|
206
|
+
symbol: string;
|
|
207
|
+
balance: string;
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Find and read the native (gas) balance among an account's reported balance rows.
|
|
211
|
+
*
|
|
212
|
+
* A row is the native one when its token is the catalogue's symbol for the chain, or is reported
|
|
213
|
+
* without a token / as `native` (how the gateway marks a native row it did not name).
|
|
214
|
+
*/
|
|
215
|
+
export declare function readNativeBalance(chain: string | number, balances: readonly BalanceRow[] | undefined | null): NativeBalanceReading;
|
|
216
|
+
/** A sentence naming why the gas on `chain` could not be read, for an unverifiable reading. */
|
|
217
|
+
export declare function describeUnverifiable(chain: string, reading: NativeBalanceReading): string | undefined;
|
|
218
|
+
//# sourceMappingURL=chains.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../src/chains.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,MAAM,YAA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AAE,KAAK,EAAE,gBAAgB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,KAAK,EAAE,qBAAqB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,GACnF;IAAE,KAAK,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7D;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,QAAQ,EAAE,SAAS,UAAU,EAAE,GAAG,SAAS,GAAG,IAAI,GACjD,oBAAoB,CAkBtB;AAED,+FAA+F;AAC/F,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,GAAG,MAAM,GAAG,SAAS,CAYrG"}
|
package/dist/chains.js
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chain catalogue: the one place this SDK, the CLI and the MCP server learn what a chain IS.
|
|
3
|
+
*
|
|
4
|
+
* Before this file the same facts lived in five tables — the CLI's supported list, its alias map,
|
|
5
|
+
* its numeric-id map, its block-time table and its faucet table, plus two copies of a numeric-id
|
|
6
|
+
* map in the SDK — and they had already drifted (the SDK knew five chains, the CLI three). Every
|
|
7
|
+
* native-balance check also assumed the gas token was called `ETH`, which on a chain whose gas is
|
|
8
|
+
* not ETH made the funding guards pass without looking. Each of those is now derived from here.
|
|
9
|
+
*
|
|
10
|
+
* **What this table is, and what it is not.**
|
|
11
|
+
*
|
|
12
|
+
* - It is static on purpose. Normalizing a numeric `chain_id`, naming the gas token, estimating a
|
|
13
|
+
* wait and validating a flag must all work offline and on a first run.
|
|
14
|
+
* - It does NOT decide what is enabled on its own. A chain is offered only when it is enabled in
|
|
15
|
+
* configuration AND the gateway serves it (`GET /v1/chains`): see {@link resolveEnabledChains}.
|
|
16
|
+
* The catalogue's `enabledByDefault` is only the configuration default.
|
|
17
|
+
* - A `retired` entry is kept for reading: an older gateway may still return its numeric id in a
|
|
18
|
+
* portfolio, and dropping it would make that row unrecognisable. A retired chain is never
|
|
19
|
+
* offered and cannot be enabled.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Every chain this SDK knows. Order is the order chains are listed to a person.
|
|
23
|
+
*
|
|
24
|
+
* Facts verified 2026-10-05 against chainid.network and, for Telcoin Adiri, against the chain's
|
|
25
|
+
* own RPC (`eth_chainId` = 0x7e1). Adiri's block cadence was measured over its last 6000 blocks:
|
|
26
|
+
* blocks appear only when there is a transaction, and active blocks cluster 7–16 s apart.
|
|
27
|
+
*/
|
|
28
|
+
export const CHAIN_CATALOGUE = Object.freeze([
|
|
29
|
+
{
|
|
30
|
+
slug: 'ethereum-sepolia',
|
|
31
|
+
chainId: 11155111,
|
|
32
|
+
displayName: 'Ethereum Sepolia',
|
|
33
|
+
environment: 'testnet',
|
|
34
|
+
nativeSymbol: 'ETH',
|
|
35
|
+
nativeDecimals: 18,
|
|
36
|
+
blockSeconds: 12,
|
|
37
|
+
blocksOnlyWithTraffic: false,
|
|
38
|
+
faucet: 'https://sepoliafaucet.com',
|
|
39
|
+
gasReserve: '0.001',
|
|
40
|
+
aliases: ['eth', 'ethereum', 'sepolia', 'eth-sepolia', 'mainnet'],
|
|
41
|
+
support: 'live',
|
|
42
|
+
enabledByDefault: true,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
slug: 'base-sepolia',
|
|
46
|
+
chainId: 84532,
|
|
47
|
+
displayName: 'Base Sepolia',
|
|
48
|
+
environment: 'testnet',
|
|
49
|
+
nativeSymbol: 'ETH',
|
|
50
|
+
nativeDecimals: 18,
|
|
51
|
+
blockSeconds: 2,
|
|
52
|
+
blocksOnlyWithTraffic: false,
|
|
53
|
+
faucet: 'https://www.alchemy.com/faucets/base-sepolia',
|
|
54
|
+
gasReserve: '0.0001',
|
|
55
|
+
aliases: ['base', 'basesepolia'],
|
|
56
|
+
support: 'live',
|
|
57
|
+
enabledByDefault: true,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
slug: 'arbitrum-sepolia',
|
|
61
|
+
chainId: 421614,
|
|
62
|
+
displayName: 'Arbitrum Sepolia',
|
|
63
|
+
environment: 'testnet',
|
|
64
|
+
nativeSymbol: 'ETH',
|
|
65
|
+
nativeDecimals: 18,
|
|
66
|
+
blockSeconds: 0.25,
|
|
67
|
+
blocksOnlyWithTraffic: false,
|
|
68
|
+
faucet: 'https://www.alchemy.com/faucets/arbitrum-sepolia',
|
|
69
|
+
gasReserve: '0.0001',
|
|
70
|
+
aliases: ['arb', 'arbitrum', 'arb-sepolia', 'arbsepolia'],
|
|
71
|
+
support: 'live',
|
|
72
|
+
enabledByDefault: true,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
// Telcoin Network's testnet. Gas is TEL, not ETH. Off until configuration enables it AND the
|
|
76
|
+
// gateway serves it.
|
|
77
|
+
slug: 'telcoin-adiri',
|
|
78
|
+
chainId: 2017,
|
|
79
|
+
displayName: 'Telcoin Adiri (testnet)',
|
|
80
|
+
environment: 'testnet',
|
|
81
|
+
nativeSymbol: 'TEL',
|
|
82
|
+
nativeDecimals: 18,
|
|
83
|
+
blockSeconds: 7,
|
|
84
|
+
blocksOnlyWithTraffic: true,
|
|
85
|
+
faucet: 'https://www.telcoin.network/faucet',
|
|
86
|
+
aliases: ['adiri', 'telcoin', 'tel', 'telcoin-testnet', 'telcoin-network'],
|
|
87
|
+
support: 'opt-in',
|
|
88
|
+
enabledByDefault: false,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
slug: 'optimism-sepolia',
|
|
92
|
+
chainId: 11155420,
|
|
93
|
+
displayName: 'OP Sepolia',
|
|
94
|
+
environment: 'testnet',
|
|
95
|
+
nativeSymbol: 'ETH',
|
|
96
|
+
nativeDecimals: 18,
|
|
97
|
+
blockSeconds: 2,
|
|
98
|
+
blocksOnlyWithTraffic: false,
|
|
99
|
+
aliases: [],
|
|
100
|
+
support: 'retired',
|
|
101
|
+
enabledByDefault: false,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
slug: 'polygon-amoy',
|
|
105
|
+
chainId: 80002,
|
|
106
|
+
displayName: 'Polygon Amoy',
|
|
107
|
+
environment: 'testnet',
|
|
108
|
+
nativeSymbol: 'POL',
|
|
109
|
+
nativeDecimals: 18,
|
|
110
|
+
blockSeconds: 2,
|
|
111
|
+
blocksOnlyWithTraffic: false,
|
|
112
|
+
aliases: [],
|
|
113
|
+
support: 'retired',
|
|
114
|
+
enabledByDefault: false,
|
|
115
|
+
},
|
|
116
|
+
].map((entry) => Object.freeze({ ...entry, aliases: Object.freeze([...entry.aliases]) })));
|
|
117
|
+
const BY_SLUG = new Map(CHAIN_CATALOGUE.map((c) => [c.slug, c]));
|
|
118
|
+
const BY_NUMERIC = new Map(CHAIN_CATALOGUE.map((c) => [String(c.chainId), c]));
|
|
119
|
+
/** The catalogue entry for a slug or a numeric chain id (either spelling), or undefined. */
|
|
120
|
+
export function chainInfo(value) {
|
|
121
|
+
if (value === null || value === undefined)
|
|
122
|
+
return undefined;
|
|
123
|
+
const raw = String(value).trim();
|
|
124
|
+
return BY_SLUG.get(raw) ?? BY_NUMERIC.get(raw);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Resolve whatever the gateway called a chain into its slug.
|
|
128
|
+
*
|
|
129
|
+
* A numeric id the catalogue knows becomes its slug. Anything else is returned unchanged (trimmed):
|
|
130
|
+
* a value we cannot map is still the best label we have for it, and inventing one would be worse.
|
|
131
|
+
*/
|
|
132
|
+
export function chainSlug(value) {
|
|
133
|
+
if (value === null || value === undefined)
|
|
134
|
+
return '';
|
|
135
|
+
const raw = String(value).trim();
|
|
136
|
+
return chainInfo(raw)?.slug ?? raw;
|
|
137
|
+
}
|
|
138
|
+
/** The native gas token's symbol, or undefined when the catalogue does not know the chain. */
|
|
139
|
+
export function nativeSymbolFor(chain) {
|
|
140
|
+
return chainInfo(chain)?.nativeSymbol;
|
|
141
|
+
}
|
|
142
|
+
export function faucetForChain(chain) {
|
|
143
|
+
return chainInfo(chain)?.faucet;
|
|
144
|
+
}
|
|
145
|
+
/** The gas reserve estimate for a chain, in whole native units, or undefined when the catalogue has none. See {@link ChainCatalogueEntry.gasReserve}. */
|
|
146
|
+
export function gasReserveFor(chain) {
|
|
147
|
+
return chainInfo(chain)?.gasReserve;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* A non-negative decimal string ("0.0021", "3", "1.50") to base units, exactly, or undefined when it is not one.
|
|
151
|
+
*
|
|
152
|
+
* Returns undefined rather than throwing: a balance the gateway reported as "unavailable" or an amount typed with too many decimals is
|
|
153
|
+
* a fact to report as unknown, not an exception to unwind. Integer arithmetic only - `Number("0.1") * 10 ** 18` is wrong for values a
|
|
154
|
+
* wallet shows exactly.
|
|
155
|
+
*/
|
|
156
|
+
export function parseUnits(value, decimals) {
|
|
157
|
+
if (value === null || value === undefined)
|
|
158
|
+
return undefined;
|
|
159
|
+
const m = /^(\d+)(?:\.(\d+))?$/.exec(String(value).trim());
|
|
160
|
+
if (!m)
|
|
161
|
+
return undefined;
|
|
162
|
+
const frac = m[2] ?? '';
|
|
163
|
+
if (frac.length > decimals)
|
|
164
|
+
return undefined;
|
|
165
|
+
return BigInt(m[1]) * 10n ** BigInt(decimals) + BigInt(frac.padEnd(decimals, '0') || '0');
|
|
166
|
+
}
|
|
167
|
+
/** Base units to a whole-unit decimal string with no trailing zeros ("1500000000000000" at 18 decimals -> "0.0015"). */
|
|
168
|
+
export function formatUnits(value, decimals) {
|
|
169
|
+
const negative = value < 0n;
|
|
170
|
+
const abs = negative ? -value : value;
|
|
171
|
+
const digits = abs.toString().padStart(decimals + 1, '0');
|
|
172
|
+
const whole = digits.slice(0, digits.length - decimals);
|
|
173
|
+
const frac = digits.slice(digits.length - decimals).replace(/0+$/, '');
|
|
174
|
+
return `${negative ? '-' : ''}${whole}${frac ? `.${frac}` : ''}`;
|
|
175
|
+
}
|
|
176
|
+
/** Slugs the catalogue enables when configuration says nothing: the live chains, in order. */
|
|
177
|
+
export function defaultEnabledChains() {
|
|
178
|
+
return CHAIN_CATALOGUE.filter((c) => c.enabledByDefault).map((c) => c.slug);
|
|
179
|
+
}
|
|
180
|
+
/** Slugs that configuration may enable: everything not retired. */
|
|
181
|
+
export function enablableChains() {
|
|
182
|
+
return CHAIN_CATALOGUE.filter((c) => c.support !== 'retired').map((c) => c.slug);
|
|
183
|
+
}
|
|
184
|
+
/** Thrown when configuration names a chain that cannot be enabled. */
|
|
185
|
+
export class ChainConfigurationError extends Error {
|
|
186
|
+
chain;
|
|
187
|
+
constructor(chain, message) {
|
|
188
|
+
super(message);
|
|
189
|
+
this.name = 'ChainConfigurationError';
|
|
190
|
+
this.chain = chain;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Parse an enabled-chains setting (e.g. `CERTEN_ENABLED_CHAINS`): a comma-separated list of slugs
|
|
195
|
+
* or numeric ids that REPLACES the default set.
|
|
196
|
+
*
|
|
197
|
+
* Unset or blank means the default set. Every name must be a catalogue chain that is not retired;
|
|
198
|
+
* anything else is refused by name — an enable switch that quietly ignored a typo would leave a
|
|
199
|
+
* person believing a chain was on.
|
|
200
|
+
*/
|
|
201
|
+
export function parseEnabledChains(setting) {
|
|
202
|
+
if (setting === undefined || setting === null || setting.trim() === '')
|
|
203
|
+
return defaultEnabledChains();
|
|
204
|
+
const out = [];
|
|
205
|
+
for (const part of setting.split(',').map((p) => p.trim()).filter((p) => p.length > 0)) {
|
|
206
|
+
const info = chainInfo(part);
|
|
207
|
+
if (!info) {
|
|
208
|
+
throw new ChainConfigurationError(part, `"${part}" is not a chain this client knows, so it cannot be enabled. Known: ${enablableChains().join(', ')}.`);
|
|
209
|
+
}
|
|
210
|
+
if (info.support === 'retired') {
|
|
211
|
+
throw new ChainConfigurationError(info.slug, `"${info.slug}" is retired and cannot be enabled. Enablable: ${enablableChains().join(', ')}.`);
|
|
212
|
+
}
|
|
213
|
+
if (!out.includes(info.slug))
|
|
214
|
+
out.push(info.slug);
|
|
215
|
+
}
|
|
216
|
+
return out;
|
|
217
|
+
}
|
|
218
|
+
/** Does the gateway serve this entry? Listed, and not explicitly disabled. */
|
|
219
|
+
export function gatewayServes(entry) {
|
|
220
|
+
return entry.enabled !== false;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Is `chain` available to use, given the configured set and (when known) what the gateway serves?
|
|
224
|
+
*
|
|
225
|
+
* `served` undefined means "the gateway has not been asked": the configured set alone decides,
|
|
226
|
+
* which is what an offline client can know. Passing the gateway's list narrows it — the client
|
|
227
|
+
* never offers a chain the gateway does not serve.
|
|
228
|
+
*/
|
|
229
|
+
export function chainAvailability(chain, configured, served) {
|
|
230
|
+
const info = chainInfo(chain);
|
|
231
|
+
if (!info)
|
|
232
|
+
return { state: 'unknown', chain: String(chain).trim() };
|
|
233
|
+
if (info.support === 'retired')
|
|
234
|
+
return { state: 'retired', chain: info };
|
|
235
|
+
if (!configured.includes(info.slug))
|
|
236
|
+
return { state: 'not-configured', chain: info };
|
|
237
|
+
if (served !== undefined) {
|
|
238
|
+
const entry = served.find((s) => chainSlug(s.id) === info.slug || (s.chainId !== null && s.chainId === info.chainId));
|
|
239
|
+
if (!entry)
|
|
240
|
+
return { state: 'unlisted', chain: info, code: 'unknown_chain' };
|
|
241
|
+
if (!gatewayServes(entry))
|
|
242
|
+
return { state: 'disabled', chain: info, code: 'chain_not_enabled' };
|
|
243
|
+
}
|
|
244
|
+
return { state: 'enabled', chain: info };
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* The chains to offer: configured ∩ served, in catalogue order.
|
|
248
|
+
*
|
|
249
|
+
* `served` undefined means the gateway was not consulted, and the configured set is returned.
|
|
250
|
+
*/
|
|
251
|
+
export function resolveEnabledChains(configured = defaultEnabledChains(), served) {
|
|
252
|
+
return CHAIN_CATALOGUE.filter((c) => chainAvailability(c.slug, configured, served).state === 'enabled');
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Find and read the native (gas) balance among an account's reported balance rows.
|
|
256
|
+
*
|
|
257
|
+
* A row is the native one when its token is the catalogue's symbol for the chain, or is reported
|
|
258
|
+
* without a token / as `native` (how the gateway marks a native row it did not name).
|
|
259
|
+
*/
|
|
260
|
+
export function readNativeBalance(chain, balances) {
|
|
261
|
+
const symbol = nativeSymbolFor(chain);
|
|
262
|
+
if (symbol === undefined)
|
|
263
|
+
return { state: 'unknown-native', chain: chainSlug(chain) };
|
|
264
|
+
const rows = balances ?? [];
|
|
265
|
+
if (rows.length === 0)
|
|
266
|
+
return { state: 'no-balances' };
|
|
267
|
+
const native = rows.find((b) => !b.token || b.token === 'native' || b.token.toUpperCase() === symbol.toUpperCase());
|
|
268
|
+
if (!native) {
|
|
269
|
+
return {
|
|
270
|
+
state: 'native-not-reported',
|
|
271
|
+
chain: chainSlug(chain),
|
|
272
|
+
symbol,
|
|
273
|
+
reported: rows.map((b) => b.token ?? ''),
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
const n = Number(native.balance);
|
|
277
|
+
if (native.balance === '' || !Number.isFinite(n))
|
|
278
|
+
return { state: 'unreadable', symbol, balance: native.balance };
|
|
279
|
+
return n > 0 ? { state: 'funded', symbol, balance: native.balance } : { state: 'empty', symbol, balance: native.balance };
|
|
280
|
+
}
|
|
281
|
+
/** A sentence naming why the gas on `chain` could not be read, for an unverifiable reading. */
|
|
282
|
+
export function describeUnverifiable(chain, reading) {
|
|
283
|
+
switch (reading.state) {
|
|
284
|
+
case 'unknown-native':
|
|
285
|
+
return `this client does not know the native gas token of "${reading.chain}", so it cannot tell which balance pays for execution`;
|
|
286
|
+
case 'native-not-reported':
|
|
287
|
+
return `the gateway reported ${reading.reported.map((t) => t || '(unnamed)').join(', ')} on ${chain}, `
|
|
288
|
+
+ `but its gas token is ${reading.symbol}`;
|
|
289
|
+
case 'unreadable':
|
|
290
|
+
return `the gateway could not read the ${reading.symbol} balance on ${chain} (it reported "${reading.balance}")`;
|
|
291
|
+
default:
|
|
292
|
+
return undefined;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
//# sourceMappingURL=chains.js.map
|