@bananapus/nana-sdk-core 2.31.0 → 2.33.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.
Files changed (41) hide show
  1. package/dist/cjs/review/index.d.ts +1 -0
  2. package/dist/cjs/review/index.d.ts.map +1 -1
  3. package/dist/cjs/review/index.js +1 -0
  4. package/dist/cjs/review/index.js.map +1 -1
  5. package/dist/cjs/review/messages.d.ts +18 -0
  6. package/dist/cjs/review/messages.d.ts.map +1 -1
  7. package/dist/cjs/review/messages.js +19 -1
  8. package/dist/cjs/review/messages.js.map +1 -1
  9. package/dist/cjs/review/writeHold.d.ts +211 -0
  10. package/dist/cjs/review/writeHold.d.ts.map +1 -0
  11. package/dist/cjs/review/writeHold.js +620 -0
  12. package/dist/cjs/review/writeHold.js.map +1 -0
  13. package/dist/cjs/review/writeRecovery.d.ts +113 -9
  14. package/dist/cjs/review/writeRecovery.d.ts.map +1 -1
  15. package/dist/cjs/review/writeRecovery.js +357 -49
  16. package/dist/cjs/review/writeRecovery.js.map +1 -1
  17. package/dist/cjs/safeService.d.ts +40 -0
  18. package/dist/cjs/safeService.d.ts.map +1 -1
  19. package/dist/cjs/safeService.js +69 -12
  20. package/dist/cjs/safeService.js.map +1 -1
  21. package/dist/esm/review/index.d.ts +1 -0
  22. package/dist/esm/review/index.d.ts.map +1 -1
  23. package/dist/esm/review/index.js +1 -0
  24. package/dist/esm/review/index.js.map +1 -1
  25. package/dist/esm/review/messages.d.ts +18 -0
  26. package/dist/esm/review/messages.d.ts.map +1 -1
  27. package/dist/esm/review/messages.js +18 -0
  28. package/dist/esm/review/messages.js.map +1 -1
  29. package/dist/esm/review/writeHold.d.ts +211 -0
  30. package/dist/esm/review/writeHold.d.ts.map +1 -0
  31. package/dist/esm/review/writeHold.js +613 -0
  32. package/dist/esm/review/writeHold.js.map +1 -0
  33. package/dist/esm/review/writeRecovery.d.ts +113 -9
  34. package/dist/esm/review/writeRecovery.d.ts.map +1 -1
  35. package/dist/esm/review/writeRecovery.js +355 -49
  36. package/dist/esm/review/writeRecovery.js.map +1 -1
  37. package/dist/esm/safeService.d.ts +40 -0
  38. package/dist/esm/safeService.d.ts.map +1 -1
  39. package/dist/esm/safeService.js +66 -12
  40. package/dist/esm/safeService.js.map +1 -1
  41. package/package.json +1 -1
@@ -6,4 +6,5 @@ export * from "./simulation.js";
6
6
  export * from "./transactionReview.js";
7
7
  export * from "./transaction-message.js";
8
8
  export * from "./writeRecovery.js";
9
+ export * from "./writeHold.js";
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/review/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/review/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
@@ -22,4 +22,5 @@ __exportStar(require("./simulation.js"), exports);
22
22
  __exportStar(require("./transactionReview.js"), exports);
23
23
  __exportStar(require("./transaction-message.js"), exports);
24
24
  __exportStar(require("./writeRecovery.js"), exports);
25
+ __exportStar(require("./writeHold.js"), exports);
25
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/review/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,2CAAyB;AACzB,gDAA8B;AAC9B,+CAA6B;AAC7B,kDAAgC;AAChC,yDAAuC;AACvC,2DAAyC;AACzC,qDAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/review/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,2CAAyB;AACzB,gDAA8B;AAC9B,+CAA6B;AAC7B,kDAAgC;AAChC,yDAAuC;AACvC,2DAAyC;AACzC,qDAAmC;AACnC,iDAA+B"}
@@ -39,5 +39,23 @@ export declare const SAFE_PROPOSAL_REPLACED_LINE = "Another Safe transaction use
39
39
  export declare const SAFE_PROPOSAL_EXECUTED_LINE = "Your Safe ran this transaction.";
40
40
  /** A quote released after its payment failed and its deadline passed. */
41
41
  export declare const RELAYR_PAYMENT_RELEASED_LINE = "Your payment didn't go through and its quote expired. Pay a new quote.";
42
+ /** The review's line while held writes last only until this tab closes or reloads. */
43
+ export declare const WRITE_HOLD_IN_TAB_LINE = "This browser can't remember pending transactions. Check your wallet before repeating one.";
44
+ /** A held write whose saved hash is still pending: no exit, the wallet ends it. */
45
+ export declare const WRITE_HOLD_PENDING_LINE = "Still pending in your wallet. Speed it up or cancel it there.";
46
+ /** A write that reverted onchain, held until that is final so a retry can't double it. */
47
+ export declare const WRITE_HOLD_REVERTED_LINE = "This transaction failed onchain. You can try again in a few minutes.";
48
+ /** A held write the chain can't check (saved with no nonce to look at). The exit is offered. */
49
+ export declare const WRITE_HOLD_UNCHECKED_LINE = "This transaction can't be checked onchain. Check your wallet before sending again.";
50
+ /** A send stopped before the wallet because the account's nonce couldn't be read. */
51
+ export declare const WRITE_HOLD_NONCE_LINE = "Couldn't read your account from the network, so nothing was sent. Try again in a moment.";
52
+ /** The warning on the exit of a held write that has a hash. */
53
+ export declare const WRITE_HOLD_HASHED_EXIT_LINE = "If that transaction is still in your wallet, sending again can run it twice.";
54
+ /** A held Safe write whose nonce another Safe transaction used. The exit is offered. */
55
+ export declare const WRITE_HOLD_SAFE_REPLACED_LINE = "Another Safe transaction used this nonce. Check your Safe, then send again.";
56
+ /** A held write the app's effect read shows done. Nothing is released on that alone; the exit is offered. */
57
+ export declare const WRITE_HOLD_LOOKS_DONE_LINE = "This looks done. Check your wallet, then continue.";
58
+ /** A held Safe write whose follower ended without proof. The exit is offered. */
59
+ export declare const WRITE_HOLD_SAFE_UNPROVEN_LINE = "This Safe transaction couldn't be confirmed here. Check your Safe, then send again.";
42
60
  export {};
43
61
  //# sourceMappingURL=messages.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/review/messages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,4FAA4F;AAC5F,KAAK,aAAa,GAAG,KAAK,GAAG,SAAS,GAAG,SAAS,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,EACE,MAAiB,EACjB,KAAkB,EAClB,UAA0D,GAC3D,GAAE;IACD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;CAChC,GACL,MAAM,CAIR;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,aAAa,EACrB,EACE,MAAiB,EACjB,OAAmB,EACnB,gBAAwB,GACzB,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAO,GACxE,MAAM,CAOR;AAED,wEAAwE;AACxE,wBAAgB,gBAAgB,CAAC,MAAM,SAAgB,GAAG,MAAM,CAE/D;AAED,4EAA4E;AAC5E,eAAO,MAAM,gBAAgB,oCAAoC,CAAC;AAElE,8DAA8D;AAC9D,wBAA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C,MAAM,SAAgB,GACrB,MAAM,CAIR;AAED,iEAAiE;AACjE,eAAO,MAAM,2BAA2B,0EACiC,CAAC;AAE1E,gDAAgD;AAChD,eAAO,MAAM,2BAA2B,oCAAoC,CAAC;AAE7E,yEAAyE;AACzE,eAAO,MAAM,4BAA4B,2EACiC,CAAC;AAE3E,sFAAsF;AACtF,eAAO,MAAM,sBAAsB,8FAC0D,CAAC;AAE9F,mFAAmF;AACnF,eAAO,MAAM,uBAAuB,kEAC6B,CAAC;AAElE,0FAA0F;AAC1F,eAAO,MAAM,wBAAwB,yEACmC,CAAC;AAEzE,gGAAgG;AAChG,eAAO,MAAM,yBAAyB,uFACgD,CAAC;AAEvF,qFAAqF;AACrF,eAAO,MAAM,qBAAqB,6FAC0D,CAAC;AAE7F,+DAA+D;AAC/D,eAAO,MAAM,2BAA2B,iFACwC,CAAC;AAEjF,wFAAwF;AACxF,eAAO,MAAM,6BAA6B,gFACqC,CAAC;AAEhF,6GAA6G;AAC7G,eAAO,MAAM,0BAA0B,uDACe,CAAC;AAEvD,iFAAiF;AACjF,eAAO,MAAM,6BAA6B,wFAC6C,CAAC"}
@@ -5,7 +5,7 @@
5
5
  * `action` is a noun such as "action", "launch" or "payment".
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.RELAYR_PAYMENT_RELEASED_LINE = exports.SAFE_PROPOSAL_EXECUTED_LINE = exports.SAFE_PROPOSAL_REPLACED_LINE = exports.WRITE_EXIT_LABEL = void 0;
8
+ exports.WRITE_HOLD_SAFE_UNPROVEN_LINE = exports.WRITE_HOLD_LOOKS_DONE_LINE = exports.WRITE_HOLD_SAFE_REPLACED_LINE = exports.WRITE_HOLD_HASHED_EXIT_LINE = exports.WRITE_HOLD_NONCE_LINE = exports.WRITE_HOLD_UNCHECKED_LINE = exports.WRITE_HOLD_REVERTED_LINE = exports.WRITE_HOLD_PENDING_LINE = exports.WRITE_HOLD_IN_TAB_LINE = exports.RELAYR_PAYMENT_RELEASED_LINE = exports.SAFE_PROPOSAL_EXECUTED_LINE = exports.SAFE_PROPOSAL_REPLACED_LINE = exports.WRITE_EXIT_LABEL = void 0;
9
9
  exports.relayrHeldMessage = relayrHeldMessage;
10
10
  exports.relayrDiscardLine = relayrDiscardLine;
11
11
  exports.writeHeldMessage = writeHeldMessage;
@@ -52,4 +52,22 @@ exports.SAFE_PROPOSAL_REPLACED_LINE = "Another Safe transaction used this nonce.
52
52
  exports.SAFE_PROPOSAL_EXECUTED_LINE = "Your Safe ran this transaction.";
53
53
  /** A quote released after its payment failed and its deadline passed. */
54
54
  exports.RELAYR_PAYMENT_RELEASED_LINE = "Your payment didn't go through and its quote expired. Pay a new quote.";
55
+ /** The review's line while held writes last only until this tab closes or reloads. */
56
+ exports.WRITE_HOLD_IN_TAB_LINE = "This browser can't remember pending transactions. Check your wallet before repeating one.";
57
+ /** A held write whose saved hash is still pending: no exit, the wallet ends it. */
58
+ exports.WRITE_HOLD_PENDING_LINE = "Still pending in your wallet. Speed it up or cancel it there.";
59
+ /** A write that reverted onchain, held until that is final so a retry can't double it. */
60
+ exports.WRITE_HOLD_REVERTED_LINE = "This transaction failed onchain. You can try again in a few minutes.";
61
+ /** A held write the chain can't check (saved with no nonce to look at). The exit is offered. */
62
+ exports.WRITE_HOLD_UNCHECKED_LINE = "This transaction can't be checked onchain. Check your wallet before sending again.";
63
+ /** A send stopped before the wallet because the account's nonce couldn't be read. */
64
+ exports.WRITE_HOLD_NONCE_LINE = "Couldn't read your account from the network, so nothing was sent. Try again in a moment.";
65
+ /** The warning on the exit of a held write that has a hash. */
66
+ exports.WRITE_HOLD_HASHED_EXIT_LINE = "If that transaction is still in your wallet, sending again can run it twice.";
67
+ /** A held Safe write whose nonce another Safe transaction used. The exit is offered. */
68
+ exports.WRITE_HOLD_SAFE_REPLACED_LINE = "Another Safe transaction used this nonce. Check your Safe, then send again.";
69
+ /** A held write the app's effect read shows done. Nothing is released on that alone; the exit is offered. */
70
+ exports.WRITE_HOLD_LOOKS_DONE_LINE = "This looks done. Check your wallet, then continue.";
71
+ /** A held Safe write whose follower ended without proof. The exit is offered. */
72
+ exports.WRITE_HOLD_SAFE_UNPROVEN_LINE = "This Safe transaction couldn't be confirmed here. Check your Safe, then send again.";
55
73
  //# sourceMappingURL=messages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/review/messages.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAUH,8CAeC;AAOD,8CAcC;AAGD,4CAEC;AAMD,4CAOC;AA3DD;;;;GAIG;AACH,SAAgB,iBAAiB,CAC/B,KAAa,EACb,EACE,MAAM,GAAG,QAAQ,EACjB,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,EAClB,UAAU,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,cAAc,EAAE,MAKxD,EAAE;IAEN,OAAO,KAAK,GAAG,KAAK,GAAG,KAAK;QAC1B,CAAC,CAAC,QAAQ,MAAM,4CAA4C,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC,yBAAyB;QAC9G,CAAC,CAAC,QAAQ,MAAM,iEAAiE,CAAC;AACtF,CAAC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAC/B,MAAqB,EACrB,EACE,MAAM,GAAG,QAAQ,EACjB,OAAO,GAAG,SAAS,EACnB,gBAAgB,GAAG,KAAK,MAC6C,EAAE;IAEzE,IAAI,MAAM,KAAK,KAAK;QAClB,OAAO,QAAQ,MAAM,wDAAwD,OAAO,uCAAuC,CAAC;IAC9H,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,OAAO,OAAO,6BAA6B,CAAC;IAC7E,OAAO,gBAAgB;QACrB,CAAC,CAAC,iDAAiD,MAAM,qDAAqD;QAC9G,CAAC,CAAC,QAAQ,MAAM,gDAAgD,CAAC;AACrE,CAAC;AAED,wEAAwE;AACxE,SAAgB,gBAAgB,CAAC,MAAM,GAAG,aAAa;I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AA6B,GACxC,6EAA6E,CAAC;AAEhF,6GAA6G;AAChG,QAAA,0BAA0B,GACrC,oDAAoD,CAAC;AAEvD,iFAAiF;AACpE,QAAA,6BAA6B,GACxC,qFAAqF,CAAC"}
@@ -0,0 +1,211 @@
1
+ import { type Hex, type PublicClient, type TransactionReceipt } from "viem";
2
+ import { type SafeQueuedTransaction, type SafeServiceOptions } from "../safeService.js";
3
+ import { verifyReviewedWriteReceipt, type HeldWriteStorage, type ReviewedWriteRecoveryInput, type ReviewedWriteRecoveryRecord } from "./writeRecovery.js";
4
+ /** The reads a write hold makes on the call's chain; a viem PublicClient satisfies it. */
5
+ export type WriteHoldClient = Pick<PublicClient, "getBlock" | "getBlockNumber" | "getChainId" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "request">;
6
+ /** How a held write ended, when the hold saw it end. */
7
+ export type WriteHoldSettled =
8
+ /** Its verified receipt (a revert only once final). */
9
+ {
10
+ result: "success" | "failed";
11
+ hash: Hex;
12
+ }
13
+ /** A Safe proposal's expiry before it ran is proven. */
14
+ | {
15
+ result: "expired";
16
+ };
17
+ type Held<S extends string, Extra> = {
18
+ status: S;
19
+ /** The record this state was read from: the identity an exit must name. */
20
+ record: ReviewedWriteRecoveryRecord;
21
+ /** The one line the app shows for it. */
22
+ line: string;
23
+ } & Extra;
24
+ /**
25
+ * What a write hold says about one exact call, from {@link WriteHold.state}:
26
+ *
27
+ * - `clear`: nothing is held; `settled` says how a hold just ended;
28
+ * - `pending-known-hash`: its saved hash (or Safe proposal) can still run. No
29
+ * exit: the wallet speeds it up or cancels it;
30
+ * - `held-no-hash`: the wallet never returned a hash. The exit is offered;
31
+ * - `dropped-proven`: the node doesn't know the saved hash and a canonical
32
+ * finalized block shows another transaction ran at the nonce it was
33
+ * actually sent at (`sentNonce`, from its authenticated transaction; the
34
+ * nonce read before the wallet opened only locates the call). The exit is
35
+ * offered;
36
+ * - `held-unchecked`: a saved hash the node doesn't know, on a record saved
37
+ * with no nonce to check, or 30 minutes after the wallet returned it (or,
38
+ * for a record saved before that time was kept, after it was first read). The
39
+ * exit is offered, with a line that says so; a hash that shows up later is
40
+ * followed as usual. A Safe proposal Safe's service never authenticates
41
+ * gets it after the same 30 minutes. Its `warning` says a resend can run it
42
+ * twice;
43
+ * - `safe-replaced`: another Safe transaction used a Safe write's nonce (or
44
+ * the executor's, for an execution returned at once). It may have run the
45
+ * call too, so it is never released on its own: the exit is offered at
46
+ * once, with its `warning`;
47
+ * - `safe-unproven`: the app's Safe follower ended without proof
48
+ * ({@link WriteHoldHandle.onUnproven}). The exit is offered at once, with
49
+ * its `warning`; authenticated evidence that arrives later still settles it;
50
+ * - `looks-done`: the app's effect read shows the call took effect. Nothing
51
+ * is released on that alone: its line says so, and the exit is offered at
52
+ * once (with the `warning` when it has a hash);
53
+ * - `ran-executed`: the chain shows it ran (a Safe execution, or a revert
54
+ * not final yet). It is kept until its result settles it, and never offered
55
+ * a resend.
56
+ */
57
+ export type WriteHoldState = {
58
+ status: "clear";
59
+ settled?: WriteHoldSettled;
60
+ } | Held<"pending-known-hash", {
61
+ hash: Hex;
62
+ exit: false;
63
+ }> | Held<"held-no-hash", {
64
+ exit: true;
65
+ }> | Held<"dropped-proven", {
66
+ hash: Hex;
67
+ usedBy: Hex;
68
+ exit: true;
69
+ warning: string;
70
+ }> | Held<"held-unchecked", {
71
+ hash: Hex;
72
+ exit: true;
73
+ warning: string;
74
+ }> | Held<"safe-replaced", {
75
+ hash: Hex;
76
+ exit: true;
77
+ warning: string;
78
+ }> | Held<"safe-unproven", {
79
+ hash: Hex;
80
+ exit: true;
81
+ warning: string;
82
+ }> | Held<"looks-done", {
83
+ hash?: Hex;
84
+ exit: true;
85
+ warning?: string;
86
+ }> | Held<"ran-executed", {
87
+ executionHash?: Hex;
88
+ result?: "failed";
89
+ exit: false;
90
+ }>;
91
+ /** Any state but `clear`. */
92
+ export type WriteHeldState = Exclude<WriteHoldState, {
93
+ status: "clear";
94
+ }>;
95
+ /** A send was refused because the exact call is held; `state` says how. */
96
+ export declare class WriteHeldError extends Error {
97
+ readonly state: WriteHeldState;
98
+ readonly name = "WriteHeldError";
99
+ constructor(state: WriteHeldState);
100
+ }
101
+ /** The account's nonce couldn't be read, so the wallet never opened. */
102
+ export declare class WriteHoldNonceError extends Error {
103
+ readonly cause: unknown;
104
+ readonly name = "WriteHoldNonceError";
105
+ constructor(cause: unknown);
106
+ }
107
+ /** The exact call is already being sent from another flow or tab. */
108
+ export declare class WriteHoldBusyError extends Error {
109
+ readonly name = "WriteHoldBusyError";
110
+ constructor();
111
+ }
112
+ /** The callbacks a send hands its wallet boundary (`submitReviewedContractWrite`). */
113
+ export type WriteHoldGate = {
114
+ /**
115
+ * Hold the call right before the wallet opens: `beforeWrite`. It reads the
116
+ * account's next nonce for later proof, rechecks, and throws
117
+ * {@link WriteHeldError} if the call became held meanwhile. `actualCall`:
118
+ * a reused Safe proposal's exact call.
119
+ */
120
+ beforeSend(actualCall?: ReviewedWriteRecoveryInput["call"]): Promise<void>;
121
+ /** The wallet returned this hash (a Safe proposal's safeTxHash): `onWriteSubmitted`. */
122
+ afterSubmit(hash: Hex, proposal?: SafeQueuedTransaction): void;
123
+ /** Nothing reached the wallet, or it refused: `onWriteRejected` and `onBeforeWriteAborted`. */
124
+ onRejected(): void;
125
+ };
126
+ type Locks = Pick<LockManager, "request">;
127
+ /**
128
+ * One controller for held wallet writes, framework-free: every app wires its
129
+ * send, receipt and exit through it, so nothing is ever sent twice.
130
+ *
131
+ * - Holds live in the browser's storage, shared by tabs and kept across
132
+ * reloads, or in this tab's memory where storage is refused
133
+ * ({@link createHeldWriteStorage}); {@link reviewLine} is then the line the
134
+ * review shows. The wallet never opens without a hold.
135
+ * - A send checks, reserves and hands the call to the wallet under one lock
136
+ * per exact call (Web Locks, or the SDK's fallback), so two flows or tabs
137
+ * can never both reserve it.
138
+ * - A verified successful receipt releases at once. A revert holds until a
139
+ * canonical finalized block includes it. A Safe proposal proven executed
140
+ * is kept through reload until its execution's receipt settles it; one
141
+ * proven expired releases. One another Safe transaction replaced is never
142
+ * released on its own: the user's exit ends it.
143
+ */
144
+ export declare function createWriteHold(options?: {
145
+ storage?: HeldWriteStorage;
146
+ locks?: Locks;
147
+ safeService?: SafeServiceOptions;
148
+ /** How often, and how many times, a ran write is looked at again until it settles. */
149
+ settle?: {
150
+ intervalMs?: number;
151
+ attempts?: number;
152
+ };
153
+ }): {
154
+ open: (call: ReviewedWriteRecoveryInput) => {
155
+ state: (client: WriteHoldClient, checks?: {
156
+ effect?: (chainId: number) => Promise<boolean>;
157
+ }) => Promise<WriteHoldState>;
158
+ /** What the saved record alone says, without asking the chain. */
159
+ peek: () => WriteHoldState;
160
+ /** Every state this controller reads or makes for the call, and other tabs' changes. */
161
+ subscribe(listener: (state: WriteHoldState) => void): () => void;
162
+ /**
163
+ * Send the call under its hold. A held call throws
164
+ * {@link WriteHeldError} before anything opens, and another flow or tab
165
+ * sending it throws {@link WriteHoldBusyError}. `run` hands the
166
+ * {@link WriteHoldGate} to its wallet boundary. A write that may have
167
+ * reached the wallet stays held whatever `run` throws.
168
+ */
169
+ send<T>(client: WriteHoldClient, run: (gate: WriteHoldGate) => Promise<T>): Promise<T>;
170
+ /**
171
+ * The user checked their wallet. Only an exit-offered `snapshot`, the
172
+ * state the user saw, is released, after the chain is asked once more:
173
+ * any change refuses it, and a confirmation that landed meanwhile wins.
174
+ * `released` true: send again.
175
+ */
176
+ exit(snapshot: WriteHoldState, acknowledgement: {
177
+ checkedWallet: true;
178
+ }, client: WriteHoldClient): Promise<{
179
+ released: boolean;
180
+ state: WriteHoldState;
181
+ }>;
182
+ /**
183
+ * A receipt for the held write: an ordinary write's own hash, or a Safe
184
+ * proposal's execution (`proof`: its whole batch). It releases only once
185
+ * verified, and a revert only once final.
186
+ */
187
+ onReceipt(receipt: TransactionReceipt, client: WriteHoldClient, proof?: Parameters<typeof verifyReviewedWriteReceipt>[3]): Promise<WriteHoldState>;
188
+ /**
189
+ * The app's Safe follower ended without proof (its watch gave up, or
190
+ * the service lost the proposal). `proposalHash`, when given, must name
191
+ * the held one. It is held with the exit at once, through reloads;
192
+ * authenticated evidence that arrives later still settles it.
193
+ */
194
+ onUnproven(client: WriteHoldClient, proposalHash?: Hex): Promise<WriteHoldState>;
195
+ /**
196
+ * The app's own proof that the held Safe proposal ran, with its
197
+ * execution's transaction when known. Kept until its result settles it.
198
+ */
199
+ onExecuted(client: WriteHoldClient, executionHash?: Hex): Promise<WriteHoldState>;
200
+ };
201
+ /** Whether holds outlive this tab right now. */
202
+ durable: () => boolean;
203
+ /** The review's line while holds last only in this tab, or null. */
204
+ reviewLine: () => "This browser can't remember pending transactions. Check your wallet before repeating one." | null;
205
+ /** Stop every settle poll and the tab listener (tests, teardown). */
206
+ dispose(): void;
207
+ };
208
+ export type WriteHold = ReturnType<typeof createWriteHold>;
209
+ export type WriteHoldHandle = ReturnType<WriteHold["open"]>;
210
+ export {};
211
+ //# sourceMappingURL=writeHold.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writeHold.d.ts","sourceRoot":"","sources":["../../../src/review/writeHold.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,GAAG,EACR,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACxB,MAAM,MAAM,CAAC;AACd,OAAO,EAOL,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACxB,MAAM,mBAAmB,CAAC;AAc3B,OAAO,EAOL,0BAA0B,EAC1B,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EACjC,MAAM,oBAAoB,CAAC;AAE5B,0FAA0F;AAC1F,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,YAAY,EACV,UAAU,GACV,gBAAgB,GAChB,YAAY,GACZ,gBAAgB,GAChB,qBAAqB,GACrB,uBAAuB,GACvB,SAAS,CACZ,CAAC;AAEF,wDAAwD;AACxD,MAAM,MAAM,gBAAgB;AAC1B,uDAAuD;AACrD;IAAE,MAAM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