@bananapus/nana-sdk-core 2.21.0 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  import { type Address, type Hex, type PublicClient, type TransactionReceipt } from "viem";
2
+ import { erc2771ForwarderAbi } from "../generated/juicebox.js";
2
3
  /** Relayr's HTTP API. */
3
4
  export declare const RELAYR_API = "https://api.relayr.ba5ed.com";
4
5
  /**
@@ -448,5 +449,204 @@ export declare function verifyRelayrDestinations(clientFor: (chainId: number) =>
448
449
  records: readonly RelayrTransactionRecord[];
449
450
  account?: Address;
450
451
  }): Promise<RelayrVerifiedDestination[]>;
452
+ /**
453
+ * The reads that classify signed forward requests at a canonical finalized
454
+ * block. Typed by the fields they read, so a PublicClient for any chain, with
455
+ * that chain's formatters, satisfies it.
456
+ */
457
+ export type RelayrFinalizedClient = {
458
+ getBlock(args: {
459
+ blockTag: "finalized";
460
+ }): Promise<{
461
+ number: bigint | null;
462
+ hash: Hex | null;
463
+ timestamp: bigint;
464
+ }>;
465
+ getBlock(args: {
466
+ blockNumber: bigint;
467
+ }): Promise<{
468
+ hash: Hex | null;
469
+ }>;
470
+ readContract(args: {
471
+ address: Address;
472
+ abi: typeof erc2771ForwarderAbi;
473
+ functionName: "nonces";
474
+ args: readonly [Address];
475
+ blockNumber: bigint;
476
+ }): Promise<bigint>;
477
+ };
478
+ /**
479
+ * A signed forward request as these rules read it: its chain, its signer (the
480
+ * request's `from`, whose forwarder nonce it uses), its deadline in seconds,
481
+ * and the forwarder nonce it was signed with, when that was saved.
482
+ */
483
+ export type RelayrSignedRequest = {
484
+ chainId: number;
485
+ signer: Address;
486
+ deadline: number | bigint;
487
+ nonce?: string | bigint;
488
+ };
489
+ /**
490
+ * One signed request at a canonical finalized block on its chain (ruling
491
+ * R114). It is dead once the forwarder's nonce for its signer moved past the
492
+ * nonce it was signed with (it, or another request at that nonce, may have
493
+ * run), or once its deadline is strictly earlier than that block's timestamp.
494
+ * `unused`: the nonce still equals the saved one. Anything unknown is live: a
495
+ * failed read, a node without a finalized block, a block no longer canonical,
496
+ * and a request saved without its nonce until its deadline passes.
497
+ */
498
+ export type RelayrRequestState = {
499
+ live: true;
500
+ deadline: number;
501
+ } | {
502
+ live: false;
503
+ mayHaveRun: boolean;
504
+ unused: boolean;
505
+ };
506
+ /**
507
+ * What a set of requests allows together (ruling R114). While any one is live
508
+ * the set holds until `until`, the deadline of its last live request.
509
+ * `mayHaveRun` says whether a dead one's nonce moved or was never saved, and,
510
+ * once every one is dead, `unused` whether there is at least one and every
511
+ * nonce still equals the saved one.
512
+ */
513
+ export type RelayrRequestsVerdict = {
514
+ live: true;
515
+ until: number;
516
+ mayHaveRun: boolean;
517
+ } | {
518
+ live: false;
519
+ mayHaveRun: boolean;
520
+ unused: boolean;
521
+ };
522
+ /**
523
+ * Why a session whose requests are all dead can be discarded (ruling R114):
524
+ *
525
+ * - `ran`: a request's nonce moved past the one it was signed with, or the
526
+ * session saved no nonces, so one may have run;
527
+ * - `changed`: none ran, and the action's recheck refuses its calls;
528
+ * - `expired`: none ran, and no recheck could run, as in an account view. The
529
+ * action itself still signs them again at their saved nonces.
530
+ */
531
+ export type RelayrDiscardReason = "ran" | "changed" | "expired";
532
+ /**
533
+ * What a session whose bundle won't run as signed does next, from its
534
+ * requests' verdict (rulings R104 and R114). Discard ends only the session,
535
+ * never what the action saved.
536
+ *
537
+ * - `hold`: a request can still run and one may already have run. No new
538
+ * signature, no new quote and no Discard until `until`.
539
+ * - `refresh`: a request can still run and none moved (R114 (a)). Until
540
+ * `until`, the session may quote or pay its saved requests again while they
541
+ * still verify and the action's recheck passes, or sign each again at its
542
+ * saved nonce, in `nonces` (null when it saved none): the forwarder runs one
543
+ * request per nonce, so an old request and its refresh never both run. A
544
+ * signature at any other nonce waits until every request is dead.
545
+ * - `re-sign`: every request is dead and unused, and the recheck passed: sign
546
+ * the calls again at `nonces` (R104).
547
+ * - `discard`: every request is dead; Discard for `reason`. With `changed`,
548
+ * `error` is the recheck's refusal.
549
+ * - `reorg-hold`: every request is dead and none moved, but a finalized nonce
550
+ * is below a saved one (a reorg dropped an earlier forwarded transaction),
551
+ * or there are no saved nonces to sign at (`nonces` omitted or empty), or
552
+ * there were no requests. It holds until the nonce catches up.
553
+ * - `unchecked`: the recheck failed because the node could not answer (ruling
554
+ * R118): its cause chain holds a transport or JSON-RPC failure, or a revert
555
+ * without revert data, and no revert data. That decides nothing. Try again.
556
+ *
557
+ * `error` is never enumerable, so no JSON or log of an outcome shows it: an
558
+ * RPC error's URL can carry a key.
559
+ */
560
+ export type RelayrSessionOutcome = {
561
+ kind: "hold";
562
+ until: number;
563
+ } | {
564
+ kind: "refresh";
565
+ until: number;
566
+ nonces: string[] | null;
567
+ } | {
568
+ kind: "re-sign";
569
+ nonces: string[];
570
+ } | {
571
+ kind: "discard";
572
+ reason: RelayrDiscardReason;
573
+ error?: unknown;
574
+ } | {
575
+ kind: "reorg-hold";
576
+ } | {
577
+ kind: "unchecked";
578
+ error: unknown;
579
+ };
580
+ /**
581
+ * `read` at the chain's finalized block, with that block's timestamp, once
582
+ * the block at its number still has the same hash after the read. Null while
583
+ * any of it cannot be read: a node without the finalized tag, an RPC error, a
584
+ * malformed block, or a block that is no longer canonical.
585
+ */
586
+ export declare function atCanonicalFinalizedBlock<T>(client: Pick<RelayrFinalizedClient, "getBlock">, read: (blockNumber: bigint) => Promise<T>): Promise<{
587
+ value: T;
588
+ timestamp: bigint;
589
+ } | null>;
590
+ /**
591
+ * The requests a session published, each read from its entry (an `execute`
592
+ * on its chain's canonical forwarder, as {@link relayrForwardRequest} reads
593
+ * it), with the nonce it was signed with when `nonces` has one for every
594
+ * entry. Null when there are none, or one is not such a request: requests
595
+ * that can't be read can't be classified, so they never count as dead.
596
+ */
597
+ export declare function relayrSignedRequests(entries: readonly Pick<RelayrEntry, "chain" | "target" | "data">[] | undefined, nonces?: readonly (string | bigint)[]): RelayrSignedRequest[] | null;
598
+ /**
599
+ * The one classification of signed forward requests (ruling R114): each at a
600
+ * canonical finalized block on its chain, read once per chain and signer with
601
+ * `clientFor(chainId)`. Never throws for a chain it cannot read: its requests
602
+ * are live.
603
+ */
604
+ export declare function relayrRequestStates(clientFor: (chainId: number) => RelayrFinalizedClient | undefined, requests: readonly RelayrSignedRequest[]): Promise<RelayrRequestState[]>;
605
+ /**
606
+ * What `states` allow together. No states are neither run nor unused, so a
607
+ * session with none holds.
608
+ */
609
+ export declare function relayrRequestsVerdict(states: readonly RelayrRequestState[]): RelayrRequestsVerdict;
610
+ /**
611
+ * Ruling R117: whether every request is dead at a canonical finalized block
612
+ * on its chain, anything unknown counting as live. A saved session reserves
613
+ * its signers' forwarder nonces on its chains exactly while one of its
614
+ * requests is live, never by a device clock or a quote's expiry. Requests that
615
+ * can't be classified (null) or none at all are never dead.
616
+ */
617
+ export declare function relayrRequestsDead(clientFor: (chainId: number) => RelayrFinalizedClient | undefined, requests: readonly RelayrSignedRequest[] | null | undefined): Promise<boolean>;
618
+ /**
619
+ * Whether the chain's finalized block, still canonical, is past `deadline`
620
+ * (seconds, as a safe integer, decimal or 0x-hex digits, or a bigint): its
621
+ * timestamp is later. False while that is unknown, or the deadline can't be
622
+ * read.
623
+ */
624
+ export declare function relayrDeadlinePassed(client: Pick<RelayrFinalizedClient, "getBlock">, deadline: number | string | bigint): Promise<boolean>;
625
+ /** Whether `value` is a {@link RelayrDiscardReason}, for a reason read back from storage. */
626
+ export declare function isRelayrDiscardReason(value: unknown): value is RelayrDiscardReason;
627
+ /**
628
+ * What a session does next from its requests' `verdict` (see
629
+ * {@link RelayrSessionOutcome}), which was classified before the action's own
630
+ * recheck, since a request that ran would make the recheck refuse.
631
+ *
632
+ * `nonces` must be the saved nonces of exactly the requests that were
633
+ * classified into `verdict`, in the same order: `refresh` and `re-sign` hand
634
+ * them back to sign at, and nothing here can check them against the verdict.
635
+ * Without them (omitted, empty or not a list), a session whose requests are
636
+ * all dead and unused holds as `reorg-hold`, and is neither discarded nor
637
+ * signed again.
638
+ *
639
+ * `recheck`, the action's proof that its calls still apply, resolves when
640
+ * they do and throws when they don't; a value it resolves with is never read.
641
+ * It runs only once every request is dead and unused. Without one, as in an
642
+ * account view, such a session can be discarded as `expired`. A recheck that
643
+ * fails because the node could not answer decides nothing. Known limit: a
644
+ * reorg that drops an earlier forwarded transaction can leave a finalized
645
+ * nonce below a saved one, and the session holds until the nonce catches up.
646
+ */
647
+ export declare function relayrSessionOutcome(verdict: RelayrRequestsVerdict, { nonces, recheck, }?: {
648
+ nonces?: readonly string[] | null;
649
+ recheck?: () => Promise<void>;
650
+ }): Promise<RelayrSessionOutcome>;
451
651
  export {};
452
652
  //# sourceMappingURL=relayr.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"relayr.d.ts","sourceRoot":"","sources":["../../../src/review/relayr.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACxB,MAAM,MAAM,CAAC;AAed,yBAAyB;AACzB,eAAO,MAAM,UAAU,iCAAiC,CAAC;AAEzD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EACe,OAAO,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,uBAAuB,eAAe,CAAC;AAEpD,wDAAwD;AACxD,eAAO,MAAM,wBAAwB,EACqC,GAAG,CAAC;AAE9E,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,EACkB,OAAO,CAAC;AAE1D,oDAAoD;AACpD,eAAO,MAAM,kBAAkB,UAAW,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,iCAAiC,QAAe,CAAC;AAE9D,uDAAuD;AACvD,eAAO,MAAM,qBAAqB;;;;;;;;;;;EAQxB,CAAC;AAEX,2DAA2D;AAC3D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;CAUxB,CAAC;AA4BX,+EAA+E;AAC/E,MAAM,MAAM,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EAAE,SAAS,kBAAkB,EAAE,GACpC,qBAAqB,CAcvB;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,qBAAqB,GAAG,SAAS,EACjE,QAAQ,EAAE,SAAS,mBAAmB,EAAE,GAAG,IAAI,GAAG,SAAS,GAC1D,OAAO,CAAC,OAAO,CAAC,CAMlB;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,IAAI,CAAC,qBAAqB,EAAE,UAAU,CAAC,EAC/C,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GACjC,OAAO,CAAC,OAAO,CAAC,CAOlB;AAED,6FAA6F;AAC7F,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,mBAAmB,CAE9B;AA0DD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,qBAAqB,EAC9B,EACE,MAAM,EACN,OAAO,GACR,GAAE;IACD,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B,GACL,OAAO,CAAC,oBAAoB,CAAC,CAsB/B"}
@@ -23,6 +23,14 @@ exports.requireRelayrPaymentRetry = requireRelayrPaymentRetry;
23
23
  exports.requireRelayrBundleUnpaid = requireRelayrBundleUnpaid;
24
24
  exports.verifyRelayrDestination = verifyRelayrDestination;
25
25
  exports.verifyRelayrDestinations = verifyRelayrDestinations;
26
+ exports.atCanonicalFinalizedBlock = atCanonicalFinalizedBlock;
27
+ exports.relayrSignedRequests = relayrSignedRequests;
28
+ exports.relayrRequestStates = relayrRequestStates;
29
+ exports.relayrRequestsVerdict = relayrRequestsVerdict;
30
+ exports.relayrRequestsDead = relayrRequestsDead;
31
+ exports.relayrDeadlinePassed = relayrDeadlinePassed;
32
+ exports.isRelayrDiscardReason = isRelayrDiscardReason;
33
+ exports.relayrSessionOutcome = relayrSessionOutcome;
26
34
  const viem_1 = require("viem");
27
35
  const juicebox_js_1 = require("../generated/juicebox.js");
28
36
  const untrusted_js_1 = require("../untrusted.js");
@@ -150,15 +158,19 @@ class RelayrPaymentRetryError extends Error {
150
158
  }
151
159
  }
152
160
  exports.RelayrPaymentRetryError = RelayrPaymentRetryError;
153
- /** `error` with `cause` set like a native error cause, but on ES2021 and never enumerable: an RPC error's URL can carry a key. */
154
- function withCause(error, cause) {
155
- Object.defineProperty(error, "cause", {
156
- value: cause,
161
+ /** `target` with `key` set to `value`, writable but never enumerable: an RPC error's URL can carry a key, and no JSON or log may show it. */
162
+ function withHidden(target, key, value) {
163
+ Object.defineProperty(target, key, {
164
+ value,
157
165
  writable: true,
158
166
  enumerable: false,
159
167
  configurable: true,
160
168
  });
161
- return error;
169
+ return target;
170
+ }
171
+ /** `error` with `cause` set like a native error cause, but on ES2021 and never enumerable: an RPC error's URL can carry a key. */
172
+ function withCause(error, cause) {
173
+ return withHidden(error, "cause", cause);
162
174
  }
163
175
  function errorWithCause(message, cause) {
164
176
  return withCause(new Error(message), cause);
@@ -988,4 +1000,247 @@ async function verifyRelayrDestinations(clientFor, { bindings, records, account,
988
1000
  }
989
1001
  return verified;
990
1002
  }
1003
+ /**
1004
+ * `read` at the chain's finalized block, with that block's timestamp, once
1005
+ * the block at its number still has the same hash after the read. Null while
1006
+ * any of it cannot be read: a node without the finalized tag, an RPC error, a
1007
+ * malformed block, or a block that is no longer canonical.
1008
+ */
1009
+ async function atCanonicalFinalizedBlock(client, read) {
1010
+ try {
1011
+ const { number, hash, timestamp } = await client.getBlock({
1012
+ blockTag: "finalized",
1013
+ });
1014
+ if (typeof number !== "bigint" ||
1015
+ !(0, untrusted_js_1.isBytes32)(hash) ||
1016
+ typeof timestamp !== "bigint") {
1017
+ return null;
1018
+ }
1019
+ const value = await read(number);
1020
+ const canonical = await client.getBlock({ blockNumber: number });
1021
+ return canonical.hash === hash ? { value, timestamp } : null;
1022
+ }
1023
+ catch {
1024
+ return null;
1025
+ }
1026
+ }
1027
+ /**
1028
+ * The nonce the canonical forwarder on `chainId` expects next from `signer`
1029
+ * at the chain's finalized block, still canonical, with that block's
1030
+ * timestamp. Null while that cannot be read.
1031
+ */
1032
+ async function finalizedForwarderNonce(clientFor, chainId, signer) {
1033
+ const forwarder = forwarderOn(chainId);
1034
+ if (!forwarder || !isAddressLike(signer))
1035
+ return null;
1036
+ let client;
1037
+ try {
1038
+ client = clientFor(chainId);
1039
+ }
1040
+ catch {
1041
+ return null;
1042
+ }
1043
+ if (!client)
1044
+ return null;
1045
+ const reader = client;
1046
+ const finalized = await atCanonicalFinalizedBlock(reader, (blockNumber) => reader.readContract({
1047
+ address: forwarder,
1048
+ abi: juicebox_js_1.erc2771ForwarderAbi,
1049
+ functionName: "nonces",
1050
+ args: [signer],
1051
+ blockNumber,
1052
+ }));
1053
+ const nonce = finalized && (0, untrusted_js_1.uint256)(finalized.value);
1054
+ return finalized && nonce !== null
1055
+ ? { nonce, timestamp: finalized.timestamp }
1056
+ : null;
1057
+ }
1058
+ /**
1059
+ * The requests a session published, each read from its entry (an `execute`
1060
+ * on its chain's canonical forwarder, as {@link relayrForwardRequest} reads
1061
+ * it), with the nonce it was signed with when `nonces` has one for every
1062
+ * entry. Null when there are none, or one is not such a request: requests
1063
+ * that can't be read can't be classified, so they never count as dead.
1064
+ */
1065
+ function relayrSignedRequests(entries, nonces) {
1066
+ const published = Array.isArray(entries) ? entries : [];
1067
+ const saved = Array.isArray(nonces) && nonces.length === published.length
1068
+ ? nonces
1069
+ : undefined;
1070
+ const requests = published.flatMap((entry, index) => {
1071
+ const request = relayrForwardRequest(entry);
1072
+ return request
1073
+ ? [
1074
+ {
1075
+ chainId: entry.chain,
1076
+ signer: request.from,
1077
+ deadline: request.deadline,
1078
+ ...(saved ? { nonce: saved[index] } : {}),
1079
+ },
1080
+ ]
1081
+ : [];
1082
+ });
1083
+ return published.length && requests.length === published.length
1084
+ ? requests
1085
+ : null;
1086
+ }
1087
+ /**
1088
+ * The one classification of signed forward requests (ruling R114): each at a
1089
+ * canonical finalized block on its chain, read once per chain and signer with
1090
+ * `clientFor(chainId)`. Never throws for a chain it cannot read: its requests
1091
+ * are live.
1092
+ */
1093
+ async function relayrRequestStates(clientFor, requests) {
1094
+ const finalized = new Map();
1095
+ return Promise.all(requests.map(async ({ chainId, signer, deadline, nonce, }) => {
1096
+ const key = `${chainId}:${String(signer).toLowerCase()}`;
1097
+ if (!finalized.has(key)) {
1098
+ finalized.set(key, finalizedForwarderNonce(clientFor, chainId, signer));
1099
+ }
1100
+ const block = await finalized.get(key);
1101
+ // A saved nonce that can't be read leaves the request unknown, and a
1102
+ // deadline that can't be read has not passed.
1103
+ const saved = nonce === undefined ? null : (0, untrusted_js_1.uint256)(nonce);
1104
+ const end = (0, untrusted_js_1.uint256)(deadline);
1105
+ if (block && (nonce === undefined || saved !== null)) {
1106
+ if (saved !== null && block.nonce > saved) {
1107
+ return { live: false, mayHaveRun: true, unused: false };
1108
+ }
1109
+ if (end !== null && end < block.timestamp) {
1110
+ return {
1111
+ live: false,
1112
+ mayHaveRun: saved === null,
1113
+ unused: block.nonce === saved,
1114
+ };
1115
+ }
1116
+ }
1117
+ return { live: true, deadline: Number(deadline) };
1118
+ }));
1119
+ }
1120
+ /**
1121
+ * What `states` allow together. No states are neither run nor unused, so a
1122
+ * session with none holds.
1123
+ */
1124
+ function relayrRequestsVerdict(states) {
1125
+ const deadlines = states.flatMap((state) => state.live ? [state.deadline] : []);
1126
+ const mayHaveRun = states.some((state) => !state.live && state.mayHaveRun);
1127
+ if (deadlines.length) {
1128
+ return { live: true, until: Math.max(...deadlines), mayHaveRun };
1129
+ }
1130
+ return {
1131
+ live: false,
1132
+ mayHaveRun,
1133
+ unused: states.length > 0 && states.every((state) => !state.live && state.unused),
1134
+ };
1135
+ }
1136
+ /**
1137
+ * Ruling R117: whether every request is dead at a canonical finalized block
1138
+ * on its chain, anything unknown counting as live. A saved session reserves
1139
+ * its signers' forwarder nonces on its chains exactly while one of its
1140
+ * requests is live, never by a device clock or a quote's expiry. Requests that
1141
+ * can't be classified (null) or none at all are never dead.
1142
+ */
1143
+ async function relayrRequestsDead(clientFor, requests) {
1144
+ return (Array.isArray(requests) &&
1145
+ requests.length > 0 &&
1146
+ !relayrRequestsVerdict(await relayrRequestStates(clientFor, requests)).live);
1147
+ }
1148
+ /**
1149
+ * Whether the chain's finalized block, still canonical, is past `deadline`
1150
+ * (seconds, as a safe integer, decimal or 0x-hex digits, or a bigint): its
1151
+ * timestamp is later. False while that is unknown, or the deadline can't be
1152
+ * read.
1153
+ */
1154
+ async function relayrDeadlinePassed(client, deadline) {
1155
+ const finalized = await atCanonicalFinalizedBlock(client, async () => undefined);
1156
+ const end = (0, untrusted_js_1.uint256)(deadline);
1157
+ return !!finalized && end !== null && finalized.timestamp > end;
1158
+ }
1159
+ /** Whether `value` is a {@link RelayrDiscardReason}, for a reason read back from storage. */
1160
+ function isRelayrDiscardReason(value) {
1161
+ return value === "ran" || value === "changed" || value === "expired";
1162
+ }
1163
+ /** The transport failures that mean a recheck could not reach the chain. */
1164
+ const UNREACHED = ["HttpRequestError", "TimeoutError", "WebSocketRequestError"];
1165
+ /**
1166
+ * Revert data: whole bytes of hex, at least a 4-byte selector, bare or in
1167
+ * Nethermind's "Reverted 0x…" form.
1168
+ */
1169
+ const REVERT_DATA = /^(?:Reverted )?0x(?:[0-9a-fA-F]{2}){4,}$/u;
1170
+ /**
1171
+ * Whether one error carries revert data, whatever its JSON-RPC code: in its
1172
+ * `data`, in a `data.data` a node nests there, or in the `raw` data of viem's
1173
+ * contract revert. Such an error is the chain answering.
1174
+ */
1175
+ function revertedWithData(link) {
1176
+ const { raw, data } = link;
1177
+ const nested = data !== null && typeof data === "object"
1178
+ ? data.data
1179
+ : undefined;
1180
+ return [raw, data, nested].some((value) => typeof value === "string" && REVERT_DATA.test(value));
1181
+ }
1182
+ /**
1183
+ * Ruling R118: the node could not answer the recheck, so it says nothing
1184
+ * about the project. Within the error's first eight links (its cause chain),
1185
+ * one is a transport failure (HTTP, timeout or WebSocket), a JSON-RPC failure
1186
+ * (viem's `RpcRequestError` or any `RpcError`, such as -32001, -32005 or
1187
+ * -32603), or a contract revert without revert data, as viem reads a bare
1188
+ * revert, transient or not; and no link carries revert data, which on any
1189
+ * code is the chain answering. An app's error that wraps such a failure as
1190
+ * its `cause` reads the same way.
1191
+ */
1192
+ function recheckUnreached(error) {
1193
+ const links = [];
1194
+ for (let link = error; links.length < 8 && link instanceof Error; link = link.cause) {
1195
+ links.push(link);
1196
+ }
1197
+ return (!links.some(revertedWithData) &&
1198
+ links.some((link) => UNREACHED.includes(link.name) ||
1199
+ link instanceof viem_1.RpcRequestError ||
1200
+ link instanceof viem_1.RpcError ||
1201
+ link instanceof viem_1.ContractFunctionRevertedError));
1202
+ }
1203
+ /**
1204
+ * What a session does next from its requests' `verdict` (see
1205
+ * {@link RelayrSessionOutcome}), which was classified before the action's own
1206
+ * recheck, since a request that ran would make the recheck refuse.
1207
+ *
1208
+ * `nonces` must be the saved nonces of exactly the requests that were
1209
+ * classified into `verdict`, in the same order: `refresh` and `re-sign` hand
1210
+ * them back to sign at, and nothing here can check them against the verdict.
1211
+ * Without them (omitted, empty or not a list), a session whose requests are
1212
+ * all dead and unused holds as `reorg-hold`, and is neither discarded nor
1213
+ * signed again.
1214
+ *
1215
+ * `recheck`, the action's proof that its calls still apply, resolves when
1216
+ * they do and throws when they don't; a value it resolves with is never read.
1217
+ * It runs only once every request is dead and unused. Without one, as in an
1218
+ * account view, such a session can be discarded as `expired`. A recheck that
1219
+ * fails because the node could not answer decides nothing. Known limit: a
1220
+ * reorg that drops an earlier forwarded transaction can leave a finalized
1221
+ * nonce below a saved one, and the session holds until the nonce catches up.
1222
+ */
1223
+ async function relayrSessionOutcome(verdict, { nonces, recheck, } = {}) {
1224
+ const saved = Array.isArray(nonces) && nonces.length ? [...nonces] : null;
1225
+ if (verdict.live) {
1226
+ return verdict.mayHaveRun
1227
+ ? { kind: "hold", until: verdict.until }
1228
+ : { kind: "refresh", until: verdict.until, nonces: saved };
1229
+ }
1230
+ if (verdict.mayHaveRun)
1231
+ return { kind: "discard", reason: "ran" };
1232
+ if (!verdict.unused || !saved)
1233
+ return { kind: "reorg-hold" };
1234
+ if (!recheck)
1235
+ return { kind: "discard", reason: "expired" };
1236
+ try {
1237
+ await recheck();
1238
+ }
1239
+ catch (error) {
1240
+ return recheckUnreached(error)
1241
+ ? withHidden({ kind: "unchecked" }, "error", error)
1242
+ : withHidden({ kind: "discard", reason: "changed" }, "error", error);
1243
+ }
1244
+ return { kind: "re-sign", nonces: saved };
1245
+ }
991
1246
  //# sourceMappingURL=relayr.js.map