@molpha/sdk 0.2.0-dev-20261005112114 → 0.2.0-dev-20261006113121

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/README.md CHANGED
@@ -60,8 +60,25 @@ The preimage is 141 bytes (32 + 32 + 32 + 4 + 1 + 8 + 32).
60
60
  pnpm add @molpha/sdk
61
61
  ```
62
62
 
63
+ For the pre-release channel (parity program + `dev-gateway`):
64
+
65
+ ```bash
66
+ pnpm add @molpha/sdk@dev
67
+ ```
68
+
63
69
  Runtime dependencies include `@solana/kit`, `@anchor-lang/core`, and `@noble/*`. `bn.js` is an optional peer dependency (used by the Solana / Anchor path).
64
70
 
71
+ ### npm tags and deployment defaults
72
+
73
+ Defaults are baked at publish time from `config/deployments.json` (`MOLPHA_SDK_PROFILE`). Override at runtime with `endpoints`, `programId`, and `idl`.
74
+
75
+ | npm dist-tag | Profile | Default gateway | Solana program | EVM / Starknet |
76
+ |---|---|---|---|---|
77
+ | `latest` | `stable` | `https://gateway.molpha.io/` | `MoLFGDpFoVnQgwbkTNScKPohCxhbfd61JjFrnotuwzh` | Documented CREATE2 / Sepolia addresses |
78
+ | `dev` | `dev` | `https://dev-gateway.molpha.io/` | `chivcFQgxzwkpLvW41PV431HQ4dYpaW3povQH3AdpQt` | Provisional until redeploy (`MOLPHA_DEV_VERIFIERS_PROVISIONAL`); falls back to stable addresses |
79
+
80
+ Inspect the active profile via `MOLPHA_SDK_PROFILE` and `MOLPHA_DEV_VERIFIERS_PROVISIONAL`. Local builds: `MOLPHA_SDK_PROFILE=stable pnpm build` or `MOLPHA_SDK_PROFILE=dev pnpm build` (default `dev`).
81
+
65
82
  | Import | Use |
66
83
  |---|---|
67
84
  | `@molpha/sdk` | Facade (`MolphaSDK`), `MolphaGateway`, `MolphaSolanaClient`, core hashing (`deriveSourceId`, `attestationMessageHash`, `hashRequestAuth`, `timestampSeconds`), EVM/Starknet helpers. Browser-safe; no `fs` in the main entry. |
@@ -175,7 +192,22 @@ nobody can pick a committee by picking a time.
175
192
  - The message the nodes sign is `keccak256(MOLPHA_MESSAGE_V1 || value || sourceId || u32be(registryVersion) || u8(quorum) || u64be(timestamp) || signersBitmap)`.
176
193
  - Chain clocks, epochs and `maxAge`/staleness are in **seconds**: compare with
177
194
  `timestampSeconds(payload.timestamp)` (floored `ts / 1000`). `timestampAgeSeconds(ts, nowSeconds)` saturates at 0.
178
- - A round that was already reserved for this consumer, or dispatched to the nodes, cannot run again in the same tick (HTTP 409), so a retry waits for the next one (`tickMs`, default 1000: set it to the gateway's `round.tick_ms`).
195
+ - A round that was already reserved for this consumer, or dispatched to the nodes, cannot run again in the same tick (HTTP 409), so a retry waits for the next one. `tickMs` defaults to the gateway's advertised `tickMs` (read once, on the first retry, from `GET /v1/info`), else 1000.
196
+
197
+ ### Retries and timeouts
198
+
199
+ `requestSignedData` makes up to `maxRetries` attempts (default 6) and chooses the wait before each by why the last one failed (`retryDelayMs`). Every wait reaches at least the next tick, then adds jitter so clients that failed together do not retry together:
200
+
201
+ | Last attempt | Wait before the next |
202
+ | --- | --- |
203
+ | 409 (this consumer already has a round for the source in this tick) | next tick, plus up to half a tick |
204
+ | 503 or 429 (gateway at capacity, or nodes unavailable) | the later of the next tick and the gateway's `Retry-After`, plus up to a tick |
205
+ | timeout, network error, other 5xx | capped exponential backoff (250 ms up to 5 s), half of it randomized |
206
+ | 400, 401, 402, 403 | none: terminal. 403 means the subscription is inactive or its round quota for the term is spent |
207
+
208
+ A 400 saying the `registryVersion` is not the current one (a cached context, or a registry roll between your read and the request) is the exception: the SDK reads the registry afresh and retries once, without spending an attempt.
209
+
210
+ `timeoutMs` defaults to 35 s, above the gateway's own wait for a round (`roundTimeoutSeconds` in `/v1/info`, 30 s by default). A shorter timeout abandons a round the gateway is still running, and the retry then starts another. A source that cannot be fetched is reported as soon as enough nodes have failed (usually well under a second), not after the wait.
179
211
  - Private API secrets are encrypted for every node of the registry (the committee is unknown until the gateway stamps the round); the gateway forwards only the selected nodes' envelopes. `verifyNodeKeys` therefore authenticates all of them.
180
212
 
181
213
  ## Wallet
@@ -311,6 +343,10 @@ If the signed 32-byte value is the keccak digest of a longer preimage, pass `{ r
311
343
  const { signature, feed } = await sdk.solana.submitAttestation(result, { rawValue });
312
344
  ```
313
345
 
346
+ **Compute budget and fees.** The transaction requests `estimateSubmitComputeUnits(signers)` compute units (about `43k + 9.2k` per signer, plus 15% and 10k of margin: roughly 140k at 8 signers), not the 1.4M maximum the old default asked for, which mattered once a priority fee is priced per requested unit. Pass `{ computeUnitLimit }` to override it. No priority fee is attached unless you ask: `{ priorityFeeMicroLamports: 2_000 }` sets a price in micro-lamports per unit, and `{ priorityFeeMicroLamports: "auto" }` uses the 75th percentile of the fees recently paid by writers of that feed (capped at 1 lamport per unit; an unreadable fee market means no fee). Use one of them when submits are dropped under load.
347
+
348
+ **Many feeds.** The client caches what feeds sharing a registry version have in common: the registry read (30 s), each signer `Node` key (never changes) and the coalition key of each signer set, and concurrent submits share one read. Submitting a fleet of feeds therefore costs one registry read and one `Node` read per distinct signer, not per submit. A stale or duplicate round is refused by the program in about 17-20k compute units, before it verifies the signature.
349
+
314
350
  Then read the feed this wallet wrote for that source and quorum:
315
351
 
316
352
  ```ts
@@ -337,6 +373,27 @@ const result = await sdk.gateway.requestSignedData({ apiConfig, signaturesRequir
337
373
  const { signature, feed } = await sdk.solana.submitAttestation(result);
338
374
  ```
339
375
 
376
+ If the round succeeds but submitting fails, `requestAndSubmit` throws a `SubmitFailedError` that carries the signed attestation (`error.result`). The round already consumed quota and the attestation is valid, so submit `error.result` again instead of requesting a new round.
377
+
378
+ ### Many feeds
379
+
380
+ For a large set of feeds use `requestMany` (also exported from the package root) instead of looping over `requestAndSubmit`:
381
+
382
+ ```ts
383
+ import { requestMany } from "@molpha/sdk";
384
+
385
+ const results = await requestMany(sdk, feeds, {
386
+ spreadMs: 1000, // spread starts by source hash so feeds due together do not arrive together
387
+ request: { maxRetries: 6 },
388
+ });
389
+ for (const r of results) {
390
+ if (!r.ok) console.error(r.label, r.error);
391
+ else if (r.submitError) console.warn(r.label, "round ok, submit failed", r.submitError);
392
+ }
393
+ ```
394
+
395
+ It reads the registry inputs once for the whole batch; bounds concurrency, starting from half the gateway's advertised `maxInflightRounds` (at most 64, else 32) and adapting (halving on a busy answer, growing back while requests succeed); runs Solana submits on their own smaller limiter (`submitConcurrency`, default 8); never discards the signed attestation of a round whose submit failed; and returns one result per feed in input order, so a failing feed does not stop the others. Pass `submit: false` to collect attestations only. Throughput is limited by the submit path (one transaction per attestation) long before it is limited by the gateway.
396
+
340
397
  ### Fast requests with a cached context
341
398
 
342
399
  By default every `requestSignedData` call reads the on-chain registry up front
@@ -867,7 +924,7 @@ Known limitations:
867
924
  - production deployments should use authenticated gateway requests;
868
925
  - testnet verifier addresses may change between protocol releases.
869
926
 
870
- Solana paths such as selection bitmap and `submit_attestation` remaining-accounts resolution are aligned with the Molpha program version vendored in this repo (`MoLFnEbuMS5gWnXNfUMLAYSqRM3eQZKWRzjeMQfqbT3`, not yet deployed).
927
+ Solana paths such as selection bitmap and `submit_attestation` remaining-accounts resolution are aligned with the IDL selected by the active deployment profile (`idl/profiles/{stable,dev}/molpha.json`).
871
928
 
872
929
  ## Develop
873
930
 
@@ -34,10 +34,13 @@ function getAssociatedTokenAddressSync(mint, owner, tokenProgram = TOKEN_PROGRAM
34
34
  function setComputeUnitLimit(units) {
35
35
  return web3.ComputeBudgetProgram.setComputeUnitLimit({ units });
36
36
  }
37
+ function setComputeUnitPrice(microLamports) {
38
+ return web3.ComputeBudgetProgram.setComputeUnitPrice({ microLamports });
39
+ }
37
40
  function keypairFromSecretKey(secretKey) {
38
41
  return web3.Keypair.fromSecretKey(secretKey);
39
42
  }
40
43
 
41
- export { SYSTEM_PROGRAM_ADDRESS, TOKEN_PROGRAM_ADDRESS, addressBytes, addressFromBytes, findProgramAddressSync, getAssociatedTokenAddressSync, keypairFromSecretKey, setComputeUnitLimit, toPublicKey, toSolanaAddress };
42
- //# sourceMappingURL=chunk-2X22JY7Q.js.map
43
- //# sourceMappingURL=chunk-2X22JY7Q.js.map
44
+ export { SYSTEM_PROGRAM_ADDRESS, TOKEN_PROGRAM_ADDRESS, addressBytes, addressFromBytes, findProgramAddressSync, getAssociatedTokenAddressSync, keypairFromSecretKey, setComputeUnitLimit, setComputeUnitPrice, toPublicKey, toSolanaAddress };
45
+ //# sourceMappingURL=chunk-H77BBZOL.js.map
46
+ //# sourceMappingURL=chunk-H77BBZOL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/solana/kit.ts"],"names":[],"mappings":";;;;AAaO,IAAM,qBAAA,GAAwB,QAAQ,6CAA6C;AACnF,IAAM,gCAAA,GAAmC,OAAA;AAAA,EAC9C;AACF,CAAA;AACO,IAAM,sBAAA,GAAyB,QAAQ,kCAAkC;AAEhF,IAAM,iBAAiB,iBAAA,EAAkB;AACzC,IAAM,iBAAiB,iBAAA,EAAkB;AAElC,SAAS,gBAAgB,KAAA,EAA+B;AAC7D,EAAA,OAAO,QAAQ,OAAO,KAAA,KAAU,WAAW,KAAA,GAAQ,KAAA,CAAM,UAAU,CAAA;AACrE;AAEO,SAAS,YAAY,KAAA,EAA2D;AACrF,EAAA,OAAO,iBAAiB,IAAA,CAAK,SAAA,GAAY,QAAQ,IAAI,IAAA,CAAK,UAAU,KAAK,CAAA;AAC3E;AAEO,SAAS,aAAa,KAAA,EAAkC;AAC7D,EAAA,OAAO,WAAW,IAAA,CAAK,cAAA,CAAe,OAAO,eAAA,CAAgB,KAAK,CAAC,CAAC,CAAA;AACtE;AAGO,SAAS,iBAAiB,KAAA,EAA4B;AAC3D,EAAA,OAAO,cAAA,CAAe,OAAO,KAAK,CAAA;AACpC;AAEO,SAAS,sBAAA,CACd,OACA,cAAA,EACS;AACT,EAAA,MAAM,CAAC,GAAG,CAAA,GAAI,IAAA,CAAK,UAAU,sBAAA,CAAuB,KAAA,EAAO,WAAA,CAAY,cAAc,CAAC,CAAA;AACtF,EAAA,OAAO,gBAAgB,GAAG,CAAA;AAC5B;AAUO,SAAS,6BAAA,CACd,IAAA,EACA,KAAA,EACA,YAAA,GAA8B,qBAAA,EACrB;AACT,EAAA,OAAO,sBAAA;AAAA,IACL,CAAC,aAAa,KAAK,CAAA,EAAG,aAAa,YAAY,CAAA,EAAG,YAAA,CAAa,IAAI,CAAC,CAAA;AAAA,IACpE;AAAA,GACF;AACF;AAEO,SAAS,oBAAoB,KAAA,EAAkC;AACpE,EAAA,OAAO,IAAA,CAAK,oBAAA,CAAqB,mBAAA,CAAoB,EAAE,OAAO,CAAA;AAChE;AAEO,SAAS,oBAAoB,aAAA,EAA0C;AAC5E,EAAA,OAAO,IAAA,CAAK,oBAAA,CAAqB,mBAAA,CAAoB,EAAE,eAAe,CAAA;AACxE;AAEO,SAAS,qBAAqB,SAAA,EAAsC;AACzE,EAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,SAAS,CAAA;AAC7C","file":"chunk-H77BBZOL.js","sourcesContent":["import { web3 } from \"@anchor-lang/core\";\nimport { address, getAddressDecoder, getAddressEncoder, type Address } from \"@solana/kit\";\n\nexport type SolanaAddress = Address | string | InstanceType<typeof web3.PublicKey>;\nexport type SolanaConnection = InstanceType<typeof web3.Connection>;\nexport type SolanaKeypair = InstanceType<typeof web3.Keypair>;\nexport type SolanaInstruction = InstanceType<typeof web3.TransactionInstruction>;\nexport type SolanaAccountMeta = {\n pubkey: InstanceType<typeof web3.PublicKey>;\n isSigner: boolean;\n isWritable: boolean;\n};\n\nexport const TOKEN_PROGRAM_ADDRESS = address(\"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA\");\nexport const ASSOCIATED_TOKEN_PROGRAM_ADDRESS = address(\n \"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL\",\n);\nexport const SYSTEM_PROGRAM_ADDRESS = address(\"11111111111111111111111111111111\");\n\nconst addressEncoder = getAddressEncoder();\nconst addressDecoder = getAddressDecoder();\n\nexport function toSolanaAddress(value: SolanaAddress): Address {\n return address(typeof value === \"string\" ? value : value.toBase58());\n}\n\nexport function toPublicKey(value: SolanaAddress): InstanceType<typeof web3.PublicKey> {\n return value instanceof web3.PublicKey ? value : new web3.PublicKey(value);\n}\n\nexport function addressBytes(value: SolanaAddress): Uint8Array {\n return Uint8Array.from(addressEncoder.encode(toSolanaAddress(value)));\n}\n\n/** Base58 `Address` from 32 raw bytes (e.g. a `Registry.nodes[i]` entry). */\nexport function addressFromBytes(bytes: Uint8Array): Address {\n return addressDecoder.decode(bytes);\n}\n\nexport function findProgramAddressSync(\n seeds: Uint8Array[],\n programAddress: SolanaAddress,\n): Address {\n const [pda] = web3.PublicKey.findProgramAddressSync(seeds, toPublicKey(programAddress));\n return toSolanaAddress(pda);\n}\n\nexport function findProgramPublicKeySync(\n seeds: Uint8Array[],\n programAddress: SolanaAddress,\n): InstanceType<typeof web3.PublicKey> {\n const [pda] = web3.PublicKey.findProgramAddressSync(seeds, toPublicKey(programAddress));\n return pda;\n}\n\nexport function getAssociatedTokenAddressSync(\n mint: SolanaAddress,\n owner: SolanaAddress,\n tokenProgram: SolanaAddress = TOKEN_PROGRAM_ADDRESS,\n): Address {\n return findProgramAddressSync(\n [addressBytes(owner), addressBytes(tokenProgram), addressBytes(mint)],\n ASSOCIATED_TOKEN_PROGRAM_ADDRESS,\n );\n}\n\nexport function setComputeUnitLimit(units: number): SolanaInstruction {\n return web3.ComputeBudgetProgram.setComputeUnitLimit({ units });\n}\n\nexport function setComputeUnitPrice(microLamports: number): SolanaInstruction {\n return web3.ComputeBudgetProgram.setComputeUnitPrice({ microLamports });\n}\n\nexport function keypairFromSecretKey(secretKey: Uint8Array): SolanaKeypair {\n return web3.Keypair.fromSecretKey(secretKey);\n}\n\nexport function generateKeypair(): SolanaKeypair {\n return web3.Keypair.generate();\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,22 @@
1
1
  import { Address } from '@solana/kit';
2
2
  import { Wallet, Idl, AnchorProvider } from '@anchor-lang/core';
3
- import { U as UpstreamQuote, A as APIConfig, a as AssetDomain, b as UpstreamTerms, E as EvmSigner, R as RegistrySelectionConfig, S as Signer, N as NodeKeyVerifier, c as Node, d as NodesInfo, e as SourcePaymentOptions, f as Attestation, g as SolanaAccountMeta, h as SolanaConnection, i as SolanaAddress, j as NodeKeyVerifierArgs, k as AggregationConfig, M as MolphaWallet } from './wallet-LqCFWwV4.js';
4
- export { l as AttestationPayload, m as EncKeyBundle, n as NumericConfig, o as RegistryInfo, p as SchnorrSignature, q as gatewaySignerFromWallet, s as signerFromKeypair } from './wallet-LqCFWwV4.js';
3
+ import { U as UpstreamQuote, A as APIConfig, a as AssetDomain, b as UpstreamTerms, E as EvmSigner, S as Signer, c as SourcePaymentOptions, R as RegistrySelectionConfig, N as Node, d as NodeKeyVerifier, e as NodesInfo, f as Attestation, g as SolanaAccountMeta, h as SolanaConnection, i as SolanaAddress, j as NodeKeyVerifierArgs, k as AggregationConfig, M as MolphaWallet } from './wallet--IGHoCtG.js';
4
+ export { l as AttestationPayload, m as EncKeyBundle, n as NumericConfig, o as RegistryInfo, p as SchnorrSignature, q as gatewaySignerFromWallet, s as signerFromKeypair } from './wallet--IGHoCtG.js';
5
5
  import BN from 'bn.js';
6
6
 
7
+ /**
8
+ * GENERATED by `scripts/select-profile.ts` — do not edit.
9
+ * Profile: dev
10
+ * EVM/Starknet verifier addresses are unset until the Attestation-interface redeploy. Codegen falls back to stable addresses and sets MOLPHA_DEV_VERIFIERS_PROVISIONAL.
11
+ */
12
+ declare const MOLPHA_SDK_PROFILE: "dev";
13
+ declare const DEFAULT_GATEWAY_ENDPOINT = "https://dev-gateway.molpha.io/";
14
+ declare const MOLPHA_PROGRAM_ID = "chivcFQgxzwkpLvW41PV431HQ4dYpaW3povQH3AdpQt";
15
+ declare const MOLPHA_VERIFIER_ADDRESS: "0xE1fd792b7E54e0C8F0Cd1c8055E446ff36d233eB";
16
+ declare const MOLPHA_VERIFIER_STARKNET_SEPOLIA: "0x0378df4dbecf8f0c7daa801282932f7011c7a5e5773bab9eaf68f5fa5e7530ef";
17
+ /** True when the active profile has unset EVM/Starknet addresses (dev falls back to stable). */
18
+ declare const MOLPHA_DEV_VERIFIERS_PROVISIONAL: true;
19
+
7
20
  /**
8
21
  * Gateway on-chain identity. The request-auth hash binds the Gateway PDA
9
22
  * (`["molpha_gateway", gatewayAuthority]`), so the client must know which gateway it is
@@ -27,6 +40,12 @@ interface GatewayInfo {
27
40
  gatewayAuthority: string;
28
41
  /** Program id the gateway settles against; must match the client's when present. */
29
42
  programId?: string;
43
+ /** The gateway's round timestamp grid in milliseconds (`round.tick_ms`), when advertised. */
44
+ tickMs?: number;
45
+ /** Longest the gateway waits for a round, in seconds (`node.agg_wait_seconds`), when advertised. */
46
+ roundTimeoutSeconds?: number;
47
+ /** Rounds the gateway runs at once (`limits.max_inflight_rounds`); 0 or absent: not advertised. */
48
+ maxInflightRounds?: number;
30
49
  }
31
50
  declare function normalizeEndpoint(input: GatewayEndpointInput): GatewayEndpoint;
32
51
  /** 32-byte form of a base58 address. */
@@ -145,14 +164,23 @@ interface RequestSignedDataOptions {
145
164
  sourcePayment?: SourcePaymentOptions;
146
165
  /** Max accepted value age in seconds. Default 60. */
147
166
  maxAge?: number;
148
- /** Max attempts; each retry waits for a later gateway tick. Default 15. */
167
+ /**
168
+ * Max attempts. Each retry waits for a later gateway tick, plus jitter, and for longer after a
169
+ * busy answer (`Retry-After`) or a failure that is not a conflict (capped exponential backoff);
170
+ * see {@link retryDelayMs}. Default {@link DEFAULT_MAX_RETRIES}.
171
+ */
149
172
  maxRetries?: number;
150
173
  /**
151
174
  * The gateway's tick grid in milliseconds (its `round.tick_ms`). A retry waits for the start of
152
- * the next tick so it is a new round, not a duplicate of the last. Default 1000.
175
+ * the next tick so it is a new round, not a duplicate of the last. Default: the gateway's
176
+ * advertised `tickMs` (read once, on the first retry), else 1000.
153
177
  */
154
178
  tickMs?: number;
155
- /** Per-request timeout in ms. Default 5000. */
179
+ /**
180
+ * Per-request timeout in ms. Default {@link DEFAULT_ROUND_TIMEOUT_MS}, above the gateway's own
181
+ * wait for a round: a shorter timeout abandons rounds the gateway is still running and the retry
182
+ * then starts another.
183
+ */
156
184
  timeoutMs?: number;
157
185
  /**
158
186
  * Pre-fetched round inputs. Any field present here skips its network/on-chain
@@ -198,6 +226,8 @@ interface MolphaGatewayOptions {
198
226
  * may use gateway-provided node keys without authentication. Defaults to false.
199
227
  */
200
228
  allowUnverifiedNodeKeysForPrivateApi?: boolean;
229
+ /** Source of randomness in [0, 1) for retry jitter; defaults to `Math.random` (tests only). */
230
+ random?: () => number;
201
231
  }
202
232
  /**
203
233
  * The slow-changing inputs a `requestSignedData` round binds to. Fetch once with
@@ -209,8 +239,41 @@ interface RoundContext extends RegistrySelectionConfig {
209
239
  }
210
240
  /** Milliseconds from `nowMs` to the start of the next tick, plus a millisecond of margin. */
211
241
  declare function msUntilNextTick(nowMs: number, tickMs: number): number;
212
- /** Default gateway base URL when `endpoints` is omitted. */
213
- declare const DEFAULT_GATEWAY_ENDPOINT = "https://dev-gateway.molpha.io/";
242
+ /**
243
+ * Default per-request timeout: above the gateway's own wait for a round (`node.agg_wait_seconds`,
244
+ * 30 s by default), so the client does not abandon a round the gateway is still running and then
245
+ * start a second one. A gateway advertises its value as `roundTimeoutSeconds` in `GET /v1/info`.
246
+ */
247
+ declare const DEFAULT_ROUND_TIMEOUT_MS = 35000;
248
+ /** Default number of attempts. */
249
+ declare const DEFAULT_MAX_RETRIES = 6;
250
+ /**
251
+ * Why an attempt failed, as far as it decides how long to wait before the next one:
252
+ * - `conflict`: HTTP 409, this consumer already has a round for the source in this tick;
253
+ * - `busy`: HTTP 503 or 429, the gateway is at capacity or a node set is unavailable, optionally
254
+ * with the gateway's `Retry-After`;
255
+ * - `error`: anything else that may be transient (timeout, network, other 5xx).
256
+ */
257
+ type RetryCause = {
258
+ kind: "conflict";
259
+ } | {
260
+ kind: "busy";
261
+ retryAfterMs?: number;
262
+ } | {
263
+ kind: "error";
264
+ };
265
+ /**
266
+ * How long to wait before the next attempt, in ms. Every delay reaches at least the start of the
267
+ * next tick (a retry inside the tick that just failed would be a duplicate round), then adds jitter
268
+ * so clients that failed together do not retry together:
269
+ * - conflict: the next tick plus up to half a tick;
270
+ * - busy: the later of the next tick and the gateway's `Retry-After` (a tick if absent), plus up to
271
+ * a tick;
272
+ * - error: capped exponential backoff (250 ms, 500 ms, ... 5 s) with half of it randomized.
273
+ * `failures` is the number of attempts that have failed so far (1 after the first).
274
+ */
275
+ declare function retryDelayMs(cause: RetryCause, failures: number, nowMs: number, tickMs: number, random?: () => number): number;
276
+
214
277
  /** Thrown for terminal gateway errors (400/401) — never retried. */
215
278
  declare class GatewayError extends Error {
216
279
  readonly status?: number | undefined;
@@ -229,12 +292,17 @@ declare class MolphaGateway {
229
292
  private readonly programIdBytes;
230
293
  /** Gateway PDA per endpoint URL; resolved once per client lifetime. */
231
294
  private readonly gatewayPdas;
295
+ /** Advertised timing per endpoint URL, read lazily on the first retry. */
296
+ private readonly advertisedInfo;
297
+ private readonly random;
232
298
  constructor(endpoints?: GatewayEndpointInput | GatewayEndpointInput[], getRegistrySelectionConfig?: () => Promise<RegistrySelectionConfig>, defaultSigner?: Signer,
233
299
  /**
234
300
  * Either a default subscription owner (base58) or gateway options. A string is the
235
301
  * shorthand for `{ defaultSubscriptionOwner }` used by standalone callers/tests.
236
302
  */
237
303
  defaultSubscriptionOwnerOrOptions?: string | MolphaGatewayOptions, defaultConsumerAuthority?: string);
304
+ /** The configured gateway base URLs, in failover order. */
305
+ endpointUrls(): string[];
238
306
  /** Tries endpoints in order; returns the first node list it can fetch. */
239
307
  getNodes(): Promise<Node[]>;
240
308
  /**
@@ -302,6 +370,12 @@ declare class MolphaGateway {
302
370
  * encryption) or when nothing else can tell us the node count.
303
371
  */
304
372
  private resolveContext;
373
+ /**
374
+ * The gateway's advertised tick grid, read once per endpoint and only when a retry needs it. Any
375
+ * failure (an old gateway without `/v1/info`, a timeout) means "not advertised", so the caller
376
+ * falls back to the default; a failure is not cached.
377
+ */
378
+ private advertisedTickMs;
305
379
  /** Gateway PDA bytes for an endpoint, cached per URL. A failed lookup is not cached. */
306
380
  private resolveGatewayPda;
307
381
  private lookupGatewayPda;
@@ -394,6 +468,17 @@ declare function planIdFromVariant(variant: Record<string, unknown>): PlanId;
394
468
  * `Program` over the vendored IDL (program `3d01170`, "Epoch settlements").
395
469
  */
396
470
 
471
+ /**
472
+ * Compute units to request for a `submit_attestation` carrying `signerCount` signatures.
473
+ *
474
+ * The program's LiteSVM benchmark measures the whole transaction at about `43k + 9.1k` units per
475
+ * signer (119k at 8 signers, 155k at 12, 208k at 18), so the old flat 1.4M request was 7-10 times
476
+ * what a typical aggregate uses. That matters once a priority fee is attached, because it is
477
+ * priced per requested unit, and for how the scheduler packs blocks. The estimate adds 15% and a
478
+ * fixed 10k: the program's selection check costs a little more on some registries than the
479
+ * benchmark's, and a limit that is hit fails the transaction for good.
480
+ */
481
+ declare function estimateSubmitComputeUnits(signerCount: number): number;
397
482
  type Commitment$1 = NonNullable<ConstructorParameters<typeof AnchorProvider>[2]>["commitment"];
398
483
  interface SubscribeResult {
399
484
  signature: string;
@@ -478,7 +563,18 @@ interface SubmitAttestationArgs {
478
563
  };
479
564
  }
480
565
  interface SubmitAttestationOptions {
566
+ /**
567
+ * Compute-unit limit. Defaults to {@link estimateSubmitComputeUnits} for the aggregate's signer
568
+ * count, not the 1.4M maximum.
569
+ */
481
570
  computeUnitLimit?: number;
571
+ /**
572
+ * Priority fee in micro-lamports per compute unit. A number is used as given; `"auto"` takes the
573
+ * 75th percentile of the fees recently paid by transactions that wrote the feed, capped at 1
574
+ * lamport per unit. Omitted: no priority fee, which is right on a quiet cluster. Raise it (or
575
+ * use `"auto"`) when submits are dropped under load.
576
+ */
577
+ priorityFeeMicroLamports?: number | "auto";
482
578
  /**
483
579
  * Precomputed signer coalition key. When omitted, the client fetches signer `Node`
484
580
  * accounts and sums their secp256k1 keys ({@link computeCoalitionKey}).
@@ -501,6 +597,10 @@ declare class MolphaSolanaClient {
501
597
  private readonly program;
502
598
  private readonly provider;
503
599
  readonly programId: Address;
600
+ private readonly registryCache;
601
+ private readonly nodeKeyCache;
602
+ private readonly coalitionCache;
603
+ private priorityFeeCache?;
504
604
  private constructor();
505
605
  static create(opts: CreateClientOpts): MolphaSolanaClient;
506
606
  private get wallet();
@@ -568,8 +668,12 @@ declare class MolphaSolanaClient {
568
668
  * `keccak256(rawValue)`; {@link buildSubmitAttestationArgs} validates that before send.
569
669
  */
570
670
  submitAttestation(attestation: Attestation, opts?: SubmitAttestationOptions): Promise<SubmitResult>;
671
+ /** The registry for `version`, reused for {@link REGISTRY_CACHE_MS}. */
672
+ private fetchRegistryCached;
673
+ private resolvePriorityFee;
571
674
  /** Sum of the signers' keys, read from their on-chain `Node` accounts (one batched fetch). */
572
675
  private computeSignerCoalitionKey;
676
+ private sumSignerKeys;
573
677
  /**
574
678
  * Read the feed written by `submitter` (default: this wallet) for
575
679
  * `(sourceId, signaturesRequired)`, or `null` before its first submit.
@@ -651,13 +755,6 @@ declare function deriveSourceId(apiConfig: APIConfig): Uint8Array;
651
755
  /** Hex-encoded {@link deriveSourceId} (64 lowercase hex chars, no `0x`). */
652
756
  declare function deriveSourceIdString(apiConfig: APIConfig): string;
653
757
 
654
- /**
655
- * Protocol-wide constants that must stay in sync with the vendored IDL. Kept as plain
656
- * literals so gateway-only / browser bundles never pull in `idl/molpha.json`.
657
- */
658
- /** Molpha program id (`idl/molpha.json` → `address`). Asserted equal in `test/gateway-auth.test.ts`. */
659
- declare const MOLPHA_PROGRAM_ID = "chivcFQgxzwkpLvW41PV431HQ4dYpaW3povQH3AdpQt";
660
-
661
758
  declare const utf8: (s: string) => Uint8Array;
662
759
  declare const concatBytes: (...arrays: Uint8Array[]) => Uint8Array;
663
760
  /** Lower-case hex, no `0x` prefix. */
@@ -1057,11 +1154,14 @@ declare const MOLPHA_VERIFIER_ABI: readonly [{
1057
1154
  /**
1058
1155
  * Deployed Molpha verifier contract address on EVM chains.
1059
1156
  * Deployed via CREATE2 for the same address on every supported chain.
1157
+ *
1158
+ * Address comes from the active deployment profile (`config/deployments.json`).
1159
+ * When `MOLPHA_DEV_VERIFIERS_PROVISIONAL` is true, the value is a stable fallback
1160
+ * and should not be treated as the live Attestation-interface deployment.
1060
1161
  */
1162
+
1061
1163
  /** Supported EVM testnet identifiers (chain selection only). */
1062
1164
  type MolphaEvmNetwork = "evm-sepolia" | "arbitrum-sepolia" | "avalanche-fuji" | "bsc-testnet";
1063
- /** CREATE2 Molpha verifier address — identical on all supported EVM chains. */
1064
- declare const MOLPHA_VERIFIER_ADDRESS: "0xE1fd792b7E54e0C8F0Cd1c8055E446ff36d233eB";
1065
1165
 
1066
1166
  /** EIP-712 domain of the token contract that will settle the authorization. */
1067
1167
  interface Eip712Domain {
@@ -1198,11 +1298,14 @@ declare function parseEvmVerifyResult(result: string | {
1198
1298
 
1199
1299
  /**
1200
1300
  * Deployed Molpha verifier contract addresses on Starknet testnets.
1301
+ *
1302
+ * Address comes from the active deployment profile (`config/deployments.json`).
1303
+ * When `MOLPHA_DEV_VERIFIERS_PROVISIONAL` is true, the value is a stable fallback
1304
+ * and should not be treated as the live Attestation-interface deployment.
1201
1305
  */
1306
+
1202
1307
  /** Supported Starknet testnet identifiers. */
1203
1308
  type MolphaStarknetNetwork = "starknet-sepolia";
1204
- /** Deployed verifier address on Starknet Sepolia. */
1205
- declare const MOLPHA_VERIFIER_STARKNET_SEPOLIA: "0x0378df4dbecf8f0c7daa801282932f7011c7a5e5773bab9eaf68f5fa5e7530ef";
1206
1309
  /** Network id -> deployed verifier address. */
1207
1310
  declare const MOLPHA_VERIFIER_STARKNET_ADDRESSES: Record<MolphaStarknetNetwork, `0x${string}`>;
1208
1311
  /** Resolve the deployed verifier address for a supported Starknet network. */
@@ -1331,6 +1434,98 @@ declare const subscriptionPda: (owner: SolanaAddress, programId: SolanaAddress)
1331
1434
  */
1332
1435
  declare function feedPda(sourceId: Uint8Array, signaturesRequired: number, submitter: SolanaAddress, programId: SolanaAddress): Address;
1333
1436
 
1437
+ /**
1438
+ * Drive many feeds through the gateway (and optionally on to Solana) without overloading it.
1439
+ *
1440
+ * The consumer is the party that pushes updates and pays for them, so the cost and the burst
1441
+ * behaviour of a large set of feeds is the consumer's to control. {@link requestMany} does the parts
1442
+ * that matter at volume:
1443
+ *
1444
+ * - the registry inputs are read once and shared by every request, not once per feed;
1445
+ * - concurrency is bounded and adapts: it starts from the gateway's advertised capacity, halves
1446
+ * when the gateway answers busy (503/429) and creeps back up while requests succeed (AIMD);
1447
+ * - request starts are spread over a window by a hash of each feed's source id, so feeds that fall
1448
+ * due together do not arrive together, and the same feed always lands at the same offset;
1449
+ * - submitting to Solana runs on its own, smaller limiter, pipelined behind the requests;
1450
+ * - a failed submit never discards the signed attestation the gateway returned (and quota paid for).
1451
+ *
1452
+ * Each request still has the single-request retry policy (backoff with jitter, `Retry-After`, a stale
1453
+ * registry refreshed once; see {@link retryDelayMs}).
1454
+ */
1455
+
1456
+ /** One feed to update. */
1457
+ interface BulkFeed {
1458
+ apiConfig: APIConfig;
1459
+ signaturesRequired: number;
1460
+ /** Echoed in the result; for the caller's own bookkeeping. */
1461
+ label?: string;
1462
+ }
1463
+ interface BulkOptions {
1464
+ /**
1465
+ * Most gateway requests in flight. The limit adapts below this ceiling. Default: half the gateway's
1466
+ * advertised `maxInflightRounds` (at most 64), or 32 when it advertises none.
1467
+ */
1468
+ concurrency?: number;
1469
+ /**
1470
+ * Spread request starts over this many ms by a hash of the feed's source id. Feeds that are due on
1471
+ * the same tick otherwise arrive together and queue at the gateway. Default 0 (no spreading).
1472
+ */
1473
+ spreadMs?: number;
1474
+ /** Submit each attestation to Solana after its round. Default true. */
1475
+ submit?: boolean;
1476
+ /** Most Solana submits in flight. Default 8. */
1477
+ submitConcurrency?: number;
1478
+ /**
1479
+ * Options applied to every request (subscription owner, signer, `maxRetries`, `timeoutMs`, ...).
1480
+ * `apiConfig`, `signaturesRequired` and `context` are set per feed.
1481
+ */
1482
+ request?: Omit<RequestSignedDataOptions, "apiConfig" | "signaturesRequired" | "context">;
1483
+ /** Called as each feed finishes, in completion order. */
1484
+ onResult?: (result: BulkResult) => void;
1485
+ /** Stops starting new feeds; those already started finish. */
1486
+ signal?: AbortSignal;
1487
+ }
1488
+ interface BulkResult {
1489
+ /** Position in the input array. */
1490
+ index: number;
1491
+ label?: string;
1492
+ /** The gateway round succeeded (submitting is reported separately in `submitError`). */
1493
+ ok: boolean;
1494
+ /** The signed attestation, whenever the round succeeded, including when the submit failed. */
1495
+ attestation?: Attestation;
1496
+ /** Transaction signature and feed account, when submitted. */
1497
+ signature?: string;
1498
+ feedAddress?: Address;
1499
+ /** Why the round failed. */
1500
+ error?: unknown;
1501
+ /** Why submitting failed after a successful round; `attestation` is still valid. */
1502
+ submitError?: unknown;
1503
+ }
1504
+ /**
1505
+ * An adaptive concurrency limit: additive increase on success, multiplicative decrease on a busy
1506
+ * answer. Waiters are served in arrival order.
1507
+ */
1508
+ declare class AdaptiveLimiter {
1509
+ private readonly max;
1510
+ private readonly now;
1511
+ private limit_;
1512
+ private inFlight;
1513
+ private successes;
1514
+ private lastCut;
1515
+ private readonly waiters;
1516
+ constructor(initial: number, max: number, now?: () => number);
1517
+ get limit(): number;
1518
+ acquire(): Promise<void>;
1519
+ /** Release a slot. `busy` reports that the gateway answered at capacity. */
1520
+ release(outcome: "ok" | "busy" | "other"): void;
1521
+ }
1522
+ /** Deterministic start offset for a feed: the same source id always lands at the same point. */
1523
+ declare function spreadOffsetMs(sourceIdHex: string, spreadMs: number): number;
1524
+ /**
1525
+ * Update many feeds. Results are returned in input order; a feed that fails does not stop the others.
1526
+ */
1527
+ declare function requestMany(sdk: MolphaSDK, feeds: BulkFeed[], opts?: BulkOptions): Promise<BulkResult[]>;
1528
+
1334
1529
  /**
1335
1530
  * Vendored Molpha Anchor IDL (`target/idl/molpha.json` from the program repo).
1336
1531
  *
@@ -1368,6 +1563,20 @@ interface MolphaSDKOptions {
1368
1563
  idl?: Idl;
1369
1564
  commitment?: Commitment;
1370
1565
  }
1566
+ /**
1567
+ * Thrown by {@link MolphaSDK.requestAndSubmit} when the gateway round succeeded but submitting the
1568
+ * attestation to Solana failed. The round consumed subscription quota and the signed attestation is
1569
+ * valid, so it is carried here: submit `error.result` again (it stays valid until its freshness
1570
+ * window passes, and re-submitting it is safe) instead of requesting, and paying for, a new round.
1571
+ */
1572
+ declare class SubmitFailedError extends Error {
1573
+ /** The signed attestation the gateway returned. */
1574
+ readonly result: Attestation;
1575
+ readonly cause: unknown;
1576
+ constructor(
1577
+ /** The signed attestation the gateway returned. */
1578
+ result: Attestation, cause: unknown);
1579
+ }
1371
1580
  declare class MolphaSDK {
1372
1581
  readonly gateway: MolphaGateway;
1373
1582
  readonly solana: MolphaSolanaClient;
@@ -1383,4 +1592,4 @@ declare class MolphaSDK {
1383
1592
  }>;
1384
1593
  }
1385
1594
 
1386
- export { APIConfig, AggregationConfig, AggregationConfigError, AssetDomain, Attestation, type AttestationMessageFields, type BuildEvmVerifierArgsOptions, type BuildStarknetVerifierArgsOptions, type CoalitionKey, DEFAULT_GATEWAY_ENDPOINT, EIP712_DOMAIN_TYPEHASH, type Eip712Domain, type EvmAttestation, type EvmAttestationPayload, type EvmSchnorrSignature, EvmSigner, type EvmVerifierArgs, type EvmVerifyResult, type FeedAccount, type GatewayEndpoint, type GatewayEndpointInput, GatewayError, type GatewayInfo, INT256_MAX, INT256_MIN, MESSAGE_PREFIX, MIN_TOLERANCE_SIGNATURES, MOLPHA_IDL, MOLPHA_PROGRAM_ADDRESS, MOLPHA_PROGRAM_ID, MOLPHA_VERIFIER_ABI, MOLPHA_VERIFIER_ADDRESS, MOLPHA_VERIFIER_STARKNET_ADDRESSES, MOLPHA_VERIFIER_STARKNET_SEPOLIA, type MolphaEvmNetwork, MolphaGateway, type MolphaGatewayOptions, MolphaSDK, type MolphaSDKOptions, MolphaSolanaClient, type MolphaStarknetNetwork, MolphaWallet, Node, NodeKeyVerifier, NodeKeyVerifierArgs, NodesInfo, type PlanId, type PlanInfo, PlanType, REQUEST_AUTH_DOMAIN, RegistrySelectionConfig, type RegistryStateView, type RegistryView, type RequestAuthFields, type RequestSignedDataOptions, type RoundContext, SELECTION_WINDOW_MS, type Secp256k1KeyInput, Signer, SourcePaymentOptions, type StarknetAttestation, type StarknetAttestationPayload, type StarknetFeltLike, type StarknetSchnorrSignature, type StarknetVerifierArgs, type StarknetVerifyResult, type SubmitAttestationArgs, type SubmitAttestationOptions, type SubmitResult, type SubscribeResult, type SubscriptionInfo, TRANSFER_WITH_AUTHORIZATION_TYPEHASH, type TransferAuthorization, UpstreamPaymentRequiredError, UpstreamQuote, UpstreamTerms, VERIFY_CODES, type VerifyCode, type VerifyCodeName, addressToBytes, assertAggregationQuorum, attestationMessageHash, attestationMessageHashFromAttestation, base64ToBytes, bigIntFromBytesBe, bitmapBitSet, bitmapToIndices, buildEvmVerifierArgs, buildStarknetVerifierArgs, buildSubmitAttestationArgs, bytesToBase64, bytesToHex, bytesToHex0x, canonicalizeAPIConfig, canonicalizeAggregation, commitmentAddressToStarknetFelt, computeCoalitionKey, concatBytes, createEvmSignerFromPrivateKey, decodeInt256, deriveGatewayPda, deriveGatewayPdaAddress, deriveGroupBitmap, deriveSelectionBitmap, deriveSelectionSeed, deriveSourceId, deriveSourceIdString, domainSeparator, effectiveSelectionSize, eligibleSetSize, encodeEvmVerifyCalldata, encodeInt256, encodeInt256Decimal, encodeRequestAuth, encodeStarknetVerifyCalldata, ensureLength, evmAddressFromPrivateKey, feedPda, formatInt256Decimal, gatewayPda, getMolphaStarknetVerifierAddress, hashRequestAuth, hexToBytes, msUntilNextTick, nodePda, normalizeEndpoint, normalizeSecp256k1PublicKeyHex, parseEvmVerifyResult, parseGatewayInfo, parseStarknetVerifyResult, parseUpstreamQuote, planIdFromVariant, planPda, planVariant, probeSource, protocolConfigPda, registryPda, registryStatePda, resolveRemainingAccounts, secp256k1PublicKeyFromCoordinates, selectedIndices, signSourcePayments, signersBitmapToDecimal, signersBitmapToStarknetUint256, signersBitmapToUint256, subscriptionPda, timestampAgeSeconds, timestampSeconds, toChecksumAddress, toFixedBytes, toFixedHex, transferWithAuthorizationDigest, transferWithAuthorizationHash, u256beFromBigInt, u32be, u32le, u64be, u64le, u8, utf8, validateSuppliedTerms, verifyCodeName };
1595
+ export { APIConfig, AdaptiveLimiter, AggregationConfig, AggregationConfigError, AssetDomain, Attestation, type AttestationMessageFields, type BuildEvmVerifierArgsOptions, type BuildStarknetVerifierArgsOptions, type BulkFeed, type BulkOptions, type BulkResult, type CoalitionKey, DEFAULT_GATEWAY_ENDPOINT, DEFAULT_MAX_RETRIES, DEFAULT_ROUND_TIMEOUT_MS, EIP712_DOMAIN_TYPEHASH, type Eip712Domain, type EvmAttestation, type EvmAttestationPayload, type EvmSchnorrSignature, EvmSigner, type EvmVerifierArgs, type EvmVerifyResult, type FeedAccount, type GatewayEndpoint, type GatewayEndpointInput, GatewayError, type GatewayInfo, INT256_MAX, INT256_MIN, MESSAGE_PREFIX, MIN_TOLERANCE_SIGNATURES, MOLPHA_DEV_VERIFIERS_PROVISIONAL, MOLPHA_IDL, MOLPHA_PROGRAM_ADDRESS, MOLPHA_PROGRAM_ID, MOLPHA_SDK_PROFILE, MOLPHA_VERIFIER_ABI, MOLPHA_VERIFIER_ADDRESS, MOLPHA_VERIFIER_STARKNET_ADDRESSES, MOLPHA_VERIFIER_STARKNET_SEPOLIA, type MolphaEvmNetwork, MolphaGateway, type MolphaGatewayOptions, MolphaSDK, type MolphaSDKOptions, MolphaSolanaClient, type MolphaStarknetNetwork, MolphaWallet, Node, NodeKeyVerifier, NodeKeyVerifierArgs, NodesInfo, type PlanId, type PlanInfo, PlanType, REQUEST_AUTH_DOMAIN, RegistrySelectionConfig, type RegistryStateView, type RegistryView, type RequestAuthFields, type RequestSignedDataOptions, type RetryCause, type RoundContext, SELECTION_WINDOW_MS, type Secp256k1KeyInput, Signer, SourcePaymentOptions, type StarknetAttestation, type StarknetAttestationPayload, type StarknetFeltLike, type StarknetSchnorrSignature, type StarknetVerifierArgs, type StarknetVerifyResult, type SubmitAttestationArgs, type SubmitAttestationOptions, SubmitFailedError, type SubmitResult, type SubscribeResult, type SubscriptionInfo, TRANSFER_WITH_AUTHORIZATION_TYPEHASH, type TransferAuthorization, UpstreamPaymentRequiredError, UpstreamQuote, UpstreamTerms, VERIFY_CODES, type VerifyCode, type VerifyCodeName, addressToBytes, assertAggregationQuorum, attestationMessageHash, attestationMessageHashFromAttestation, base64ToBytes, bigIntFromBytesBe, bitmapBitSet, bitmapToIndices, buildEvmVerifierArgs, buildStarknetVerifierArgs, buildSubmitAttestationArgs, bytesToBase64, bytesToHex, bytesToHex0x, canonicalizeAPIConfig, canonicalizeAggregation, commitmentAddressToStarknetFelt, computeCoalitionKey, concatBytes, createEvmSignerFromPrivateKey, decodeInt256, deriveGatewayPda, deriveGatewayPdaAddress, deriveGroupBitmap, deriveSelectionBitmap, deriveSelectionSeed, deriveSourceId, deriveSourceIdString, domainSeparator, effectiveSelectionSize, eligibleSetSize, encodeEvmVerifyCalldata, encodeInt256, encodeInt256Decimal, encodeRequestAuth, encodeStarknetVerifyCalldata, ensureLength, estimateSubmitComputeUnits, evmAddressFromPrivateKey, feedPda, formatInt256Decimal, gatewayPda, getMolphaStarknetVerifierAddress, hashRequestAuth, hexToBytes, msUntilNextTick, nodePda, normalizeEndpoint, normalizeSecp256k1PublicKeyHex, parseEvmVerifyResult, parseGatewayInfo, parseStarknetVerifyResult, parseUpstreamQuote, planIdFromVariant, planPda, planVariant, probeSource, protocolConfigPda, registryPda, registryStatePda, requestMany, resolveRemainingAccounts, retryDelayMs, secp256k1PublicKeyFromCoordinates, selectedIndices, signSourcePayments, signersBitmapToDecimal, signersBitmapToStarknetUint256, signersBitmapToUint256, spreadOffsetMs, subscriptionPda, timestampAgeSeconds, timestampSeconds, toChecksumAddress, toFixedBytes, toFixedHex, transferWithAuthorizationDigest, transferWithAuthorizationHash, u256beFromBigInt, u32be, u32le, u64be, u64le, u8, utf8, validateSuppliedTerms, verifyCodeName };