@bananapus/nana-sdk-core 3.5.2 → 5.0.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 (304) hide show
  1. package/bin/wallet-check.mjs +495 -0
  2. package/dist/cjs/actions/suckerPairs.d.ts +5 -3
  3. package/dist/cjs/actions/suckerPairs.d.ts.map +1 -1
  4. package/dist/cjs/actions/suckerPairs.js +6 -26
  5. package/dist/cjs/actions/suckerPairs.js.map +1 -1
  6. package/dist/cjs/pause.d.ts +2 -0
  7. package/dist/cjs/pause.d.ts.map +1 -1
  8. package/dist/cjs/pause.js +17 -0
  9. package/dist/cjs/pause.js.map +1 -1
  10. package/dist/cjs/review/confirm.d.ts +56 -0
  11. package/dist/cjs/review/confirm.d.ts.map +1 -0
  12. package/dist/cjs/review/confirm.js +99 -0
  13. package/dist/cjs/review/confirm.js.map +1 -0
  14. package/dist/cjs/review/contractWrite.d.ts +5 -3
  15. package/dist/cjs/review/contractWrite.d.ts.map +1 -1
  16. package/dist/cjs/review/contractWrite.js +10 -8
  17. package/dist/cjs/review/contractWrite.js.map +1 -1
  18. package/dist/cjs/review/decode.d.ts +19 -1
  19. package/dist/cjs/review/decode.d.ts.map +1 -1
  20. package/dist/cjs/review/decode.js +30 -11
  21. package/dist/cjs/review/decode.js.map +1 -1
  22. package/dist/cjs/review/decodeCall.d.ts +21 -0
  23. package/dist/cjs/review/decodeCall.d.ts.map +1 -0
  24. package/dist/cjs/review/decodeCall.js +183 -0
  25. package/dist/cjs/review/decodeCall.js.map +1 -0
  26. package/dist/cjs/review/heldWrite.d.ts +4 -0
  27. package/dist/cjs/review/heldWrite.d.ts.map +1 -1
  28. package/dist/cjs/review/heldWrite.js +35 -31
  29. package/dist/cjs/review/heldWrite.js.map +1 -1
  30. package/dist/cjs/review/index.d.ts +12 -1
  31. package/dist/cjs/review/index.d.ts.map +1 -1
  32. package/dist/cjs/review/index.js +29 -1
  33. package/dist/cjs/review/index.js.map +1 -1
  34. package/dist/cjs/review/intents.d.ts +10 -0
  35. package/dist/cjs/review/intents.d.ts.map +1 -1
  36. package/dist/cjs/review/intents.js +13 -0
  37. package/dist/cjs/review/intents.js.map +1 -1
  38. package/dist/cjs/review/lineError.d.ts +72 -0
  39. package/dist/cjs/review/lineError.d.ts.map +1 -0
  40. package/dist/cjs/review/lineError.js +76 -0
  41. package/dist/cjs/review/lineError.js.map +1 -0
  42. package/dist/cjs/review/messages.d.ts +15 -3
  43. package/dist/cjs/review/messages.d.ts.map +1 -1
  44. package/dist/cjs/review/messages.js +16 -4
  45. package/dist/cjs/review/messages.js.map +1 -1
  46. package/dist/cjs/review/model.d.ts +149 -0
  47. package/dist/cjs/review/model.d.ts.map +1 -0
  48. package/dist/cjs/review/model.js +750 -0
  49. package/dist/cjs/review/model.js.map +1 -0
  50. package/dist/cjs/review/plan.d.ts +61 -0
  51. package/dist/cjs/review/plan.d.ts.map +1 -0
  52. package/dist/cjs/review/plan.js +143 -0
  53. package/dist/cjs/review/plan.js.map +1 -0
  54. package/dist/cjs/review/react/index.d.ts +1 -0
  55. package/dist/cjs/review/react/index.d.ts.map +1 -1
  56. package/dist/cjs/review/react/index.js +1 -0
  57. package/dist/cjs/review/react/index.js.map +1 -1
  58. package/dist/cjs/review/react/useHeldSend.js +3 -4
  59. package/dist/cjs/review/react/useHeldSend.js.map +1 -1
  60. package/dist/cjs/review/react/useHeldWrite.d.ts.map +1 -1
  61. package/dist/cjs/review/react/useHeldWrite.js +2 -1
  62. package/dist/cjs/review/react/useHeldWrite.js.map +1 -1
  63. package/dist/cjs/review/react/useReviewedRun.d.ts +122 -0
  64. package/dist/cjs/review/react/useReviewedRun.d.ts.map +1 -0
  65. package/dist/cjs/review/react/useReviewedRun.js +443 -0
  66. package/dist/cjs/review/react/useReviewedRun.js.map +1 -0
  67. package/dist/cjs/review/receipt.d.ts +37 -1
  68. package/dist/cjs/review/receipt.d.ts.map +1 -1
  69. package/dist/cjs/review/receipt.js +76 -3
  70. package/dist/cjs/review/receipt.js.map +1 -1
  71. package/dist/cjs/review/relayr.d.ts +13 -4
  72. package/dist/cjs/review/relayr.d.ts.map +1 -1
  73. package/dist/cjs/review/relayr.js +52 -8
  74. package/dist/cjs/review/relayr.js.map +1 -1
  75. package/dist/cjs/review/relayrSend.d.ts +106 -0
  76. package/dist/cjs/review/relayrSend.d.ts.map +1 -0
  77. package/dist/cjs/review/relayrSend.js +795 -0
  78. package/dist/cjs/review/relayrSend.js.map +1 -0
  79. package/dist/cjs/review/reviewQueue.d.ts +10 -9
  80. package/dist/cjs/review/reviewQueue.d.ts.map +1 -1
  81. package/dist/cjs/review/reviewQueue.js +19 -29
  82. package/dist/cjs/review/reviewQueue.js.map +1 -1
  83. package/dist/cjs/review/reviewRequests.d.ts +86 -0
  84. package/dist/cjs/review/reviewRequests.d.ts.map +1 -0
  85. package/dist/cjs/review/reviewRequests.js +266 -0
  86. package/dist/cjs/review/reviewRequests.js.map +1 -0
  87. package/dist/cjs/review/safeRelayr.d.ts +3 -1
  88. package/dist/cjs/review/safeRelayr.d.ts.map +1 -1
  89. package/dist/cjs/review/safeRelayr.js +9 -9
  90. package/dist/cjs/review/safeRelayr.js.map +1 -1
  91. package/dist/cjs/review/safeSend.d.ts +69 -0
  92. package/dist/cjs/review/safeSend.d.ts.map +1 -0
  93. package/dist/cjs/review/safeSend.js +306 -0
  94. package/dist/cjs/review/safeSend.js.map +1 -0
  95. package/dist/cjs/review/send.d.ts +272 -0
  96. package/dist/cjs/review/send.d.ts.map +1 -0
  97. package/dist/cjs/review/send.js +1163 -0
  98. package/dist/cjs/review/send.js.map +1 -0
  99. package/dist/cjs/review/sequence.d.ts +77 -0
  100. package/dist/cjs/review/sequence.d.ts.map +1 -0
  101. package/dist/cjs/review/sequence.js +232 -0
  102. package/dist/cjs/review/sequence.js.map +1 -0
  103. package/dist/cjs/review/sign.d.ts +111 -0
  104. package/dist/cjs/review/sign.d.ts.map +1 -0
  105. package/dist/cjs/review/sign.js +378 -0
  106. package/dist/cjs/review/sign.js.map +1 -0
  107. package/dist/cjs/review/simulation.d.ts +41 -2
  108. package/dist/cjs/review/simulation.d.ts.map +1 -1
  109. package/dist/cjs/review/simulation.js +99 -29
  110. package/dist/cjs/review/simulation.js.map +1 -1
  111. package/dist/cjs/review/transaction-message.d.ts +13 -0
  112. package/dist/cjs/review/transaction-message.d.ts.map +1 -1
  113. package/dist/cjs/review/transaction-message.js +25 -0
  114. package/dist/cjs/review/transaction-message.js.map +1 -1
  115. package/dist/cjs/review/transactionReview.d.ts +27 -19
  116. package/dist/cjs/review/transactionReview.d.ts.map +1 -1
  117. package/dist/cjs/review/transactionReview.js +22 -63
  118. package/dist/cjs/review/transactionReview.js.map +1 -1
  119. package/dist/cjs/review/wallet.d.ts +98 -0
  120. package/dist/cjs/review/wallet.d.ts.map +1 -0
  121. package/dist/cjs/review/wallet.js +234 -0
  122. package/dist/cjs/review/wallet.js.map +1 -0
  123. package/dist/cjs/review/writeHold.d.ts +138 -13
  124. package/dist/cjs/review/writeHold.d.ts.map +1 -1
  125. package/dist/cjs/review/writeHold.js +98 -18
  126. package/dist/cjs/review/writeHold.js.map +1 -1
  127. package/dist/cjs/review/writeRecovery.d.ts +17 -1
  128. package/dist/cjs/review/writeRecovery.d.ts.map +1 -1
  129. package/dist/cjs/review/writeRecovery.js +146 -45
  130. package/dist/cjs/review/writeRecovery.js.map +1 -1
  131. package/dist/cjs/safeService.d.ts +27 -4
  132. package/dist/cjs/safeService.d.ts.map +1 -1
  133. package/dist/cjs/safeService.js +120 -3
  134. package/dist/cjs/safeService.js.map +1 -1
  135. package/dist/cjs/testing.d.ts +24 -0
  136. package/dist/cjs/testing.d.ts.map +1 -1
  137. package/dist/cjs/testing.js +26 -1
  138. package/dist/cjs/testing.js.map +1 -1
  139. package/dist/cjs/v6/defifa.d.ts.map +1 -1
  140. package/dist/cjs/v6/defifa.js +24 -23
  141. package/dist/cjs/v6/defifa.js.map +1 -1
  142. package/dist/cjs/v6/executionErrors.d.ts.map +1 -1
  143. package/dist/cjs/v6/executionErrors.js +3 -2
  144. package/dist/cjs/v6/executionErrors.js.map +1 -1
  145. package/dist/cjs/v6/pay.d.ts +25 -8
  146. package/dist/cjs/v6/pay.d.ts.map +1 -1
  147. package/dist/cjs/v6/pay.js +117 -23
  148. package/dist/cjs/v6/pay.js.map +1 -1
  149. package/dist/cjs/v6/suckers.d.ts +30 -0
  150. package/dist/cjs/v6/suckers.d.ts.map +1 -1
  151. package/dist/cjs/v6/suckers.js +69 -5
  152. package/dist/cjs/v6/suckers.js.map +1 -1
  153. package/dist/esm/actions/suckerPairs.d.ts +5 -3
  154. package/dist/esm/actions/suckerPairs.d.ts.map +1 -1
  155. package/dist/esm/actions/suckerPairs.js +7 -27
  156. package/dist/esm/actions/suckerPairs.js.map +1 -1
  157. package/dist/esm/pause.d.ts +2 -0
  158. package/dist/esm/pause.d.ts.map +1 -1
  159. package/dist/esm/pause.js +16 -0
  160. package/dist/esm/pause.js.map +1 -1
  161. package/dist/esm/review/confirm.d.ts +56 -0
  162. package/dist/esm/review/confirm.d.ts.map +1 -0
  163. package/dist/esm/review/confirm.js +93 -0
  164. package/dist/esm/review/confirm.js.map +1 -0
  165. package/dist/esm/review/contractWrite.d.ts +5 -3
  166. package/dist/esm/review/contractWrite.d.ts.map +1 -1
  167. package/dist/esm/review/contractWrite.js +10 -8
  168. package/dist/esm/review/contractWrite.js.map +1 -1
  169. package/dist/esm/review/decode.d.ts +19 -1
  170. package/dist/esm/review/decode.d.ts.map +1 -1
  171. package/dist/esm/review/decode.js +29 -14
  172. package/dist/esm/review/decode.js.map +1 -1
  173. package/dist/esm/review/decodeCall.d.ts +21 -0
  174. package/dist/esm/review/decodeCall.d.ts.map +1 -0
  175. package/dist/esm/review/decodeCall.js +180 -0
  176. package/dist/esm/review/decodeCall.js.map +1 -0
  177. package/dist/esm/review/heldWrite.d.ts +4 -0
  178. package/dist/esm/review/heldWrite.d.ts.map +1 -1
  179. package/dist/esm/review/heldWrite.js +34 -30
  180. package/dist/esm/review/heldWrite.js.map +1 -1
  181. package/dist/esm/review/index.d.ts +12 -1
  182. package/dist/esm/review/index.d.ts.map +1 -1
  183. package/dist/esm/review/index.js +12 -1
  184. package/dist/esm/review/index.js.map +1 -1
  185. package/dist/esm/review/intents.d.ts +10 -0
  186. package/dist/esm/review/intents.d.ts.map +1 -1
  187. package/dist/esm/review/intents.js +12 -0
  188. package/dist/esm/review/intents.js.map +1 -1
  189. package/dist/esm/review/lineError.d.ts +72 -0
  190. package/dist/esm/review/lineError.d.ts.map +1 -0
  191. package/dist/esm/review/lineError.js +68 -0
  192. package/dist/esm/review/lineError.js.map +1 -0
  193. package/dist/esm/review/messages.d.ts +15 -3
  194. package/dist/esm/review/messages.d.ts.map +1 -1
  195. package/dist/esm/review/messages.js +15 -3
  196. package/dist/esm/review/messages.js.map +1 -1
  197. package/dist/esm/review/model.d.ts +149 -0
  198. package/dist/esm/review/model.d.ts.map +1 -0
  199. package/dist/esm/review/model.js +746 -0
  200. package/dist/esm/review/model.js.map +1 -0
  201. package/dist/esm/review/plan.d.ts +61 -0
  202. package/dist/esm/review/plan.d.ts.map +1 -0
  203. package/dist/esm/review/plan.js +136 -0
  204. package/dist/esm/review/plan.js.map +1 -0
  205. package/dist/esm/review/react/index.d.ts +1 -0
  206. package/dist/esm/review/react/index.d.ts.map +1 -1
  207. package/dist/esm/review/react/index.js +1 -0
  208. package/dist/esm/review/react/index.js.map +1 -1
  209. package/dist/esm/review/react/useHeldSend.js +3 -4
  210. package/dist/esm/review/react/useHeldSend.js.map +1 -1
  211. package/dist/esm/review/react/useHeldWrite.d.ts.map +1 -1
  212. package/dist/esm/review/react/useHeldWrite.js +2 -1
  213. package/dist/esm/review/react/useHeldWrite.js.map +1 -1
  214. package/dist/esm/review/react/useReviewedRun.d.ts +122 -0
  215. package/dist/esm/review/react/useReviewedRun.d.ts.map +1 -0
  216. package/dist/esm/review/react/useReviewedRun.js +439 -0
  217. package/dist/esm/review/react/useReviewedRun.js.map +1 -0
  218. package/dist/esm/review/receipt.d.ts +37 -1
  219. package/dist/esm/review/receipt.d.ts.map +1 -1
  220. package/dist/esm/review/receipt.js +72 -2
  221. package/dist/esm/review/receipt.js.map +1 -1
  222. package/dist/esm/review/relayr.d.ts +13 -4
  223. package/dist/esm/review/relayr.d.ts.map +1 -1
  224. package/dist/esm/review/relayr.js +51 -8
  225. package/dist/esm/review/relayr.js.map +1 -1
  226. package/dist/esm/review/relayrSend.d.ts +106 -0
  227. package/dist/esm/review/relayrSend.d.ts.map +1 -0
  228. package/dist/esm/review/relayrSend.js +787 -0
  229. package/dist/esm/review/relayrSend.js.map +1 -0
  230. package/dist/esm/review/reviewQueue.d.ts +10 -9
  231. package/dist/esm/review/reviewQueue.d.ts.map +1 -1
  232. package/dist/esm/review/reviewQueue.js +17 -26
  233. package/dist/esm/review/reviewQueue.js.map +1 -1
  234. package/dist/esm/review/reviewRequests.d.ts +86 -0
  235. package/dist/esm/review/reviewRequests.d.ts.map +1 -0
  236. package/dist/esm/review/reviewRequests.js +263 -0
  237. package/dist/esm/review/reviewRequests.js.map +1 -0
  238. package/dist/esm/review/safeRelayr.d.ts +3 -1
  239. package/dist/esm/review/safeRelayr.d.ts.map +1 -1
  240. package/dist/esm/review/safeRelayr.js +9 -9
  241. package/dist/esm/review/safeRelayr.js.map +1 -1
  242. package/dist/esm/review/safeSend.d.ts +69 -0
  243. package/dist/esm/review/safeSend.d.ts.map +1 -0
  244. package/dist/esm/review/safeSend.js +301 -0
  245. package/dist/esm/review/safeSend.js.map +1 -0
  246. package/dist/esm/review/send.d.ts +272 -0
  247. package/dist/esm/review/send.d.ts.map +1 -0
  248. package/dist/esm/review/send.js +1156 -0
  249. package/dist/esm/review/send.js.map +1 -0
  250. package/dist/esm/review/sequence.d.ts +77 -0
  251. package/dist/esm/review/sequence.d.ts.map +1 -0
  252. package/dist/esm/review/sequence.js +223 -0
  253. package/dist/esm/review/sequence.js.map +1 -0
  254. package/dist/esm/review/sign.d.ts +111 -0
  255. package/dist/esm/review/sign.d.ts.map +1 -0
  256. package/dist/esm/review/sign.js +372 -0
  257. package/dist/esm/review/sign.js.map +1 -0
  258. package/dist/esm/review/simulation.d.ts +41 -2
  259. package/dist/esm/review/simulation.d.ts.map +1 -1
  260. package/dist/esm/review/simulation.js +95 -29
  261. package/dist/esm/review/simulation.js.map +1 -1
  262. package/dist/esm/review/transaction-message.d.ts +13 -0
  263. package/dist/esm/review/transaction-message.d.ts.map +1 -1
  264. package/dist/esm/review/transaction-message.js +23 -0
  265. package/dist/esm/review/transaction-message.js.map +1 -1
  266. package/dist/esm/review/transactionReview.d.ts +27 -19
  267. package/dist/esm/review/transactionReview.d.ts.map +1 -1
  268. package/dist/esm/review/transactionReview.js +19 -56
  269. package/dist/esm/review/transactionReview.js.map +1 -1
  270. package/dist/esm/review/wallet.d.ts +98 -0
  271. package/dist/esm/review/wallet.d.ts.map +1 -0
  272. package/dist/esm/review/wallet.js +227 -0
  273. package/dist/esm/review/wallet.js.map +1 -0
  274. package/dist/esm/review/writeHold.d.ts +138 -13
  275. package/dist/esm/review/writeHold.d.ts.map +1 -1
  276. package/dist/esm/review/writeHold.js +96 -19
  277. package/dist/esm/review/writeHold.js.map +1 -1
  278. package/dist/esm/review/writeRecovery.d.ts +17 -1
  279. package/dist/esm/review/writeRecovery.d.ts.map +1 -1
  280. package/dist/esm/review/writeRecovery.js +149 -48
  281. package/dist/esm/review/writeRecovery.js.map +1 -1
  282. package/dist/esm/safeService.d.ts +27 -4
  283. package/dist/esm/safeService.d.ts.map +1 -1
  284. package/dist/esm/safeService.js +119 -4
  285. package/dist/esm/safeService.js.map +1 -1
  286. package/dist/esm/testing.d.ts +24 -0
  287. package/dist/esm/testing.d.ts.map +1 -1
  288. package/dist/esm/testing.js +23 -1
  289. package/dist/esm/testing.js.map +1 -1
  290. package/dist/esm/v6/defifa.d.ts.map +1 -1
  291. package/dist/esm/v6/defifa.js +24 -23
  292. package/dist/esm/v6/defifa.js.map +1 -1
  293. package/dist/esm/v6/executionErrors.d.ts.map +1 -1
  294. package/dist/esm/v6/executionErrors.js +3 -2
  295. package/dist/esm/v6/executionErrors.js.map +1 -1
  296. package/dist/esm/v6/pay.d.ts +25 -8
  297. package/dist/esm/v6/pay.d.ts.map +1 -1
  298. package/dist/esm/v6/pay.js +115 -22
  299. package/dist/esm/v6/pay.js.map +1 -1
  300. package/dist/esm/v6/suckers.d.ts +30 -0
  301. package/dist/esm/v6/suckers.d.ts.map +1 -1
  302. package/dist/esm/v6/suckers.js +67 -5
  303. package/dist/esm/v6/suckers.js.map +1 -1
  304. package/package.json +11 -2
@@ -0,0 +1,306 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.proposeReviewedSafeTransaction = proposeReviewedSafeTransaction;
4
+ exports.confirmReviewedSafeTransaction = confirmReviewedSafeTransaction;
5
+ exports.executeReviewedSafeTransaction = executeReviewedSafeTransaction;
6
+ const viem_1 = require("viem");
7
+ const safe_js_1 = require("../safe.js");
8
+ const safeService_js_1 = require("../safeService.js");
9
+ const intents_js_1 = require("./intents.js");
10
+ const receipt_js_1 = require("./receipt.js");
11
+ const send_js_1 = require("./send.js");
12
+ const sign_js_1 = require("./sign.js");
13
+ const simulation_js_1 = require("./simulation.js");
14
+ const wallet_js_1 = require("./wallet.js");
15
+ const UNVERIFIED = "Could not verify this Safe onchain.";
16
+ const SAFE_CHANGED = "The Safe policy or nonce changed. Review the transaction again.";
17
+ const REFUND = "This transaction pays a gas refund, so it can't be executed here.";
18
+ function connectedAccount(deps) {
19
+ const account = deps.adapter.account();
20
+ if (!account)
21
+ throw new Error("Connect a wallet first.");
22
+ return account;
23
+ }
24
+ function requireService(chainId) {
25
+ if (!(0, safeService_js_1.hasSafeService)(chainId)) {
26
+ throw new Error(`Safe does not host a transaction service on chain ${chainId}.`);
27
+ }
28
+ }
29
+ /**
30
+ * The Safe's live policy and nonce. Fails closed on anything but a recognized
31
+ * Safe whose every module was read: a module can change the policy without
32
+ * moving the nonce.
33
+ */
34
+ async function liveSafe(client, safe) {
35
+ const [identity, nonce] = await Promise.all([
36
+ (0, safe_js_1.readAuthorityIdentity)(client, safe),
37
+ (0, safe_js_1.readBoundedSafeNonce)(client, safe),
38
+ ]);
39
+ if (identity?.kind !== "safe" ||
40
+ !identity.modules ||
41
+ nonce === null ||
42
+ nonce > BigInt(Number.MAX_SAFE_INTEGER)) {
43
+ throw new Error(UNVERIFIED);
44
+ }
45
+ return { identity, nonce: Number(nonce) };
46
+ }
47
+ /** Throws unless `after` is `before`: the same policy, modules and nonce. */
48
+ function requireUnchanged(before, after) {
49
+ if (JSON.stringify(before) !== JSON.stringify(after)) {
50
+ throw new Error(SAFE_CHANGED);
51
+ }
52
+ }
53
+ function requireSigner(state, account) {
54
+ if (!state.identity.owners.some((owner) => (0, viem_1.isAddressEqual)(owner, account))) {
55
+ throw new Error("The connected wallet is not a signer of this Safe.");
56
+ }
57
+ }
58
+ /** A pending transaction may wait behind others; an executed one must be next. */
59
+ function requireNonce(state, tx, mode) {
60
+ const nonce = (0, safeService_js_1.safeTransactionMessage)(tx).nonce;
61
+ const live = BigInt(state.nonce);
62
+ if (mode === "execute" ? nonce !== live : nonce < live) {
63
+ throw new Error(`Safe transaction #${tx.nonce} is stale or does not match the live nonce.`);
64
+ }
65
+ }
66
+ /** `tx` read once, so a record changed after review is not what is sent. */
67
+ function snapshot(tx) {
68
+ const copy = structuredClone(tx);
69
+ if ((0, safeService_js_1.safeTransactionHasRefund)(copy))
70
+ throw new Error(REFUND);
71
+ return copy;
72
+ }
73
+ /**
74
+ * Signs `tx` as `account`, an owner, through {@link signReviewed}'s Safe
75
+ * transaction review. The Safe's policy and nonce must not move while the
76
+ * review is open, checked before the wallet is asked, nor while the wallet
77
+ * is open, checked once it answers.
78
+ */
79
+ async function signAsOwner(input, deps) {
80
+ const { chainId, safe, account, tx, context, title, beforePost, plan } = input;
81
+ const client = deps.clientFor(chainId);
82
+ const before = await liveSafe(client, safe);
83
+ requireSigner(before, account);
84
+ requireNonce(before, tx, "pending");
85
+ const unchanged = async () => requireUnchanged(before, await liveSafe(client, safe));
86
+ const [signature] = await (0, sign_js_1.signReviewed)([{ kind: "safe-tx", chainId, safe, tx }], {
87
+ account,
88
+ ...(title ? { title } : {}),
89
+ ...(context ? { context } : {}),
90
+ ...(plan ? { plan } : {}),
91
+ reverify: unchanged,
92
+ }, deps);
93
+ await beforePost?.();
94
+ await unchanged();
95
+ return signature;
96
+ }
97
+ /**
98
+ * Proposes `calls` to `safe`'s owners through Safe's transaction service: one
99
+ * zero-refund Safe transaction, a CALL for one call or a MultiSendCallOnly
100
+ * batch for several, signed by the connected owner after one review. It takes
101
+ * the nonce after everything already queued. A queued proposal of exactly
102
+ * these calls is confirmed instead, or, when this owner already confirmed it,
103
+ * returned as it is.
104
+ *
105
+ * Mirrors jbm `src/lib/safe.ts` `runSafeCalls` (service path), `proposeSafeTx`
106
+ * and `signSafeTx` (`:331-420`).
107
+ */
108
+ async function proposeReviewedSafeTransaction(input, deps) {
109
+ const { chainId, safe, context, title, origin = "Juicebox", service, plan, } = input;
110
+ requireService(chainId);
111
+ const calls = [...input.calls].map((call) => {
112
+ const { chainId: on, to, data, value } = call;
113
+ if (on !== chainId) {
114
+ throw new Error(`Every call of a Safe proposal must be on chain ${chainId}.`);
115
+ }
116
+ return { to, data, value: value ?? 0n };
117
+ });
118
+ if (!calls.length)
119
+ throw new Error("There is no transaction to review.");
120
+ const account = connectedAccount(deps);
121
+ const state = await liveSafe(deps.clientFor(chainId), safe);
122
+ requireSigner(state, account);
123
+ // An outage must not read as an empty queue: the proposal would take a
124
+ // queued nonce and strand one of the two.
125
+ const pending = await (0, safeService_js_1.listPendingSafeTransactions)(chainId, safe, state.nonce, service);
126
+ const build = (nonce) => calls.length === 1
127
+ ? (0, safeService_js_1.safeProposalFor)(calls[0], nonce)
128
+ : (0, safeService_js_1.safeBatchProposalFor)(calls, nonce);
129
+ const shape = (0, safeService_js_1.safeTransactionMessage)(build(state.nonce));
130
+ const queued = pending.find((tx) => (0, safeService_js_1.safeTransactionMatchesCall)(tx, shape));
131
+ if (queued) {
132
+ const confirmed = (0, safeService_js_1.usableSafeConfirmations)(queued, state.identity.owners).some(({ owner }) => (0, viem_1.isAddressEqual)(owner, account));
133
+ if (confirmed) {
134
+ return { safeTxHash: (0, safeService_js_1.canonicalSafeTxHash)(chainId, safe, queued) };
135
+ }
136
+ return confirmAs(account, {
137
+ chainId,
138
+ safe,
139
+ tx: queued,
140
+ ...(context ? { context } : {}),
141
+ ...(plan ? { plan } : {}),
142
+ service,
143
+ }, deps);
144
+ }
145
+ const nonce = (0, safeService_js_1.nextProposalNonce)(state.nonce, pending);
146
+ const tx = build(nonce);
147
+ const safeTxHash = (0, safeService_js_1.safeTransactionHash)(chainId, safe, tx);
148
+ const signature = await signAsOwner({
149
+ chainId,
150
+ safe,
151
+ account,
152
+ tx,
153
+ context,
154
+ title,
155
+ ...(plan ? { plan } : {}),
156
+ // Another proposal queued at this nonce meanwhile would be replaced by this one.
157
+ beforePost: async () => {
158
+ const since = await (0, safeService_js_1.listPendingSafeTransactions)(chainId, safe, state.nonce, service);
159
+ if (since.some((other) => other.nonce === nonce)) {
160
+ throw new Error(`Another proposal took Safe nonce ${nonce} during review. Nothing was proposed; review it again.`);
161
+ }
162
+ },
163
+ }, deps);
164
+ try {
165
+ await (0, safeService_js_1.proposeSafeTransaction)(chainId, safe, tx, { sender: account, signature, origin }, service);
166
+ }
167
+ catch (error) {
168
+ // The service may have queued it and lost its answer: a retry must find
169
+ // it, not propose the same calls again at the next nonce. Only this
170
+ // owner's own signature on the record proves this proposal landed.
171
+ const queued = await (0, safeService_js_1.readSafeTransaction)(chainId, safe, safeTxHash, service).then((record) => Array.isArray(record.confirmations) &&
172
+ record.confirmations.some((confirmation) => typeof confirmation?.owner === "string" &&
173
+ (0, viem_1.isAddressEqual)(confirmation.owner, account) &&
174
+ confirmation.signature?.toLowerCase() === signature.toLowerCase()), () => false);
175
+ if (!queued)
176
+ throw error;
177
+ }
178
+ return { safeTxHash };
179
+ }
180
+ /**
181
+ * Adds the connected owner's signature to the queued `tx`, after one review
182
+ * of exactly its fields, safeTxGas included. Refuses a record whose fields do
183
+ * not hash to the hash it advertises, one that pays a gas refund, and one
184
+ * whose nonce the Safe has passed.
185
+ *
186
+ * Mirrors jbm `src/lib/safe.ts` `confirmSafeTx` and `signSafeTx`
187
+ * (`:331-420`).
188
+ */
189
+ async function confirmReviewedSafeTransaction(input, deps) {
190
+ return confirmAs(connectedAccount(deps), input, deps);
191
+ }
192
+ async function confirmAs(account, input, deps) {
193
+ const { chainId, safe, context, service, plan } = input;
194
+ const tx = snapshot(input.tx);
195
+ requireService(chainId);
196
+ const safeTxHash = (0, safeService_js_1.canonicalSafeTxHash)(chainId, safe, tx);
197
+ const signature = await signAsOwner({ chainId, safe, account, tx, context, ...(plan ? { plan } : {}) }, deps);
198
+ await (0, safeService_js_1.submitSafeConfirmation)(chainId, safe, tx, signature, service);
199
+ return { safeTxHash };
200
+ }
201
+ /**
202
+ * Executes the queued `tx` from the connected wallet, signed by its usable
203
+ * current-owner confirmations, through {@link sendReviewed}: one review, the
204
+ * step's write hold, and before the wallet opens, the Safe's policy and nonce
205
+ * checked unchanged and the exact call simulated to return true. The result
206
+ * is decided by the Safe's own ExecutionSuccess for the exact hash, never by
207
+ * the receipt's status alone. A Safe-connected wallet's proposal is returned
208
+ * as `proposed`.
209
+ *
210
+ * Mirrors jbm `src/lib/safe.ts` `executeSafeTx` and `sendContractAndConfirm`
211
+ * (`:595-760`).
212
+ */
213
+ async function executeReviewedSafeTransaction(input, deps) {
214
+ const { chainId, safe, context } = input;
215
+ const tx = snapshot(input.tx);
216
+ const account = connectedAccount(deps);
217
+ // A Safe app wraps the call in a transaction of its own Safe, which spends
218
+ // the nonce this one is signed for.
219
+ if ((0, viem_1.isAddressEqual)(account, safe)) {
220
+ throw new Error("A Safe can't execute its own queued transaction from inside itself. Execute it from an owner's wallet.");
221
+ }
222
+ const safeTxHash = (0, safeService_js_1.canonicalSafeTxHash)(chainId, safe, tx);
223
+ const client = deps.clientFor(chainId);
224
+ const state = await liveSafe(client, safe);
225
+ requireNonce(state, tx, "execute");
226
+ const { owners, threshold } = state.identity;
227
+ const usable = (0, safeService_js_1.usableSafeConfirmations)(tx, owners);
228
+ if (usable.length < threshold) {
229
+ throw new Error(`This transaction needs ${threshold} current-owner signature${threshold === 1 ? "" : "s"} before it can execute.`);
230
+ }
231
+ // Safe accepts the executor's own approval (v = 1) without checking its
232
+ // hash, so it does not bind the execution to this nonce: with it alone, a
233
+ // nonce spent meanwhile would run the same call again at the next one.
234
+ const bound = usable.filter(({ owner, signature }) => !(0, viem_1.isAddressEqual)(owner, account) ||
235
+ (!!signature && signature.slice(130, 132) !== "01"));
236
+ if (!bound.length) {
237
+ throw new Error("Your own approval alone does not bind this execution to its nonce. Sign the Safe transaction first.");
238
+ }
239
+ const args = (0, safeService_js_1.safeExecutionArgs)({ ...tx, confirmations: bound.length >= threshold ? bound : usable }, owners);
240
+ const data = (0, viem_1.encodeFunctionData)({
241
+ abi: safeService_js_1.SAFE_EXEC_ABI,
242
+ functionName: "execTransaction",
243
+ args,
244
+ });
245
+ /**
246
+ * Before the wallet opens: the Safe unchanged since review, and the exact
247
+ * call simulated to return true. A Safe signed with safeTxGas or gasPrice
248
+ * returns false for a failed call instead of reverting.
249
+ */
250
+ const stillExecutes = async () => {
251
+ requireUnchanged(state, await liveSafe(client, safe));
252
+ let executes = false;
253
+ try {
254
+ executes = (0, viem_1.decodeFunctionResult)({
255
+ abi: safeService_js_1.SAFE_EXEC_ABI,
256
+ functionName: "execTransaction",
257
+ data: await (0, simulation_js_1.simulateStateChangingTransaction)(client, {
258
+ from: account,
259
+ to: safe,
260
+ data,
261
+ }),
262
+ });
263
+ }
264
+ catch {
265
+ // A revert or an unreadable answer is not an execution.
266
+ }
267
+ if (executes !== true) {
268
+ throw new Error(`Safe transaction #${tx.nonce} would not execute successfully.`);
269
+ }
270
+ };
271
+ await (0, wallet_js_1.walletReady)(deps.adapter);
272
+ // A self-reviewing wallet sends with no step of core's before it.
273
+ if (deps.adapter.kind === "self-reviewing")
274
+ await stillExecutes();
275
+ const result = await (0, send_js_1.sendReviewed)({
276
+ account,
277
+ calls: [
278
+ {
279
+ chainId,
280
+ to: safe,
281
+ data,
282
+ abi: safeService_js_1.SAFE_EXEC_ABI,
283
+ functionName: "execTransaction",
284
+ args,
285
+ label: `Execute Safe transaction #${tx.nonce}`,
286
+ contractName: "Safe",
287
+ intent: (0, intents_js_1.safeExecutionIntent)({ chainId, safe, safeTxHash }),
288
+ },
289
+ ],
290
+ ...(context ? { context } : {}),
291
+ reverify: stillExecutes,
292
+ }, {
293
+ ...deps,
294
+ // Done only once the Safe's own event says so, below.
295
+ // Its promise is returned, so the guard that calls it sees a rejection.
296
+ onProgress: (progress) => progress.phase === "done" ? undefined : deps.onProgress?.(progress),
297
+ });
298
+ if (result.status !== "done")
299
+ return result;
300
+ const receipt = result.receipts[0] ??
301
+ (await (0, receipt_js_1.waitForTrackedReceipt)(client, result.hashes[0]));
302
+ (0, safeService_js_1.requireSafeExecutionSuccess)(receipt, safe, safeTxHash);
303
+ (0, receipt_js_1.tell)(deps.onProgress, { step: 0, total: 1, phase: "done" });
304
+ return result;
305
+ }
306
+ //# sourceMappingURL=safeSend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safeSend.js","sourceRoot":"","sources":["../../../src/review/safeSend.ts"],"names":[],"mappings":";;AAwLA,wEAqIC;AAWD,wEAaC;AA+BD,wEAoHC;AAxeD,+BAOc;AACd,wCAIoB;AACpB,sDAoB2B;AAC3B,6CAAmD;AAGnD,6CAA2D;AAC3D,uCAKmB;AACnB,uCAAyC;AACzC,mDAAmE;AACnE,2CAA0C;AAI1C,MAAM,UAAU,GAAG,qCAAqC,CAAC;AACzD,MAAM,YAAY,GAChB,iEAAiE,CAAC;AACpE,MAAM,MAAM,GACV,mEAAmE,CAAC;A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AAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/B,QAAQ,EAAE,aAAa;KACxB,EACD;QACE,GAAG,IAAI;QACP,sDAAsD;QACtD,wEAAwE;QACxE,UAAU,EAAE,CAAC,QAAQ,EAAE,EAAE,CACvB,QAAQ,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,QAAQ,CAAC;KACtE,CACF,CAAC;IACF,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC;IAC5C,MAAM,OAAO,GACX,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAClB,CAAC,MAAM,IAAA,kCAAqB,EAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,IAAA,4CAA2B,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;IACvD,IAAA,iBAAI,EAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5D,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,272 @@
1
+ import { ReviewedReceiptUnverifiedError } from "./lineError.js";
2
+ import { type Abi, type Address, type Hex, type PublicClient, type TransactionReceipt } from "viem";
3
+ import { type ReviewedWritePhase } from "./contractWrite.js";
4
+ import { type ReviewContextRow, type ReviewModel } from "./model.js";
5
+ import { type ReviewedPlan } from "./plan.js";
6
+ import { type ReviewedSequenceRecord } from "./sequence.js";
7
+ import { type ReviewedSignature } from "./sign.js";
8
+ import { type WalletAdapter } from "./wallet.js";
9
+ import { type WriteHold, type WriteHoldLegacySource, type WriteHoldSettled } from "./writeHold.js";
10
+ import { type HeldWriteStorage } from "./writeRecovery.js";
11
+ export type ReviewedCall = {
12
+ chainId: number;
13
+ to: Address;
14
+ data: Hex;
15
+ value?: bigint;
16
+ /**
17
+ * The exact gas limit to send with, when the app fixes it (a saved gas
18
+ * envelope, say). It is shown and bound in the review, simulated and sent
19
+ * as it is, never estimated or padded. A Safe app proposes with safeTxGas 0
20
+ * whatever this is.
21
+ */
22
+ gas?: bigint;
23
+ /**
24
+ * For a Safe app only, with `abi` and `functionName`: the indexes of the
25
+ * args (a fresh deadline) a proposal its Safe already queued may differ in
26
+ * and still be adopted instead of proposed twice. The queued data must
27
+ * decode with `abi` to the same function, encode back to exactly its bytes,
28
+ * and match every other arg; the target, value and operation must match as
29
+ * they are. Bound into the review. Unset compares exact bytes.
30
+ */
31
+ adoptIgnoringArgs?: readonly number[];
32
+ /** When given, `data` must be exactly this function's encoding of `args`. */
33
+ abi?: Abi;
34
+ functionName?: string;
35
+ args?: readonly unknown[];
36
+ label?: string;
37
+ contractName?: string;
38
+ /** The hold namespace, as `useSafeTx`'s `TxSendOptions` today. */
39
+ intent?: string;
40
+ /** The keys an earlier version held this write under, as the hold's `open` takes them. */
41
+ legacy?: readonly WriteHoldLegacySource[];
42
+ /** Simulate on the previous step's receipt block. */
43
+ dependsOnPrior?: boolean;
44
+ /**
45
+ * The block where a prerequisite confirmed outside this run (an earlier
46
+ * approval, say) took effect: the call is simulated on the latest block,
47
+ * or on this one while the node has not reached it. Used where the call
48
+ * is simulated alone and not on a prior step's block; a resumed run
49
+ * simulates on the latest block.
50
+ */
51
+ simulationBlockNumber?: bigint;
52
+ };
53
+ /** Where the step before this one confirmed. */
54
+ export type ReviewedPriorBlock = {
55
+ chainId: number;
56
+ blockNumber: bigint;
57
+ blockHash: Hex;
58
+ };
59
+ export type ReviewedAction = {
60
+ account: Address;
61
+ calls: readonly ReviewedCall[];
62
+ /**
63
+ * Signatures shown in the same prompt as `calls`, and signed after confirm,
64
+ * before the first send. A resumed sequence signs none.
65
+ */
66
+ signatures?: readonly ReviewedSignature[];
67
+ title?: string;
68
+ description?: string;
69
+ confirmLabel?: string;
70
+ context?: readonly ReviewContextRow[];
71
+ /**
72
+ * A stale-state check before each step; it throws to stop with nothing
73
+ * sent. `prior` is where the previous step of the action confirmed (on its
74
+ * own chain), so the check can read state at or after it; undefined for
75
+ * the first step, or on resume when that step's receipt can't be read.
76
+ */
77
+ reverify?: (call: ReviewedCall, index: number, prior: ReviewedPriorBlock | undefined) => Promise<void>;
78
+ /** The final synchronous gate before the wallet opens. */
79
+ assertWriteState?: () => void;
80
+ /** Refuses the action, before anything else (view-as, say). */
81
+ guard?: () => void;
82
+ /**
83
+ * A site's own record of a step at the wallet boundary, awaited: after its
84
+ * hold reserved it (and its journal saved it), right before the wallet
85
+ * opens. It throws to stop with nothing sent, which releases the step.
86
+ * `step` is the index in the whole action.
87
+ */
88
+ beforeWallet?: (call: ReviewedCall, step: number) => void | Promise<void>;
89
+ /**
90
+ * Awaited when nothing was sent for a step whose `beforeWallet` began: a
91
+ * gate refused, `beforeWallet` threw, or the wallet rejected (4001). Never
92
+ * after an ambiguous failure.
93
+ */
94
+ onUnsent?: (call: ReviewedCall, step: number) => void | Promise<void>;
95
+ /**
96
+ * Awaited once the wallet returned a step's hash, before its receipt is
97
+ * awaited: a Safe app's proposal hash (`safe`), or one its Safe already
98
+ * queued (`adopted`). A throw keeps the step pending, never unsent.
99
+ */
100
+ onSubmitted?: (call: ReviewedCall, step: number, hash: Hex, sent: {
101
+ safe: boolean;
102
+ adopted: boolean;
103
+ }) => void | Promise<void>;
104
+ /**
105
+ * Awaited once a step's receipt shows it succeeded and its progress is
106
+ * saved, before the next step; on resume, for a step that went through
107
+ * while away, when its receipt can be read. A throw is ignored: the step
108
+ * went through. A Safe app's proposal is never told here: its hold's
109
+ * settlement is (`useReviewedRun`'s `done` and `receipt`).
110
+ */
111
+ onConfirmed?: (call: ReviewedCall, step: number, receipt: TransactionReceipt) => void | Promise<void>;
112
+ /**
113
+ * Through a Safe app, every call goes to the Safe as one proposal (the
114
+ * app folds `sendCalls` into a MultiSend its signers approve once and run
115
+ * together, in order), under one hold: the first call's `intent`, or else
116
+ * `safeBatchIntent` of the calls. The calls must share a chain and
117
+ * the adapter must offer `sendCalls`. Nothing is journaled: the proposal
118
+ * runs whole or not at all. A resumed sequence, and any other wallet, sends
119
+ * the calls one by one.
120
+ */
121
+ batch?: boolean;
122
+ /**
123
+ * Withdraws the review while it is open: the run ends as cancelled with
124
+ * nothing sent, and the prompt's own `signal` aborts so its UI closes.
125
+ * Once the review is confirmed it changes nothing.
126
+ */
127
+ signal?: AbortSignal;
128
+ /**
129
+ * The site's key for this action (`payIntent(...)`, say). When set, the
130
+ * action is journaled once its review is confirmed, before the first
131
+ * wallet call, so {@link resumeReviewed} can finish it without sending a
132
+ * completed step again.
133
+ */
134
+ scope?: string;
135
+ /**
136
+ * A plan the person already reviewed ({@link reviewPlan}): nothing is
137
+ * asked, and every call (and every call the `signatures` let someone run)
138
+ * is spent from it, or nothing is sent.
139
+ */
140
+ plan?: ReviewedPlan;
141
+ /**
142
+ * Follows a sent step whose receipt its hold has not verified yet, in the
143
+ * run: `onConfirming(step)` tells the site, the hold is followed until it
144
+ * settles the step, and the run goes on to the next step or resolves.
145
+ * After `timeoutMs` (2 minutes by default) or `signal`, the run throws
146
+ * {@link ReviewedReceiptUnverifiedError} with the step still held, as it
147
+ * does at once without `follow`. Once `signal` aborts after a step was
148
+ * sent, the run sends nothing more: a later step is refused at its last
149
+ * gate as cancelled.
150
+ */
151
+ follow?: {
152
+ onConfirming?: (step: number) => void;
153
+ signal?: AbortSignal;
154
+ timeoutMs?: number;
155
+ };
156
+ };
157
+ export type ReviewedSendDeps = {
158
+ adapter: WalletAdapter;
159
+ clientFor: (chainId: number) => PublicClient;
160
+ hold: WriteHold;
161
+ onProgress?: (progress: ReviewedProgress) => void;
162
+ /** Self-reviewing adapters only: the model core would have shown. */
163
+ onPreview?: (model: ReviewModel) => void;
164
+ /** Where sequences are journaled: the hold's storage (the browser's, by default). */
165
+ storage?: HeldWriteStorage;
166
+ };
167
+ export type ReviewedProgress = {
168
+ step: number;
169
+ total: number;
170
+ phase: ReviewedWritePhase | "receipt" | "proposed" | "done";
171
+ hash?: Hex;
172
+ };
173
+ export type ReviewedResult = ({
174
+ status: "done";
175
+ hashes: Hex[];
176
+ receipts: TransactionReceipt[];
177
+ } | {
178
+ status: "proposed";
179
+ step: number;
180
+ safeTxHash: Hex;
181
+ }) & {
182
+ /** The action's `signatures`, signed in order, when it had any. */
183
+ signatures?: Hex[];
184
+ };
185
+ export declare const SAFE_BATCH_UNSUPPORTED_LINE = "This Safe connection can't propose these calls as one transaction. Nothing was sent.";
186
+ export declare const SAFE_BATCH_UNFOLLOWABLE_LINE = "Your Safe took this batch, but it can't be followed from here. Check your Safe before sending again.";
187
+ /** What {@link reviewPlan} reviews: calls from `account`, or from their own `from`. */
188
+ export type ReviewedPlanAction = Pick<ReviewedAction, "account" | "title" | "description" | "confirmLabel" | "context" | "signal"> & {
189
+ calls: readonly (ReviewedCall & {
190
+ /** Who sends the call: a Safe `account` owns, say, or "relayr" for one Relayr's own account runs. */
191
+ from?: Address | "relayr";
192
+ /**
193
+ * The Relayr round this call goes in, by the app's key: a quote paid by
194
+ * `payRelayrReviewed` with this `relayrRound`. The review shows each round's fee bound (Relayr's
195
+ * stand-in quote plus `RELAYR_FEE_MARGIN_BPS`, paid on the round's
196
+ * payment chain); a round whose quote is within it pays with no prompt.
197
+ */
198
+ relayrRound?: string;
199
+ })[];
200
+ /** Each Relayr round's payment chain, by its key: by default, the round's first call's chain. */
201
+ relayrRounds?: Readonly<Record<string, {
202
+ paymentChainId: number;
203
+ }>>;
204
+ };
205
+ /**
206
+ * One review of calls an app then sends one by one, across chains and
207
+ * paths: core's prompt over exactly `action.calls`, simulated as their
208
+ * senders, and nothing else. The plan it returns lets {@link sendReviewed},
209
+ * `signReviewed`, `proposeReviewedSafeTransaction` and `payRelayrReviewed`
210
+ * skip their prompt for a call identical to one of its
211
+ * calls (account, chain, sender, target, data, value and gas: a call's
212
+ * exact gas limit, or a forward request's signed gas, is set before the
213
+ * review), each spent once, for {@link REVIEWED_PLAN_TTL_MS} after confirm.
214
+ * Anything else is refused.
215
+ */
216
+ export declare function reviewPlan(action: ReviewedPlanAction, deps: Pick<ReviewedSendDeps, "clientFor">): Promise<ReviewedPlan>;
217
+ /**
218
+ * Sends one reviewed action: one call, or a sequence (approve then pay, say),
219
+ * reviewed once and sent without asking again.
220
+ *
221
+ * Core builds one model over every call and asks the registered review
222
+ * handler once ({@link registerReviewHandler}); nothing is sent unless the
223
+ * handler returns the confirmation core minted for that model. The
224
+ * review-time simulation runs while the review is open, and confirm never
225
+ * waits on it. Then, for each call in order: `reverify`, a check that the call
226
+ * still encodes to exactly the reviewed bytes, a simulation (at the previous
227
+ * step's receipt block when `dependsOnPrior`), and the send of those bytes
228
+ * through the adapter under the call's write hold, by
229
+ * `submitReviewedContractWrite`. The connected account must stay
230
+ * `action.account`, and the wallet on the call's chain. Each step waits for
231
+ * its receipt; a revert stops the sequence. A Safe-connected wallet's first
232
+ * step becomes a proposal, and the sequence stops there.
233
+ *
234
+ * The action's `signatures` show in the same model and prompt, and are
235
+ * signed after confirm and before the first send, as `signReviewed` signs.
236
+ *
237
+ * Only an explicit wallet rejection (EIP-1193 4001) releases a step's hold;
238
+ * any other failure once the wallet opened keeps it held.
239
+ *
240
+ * A self-reviewing adapter (Signa) is never prompted: `onPreview` gets the
241
+ * model, and the adapter gets the raw calls to review on its own page. An
242
+ * action with `signatures` is refused for it with EIP-1193 4200.
243
+ */
244
+ export declare function sendReviewed(action: ReviewedAction, deps: ReviewedSendDeps): Promise<ReviewedResult>;
245
+ /**
246
+ * Finish a sequence {@link sendReviewed} saved under `record.scope`: the step
247
+ * whose wallet call opened is decided by its write hold first (still held is
248
+ * refused; a settled success counts as completed, its receipt's hash
249
+ * recorded), then every remaining step, and only those, is reviewed once
250
+ * more as one fresh model and sent as `sendReviewed` sends. `reverify` gets
251
+ * each step's original index in the action. Only `record.account` can resume
252
+ * it. The result's `hashes` are every completed step's, `receipts` this
253
+ * run's.
254
+ */
255
+ export declare function resumeReviewed(record: ReviewedSequenceRecord, action: Pick<ReviewedAction, "reverify" | "assertWriteState" | "guard" | "context" | "title" | "beforeWallet" | "onUnsent" | "onSubmitted" | "onConfirmed" | "signal" | "follow">, deps: ReviewedSendDeps): Promise<ReviewedResult>;
256
+ /**
257
+ * Completes a sent step (one a run left at its receipt,
258
+ * {@link ReviewedReceiptUnverifiedError}, or a proposal: its step and its
259
+ * `held` call and reservation) once its hold settled that send, as the run
260
+ * itself would have: the saved sequence under `scope` records it, a success
261
+ * is told to `onConfirmed` with the receipt its hold verified (`receipt`,
262
+ * the hold view's, say, when it is that one) and only then acknowledged, the
263
+ * one acknowledgement of a followed step. Returns the settlement and that
264
+ * checked receipt (a failure's too); null until then. A read that fails or disagrees with the hold throws with
265
+ * nothing advanced: call it again. Call it once per settlement:
266
+ * `onConfirmed` is told each time.
267
+ */
268
+ export declare function completeReviewedStep(unverified: Pick<ReviewedReceiptUnverifiedError, "step" | "held">, action: Pick<ReviewedAction, "account" | "scope" | "onConfirmed">, deps: ReviewedSendDeps, receipt?: TransactionReceipt | null): Promise<{
269
+ settled: WriteHoldSettled;
270
+ receipt: TransactionReceipt | null;
271
+ } | null>;
272
+ //# sourceMappingURL=send.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../../src/review/send.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,8BAA8B,EAG/B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAGL,KAAK,GAAG,EACR,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACxB,MAAM,MAAM,CAAC;AAMd,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAgB5B,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAEjB,MAAM,YAAY,CAAC;AACpB,OA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