veriq-client 0.1.0 → 0.1.2

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
@@ -72,7 +72,8 @@ const veriq = createVeriq({ url?, policy?, fetch?, timeoutMs?, debug? })
72
72
  | `capabilities()` | `Capabilities` | `veriq_getCapabilities` |
73
73
  | `transport(opts?)` | viem `Transport` | See below |
74
74
  | `withPolicy(policy)` | `VeriqClient` | New, immutable client |
75
- | `request(method, params?)` | `unknown` | Raw JSON-RPC to the engine |
75
+ | `request(method, params?)` | `unknown` | Raw JSON-RPC to the engine (`result` only) |
76
+ | `requestWithReceipt(method, params?)` | `{ result, receipt }` | Raw JSON-RPC plus the receipt the engine attaches to standard `eth_*` reads (top-level `veriq` member), Zod-checked; `receipt` is `undefined` for methods without one |
76
77
 
77
78
  ```ts
78
79
  type VerifiedResult<T> = {
@@ -111,6 +112,34 @@ import { presets } from 'veriq-client'
111
112
  const strict = veriq.withPolicy(presets.verifiedCompare)
112
113
  ```
113
114
 
115
+ ## Private reads (Anon-RPC)
116
+
117
+ `createPrivateReader` fetches each proof through an anonymizing `fetch` (e.g. Nox's
118
+ `AnonRpcWorker.fetch`), so providers never see your IP; the engine never contacts them.
119
+
120
+ ```ts
121
+ import { createPrivateReader, loadVerifier } from 'veriq-client'
122
+ import wasmUrl from 'veriq-client/verifier.wasm?url' // ~205 KB, ~78 KB gzip
123
+
124
+ const reader = createPrivateReader(veriq, {
125
+ fetch: nox.fetch,
126
+ network: 'nox',
127
+ providers: [{ label: 'ethpandaops', url: 'https://rpc.sepolia.ethpandaops.io' }],
128
+ lightClient, // optional: { finalized() } from Helios in the browser
129
+ verifier: () => loadVerifier(wasmUrl), // optional: check proofs in the browser first
130
+ })
131
+ const { value, receipt } = await reader.readStorage({ address, slot: '0x0' })
132
+ receipt.verification.verifierLocation // 'browser'
133
+ ```
134
+
135
+ - `lightClient`: its finalized block is the one read; the engine's `veriq_getRoot` must be the
136
+ same block, or the read fails with `RootMismatchError` (`ROOT_MISMATCH`, -32017).
137
+ - `verifier`: the engine's own Rust verifier as WebAssembly. A forged proof is rejected before
138
+ the engine is asked. If it fails to load, the engine verifies alone and the receipt says
139
+ `BROWSER_VERIFIER_UNAVAILABLE`.
140
+ - Both together: if the engine is unreachable, the read still returns a verified value with a
141
+ receipt made in the browser (`LOCAL_ONLY` warning, `requestId` starting `local-`).
142
+
114
143
  ## viem transport
115
144
 
116
145
  ```ts
@@ -124,7 +153,7 @@ const balance = await client.getBalance({ address, blockTag: 'finalized' })
124
153
  transport.lastReceipt?.verification.status // 'verified'
125
154
  ```
126
155
 
127
- `eth_getBalance` and `eth_getStorageAt` go through the verified path. Every other method is forwarded to the engine unchanged, and unsupported ones come back as `UnsupportedVerificationError`. In strict mode (the default when verification is `required`), block tags other than `"finalized"` throw before anything is sent. viem defaults to `latest`, so pass `blockTag: 'finalized'`. viem is an optional peer: the transport imports only its types.
156
+ `eth_getBalance` and `eth_getStorageAt` go through the verified path. Every other method is forwarded to the engine unchanged, and unsupported ones come back as `UnsupportedVerificationError`. The engine answers `eth_getTransactionCount` and `eth_getCode` at `"finalized"` with a proof too; their receipt arrives in the response's top-level `veriq` member, and the transport passes it to `lastReceipt` and `onReceipt` like any other. In strict mode (the default when verification is `required`), block tags other than `"finalized"` throw before anything is sent, for all four (`eth_getBalance`, `eth_getStorageAt`, `eth_getTransactionCount`, `eth_getCode`). viem defaults to `latest`, so pass `blockTag: 'finalized'`. viem is an optional peer: the transport imports only its types.
128
157
 
129
158
  ## React components
130
159
 
@@ -194,7 +223,8 @@ Every error extends `VeriqError { code, codeName, hint, data?, receiptId? }`. `S
194
223
 
195
224
  - **Finalized only.** A `verified` receipt means the value was proven against a finalized Sepolia state root that the engine's Helios light client authenticated from a pinned checkpoint. `latest` can't be verified and is refused under `required`.
196
225
  - **The SDK trusts the local engine.** It validates the receipt's shape, not the proof. Run the engine on your own machine. Anything that can impersonate `127.0.0.1:8547` can lie to the SDK.
197
- - **What is verified:** balances, and storage slots (account proof plus storage proof, including exclusion proofs for zero values).
226
+ - **What is verified:** balances, storage slots (account proof plus storage proof, including exclusion proofs for zero values), nonces (the proven account) and contract code (`keccak256(code)` against the proven `codeHash`).
227
+ - **Nonce and code have no first-class methods.** There is no `readNonce` / `readCode`: use the viem transport (`getTransactionCount` / `getCode` with `blockTag: 'finalized'`) or `requestWithReceipt('eth_getTransactionCount' | 'eth_getCode', [address, 'finalized'])`. You get the raw hex `result` (not a `bigint`) plus the receipt, and no `verified` / `attempts` shortcut: read `receipt.verification.status` and `receipt.routing.attempts`. These standard methods always run under `verifiedFinalized`: a client or transport policy is not sent with them (the JSON-RPC methods have no policy parameter), so `consistency: 'compare'` and the engine-side `timeoutMs` apply only to `readBalance` / `readStorage` (the client-side timeout still follows the client's policy).
198
228
  - **What isn't:** every other method is `unsupported` or forwarded unverified, as the policy allows. Agreement between providers is recorded, never treated as proof.
199
229
  - **Dev mode is unverified.** `rootSource: 'untrusted-rpc'` receipts come from an RPC-supplied root. `<EngineStatus>` shows an amber DEV MODE pill.
200
230
  - **Privacy:** with `transport: direct`, providers still see the address you query and your IP. Veriq protects integrity, not privacy.
package/dist/bin/veriq.js CHANGED
@@ -12,10 +12,11 @@ var ERROR_CODES = {
12
12
  POLICY_UNSATISFIABLE: -32014,
13
13
  PROVIDER_TIMEOUT: -32015,
14
14
  ALL_PROVIDERS_FAILED: -32016,
15
+ ROOT_MISMATCH: -32017,
15
16
  INVALID_REQUEST: -32602,
16
17
  INTERNAL_ERROR: -32603
17
18
  };
18
- var CLIENT_CODES = { ENGINE_UNREACHABLE: -1, SCHEMA_MISMATCH: -2 };
19
+ var CLIENT_CODES = { ENGINE_UNREACHABLE: -1, SCHEMA_MISMATCH: -2, CHAIN_MISMATCH: -3 };
19
20
  var DEFAULT_URL = "http://127.0.0.1:8547";
20
21
  var ERROR_MEANINGS = {
21
22
  INVALID_PROOF: "Every attempted proof failed verification against the pinned state root.",
@@ -25,6 +26,7 @@ var ERROR_MEANINGS = {
25
26
  POLICY_UNSATISFIABLE: 'The policy contradicts itself, e.g. "latest" blocks with verification required.',
26
27
  PROVIDER_TIMEOUT: "The shared deadline ran out before any provider returned a valid proof.",
27
28
  ALL_PROVIDERS_FAILED: "Every eligible provider failed or was cooling down.",
29
+ ROOT_MISMATCH: "Two trusted light clients (engine and browser) report different roots for the same finalized block.",
28
30
  INVALID_REQUEST: "The request parameters are malformed (bad address, slot or policy).",
29
31
  INTERNAL_ERROR: "The engine could not complete the request because an internal service is unavailable."
30
32
  };
@@ -36,10 +38,12 @@ var ERROR_HINTS = {
36
38
  POLICY_UNSATISFIABLE: "latest + verification=required can't be proven. Use blockPolicy 'finalized'.",
37
39
  PROVIDER_TIMEOUT: "No valid proof arrived before the deadline. Raise timeoutMs or check provider health.",
38
40
  ALL_PROVIDERS_FAILED: "Every provider failed or is cooling down. Check veriq health for breaker states.",
41
+ ROOT_MISMATCH: "Nothing was verified. One light client follows a wrong chain or a bad checkpoint: check both checkpoints and consensus APIs.",
39
42
  INVALID_REQUEST: "Check the address (0x + 40 hex), slot (0x + up to 64 hex) and policy fields.",
40
43
  INTERNAL_ERROR: "Retry shortly; if the error persists, check the engine health endpoint.",
41
44
  ENGINE_UNREACHABLE: `No Veriq engine at ${DEFAULT_URL}. Start it with: cd backend && cargo run -p veriq-server`,
42
45
  SCHEMA_MISMATCH: "The engine answered with a shape this SDK does not understand. Make sure SDK and engine versions match.",
46
+ CHAIN_MISMATCH: "The engine serves another chain than this reader reads. Point the client at an engine started with the matching VERIQ_NETWORK.",
43
47
  UNKNOWN: "Unexpected engine error. Check the engine logs."
44
48
  };
45
49
  var VeriqError = class extends Error {
@@ -76,10 +80,14 @@ var ProviderTimeoutError = class extends VeriqError {
76
80
  };
77
81
  var AllProvidersFailedError = class extends VeriqError {
78
82
  };
83
+ var RootMismatchError = class extends VeriqError {
84
+ };
79
85
  var InvalidRequestError = class extends VeriqError {
80
86
  };
81
87
  var InternalError = class extends VeriqError {
82
88
  };
89
+ var ChainMismatchError = class extends VeriqError {
90
+ };
83
91
  var EngineUnreachableError = class extends VeriqError {
84
92
  };
85
93
  var VeriqSchemaError = class extends VeriqError {
@@ -96,9 +104,11 @@ var ERROR_CLASSES = {
96
104
  [ERROR_CODES.POLICY_UNSATISFIABLE]: PolicyUnsatisfiableError,
97
105
  [ERROR_CODES.PROVIDER_TIMEOUT]: ProviderTimeoutError,
98
106
  [ERROR_CODES.ALL_PROVIDERS_FAILED]: AllProvidersFailedError,
107
+ [ERROR_CODES.ROOT_MISMATCH]: RootMismatchError,
99
108
  [ERROR_CODES.INVALID_REQUEST]: InvalidRequestError,
100
109
  [ERROR_CODES.INTERNAL_ERROR]: InternalError,
101
- [CLIENT_CODES.ENGINE_UNREACHABLE]: EngineUnreachableError
110
+ [CLIENT_CODES.ENGINE_UNREACHABLE]: EngineUnreachableError,
111
+ [CLIENT_CODES.CHAIN_MISMATCH]: ChainMismatchError
102
112
  };
103
113
  var ALL_CODES = { ...ERROR_CODES, ...CLIENT_CODES };
104
114
  function nameForCode(code) {
@@ -146,7 +156,7 @@ var VerificationStatusSchema = z.enum(["verified", "unverified", "unsupported"])
146
156
  var RootSourceSchema = z.enum(["local-light-client", "fixture", "untrusted-rpc"]);
147
157
  var VerifierLocationSchema = z.enum(["local-engine", "remote-engine", "browser"]);
148
158
  var MechanismSchema = z.enum(["account-proof", "storage-proof", "code-hash"]);
149
- var TransportKindSchema = z.enum(["direct", "ohttp", "anyone-socks"]);
159
+ var TransportKindSchema = z.enum(["direct", "ohttp", "anyone-socks", "anon-rpc"]);
150
160
  var ComparisonSchema = z.enum(["not-run", "agree", "divergent"]);
151
161
  var IdentitySchema = z.object({
152
162
  requestId: z.string(),
@@ -158,7 +168,9 @@ var BlockSchema = z.object({
158
168
  number: u64,
159
169
  hash: Hex32Schema,
160
170
  stateRoot: Hex32Schema,
161
- finalized: z.boolean()
171
+ finalized: z.boolean(),
172
+ /** S6: the chain this block is on. Absent in receipts from engines before mainnet support. */
173
+ chainId: u64.optional()
162
174
  });
163
175
  var BootstrapSchema = z.object({
164
176
  source: z.string().nullable().default(null),
@@ -246,6 +258,15 @@ var ReadResultSchema = z.object({
246
258
  receipt: TrustReceiptSchema,
247
259
  attempts: z.array(AttemptSchema).default([])
248
260
  });
261
+ var RootInfoSchema = z.object({
262
+ number: z.number().int().nonnegative(),
263
+ hash: Hex32Schema,
264
+ stateRoot: Hex32Schema,
265
+ rootSource: z.string(),
266
+ verified: z.boolean(),
267
+ /** S6: the engine's chain. Absent from older engines. */
268
+ chainId: z.number().int().positive().optional()
269
+ });
249
270
  var ReceiptRecordSchema = z.object({
250
271
  id: z.string(),
251
272
  createdAt: z.number(),
@@ -332,6 +353,38 @@ var CapabilitiesSchema = z.object({
332
353
  blockPolicies: z.array(BlockPolicySchema).default(["finalized"]),
333
354
  privacy: z.boolean().default(false)
334
355
  }).passthrough();
356
+ var DelegationStatusSchema = z.union([
357
+ z.object({
358
+ status: z.enum(["normal-eoa", "contract", "revoked", "invalid-designator"])
359
+ }),
360
+ z.object({
361
+ status: z.literal("delegated"),
362
+ delegate: hex(20)
363
+ }),
364
+ z.enum(["normal-eoa", "delegated", "contract", "revoked", "invalid-designator"])
365
+ ]);
366
+ var DelegationSecurityClassificationSchema = z.enum([
367
+ "normal-eoa",
368
+ "smart-contract",
369
+ "delegation-detected",
370
+ "delegation-revoked",
371
+ "unverified-delegate",
372
+ "delegate-code-verified",
373
+ "potential-risk",
374
+ "security-assessment-unavailable"
375
+ ]);
376
+ var DelegationResultSchema = z.object({
377
+ address: hex(20),
378
+ status: DelegationStatusSchema,
379
+ isDelegated: z.boolean(),
380
+ delegateAddress: hex(20).nullish(),
381
+ codeHash: Hex32Schema,
382
+ delegateCodeHash: Hex32Schema.nullish(),
383
+ securityClassification: DelegationSecurityClassificationSchema,
384
+ blockNumber: u64.optional(),
385
+ verified: z.boolean().default(true),
386
+ receipt: TrustReceiptSchema
387
+ });
335
388
  function valueAt(input, path) {
336
389
  let cur = input;
337
390
  for (const key of path) {
@@ -411,6 +464,9 @@ async function send(ctx, input, init, opts, label) {
411
464
  }
412
465
  }
413
466
  async function rpcCall(ctx, method, params, opts) {
467
+ return (await rpcEnvelope(ctx, method, params, opts)).result;
468
+ }
469
+ async function rpcEnvelope(ctx, method, params, opts) {
414
470
  const body = await send(
415
471
  ctx,
416
472
  ctx.url || "/",
@@ -430,7 +486,7 @@ async function rpcCall(ctx, method, params, opts) {
430
486
  }
431
487
  }
432
488
  if (!("result" in body)) throw new VeriqSchemaError(["response.result: expected a value, got undefined"]);
433
- return body.result;
489
+ return "veriq" in body && body.veriq != null ? { result: body.result, veriq: body.veriq } : { result: body.result };
434
490
  }
435
491
  function httpGet(ctx, path, opts) {
436
492
  return send(ctx, `${ctx.url}${path}`, { method: "GET" }, opts, `GET ${path.split("?")[0]}`);
@@ -475,7 +531,14 @@ function createTransport(client, opts = {}) {
475
531
  record(r.receipt);
476
532
  return r.value;
477
533
  }
478
- return client.request(method, params ? [...params] : []);
534
+ if ((method === "eth_getTransactionCount" || method === "eth_getCode") && verifiedPath(method, blockTag(params, 1))) {
535
+ const { result: result2, receipt: receipt2 } = await client.requestWithReceipt(method, params ? [...params] : []);
536
+ if (receipt2) record(receipt2);
537
+ return result2;
538
+ }
539
+ const { result, receipt } = await client.requestWithReceipt(method, params ? [...params] : []);
540
+ if (receipt) record(receipt);
541
+ return result;
479
542
  }
480
543
  const eip1193 = request;
481
544
  const transport = (() => ({
@@ -547,6 +610,12 @@ function createVeriq(options = {}) {
547
610
  const value = `0x${BigInt(r.value).toString(16).padStart(64, "0")}`;
548
611
  return { value, receipt: r.receipt, verified: r.receipt.verification.status === "verified", attempts: r.attempts };
549
612
  },
613
+ async getDelegation({ address, policy: p = policy, signal }) {
614
+ assertAddress(address);
615
+ assertPolicy(p);
616
+ const raw = await rpcCall(ctx, "veriq_getDelegation", [address, p], { timeoutMs: readTimeout(p), ...signal ? { signal } : {} });
617
+ return parseWith(DelegationResultSchema, raw, "delegation");
618
+ },
550
619
  async getReceipt(id) {
551
620
  const raw = await rpcCall(ctx, "veriq_getReceipt", [id], shortTimeout);
552
621
  const receipt = raw && typeof raw === "object" && "receipt" in raw && !("identity" in raw) ? raw.receipt : raw;
@@ -566,12 +635,36 @@ function createVeriq(options = {}) {
566
635
  const list = raw && typeof raw === "object" && "providers" in raw ? raw.providers : raw;
567
636
  return parseWith(z2.array(ProviderHealthSchema), list, "providers");
568
637
  },
638
+ async getRoot() {
639
+ return parseWith(RootInfoSchema, await rpcCall(ctx, "veriq_getRoot", [], shortTimeout), "root");
640
+ },
641
+ async verifyProof(input, p = policy) {
642
+ assertPolicy(p);
643
+ assertAddress(input.address);
644
+ if (input.kind === "storage") {
645
+ if (input.slot === void 0) throw invalid("a storage proof needs a slot");
646
+ assertSlot(input.slot);
647
+ }
648
+ const { slot, elapsedMs, ...rest } = input;
649
+ const payload = {
650
+ ...rest,
651
+ ...input.kind === "storage" ? { slot } : {},
652
+ ...elapsedMs === void 0 ? {} : { elapsedMs }
653
+ };
654
+ const raw = await rpcCall(ctx, "veriq_verifyProof", [payload, p], { timeoutMs: readTimeout(p) });
655
+ const r = parseWith(ReadResultSchema, raw, "result");
656
+ return { value: r.value, receipt: r.receipt, verified: r.receipt.verification.status === "verified", attempts: attemptsFromReceipt(r.receipt) };
657
+ },
569
658
  async capabilities() {
570
659
  return parseWith(CapabilitiesSchema, await rpcCall(ctx, "veriq_getCapabilities", [], shortTimeout), "capabilities");
571
660
  },
572
661
  transport: (opts) => createTransport(client, opts),
573
662
  withPolicy: (p) => createVeriq({ ...options, policy: p }),
574
- request: (method, params = []) => rpcCall(ctx, method, params, { timeoutMs: readTimeout(policy) })
663
+ request: (method, params = []) => rpcCall(ctx, method, params, { timeoutMs: readTimeout(policy) }),
664
+ async requestWithReceipt(method, params = []) {
665
+ const { result, veriq } = await rpcEnvelope(ctx, method, params, { timeoutMs: readTimeout(policy) });
666
+ return { result, receipt: veriq === void 0 ? void 0 : parseWith(TrustReceiptSchema, veriq, "veriq") };
667
+ }
575
668
  };
576
669
  return Object.freeze(client);
577
670
  }
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
- 'use strict';var zod=require('zod');var Ue=Object.defineProperty;var i=(e,t)=>Ue(e,"name",{value:t,configurable:true});var g={INVALID_PROOF:-32010,ROOT_UNAVAILABLE:-32011,UNSUPPORTED_VERIFICATION:-32012,PRIVACY_UNAVAILABLE:-32013,POLICY_UNSATISFIABLE:-32014,PROVIDER_TIMEOUT:-32015,ALL_PROVIDERS_FAILED:-32016,INVALID_REQUEST:-32602,INTERNAL_ERROR:-32603},A={ENGINE_UNREACHABLE:-1,SCHEMA_MISMATCH:-2},je="http://127.0.0.1:8547",he={INVALID_PROOF:"Every attempted proof failed verification against the pinned state root.",ROOT_UNAVAILABLE:"No trusted root: the light client is not synced and dev mode is off.",UNSUPPORTED_VERIFICATION:"This method or block tag cannot be proven under the chosen policy.",PRIVACY_UNAVAILABLE:"Privacy is required but no private-transport provider is healthy. Nothing was sent.",POLICY_UNSATISFIABLE:'The policy contradicts itself, e.g. "latest" blocks with verification required.',PROVIDER_TIMEOUT:"The shared deadline ran out before any provider returned a valid proof.",ALL_PROVIDERS_FAILED:"Every eligible provider failed or was cooling down.",INVALID_REQUEST:"The request parameters are malformed (bad address, slot or policy).",INTERNAL_ERROR:"The engine could not complete the request because an internal service is unavailable."},Me={INVALID_PROOF:"Every provider sent a proof that does not match the finalized root. Add an honest provider or wait for cooldowns.",ROOT_UNAVAILABLE:"The light client hasn't synced a finalized root yet. Wait ~1 min or check /health.",UNSUPPORTED_VERIFICATION:"Veriq can't prove this method or block tag. Use blockTag 'finalized' or verification 'preferred'.",PRIVACY_UNAVAILABLE:"No private-transport provider is healthy. Use privacy 'preferred' or 'off'.",POLICY_UNSATISFIABLE:"latest + verification=required can't be proven. Use blockPolicy 'finalized'.",PROVIDER_TIMEOUT:"No valid proof arrived before the deadline. Raise timeoutMs or check provider health.",ALL_PROVIDERS_FAILED:"Every provider failed or is cooling down. Check veriq health for breaker states.",INVALID_REQUEST:"Check the address (0x + 40 hex), slot (0x + up to 64 hex) and policy fields.",INTERNAL_ERROR:"Retry shortly; if the error persists, check the engine health endpoint.",ENGINE_UNREACHABLE:`No Veriq engine at ${je}. Start it with: cd backend && cargo run -p veriq-server`,SCHEMA_MISMATCH:"The engine answered with a shape this SDK does not understand. Make sure SDK and engine versions match.",UNKNOWN:"Unexpected engine error. Check the engine logs."},H=class H extends Error{constructor(t,n,o={}){super(n,o.cause===void 0?void 0:{cause:o.cause}),this.name=new.target.name,this.code=t,this.codeName=be(t),this.hint=o.hint??Me[this.codeName],o.data!==void 0&&(this.data=o.data);let s=o.receiptId??ze(o.data);s!==void 0&&(this.receiptId=s);}get meaning(){return this.codeName in he?he[this.codeName]:this.message}toString(){return `VeriqError[${this.code} ${this.codeName}]: ${this.message} \u2014 ${this.hint}`}};i(H,"VeriqError");var h=H,z=class z extends h{};i(z,"InvalidProofError");var q=z,F=class F extends h{};i(F,"RootUnavailableError");var _=F,B=class B extends h{};i(B,"UnsupportedVerificationError");var S=B,G=class G extends h{};i(G,"PrivacyUnavailableError");var U=G,W=class W extends h{};i(W,"PolicyUnsatisfiableError");var j=W,Y=class Y extends h{};i(Y,"ProviderTimeoutError");var T=Y,K=class K extends h{};i(K,"AllProvidersFailedError");var M=K,Q=class Q extends h{};i(Q,"InvalidRequestError");var I=Q,J=class J extends h{};i(J,"InternalError");var D=J,Z=class Z extends h{};i(Z,"EngineUnreachableError");var O=Z,X=class X extends h{constructor(t,n={}){super(A.SCHEMA_MISMATCH,t.join("; "),n),this.issues=t;}};i(X,"VeriqSchemaError");var x=X,De={[g.INVALID_PROOF]:q,[g.ROOT_UNAVAILABLE]:_,[g.UNSUPPORTED_VERIFICATION]:S,[g.PRIVACY_UNAVAILABLE]:U,[g.POLICY_UNSATISFIABLE]:j,[g.PROVIDER_TIMEOUT]:T,[g.ALL_PROVIDERS_FAILED]:M,[g.INVALID_REQUEST]:I,[g.INTERNAL_ERROR]:D,[A.ENGINE_UNREACHABLE]:O},He={...g,...A};function be(e){for(let[t,n]of Object.entries(He))if(n===e)return t;return "UNKNOWN"}i(be,"nameForCode");function wt(e){let t=be(e);return t in g?t:void 0}i(wt,"errorNameForCode");function ze(e){if(e&&typeof e=="object"&&"receiptId"in e&&typeof e.receiptId=="string")return e.receiptId}i(ze,"receiptIdFrom");function Re(e){let t=De[e.code]??h;return new t(e.code,e.message,{data:e.data})}i(Re,"errorFromRpc");function $t(e){return e instanceof h}i($t,"isVeriqError");var N=Object.freeze({verification:"required",privacy:"off",consistency:"single",blockPolicy:"finalized",timeoutMs:8e3}),Fe=Object.freeze({...N,consistency:"compare"}),Be=Object.freeze({...N,privacy:"required"}),Ge=Object.freeze({verification:"preferred",privacy:"off",consistency:"single",blockPolicy:"finalized",timeoutMs:8e3}),Vt={verifiedFinalized:N,verifiedCompare:Fe,privateVerified:Be,devUnverified:Ge};var ee="expected 0x-hex",ye=i(e=>zod.z.string({required_error:ee,invalid_type_error:ee}).regex(e?new RegExp(`^0x[0-9a-fA-F]{${e*2}}$`):/^0x[0-9a-fA-F]+$/,e?`expected 0x-hex (${e} bytes)`:ee),"hex"),b=zod.z.number({required_error:"expected a number"}).int().nonnegative(),re=ye(32),We=zod.z.enum(["verified","unverified","unsupported"]),xe=zod.z.enum(["local-light-client","fixture","untrusted-rpc"]),Ye=zod.z.enum(["local-engine","remote-engine","browser"]),Ke=zod.z.enum(["account-proof","storage-proof","code-hash"]),Ee=zod.z.enum(["direct","ohttp","anyone-socks"]),Qe=zod.z.enum(["not-run","agree","divergent"]),Je=zod.z.object({requestId:zod.z.string(),method:zod.z.string(),requestBinding:zod.z.string(),resultBinding:zod.z.string()}),Ze=zod.z.object({number:b,hash:re,stateRoot:re,finalized:zod.z.boolean()}),Xe=zod.z.object({source:zod.z.string().nullable().default(null),checkpoint:zod.z.string().nullable().default(null),checkpointSource:zod.z.string().nullable().default(null)}),et=zod.z.object({status:We,rootSource:xe,verifierLocation:Ye,mechanisms:zod.z.array(Ke),bootstrap:Xe}),tt=zod.z.object({transport:Ee,mechanism:zod.z.string().nullable().default(null)}),rt=zod.z.enum(["success","transport-failure","provider-error","invalid-proof"]),nt=zod.z.object({provider:zod.z.string(),outcome:rt,elapsedMs:b,failureReason:zod.z.string().nullish()}),ot=zod.z.object({comparison:Qe,providersTried:b,providerLabel:zod.z.string().nullable().default(null),attempts:zod.z.array(nt).default([])}),it=zod.z.object({observedAt:b,ageSeconds:b,pinned:zod.z.boolean()}),st=zod.z.object({code:zod.z.string(),message:zod.z.string()}),k=zod.z.object({identity:Je,block:Ze,verification:et,privacy:tt,routing:ot,freshness:it,warnings:zod.z.array(st).default([])}),at=zod.z.enum(["required","preferred","disabled"]),ve=zod.z.enum(["finalized","latest"]),Se=zod.z.object({verification:at,privacy:zod.z.enum(["required","preferred","off"]),consistency:zod.z.enum(["single","compare"]),blockPolicy:ve,timeoutMs:zod.z.number().int().min(1).max(12e4)}),ne={success:"ok","invalid-proof":"INVALID_PROOF","transport-failure":"transport_error","provider-error":"PROVIDER_ERROR"};function ct(e){if(typeof e!="object"||e===null||Array.isArray(e))return e;let t=e,n=typeof t.outcome=="string"?ne[t.outcome]??t.outcome:t.outcome,o=t.reason??t.failureReason;return {provider:t.provider,outcome:n,elapsedMs:t.elapsedMs,...o!=null?{reason:o}:{}}}i(ct,"normalizeAttempt");var Te=zod.z.preprocess(ct,zod.z.object({provider:zod.z.string(),outcome:zod.z.string(),elapsedMs:zod.z.number().nonnegative(),reason:zod.z.string().nullish()})),pt=zod.z.object({code:zod.z.number().int(),message:zod.z.string(),data:zod.z.unknown().optional()}),Ie=zod.z.object({value:ye(),receipt:k,attempts:zod.z.array(Te).default([])}),oe=zod.z.object({id:zod.z.string(),createdAt:zod.z.number(),method:zod.z.string(),params:zod.z.object({address:zod.z.string().optional(),slot:zod.z.string().optional()}),value:zod.z.string().nullish(),blockNumber:b.nullish(),receipt:k.nullish(),error:pt.nullish(),attempts:zod.z.array(Te).default([])}),Oe=zod.z.object({receipts:zod.z.array(oe)}),lt=zod.z.enum(["closed","open","half-open"]),ie=zod.z.object({name:zod.z.string(),chainOk:zod.z.boolean(),proofSupport:zod.z.boolean(),eip1898:zod.z.boolean(),transport:Ee.default("direct"),breaker:zod.z.object({state:lt,cooldownUntil:zod.z.number().nullish(),reason:zod.z.string().nullish()}),successRate:zod.z.number().min(0).max(1).nullish(),lastError:zod.z.string().nullish()}),ut=zod.z.object({synced:zod.z.boolean(),finalizedNumber:b.nullish(),finalizedHash:re.nullish(),lagSeconds:b.nullish(),lastUpdateUnix:b.nullish(),headNumber:b.nullish(),checkpoint:zod.z.string().nullish(),checkpointSource:zod.z.string().nullish()}),dt=zod.z.object({ok:zod.z.boolean().default(true),chainId:zod.z.number().int().optional(),bind:zod.z.string().optional(),rootSource:xe.nullable(),devMode:zod.z.boolean().default(false),providers:zod.z.array(ie),providerCount:zod.z.number().int().nonnegative(),lightClient:ut,error:zod.z.object({code:zod.z.string(),message:zod.z.string()}).nullish()}),te=i(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isObj");function ft(e){if(!te(e))return e;let t=Array.isArray(e.providers)?e.providers:[],n=typeof e.providers=="number"?e.providers:t.length;if(te(e.lightClient))return {rootSource:null,providerCount:n,...e,providers:t};let o=te(e.bootstrap)?e.bootstrap:{},s=typeof e.rootSource=="string"?e.rootSource:null;return {ok:e.status===void 0?true:e.status==="ok",...typeof e.bind=="string"?{bind:e.bind}:{},rootSource:s,devMode:s==="untrusted-rpc",providers:t,providerCount:n,lightClient:{synced:e.synced===true,finalizedNumber:e.finalizedNumber??null,finalizedHash:e.finalizedHash??null,lagSeconds:e.lagSeconds??null,lastUpdateUnix:e.lastUpdateUnix??null,headNumber:e.headNumber??null,checkpoint:o.checkpoint??null,checkpointSource:o.checkpointSource??null},error:typeof e.error=="string"?{code:e.error,message:typeof e.message=="string"?e.message:""}:null}}i(ft,"normalizeHealth");var Ae=zod.z.preprocess(ft,dt),Ne=zod.z.object({methods:zod.z.array(zod.z.string()),verifiedMethods:zod.z.array(zod.z.string()).default([]),blockPolicies:zod.z.array(ve).default(["finalized"]),privacy:zod.z.boolean().default(false)}).passthrough();function mt(e,t){let n=e;for(let o of t){if(n===null||typeof n!="object")return;n=n[o];}return n}i(mt,"valueAt");function gt(e){return e===void 0?"undefined":typeof e=="string"?JSON.stringify(e.length>24?`${e.slice(0,24)}\u2026`:e):e===null||typeof e!="object"?String(e):Array.isArray(e)?"array":"object"}i(gt,"show");function w(e,t,n){return e.issues.map(o=>{let s=[n,...o.path].join("."),p=gt(mt(t,o.path)),u=o.message;return o.code==="invalid_type"&&o.message==="Required"?u=`expected ${o.expected}`:o.code==="invalid_type"&&o.message.startsWith("Expected")?u=`expected ${o.expected}`:o.code==="invalid_enum_value"&&(u=`expected one of ${o.options.join(" | ")}`),`${s}: ${u}, got ${p}`})}i(w,"formatIssues");var ht=1;function bt(e){return e.split(/[?#]/)[0]??e}i(bt,"safeUrl");function se(e,t,n){let o=bt(e.url)||"/";return new O(A.ENGINE_UNREACHABLE,`Could not reach the Veriq engine at ${o}: ${t}`,{hint:`No Veriq engine at ${o}. Start it with: cd backend && cargo run -p veriq-server`,cause:n})}i(se,"unreachable");async function ke(e,t,n,o,s){let p=new AbortController,u=false,m=setTimeout(()=>{u=true,p.abort();},o.timeoutMs),d=i(()=>p.abort(),"onAbort");o.signal?.addEventListener("abort",d,{once:true});let a=Date.now();try{let c;try{c=await e.fetch(t,{...n,signal:p.signal});}catch(f){throw u?new T(g.PROVIDER_TIMEOUT,`No answer from the engine within ${o.timeoutMs} ms (client-side timeout)`,{hint:"The engine did not answer in time. Raise timeoutMs, or check that the engine is healthy with: veriq health",cause:f}):o.signal?.aborted?f:se(e,f instanceof Error?f.message:String(f),f)}let l;try{l=await c.json();}catch(f){throw se(e,`HTTP ${c.status} with a non-JSON body. Is this a Veriq engine?`,f)}if(!c.ok&&!(l&&typeof l=="object"&&"error"in l))throw se(e,`HTTP ${c.status}`);return l}finally{clearTimeout(m),o.signal?.removeEventListener("abort",d),e.debug&&console.debug(`[veriq] ${s} ${Date.now()-a} ms`);}}i(ke,"send");async function E(e,t,n,o){let s=await ke(e,e.url||"/",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:ht++,method:t,params:n})},o,t);if(!s||typeof s!="object")throw new x([`response: expected a JSON-RPC object, got ${typeof s}`]);if("error"in s&&s.error&&typeof s.error=="object"){let p=s.error;if(typeof p.code=="number")throw Re({code:p.code,message:typeof p.message=="string"?p.message:"engine error",data:p.data})}if(!("result"in s))throw new x(["response.result: expected a value, got undefined"]);return s.result}i(E,"rpcCall");function $(e,t,n){return ke(e,`${e.url}${t}`,{method:"GET"},n,`GET ${t.split("?")[0]}`)}i($,"httpGet");function R(e,t,n){let o=e.safeParse(t);if(!o.success)throw new x(w(o.error,t,n));return o.data}i(R,"parseWith");function we(e,t){return e?.[t]??"latest"}i(we,"blockTag");function ae(e,t={}){let n=t.policy??e.policy,o=t.strict??n.verification==="required",s,p=i(c=>{s=c,t.onReceipt?.(c);},"record"),u=i((c,l)=>{if(l==="finalized")return true;if(o)throw new S(g.UNSUPPORTED_VERIFICATION,`${c} at block "${typeof l=="string"?l:"custom"}" can't be proven; only "finalized" can`,{hint:"Pass blockTag: 'finalized' (viem defaults to 'latest')."});return false},"verifiedPath");async function m({method:c,params:l}){if(c==="eth_getBalance"&&u(c,we(l,1))){let f=await e.readBalance({address:String(l?.[0]),policy:n});return p(f.receipt),`0x${f.value.toString(16)}`}if(c==="eth_getStorageAt"&&u(c,we(l,2))){let f=await e.readStorage({address:String(l?.[0]),slot:String(l?.[1]),policy:n});return p(f.receipt),f.value}return e.request(c,l?[...l]:[])}i(m,"request");let d=m,a=i((()=>({config:{key:"veriq",name:"Veriq",request:d,retryCount:0,type:"veriq"},request:d,value:{get lastReceipt(){return s}}})),"transport");return Object.defineProperty(a,"lastReceipt",{get:i(()=>s,"get"),enumerable:true}),a}i(ae,"createTransport");var $e="http://127.0.0.1:8547",yt=/^0x[0-9a-fA-F]{40}$/,xt=/^0x[0-9a-fA-F]{1,64}$/;function Pe(e){return e.routing.attempts.map(t=>({provider:t.provider,outcome:ne[t.outcome]??t.outcome,elapsedMs:t.elapsedMs,...t.failureReason?{reason:t.failureReason}:{}}))}i(Pe,"attemptsFromReceipt");function le(e){return new I(g.INVALID_REQUEST,e)}i(le,"invalid");function ce(e){if(typeof e!="string"||!yt.test(e))throw le("address must be 0x followed by 40 hex characters")}i(ce,"assertAddress");function Ce(e){if(typeof e!="string"||!xt.test(e))throw le("slot must be 0x followed by 1 to 64 hex characters")}i(Ce,"assertSlot");function pe(e){let t=Se.safeParse(e);if(!t.success)throw le(w(t.error,e,"policy").join("; "))}i(pe,"assertPolicy");function Ve(e={}){let t=(e.url??$e).replace(/\/$/,""),n=e.policy??N;pe(n);let o=e.fetch??((a,c)=>globalThis.fetch(a,c)),s={url:t,fetch:o,debug:e.debug??false},p=i(a=>e.timeoutMs??a.timeoutMs+1e3,"readTimeout"),u={timeoutMs:e.timeoutMs??5e3};async function m(a,c,l,f){pe(l);let y=await E(s,a,[...c,l],{timeoutMs:p(l),...f?{signal:f}:{}}),v=R(Ie,y,"result");return {...v,attempts:v.attempts.length?v.attempts:Pe(v.receipt)}}i(m,"read");let d={url:t,policy:n,async readBalance({address:a,policy:c=n,signal:l}){ce(a);let f=await m("veriq_readBalance",[a],c,l);return {value:BigInt(f.value),receipt:f.receipt,verified:f.receipt.verification.status==="verified",attempts:f.attempts}},async readStorage({address:a,slot:c,policy:l=n,signal:f}){ce(a),Ce(c);let y=await m("veriq_readStorage",[a,c],l,f);return {value:`0x${BigInt(y.value).toString(16).padStart(64,"0")}`,receipt:y.receipt,verified:y.receipt.verification.status==="verified",attempts:y.attempts}},async getReceipt(a){let c=await E(s,"veriq_getReceipt",[a],u),l=c&&typeof c=="object"&&"receipt"in c&&!("identity"in c)?c.receipt:c;return R(k,l,"receipt")},async getReceiptRecord(a){return R(oe,await $(s,`/receipts/${encodeURIComponent(a)}`,u),"record")},async listReceipts(a=50){return R(Oe,await $(s,`/receipts?limit=${a}`,u),"receipts").receipts},async health(){return R(Ae,await $(s,"/health",u),"health")},async providers(){let a=await E(s,"veriq_getProviderHealth",[],u),c=a&&typeof a=="object"&&"providers"in a?a.providers:a;return R(zod.z.array(ie),c,"providers")},async capabilities(){return R(Ne,await E(s,"veriq_getCapabilities",[],u),"capabilities")},transport:i(a=>ae(d,a),"transport"),withPolicy:i(a=>Ve({...e,policy:a}),"withPolicy"),request:i((a,c=[])=>E(s,a,c,{timeoutMs:p(n)}),"request")};return Object.freeze(d)}i(Ve,"createVeriq");var Le=10n**18n;function qe(e,t={}){let n=t.decimals??4,o=t.symbol===false?"":" ETH",s=typeof e=="bigint"?e:BigInt(e),p=s<0n,u=p?-s:s,m=u/Le,d=(u%Le).toString().padStart(18,"0").slice(0,n).replace(/0+$/,"");if(m===0n&&d===""&&u>0n)return `${p?">-":"<"}0.${"0".repeat(Math.max(0,n-1))}1${o}`;let a=m.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return `${p?"-":""}${a}${d?`.${d}`:""}${o}`}i(qe,"formatEth");function P(e,t=4,n=4){let o=e.startsWith("0x")?t+2:t;return e.length<=o+n+1?e:`${e.slice(0,o)}\u2026${e.slice(-n)}`}i(P,"shortHash");function ue(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}i(ue,"formatNumber");function de(e){switch(e){case "local-light-client":return "local light client (Helios)";case "fixture":return "fixture (tests only)";case "untrusted-rpc":return "untrusted RPC (DEV MODE)"}}i(de,"rootSourceLabel");function Et(e){return "identity"in e?{receipt:e,attempts:[]}:{receipt:e.receipt,...e.value!==void 0?{value:e.value}:{},attempts:e.attempts??[]}}i(Et,"split");function vt(e){return e==="verified"?"ok":e==="unverified"?"warn":"lav"}i(vt,"statusTone");function St(e,t){if(t===void 0)return "";if(/storage/i.test(e.identity.method)){let n=typeof t=="bigint"?t:BigInt(t);return n<10n**15n?n.toString():P(`0x${n.toString(16)}`)}return qe(t)}i(St,"formatValue");function C(e){let{receipt:t,value:n,attempts:o}=Et(e),s=[{label:"block",value:`#${ue(t.block.number)} ${P(t.block.hash)}${t.block.finalized?"":" (not finalized)"}`},{label:"stateRoot",value:P(t.block.stateRoot)},{label:"root",value:de(t.verification.rootSource),tone:t.verification.rootSource==="untrusted-rpc"?"warn":"ink"}],p=o.reduce((d,a)=>d+a.elapsedMs,0),u=o.length||t.routing.providersTried,m=[t.routing.providerLabel??"\u2014",`${u} attempt${u===1?"":"s"}`,...o.length?[`${Math.round(p)} ms`]:[]].join(" \xB7 ");s.push({label:"provider",value:m});for(let d of o)d.outcome!=="ok"&&s.push({label:"rejected",value:`${d.provider} ${d.outcome}`,tone:"err"});t.routing.comparison!=="not-run"&&s.push({label:"compare",value:t.routing.comparison,tone:t.routing.comparison==="agree"?"ok":"warn"});for(let d of t.warnings)s.push({label:"warning",value:d.code,tone:"warn"});return {status:t.verification.status,value:St(t,n),rows:s}}i(C,"receiptRows");function Tt(e){let{status:t,value:n,rows:o}=C(e);return [`${t.toUpperCase()}${n?` ${n}`:""}`,...o.map(s=>`${s.label.padEnd(10)} ${s.value}`)].join(`
2
- `)}i(Tt,"formatReceipt");function fe(e){let t=e.lightClient,n=t.finalizedNumber!=null&&t.headNumber!=null?`${t.headNumber-t.finalizedNumber} blocks behind head`:"",o=[{label:"engine",value:`${e.ok?"online":`degraded${e.error?` \xB7 ${e.error.code}`:""}`}${e.bind?` \xB7 ${e.bind}`:""}`,tone:e.ok?"ok":"warn"},{label:"root",value:e.rootSource?de(e.rootSource):"none yet (light client not synced)",tone:!e.rootSource||e.devMode||e.rootSource==="untrusted-rpc"?"warn":"ink"},{label:"light",value:t.synced?"synced":"not synced",tone:t.synced?"ok":"warn"},{label:"finalized",value:t.finalizedNumber!=null?`#${ue(t.finalizedNumber)}${n?` \xB7 ${n}`:""}`:"\u2014"}],s=e.providers.map(p=>[p.name,p.chainOk?"yes":"no",p.proofSupport?"yes":"no",p.eip1898?"yes":"no",p.breaker.state,p.transport]);return e.providers.length===0&&o.push({label:"providers",value:`${e.providerCount} configured`,tone:"ink"}),{engine:o,providers:s}}i(fe,"healthRows");var It={ink:null,muted:[91,91,102],lav:[156,149,214],border:[156,149,214],title:[107,98,181],ok:[47,158,110],warn:[183,121,31],err:[194,65,91]};function _e(e){return globalThis.process?.env?.[e]}i(_e,"env");function L(){return _e("NO_COLOR")!==void 0?false:_e("FORCE_COLOR")!==void 0?true:globalThis.process?.stdout?.isTTY===true}i(L,"supportsColor");function ge(e){return (t,n,o=false)=>{let s=It[t];return !e||!s&&!o?n:`${o?"\x1B[1m":""}${s?`\x1B[38;2;${s[0]};${s[1]};${s[2]}m`:""}${n}\x1B[0m`}}i(ge,"painter");function me(e,t,n){let o=Math.max(e.length+6,...t.map(m=>m.plain.length))+4,s=`${n("border","\u256D\u2500 ")}${n("title",e,true)}${n("border",` ${"\u2500".repeat(o-e.length-3)}\u256E`)}`,p=t.map(m=>`${n("border","\u2502")} ${m.painted}${" ".repeat(o-m.plain.length-1)}${n("border","\u2502")}`),u=n("border",`\u2570${"\u2500".repeat(o)}\u256F`);return [s,...p,u].join(`
3
- `)}i(me,"box");var V=11;function Ot(e,t={}){let n=ge(t.color??L()),{status:o,value:s,rows:p}=C(e),u=o==="verified"?"ok":o==="unverified"?"warn":"lav",m=`\u25CF ${o.toUpperCase()}`,d=" ".repeat(Math.max(2,22-m.length)),a=[{plain:`${m}${d}${s}`,painted:`${n(u,m,true)}${d}${n("ink",s,true)}`},...p.map(c=>({plain:`${c.label.padEnd(V)}${c.value}`,painted:`${n("muted",c.label.padEnd(V))}${n(c.tone??"ink",c.value)}`}))];return me("Veriq \xB7 Trust Receipt",a,n)}i(Ot,"prettyReceipt");function At(e,t={}){let n=ge(t.color??L()),{engine:o,providers:s}=fe(e),p=o.map(a=>({plain:`${a.label.padEnd(V)}${a.value}`,painted:`${n("muted",a.label.padEnd(V))}${n(a.tone??"ink",a.value)}`})),u=["provider","chain","proof","1898","breaker","transport"],m=u.map((a,c)=>Math.max(a.length,...s.map(l=>(l[c]??"").length))+2),d=i(a=>a.map((c,l)=>c.padEnd(m[l]??0)).join("").trimEnd(),"fmt");if(s.length===0)return me("Veriq \xB7 Engine health",p,n);p.push({plain:"",painted:""}),p.push({plain:d(u),painted:n("muted",d(u))});for(let a of s){let c=d(a),l=a[1]==="no"||a[2]==="no"||a[4]!=="closed";p.push({plain:c,painted:n(l?"err":"ink",c)});}return me("Veriq \xB7 Engine health",p,n)}i(At,"prettyHealth");function Nt(e,t={}){let n=ge(t.color??L());return `${n("err",`\u2715 ${e.name} [${e.code} ${e.codeName}]`,true)}
1
+ 'use strict';var zod=require('zod');var Pt=Object.defineProperty;var o=(e,t)=>Pt(e,"name",{value:t,configurable:true});var R={INVALID_PROOF:-32010,ROOT_UNAVAILABLE:-32011,UNSUPPORTED_VERIFICATION:-32012,PRIVACY_UNAVAILABLE:-32013,POLICY_UNSATISFIABLE:-32014,PROVIDER_TIMEOUT:-32015,ALL_PROVIDERS_FAILED:-32016,ROOT_MISMATCH:-32017,INVALID_REQUEST:-32602,INTERNAL_ERROR:-32603},L={ENGINE_UNREACHABLE:-1,SCHEMA_MISMATCH:-2,CHAIN_MISMATCH:-3},Nt="http://127.0.0.1:8547",nt={INVALID_PROOF:"Every attempted proof failed verification against the pinned state root.",ROOT_UNAVAILABLE:"No trusted root: the light client is not synced and dev mode is off.",UNSUPPORTED_VERIFICATION:"This method or block tag cannot be proven under the chosen policy.",PRIVACY_UNAVAILABLE:"Privacy is required but no private-transport provider is healthy. Nothing was sent.",POLICY_UNSATISFIABLE:'The policy contradicts itself, e.g. "latest" blocks with verification required.',PROVIDER_TIMEOUT:"The shared deadline ran out before any provider returned a valid proof.",ALL_PROVIDERS_FAILED:"Every eligible provider failed or was cooling down.",ROOT_MISMATCH:"Two trusted light clients (engine and browser) report different roots for the same finalized block.",INVALID_REQUEST:"The request parameters are malformed (bad address, slot or policy).",INTERNAL_ERROR:"The engine could not complete the request because an internal service is unavailable."},_t={INVALID_PROOF:"Every provider sent a proof that does not match the finalized root. Add an honest provider or wait for cooldowns.",ROOT_UNAVAILABLE:"The light client hasn't synced a finalized root yet. Wait ~1 min or check /health.",UNSUPPORTED_VERIFICATION:"Veriq can't prove this method or block tag. Use blockTag 'finalized' or verification 'preferred'.",PRIVACY_UNAVAILABLE:"No private-transport provider is healthy. Use privacy 'preferred' or 'off'.",POLICY_UNSATISFIABLE:"latest + verification=required can't be proven. Use blockPolicy 'finalized'.",PROVIDER_TIMEOUT:"No valid proof arrived before the deadline. Raise timeoutMs or check provider health.",ALL_PROVIDERS_FAILED:"Every provider failed or is cooling down. Check veriq health for breaker states.",ROOT_MISMATCH:"Nothing was verified. One light client follows a wrong chain or a bad checkpoint: check both checkpoints and consensus APIs.",INVALID_REQUEST:"Check the address (0x + 40 hex), slot (0x + up to 64 hex) and policy fields.",INTERNAL_ERROR:"Retry shortly; if the error persists, check the engine health endpoint.",ENGINE_UNREACHABLE:`No Veriq engine at ${Nt}. Start it with: cd backend && cargo run -p veriq-server`,SCHEMA_MISMATCH:"The engine answered with a shape this SDK does not understand. Make sure SDK and engine versions match.",CHAIN_MISMATCH:"The engine serves another chain than this reader reads. Point the client at an engine started with the matching VERIQ_NETWORK.",UNKNOWN:"Unexpected engine error. Check the engine logs."},xe=class xe extends Error{constructor(t,r,i={}){super(r,i.cause===void 0?void 0:{cause:i.cause}),this.name=new.target.name,this.code=t,this.codeName=ot(t),this.hint=i.hint??_t[this.codeName],i.data!==void 0&&(this.data=i.data);let s=i.receiptId??Vt(i.data);s!==void 0&&(this.receiptId=s);}get meaning(){return this.codeName in nt?nt[this.codeName]:this.message}toString(){return `VeriqError[${this.code} ${this.codeName}]: ${this.message} \u2014 ${this.hint}`}};o(xe,"VeriqError");var S=xe,Ee=class Ee extends S{};o(Ee,"InvalidProofError");var B=Ee,Se=class Se extends S{};o(Se,"RootUnavailableError");var J=Se,Ie=class Ie extends S{};o(Ie,"UnsupportedVerificationError");var X=Ie,Ae=class Ae extends S{};o(Ae,"PrivacyUnavailableError");var W=Ae,ke=class ke extends S{};o(ke,"PolicyUnsatisfiableError");var ve=ke,Te=class Te extends S{};o(Te,"ProviderTimeoutError");var Z=Te,Oe=class Oe extends S{};o(Oe,"AllProvidersFailedError");var ee=Oe,Pe=class Pe extends S{};o(Pe,"RootMismatchError");var te=Pe,Ne=class Ne extends S{};o(Ne,"InvalidRequestError");var C=Ne,_e=class _e extends S{};o(_e,"InternalError");var re=_e,$e=class $e extends S{};o($e,"ChainMismatchError");var ne=$e,Ce=class Ce extends S{};o(Ce,"EngineUnreachableError");var D=Ce,Ve=class Ve extends S{constructor(t,r={}){super(L.SCHEMA_MISMATCH,t.join("; "),r),this.issues=t;}};o(Ve,"VeriqSchemaError");var G=Ve,$t={[R.INVALID_PROOF]:B,[R.ROOT_UNAVAILABLE]:J,[R.UNSUPPORTED_VERIFICATION]:X,[R.PRIVACY_UNAVAILABLE]:W,[R.POLICY_UNSATISFIABLE]:ve,[R.PROVIDER_TIMEOUT]:Z,[R.ALL_PROVIDERS_FAILED]:ee,[R.ROOT_MISMATCH]:te,[R.INVALID_REQUEST]:C,[R.INTERNAL_ERROR]:re,[L.ENGINE_UNREACHABLE]:D,[L.CHAIN_MISMATCH]:ne},Ct={...R,...L};function ot(e){for(let[t,r]of Object.entries(Ct))if(r===e)return t;return "UNKNOWN"}o(ot,"nameForCode");function Mr(e){let t=ot(e);return t in R?t:void 0}o(Mr,"errorNameForCode");function Vt(e){if(e&&typeof e=="object"&&"receiptId"in e&&typeof e.receiptId=="string")return e.receiptId}o(Vt,"receiptIdFrom");function it(e){let t=$t[e.code]??S;return new t(e.code,e.message,{data:e.data})}o(it,"errorFromRpc");function Hr(e){return e instanceof S}o(Hr,"isVeriqError");var oe=Object.freeze({verification:"required",privacy:"off",consistency:"single",blockPolicy:"finalized",timeoutMs:8e3}),Lt=Object.freeze({...oe,consistency:"compare"}),Dt=Object.freeze({...oe,privacy:"required"}),qt=Object.freeze({verification:"preferred",privacy:"off",consistency:"single",blockPolicy:"finalized",timeoutMs:8e3}),jr={verifiedFinalized:oe,verifiedCompare:Lt,privateVerified:Dt,devUnverified:qt};var Le="expected 0x-hex",ie=o(e=>zod.z.string({required_error:Le,invalid_type_error:Le}).regex(e?new RegExp(`^0x[0-9a-fA-F]{${e*2}}$`):/^0x[0-9a-fA-F]+$/,e?`expected 0x-hex (${e} bytes)`:Le),"hex"),N=zod.z.number({required_error:"expected a number"}).int().nonnegative(),U=ie(32),Mt=zod.z.enum(["verified","unverified","unsupported"]),st=zod.z.enum(["local-light-client","fixture","untrusted-rpc"]),Ht=zod.z.enum(["local-engine","remote-engine","browser"]),Bt=zod.z.enum(["account-proof","storage-proof","code-hash"]),at=zod.z.enum(["direct","ohttp","anyone-socks","anon-rpc"]),Ut=zod.z.enum(["not-run","agree","divergent"]),jt=zod.z.object({requestId:zod.z.string(),method:zod.z.string(),requestBinding:zod.z.string(),resultBinding:zod.z.string()}),zt=zod.z.object({number:N,hash:U,stateRoot:U,finalized:zod.z.boolean(),chainId:N.optional()}),Ft=zod.z.object({source:zod.z.string().nullable().default(null),checkpoint:zod.z.string().nullable().default(null),checkpointSource:zod.z.string().nullable().default(null)}),Wt=zod.z.object({status:Mt,rootSource:st,verifierLocation:Ht,mechanisms:zod.z.array(Bt),bootstrap:Ft}),Gt=zod.z.object({transport:at,mechanism:zod.z.string().nullable().default(null)}),Kt=zod.z.enum(["success","transport-failure","provider-error","invalid-proof"]),Yt=zod.z.object({provider:zod.z.string(),outcome:Kt,elapsedMs:N,failureReason:zod.z.string().nullish()}),Qt=zod.z.object({comparison:Ut,providersTried:N,providerLabel:zod.z.string().nullable().default(null),attempts:zod.z.array(Yt).default([])}),Jt=zod.z.object({observedAt:N,ageSeconds:N,pinned:zod.z.boolean()}),Xt=zod.z.object({code:zod.z.string(),message:zod.z.string()}),q=zod.z.object({identity:jt,block:zt,verification:Wt,privacy:Gt,routing:Qt,freshness:Jt,warnings:zod.z.array(Xt).default([])}),Zt=zod.z.enum(["required","preferred","disabled"]),ct=zod.z.enum(["finalized","latest"]),lt=zod.z.object({verification:Zt,privacy:zod.z.enum(["required","preferred","off"]),consistency:zod.z.enum(["single","compare"]),blockPolicy:ct,timeoutMs:zod.z.number().int().min(1).max(12e4)}),qe={success:"ok","invalid-proof":"INVALID_PROOF","transport-failure":"transport_error","provider-error":"PROVIDER_ERROR"};function er(e){if(typeof e!="object"||e===null||Array.isArray(e))return e;let t=e,r=typeof t.outcome=="string"?qe[t.outcome]??t.outcome:t.outcome,i=t.reason??t.failureReason;return {provider:t.provider,outcome:r,elapsedMs:t.elapsedMs,...i!=null?{reason:i}:{}}}o(er,"normalizeAttempt");var ut=zod.z.preprocess(er,zod.z.object({provider:zod.z.string(),outcome:zod.z.string(),elapsedMs:zod.z.number().nonnegative(),reason:zod.z.string().nullish()})),tr=zod.z.object({code:zod.z.number().int(),message:zod.z.string(),data:zod.z.unknown().optional()}),Me=zod.z.object({value:ie(),receipt:q,attempts:zod.z.array(ut).default([])}),dt=zod.z.object({number:zod.z.number().int().nonnegative(),hash:U,stateRoot:U,rootSource:zod.z.string(),verified:zod.z.boolean(),chainId:zod.z.number().int().positive().optional()}),He=zod.z.object({id:zod.z.string(),createdAt:zod.z.number(),method:zod.z.string(),params:zod.z.object({address:zod.z.string().optional(),slot:zod.z.string().optional()}),value:zod.z.string().nullish(),blockNumber:N.nullish(),receipt:q.nullish(),error:tr.nullish(),attempts:zod.z.array(ut).default([])}),pt=zod.z.object({receipts:zod.z.array(He)}),rr=zod.z.enum(["closed","open","half-open"]),Be=zod.z.object({name:zod.z.string(),chainOk:zod.z.boolean(),proofSupport:zod.z.boolean(),eip1898:zod.z.boolean(),transport:at.default("direct"),breaker:zod.z.object({state:rr,cooldownUntil:zod.z.number().nullish(),reason:zod.z.string().nullish()}),successRate:zod.z.number().min(0).max(1).nullish(),lastError:zod.z.string().nullish()}),nr=zod.z.object({synced:zod.z.boolean(),finalizedNumber:N.nullish(),finalizedHash:U.nullish(),lagSeconds:N.nullish(),lastUpdateUnix:N.nullish(),headNumber:N.nullish(),checkpoint:zod.z.string().nullish(),checkpointSource:zod.z.string().nullish()}),or=zod.z.object({ok:zod.z.boolean().default(true),chainId:zod.z.number().int().optional(),bind:zod.z.string().optional(),rootSource:st.nullable(),devMode:zod.z.boolean().default(false),providers:zod.z.array(Be),providerCount:zod.z.number().int().nonnegative(),lightClient:nr,error:zod.z.object({code:zod.z.string(),message:zod.z.string()}).nullish()}),De=o(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isObj");function ir(e){if(!De(e))return e;let t=Array.isArray(e.providers)?e.providers:[],r=typeof e.providers=="number"?e.providers:t.length;if(De(e.lightClient))return {rootSource:null,providerCount:r,...e,providers:t};let i=De(e.bootstrap)?e.bootstrap:{},s=typeof e.rootSource=="string"?e.rootSource:null;return {ok:e.status===void 0?true:e.status==="ok",...typeof e.bind=="string"?{bind:e.bind}:{},rootSource:s,devMode:s==="untrusted-rpc",providers:t,providerCount:r,lightClient:{synced:e.synced===true,finalizedNumber:e.finalizedNumber??null,finalizedHash:e.finalizedHash??null,lagSeconds:e.lagSeconds??null,lastUpdateUnix:e.lastUpdateUnix??null,headNumber:e.headNumber??null,checkpoint:i.checkpoint??null,checkpointSource:i.checkpointSource??null},error:typeof e.error=="string"?{code:e.error,message:typeof e.message=="string"?e.message:""}:null}}o(ir,"normalizeHealth");var ft=zod.z.preprocess(ir,or),gt=zod.z.object({methods:zod.z.array(zod.z.string()),verifiedMethods:zod.z.array(zod.z.string()).default([]),blockPolicies:zod.z.array(ct).default(["finalized"]),privacy:zod.z.boolean().default(false)}).passthrough(),sr=zod.z.union([zod.z.object({status:zod.z.enum(["normal-eoa","contract","revoked","invalid-designator"])}),zod.z.object({status:zod.z.literal("delegated"),delegate:ie(20)}),zod.z.enum(["normal-eoa","delegated","contract","revoked","invalid-designator"])]),ar=zod.z.enum(["normal-eoa","smart-contract","delegation-detected","delegation-revoked","unverified-delegate","delegate-code-verified","potential-risk","security-assessment-unavailable"]),mt=zod.z.object({address:ie(20),status:sr,isDelegated:zod.z.boolean(),delegateAddress:ie(20).nullish(),codeHash:U,delegateCodeHash:U.nullish(),securityClassification:ar,blockNumber:N.optional(),verified:zod.z.boolean().default(true),receipt:q});function cr(e,t){let r=e;for(let i of t){if(r===null||typeof r!="object")return;r=r[i];}return r}o(cr,"valueAt");function lr(e){return e===void 0?"undefined":typeof e=="string"?JSON.stringify(e.length>24?`${e.slice(0,24)}\u2026`:e):e===null||typeof e!="object"?String(e):Array.isArray(e)?"array":"object"}o(lr,"show");function le(e,t,r){return e.issues.map(i=>{let s=[r,...i.path].join("."),l=lr(cr(t,i.path)),u=i.message;return i.code==="invalid_type"&&i.message==="Required"?u=`expected ${i.expected}`:i.code==="invalid_type"&&i.message.startsWith("Expected")?u=`expected ${i.expected}`:i.code==="invalid_enum_value"&&(u=`expected one of ${i.options.join(" | ")}`),`${s}: ${u}, got ${l}`})}o(le,"formatIssues");var ur=1;function dr(e){return e.split(/[?#]/)[0]??e}o(dr,"safeUrl");function Ue(e,t,r){let i=dr(e.url)||"/";return new D(L.ENGINE_UNREACHABLE,`Could not reach the Veriq engine at ${i}: ${t}`,{hint:`No Veriq engine at ${i}. Start it with: cd backend && cargo run -p veriq-server`,cause:r})}o(Ue,"unreachable");async function ht(e,t,r,i,s){let l=new AbortController,u=false,h=setTimeout(()=>{u=true,l.abort();},i.timeoutMs),g=o(()=>l.abort(),"onAbort");i.signal?.addEventListener("abort",g,{once:true});let a=Date.now();try{let c;try{c=await e.fetch(t,{...r,signal:l.signal});}catch(m){throw u?new Z(R.PROVIDER_TIMEOUT,`No answer from the engine within ${i.timeoutMs} ms (client-side timeout)`,{hint:"The engine did not answer in time. Raise timeoutMs, or check that the engine is healthy with: veriq health",cause:m}):i.signal?.aborted?m:Ue(e,m instanceof Error?m.message:String(m),m)}let d;try{d=await c.json();}catch(m){throw Ue(e,`HTTP ${c.status} with a non-JSON body. Is this a Veriq engine?`,m)}if(!c.ok&&!(d&&typeof d=="object"&&"error"in d))throw Ue(e,`HTTP ${c.status}`);return d}finally{clearTimeout(h),i.signal?.removeEventListener("abort",g),e.debug&&console.debug(`[veriq] ${s} ${Date.now()-a} ms`);}}o(ht,"send");async function V(e,t,r,i){return (await je(e,t,r,i)).result}o(V,"rpcCall");async function je(e,t,r,i){let s=await ht(e,e.url||"/",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:ur++,method:t,params:r})},i,t);if(!s||typeof s!="object")throw new G([`response: expected a JSON-RPC object, got ${typeof s}`]);if("error"in s&&s.error&&typeof s.error=="object"){let l=s.error;if(typeof l.code=="number")throw it({code:l.code,message:typeof l.message=="string"?l.message:"engine error",data:l.data})}if(!("result"in s))throw new G(["response.result: expected a value, got undefined"]);return "veriq"in s&&s.veriq!=null?{result:s.result,veriq:s.veriq}:{result:s.result}}o(je,"rpcEnvelope");function ue(e,t,r){return ht(e,`${e.url}${t}`,{method:"GET"},r,`GET ${t.split("?")[0]}`)}o(ue,"httpGet");function _(e,t,r){let i=e.safeParse(t);if(!i.success)throw new G(le(i.error,t,r));return i.data}o(_,"parseWith");function ze(e,t){return e?.[t]??"latest"}o(ze,"blockTag");function Fe(e,t={}){let r=t.policy??e.policy,i=t.strict??r.verification==="required",s,l=o(c=>{s=c,t.onReceipt?.(c);},"record"),u=o((c,d)=>{if(d==="finalized")return true;if(i)throw new X(R.UNSUPPORTED_VERIFICATION,`${c} at block "${typeof d=="string"?d:"custom"}" can't be proven; only "finalized" can`,{hint:"Pass blockTag: 'finalized' (viem defaults to 'latest')."});return false},"verifiedPath");async function h({method:c,params:d}){if(c==="eth_getBalance"&&u(c,ze(d,1))){let T=await e.readBalance({address:String(d?.[0]),policy:r});return l(T.receipt),`0x${T.value.toString(16)}`}if(c==="eth_getStorageAt"&&u(c,ze(d,2))){let T=await e.readStorage({address:String(d?.[0]),slot:String(d?.[1]),policy:r});return l(T.receipt),T.value}if((c==="eth_getTransactionCount"||c==="eth_getCode")&&u(c,ze(d,1))){let{result:T,receipt:$}=await e.requestWithReceipt(c,d?[...d]:[]);return $&&l($),T}let{result:m,receipt:E}=await e.requestWithReceipt(c,d?[...d]:[]);return E&&l(E),m}o(h,"request");let g=h,a=o((()=>({config:{key:"veriq",name:"Veriq",request:g,retryCount:0,type:"veriq"},request:g,value:{get lastReceipt(){return s}}})),"transport");return Object.defineProperty(a,"lastReceipt",{get:o(()=>s,"get"),enumerable:true}),a}o(Fe,"createTransport");var Rt="http://127.0.0.1:8547",fr=/^0x[0-9a-fA-F]{40}$/,gr=/^0x[0-9a-fA-F]{1,64}$/;function ae(e){return e.routing.attempts.map(t=>({provider:t.provider,outcome:qe[t.outcome]??t.outcome,elapsedMs:t.elapsedMs,...t.failureReason?{reason:t.failureReason}:{}}))}o(ae,"attemptsFromReceipt");function de(e){return new C(R.INVALID_REQUEST,e)}o(de,"invalid");function M(e){if(typeof e!="string"||!fr.test(e))throw de("address must be 0x followed by 40 hex characters")}o(M,"assertAddress");function ce(e){if(typeof e!="string"||!gr.test(e))throw de("slot must be 0x followed by 1 to 64 hex characters")}o(ce,"assertSlot");function se(e){let t=lt.safeParse(e);if(!t.success)throw de(le(t.error,e,"policy").join("; "))}o(se,"assertPolicy");function bt(e={}){let t=(e.url??Rt).replace(/\/$/,""),r=e.policy??oe;se(r);let i=e.fetch??((a,c)=>globalThis.fetch(a,c)),s={url:t,fetch:i,debug:e.debug??false},l=o(a=>e.timeoutMs??a.timeoutMs+1e3,"readTimeout"),u={timeoutMs:e.timeoutMs??5e3};async function h(a,c,d,m){se(d);let E=await V(s,a,[...c,d],{timeoutMs:l(d),...m?{signal:m}:{}}),T=_(Me,E,"result");return {...T,attempts:T.attempts.length?T.attempts:ae(T.receipt)}}o(h,"read");let g={url:t,policy:r,async readBalance({address:a,policy:c=r,signal:d}){M(a);let m=await h("veriq_readBalance",[a],c,d);return {value:BigInt(m.value),receipt:m.receipt,verified:m.receipt.verification.status==="verified",attempts:m.attempts}},async readStorage({address:a,slot:c,policy:d=r,signal:m}){M(a),ce(c);let E=await h("veriq_readStorage",[a,c],d,m);return {value:`0x${BigInt(E.value).toString(16).padStart(64,"0")}`,receipt:E.receipt,verified:E.receipt.verification.status==="verified",attempts:E.attempts}},async getDelegation({address:a,policy:c=r,signal:d}){M(a),se(c);let m=await V(s,"veriq_getDelegation",[a,c],{timeoutMs:l(c),...d?{signal:d}:{}});return _(mt,m,"delegation")},async getReceipt(a){let c=await V(s,"veriq_getReceipt",[a],u),d=c&&typeof c=="object"&&"receipt"in c&&!("identity"in c)?c.receipt:c;return _(q,d,"receipt")},async getReceiptRecord(a){return _(He,await ue(s,`/receipts/${encodeURIComponent(a)}`,u),"record")},async listReceipts(a=50){return _(pt,await ue(s,`/receipts?limit=${a}`,u),"receipts").receipts},async health(){return _(ft,await ue(s,"/health",u),"health")},async providers(){let a=await V(s,"veriq_getProviderHealth",[],u),c=a&&typeof a=="object"&&"providers"in a?a.providers:a;return _(zod.z.array(Be),c,"providers")},async getRoot(){return _(dt,await V(s,"veriq_getRoot",[],u),"root")},async verifyProof(a,c=r){if(se(c),M(a.address),a.kind==="storage"){if(a.slot===void 0)throw de("a storage proof needs a slot");ce(a.slot);}let{slot:d,elapsedMs:m,...E}=a,T={...E,...a.kind==="storage"?{slot:d}:{},...m===void 0?{}:{elapsedMs:m}},$=await V(s,"veriq_verifyProof",[T,c],{timeoutMs:l(c)}),z=_(Me,$,"result");return {value:z.value,receipt:z.receipt,verified:z.receipt.verification.status==="verified",attempts:ae(z.receipt)}},async capabilities(){return _(gt,await V(s,"veriq_getCapabilities",[],u),"capabilities")},transport:o(a=>Fe(g,a),"transport"),withPolicy:o(a=>bt({...e,policy:a}),"withPolicy"),request:o((a,c=[])=>V(s,a,c,{timeoutMs:l(r)}),"request"),async requestWithReceipt(a,c=[]){let{result:d,veriq:m}=await je(s,a,c,{timeoutMs:l(r)});return {result:d,receipt:m===void 0?void 0:_(q,m,"veriq")}}};return Object.freeze(g)}o(bt,"createVeriq");var mr="0xef0100",un=23,dn=48,hr="0x0000000000000000000000000000000000000000";function Rr(e){let t=e.toLowerCase(),r=t.startsWith("0x")?t:`0x${t}`;if(r==="0x"||r.length<=2)return {isDesignator:false,delegate:null,isRevoked:false,isMalformed:false};if(!r.startsWith(mr))return {isDesignator:false,delegate:null,isRevoked:false,isMalformed:false};if(r.length!==48)return {isDesignator:false,delegate:null,isRevoked:false,isMalformed:true};let i=`0x${r.slice(8)}`,s=i===hr;return {isDesignator:!s,delegate:s?null:i,isRevoked:s,isMalformed:false}}o(Rr,"parseDelegationDesignator");function yt(e){let t=Rr(e);if(t.isMalformed)return {status:{status:"invalid-designator"},isDelegated:false,delegateAddress:null};if(t.isRevoked)return {status:{status:"revoked"},isDelegated:false,delegateAddress:null};if(t.isDesignator&&t.delegate)return {status:{status:"delegated",delegate:t.delegate},isDelegated:true,delegateAddress:t.delegate};let r=e.startsWith("0x")?e:`0x${e}`;return r==="0x"||r.length<=2?{status:{status:"normal-eoa"},isDelegated:false,delegateAddress:null}:{status:{status:"contract"},isDelegated:false,delegateAddress:null}}o(yt,"classifyAccountCode");var St={1:["nym","tor"],11155111:["nox"]};function It(e,t){let r=St[e];if(!r)throw new W(R.PRIVACY_UNAVAILABLE,`no private network is known for chain ${e}`);if(!r.includes(t))throw new W(R.PRIVACY_UNAVAILABLE,`"${t}" does not carry chain ${e}; use ${r.map(i=>`"${i}"`).join(" or ")}`,{hint:"The private network follows the chain: Nox on Sepolia, Nym or Tor on mainnet. Nothing was sent."})}o(It,"assertNetworkForChain");var wt=/^[A-Za-z0-9_.-]{1,64}$/,br=1,vt=160,yr=new Set(["localhost","127.0.0.1","[::1]"]),wr=1500,xt=/^0x[0-9a-fA-F]{64}$/,vr={balance:["account-proof"],nonce:["account-proof"],storage:["account-proof","storage-proof"],code:["account-proof","code-hash"]},We=class We extends Error{constructor(r,i){super(r);this.code=i;}};o(We,"UpstreamError");var H=We,j=o(e=>new C(R.INVALID_REQUEST,e),"invalid");function xr(e){if(!Array.isArray(e.providers)||e.providers.length===0)throw j("createPrivateReader needs at least one provider");if(typeof e.network!="string"||!wt.test(e.network))throw j("network must be 1-64 letters, digits, '_', '-' or '.'");let t=new Set;e.providers.forEach((r,i)=>{if(typeof r.label!="string"||!wt.test(r.label))throw j(`providers[${i}].label must be 1-64 letters, digits, '_', '-' or '.'`);if(t.has(r.label))throw j(`provider label "${r.label}" is used twice`);t.add(r.label);let s;try{s=new URL(r.url);}catch{throw j(`provider "${r.label}": url is not a valid URL`)}let l=s.protocol==="http:"&&yr.has(s.hostname);if(s.protocol!=="https:"&&!(e.allowInsecureLoopback&&l))throw j(`provider "${r.label}": url must be https`)});}o(xr,"validateOptions");function Er(e){let t=new Set;for(let{url:r}of e){t.add(r);try{let i=new URL(r);t.add(`${i.origin}${i.pathname}`);for(let s of i.pathname.split("/"))s.length>=8&&t.add(s);for(let s of i.searchParams.values())s.length>=8&&t.add(s);i.username&&t.add(i.username),i.password&&t.add(i.password);}catch{}}return [...t].sort((r,i)=>i.length-r.length)}o(Er,"secretsOf");function Et(e,t){let r=e;for(let i of t)r=r.split(i).join("<redacted>");return r=r.replace(/\b[a-z][a-z0-9+.-]*:\/\/[^\s"'<>]+/gi,"<url>"),r=r.replace(/\s+/g," ").trim(),r.length>vt?`${r.slice(0,vt)}\u2026`:r}o(Et,"sanitize");function Sr(e){return e instanceof H?e.code===-32602||e.code===-32e3||/unknown block|header not found|block not found/i.test(e.message):false}o(Sr,"blockRefused");function Ir(e,t,r){if(e==="code")return t.toLowerCase()===r.toLowerCase();try{return BigInt(t)===BigInt(r)}catch{return false}}o(Ir,"sameValue");function Ar(e){return e instanceof C&&/veriq_getRoot/.test(e.message)}o(Ar,"rootMoved");function kr(e,t){xr(t),t.chainId!==void 0&&It(t.chainId,t.network);let r=t.timeoutMs??3e4,i=t.providers.map(p=>({...p})),s=Er(i),l=t.alignTimeoutMs??3e4;async function u(p){let f;try{f=await p.finalized();}catch{return null}return !f||!Number.isSafeInteger(f.number)||!xt.test(f.hash)||!xt.test(f.stateRoot)?null:{number:f.number,hash:f.hash,stateRoot:f.stateRoot}}o(u,"browserFinalized");async function h(){let p=await e.getRoot(),f=p.chainId??11155111;if(t.chainId!==void 0&&f!==t.chainId)throw new ne(L.CHAIN_MISMATCH,`the engine serves chain ${f}, this reader reads chain ${t.chainId}; nothing was read`);return p}o(h,"engineRoot");let g=null;function a(){let p=t.verifier;return p?(g??(g=(async()=>{try{return {verifier:typeof p=="function"?await p():p}}catch(f){return {unavailable:f instanceof Error?f.message:String(f)}}})()),g):Promise.resolve(null)}o(a,"browserVerifier");async function c(p){let f=t.lightClient;if(!f)return {root:await h()};let y=Date.now()+l;for(;;){let[b,w]=await Promise.all([h().then(x=>({root:x}),x=>({error:x})),u(f)]);if("error"in b){if(b.error instanceof D&&w&&p)return {root:{...w,rootSource:"local-light-client",verified:true},browser:w,engineDown:true};throw b.error}let v=b.root;if(!w)return {root:v};if(w.number===v.number){let x=o((P,I)=>P.toLowerCase()===I.toLowerCase(),"same");if(!x(w.hash,v.hash)||!x(w.stateRoot,v.stateRoot))throw new te(R.ROOT_MISMATCH,`finalized block #${v.number}: the browser light client has ${w.hash} (state root ${w.stateRoot}), the engine has ${v.hash} (state root ${v.stateRoot}); nothing was read`);return {root:v,browser:w}}if(Date.now()>=y)throw new J(R.ROOT_UNAVAILABLE,`the browser light client is at finalized block #${w.number} and the engine at #${v.number}; they did not agree within ${Math.round(l/1e3)} s`,{hint:"One light client is not following finality. Check the engine /health and the browser light client status."});await new Promise(x=>setTimeout(x,wr));}}o(c,"pinRoot");let d=new Set,m=1;async function E(p,f,y){let b=m++,w=new AbortController,v,x=new Promise((I,A)=>{v=setTimeout(()=>{w.abort(),A(new H(`no answer within ${r} ms`,void 0));},r);}),P=(async()=>{let I,A;try{I=await t.fetch(p.url,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:b,method:f,params:y}),signal:w.signal}),A=await I.json();}catch(k){let F=k instanceof Error?k.message:String(k);throw new H(Et(F||"request failed",s),void 0)}if(A&&typeof A=="object"&&A.error){let k=typeof A.error.message=="string"?A.error.message:"provider error",F=typeof A.error.code=="number"?A.error.code:void 0;throw new H(Et(k,s),F)}if(!A||typeof A!="object"||!("result"in A))throw new H(`HTTP ${I.status} without a JSON-RPC result`,void 0);if(A.id!==b)throw new H("JSON-RPC answer has the wrong id",void 0);return A.result})();try{return await Promise.race([P,x])}finally{clearTimeout(v);}}o(E,"upstream");async function T(p,f,y,b){if(!d.has(p.label))try{return await E(p,f,[...y,{blockHash:b.hash}])}catch(w){if(!Sr(w))throw w;w.code===-32602&&d.add(p.label);}return E(p,f,[...y,`0x${b.number.toString(16)}`])}o(T,"atBlock");async function $(p,f,y,b){if(M(f),p==="storage"){if(y===void 0)throw j("readStorage needs a slot");ce(y);}let w=await a(),v=w&&"verifier"in w?w.verifier:null,x=[],P=o(k=>`${k.label}@anon-rpc:${t.network}`,"attemptLabel"),I;for(let k of i)for(let F=0;;F++){let{root:Y,browser:he,engineDown:Ot}=await c(v!==null),Re=Date.now(),be,ye;try{be=await T(k,"eth_getProof",[f,y===void 0?[]:[y]],Y),p==="code"&&(ye=await T(k,"eth_getCode",[f],Y));}catch(O){I=O,x.push({provider:P(k),outcome:"transport-failure",elapsedMs:Date.now()-Re,failureReason:"provider request failed"});break}let Q=null;if(v){let O=v.verifyRead({stateRoot:Y.stateRoot,address:f,kind:p,...y===void 0?{}:{slot:y},proof:be,...p==="code"?{code:ye}:{}});if(!O.ok){if(O.code==="INVALID_PROOF"){I=new B(R.INVALID_PROOF,`${k.label}: rejected in the browser, the engine was not asked: ${O.error}`),x.push({provider:P(k),outcome:"invalid-proof",elapsedMs:Date.now()-Re,failureReason:"INVALID_PROOF: provider attempt failed"});break}throw new C(R.INVALID_REQUEST,`the browser verifier refused the read: ${O.error}`)}Q=O.value;}let we=Date.now()-Re,tt={kind:p,address:f,...y===void 0?{}:{slot:y},blockHash:Y.hash,proof:be,...p==="code"?{code:ye}:{},provider:k.label,network:t.network,elapsedMs:we,...he?{browserRoot:he}:{},...v?{verifier:"browser"}:t.verifier?{verifier:"unavailable"}:{}},rt=o(()=>(x.push({provider:P(k),outcome:"success",elapsedMs:we}),z(v,tt,Q,Y,x,b)),"localOnly");if(Ot)return rt();try{let O=await e.verifyProof(tt,b);if(Q!==null&&!Ir(p,Q,O.value))throw new re(R.INTERNAL_ERROR,"the browser verifier and the engine proved different values from the same proof; nothing was returned");return O}catch(O){if(O instanceof D&&Q!==null&&he)return rt();if(I=O,O instanceof B&&x.push({provider:P(k),outcome:"invalid-proof",elapsedMs:we,failureReason:"INVALID_PROOF: provider attempt failed"}),Ar(O)){if(F<br)continue;throw new C(R.INVALID_REQUEST,`the finalized block moved again while fetching through ${t.network}; nothing was verified`,{cause:O,hint:"Retry the read. The provider or network is slower than the finalized block moves."})}if(O instanceof B)break;throw O}}if(I instanceof S)throw I;let A=I instanceof Error?I.message:"no answer";throw new ee(R.ALL_PROVIDERS_FAILED,`no provider answered through ${t.network} (${i.length} tried): ${A}`,{hint:"The anonymizing network may still be connecting, or the providers refuse browser requests (CORS)."})}o($,"read");function z(p,f,y,b,w,v){let x="veriq_verifyProof",P=v?[f,v]:[f],I=[{code:"LOCAL_ONLY",message:`the engine could not be reached: this value was verified in the browser against its own light client (synced over ${t.network}); the engine did not see or store this receipt`},{code:"BROWSER_LIGHT_CLIENT",message:`a light client in the browser, synced over ${t.network}, produced this finalized block and state root`}];v?.consistency==="compare"&&I.push({code:"COMPARE_UNAVAILABLE",message:"a client-fetched proof comes from one provider; nothing was compared"});let A=Math.floor(Date.now()/1e3),k=q.parse({identity:{requestId:`local-${Date.now().toString(16)}-${Math.floor(Math.random()*16777215).toString(16).padStart(6,"0")}`,method:x,requestBinding:p.binding(x,P),resultBinding:p.binding(x,y)},block:{number:b.number,hash:b.hash,stateRoot:b.stateRoot,finalized:true,...t.chainId!==void 0?{chainId:t.chainId}:{}},verification:{status:"verified",rootSource:"local-light-client",verifierLocation:"browser",mechanisms:vr[f.kind],bootstrap:{source:"browser-light-client",checkpoint:null,checkpointSource:null}},privacy:{transport:"anon-rpc",mechanism:t.network},routing:{comparison:"not-run",providersTried:w.length,providerLabel:`${f.provider}@anon-rpc:${t.network}`,attempts:w},freshness:{observedAt:A,ageSeconds:0,pinned:true},warnings:I});return {value:y,receipt:k,verified:true,attempts:ae(k)}}o(z,"localResult");let et=o(p=>({...p,value:BigInt(p.value)}),"word");return {readBalance:o(async({address:p,policy:f})=>et(await $("balance",p,void 0,f)),"readBalance"),readNonce:o(async({address:p,policy:f})=>et(await $("nonce",p,void 0,f)),"readNonce"),readStorage:o(async({address:p,slot:f,policy:y})=>{let b=await $("storage",p,f,y);return {...b,value:`0x${BigInt(b.value).toString(16).padStart(64,"0")}`}},"readStorage"),readCode:o(({address:p,policy:f})=>$("code",p,void 0,f),"readCode"),getDelegation:o(async({address:p,policy:f})=>{M(p);let y=await $("code",p,void 0,f),b=yt(y.value),w=b.isDelegated,v=b.delegateAddress,x={...y.receipt,warnings:[...y.receipt.warnings]},P;b.status.status==="normal-eoa"?P="normal-eoa":b.status.status==="delegated"?(P="delegation-detected",v&&x.warnings.push({code:"EIP7702_DELEGATION_DETECTED",message:`EIP-7702 delegation active: calls execute code from ${v}`})):b.status.status==="revoked"?(P="delegation-revoked",x.warnings.push({code:"EIP7702_DELEGATION_REVOKED",message:"EIP-7702 delegation cleared: account was previously delegated but is now empty"})):b.status.status==="contract"?P="smart-contract":(P="potential-risk",x.warnings.push({code:"EIP7702_INVALID_DESIGNATOR",message:"Account code begins with 0xef0100 but has invalid length or malformed encoding"}));let I=y.receipt.identity.resultBinding||`0x${"0".repeat(64)}`;return {address:p,status:b.status,isDelegated:w,delegateAddress:v,codeHash:I,securityClassification:P,blockNumber:y.receipt.block.number,verified:y.verified,receipt:x}},"getDelegation")}}o(kr,"createPrivateReader");var Ge=2,Ke=class Ke extends S{constructor(t,r){super(R.INTERNAL_ERROR,t,{cause:r,hint:"The browser verifier did not load; the engine still verifies every proof."});}};o(Ke,"VerifierUnavailableError");var K=Ke;async function Tr(e){if(typeof e=="string"||e instanceof URL){let t=await fetch(e);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.arrayBuffer()}return typeof Response<"u"&&e instanceof Response?e.arrayBuffer():e}o(Tr,"bytesOf");async function Or(e){let t;try{let u=await Tr(e);t=(u instanceof WebAssembly.Module?await WebAssembly.instantiate(u,{}):(await WebAssembly.instantiate(u,{})).instance).exports;}catch(u){let h=u instanceof Error?u.message:String(u);throw new K(`the browser verifier could not be loaded: ${h}`,u)}let r=typeof t.veriq_abi_version=="function"?t.veriq_abi_version():1;if(r!==Ge||typeof t.veriq_verify_read!="function")throw new K(`the browser verifier speaks ABI ${r}, this SDK needs ${Ge}`);let i=new TextEncoder,s=new TextDecoder;function l(u,h){let g=i.encode(JSON.stringify(h)),a=t.veriq_alloc(g.length);new Uint8Array(t.memory.buffer,a,g.length).set(g);let c;try{c=u(a,g.length);}finally{t.veriq_free(a,g.length);}let d=Number(c>>32n),m=Number(c&0xffffffffn),E=s.decode(new Uint8Array(t.memory.buffer,d,m).slice());return t.veriq_free(d,m),JSON.parse(E)}return o(l,"call"),{abiVersion:r,verifyRead(u){let{stateRoot:h,address:g,kind:a,slot:c,proof:d,code:m}=u,E=l(t.veriq_verify_read,{stateRoot:h,address:g,kind:a,slot:c,proof:d,code:m});return E.ok===true&&typeof E.value=="string"?{ok:true,value:E.value}:{ok:false,code:String(E.code??"INTERNAL_ERROR"),error:String(E.error??"verification failed")}},binding(u,h){let g=l(t.veriq_binding,{method:u,value:h});if(g.ok!==true||typeof g.binding!="string")throw new K(`binding failed: ${String(g.error)}`);return g.binding}}}o(Or,"loadVerifier");var At=10n**18n;function kt(e,t={}){let r=t.decimals??4,i=t.symbol===false?"":" ETH",s=typeof e=="bigint"?e:BigInt(e),l=s<0n,u=l?-s:s,h=u/At,g=(u%At).toString().padStart(18,"0").slice(0,r).replace(/0+$/,"");if(h===0n&&g===""&&u>0n)return `${l?">-":"<"}0.${"0".repeat(Math.max(0,r-1))}1${i}`;let a=h.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return `${l?"-":""}${a}${g?`.${g}`:""}${i}`}o(kt,"formatEth");function pe(e,t=4,r=4){let i=e.startsWith("0x")?t+2:t;return e.length<=i+r+1?e:`${e.slice(0,i)}\u2026${e.slice(-r)}`}o(pe,"shortHash");function Ye(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}o(Ye,"formatNumber");function Qe(e){switch(e){case "local-light-client":return "local light client (Helios)";case "fixture":return "fixture (tests only)";case "untrusted-rpc":return "untrusted RPC (DEV MODE)"}}o(Qe,"rootSourceLabel");function Pr(e){return "identity"in e?{receipt:e,attempts:[]}:{receipt:e.receipt,...e.value!==void 0?{value:e.value}:{},attempts:e.attempts??[]}}o(Pr,"split");function Nr(e){return e==="verified"?"ok":e==="unverified"?"warn":"lav"}o(Nr,"statusTone");function _r(e,t){if(t===void 0)return "";if(/storage/i.test(e.identity.method)){let r=typeof t=="bigint"?t:BigInt(t);return r<10n**15n?r.toString():pe(`0x${r.toString(16)}`)}return kt(t)}o(_r,"formatValue");function fe(e){let{receipt:t,value:r,attempts:i}=Pr(e),s=[{label:"block",value:`#${Ye(t.block.number)} ${pe(t.block.hash)}${t.block.finalized?"":" (not finalized)"}`},{label:"stateRoot",value:pe(t.block.stateRoot)},{label:"root",value:Qe(t.verification.rootSource),tone:t.verification.rootSource==="untrusted-rpc"?"warn":"ink"}],l=i.reduce((g,a)=>g+a.elapsedMs,0),u=i.length||t.routing.providersTried,h=[t.routing.providerLabel??"\u2014",`${u} attempt${u===1?"":"s"}`,...i.length?[`${Math.round(l)} ms`]:[]].join(" \xB7 ");s.push({label:"provider",value:h});for(let g of i)g.outcome!=="ok"&&s.push({label:"rejected",value:`${g.provider} ${g.outcome}`,tone:"err"});t.routing.comparison!=="not-run"&&s.push({label:"compare",value:t.routing.comparison,tone:t.routing.comparison==="agree"?"ok":"warn"});for(let g of t.warnings)s.push({label:"warning",value:g.code,tone:"warn"});return {status:t.verification.status,value:_r(t,r),rows:s}}o(fe,"receiptRows");function $r(e){let{status:t,value:r,rows:i}=fe(e);return [`${t.toUpperCase()}${r?` ${r}`:""}`,...i.map(s=>`${s.label.padEnd(10)} ${s.value}`)].join(`
2
+ `)}o($r,"formatReceipt");function Je(e){let t=e.lightClient,r=t.finalizedNumber!=null&&t.headNumber!=null?`${t.headNumber-t.finalizedNumber} blocks behind head`:"",i=[{label:"engine",value:`${e.ok?"online":`degraded${e.error?` \xB7 ${e.error.code}`:""}`}${e.bind?` \xB7 ${e.bind}`:""}`,tone:e.ok?"ok":"warn"},{label:"root",value:e.rootSource?Qe(e.rootSource):"none yet (light client not synced)",tone:!e.rootSource||e.devMode||e.rootSource==="untrusted-rpc"?"warn":"ink"},{label:"light",value:t.synced?"synced":"not synced",tone:t.synced?"ok":"warn"},{label:"finalized",value:t.finalizedNumber!=null?`#${Ye(t.finalizedNumber)}${r?` \xB7 ${r}`:""}`:"\u2014"}],s=e.providers.map(l=>[l.name,l.chainOk?"yes":"no",l.proofSupport?"yes":"no",l.eip1898?"yes":"no",l.breaker.state,l.transport]);return e.providers.length===0&&i.push({label:"providers",value:`${e.providerCount} configured`,tone:"ink"}),{engine:i,providers:s}}o(Je,"healthRows");var Cr={ink:null,muted:[91,91,102],lav:[156,149,214],border:[156,149,214],title:[107,98,181],ok:[47,158,110],warn:[183,121,31],err:[194,65,91]};function Tt(e){return globalThis.process?.env?.[e]}o(Tt,"env");function me(){return Tt("NO_COLOR")!==void 0?false:Tt("FORCE_COLOR")!==void 0?true:globalThis.process?.stdout?.isTTY===true}o(me,"supportsColor");function Ze(e){return (t,r,i=false)=>{let s=Cr[t];return !e||!s&&!i?r:`${i?"\x1B[1m":""}${s?`\x1B[38;2;${s[0]};${s[1]};${s[2]}m`:""}${r}\x1B[0m`}}o(Ze,"painter");function Xe(e,t,r){let i=Math.max(e.length+6,...t.map(h=>h.plain.length))+4,s=`${r("border","\u256D\u2500 ")}${r("title",e,true)}${r("border",` ${"\u2500".repeat(i-e.length-3)}\u256E`)}`,l=t.map(h=>`${r("border","\u2502")} ${h.painted}${" ".repeat(i-h.plain.length-1)}${r("border","\u2502")}`),u=r("border",`\u2570${"\u2500".repeat(i)}\u256F`);return [s,...l,u].join(`
3
+ `)}o(Xe,"box");var ge=11;function Vr(e,t={}){let r=Ze(t.color??me()),{status:i,value:s,rows:l}=fe(e),u=i==="verified"?"ok":i==="unverified"?"warn":"lav",h=`\u25CF ${i.toUpperCase()}`,g=" ".repeat(Math.max(2,22-h.length)),a=[{plain:`${h}${g}${s}`,painted:`${r(u,h,true)}${g}${r("ink",s,true)}`},...l.map(c=>({plain:`${c.label.padEnd(ge)}${c.value}`,painted:`${r("muted",c.label.padEnd(ge))}${r(c.tone??"ink",c.value)}`}))];return Xe("Veriq \xB7 Trust Receipt",a,r)}o(Vr,"prettyReceipt");function Lr(e,t={}){let r=Ze(t.color??me()),{engine:i,providers:s}=Je(e),l=i.map(a=>({plain:`${a.label.padEnd(ge)}${a.value}`,painted:`${r("muted",a.label.padEnd(ge))}${r(a.tone??"ink",a.value)}`})),u=["provider","chain","proof","1898","breaker","transport"],h=u.map((a,c)=>Math.max(a.length,...s.map(d=>(d[c]??"").length))+2),g=o(a=>a.map((c,d)=>c.padEnd(h[d]??0)).join("").trimEnd(),"fmt");if(s.length===0)return Xe("Veriq \xB7 Engine health",l,r);l.push({plain:"",painted:""}),l.push({plain:g(u),painted:r("muted",g(u))});for(let a of s){let c=g(a),d=a[1]==="no"||a[2]==="no"||a[4]!=="closed";l.push({plain:c,painted:r(d?"err":"ink",c)});}return Xe("Veriq \xB7 Engine health",l,r)}o(Lr,"prettyHealth");function Dr(e,t={}){let r=Ze(t.color??me());return `${r("err",`\u2715 ${e.name} [${e.code} ${e.codeName}]`,true)}
4
4
  ${e.message}
5
- ${n("muted",`\u2192 ${e.hint}`)}`}i(Nt,"prettyError");exports.AllProvidersFailedError=M;exports.AttemptOutcomeSchema=rt;exports.AttemptSchema=Te;exports.BlockPolicySchema=ve;exports.BlockSchema=Ze;exports.BootstrapSchema=Xe;exports.BreakerStateSchema=lt;exports.CLIENT_CODES=A;exports.CapabilitiesSchema=Ne;exports.ComparisonSchema=Qe;exports.DEFAULT_ENGINE_URL=$e;exports.ERROR_CLASSES=De;exports.ERROR_CODES=g;exports.ERROR_HINTS=Me;exports.ERROR_MEANINGS=he;exports.EngineHealthSchema=Ae;exports.EngineUnreachableError=O;exports.FreshnessSchema=it;exports.Hex32Schema=re;exports.IdentitySchema=Je;exports.InternalError=D;exports.InvalidProofError=q;exports.InvalidRequestError=I;exports.LightClientStatusSchema=ut;exports.MechanismSchema=Ke;exports.OUTCOME_LABEL=ne;exports.PolicySchema=Se;exports.PolicyUnsatisfiableError=j;exports.PrivacySchema=tt;exports.PrivacyUnavailableError=U;exports.ProviderHealthSchema=ie;exports.ProviderTimeoutError=T;exports.ReadResultSchema=Ie;exports.ReceiptListSchema=Oe;exports.ReceiptRecordSchema=oe;exports.RootSourceSchema=xe;exports.RootUnavailableError=_;exports.RoutingAttemptSchema=nt;exports.RoutingSchema=ot;exports.RpcErrorSchema=pt;exports.TransportKindSchema=Ee;exports.TrustReceiptSchema=k;exports.UnsupportedVerificationError=S;exports.VerificationPolicySchema=at;exports.VerificationSchema=et;exports.VerificationStatusSchema=We;exports.VerifierLocationSchema=Ye;exports.VeriqError=h;exports.VeriqSchemaError=x;exports.WarningSchema=st;exports.assertAddress=ce;exports.assertPolicy=pe;exports.assertSlot=Ce;exports.attemptsFromReceipt=Pe;exports.createTransport=ae;exports.createVeriq=Ve;exports.devUnverified=Ge;exports.errorFromRpc=Re;exports.errorNameForCode=wt;exports.formatEth=qe;exports.formatIssues=w;exports.formatNumber=ue;exports.formatReceipt=Tt;exports.healthRows=fe;exports.isVeriqError=$t;exports.presets=Vt;exports.prettyError=Nt;exports.prettyHealth=At;exports.prettyReceipt=Ot;exports.privateVerified=Be;exports.receiptRows=C;exports.rootSourceLabel=de;exports.shortHash=P;exports.statusTone=vt;exports.supportsColor=L;exports.verifiedCompare=Fe;exports.verifiedFinalized=N;//# sourceMappingURL=index.cjs.map
5
+ ${r("muted",`\u2192 ${e.hint}`)}`}o(Dr,"prettyError");exports.AllProvidersFailedError=ee;exports.AttemptOutcomeSchema=Kt;exports.AttemptSchema=ut;exports.BlockPolicySchema=ct;exports.BlockSchema=zt;exports.BootstrapSchema=Ft;exports.BreakerStateSchema=rr;exports.CLIENT_CODES=L;exports.CapabilitiesSchema=gt;exports.ChainMismatchError=ne;exports.ComparisonSchema=Ut;exports.DEFAULT_ENGINE_URL=Rt;exports.DESIGNATOR_BYTE_LENGTH=un;exports.DESIGNATOR_HEX_LENGTH=dn;exports.DelegationResultSchema=mt;exports.DelegationSecurityClassificationSchema=ar;exports.DelegationStatusSchema=sr;exports.EIP7702_PREFIX=mr;exports.ERROR_CLASSES=$t;exports.ERROR_CODES=R;exports.ERROR_HINTS=_t;exports.ERROR_MEANINGS=nt;exports.EngineHealthSchema=ft;exports.EngineUnreachableError=D;exports.FreshnessSchema=Jt;exports.Hex32Schema=U;exports.IdentitySchema=jt;exports.InternalError=re;exports.InvalidProofError=B;exports.InvalidRequestError=C;exports.LightClientStatusSchema=nr;exports.MechanismSchema=Bt;exports.OUTCOME_LABEL=qe;exports.PRIVATE_NETWORKS=St;exports.PolicySchema=lt;exports.PolicyUnsatisfiableError=ve;exports.PrivacySchema=Gt;exports.PrivacyUnavailableError=W;exports.ProviderHealthSchema=Be;exports.ProviderTimeoutError=Z;exports.ReadResultSchema=Me;exports.ReceiptListSchema=pt;exports.ReceiptRecordSchema=He;exports.RootInfoSchema=dt;exports.RootMismatchError=te;exports.RootSourceSchema=st;exports.RootUnavailableError=J;exports.RoutingAttemptSchema=Yt;exports.RoutingSchema=Qt;exports.RpcErrorSchema=tr;exports.TransportKindSchema=at;exports.TrustReceiptSchema=q;exports.UnsupportedVerificationError=X;exports.VERIFIER_ABI_VERSION=Ge;exports.VerificationPolicySchema=Zt;exports.VerificationSchema=Wt;exports.VerificationStatusSchema=Mt;exports.VerifierLocationSchema=Ht;exports.VerifierUnavailableError=K;exports.VeriqError=S;exports.VeriqSchemaError=G;exports.WarningSchema=Xt;exports.ZERO_ADDRESS=hr;exports.assertAddress=M;exports.assertNetworkForChain=It;exports.assertPolicy=se;exports.assertSlot=ce;exports.attemptsFromReceipt=ae;exports.classifyAccountCode=yt;exports.createPrivateReader=kr;exports.createTransport=Fe;exports.createVeriq=bt;exports.devUnverified=qt;exports.errorFromRpc=it;exports.errorNameForCode=Mr;exports.formatEth=kt;exports.formatIssues=le;exports.formatNumber=Ye;exports.formatReceipt=$r;exports.healthRows=Je;exports.isVeriqError=Hr;exports.loadVerifier=Or;exports.parseDelegationDesignator=Rr;exports.presets=jr;exports.prettyError=Dr;exports.prettyHealth=Lr;exports.prettyReceipt=Vr;exports.privateVerified=Dt;exports.receiptRows=fe;exports.rootSourceLabel=Qe;exports.shortHash=pe;exports.statusTone=Nr;exports.supportsColor=me;exports.verifiedCompare=Lt;exports.verifiedFinalized=oe;//# sourceMappingURL=index.cjs.map
6
6
  //# sourceMappingURL=index.cjs.map