@velora-dex/widget 0.4.14 → 0.5.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 (229) hide show
  1. package/dist/components/web3/ConnectWallets/walletFlags.d.ts +90 -0
  2. package/dist/components/web3/ConnectWallets/walletFlags.d.ts.map +1 -0
  3. package/dist/components/web3/ConnectWallets/walletFlags.js +104 -0
  4. package/dist/components/web3/ConnectWallets/walletFlags.js.map +1 -0
  5. package/dist/components/web3/ConnectWallets/walletIcons.d.ts +4 -1
  6. package/dist/components/web3/ConnectWallets/walletIcons.d.ts.map +1 -1
  7. package/dist/components/web3/ConnectWallets/walletIcons.js +23 -3
  8. package/dist/components/web3/ConnectWallets/walletIcons.js.map +1 -1
  9. package/dist/components/widget/AppHeader/Activities/Drawers.d.ts.map +1 -1
  10. package/dist/components/widget/AppHeader/Activities/Drawers.js +24 -14
  11. package/dist/components/widget/AppHeader/Activities/Drawers.js.map +1 -1
  12. package/dist/components/widget/Button/CancelButton/CancelButton.js +44 -40
  13. package/dist/components/widget/Button/CancelButton/CancelButton.js.map +1 -1
  14. package/dist/components/widget/Button/CancelButton/CancelButtonWithDrawer.d.ts +15 -0
  15. package/dist/components/widget/Button/CancelButton/CancelButtonWithDrawer.d.ts.map +1 -0
  16. package/dist/components/widget/Button/CancelButton/CancelButtonWithDrawer.js +66 -0
  17. package/dist/components/widget/Button/CancelButton/CancelButtonWithDrawer.js.map +1 -0
  18. package/dist/components/widget/Drawer/state/useDrawerControls.d.ts +5 -2
  19. package/dist/components/widget/Drawer/state/useDrawerControls.d.ts.map +1 -1
  20. package/dist/components/widget/Drawer/state/useDrawerControls.js +75 -2
  21. package/dist/components/widget/Drawer/state/useDrawerControls.js.map +1 -1
  22. package/dist/components/widget/LimitOrderItem/LimitOrderDetails/Controls.d.ts.map +1 -1
  23. package/dist/components/widget/LimitOrderItem/LimitOrderDetails/Controls.js +85 -49
  24. package/dist/components/widget/LimitOrderItem/LimitOrderDetails/Controls.js.map +1 -1
  25. package/dist/components/widget/OtcOrderItem/OtcOrderDetails/Controls.d.ts.map +1 -1
  26. package/dist/components/widget/OtcOrderItem/OtcOrderDetails/Controls.js +33 -22
  27. package/dist/components/widget/OtcOrderItem/OtcOrderDetails/Controls.js.map +1 -1
  28. package/dist/components/widget/TradeOverview/CancelButtonWithDrawer.d.ts +7 -0
  29. package/dist/components/widget/TradeOverview/CancelButtonWithDrawer.d.ts.map +1 -0
  30. package/dist/components/widget/TradeOverview/CancelButtonWithDrawer.js +84 -0
  31. package/dist/components/widget/TradeOverview/CancelButtonWithDrawer.js.map +1 -0
  32. package/dist/components/widget/TradeOverview/CancelOrder/ConfirmCancel.d.ts +12 -0
  33. package/dist/components/widget/TradeOverview/CancelOrder/ConfirmCancel.d.ts.map +1 -0
  34. package/dist/components/widget/TradeOverview/CancelOrder/ConfirmCancel.js +227 -0
  35. package/dist/components/widget/TradeOverview/CancelOrder/ConfirmCancel.js.map +1 -0
  36. package/dist/components/widget/TradeOverview/CancelOrder/constants.d.ts +8 -0
  37. package/dist/components/widget/TradeOverview/CancelOrder/constants.d.ts.map +1 -0
  38. package/dist/components/widget/TradeOverview/CancelOrder/constants.js +20 -0
  39. package/dist/components/widget/TradeOverview/CancelOrder/constants.js.map +1 -0
  40. package/dist/components/widget/TradeOverview/CancelOrder/utils.d.ts +12 -0
  41. package/dist/components/widget/TradeOverview/CancelOrder/utils.d.ts.map +1 -0
  42. package/dist/components/widget/TradeOverview/CancelOrder/utils.js +49 -0
  43. package/dist/components/widget/TradeOverview/CancelOrder/utils.js.map +1 -0
  44. package/dist/components/widget/TradeOverview/MarketSwapTradeOverview.d.ts +2 -2
  45. package/dist/components/widget/TradeOverview/MarketSwapTradeOverview.d.ts.map +1 -1
  46. package/dist/components/widget/TradeOverview/MarketSwapTradeOverview.js +38 -28
  47. package/dist/components/widget/TradeOverview/MarketSwapTradeOverview.js.map +1 -1
  48. package/dist/components/widget/TradeOverview/TradeComplete/TradeCompleteFooter.d.ts.map +1 -1
  49. package/dist/components/widget/TradeOverview/TradeComplete/TradeCompleteFooter.js +16 -18
  50. package/dist/components/widget/TradeOverview/TradeComplete/TradeCompleteFooter.js.map +1 -1
  51. package/dist/components/widget/TradeOverview/TradeComplete/TradeCompleteHeader.d.ts +2 -1
  52. package/dist/components/widget/TradeOverview/TradeComplete/TradeCompleteHeader.d.ts.map +1 -1
  53. package/dist/components/widget/TradeOverview/TradeComplete/TradeCompleteHeader.js +78 -64
  54. package/dist/components/widget/TradeOverview/TradeComplete/TradeCompleteHeader.js.map +1 -1
  55. package/dist/components/widget/TradeOverview/TradeComplete/index.d.ts.map +1 -1
  56. package/dist/components/widget/TradeOverview/TradeComplete/index.js +21 -14
  57. package/dist/components/widget/TradeOverview/TradeComplete/index.js.map +1 -1
  58. package/dist/components/widget/TradeOverview/TradeError/TradeErrorDetails.d.ts +2 -1
  59. package/dist/components/widget/TradeOverview/TradeError/TradeErrorDetails.d.ts.map +1 -1
  60. package/dist/components/widget/TradeOverview/TradeError/TradeErrorDetails.js +66 -24
  61. package/dist/components/widget/TradeOverview/TradeError/TradeErrorDetails.js.map +1 -1
  62. package/dist/components/widget/TradeOverview/TradeError/index.d.ts.map +1 -1
  63. package/dist/components/widget/TradeOverview/TradeError/index.js +11 -7
  64. package/dist/components/widget/TradeOverview/TradeError/index.js.map +1 -1
  65. package/dist/components/widget/TradeOverview/TradeError/utils.d.ts +4 -1
  66. package/dist/components/widget/TradeOverview/TradeError/utils.d.ts.map +1 -1
  67. package/dist/components/widget/TradeOverview/TradeError/utils.js +20 -2
  68. package/dist/components/widget/TradeOverview/TradeError/utils.js.map +1 -1
  69. package/dist/components/widget/TradeOverview/TradeOverview.d.ts +5 -4
  70. package/dist/components/widget/TradeOverview/TradeOverview.d.ts.map +1 -1
  71. package/dist/components/widget/TradeOverview/TradeOverview.js.map +1 -1
  72. package/dist/components/widget/TradeOverview/TradeOverviewFooter.d.ts.map +1 -1
  73. package/dist/components/widget/TradeOverview/TradeOverviewFooter.js +15 -21
  74. package/dist/components/widget/TradeOverview/TradeOverviewFooter.js.map +1 -1
  75. package/dist/components/widget/TradeOverview/steps.d.ts +4 -0
  76. package/dist/components/widget/TradeOverview/steps.d.ts.map +1 -1
  77. package/dist/components/widget/TradeOverview/steps.js.map +1 -1
  78. package/dist/components/widget/TradeOverview/tradeFlowContext.d.ts +22 -5
  79. package/dist/components/widget/TradeOverview/tradeFlowContext.d.ts.map +1 -1
  80. package/dist/components/widget/TradeOverview/tradeFlowContext.js +37 -11
  81. package/dist/components/widget/TradeOverview/tradeFlowContext.js.map +1 -1
  82. package/dist/components/widget/TransactionDetails/LimitOrderDetails/Controls.d.ts +4 -1
  83. package/dist/components/widget/TransactionDetails/LimitOrderDetails/Controls.d.ts.map +1 -1
  84. package/dist/components/widget/TransactionDetails/LimitOrderDetails/Controls.js +133 -31
  85. package/dist/components/widget/TransactionDetails/LimitOrderDetails/Controls.js.map +1 -1
  86. package/dist/components/widget/TransactionDetails/LimitOrderDetails/TransactionDetails.d.ts +7 -2
  87. package/dist/components/widget/TransactionDetails/LimitOrderDetails/TransactionDetails.d.ts.map +1 -1
  88. package/dist/components/widget/TransactionDetails/LimitOrderDetails/TransactionDetails.js +18 -14
  89. package/dist/components/widget/TransactionDetails/LimitOrderDetails/TransactionDetails.js.map +1 -1
  90. package/dist/components/widget/TransactionDetails/TransactionListItem.d.ts.map +1 -1
  91. package/dist/components/widget/TransactionDetails/TransactionListItem.js +1 -1
  92. package/dist/components/widget/TransactionDetails/TransactionListItem.js.map +1 -1
  93. package/dist/configurator/Configurator.d.ts.map +1 -1
  94. package/dist/core/Updaters.d.ts.map +1 -1
  95. package/dist/core/Updaters.js +2 -0
  96. package/dist/core/Updaters.js.map +1 -1
  97. package/dist/core/state/widgetEventsAtom.d.ts.map +1 -1
  98. package/dist/core/state/widgetEventsAtom.js +51 -37
  99. package/dist/core/state/widgetEventsAtom.js.map +1 -1
  100. package/dist/events/types/{cancel.d.ts → cancelOrder.d.ts} +5 -2
  101. package/dist/events/types/cancelOrder.d.ts.map +1 -0
  102. package/dist/events/types/cancelTx.d.ts +35 -0
  103. package/dist/events/types/cancelTx.d.ts.map +1 -0
  104. package/dist/events/types/index.d.ts +5 -2
  105. package/dist/events/types/index.d.ts.map +1 -1
  106. package/dist/events/types/swap.d.ts +11 -1
  107. package/dist/events/types/swap.d.ts.map +1 -1
  108. package/dist/hooks/connectors/useIsConnectedSafe.js +1 -0
  109. package/dist/hooks/connectors/useIsConnectedSafe.js.map +1 -1
  110. package/dist/hooks/getCode/useIsAccountContract.js.map +1 -1
  111. package/dist/hooks/otc/mutations/useCancelLimitOrder.d.ts +20 -2
  112. package/dist/hooks/otc/mutations/useCancelLimitOrder.d.ts.map +1 -1
  113. package/dist/hooks/otc/mutations/useCancelLimitOrder.js +197 -74
  114. package/dist/hooks/otc/mutations/useCancelLimitOrder.js.map +1 -1
  115. package/dist/hooks/otc/tradeFlow/useFillOtcOrderFlow.d.ts.map +1 -1
  116. package/dist/hooks/otc/tradeFlow/useFillOtcOrderFlow.js +0 -1
  117. package/dist/hooks/otc/tradeFlow/useFillOtcOrderFlow.js.map +1 -1
  118. package/dist/hooks/otc/tradeFlow/useOtcOrderFlow.d.ts +6 -1
  119. package/dist/hooks/otc/tradeFlow/useOtcOrderFlow.d.ts.map +1 -1
  120. package/dist/hooks/otc/tradeFlow/useOtcOrderFlow.js +37 -24
  121. package/dist/hooks/otc/tradeFlow/useOtcOrderFlow.js.map +1 -1
  122. package/dist/hooks/otc/tradeFlow/useOtcOrderStep.d.ts +2 -2
  123. package/dist/hooks/otc/tradeFlow/useOtcOrderStep.d.ts.map +1 -1
  124. package/dist/hooks/otc/tradeFlow/useOtcOrderStep.js +28 -42
  125. package/dist/hooks/otc/tradeFlow/useOtcOrderStep.js.map +1 -1
  126. package/dist/hooks/swap/prices/delta/mutations/useCancelDeltaOrdersEvents.d.ts +6 -1
  127. package/dist/hooks/swap/prices/delta/mutations/useCancelDeltaOrdersEvents.d.ts.map +1 -1
  128. package/dist/hooks/swap/prices/delta/mutations/useCancelDeltaOrdersEvents.js +16 -0
  129. package/dist/hooks/swap/prices/delta/mutations/useCancelDeltaOrdersEvents.js.map +1 -1
  130. package/dist/hooks/swap/prices/delta/mutations/useCancelOrWithdrawAndCancelDeltaOrder.d.ts +10 -4
  131. package/dist/hooks/swap/prices/delta/mutations/useCancelOrWithdrawAndCancelDeltaOrder.d.ts.map +1 -1
  132. package/dist/hooks/swap/prices/delta/mutations/useCancelOrWithdrawAndCancelDeltaOrder.js +176 -145
  133. package/dist/hooks/swap/prices/delta/mutations/useCancelOrWithdrawAndCancelDeltaOrder.js.map +1 -1
  134. package/dist/hooks/swap/prices/delta/mutations/useIsDeltaOrderCancellable.d.ts +11 -0
  135. package/dist/hooks/swap/prices/delta/mutations/useIsDeltaOrderCancellable.d.ts.map +1 -0
  136. package/dist/hooks/swap/prices/delta/mutations/useIsDeltaOrderCancellable.js +69 -0
  137. package/dist/hooks/swap/prices/delta/mutations/useIsDeltaOrderCancellable.js.map +1 -0
  138. package/dist/hooks/swap/prices/delta/mutations/useWithdrawAndCancelDeltaOrder.d.ts +2 -2
  139. package/dist/hooks/swap/prices/delta/mutations/useWithdrawAndCancelDeltaOrder.d.ts.map +1 -1
  140. package/dist/hooks/swap/prices/delta/mutations/useWithdrawAndCancelDeltaOrder.js +24 -28
  141. package/dist/hooks/swap/prices/delta/mutations/useWithdrawAndCancelDeltaOrder.js.map +1 -1
  142. package/dist/hooks/swap/prices/market/mutations/useSendMarketSwapTx.d.ts +6 -2
  143. package/dist/hooks/swap/prices/market/mutations/useSendMarketSwapTx.d.ts.map +1 -1
  144. package/dist/hooks/swap/prices/market/mutations/useSendMarketSwapTx.js +8 -2
  145. package/dist/hooks/swap/prices/market/mutations/useSendMarketSwapTx.js.map +1 -1
  146. package/dist/hooks/swap/tradeFlow/common/errors.d.ts +6 -0
  147. package/dist/hooks/swap/tradeFlow/common/errors.d.ts.map +1 -1
  148. package/dist/hooks/swap/tradeFlow/common/errors.js +15 -1
  149. package/dist/hooks/swap/tradeFlow/common/errors.js.map +1 -1
  150. package/dist/hooks/swap/tradeFlow/useDeltaFlow.d.ts +6 -1
  151. package/dist/hooks/swap/tradeFlow/useDeltaFlow.d.ts.map +1 -1
  152. package/dist/hooks/swap/tradeFlow/useDeltaFlow.js +55 -19
  153. package/dist/hooks/swap/tradeFlow/useDeltaFlow.js.map +1 -1
  154. package/dist/hooks/swap/tradeFlow/useDeltaSwapStep.d.ts +2 -2
  155. package/dist/hooks/swap/tradeFlow/useDeltaSwapStep.d.ts.map +1 -1
  156. package/dist/hooks/swap/tradeFlow/useDeltaSwapStep.js +45 -57
  157. package/dist/hooks/swap/tradeFlow/useDeltaSwapStep.js.map +1 -1
  158. package/dist/hooks/swap/tradeFlow/useLimitOrderFlow.d.ts +6 -1
  159. package/dist/hooks/swap/tradeFlow/useLimitOrderFlow.d.ts.map +1 -1
  160. package/dist/hooks/swap/tradeFlow/useLimitOrderFlow.js +26 -5
  161. package/dist/hooks/swap/tradeFlow/useLimitOrderFlow.js.map +1 -1
  162. package/dist/hooks/swap/tradeFlow/useLimitOrderStep.d.ts +4 -4
  163. package/dist/hooks/swap/tradeFlow/useLimitOrderStep.d.ts.map +1 -1
  164. package/dist/hooks/swap/tradeFlow/useLimitOrderStep.js +23 -37
  165. package/dist/hooks/swap/tradeFlow/useLimitOrderStep.js.map +1 -1
  166. package/dist/hooks/swap/tradeFlow/useMarketFlow.d.ts +13 -1
  167. package/dist/hooks/swap/tradeFlow/useMarketFlow.d.ts.map +1 -1
  168. package/dist/hooks/swap/tradeFlow/useMarketFlow.js +93 -26
  169. package/dist/hooks/swap/tradeFlow/useMarketFlow.js.map +1 -1
  170. package/dist/hooks/swap/tradeFlow/useMarketSwapStep.d.ts +7 -1
  171. package/dist/hooks/swap/tradeFlow/useMarketSwapStep.d.ts.map +1 -1
  172. package/dist/hooks/swap/tradeFlow/useMarketSwapStep.js +59 -42
  173. package/dist/hooks/swap/tradeFlow/useMarketSwapStep.js.map +1 -1
  174. package/dist/hooks/txs/mutations/useReplaceTx.d.ts +86 -0
  175. package/dist/hooks/txs/mutations/useReplaceTx.d.ts.map +1 -0
  176. package/dist/hooks/txs/mutations/useReplaceTx.js +514 -0
  177. package/dist/hooks/txs/mutations/useReplaceTx.js.map +1 -0
  178. package/dist/hooks/txs/mutations/useSendTx.d.ts +7 -2
  179. package/dist/hooks/txs/mutations/useSendTx.d.ts.map +1 -1
  180. package/dist/hooks/txs/mutations/useSendTx.js.map +1 -1
  181. package/dist/hooks/txs/queries/useAccountNonce.d.ts +9 -0
  182. package/dist/hooks/txs/queries/useAccountNonce.d.ts.map +1 -0
  183. package/dist/hooks/txs/queries/useAccountNonce.js +31 -0
  184. package/dist/hooks/txs/queries/useAccountNonce.js.map +1 -0
  185. package/dist/hooks/txs/queries/useTxFees.d.ts +16 -0
  186. package/dist/hooks/txs/queries/useTxFees.d.ts.map +1 -0
  187. package/dist/hooks/txs/queries/useTxFees.js +103 -0
  188. package/dist/hooks/txs/queries/useTxFees.js.map +1 -0
  189. package/dist/hooks/txs/queries/useTxHistory.d.ts.map +1 -1
  190. package/dist/hooks/txs/queries/useTxHistory.js +3 -2
  191. package/dist/hooks/txs/queries/useTxHistory.js.map +1 -1
  192. package/dist/hooks/txs/queries/useTxResponse.d.ts +2390 -0
  193. package/dist/hooks/txs/queries/useTxResponse.d.ts.map +1 -0
  194. package/dist/hooks/txs/queries/useTxResponse.js +75 -0
  195. package/dist/hooks/txs/queries/useTxResponse.js.map +1 -0
  196. package/dist/hooks/txs/queries/useWalletCanReplaceTx.d.ts +2 -0
  197. package/dist/hooks/txs/queries/useWalletCanReplaceTx.d.ts.map +1 -0
  198. package/dist/hooks/txs/queries/useWalletCanReplaceTx.js +30 -0
  199. package/dist/hooks/txs/queries/useWalletCanReplaceTx.js.map +1 -0
  200. package/dist/index.d.ts +1 -1
  201. package/dist/index.d.ts.map +1 -1
  202. package/dist/styles.css +3 -0
  203. package/dist/transactions/queries/ensureEstimateFeesPerGas.d.ts +16 -0
  204. package/dist/transactions/queries/ensureEstimateFeesPerGas.d.ts.map +1 -0
  205. package/dist/transactions/queries/ensureEstimateFeesPerGas.js +23 -0
  206. package/dist/transactions/queries/ensureEstimateFeesPerGas.js.map +1 -0
  207. package/dist/transactions/queries/ensureTxReceipt.d.ts.map +1 -1
  208. package/dist/transactions/queries/ensureTxReceipt.js +1 -1
  209. package/dist/transactions/queries/ensureTxReceipt.js.map +1 -1
  210. package/dist/transactions/queries/ensureTxResponse.d.ts +17 -0
  211. package/dist/transactions/queries/ensureTxResponse.d.ts.map +1 -0
  212. package/dist/transactions/queries/ensureTxResponse.js +23 -0
  213. package/dist/transactions/queries/ensureTxResponse.js.map +1 -0
  214. package/dist/transactions/state/hooks/useMarkTxAsDropped.d.ts +7 -0
  215. package/dist/transactions/state/hooks/useMarkTxAsDropped.d.ts.map +1 -0
  216. package/dist/transactions/state/hooks/useMarkTxAsDropped.js +10 -0
  217. package/dist/transactions/state/hooks/useMarkTxAsDropped.js.map +1 -0
  218. package/dist/transactions/state/transactionsActionAtom.d.ts +12 -0
  219. package/dist/transactions/state/transactionsActionAtom.d.ts.map +1 -1
  220. package/dist/transactions/state/transactionsActionAtom.js +40 -1
  221. package/dist/transactions/state/transactionsActionAtom.js.map +1 -1
  222. package/dist/transactions/status.d.ts +1 -1
  223. package/dist/transactions/status.d.ts.map +1 -1
  224. package/dist/transactions/status.js +6 -0
  225. package/dist/transactions/status.js.map +1 -1
  226. package/dist/transactions/types.d.ts +15 -2
  227. package/dist/transactions/types.d.ts.map +1 -1
  228. package/package.json +2 -2
  229. package/dist/events/types/cancel.d.ts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTxResponse.d.ts","sourceRoot":"","sources":["../../../../src/hooks/txs/queries/useTxResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAD5oW"}
@@ -0,0 +1,75 @@
1
+ import { d as distExports } from '../../../_virtual/index.js';
2
+ import { ensureTxResponseFactory } from '../../../transactions/queries/ensureTxResponse.js';
3
+ import { useQueryClient } from '@tanstack/react-query';
4
+ import { useTransaction, useConfig } from 'wagmi';
5
+
6
+ function useEnsureTxResponse() {
7
+ const $ = distExports.c(3);
8
+ const queryClient = useQueryClient();
9
+ const wagmiConfig = useConfig();
10
+ let t0;
11
+ if ($[0] !== queryClient || $[1] !== wagmiConfig) {
12
+ t0 = ensureTxResponseFactory({
13
+ queryClient,
14
+ wagmiConfig
15
+ });
16
+ $[0] = queryClient;
17
+ $[1] = wagmiConfig;
18
+ $[2] = t0;
19
+ } else {
20
+ t0 = $[2];
21
+ }
22
+ return t0;
23
+ }
24
+ function useTxResponse(t0) {
25
+ const $ = distExports.c(9);
26
+ const {
27
+ hash,
28
+ chainId,
29
+ enabled: t1
30
+ } = t0;
31
+ const enabled = t1 === void 0 ? true : t1;
32
+ const ensureTxResponse = useEnsureTxResponse();
33
+ const t2 = !!hash && enabled;
34
+ let t3;
35
+ if ($[0] !== t2) {
36
+ t3 = {
37
+ enabled: t2
38
+ };
39
+ $[0] = t2;
40
+ $[1] = t3;
41
+ } else {
42
+ t3 = $[1];
43
+ }
44
+ let t4;
45
+ if ($[2] !== chainId || $[3] !== hash || $[4] !== t3) {
46
+ t4 = {
47
+ hash,
48
+ chainId,
49
+ query: t3
50
+ };
51
+ $[2] = chainId;
52
+ $[3] = hash;
53
+ $[4] = t3;
54
+ $[5] = t4;
55
+ } else {
56
+ t4 = $[5];
57
+ }
58
+ const txResponseQuery = useTransaction(t4);
59
+ let t5;
60
+ if ($[6] !== ensureTxResponse || $[7] !== txResponseQuery) {
61
+ t5 = {
62
+ query: txResponseQuery,
63
+ ensureTxResponse
64
+ };
65
+ $[6] = ensureTxResponse;
66
+ $[7] = txResponseQuery;
67
+ $[8] = t5;
68
+ } else {
69
+ t5 = $[8];
70
+ }
71
+ return t5;
72
+ }
73
+
74
+ export { useEnsureTxResponse, useTxResponse };
75
+ //# sourceMappingURL=useTxResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTxResponse.js","sources":["../../../../src/hooks/txs/queries/useTxResponse.ts"],"sourcesContent":["import type { SupportedChainId } from \"@/lib/web3/wagmi/types\";\nimport {\n ensureTxResponseFactory,\n type EnsureTxResponseFn,\n} from \"@/transactions/queries/ensureTxResponse\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport type { Hash } from \"viem\";\nimport { useConfig, useTransaction } from \"wagmi\";\n\nexport function useEnsureTxResponse(): EnsureTxResponseFn {\n const queryClient = useQueryClient();\n const wagmiConfig = useConfig();\n\n return ensureTxResponseFactory({ queryClient, wagmiConfig });\n}\n\ntype UseTxResponseInput = {\n hash?: Hash;\n chainId?: SupportedChainId;\n enabled?: boolean;\n};\n\nexport function useTxResponse({\n hash,\n chainId,\n enabled = true,\n}: UseTxResponseInput) {\n const ensureTxResponse = useEnsureTxResponse();\n\n const txResponseQuery = useTransaction({\n hash,\n chainId,\n query: { enabled: !!hash && enabled },\n });\n\n return {\n query: txResponseQuery,\n ensureTxResponse,\n };\n}\n"],"names":["useEnsureTxResponse","$","_c","queryClient","useQueryClient","wagmiConfig","useConfig","t0","ensureTxResponseFactory","useTxResponse","hash","chainId","enabled","t1","undefined","ensureTxResponse","t2","t3","t4","query","txResponseQuery","useTransaction","t5"],"mappings":";;;;;AASO,SAAAA,mBAAAA,GAAA;AAAA,EAAA,MAAAC,CAAAA,GAAAC,cAAA,CAAA,CAAA;AACL,EAAA,MAAAC,cAAoBC,cAAAA,EAAe;AACnC,EAAA,MAAAC,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A,KAAAU,OAAAA,IAAAV,CAAAA,QAAAS,IAAAA,IAAAT,CAAAA,CAAA,CAAA,CAAA,KAAAgB,EAAAA,EAAA;AAHAC,IAAAA,EAAAA,GAAA;AAAA,MAAAR,IAAAA;AAAAA,MAAAC,OAAAA;AAAAA,MAAAQ,KAAAA,EAG9BF;AAAAA,KACT;AAAChB,IAAAA,CAAAA,MAAAU,OAAAA;AAAAV,IAAAA,CAAAA,MAAAS,IAAAA;AAAAT,IAAAA,CAAAA,MAAAgB,EAAAA;AAAAhB,IAAAA,CAAAA,MAAAiB,EAAAA;AAAAA,EAAA,CAAA,MAAA;AAAAA,IAAAA,EAAAA,GAAAjB,EAAA,CAAA,CAAA;AAAA,EAAA;AAJD,EAAA,MAAAmB,eAAAA,GAAwBC,eAAeH,EAItC,CAAA;AAAE,EAAA,IAAAI,EAAAA;AAAA,EAAA,IAAArB,EAAA,CAAA,CAAA,KAAAc,oBAAAd,CAAAA,QAAAmB,eAAAA,EAAA;AAEIE,IAAAA,EAAAA,GAAA;AAAA,MAAAH,KAAAA,EACEC,eAAAA;AAAAA,MAAeL;AAAAA,KAExB;AAACd,IAAAA,CAAAA,MAAAc,gBAAAA;AAAAd,IAAAA,CAAAA,MAAAmB,eAAAA;AAAAnB,IAAAA,CAAAA,MAAAqB,EAAAA;AAAAA,EAAA,CAAA,MAAA;AAAAA,IAAAA,EAAAA,GAAArB,EAAA,CAAA,CAAA;AAAA,EAAA;AAAA,EAAA,OAHMqB,EAAAA;AAGN;;;;"}
@@ -0,0 +1,2 @@
1
+ export declare function useWalletCanReplaceTx(): boolean;
2
+ //# sourceMappingURL=useWalletCanReplaceTx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWalletCanReplaceTx.d.ts","sourceRoot":"","sources":["../../../../src/hooks/txs/queries/useWalletCanReplaceTx.ts"],"names":[],"mappings":"AAsBA,wBAAgB,qBAAqB,IAAI,OAAO,CAqB/C"}
@@ -0,0 +1,30 @@
1
+ import { d as distExports } from '../../../_virtual/index.js';
2
+ import { useAccount } from 'wagmi';
3
+ import { useWalletMetadata } from '../../../components/web3/ConnectWallets/walletIcons.js';
4
+ import { useIsAccountContract } from '../../getCode/useIsAccountContract.js';
5
+
6
+ const SUPPORTED_WALLETS_REGEX = /Rabby|Ledger Wallet/i;
7
+ function useWalletCanReplaceTx() {
8
+ const $ = distExports.c(2);
9
+ const {
10
+ connector
11
+ } = useAccount();
12
+ const walletMetadata = useWalletMetadata(connector);
13
+ const {
14
+ data: accountContractData
15
+ } = useIsAccountContract();
16
+ let t0;
17
+ if ($[0] !== walletMetadata) {
18
+ t0 = !!walletMetadata?.name && !SUPPORTED_WALLETS_REGEX.test(walletMetadata.name);
19
+ $[0] = walletMetadata;
20
+ $[1] = t0;
21
+ } else {
22
+ t0 = $[1];
23
+ }
24
+ const isKnownUnsupportedWallet = t0;
25
+ const isSmartContract = accountContractData?.isContract ?? false;
26
+ return !!connector && !!walletMetadata && !isKnownUnsupportedWallet && !isSmartContract;
27
+ }
28
+
29
+ export { useWalletCanReplaceTx };
30
+ //# sourceMappingURL=useWalletCanReplaceTx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWalletCanReplaceTx.js","sources":["../../../../src/hooks/txs/queries/useWalletCanReplaceTx.ts"],"sourcesContent":["import { useAccount } from \"wagmi\";\nimport { useWalletMetadata } from \"@/components/web3/ConnectWallets/walletIcons\";\nimport { useIsAccountContract } from \"@/hooks/getCode/useIsAccountContract\";\n/**\n * Some of the tested wallets:\n *\n * | Wallet | Test result | Supports | metadata.name |\n * | ------------- | -------------------------------------------------------------------------------------------------------- | -------- | ------------- |\n * | Rabby | Works, but ignores gasPrice params | ✓ | Rabby Wallet |\n * | MetaMask | nonce is ignored, gasPrice params accepted | ✗ | MetaMask |\n * | TrustWallet | ignores nonce, uses its internal nonce, ignores gasPrice params | ✗ | Trust Wallet |\n * | BitGet Wallet | ignores gasPrice params, accepts nonce, but doesn't allow to submit tx with same nonce to replace | ✗ | Bitget Wallet |\n * | Rainbow | ignores nonce, uses its internal nonce, ignores gasPrice params | ✗ | Rainbow |\n * | Phantom | accepts nonce, but doesn't allow to submit tx with same nonce to replace, ignores gasPrice params | ✗ | Phantom |\n * | Enkrypt | ignores nonce, uses its internal nonce, ignores gasPrice params | ✗ | Enkrypt |\n * | Ledger Live | ignores nonce, uses its internal nonce, ignores gasPrice params | ✗ | Ledger Live |\n * | Ledger Button | supports nonce, should take all params as is | ✓ | Ledger Wallet |\n *\n */\n\nconst SUPPORTED_WALLETS_REGEX = /Rabby|Ledger Wallet/i; // wallets known to support replaceTx nonce override\n\nexport function useWalletCanReplaceTx(): boolean {\n const { connector } = useAccount();\n const walletMetadata = useWalletMetadata(connector);\n const { data: accountContractData } = useIsAccountContract();\n\n // 1. Check if Wallet is Metamask (injected wallet or through WalletConnect)\n // Metamask ignores txParams.nonce and doesn't allow replacing txs\n const isKnownUnsupportedWallet =\n !!walletMetadata?.name &&\n !SUPPORTED_WALLETS_REGEX.test(walletMetadata.name);\n\n // 2. Check if user account is a SmartContract\n // SmartContracts have their own logic for replacing pending txs (if any)\n const isSmartContract = accountContractData?.isContract ?? false;\n\n return (\n !!connector &&\n !!walletMetadata &&\n !isKnownUnsupportedWallet &&\n !isSmartContract\n );\n}\n"],"names":["SUPPORTED_WALLETS_REGEX","useWalletCanReplaceTx","$","_c","connector","useAccount","walletMetadata","useWalletMetadata","data","accountContractData","useIsAccountContract","t0","name","test","isKnownUnsupportedWallet","isSmartContract","isContract"],"mappings":";;;;;AAoBA,MAAMA,uBAAAA,GAA0B,sBAAA;AAEzB,SAAAC,qBAAAA,GAAA;AAAA,EAAA,MAAAC,CAAAA,GAAAC,cAAA,CAAA,CAAA;AACL,EAAA,MAAA;AAAA,IAAAC;AAAAA,MAAsBC,UAAAA,EAAW;AACjC,EAAA,MAAAC,cAAAA,GAAuBC,kBAAkBH,SAAS,CAAA;AAClD,EAAA,MAAA;AAAA,IAAAI,IAAAA,EAAAC;AAAAA,MAAsCC,oBAAAA,EAAqB;AAAE,EAAA,IAAAC,EAAAA;AAAA,EAAA,IAAAT,CAAAA,QAAAI,cAAAA,EAAA;AAK3DK,IAAAA,EAAAA,GAAA,CAAC,CAACL,cAAAA,EAAcM,IAAAA,IAAhB,CACCZ,uBAAAA,CAAuBa,IAAAA,CAAMP,eAAcM,IAAK,CAAA;AAACV,IAAAA,CAAAA,MAAAI,cAAAA;AAAAJ,IAAAA,CAAAA,MAAAS,EAAAA;AAAAA,EAAA,CAAA,MAAA;AAAAA,IAAAA,EAAAA,GAAAT,EAAA,CAAA,CAAA;AAAA,EAAA;AAFpD,EAAA,MAAAY,wBAAAA,GACEH,EAAAA;AAKF,EAAA,MAAAI,eAAAA,GAAwBN,qBAAmBO,UAAAA,IAAnB,KAAA;AAAyC,EAAA,OAG/D,CAAC,CAACZ,SAAAA,IAAF,CACC,CAACE,cAAAA,IADF,CAECQ,4BAFD,CAGCC,eAAAA;AAAe;;;;"}
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export type { SupportedChainId } from './lib/web3/wagmi/types';
4
4
  export type { SwapMode } from './components/widget/SwapModeSwitcher/state/types';
5
5
  export type { MinTradeFlowToken } from './components/widget/TradeOverview';
6
6
  export type { LimitOrderFormState, OTCOrderFormState, SwapFormState, SettingsState, TokenFormState, WidgetState, AccountState, } from './events/types/common';
7
- export type { WidgetEventCallbacks, OnConnectWallet, OnAllowToken, OnWrapETH, OnSwap, OnLimitOrder, OnOTCOrder, OnSettingsChange, OnCancelOrder, OnFillOTCOrder, OnFormInputChange, OnPriceChange, } from './events/types';
7
+ export type { WidgetEventCallbacks, OnConnectWallet, OnAllowToken, OnWrapETH, OnSwap, OnLimitOrder, OnOTCOrder, OnSettingsChange, OnCancelOrder, OnCancelTx, OnFillOTCOrder, OnFormInputChange, OnPriceChange, } from './events/types';
8
8
  export type { FormInputProps } from './core/inputs/state/types';
9
9
  export type { TradeMode } from './core/state/tradeModeAtom';
10
10
  export { defaults } from './core/constants';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,YAAY,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EACX,cAAc,EACd,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,YAAY,EAAE,QAAQ,EAAE,MAAM,kDAAkD,CAAC;AACjF,YAAY,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,WAAW,EACX,YAAY,GACb,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,SAAS,EACT,MAAM,EACN,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,YAAY,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAG5D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,YAAY,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EACX,cAAc,EACd,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,YAAY,EAAE,QAAQ,EAAE,MAAM,kDAAkD,CAAC;AACjF,YAAY,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,WAAW,EACX,YAAY,GACb,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,SAAS,EACT,MAAM,EACN,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,YAAY,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAG5D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/styles.css CHANGED
@@ -1112,6 +1112,9 @@
1112
1112
  .velora-widget.velora-widget .gap-6 {
1113
1113
  gap: calc(var(--spacing) * 6);
1114
1114
  }
1115
+ .velora-widget.velora-widget .gap-7 {
1116
+ gap: calc(var(--spacing) * 7);
1117
+ }
1115
1118
  .velora-widget.velora-widget .gap-10 {
1116
1119
  gap: calc(var(--spacing) * 10);
1117
1120
  }
@@ -0,0 +1,16 @@
1
+ import { wagmiConfig as _wagmiConfig } from '../../lib/web3/wagmi/config';
2
+ import { QueryClient } from '@tanstack/react-query';
3
+ import { FeeValuesType } from 'viem';
4
+ import { SupportedChainId } from '../../lib/web3/wagmi/types';
5
+ import { EstimateFeesPerGasReturnType } from '@wagmi/core';
6
+ export type EstimateFeesPerGasFn = (options: {
7
+ chainId: SupportedChainId;
8
+ type?: FeeValuesType;
9
+ }) => Promise<EstimateFeesPerGasReturnType>;
10
+ type EstimateFeesPerGasFactory = (params?: {
11
+ queryClient?: QueryClient;
12
+ wagmiConfig?: typeof _wagmiConfig;
13
+ }) => EstimateFeesPerGasFn;
14
+ export declare const estimateFeesPerGasFactory: EstimateFeesPerGasFactory;
15
+ export {};
16
+ //# sourceMappingURL=ensureEstimateFeesPerGas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureEstimateFeesPerGas.d.ts","sourceRoot":"","sources":["../../../src/transactions/queries/ensureEstimateFeesPerGas.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,MAAM,CAAC;AAG1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE;IAC3C,OAAO,EAAE,gBAAgB,CAAC;IAC1B,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB,KAAK,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAE5C,KAAK,yBAAyB,GAAG,CAAC,MAAM,CAAC,EAAE;IACzC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,YAAY,CAAC;CACnC,KAAK,oBAAoB,CAAC;AAE3B,eAAO,MAAM,yBAAyB,EAAE,yBAarC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { queryClient } from '../../lib/queryClient.js';
2
+ import { wagmiConfig } from '../../lib/web3/wagmi/config.js';
3
+ import 'viem';
4
+ import { estimateFeesPerGasQueryOptions } from 'wagmi/query';
5
+
6
+ const estimateFeesPerGasFactory = (options = {}) => async ({
7
+ chainId,
8
+ type = "eip1559"
9
+ }) => {
10
+ const {
11
+ queryClient: queryClient$1 = queryClient,
12
+ wagmiConfig: wagmiConfig$1 = wagmiConfig
13
+ } = options;
14
+ const queryOptions = estimateFeesPerGasQueryOptions(wagmiConfig$1, {
15
+ chainId,
16
+ type
17
+ });
18
+ const gasFeeResponse = await queryClient$1.ensureQueryData(queryOptions);
19
+ return gasFeeResponse;
20
+ };
21
+
22
+ export { estimateFeesPerGasFactory };
23
+ //# sourceMappingURL=ensureEstimateFeesPerGas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureEstimateFeesPerGas.js","sources":["../../../src/transactions/queries/ensureEstimateFeesPerGas.ts"],"sourcesContent":["import { queryClient as _queryClient } from \"@/lib/queryClient\";\nimport { wagmiConfig as _wagmiConfig } from \"@/lib/web3/wagmi/config\";\nimport type { QueryClient } from \"@tanstack/react-query\";\n\nimport { type FeeValuesType } from \"viem\";\n\nimport { estimateFeesPerGasQueryOptions } from \"wagmi/query\";\nimport type { SupportedChainId } from \"@/lib/web3/wagmi/types\";\nimport type { EstimateFeesPerGasReturnType } from \"@wagmi/core\";\n\nexport type EstimateFeesPerGasFn = (options: {\n chainId: SupportedChainId;\n type?: FeeValuesType;\n}) => Promise<EstimateFeesPerGasReturnType>;\n\ntype EstimateFeesPerGasFactory = (params?: {\n queryClient?: QueryClient;\n wagmiConfig?: typeof _wagmiConfig;\n}) => EstimateFeesPerGasFn;\n\nexport const estimateFeesPerGasFactory: EstimateFeesPerGasFactory =\n (options = {}) =>\n async ({ chainId, type = \"eip1559\" }) => {\n const { queryClient = _queryClient, wagmiConfig = _wagmiConfig } = options;\n\n const queryOptions = estimateFeesPerGasQueryOptions(wagmiConfig, {\n chainId,\n type,\n });\n\n const gasFeeResponse = await queryClient.ensureQueryData(queryOptions);\n\n return gasFeeResponse;\n };\n"],"names":["estimateFeesPerGasFactory","options","chainId","type","queryClient","_queryClient","wagmiConfig","_wagmiConfig","queryOptions","estimateFeesPerGasQueryOptions","gasFeeResponse","ensureQueryData"],"mappings":";;;;;AAoBO,MAAMA,yBAAAA,GACXA,CAACC,OAAAA,GAAU,OACX,OAAO;AAAA,EAAEC,OAAAA;AAAAA,EAASC,IAAAA,GAAO;AAAU,CAAA,KAAM;AACvC,EAAA,MAAM;AAAA,iBAAEC,aAAAA,GAAcC,WAAAA;AAAAA,iBAAcC,aAAAA,GAAcC;AAAAA,GAAa,GAAIN,OA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CAAC;AAIxB,eAAO,MAAM,sBAAsB,EAAE,sBAiHlC,CAAC"}
1
+ {"version":3,"file":"ensureTxReceipt.d.ts","sourceRoot":"","sources":["../../../src/transactions/queries/ensureTxReceipt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAI3E,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAU1C,KAAK,YAAY,GAAG,CAAC,IAAI,EAAE,qBAAqB,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;AAEjE,MAAM,MAAM,iBAAiB,GAAG,CAC9B,OAAO,EAAE,YAAY,CACnB,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,GAAG,eAAe,CAAC,EAChE,MAAM,GAAG,SAAS,CACnB,GAAG;IACF,UAAU,CAAC,EAAE,YAAY,CAAC;CAC3B,KACE,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEjC,KAAK,sBAAsB,GAAG,CAAC,MAAM,CAAC,EAAE;IACtC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,YAAY,CAAC;IAClC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,KAAK,iBAAiB,CAAC;AAIxB,eAAO,MAAM,sBAAsB,EAAE,sBAmHlC,CAAC"}
@@ -38,7 +38,7 @@ const ensureTxReceiptFactory = (options = {}) => async ({
38
38
  }
39
39
  const isConnectedToSafe = isWConnectConnectorWithSafe || isConnectedToSafeIframe;
40
40
  const isSafe = _isSafe || isConnectedToSafe;
41
- const timeout = isSafe ? SAFE_CALLS_WAIT_TIMEOUT : void 0;
41
+ const timeout = isSafe ? SAFE_CALLS_WAIT_TIMEOUT : SAFE_CALLS_WAIT_TIMEOUT / 2;
42
42
  let config = wagmiConfig$1;
43
43
  let realtxHash = hash;
44
44
  if (isConnectedToSafeIframe) {
@@ -1 +1 @@
1
- {"version":3,"file":"ensureTxReceipt.js","sources":["../../../src/transactions/queries/ensureTxReceipt.ts"],"sourcesContent":["import type { UseAwaitTxParameters } from \"@/hooks/txs/queries/useAwaitTx\";\nimport { queryClient as _queryClient } from \"@/lib/queryClient\";\nimport { wagmiConfig as _wagmiConfig } from \"@/lib/web3/wagmi/config\";\nimport type { QueryClient } from \"@tanstack/react-query\";\n\nimport { assert, type MarkRequired } from \"ts-essentials\";\nimport { type ReplacementReturnType, type TransactionReceipt } from \"viem\";\n\nimport { waitForTransactionReceiptQueryOptions } from \"wagmi/query\";\nimport { SAFE_CALLS_WAIT_TIMEOUT } from \"@/lib/constants\";\nimport { type Chain } from \"wagmi/chains\";\nimport { getAccount, getConnectorClient } from \"@wagmi/core\";\nimport {\n isConnectorWithSafeIframeProvider,\n isExternalConnectorSafeWalletConnect,\n} from \"@/components/web3/ConnectExternalProvider/utils\";\nimport { isWalletConnectConnectorWithSafe } from \"@/hooks/connectors/useIsSafeThroughWalletConnect\";\nimport { ensureCallsStatusFactory } from \"./ensureCallsStatus\";\nimport { createLogger } from \"@/lib/utils/logger\";\n\ntype OnReplacedCb = (data: ReplacementReturnType<Chain>) => void;\n\nexport type EnsureTxReceiptFn = (\n options: MarkRequired<\n Pick<UseAwaitTxParameters, \"hash\" | \"chainId\" | \"confirmations\">,\n \"hash\" | \"chainId\"\n > & {\n onReplaced?: OnReplacedCb;\n }\n) => Promise<TransactionReceipt>;\n\ntype EnsureTxReceiptFactory = (params?: {\n queryClient?: QueryClient;\n wagmiConfig?: typeof _wagmiConfig;\n isSafe?: boolean;\n}) => EnsureTxReceiptFn;\n\nconst logger = createLogger(\"Transactions:EnsureTxReceipt\");\n\nexport const ensureTxReceiptFactory: EnsureTxReceiptFactory =\n (options = {}) =>\n async ({ hash, chainId, confirmations, onReplaced }) => {\n const {\n queryClient = _queryClient,\n wagmiConfig = _wagmiConfig,\n isSafe: _isSafe,\n } = options;\n const { connector } = getAccount(wagmiConfig);\n let isWConnectConnectorWithSafe = false;\n let isConnectedToSafeIframe = false;\n if (connector) {\n isWConnectConnectorWithSafe =\n // can determine sync from connector.type and connector.id in case of external provider\n isExternalConnectorSafeWalletConnect(connector);\n // can determine sync from connector.type and connector.id in case of Safe Iframe provider,\n // whether as external provider or in safe connector\n isConnectedToSafeIframe = isConnectorWithSafeIframeProvider(connector);\n if (!isWConnectConnectorWithSafe && !isConnectedToSafeIframe) {\n // neither External Safe WalletConnect connector nor Safe Iframe connector,\n // so we check if it's a WalletConnect connector with Safe\n isWConnectConnectorWithSafe =\n await isWalletConnectConnectorWithSafe(connector);\n }\n }\n const isConnectedToSafe =\n isWConnectConnectorWithSafe || isConnectedToSafeIframe;\n\n const isSafe = _isSafe || isConnectedToSafe;\n\n const timeout = isSafe ? SAFE_CALLS_WAIT_TIMEOUT : undefined;\n\n let config = wagmiConfig;\n let realtxHash = hash;\n\n // always use connector client if connected through native safe connector.\n // safe provider returns a safeTxHash that is different from a real tx hash.\n // if connected to safe through WalletConnect - publicClient returns a real tx hash.\n if (isConnectedToSafeIframe) {\n const safeClient = await getConnectorClient(wagmiConfig, {\n chainId,\n connector,\n });\n\n // force waitForTransactionReceiptQueryOptions to use SafeClient internally\n config = {\n ...wagmiConfig,\n // doesn't work with Safe through WalletConnect connector\n getClient: (options) => {\n assert(!options || options.chainId === chainId, \"chainId mismatch\");\n return safeClient;\n },\n } as typeof wagmiConfig;\n } else if (isWConnectConnectorWithSafe) {\n /**\n * When Safe is connected through WalletConnect\n * (whether as external provider or in WalletConnect connector),\n * the resulting provider only ever returns safeTxHash in response to eth_sendTransaction.\n * And the provider never returns any kind of result in response to eth_getTransactionReceipt\n * or eth_getTransactionByHash for that safeTxHash.\n * Safe iframe provider does return real txHash's receipt in response to eth_getTransactionReceipt for safeTxHash.\n * But Safe through WalletConnect never does that.\n * Options:\n * 1. Use deprecated Safe API v1 to get the real tx hash and await its receipt\n * 2. Use Safe API v2 (optionally through safe-api-kit) but there an API key is required\n * 3. Safe SDK isn't an option as it communicates with Safe only from inside an iframe\n * 4. Surprisingly, wallet_getCallsStatus works with safeTxHash (at least with multiple signers)\n *\n * Here we go with option 4:\n * sendCallsId=safeTxHash -> getCallsStatus -> realTxHash=callsReceipt.txHash -> await receipt of realTxHash\n *\n * refs:\n * https://github.com/safe-global/safe-react-apps/issues/712\n * https://github.com/safe-global/safe-react-apps/issues/62\n */\n const ensureCallsStatus = ensureCallsStatusFactory({\n ...options,\n isSafe: true,\n });\n try {\n const callsStatusResult = await ensureCallsStatus({ id: hash });\n const classReceipt =\n callsStatusResult.receipts?.[callsStatusResult.receipts.length - 1];\n\n assert(\n classReceipt,\n `Transaction receipt not found for Safe tx through WalletConnect ${hash}, on chain ${chainId}`\n );\n\n realtxHash = classReceipt.transactionHash;\n } catch (error) {\n // it is possible Safe through WalletConnect could be connected but called with a past non-Safe tx from localStorage,\n // in that case we should try to get the tx receipt normally\n logger.error(\n \"Error getting calls status for Safe tx through WalletConnect\",\n { error }\n );\n }\n }\n\n // wagmi/core waitForTransactionReceipt throws on receipt.status==\"reverted\",\n // unlike viem waitForTransactionReceipt which returns the receipt as is\n const queryOptions = waitForTransactionReceiptQueryOptions(config, {\n hash: realtxHash,\n chainId,\n confirmations,\n timeout,\n onReplaced,\n });\n\n const receipt = await queryClient.ensureQueryData(queryOptions);\n\n return receipt;\n };\n"],"names":["logger","createLogger","ensureTxReceiptFactory","options","hash","chainId","confirmations","onReplaced","queryClient","_queryClient","wagmiConfig","_wagmiConfig","isSafe","_isSafe","connector","getAccount","isWConnectConnectorWithSafe","isConnectedToSafeIframe","isExternalConnectorSafeWalletConnect","isConnectorWithSafeIframeProvider","isWalletConnectConnectorWithSafe","isConnectedToSafe","timeout","SAFE_CALLS_WAIT_TIMEOUT","undefined","config","realtxHash","safeClient","getConnectorClient","getClient","assert","ensureCallsStatus","ensureCallsStatusFactory","callsStatusResult","id","classReceipt","receipts","length","transactionHash","error","queryOptions","waitForTransactionReceiptQueryOptions","receipt","ensureQueryData"],"mappings":";;;;;;;;;;;;;AAqCA,MAAMA,MAAAA,GAASC,aAAa,8BAA8B,CAAA;AAEnD,MAAMC,sBAAAA,GACXA,CAACC,OAAAA,GAAU,OACX,OAAO;AAAA,EAAEC,IAAAA;AAAAA,EAAMC,OAAAA;AAAAA,EAASC,aAAAA;AAAAA,EAAeC;AAAW,CAAA,KAAM;AACtD,EAAA,MAAM;AAAA,iBACJC,aAAAA,GAAcC,WAAAA;AAAAA,iBACdC,aAAAA,GAAcC,WAAAA;AAAAA,IACdC,MAAAA,EAAQC;AAAAA,GACV,GAAIV,OAAAA;AACJ,EAAA,MAAM;AAAA,IAAEW;AAAAA,GAAU,GAAIC,WAAWL,aAAW,CAAA;AAC5C,EAAA,IAAIM,2BAAAA,GAA8B,KAAA;AAClC,EAAA,IAAIC,uBAAAA,GAA0B,KAAA;AAC9B,EAAA,IAAIH,SAAAA,EAAW;AACbE,IAAAA,2BAAAA;AAAAA,IAEEE,qCAAqCJ,SAAS,CAAA;AAGhDG,IAAAA,uBAAAA,GAA0BE,kCAAkCL,SAAS,CAAA;AACrE,IAAA,IAAI,CAACE,2BAAAA,IAA+B,CAACC,uBAAAA,EAAyB;AAG5DD,MAAAA,2BAAAA,GACE,MAAMI,iCAAiCN,SAAS,CAAA;AAAA,IACpD;AAAA,EACF;AACA,EAAA,MAAMO,oBACJL,2BAAAA,IAA+BC,uBAAAA;AAEjC,EAAA,MAAML,SAASC,OAAAA,IAAWQ,iBAAAA;AAE1B,EAAA,MAAMC,OAAAA,GAAUV,SAASW,uBAAAA,GAA0BC,MAAAA;AAEnD,EAAA,IAAIC,MAAAA,GAASf,aAAA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AMsB,UAAAA;AAAAA,IACNrB,OAAAA;AAAAA,IACAC,aAAAA;AAAAA,IACAgB,OAAAA;AAAAA,IACAf;AAAAA,GACD,CAAA;AAED,EAAA,MAAMmC,OAAAA,GAAU,MAAMlC,aAAAA,CAAYmC,eAAAA,CAAgBH,YAAY,CAAA;AAE9D,EAAA,OAAOE,OAAAA;AACT;;;;"}
1
+ {"version":3,"file":"ensureTxReceipt.js","sources":["../../../src/transactions/queries/ensureTxReceipt.ts"],"sourcesContent":["import type { UseAwaitTxParameters } from \"@/hooks/txs/queries/useAwaitTx\";\nimport { queryClient as _queryClient } from \"@/lib/queryClient\";\nimport { wagmiConfig as _wagmiConfig } from \"@/lib/web3/wagmi/config\";\nimport type { QueryClient } from \"@tanstack/react-query\";\n\nimport { assert, type MarkRequired } from \"ts-essentials\";\nimport { type ReplacementReturnType, type TransactionReceipt } from \"viem\";\n\nimport { waitForTransactionReceiptQueryOptions } from \"wagmi/query\";\nimport { SAFE_CALLS_WAIT_TIMEOUT } from \"@/lib/constants\";\nimport { type Chain } from \"wagmi/chains\";\nimport { getAccount, getConnectorClient } from \"@wagmi/core\";\nimport {\n isConnectorWithSafeIframeProvider,\n isExternalConnectorSafeWalletConnect,\n} from \"@/components/web3/ConnectExternalProvider/utils\";\nimport { isWalletConnectConnectorWithSafe } from \"@/hooks/connectors/useIsSafeThroughWalletConnect\";\nimport { ensureCallsStatusFactory } from \"./ensureCallsStatus\";\nimport { createLogger } from \"@/lib/utils/logger\";\n\ntype OnReplacedCb = (data: ReplacementReturnType<Chain>) => void;\n\nexport type EnsureTxReceiptFn = (\n options: MarkRequired<\n Pick<UseAwaitTxParameters, \"hash\" | \"chainId\" | \"confirmations\">,\n \"hash\" | \"chainId\"\n > & {\n onReplaced?: OnReplacedCb;\n }\n) => Promise<TransactionReceipt>;\n\ntype EnsureTxReceiptFactory = (params?: {\n queryClient?: QueryClient;\n wagmiConfig?: typeof _wagmiConfig;\n isSafe?: boolean;\n}) => EnsureTxReceiptFn;\n\nconst logger = createLogger(\"Transactions:EnsureTxReceipt\");\n\nexport const ensureTxReceiptFactory: EnsureTxReceiptFactory =\n (options = {}) =>\n async ({ hash, chainId, confirmations, onReplaced }) => {\n const {\n queryClient = _queryClient,\n wagmiConfig = _wagmiConfig,\n isSafe: _isSafe,\n } = options;\n const { connector } = getAccount(wagmiConfig);\n let isWConnectConnectorWithSafe = false;\n let isConnectedToSafeIframe = false;\n if (connector) {\n isWConnectConnectorWithSafe =\n // can determine sync from connector.type and connector.id in case of external provider\n isExternalConnectorSafeWalletConnect(connector);\n // can determine sync from connector.type and connector.id in case of Safe Iframe provider,\n // whether as external provider or in safe connector\n isConnectedToSafeIframe = isConnectorWithSafeIframeProvider(connector);\n if (!isWConnectConnectorWithSafe && !isConnectedToSafeIframe) {\n // neither External Safe WalletConnect connector nor Safe Iframe connector,\n // so we check if it's a WalletConnect connector with Safe\n isWConnectConnectorWithSafe =\n await isWalletConnectConnectorWithSafe(connector);\n }\n }\n const isConnectedToSafe =\n isWConnectConnectorWithSafe || isConnectedToSafeIframe;\n\n const isSafe = _isSafe || isConnectedToSafe;\n\n const timeout = isSafe\n ? SAFE_CALLS_WAIT_TIMEOUT\n : SAFE_CALLS_WAIT_TIMEOUT / 2; // by default timeout is set to 0 inside waitForTransactionReceipt,\n // which makes the receipt query never resolve if the tx is dropped\n\n let config = wagmiConfig;\n let realtxHash = hash;\n\n // always use connector client if connected through native safe connector.\n // safe provider returns a safeTxHash that is different from a real tx hash.\n if (isConnectedToSafeIframe) {\n const safeClient = await getConnectorClient(wagmiConfig, {\n chainId,\n connector,\n });\n\n // force waitForTransactionReceiptQueryOptions to use SafeClient internally\n config = {\n ...wagmiConfig,\n // doesn't work with Safe through WalletConnect connector\n getClient: (options) => {\n assert(!options || options.chainId === chainId, \"chainId mismatch\");\n return safeClient;\n },\n } as typeof wagmiConfig;\n } else if (isWConnectConnectorWithSafe) {\n /**\n * When Safe is connected through WalletConnect\n * (whether as external provider or in WalletConnect connector),\n * the resulting provider only ever returns safeTxHash in response to eth_sendTransaction.\n * And the provider never returns any kind of result in response to eth_getTransactionReceipt\n * or eth_getTransactionByHash for that safeTxHash.\n * Safe iframe provider does return real txHash's receipt in response to eth_getTransactionReceipt for safeTxHash.\n * But Safe through WalletConnect never does that.\n * Options:\n * 1. Use deprecated Safe API v1 to get the real tx hash and await its receipt\n * 2. Use Safe API v2 (optionally through safe-api-kit) but there an API key is required\n * 3. Safe SDK isn't an option as it communicates with Safe only from inside an iframe\n * 4. Surprisingly, wallet_getCallsStatus works with safeTxHash (at least with multiple signers)\n *\n * Here we go with option 4:\n * sendCallsId=safeTxHash -> getCallsStatus -> realTxHash=callsReceipt.txHash -> await receipt of realTxHash\n *\n * refs:\n * https://github.com/safe-global/safe-react-apps/issues/712\n * https://github.com/safe-global/safe-react-apps/issues/62\n */\n const ensureCallsStatus = ensureCallsStatusFactory({\n ...options,\n isSafe: true,\n });\n try {\n const callsStatusResult = await ensureCallsStatus({ id: hash });\n const classReceipt =\n callsStatusResult.receipts?.[callsStatusResult.receipts.length - 1];\n\n assert(\n classReceipt,\n `Transaction receipt not found for Safe tx through WalletConnect ${hash}, on chain ${chainId}`\n );\n\n realtxHash = classReceipt.transactionHash;\n } catch (error) {\n // it is possible Safe through WalletConnect could be connected but called with a past non-Safe tx from localStorage,\n // in that case we should try to get the tx receipt normally\n logger.error(\n \"Error getting calls status for Safe tx through WalletConnect\",\n { error }\n );\n }\n }\n\n // wagmi/core waitForTransactionReceipt throws on receipt.status==\"reverted\",\n // unlike viem waitForTransactionReceipt which returns the receipt as is\n const queryOptions = waitForTransactionReceiptQueryOptions(config, {\n hash: realtxHash,\n chainId,\n confirmations,\n timeout,\n onReplaced,\n });\n\n const receipt = await queryClient.ensureQueryData(queryOptions);\n\n return receipt;\n };\n"],"names":["logger","createLogger","ensureTxReceiptFactory","options","hash","chainId","confirmations","onReplaced","queryClient","_queryClient","wagmiConfig","_wagmiConfig","isSafe","_isSafe","connector","getAccount","isWConnectConnectorWithSafe","isConnectedToSafeIframe","isExternalConnectorSafeWalletConnect","isConnectorWithSafeIframeProvider","isWalletConnectConnectorWithSafe","isConnectedToSafe","timeout","SAFE_CALLS_WAIT_TIMEOUT","config","realtxHash","safeClient","getConnectorClient","getClient","assert","ensureCallsStatus","ensureCallsStatusFactory","callsStatusResult","id","classReceipt","receipts","length","transactionHash","error","queryOptions","waitForTransactionReceiptQueryOptions","receipt","ensureQueryData"],"mappings":";;;;;;;;;;;;;AAqCA,MAAMA,MAAAA,GAASC,aAAa,8BAA8B,CAAA;AAEnD,MAAMC,sBAAAA,GACXA,CAACC,OAAAA,GAAU,OACX,OAAO;AAAA,EAAEC,IAAAA;AAAAA,EAAMC,OAAAA;AAAAA,EAASC,aAAAA;AAAAA,EAAeC;AAAW,CAAA,KAAM;AACtD,EAAA,MAAM;AAAA,iBACJC,aAAAA,GAAcC,WAAAA;AAAAA,iBACdC,aAAAA,GAAcC,WAAAA;AAAAA,IACdC,MAAAA,EAAQC;AAAAA,GACV,GAAIV,OAAAA;AACJ,EAAA,MAAM;AAAA,IAAEW;AAAAA,GAAU,GAAIC,WAAWL,aAAW,CAAA;AAC5C,EAAA,IAAIM,2BAAAA,GAA8B,KAAA;AAClC,EAAA,IAAIC,uBAAAA,GAA0B,KAAA;AAC9B,EAAA,IAAIH,SAAAA,EAAW;AACbE,IAAAA,2BAAAA;AAAAA,IAEEE,qCAAqCJ,SAAS,CAAA;AAGhDG,IAAAA,uBAAAA,GAA0BE,kCAAkCL,SAAS,CAAA;AACrE,IAAA,IAAI,CAACE,2BAAAA,IAA+B,CAACC,uBAAAA,EAAyB;AAG5DD,MAAAA,2BAAAA,GACE,MAAMI,iCAAiCN,SAAS,CAAA;AAAA,IACpD;AAAA,EACF;AACA,EAAA,MAAMO,oBACJL,2BAAAA,IAA+BC,uBAAAA;AAEjC,EAAA,MAAML,SAASC,OAAAA,IAAWQ,iBAAAA;AAE1B,EAAA,MAAMC,OAAAA,GAAUV,MAAAA,G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IA,EAAA,MAAMC,YAAAA,GAAeC,sCAAsChB,MAAAA,EAAQ;AAAA,IACjEpB,IAAAA,EAAMqB,UAAAA;AAAAA,IACNpB,OAAAA;AAAAA,IACAC,aAAAA;AAAAA,IACAgB,OAAAA;AAAAA,IACAf;AAAAA,GACD,CAAA;AAED,EAAA,MAAMkC,OAAAA,GAAU,MAAMjC,aAAAA,CAAYkC,eAAAA,CAAgBH,YAAY,CAAA;AAE9D,EAAA,OAAOE,OAAAA;AACT;;;;"}
@@ -0,0 +1,17 @@
1
+ import { wagmiConfig as _wagmiConfig } from '../../lib/web3/wagmi/config';
2
+ import { QueryClient } from '@tanstack/react-query';
3
+ import { Hash } from 'viem';
4
+ import { SupportedChainId } from '../../lib/web3/wagmi/types';
5
+ import { GetTransactionReturnType } from '@wagmi/core';
6
+ export type TxResponse = GetTransactionReturnType<typeof _wagmiConfig, SupportedChainId>;
7
+ export type EnsureTxResponseFn = (options: {
8
+ hash: Hash;
9
+ chainId: SupportedChainId;
10
+ }) => Promise<TxResponse>;
11
+ type EnsureTxResponseFactory = (params?: {
12
+ queryClient?: QueryClient;
13
+ wagmiConfig?: typeof _wagmiConfig;
14
+ }) => EnsureTxResponseFn;
15
+ export declare const ensureTxResponseFactory: EnsureTxResponseFactory;
16
+ export {};
17
+ //# sourceMappingURL=ensureTxResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureTxResponse.d.ts","sourceRoot":"","sources":["../../../src/transactions/queries/ensureTxResponse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,MAAM,CAAC;AAGjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE5D,MAAM,MAAM,UAAU,GAAG,wBAAwB,CAC/C,OAAO,YAAY,EACnB,gBAAgB,CACjB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE;IACzC,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,gBAAgB,CAAC;CAC3B,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AAE1B,KAAK,uBAAuB,GAAG,CAAC,MAAM,CAAC,EAAE;IACvC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,YAAY,CAAC;CACnC,KAAK,kBAAkB,CAAC;AAEzB,eAAO,MAAM,uBAAuB,EAAE,uBAenC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { queryClient } from '../../lib/queryClient.js';
2
+ import { wagmiConfig } from '../../lib/web3/wagmi/config.js';
3
+ import 'viem';
4
+ import { getTransactionQueryOptions } from 'wagmi/query';
5
+
6
+ const ensureTxResponseFactory = (options = {}) => async ({
7
+ hash,
8
+ chainId
9
+ }) => {
10
+ const {
11
+ queryClient: queryClient$1 = queryClient,
12
+ wagmiConfig: wagmiConfig$1 = wagmiConfig
13
+ } = options;
14
+ const queryOptions = getTransactionQueryOptions(wagmiConfig$1, {
15
+ hash,
16
+ chainId
17
+ });
18
+ const txResponse = await queryClient$1.ensureQueryData(queryOptions);
19
+ return txResponse;
20
+ };
21
+
22
+ export { ensureTxResponseFactory };
23
+ //# sourceMappingURL=ensureTxResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureTxResponse.js","sources":["../../../src/transactions/queries/ensureTxResponse.ts"],"sourcesContent":["import { queryClient as _queryClient } from \"@/lib/queryClient\";\nimport { wagmiConfig as _wagmiConfig } from \"@/lib/web3/wagmi/config\";\nimport type { QueryClient } from \"@tanstack/react-query\";\n\nimport { type Hash } from \"viem\";\n\nimport { getTransactionQueryOptions } from \"wagmi/query\";\nimport type { SupportedChainId } from \"@/lib/web3/wagmi/types\";\nimport type { GetTransactionReturnType } from \"@wagmi/core\";\n\nexport type TxResponse = GetTransactionReturnType<\n typeof _wagmiConfig,\n SupportedChainId\n>;\n\nexport type EnsureTxResponseFn = (options: {\n hash: Hash;\n chainId: SupportedChainId;\n}) => Promise<TxResponse>;\n\ntype EnsureTxResponseFactory = (params?: {\n queryClient?: QueryClient;\n wagmiConfig?: typeof _wagmiConfig;\n}) => EnsureTxResponseFn;\n\nexport const ensureTxResponseFactory: EnsureTxResponseFactory =\n (options = {}) =>\n async ({ hash, chainId }) => {\n const { queryClient = _queryClient, wagmiConfig = _wagmiConfig } = options;\n\n // wagmi/core getTransaction throws TransactionNotFoundError when no tx found\n const queryOptions = getTransactionQueryOptions(wagmiConfig, {\n hash,\n chainId,\n });\n\n const txResponse: TxResponse =\n await queryClient.ensureQueryData(queryOptions);\n\n return txResponse;\n };\n"],"names":["ensureTxResponseFactory","options","hash","chainId","queryClient","_queryClient","wagmiConfig","_wagmiConfig","queryOptions","getTransactionQueryOptions","txResponse","ensureQueryData"],"mappings":";;;;;AAyBO,MAAMA,uBAAAA,GACXA,CAACC,OAAAA,GAAU,OACX,OAAO;AAAA,EAAEC,IAAAA;AAAAA,EAAMC;AAAQ,CAAA,KAAM;AAC3B,EAAA,MAAM;AAAA,iBAAEC,aAAAA,GAAcC,WAAAA;AAAAA,iBAAcC,aAAAA,GAAcC;AAAAA,GAAa,GAAIN,OAAAA;AAGnE,EAAA,MAAMO,YAAAA,GAAeC,2BAA2BH,aAAAA,EAAa;AAAA,IAC3DJ,IAAAA;AAAAA,IACAC;AAAAA,GACD,CAAA;AAED,EAAA,MAAMO,UAAAA,GACJ,MAAMN,aAAAA,CAAYO,eAAAA,CAAgBH,YAAY,CAAA;AAEhD,EAAA,OAAOE,UAAAA;AACT;;;;"}
@@ -0,0 +1,7 @@
1
+ export declare function useMarkTxAsDropped(): (args_0: {
2
+ account: import('viem').Address;
3
+ txHash: import('viem').Hash;
4
+ action?: import('../../../hooks/txs/mutations/useReplaceTx').ReplacementTxAction;
5
+ replacementTxHash?: import('viem').Hash;
6
+ }) => void;
7
+ //# sourceMappingURL=useMarkTxAsDropped.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMarkTxAsDropped.d.ts","sourceRoot":"","sources":["../../../../src/transactions/state/hooks/useMarkTxAsDropped.ts"],"names":[],"mappings":"AAGA,wBAAgB,kBAAkB;;;;;WAIjC"}
@@ -0,0 +1,10 @@
1
+ import { useSetAtom } from '../../../core/store.js';
2
+ import { markTxAsDroppedAtom } from '../transactionsActionAtom.js';
3
+
4
+ function useMarkTxAsDropped() {
5
+ const markTxAsDropped = useSetAtom(markTxAsDroppedAtom);
6
+ return markTxAsDropped;
7
+ }
8
+
9
+ export { useMarkTxAsDropped };
10
+ //# sourceMappingURL=useMarkTxAsDropped.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMarkTxAsDropped.js","sources":["../../../../src/transactions/state/hooks/useMarkTxAsDropped.ts"],"sourcesContent":["import { useSetAtom } from \"@/core/store\";\nimport { markTxAsDroppedAtom } from \"../transactionsActionAtom\";\n\nexport function useMarkTxAsDropped() {\n const markTxAsDropped = useSetAtom(markTxAsDroppedAtom);\n\n return markTxAsDropped;\n}\n"],"names":["useMarkTxAsDropped","markTxAsDropped","useSetAtom","markTxAsDroppedAtom"],"mappings":";;;AAGO,SAAAA,kBAAAA,GAAA;AACL,EAAA,MAAAC,eAAAA,GAAwBC,WAAWC,mBAAmB,CAAA;AAAE,EAAA,OAEjDF,eAAAA;AAAe;;;;"}
@@ -1,4 +1,6 @@
1
1
  import { StandaloneTransactionItem, BatchTransactionItem, MinTransactionItem } from '../types';
2
+ import { Hash, Address } from 'viem';
3
+ import { ReplacementTxAction } from '../../hooks/txs/mutations/useReplaceTx';
2
4
  export declare const addTxAtom: import('jotai').WritableAtom<null, [transaction: MinTransactionItem], void> & {
3
5
  init: null;
4
6
  };
@@ -9,4 +11,14 @@ export declare const finalizeBatchTxAtom: import('jotai').WritableAtom<null, [Ba
9
11
  init: null;
10
12
  };
11
13
  export declare const addTx: (transaction: MinTransactionItem) => Promise<void>;
14
+ type MarkTxAsDroppedOptions = {
15
+ account: Address;
16
+ txHash: Hash;
17
+ action?: ReplacementTxAction;
18
+ replacementTxHash?: Hash;
19
+ };
20
+ export declare const markTxAsDroppedAtom: import('jotai').WritableAtom<null, [MarkTxAsDroppedOptions], void> & {
21
+ init: null;
22
+ };
23
+ export {};
12
24
  //# sourceMappingURL=transactionsActionAtom.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transactionsActionAtom.d.ts","sourceRoot":"","sources":["../../../src/transactions/state/transactionsActionAtom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AA+BlB,eAAO,MAAM,SAAS;;CAoCrB,CAAC;AAEF,eAAO,MAAM,wBAAwB;;CAwCnC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;CA8B9B,CAAC;AAEH,eAAO,MAAM,KAAK,GAAU,aAAa,kBAAkB,kBAE1D,CAAC"}
1
+ {"version":3,"file":"transactionsActionAtom.d.ts","sourceRoot":"","sources":["../../../src/transactions/state/transactionsActionAtom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAMlB,OAAO,EAML,KAAK,IAAI,EACT,KAAK,OAAO,EACb,MAAM,MAAM,CAAC;AAkBd,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAE9E,eAAO,MAAM,SAAS;;CAoCrB,CAAC;AAEF,eAAO,MAAM,wBAAwB;;CAwCnC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;CA8B9B,CAAC;AAEH,eAAO,MAAM,KAAK,GAAU,aAAa,kBAAkB,kBAE1D,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,IAAI,CAAC;IACb,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,iBAAiB,CAAC,EAAE,IAAI,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,mBAAmB;;CAoC/B,CAAC"}
@@ -120,6 +120,39 @@ const finalizeBatchTxAtom = atom(null, async (_, set, transaction) => {
120
120
  const addTx = async (transaction) => {
121
121
  return jotaiStore.set(addTxAtom, transaction);
122
122
  };
123
+ const markTxAsDroppedAtom = atom(null, (_, set, options) => {
124
+ const {
125
+ txHash,
126
+ action,
127
+ replacementTxHash,
128
+ account
129
+ } = options;
130
+ set(transactionsAtom, (currentTransactions) => {
131
+ const accountTransactions = currentTransactions[account] || {};
132
+ const identifier = txHash;
133
+ const txItem = accountTransactions[identifier];
134
+ if (!txItem) return currentTransactions;
135
+ if (!isStandaloneTransactionItem(txItem)) return currentTransactions;
136
+ const updatedTxItem = {
137
+ ...txItem,
138
+ dropped: true
139
+ };
140
+ if (action && replacementTxHash) {
141
+ updatedTxItem.replacementTx = {
142
+ hash: replacementTxHash,
143
+ action
144
+ };
145
+ }
146
+ const updatedAccountTransactions = {
147
+ ...accountTransactions,
148
+ [identifier]: updatedTxItem
149
+ };
150
+ return {
151
+ ...currentTransactions,
152
+ [account]: updatedAccountTransactions
153
+ };
154
+ });
155
+ });
123
156
  function sanitizeTx(tx) {
124
157
  if (isBatchTransactionItem(tx)) {
125
158
  const txItem2 = {
@@ -161,6 +194,12 @@ function sanitizeTx(tx) {
161
194
  isSafe: tx.connectorData.isSafe ?? isGnosisSafeTx(tx)
162
195
  };
163
196
  }
197
+ if (tx.replacementTx) {
198
+ txItem.replacementTx = {
199
+ hash: tx.replacementTx.hash,
200
+ action: tx.replacementTx.action
201
+ };
202
+ }
164
203
  return txItem;
165
204
  }
166
205
  function assignTx(currentTransactions, transaction) {
@@ -183,5 +222,5 @@ function assignTx(currentTransactions, transaction) {
183
222
  };
184
223
  }
185
224
 
186
- export { addTx, addTxAtom, finalizeBatchTxAtom, finalizeStandaloneTxAtom };
225
+ export { addTx, addTxAtom, finalizeBatchTxAtom, finalizeStandaloneTxAtom, markTxAsDroppedAtom };
187
226
  //# sourceMappingURL=transactionsActionAtom.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transactionsActionAtom.js","sources":["../../../src/transactions/state/transactionsActionAtom.ts"],"sourcesContent":["import type {\n TransactionItem,\n StandaloneTransactionItem,\n BatchTransactionItem,\n MinTransactionItem,\n} from \"../types\";\nimport { atom } from \"jotai\";\nimport { jotaiStore } from \"@/core/store\";\n\nimport { ensureCallsStatusFactory } from \"../queries/ensureCallsStatus\";\nimport { ensureTxReceiptFactory } from \"../queries/ensureTxReceipt\";\nimport {\n WaitForCallsStatusTimeoutError,\n TransactionReceiptNotFoundError,\n WaitForTransactionReceiptTimeoutError,\n MethodNotSupportedRpcError,\n CallExecutionError,\n} from \"viem\";\nimport { transactionLogger } from \"../logger\";\nimport {\n transactionsAtom,\n type TransactionsMap,\n type TransactionsState,\n} from \"./transactionsAtom\";\nimport {\n isBatchTransactionItem,\n isGnosisSafeTx,\n isStandaloneTransactionItem,\n} from \"../utils\";\nimport { assert } from \"ts-essentials\";\nimport {\n accountAtom,\n isConnectorWithSafeAsyncAtomLoadableAtom,\n} from \"@/lib/web3/wagmi/external\";\nimport { isConnectorWithSafeProvider } from \"@/components/web3/ConnectExternalProvider/utils\";\n\nexport const addTxAtom = atom<null, [transaction: MinTransactionItem], void>(\n null,\n (get, set, transaction) => {\n const { connector, address } = get(accountAtom);\n assert(connector && address, \"connector and address are required\");\n let isSafe = isConnectorWithSafeProvider(connector);\n\n if (!isSafe) {\n // loadable is used to keep addition of txWithMeta to transactionsAtom sync,\n // and avoid blocking addTxAtom setters\n const loadableResult = get(isConnectorWithSafeAsyncAtomLoadableAtom);\n if (loadableResult.state === \"hasData\" && loadableResult.data) {\n isSafe = true;\n }\n }\n\n const txWithMeta: TransactionItem = {\n ...transaction,\n account: address,\n timestamp: Date.now(),\n dropped: false,\n connectorData: {\n type: connector.type,\n id: connector.id,\n isSafe,\n },\n };\n set(transactionsAtom, (current) => assignTx(current, txWithMeta));\n\n if (isStandaloneTransactionItem(txWithMeta)) {\n // don't await to avoid blocking addTxAtom setters\n set(finalizeStandaloneTxAtom, txWithMeta);\n } else {\n set(finalizeBatchTxAtom, txWithMeta);\n }\n }\n);\n\nexport const finalizeStandaloneTxAtom = atom<\n null,\n [StandaloneTransactionItem],\n Promise<void>\n>(null, async (_, set, transaction) => {\n const finalizedTx: StandaloneTransactionItem = { ...transaction };\n const ensureTxReceipt = ensureTxReceiptFactory();\n const isTxThroughSafe = isGnosisSafeTx(finalizedTx);\n\n try {\n // ensureTxReceipt internally makes sure to use walletClient for Safe connector\n const txReceipt = await ensureTxReceipt({\n hash: finalizedTx.transactionHash,\n chainId: finalizedTx.chainId,\n });\n finalizedTx.receipt = txReceipt;\n } catch (error) {\n if (\n /* \n At different steps of the waitForTransactionReceipt func different errors can be thrown.\n And if tx turned in eth_call with the same params succeeds (which it normally should not if it reverted for a valid reason and not gas or something),\n we can even get a useless Error(\"unknown reason\") or Error(\"0xrandom_hash\")\n */\n error instanceof WaitForTransactionReceiptTimeoutError || // thrown when transaction is not found within the timeout period\n error instanceof TransactionReceiptNotFoundError || // thrown when transaction receipt is not found\n error instanceof CallExecutionError // thrown when the transaction execution fails on-chain (execution reverted, out of gas, etc)\n ) {\n finalizedTx.dropped = true;\n transactionLogger.error(\"tx dropped\", {\n error,\n finalizedTx,\n isTxThroughSafe,\n });\n } else throw error;\n } finally {\n if (finalizedTx.receipt || finalizedTx.dropped) {\n set(transactionsAtom, (current) => assignTx(current, finalizedTx));\n transactionLogger.log(\"tx finalized\", { finalizedTx, isTxThroughSafe });\n }\n }\n});\n\nexport const finalizeBatchTxAtom = atom<\n null,\n [BatchTransactionItem],\n Promise<void>\n>(null, async (_, set, transaction) => {\n const finalizedTx: BatchTransactionItem = { ...transaction };\n const ensureCallsStatus = ensureCallsStatusFactory();\n\n try {\n const { receipts, status } = await ensureCallsStatus({\n id: finalizedTx.callsId,\n });\n finalizedTx.callsStatus = status;\n finalizedTx.receipt = receipts?.[receipts.length - 1];\n } catch (error) {\n if (\n error instanceof WaitForCallsStatusTimeoutError ||\n error instanceof MethodNotSupportedRpcError\n ) {\n finalizedTx.dropped = true;\n transactionLogger.error(\"batch tx dropped\", { error, finalizedTx });\n } else {\n finalizedTx.callsStatus = \"failure\";\n transactionLogger.error(\"batch tx failed\", { error, finalizedTx });\n throw error;\n }\n } finally {\n set(transactionsAtom, (current) => assignTx(current, finalizedTx));\n transactionLogger.log(\"batch tx finalized\", { finalizedTx });\n }\n});\n\nexport const addTx = async (transaction: MinTransactionItem) => {\n return jotaiStore.set(addTxAtom, transaction);\n};\n\nfunction sanitizeTx(tx: TransactionItem): TransactionItem {\n if (isBatchTransactionItem(tx)) {\n const txItem = {\n action: tx.action,\n account: tx.account,\n chainId: tx.chainId,\n callsId: tx.callsId,\n callsStatus: tx.callsStatus,\n timestamp: tx.timestamp,\n dropped: tx.dropped,\n receipt: tx.receipt,\n transactionSpecificData: tx.transactionSpecificData,\n } as BatchTransactionItem;\n\n if (tx.connectorData) {\n txItem.connectorData = {\n type: tx.connectorData.type,\n id: tx.connectorData.id,\n // extra check for backwards compatibility with txs from localStorage without connectorData.isSafe\n isSafe: tx.connectorData.isSafe ?? isGnosisSafeTx(tx),\n };\n }\n\n return txItem;\n }\n\n const txItem = {\n action: tx.action,\n chainId: tx.chainId,\n account: tx.account,\n transactionHash: tx.transactionHash,\n timestamp: tx.timestamp,\n dropped: tx.dropped,\n receipt: tx.receipt,\n transactionSpecificData: tx.transactionSpecificData,\n } as StandaloneTransactionItem;\n\n if (tx.connectorData) {\n txItem.connectorData = {\n type: tx.connectorData.type,\n id: tx.connectorData.id,\n // extra check for backwards compatibility with txs from localStorage without connectorData.isSafe\n isSafe: tx.connectorData.isSafe ?? isGnosisSafeTx(tx),\n };\n }\n\n return txItem;\n}\n\nfunction assignTx(\n currentTransactions: TransactionsState,\n transaction: TransactionItem\n): TransactionsState {\n transactionLogger.log(\"assignTx\", {\n account: transaction.account,\n transaction,\n });\n\n const accountTransactions = currentTransactions[transaction.account] || {};\n const identifier = isStandaloneTransactionItem(transaction)\n ? transaction.transactionHash\n : transaction.callsId;\n\n const updatedAccountTransactions: TransactionsMap = {\n ...accountTransactions,\n [identifier]: sanitizeTx({\n ...accountTransactions[identifier],\n ...transaction,\n }),\n };\n\n return {\n ...currentTransactions,\n [transaction.account]: updatedAccountTransactions,\n };\n}\n"],"names":["addTxAtom","atom","get","set","transaction","connector","address","accountAtom","assert","isSafe","isConnectorWithSafeProvider","loadableResult","isConnectorWithSafeAsyncAtomLoadableAtom","state","data","txWithMeta","account","timestamp","Date","now","dropped","connectorData","type","id","transactionsAtom","current","assignTx","isStandaloneTransactionItem","finalizeStandaloneTxAtom","finalizeBatchTxAtom","_","finalizedTx","ensureTxReceipt","ensureTxReceiptFactory","isTxThroughSafe","isGnosisSafeTx","txReceipt","hash","transactionHash","chainId","receipt","error","WaitForTransactionReceiptTimeoutError","TransactionReceiptNotFoundError","CallExecutionError","transactionLogger","log","ensureCallsStatus","ensureCallsStatusFactory","receipts","status","callsId","callsStatus","length","WaitForCallsStatusTimeoutError","MethodNotSupportedRpcError","addTx","jotaiStore","sanitizeTx","tx","isBatchTransactionItem","txItem","action","transactionSpecificData","currentTransactions","accountTransactions","identifier","updatedAccountTransactions"],"mappings":";;;;;;;;;;;;AAoCO,MAAMA,YAAYC,IAAAA,CACvB,IAAA,EACA,CAACC,GAAAA,EAAKC,KAAKC,WAAAA,KAAgB;AACzB,EAAA,MAAM;AAAA,IAAEC,SAAAA;AAAAA,IAAWC;AAAAA,GAAQ,GAAIJ,IAAIK,WAAW,CAAA;AAC9CC,EAAAA,MAAAA,CAAOH,SAAAA,IAAaC,SAAS,oCAAoC,CAAA;AACjE,EAAA,IAAIG,MAAAA,GAASC,4BAA4BL,SAAS,CAAA;AAEl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cC,IAAAA;AAAAA,MACvBC,EAAAA,EAAIoC,GAAGtC,aAAAA,CAAcE,EAAAA;AAAAA;AAAAA,MAErBd,MAAAA,EAAQkD,EAAAA,CAAGtC,aAAAA,CAAcZ,MAAAA,IAAU0B,eAAewB,EAAE;AAAA,KACtD;AAAA,EACF;AAEA,EAAA,OAAOE,MAAAA;AACT;AAEA,SAASnC,QAAAA,CACPsC,qBACA5D,WAAAA,EACmB;AACnByC,EAAAA,iBAAAA,CAAkBC,IAAI,UAAA,EAAY;AAAA,IAChC9B,SAASZ,WAAAA,CAAYY,OAAAA;AAAAA,IACrBZ;AAAAA,GACD,CAAA;AAED,EAAA,MAAM6D,mBAAAA,GAAsBD,mBAAAA,CAAoB5D,WAAAA,CAAYY,OAAO,KAAK,EAAC;AACzE,EAAA,MAAMkD,aAAavC,2BAAAA,CAA4BvB,WAAW,CAAA,GACtDA,WAAAA,CAAYkC,kBACZlC,WAAAA,CAAY+C,OAAAA;AAEhB,EAAA,MAAMgB,0BAAAA,GAA8C;AAAA,IAClD,GAAGF,mBAAAA;AAAAA,IACH,CAACC,UAAU,GAAGR,UAAAA,CAAW;AAAA,MACvB,GAAGO,oBAAoBC,UAAU,CAAA;AAAA,MACjC,GAAG9D;AAAAA,KACJ;AAAA,GACH;AAEA,EAAA,OAAO;AAAA,IACL,GAAG4D,mBAAAA;AAAAA,IACH,CAAC5D,WAAAA,CAAYY,OAAO,GAAGmD;AAAAA,GACzB;AACF;;;;"}
1
+ {"version":3,"file":"transactionsActionAtom.js","sources":["../../../src/transactions/state/transactionsActionAtom.ts"],"sourcesContent":["import type {\n TransactionItem,\n StandaloneTransactionItem,\n BatchTransactionItem,\n MinTransactionItem,\n} from \"../types\";\nimport { atom } from \"jotai\";\nimport { jotaiStore } from \"@/core/store\";\n\nimport { ensureCallsStatusFactory } from \"../queries/ensureCallsStatus\";\nimport { ensureTxReceiptFactory } from \"../queries/ensureTxReceipt\";\nimport {\n WaitForCallsStatusTimeoutError,\n TransactionReceiptNotFoundError,\n WaitForTransactionReceiptTimeoutError,\n MethodNotSupportedRpcError,\n CallExecutionError,\n type Hash,\n type Address,\n} from \"viem\";\nimport { transactionLogger } from \"../logger\";\nimport {\n transactionsAtom,\n type TransactionsMap,\n type TransactionsState,\n} from \"./transactionsAtom\";\nimport {\n isBatchTransactionItem,\n isGnosisSafeTx,\n isStandaloneTransactionItem,\n} from \"../utils\";\nimport { assert } from \"ts-essentials\";\nimport {\n accountAtom,\n isConnectorWithSafeAsyncAtomLoadableAtom,\n} from \"@/lib/web3/wagmi/external\";\nimport { isConnectorWithSafeProvider } from \"@/components/web3/ConnectExternalProvider/utils\";\nimport type { ReplacementTxAction } from \"@/hooks/txs/mutations/useReplaceTx\";\n\nexport const addTxAtom = atom<null, [transaction: MinTransactionItem], void>(\n null,\n (get, set, transaction) => {\n const { connector, address } = get(accountAtom);\n assert(connector && address, \"connector and address are required\");\n let isSafe = isConnectorWithSafeProvider(connector);\n\n if (!isSafe) {\n // loadable is used to keep addition of txWithMeta to transactionsAtom sync,\n // and avoid blocking addTxAtom setters\n const loadableResult = get(isConnectorWithSafeAsyncAtomLoadableAtom);\n if (loadableResult.state === \"hasData\" && loadableResult.data) {\n isSafe = true;\n }\n }\n\n const txWithMeta: TransactionItem = {\n ...transaction,\n account: address,\n timestamp: Date.now(),\n dropped: false,\n connectorData: {\n type: connector.type,\n id: connector.id,\n isSafe,\n },\n };\n set(transactionsAtom, (current) => assignTx(current, txWithMeta));\n\n if (isStandaloneTransactionItem(txWithMeta)) {\n // don't await to avoid blocking addTxAtom setters\n set(finalizeStandaloneTxAtom, txWithMeta);\n } else {\n set(finalizeBatchTxAtom, txWithMeta);\n }\n }\n);\n\nexport const finalizeStandaloneTxAtom = atom<\n null,\n [StandaloneTransactionItem],\n Promise<void>\n>(null, async (_, set, transaction) => {\n const finalizedTx: StandaloneTransactionItem = { ...transaction };\n const ensureTxReceipt = ensureTxReceiptFactory();\n const isTxThroughSafe = isGnosisSafeTx(finalizedTx);\n\n try {\n // ensureTxReceipt internally makes sure to use walletClient for Safe connector\n const txReceipt = await ensureTxReceipt({\n hash: finalizedTx.transactionHash,\n chainId: finalizedTx.chainId,\n });\n finalizedTx.receipt = txReceipt;\n } catch (error) {\n if (\n /* \n At different steps of the waitForTransactionReceipt func different errors can be thrown.\n And if tx turned in eth_call with the same params succeeds (which it normally should not if it reverted for a valid reason and not gas or something),\n we can even get a useless Error(\"unknown reason\") or Error(\"0xrandom_hash\")\n */\n error instanceof WaitForTransactionReceiptTimeoutError || // thrown when transaction is not found within the timeout period\n error instanceof TransactionReceiptNotFoundError || // thrown when transaction receipt is not found\n error instanceof CallExecutionError // thrown when the transaction execution fails on-chain (execution reverted, out of gas, etc)\n ) {\n finalizedTx.dropped = true;\n transactionLogger.error(\"tx dropped\", {\n error,\n finalizedTx,\n isTxThroughSafe,\n });\n } else throw error;\n } finally {\n if (finalizedTx.receipt || finalizedTx.dropped) {\n set(transactionsAtom, (current) => assignTx(current, finalizedTx));\n transactionLogger.log(\"tx finalized\", { finalizedTx, isTxThroughSafe });\n }\n }\n});\n\nexport const finalizeBatchTxAtom = atom<\n null,\n [BatchTransactionItem],\n Promise<void>\n>(null, async (_, set, transaction) => {\n const finalizedTx: BatchTransactionItem = { ...transaction };\n const ensureCallsStatus = ensureCallsStatusFactory();\n\n try {\n const { receipts, status } = await ensureCallsStatus({\n id: finalizedTx.callsId,\n });\n finalizedTx.callsStatus = status;\n finalizedTx.receipt = receipts?.[receipts.length - 1];\n } catch (error) {\n if (\n error instanceof WaitForCallsStatusTimeoutError ||\n error instanceof MethodNotSupportedRpcError\n ) {\n finalizedTx.dropped = true;\n transactionLogger.error(\"batch tx dropped\", { error, finalizedTx });\n } else {\n finalizedTx.callsStatus = \"failure\";\n transactionLogger.error(\"batch tx failed\", { error, finalizedTx });\n throw error;\n }\n } finally {\n set(transactionsAtom, (current) => assignTx(current, finalizedTx));\n transactionLogger.log(\"batch tx finalized\", { finalizedTx });\n }\n});\n\nexport const addTx = async (transaction: MinTransactionItem) => {\n return jotaiStore.set(addTxAtom, transaction);\n};\n\ntype MarkTxAsDroppedOptions = {\n account: Address;\n txHash: Hash;\n action?: ReplacementTxAction;\n replacementTxHash?: Hash;\n};\n\nexport const markTxAsDroppedAtom = atom<null, [MarkTxAsDroppedOptions], void>(\n null,\n (_, set, options) => {\n const { txHash, action, replacementTxHash, account } = options;\n set(transactionsAtom, (currentTransactions) => {\n const accountTransactions = currentTransactions[account] || {};\n\n const identifier = txHash;\n const txItem = accountTransactions[identifier];\n if (!txItem) return currentTransactions;\n // only non-batch txs can be cancelled\n if (!isStandaloneTransactionItem(txItem)) return currentTransactions;\n\n const updatedTxItem: typeof txItem = {\n ...txItem,\n dropped: true,\n };\n\n if (action && replacementTxHash) {\n updatedTxItem.replacementTx = {\n hash: replacementTxHash,\n action,\n };\n }\n\n const updatedAccountTransactions: TransactionsMap = {\n ...accountTransactions,\n [identifier]: updatedTxItem,\n };\n\n return {\n ...currentTransactions,\n [account]: updatedAccountTransactions,\n };\n });\n }\n);\n\nfunction sanitizeTx(tx: TransactionItem): TransactionItem {\n if (isBatchTransactionItem(tx)) {\n const txItem = {\n action: tx.action,\n account: tx.account,\n chainId: tx.chainId,\n callsId: tx.callsId,\n callsStatus: tx.callsStatus,\n timestamp: tx.timestamp,\n dropped: tx.dropped,\n receipt: tx.receipt,\n transactionSpecificData: tx.transactionSpecificData,\n } as BatchTransactionItem;\n\n if (tx.connectorData) {\n txItem.connectorData = {\n type: tx.connectorData.type,\n id: tx.connectorData.id,\n // extra check for backwards compatibility with txs from localStorage without connectorData.isSafe\n isSafe: tx.connectorData.isSafe ?? isGnosisSafeTx(tx),\n };\n }\n\n return txItem;\n }\n\n const txItem = {\n action: tx.action,\n chainId: tx.chainId,\n account: tx.account,\n transactionHash: tx.transactionHash,\n timestamp: tx.timestamp,\n dropped: tx.dropped,\n receipt: tx.receipt,\n transactionSpecificData: tx.transactionSpecificData,\n } as StandaloneTransactionItem;\n\n if (tx.connectorData) {\n txItem.connectorData = {\n type: tx.connectorData.type,\n id: tx.connectorData.id,\n // extra check for backwards compatibility with txs from localStorage without connectorData.isSafe\n isSafe: tx.connectorData.isSafe ?? isGnosisSafeTx(tx),\n };\n }\n\n if (tx.replacementTx) {\n txItem.replacementTx = {\n hash: tx.replacementTx.hash,\n action: tx.replacementTx.action,\n };\n }\n\n return txItem;\n}\n\nfunction assignTx(\n currentTransactions: TransactionsState,\n transaction: TransactionItem\n): TransactionsState {\n transactionLogger.log(\"assignTx\", {\n account: transaction.account,\n transaction,\n });\n\n const accountTransactions = currentTransactions[transaction.account] || {};\n const identifier = isStandaloneTransactionItem(transaction)\n ? transaction.transactionHash\n : transaction.callsId;\n\n const updatedAccountTransactions: TransactionsMap = {\n ...accountTransactions,\n [identifier]: sanitizeTx({\n ...accountTransactions[identifier],\n ...transaction,\n }),\n };\n\n return {\n ...currentTransactions,\n [transaction.account]: updatedAccountTransactions,\n };\n}\n"],"names":["addTxAtom","atom","get","set","transaction","connector","address","accountAtom","assert","isSafe","isConnectorWithSafeProvider","loadableResult","isConnectorWithSafeAsyncAtomLoadableAtom","state","data","txWithMeta","account","timestamp","Date","now","dropped","connectorData","type","id","transactionsAtom","current","assignTx","isStandaloneTransactionItem","finalizeStandaloneTxAtom","finalizeBatchTxAtom","_","finalizedTx","ensureTxReceipt","ensureTxReceiptFactory","isTxThroughSafe","isGnosisSafeTx","txReceipt","hash","transactionHash","chainId","receipt","error","WaitForTransactionReceiptTimeoutError","TransactionReceiptNotFoundError","CallExecutionError","transactionLogger","log","ensureCallsStatus","ensureCallsStatusFactory","receipts","status","callsId","callsStatus","length","WaitForCallsStatusTimeoutError","MethodNotSupportedRpcError","addTx","jotaiStore","markTxAsDroppedAtom","options","txHash","action","replacementTxHash","currentTransactions","accountTransactions","identifier","txItem","updatedTxItem","replacementTx","updatedAccountTransactions","sanitizeTx","tx","isBatchTransactionItem","transactionSpecificData"],"mappings":";;;;;;;;;;;;AAuCO,MAAMA,YA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AAYY,OAAO,GAAGqD;AAAAA,GACzB;AACF;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { TransactionReceipt } from 'viem';
2
2
  import { TransactionItem } from './types';
3
- export type TxStatus = TransactionReceipt["status"] | "pending";
3
+ export type TxStatus = TransactionReceipt["status"] | "pending" | "cancelled";
4
4
  export declare function getTxStatus(tx: TransactionItem): TxStatus;
5
5
  //# sourceMappingURL=status.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/transactions/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,MAAM,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;AAEhE,wBAAgB,WAAW,CAAC,EAAE,EAAE,eAAe,GAAG,QAAQ,CAKzD"}
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/transactions/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,MAAM,MAAM,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC,GAAG,SAAS,GAAG,WAAW,CAAC;AAE9E,wBAAgB,WAAW,CAAC,EAAE,EAAE,eAAe,GAAG,QAAQ,CAUzD"}
@@ -1,5 +1,11 @@
1
+ import { isStandaloneTransactionItem } from './utils.js';
2
+
1
3
  function getTxStatus(tx) {
2
4
  if (tx.action === "swap" && tx.transactionSpecificData.source === "metabase") return "success";
5
+ if (isStandaloneTransactionItem(tx) && tx.dropped) {
6
+ if (tx.replacementTx?.action === "cancel") return "cancelled";
7
+ return "reverted";
8
+ }
3
9
  return tx.receipt?.status || "pending";
4
10
  }
5
11
 
@@ -1 +1 @@
1
- {"version":3,"file":"status.js","sources":["../../src/transactions/status.ts"],"sourcesContent":["import type { TransactionReceipt } from \"viem\";\nimport type { TransactionItem } from \"./types\";\n\nexport type TxStatus = TransactionReceipt[\"status\"] | \"pending\";\n\nexport function getTxStatus(tx: TransactionItem): TxStatus {\n if (tx.action === \"swap\" && tx.transactionSpecificData.source === \"metabase\")\n return \"success\";\n\n return tx.receipt?.status || \"pending\";\n}\n"],"names":["getTxStatus","tx","action","transactionSpecificData","source","receipt","status"],"mappings":"AAKO,SAASA,YAAYC,EAAAA,EAA+B;AACzD,EAAA,IAAIA,GAAGC,MAAAA,KAAW,MAAA,IAAUD,GAAGE,uBAAAA,CAAwBC,MAAAA,KAAW,YAChE,OAAO,SAAA;AAET,EAAA,OAAOH,EAAAA,CAAGI,SAASC,MAAAA,IAAU,SAAA;AAC/B;;;;"}
1
+ {"version":3,"file":"status.js","sources":["../../src/transactions/status.ts"],"sourcesContent":["import type { TransactionReceipt } from \"viem\";\nimport type { TransactionItem } from \"./types\";\nimport { isStandaloneTransactionItem } from \"./utils\";\n\nexport type TxStatus = TransactionReceipt[\"status\"] | \"pending\" | \"cancelled\";\n\nexport function getTxStatus(tx: TransactionItem): TxStatus {\n if (tx.action === \"swap\" && tx.transactionSpecificData.source === \"metabase\")\n return \"success\";\n\n if (isStandaloneTransactionItem(tx) && tx.dropped) {\n if (tx.replacementTx?.action === \"cancel\") return \"cancelled\";\n return \"reverted\";\n }\n\n return tx.receipt?.status || \"pending\";\n}\n"],"names":["getTxStatus","tx","action","transactionSpecificData","source","isStandaloneTransactionItem","dropped","replacementTx","receipt","status"],"mappings":";;AAMO,SAASA,YAAYC,EAAAA,EAA+B;AACzD,EAAA,IAAIA,GAAGC,MAAAA,KAAW,MAAA,IAAUD,GAAGE,uBAAAA,CAAwBC,MAAAA,KAAW,YAChE,OAAO,SAAA;AAET,EAAA,IAAIC,2BAAAA,CAA4BJ,EAAE,CAAA,IAAKA,EAAAA,CAAGK,OAAAA,EAAS;AACjD,IAAA,IAAIL,EAAAA,CAAGM,aAAAA,EAAeL,MAAAA,KAAW,QAAA,EAAU,OAAO,WAAA;AAClD,IAAA,OAAO,UAAA;AAAA,EACT;AAEA,EAAA,OAAOD,EAAAA,CAAGO,SAASC,MAAAA,IAAU,SAAA;AAC/B;;;;"}