@bananapus/nana-sdk-core 2.38.2 → 2.39.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 (49) hide show
  1. package/dist/cjs/review/heldWrite.d.ts +113 -0
  2. package/dist/cjs/review/heldWrite.d.ts.map +1 -0
  3. package/dist/cjs/review/heldWrite.js +551 -0
  4. package/dist/cjs/review/heldWrite.js.map +1 -0
  5. package/dist/cjs/review/index.d.ts +2 -0
  6. package/dist/cjs/review/index.d.ts.map +1 -1
  7. package/dist/cjs/review/index.js +2 -0
  8. package/dist/cjs/review/index.js.map +1 -1
  9. package/dist/cjs/review/messages.d.ts +30 -0
  10. package/dist/cjs/review/messages.d.ts.map +1 -1
  11. package/dist/cjs/review/messages.js +34 -1
  12. package/dist/cjs/review/messages.js.map +1 -1
  13. package/dist/cjs/review/savedAttempt.d.ts +180 -0
  14. package/dist/cjs/review/savedAttempt.d.ts.map +1 -0
  15. package/dist/cjs/review/savedAttempt.js +527 -0
  16. package/dist/cjs/review/savedAttempt.js.map +1 -0
  17. package/dist/cjs/review/writeHold.d.ts +94 -2
  18. package/dist/cjs/review/writeHold.d.ts.map +1 -1
  19. package/dist/cjs/review/writeHold.js +284 -43
  20. package/dist/cjs/review/writeHold.js.map +1 -1
  21. package/dist/cjs/review/writeRecovery.d.ts +58 -0
  22. package/dist/cjs/review/writeRecovery.d.ts.map +1 -1
  23. package/dist/cjs/review/writeRecovery.js +159 -2
  24. package/dist/cjs/review/writeRecovery.js.map +1 -1
  25. package/dist/esm/review/heldWrite.d.ts +113 -0
  26. package/dist/esm/review/heldWrite.d.ts.map +1 -0
  27. package/dist/esm/review/heldWrite.js +544 -0
  28. package/dist/esm/review/heldWrite.js.map +1 -0
  29. package/dist/esm/review/index.d.ts +2 -0
  30. package/dist/esm/review/index.d.ts.map +1 -1
  31. package/dist/esm/review/index.js +2 -0
  32. package/dist/esm/review/index.js.map +1 -1
  33. package/dist/esm/review/messages.d.ts +30 -0
  34. package/dist/esm/review/messages.d.ts.map +1 -1
  35. package/dist/esm/review/messages.js +32 -0
  36. package/dist/esm/review/messages.js.map +1 -1
  37. package/dist/esm/review/savedAttempt.d.ts +180 -0
  38. package/dist/esm/review/savedAttempt.d.ts.map +1 -0
  39. package/dist/esm/review/savedAttempt.js +524 -0
  40. package/dist/esm/review/savedAttempt.js.map +1 -0
  41. package/dist/esm/review/writeHold.d.ts +94 -2
  42. package/dist/esm/review/writeHold.d.ts.map +1 -1
  43. package/dist/esm/review/writeHold.js +285 -44
  44. package/dist/esm/review/writeHold.js.map +1 -1
  45. package/dist/esm/review/writeRecovery.d.ts +58 -0
  46. package/dist/esm/review/writeRecovery.d.ts.map +1 -1
  47. package/dist/esm/review/writeRecovery.js +158 -2
  48. package/dist/esm/review/writeRecovery.js.map +1 -1
  49. package/package.json +1 -1
@@ -67,4 +67,36 @@ export const WRITE_HOLD_SAFE_UNPROVEN_LINE = "This Safe transaction couldn't be
67
67
  export const WRITE_HOLD_MINED_LINE = "Your transaction is onchain, but its result can't be read yet.";
68
68
  /** A send whose review went stale because another window's attempt of the same write ended meanwhile. */
69
69
  export const WRITE_HOLD_STALE_REVIEW_LINE = "This was just sent from another window. Review it again to send another.";
70
+ /** The one line while a sent write, direct or through a Safe, is being confirmed. */
71
+ export const HELD_CONFIRMING_LINE = "Confirming your transaction.";
72
+ /** A held write the user released with their exit: they can send it again. */
73
+ export const HELD_RELEASED_LINE = "Released. You can send it again.";
74
+ /** A held write another window released: neutral, never a result. */
75
+ export const HELD_RELEASED_ELSEWHERE_LINE = "This was released in another window.";
76
+ /** The exit button where the review follows on its own. */
77
+ export const HELD_EXIT_LABEL = "I checked my wallet";
78
+ /** The exit button where only the hold is released (an app-wide notice). */
79
+ export const HELD_RELEASE_LABEL = "I checked my wallet. Release it";
80
+ /** A held write settled with success on authenticated evidence. */
81
+ export const HELD_SUCCESS_LINE = "Your transaction went through.";
82
+ /** A held Safe proposal proven expired before it ran. */
83
+ export const HELD_EXPIRED_LINE = "Your Safe proposal expired before it ran.";
84
+ /** A success the hold settled while the user was away: shown until they say to send again. */
85
+ export const HELD_AWAY_SUCCESS_LINE = "This went through while you were away.";
86
+ /** The one action on a success settled while away: acknowledge it, then send. */
87
+ export const HELD_SEND_AGAIN_LABEL = "Send it again";
88
+ /** A saved attempt that can't be shown here: absence of evidence is never permission to send. */
89
+ export const SAVED_ATTEMPT_CHECK_LINE = "This transaction may already be in your wallet, and it cannot be confirmed from here.";
90
+ /** The warning under it. */
91
+ export const SAVED_ATTEMPT_CHECK_WARNING = "Check your wallet and the explorer first. Continuing can send it twice.";
92
+ /** The one check action's label: "I checked it. Review it again." or the flow's next step ("Create again"). */
93
+ export function checkedItLabel(next = "Review it again") {
94
+ return `I checked it. ${next.replace(/\.+$/, "")}.`;
95
+ }
96
+ /** Under a retirement that lasts in this tab alone (`durable: false`). */
97
+ export const SAVED_ATTEMPT_TAB_ONLY_LINE = "This applies to this tab only.";
98
+ /** When the browser has storage but can't read it: the warned exit's line. */
99
+ export const SAVED_ATTEMPT_UNREADABLE_LINE = "This browser can't read its saved transactions. Check your wallet before sending again.";
100
+ /** The warned exit's label, offered only after a check action found storage unreadable. */
101
+ export const SAVED_ATTEMPT_CONTINUE_ANYWAY_LABEL = "I checked my wallet. Continue anyway";
70
102
  //# sourceMappingURL=messages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/review/messages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;;GAIG;AACH,MAAM,UAAU,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,Q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MAAM,wBAAwB,GACnC,uFAAuF,CAAC;AAE1F,4BAA4B;AAC5B,MAAM,CAAC,MAAM,2BAA2B,GACtC,yEAAyE,CAAC;AAE5E,+GAA+G;AAC/G,MAAM,UAAU,cAAc,CAAC,IAAI,GAAG,iBAAiB;IACrD,OAAO,iBAAiB,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC;AACtD,CAAC;AAED,0EAA0E;AAC1E,MAAM,CAAC,MAAM,2BAA2B,GAAG,gCAAgC,CAAC;AAE5E,8EAA8E;AAC9E,MAAM,CAAC,MAAM,6BAA6B,GACxC,yFAAyF,CAAC;AAE5F,2FAA2F;AAC3F,MAAM,CAAC,MAAM,mCAAmC,GAC9C,sCAAsC,CAAC"}
@@ -0,0 +1,180 @@
1
+ import type { Address, Hex } from "viem";
2
+ import type { WriteHeldState, WriteHold, WriteHoldClient, WriteHoldHandle } from "./writeHold.js";
3
+ import { type HeldWriteStorage, type ReviewedWriteRecoveryInput } from "./writeRecovery.js";
4
+ /** What the app's domain check says of one transaction (or, given none, of a search for the attempt). */
5
+ export type SavedAttemptProof<T> =
6
+ /** The chain shows this attempt ran, with the app's result (a project ID, a launch). */
7
+ {
8
+ result: "proven";
9
+ value: T;
10
+ }
11
+ /** The transaction is some other write. */
12
+ | {
13
+ result: "not-this";
14
+ reason?: string;
15
+ }
16
+ /** It couldn't be read or shown. */
17
+ | {
18
+ result: "unknown";
19
+ reason?: string;
20
+ };
21
+ /** Where a saved attempt was held, and what the app saved of it. Only what was saved: nothing fresh. */
22
+ export type SavedAttemptScope = {
23
+ chainId: number;
24
+ /** The account that sent it: the wallet, or the Safe. */
25
+ account: Address;
26
+ /** Whether `account` is a Safe; a saved `safeTxHash` says so too. */
27
+ safe?: boolean;
28
+ /** Every intent namespace the attempt may be held under, the current one first, legacy ones after. */
29
+ namespaces: readonly string[];
30
+ /** The exact saved call, when kept: a saved hash is adopted into the hold against it. */
31
+ call?: ReviewedWriteRecoveryInput["call"];
32
+ /**
33
+ * The app's re-read of its own domain journal, required: awaited under
34
+ * the hold's locks before any check or exit retirement, it is the final say
35
+ * of Rule E (only a followed settlement retires a success). Return false,
36
+ * or throw, while the journal records the attempt's success or can't be
37
+ * read.
38
+ */
39
+ confirmRetirable(): Promise<boolean>;
40
+ saved?: {
41
+ /**
42
+ * The app's send began: the wallet may have opened. Only an explicit
43
+ * `false`, with no hash or nonce evidence, is proof that nothing was sent.
44
+ */
45
+ started?: boolean;
46
+ /** The transaction hash the wallet returned. */
47
+ hash?: Hex;
48
+ /** The Safe proposal the wallet returned. */
49
+ safeTxHash?: Hex;
50
+ /** That proposal's Safe nonce, when saved. */
51
+ safeNonce?: number;
52
+ /** The account's next nonce before the wallet opened, with the block it was read at. */
53
+ nonce?: number | bigint;
54
+ sentNonce?: number | bigint;
55
+ fromBlock?: bigint;
56
+ /** When the wallet returned the hash, in milliseconds since the epoch. */
57
+ submittedAt?: number;
58
+ /** Settlements already shown before this attempt began: never this attempt's. */
59
+ before?: readonly Hex[];
60
+ };
61
+ };
62
+ /** A saved attempt with the app's domain check of a transaction (or, given none, its search for the attempt). */
63
+ export type SavedAttempt<T> = SavedAttemptScope & {
64
+ authenticate(hash: Hex | undefined): Promise<SavedAttemptProof<T>>;
65
+ };
66
+ /**
67
+ * What a retirement returned. `durable: false`: it lasts in this tab alone
68
+ * (show `SAVED_ATTEMPT_TAB_ONLY_LINE`); another tab or a reload asks
69
+ * again, never sends. `reason: "unreadable"`: the browser has storage but
70
+ * can't read it, so the warned exit may be offered.
71
+ */
72
+ export type SavedAttemptRetired = {
73
+ retired: false;
74
+ reason?: "unreadable";
75
+ } | {
76
+ retired: true;
77
+ durable: boolean;
78
+ };
79
+ /** Why an attempt is retired: the only three things that retire one. */
80
+ export type SavedAttemptRetirement =
81
+ /** The user's exit released the hold. */
82
+ {
83
+ by: "exit";
84
+ }
85
+ /**
86
+ * The user's "I checked it. ..." on exactly this check outcome. With
87
+ * `force: "unreadable"` (the warned "I checked my wallet. Continue anyway",
88
+ * offered only after a retirement came back `reason: "unreadable"`), it
89
+ * retires in this tab alone if the hold's storage still can't be read.
90
+ */
91
+ | {
92
+ by: "check";
93
+ outcome: SavedAttemptCheck;
94
+ force?: "unreadable";
95
+ }
96
+ /** The app followed and recorded this settlement. */
97
+ | {
98
+ by: "settled";
99
+ hash?: Hex;
100
+ };
101
+ export type SavedAttemptCheck = {
102
+ status: "check";
103
+ /** What couldn't be shown, for logs and details. */
104
+ reason: string;
105
+ line: string;
106
+ warning: string;
107
+ /** The hold evidence this check evaluated: the user's check retires exactly this. */
108
+ evidence: string;
109
+ };
110
+ /**
111
+ * How recovering a saved attempt ended, the one rule every app follows
112
+ * before any send or discard:
113
+ * - `held`: the hold still holds the write. Count nothing; show `state`, and
114
+ * its exit when due (through `handle`);
115
+ * - `done`: `success` ran. `authenticated: true` when the app's check showed
116
+ * it as this attempt (`value`); `false` when the hold settled it but the
117
+ * app's details are unavailable (`reason`): record its `hash` and follow it,
118
+ * with "Check again" (recover again) as its only action. Either way, never
119
+ * send it again; only `retire({ by: "settled" })` retires it. `failed` is
120
+ * the hold's proven revert of it;
121
+ * - `check`: it can't be shown. One explicit action, "I checked it. ...",
122
+ * and only that, retires it (`retire({ by: "check", outcome })`);
123
+ * - `none`: the hold proves nothing was reserved and nothing saved says it
124
+ * was sent, or the attempt was retired (`retired`): by the user or a
125
+ * followed settlement, or by the SDK itself when it dropped every
126
+ * reservation of it on a definite wallet rejection or an abort before the
127
+ * wallet opened (`"rejected"`: nothing can have been sent).
128
+ */
129
+ export type SavedAttemptOutcome<T> = {
130
+ status: "held";
131
+ state: WriteHeldState;
132
+ handle: WriteHoldHandle;
133
+ } | {
134
+ status: "done";
135
+ result: "success";
136
+ authenticated: true;
137
+ hash?: Hex;
138
+ value: T;
139
+ } | {
140
+ status: "done";
141
+ result: "success";
142
+ authenticated: false;
143
+ /** The settled transaction; absent when another tab's check proved it without one. */
144
+ hash?: Hex;
145
+ reason: string;
146
+ } | {
147
+ status: "done";
148
+ result: "failed";
149
+ hash: Hex;
150
+ } | SavedAttemptCheck | {
151
+ status: "none";
152
+ retired?: SavedAttemptRetirement["by"] | "rejected";
153
+ };
154
+ /**
155
+ * Saved-attempt recovery over the app's write hold, framework-free: every
156
+ * app's launches, linked plans, shop updates and other saved writes recover
157
+ * the same way. Pass the hold's own `storage` and `locks` when it was made
158
+ * with custom ones; the defaults are the hold's defaults.
159
+ *
160
+ * - Recovery needs only what was saved: run it right after a saved attempt is
161
+ * found, before any fresh-send preparation.
162
+ * - Absence of evidence is `check`, never `none`: a missing hold record, a
163
+ * refused or unreadable adoption, an empty search and every exception.
164
+ * - A settled success always wins: it is never downgraded by a later failed
165
+ * or empty read, and it blocks discard until followed.
166
+ * - Only the user's exit, the user's check action, a followed settlement and
167
+ * the SDK's own drop of a rejected reservation retire an attempt, persisted under the hold's locks for every tab and
168
+ * reload, and only for the hold evidence they saw.
169
+ */
170
+ export declare function createSavedAttemptRecovery(options: {
171
+ hold: WriteHold;
172
+ storage?: HeldWriteStorage;
173
+ locks?: Pick<LockManager, "request">;
174
+ }): {
175
+ recover: <T>(attempt: SavedAttempt<T>, client: WriteHoldClient) => Promise<SavedAttemptOutcome<T>>;
176
+ retire: (attempt: SavedAttemptScope, reason: SavedAttemptRetirement) => Promise<SavedAttemptRetired>;
177
+ canDiscard: (attempt: SavedAttemptScope) => boolean;
178
+ };
179
+ export type SavedAttemptRecovery = ReturnType<typeof createSavedAttemptRecovery>;
180
+ //# sourceMappingURL=savedAttempt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"savedAttempt.d.ts","sourceRoot":"","sources":["../../../src/review/savedAttempt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAKzC,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,eAAe,EACf,eAAe,EAEhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAGL,KAA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