@rainlanguage/ui-components 0.0.1-alpha.21 → 0.0.1-alpha.211

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 (260) hide show
  1. package/dist/__fixtures__/settings.yaml +125 -0
  2. package/dist/__mocks__/CodeMirrorRainlang.svelte +4 -0
  3. package/dist/__mocks__/CodeMirrorRainlang.svelte.d.ts +18 -0
  4. package/dist/__mocks__/MockComponent.svelte +4 -0
  5. package/dist/__mocks__/MockComponent.svelte.d.ts +3 -1
  6. package/dist/__mocks__/stores.d.ts +47 -33
  7. package/dist/__mocks__/stores.js +61 -38
  8. package/dist/components/ButtonLoading.svelte +1 -1
  9. package/dist/components/ButtonVaultLink.svelte +11 -11
  10. package/dist/components/ButtonVaultLink.svelte.d.ts +4 -3
  11. package/dist/components/CheckboxInactiveOrdersVault.svelte +20 -0
  12. package/dist/components/CheckboxInactiveOrdersVault.svelte.d.ts +19 -0
  13. package/dist/components/CheckboxMyItemsOnly.svelte +3 -2
  14. package/dist/components/CheckboxMyItemsOnly.svelte.d.ts +2 -3
  15. package/dist/components/CheckboxZeroBalanceVault.svelte.d.ts +2 -2
  16. package/dist/components/CodeMirrorDotrain.svelte +4 -0
  17. package/dist/components/CodeMirrorDotrain.svelte.d.ts +1 -0
  18. package/dist/components/CodeMirrorRainlang.svelte +3 -12
  19. package/dist/components/CodeMirrorRainlang.svelte.d.ts +2 -2
  20. package/dist/components/EditableSpan.svelte +3 -14
  21. package/dist/components/EditableSpan.svelte.d.ts +0 -1
  22. package/dist/components/Hash.svelte +3 -3
  23. package/dist/components/License.svelte +5 -4
  24. package/dist/components/ListViewOrderbookFilters.svelte +45 -23
  25. package/dist/components/ListViewOrderbookFilters.svelte.d.ts +27 -22
  26. package/dist/components/LocalDbStatusBadge.svelte +27 -0
  27. package/dist/components/LocalDbStatusBadge.svelte.d.ts +19 -0
  28. package/dist/components/LocalDbStatusCard.svelte +40 -0
  29. package/dist/components/LocalDbStatusCard.svelte.d.ts +20 -0
  30. package/dist/components/LocalDbStatusModal.svelte +103 -0
  31. package/dist/components/LocalDbStatusModal.svelte.d.ts +21 -0
  32. package/dist/components/OrderOrVaultHash.svelte +12 -12
  33. package/dist/components/OrderOrVaultHash.svelte.d.ts +4 -4
  34. package/dist/components/PageHeader.svelte +1 -1
  35. package/dist/components/TanstackAppTable.svelte +179 -28
  36. package/dist/components/TanstackAppTable.svelte.d.ts +14 -8
  37. package/dist/components/ToastDetail.svelte +42 -0
  38. package/dist/components/ToastDetail.svelte.d.ts +20 -0
  39. package/dist/components/Tooltip.svelte +8 -0
  40. package/dist/components/Tooltip.svelte.d.ts +21 -0
  41. package/dist/components/VaultBalanceChangeTypeFilter.svelte +23 -0
  42. package/dist/components/VaultBalanceChangeTypeFilter.svelte.d.ts +19 -0
  43. package/dist/components/VaultCard.svelte +18 -0
  44. package/dist/components/VaultCard.svelte.d.ts +19 -0
  45. package/dist/components/charts/LightweightChart.svelte +1 -1
  46. package/dist/components/charts/LightweightChart.svelte.d.ts +5 -5
  47. package/dist/components/charts/OrderTradesChart.svelte +300 -28
  48. package/dist/components/charts/OrderTradesChart.svelte.d.ts +4 -4
  49. package/dist/components/charts/TanstackLightweightChartLine.svelte +5 -9
  50. package/dist/components/charts/VaultBalanceChart.svelte +8 -26
  51. package/dist/components/charts/VaultBalanceChart.svelte.d.ts +1 -7
  52. package/dist/components/charts/transformAndSortData.d.ts +24 -0
  53. package/dist/components/charts/transformAndSortData.js +111 -0
  54. package/dist/components/checkbox/CheckboxActiveOrders.svelte +11 -0
  55. package/dist/components/checkbox/CheckboxActiveOrders.svelte.d.ts +19 -0
  56. package/dist/components/deployment/ButtonSelectOption.svelte +2 -0
  57. package/dist/components/deployment/ButtonSelectOption.svelte.d.ts +1 -0
  58. package/dist/components/deployment/ComposedRainlangModal.svelte +2 -1
  59. package/dist/components/deployment/ComposedRainlangModal.svelte.d.ts +1 -4
  60. package/dist/components/deployment/DeploymentSectionHeader.svelte +7 -4
  61. package/dist/components/deployment/DeploymentSteps.svelte +209 -216
  62. package/dist/components/deployment/DeploymentSteps.svelte.d.ts +6 -12
  63. package/dist/components/deployment/DeploymentTile.svelte +2 -2
  64. package/dist/components/deployment/DeploymentTile.svelte.d.ts +1 -1
  65. package/dist/components/deployment/DeploymentsSection.svelte +15 -22
  66. package/dist/components/deployment/DeploymentsSection.svelte.d.ts +3 -2
  67. package/dist/components/deployment/DepositInput.svelte +8 -10
  68. package/dist/components/deployment/DepositInput.svelte.d.ts +1 -2
  69. package/dist/components/deployment/DisclaimerModal.svelte +6 -7
  70. package/dist/components/deployment/FieldDefinitionInput.svelte +7 -11
  71. package/dist/components/deployment/FieldDefinitionInput.svelte.d.ts +1 -2
  72. package/dist/components/deployment/InvalidOrdersSection.svelte +17 -0
  73. package/dist/components/deployment/InvalidOrdersSection.svelte.d.ts +19 -0
  74. package/dist/components/deployment/{StrategyPage.svelte → OrderPage.svelte} +15 -24
  75. package/dist/components/deployment/OrderPage.svelte.d.ts +21 -0
  76. package/dist/components/deployment/SelectToken.svelte +125 -48
  77. package/dist/components/deployment/SelectToken.svelte.d.ts +4 -3
  78. package/dist/components/deployment/TokenBalance.svelte +19 -0
  79. package/dist/components/deployment/TokenBalance.svelte.d.ts +19 -0
  80. package/dist/components/deployment/TokenIOInput.svelte +25 -15
  81. package/dist/components/deployment/TokenIOInput.svelte.d.ts +3 -3
  82. package/dist/components/deployment/TokenSelectionModal.svelte +148 -0
  83. package/dist/components/deployment/TokenSelectionModal.svelte.d.ts +20 -0
  84. package/dist/components/deployment/{ValidStrategiesSection.svelte → ValidOrdersSection.svelte} +7 -7
  85. package/dist/components/deployment/ValidOrdersSection.svelte.d.ts +19 -0
  86. package/dist/components/deployment/VaultIdInformation.svelte +17 -0
  87. package/dist/components/deployment/VaultIdInformation.svelte.d.ts +21 -0
  88. package/dist/components/detail/OrderDetail.svelte +184 -80
  89. package/dist/components/detail/OrderDetail.svelte.d.ts +21 -15
  90. package/dist/components/detail/TanstackOrderQuote.svelte +92 -46
  91. package/dist/components/detail/TanstackOrderQuote.svelte.d.ts +14 -16
  92. package/dist/components/detail/VaultDetail.svelte +78 -77
  93. package/dist/components/detail/VaultDetail.svelte.d.ts +12 -18
  94. package/dist/components/dropdown/DropdownActiveNetworks.svelte +44 -0
  95. package/dist/components/dropdown/DropdownActiveNetworks.svelte.d.ts +19 -0
  96. package/dist/components/dropdown/DropdownCheckbox.svelte +4 -4
  97. package/dist/components/dropdown/DropdownOrderListAccounts.svelte +5 -2
  98. package/dist/components/dropdown/DropdownOrderListAccounts.svelte.d.ts +2 -3
  99. package/dist/components/dropdown/DropdownOrderbooksFilter.svelte +172 -0
  100. package/dist/components/dropdown/DropdownOrderbooksFilter.svelte.d.ts +25 -0
  101. package/dist/components/dropdown/DropdownTokensFilter.svelte +152 -0
  102. package/dist/components/dropdown/DropdownTokensFilter.svelte.d.ts +28 -0
  103. package/dist/components/icon/Refresh.svelte +2 -1
  104. package/dist/components/icon/Refresh.svelte.d.ts +1 -0
  105. package/dist/components/input/InputOrderHash.svelte +1 -1
  106. package/dist/components/input/InputOrderHash.svelte.d.ts +3 -3
  107. package/dist/components/input/InputRegistryUrl.svelte +36 -14
  108. package/dist/components/input/InputToken.svelte +2 -2
  109. package/dist/components/input/InputTokenAmount.svelte +16 -21
  110. package/dist/components/input/InputTokenAmount.svelte.d.ts +3 -3
  111. package/dist/components/tables/OrderAPY.svelte +6 -33
  112. package/dist/components/tables/OrderAPY.svelte.d.ts +1 -4
  113. package/dist/components/tables/OrderTradesListTable.svelte +84 -81
  114. package/dist/components/tables/OrderTradesListTable.svelte.d.ts +4 -4
  115. package/dist/components/tables/OrderVaultsVolTable.svelte +17 -22
  116. package/dist/components/tables/OrderVaultsVolTable.svelte.d.ts +2 -2
  117. package/dist/components/tables/OrdersListTable.svelte +200 -108
  118. package/dist/components/tables/OrdersListTable.svelte.d.ts +17 -21
  119. package/dist/components/tables/VaultBalanceChangesTable.svelte +83 -43
  120. package/dist/components/tables/VaultBalanceChangesTable.svelte.d.ts +13 -11
  121. package/dist/components/tables/VaultsListTable.svelte +268 -145
  122. package/dist/components/tables/VaultsListTable.svelte.d.ts +24 -32
  123. package/dist/components/transactions/FixedBottomTransaction.svelte +63 -0
  124. package/dist/components/transactions/FixedBottomTransaction.svelte.d.ts +16 -0
  125. package/dist/components/transactions/TransactionDetail.svelte +31 -0
  126. package/dist/components/transactions/TransactionDetail.svelte.d.ts +20 -0
  127. package/dist/components/transactions/TransactionList.svelte +17 -0
  128. package/dist/components/transactions/TransactionList.svelte.d.ts +16 -0
  129. package/dist/components/transactions/getStatusEmoji.d.ts +2 -0
  130. package/dist/components/transactions/getStatusEmoji.js +20 -0
  131. package/dist/components/wallet/WalletConnect.svelte +5 -4
  132. package/dist/components/wallet/WalletConnect.svelte.d.ts +0 -1
  133. package/dist/consts.d.ts +1 -0
  134. package/dist/consts.js +1 -0
  135. package/dist/errors/DeploymentStepsError.d.ts +8 -2
  136. package/dist/errors/DeploymentStepsError.js +7 -1
  137. package/dist/hooks/useGui.d.ts +1 -1
  138. package/dist/hooks/useGui.js +1 -1
  139. package/dist/hooks/useLocalDb.d.ts +3 -0
  140. package/dist/hooks/useLocalDb.js +10 -0
  141. package/dist/hooks/useRaindexClient.d.ts +3 -0
  142. package/dist/hooks/useRaindexClient.js +11 -0
  143. package/dist/index.d.ts +42 -19
  144. package/dist/index.js +41 -16
  145. package/dist/models/Transaction.d.ts +75 -0
  146. package/dist/models/Transaction.js +100 -0
  147. package/dist/providers/GuiProvider.svelte +1 -1
  148. package/dist/providers/GuiProvider.svelte.d.ts +1 -1
  149. package/dist/providers/LocalDbProvider.svelte +8 -0
  150. package/dist/providers/LocalDbProvider.svelte.d.ts +21 -0
  151. package/dist/providers/RaindexClientProvider.svelte +8 -0
  152. package/dist/providers/RaindexClientProvider.svelte.d.ts +21 -0
  153. package/dist/providers/dotrainRegistry/DotrainRegistryProvider.svelte +8 -0
  154. package/dist/providers/dotrainRegistry/DotrainRegistryProvider.svelte.d.ts +24 -0
  155. package/dist/providers/dotrainRegistry/context.d.ts +9 -0
  156. package/dist/providers/dotrainRegistry/context.js +40 -0
  157. package/dist/providers/dotrainRegistry/useDotrainRegistry.d.ts +5 -0
  158. package/dist/providers/dotrainRegistry/useDotrainRegistry.js +35 -0
  159. package/dist/providers/registry/RegistryManager.d.ts +65 -0
  160. package/dist/providers/registry/RegistryManager.js +133 -0
  161. package/dist/providers/registry/RegistryProvider.svelte +6 -0
  162. package/dist/providers/registry/RegistryProvider.svelte.d.ts +21 -0
  163. package/dist/providers/registry/context.d.ts +10 -0
  164. package/dist/providers/registry/context.js +46 -0
  165. package/dist/providers/registry/useRegistry.d.ts +7 -0
  166. package/dist/providers/registry/useRegistry.js +29 -0
  167. package/dist/providers/toasts/ToastProvider.svelte +17 -0
  168. package/dist/providers/toasts/ToastProvider.svelte.d.ts +18 -0
  169. package/dist/providers/toasts/context.d.ts +14 -0
  170. package/dist/providers/toasts/context.js +22 -0
  171. package/dist/providers/toasts/useToasts.d.ts +16 -0
  172. package/dist/providers/toasts/useToasts.js +63 -0
  173. package/dist/providers/transactions/TransactionManager.d.ts +235 -0
  174. package/dist/providers/transactions/TransactionManager.js +509 -0
  175. package/dist/providers/transactions/TransactionProvider.svelte +11 -0
  176. package/dist/providers/transactions/TransactionProvider.svelte.d.ts +24 -0
  177. package/dist/providers/transactions/context.d.ts +19 -0
  178. package/dist/providers/transactions/context.js +28 -0
  179. package/dist/providers/transactions/useTransactions.d.ts +13 -0
  180. package/dist/providers/transactions/useTransactions.js +18 -0
  181. package/dist/providers/wallet/WalletProvider.svelte +7 -0
  182. package/dist/providers/wallet/WalletProvider.svelte.d.ts +21 -0
  183. package/dist/providers/wallet/context.d.ts +10 -0
  184. package/dist/providers/wallet/context.js +47 -0
  185. package/dist/providers/wallet/useAccount.d.ts +8 -0
  186. package/dist/providers/wallet/useAccount.js +148 -0
  187. package/dist/queries/keys.d.ts +1 -0
  188. package/dist/queries/keys.js +1 -0
  189. package/dist/queries/queryClient.d.ts +1 -1
  190. package/dist/queries/queryClient.js +11 -6
  191. package/dist/services/awaitTransactionIndexing.d.ts +107 -0
  192. package/dist/services/awaitTransactionIndexing.js +58 -0
  193. package/dist/services/getExplorerLink.d.ts +1 -1
  194. package/dist/services/getExplorerLink.js +2 -4
  195. package/dist/services/handleShareChoices.d.ts +2 -2
  196. package/dist/services/handleShareChoices.js +7 -2
  197. package/dist/services/historicalOrderCharts.d.ts +2 -2
  198. package/dist/services/historicalOrderCharts.js +267 -333
  199. package/dist/services/index.d.ts +2 -1
  200. package/dist/services/index.js +2 -1
  201. package/dist/services/loadRegistryUrl.d.ts +2 -0
  202. package/dist/services/loadRegistryUrl.js +22 -0
  203. package/dist/services/pairTradesChartData.d.ts +47 -0
  204. package/dist/services/pairTradesChartData.js +190 -0
  205. package/dist/services/registry.d.ts +5 -5
  206. package/dist/services/registry.js +8 -208
  207. package/dist/services/time.d.ts +12 -0
  208. package/dist/services/time.js +88 -6
  209. package/dist/storesGeneric/cachedWritableStore.d.ts +57 -0
  210. package/dist/storesGeneric/cachedWritableStore.js +93 -0
  211. package/dist/types/account.d.ts +3 -0
  212. package/dist/types/appStores.d.ts +9 -14
  213. package/dist/types/modal.d.ts +26 -14
  214. package/dist/types/{strategy.d.ts → order.d.ts} +3 -3
  215. package/dist/types/order.js +1 -0
  216. package/dist/types/toast.d.ts +11 -0
  217. package/dist/types/toast.js +1 -0
  218. package/dist/types/tokenBalance.d.ts +6 -0
  219. package/dist/types/tokenBalance.js +1 -0
  220. package/dist/types/transaction.d.ts +66 -21
  221. package/dist/types/transaction.js +31 -1
  222. package/dist/utils/configHelpers.d.ts +4 -0
  223. package/dist/utils/configHelpers.js +21 -0
  224. package/dist/utils/constructHashLink.d.ts +24 -0
  225. package/dist/utils/constructHashLink.js +115 -0
  226. package/dist/utils/getNetworkName.d.ts +1 -0
  227. package/dist/utils/getNetworkName.js +13 -0
  228. package/dist/utils/number.d.ts +0 -7
  229. package/dist/utils/number.js +0 -27
  230. package/dist/utils/tokens.d.ts +2 -0
  231. package/dist/utils/tokens.js +3 -0
  232. package/dist/utils/vaultBalanceChangeLabels.d.ts +4 -0
  233. package/dist/utils/vaultBalanceChangeLabels.js +18 -0
  234. package/package.json +39 -34
  235. package/dist/__fixtures__/orderDetail.d.ts +0 -99
  236. package/dist/__fixtures__/orderDetail.js +0 -204
  237. package/dist/__fixtures__/settings-12-11-24.json +0 -160
  238. package/dist/__mocks__/mockTransactionStore.d.ts +0 -22
  239. package/dist/__mocks__/mockTransactionStore.js +0 -56
  240. package/dist/__mocks__/settings.d.ts +0 -3
  241. package/dist/__mocks__/settings.js +0 -37
  242. package/dist/components/deployment/InvalidStrategiesSection.svelte +0 -19
  243. package/dist/components/deployment/InvalidStrategiesSection.svelte.d.ts +0 -19
  244. package/dist/components/deployment/StrategyPage.svelte.d.ts +0 -19
  245. package/dist/components/deployment/ValidStrategiesSection.svelte.d.ts +0 -19
  246. package/dist/components/deployment/getDeploymentTransactionArgs.d.ts +0 -17
  247. package/dist/components/deployment/getDeploymentTransactionArgs.js +0 -28
  248. package/dist/components/detail/DepositOrWithdrawButtons.svelte +0 -44
  249. package/dist/components/detail/DepositOrWithdrawButtons.svelte.d.ts +0 -26
  250. package/dist/components/dropdown/DropdownActiveSubgraphs.svelte +0 -38
  251. package/dist/components/dropdown/DropdownActiveSubgraphs.svelte.d.ts +0 -21
  252. package/dist/components/dropdown/DropdownOrderStatus.svelte +0 -31
  253. package/dist/components/dropdown/DropdownOrderStatus.svelte.d.ts +0 -19
  254. package/dist/stores/transactionStore.d.ts +0 -98
  255. package/dist/stores/transactionStore.js +0 -303
  256. package/dist/utils/time.d.ts +0 -12
  257. package/dist/utils/time.js +0 -27
  258. package/dist/utils/vault.d.ts +0 -2
  259. package/dist/utils/vault.js +0 -29
  260. /package/dist/types/{strategy.js → account.js} +0 -0
@@ -0,0 +1,14 @@
1
+ import { type Writable } from 'svelte/store';
2
+ import type { ToastProps } from '../../types/toast';
3
+ export declare const TOASTS_KEY = "rain:ui-components:toasts";
4
+ /**
5
+ * Retrieves the toasts store from Svelte's context
6
+ */
7
+ export declare function getToastsContext(): Writable<ToastProps[]>;
8
+ /**
9
+ * Sets the toasts store in Svelte's context
10
+ *
11
+ * @param {Writable<ToastProps[]>} toasts - The writable store containing all active toast notifications
12
+ * @returns {void}
13
+ */
14
+ export declare function setToastsContext(toasts: Writable<ToastProps[]>): void;
@@ -0,0 +1,22 @@
1
+ import { getContext, setContext } from 'svelte';
2
+ import {} from 'svelte/store';
3
+ export const TOASTS_KEY = 'rain:ui-components:toasts';
4
+ /**
5
+ * Retrieves the toasts store from Svelte's context
6
+ */
7
+ export function getToastsContext() {
8
+ const toasts = getContext(TOASTS_KEY);
9
+ if (!toasts) {
10
+ throw new Error('No toasts context found. Did you forget to wrap your component with ToastProvider?');
11
+ }
12
+ return toasts;
13
+ }
14
+ /**
15
+ * Sets the toasts store in Svelte's context
16
+ *
17
+ * @param {Writable<ToastProps[]>} toasts - The writable store containing all active toast notifications
18
+ * @returns {void}
19
+ */
20
+ export function setToastsContext(toasts) {
21
+ setContext(TOASTS_KEY, toasts);
22
+ }
@@ -0,0 +1,16 @@
1
+ import type { ToastProps } from '../../types/toast';
2
+ /**
3
+ * Hook for managing toast notifications in the application.
4
+ * Provides functionality to add, remove, and access toast notifications.
5
+ *
6
+ * @returns {Object} An object containing:
7
+ * - toasts: Writable store containing all active toast notifications
8
+ * - addToast: Function to add a new toast notification
9
+ * - removeToast: Function to remove a toast notification by index
10
+ */
11
+ export declare function useToasts(): {
12
+ toasts: import("svelte/store").Writable<ToastProps[]>;
13
+ addToast: (toast: ToastProps) => void;
14
+ removeToast: (index: number) => void;
15
+ errToast: (message: string, detail?: string) => void;
16
+ };
@@ -0,0 +1,63 @@
1
+ import { getToastsContext } from './context';
2
+ /**
3
+ * Hook for managing toast notifications in the application.
4
+ * Provides functionality to add, remove, and access toast notifications.
5
+ *
6
+ * @returns {Object} An object containing:
7
+ * - toasts: Writable store containing all active toast notifications
8
+ * - addToast: Function to add a new toast notification
9
+ * - removeToast: Function to remove a toast notification by index
10
+ */
11
+ export function useToasts() {
12
+ const toasts = getToastsContext();
13
+ /**
14
+ * Removes a toast notification by its index from the toasts store
15
+ *
16
+ * @param {number} index - The index of the toast to remove
17
+ * @returns {void}
18
+ */
19
+ const removeToast = (index) => {
20
+ toasts.update((toasts) => {
21
+ if (index < 0 || index >= toasts.length) {
22
+ return toasts;
23
+ }
24
+ return toasts.filter((_, i) => i !== index);
25
+ });
26
+ };
27
+ /**
28
+ * Adds a new toast notification to the toasts store
29
+ *
30
+ * @param {ToastProps} toast - The toast configuration object containing:
31
+ * - message: The text to display in the toast
32
+ * - type: The type of toast (success, error, warning, info)
33
+ * - color: The color theme of the toast (green, red, yellow, blue)
34
+ * - links: Optional array of links to display in the toast
35
+ * @returns {void}
36
+ */
37
+ const addToast = (toast) => {
38
+ toasts.update((toasts) => {
39
+ const updatedToasts = [...toasts, toast];
40
+ return updatedToasts;
41
+ });
42
+ };
43
+ /**
44
+ * Adds a standardized error toast notification
45
+ *
46
+ * @param message - The error message to display
47
+ * @param detail - The detail of the error
48
+ */
49
+ const errToast = (message, detail) => {
50
+ addToast({
51
+ message,
52
+ detail,
53
+ type: 'error',
54
+ color: 'red'
55
+ });
56
+ };
57
+ return {
58
+ toasts,
59
+ addToast,
60
+ removeToast,
61
+ errToast
62
+ };
63
+ }
@@ -0,0 +1,235 @@
1
+ import { type Readable } from 'svelte/store';
2
+ import type { QueryClient } from '@tanstack/svelte-query';
3
+ import { type Transaction } from '../../models/Transaction';
4
+ import type { InternalTransactionArgs, IndexingContext } from '../../types/transaction';
5
+ import type { Config } from '@wagmi/core';
6
+ import type { ToastLink, ToastProps } from '../../types/toast';
7
+ import { type RaindexVault, type RaindexOrder, RaindexClient, type Address, Float, type WasmEncodedResult } from '@rainlanguage/orderbook';
8
+ /**
9
+ * Function type for adding toast notifications to the UI.
10
+ * @param toast - The toast notification configuration object.
11
+ * @param toast.message - The message text to display in the toast.
12
+ * @param toast.type - The type of toast notification ('success', 'error', or 'info').
13
+ * @param toast.color - The color theme of the toast.
14
+ * @param toast.links - Optional array of links to display in the toast.
15
+ */
16
+ export type AddToastFunction = (toast: Omit<ToastProps, 'id'>) => void;
17
+ /**
18
+ * Creates an indexing function that wraps SDK-based polling logic.
19
+ * The SDK handles local-DB-first polling followed by subgraph fallback internally,
20
+ * so we only need to call it once.
21
+ *
22
+ * @param options Configuration for SDK-based indexing
23
+ * @param options.call Function that calls the SDK method (e.g. getAddOrdersForTransaction)
24
+ * @param options.isSuccess Function to determine if the result indicates success
25
+ * @param options.buildLinks Optional function to generate toast links from the result
26
+ * @returns An indexing function compatible with TransactionStore
27
+ */
28
+ export declare function createSdkIndexingFn<T>(options: {
29
+ call: () => Promise<WasmEncodedResult<T>>;
30
+ isSuccess: (value: T) => boolean;
31
+ buildLinks?: (value: T) => ToastLink[];
32
+ }): (ctx: IndexingContext) => Promise<void>;
33
+ /**
34
+ * Manages blockchain transactions with toast notifications and query invalidation.
35
+ * Handles transaction lifecycle, status updates, and UI feedback.
36
+ * Provides functionality for creating, tracking, and managing blockchain transactions.
37
+ */
38
+ export declare class TransactionManager {
39
+ /** Writable store tracking all active transactions. */
40
+ private transactions;
41
+ /** Query client for cache invalidation after successful transactions. */
42
+ private queryClient;
43
+ /** Function to display toast notifications in the UI. */
44
+ private addToast;
45
+ /** Wagmi configuration for blockchain interactions. */
46
+ private wagmiConfig;
47
+ /**
48
+ * Initializes a new TransactionManager instance.
49
+ * @param queryClient - Query client for cache invalidation.
50
+ * @param addToast - Function to display toast notifications.
51
+ * @param wagmiConfig - Wagmi configuration for blockchain interactions.
52
+ */
53
+ constructor(queryClient: QueryClient, addToast: AddToastFunction, wagmiConfig: Config);
54
+ /**
55
+ * Creates and initializes a new transaction for removing an order from the orderbook.
56
+ * @param args - Configuration for the remove order transaction.
57
+ * @param args.txHash - Hash of the transaction to track.
58
+ * @param args.chainId - Chain ID where the transaction is being executed.
59
+ * @param args.queryKey - The hash of the order to be removed (used for query invalidation and UI links).
60
+ * @param args.entity - The `SgOrder` entity associated with this transaction.
61
+ * @returns A new Transaction instance configured for order removal.
62
+ * @example
63
+ * const tx = await manager.createRemoveOrderTransaction({
64
+ * txHash: '0x123...',
65
+ * chainId: 1,
66
+ * queryKey: '0x456...', // Order hash
67
+ * entity: sgOrderInstance
68
+ * });
69
+ */
70
+ createRemoveOrderTransaction(args: InternalTransactionArgs & {
71
+ entity: RaindexOrder;
72
+ raindexClient: RaindexClient;
73
+ }): Promise<Transaction>;
74
+ /**
75
+ * Creates and initializes a new transaction for withdrawing funds from a vault.
76
+ * @param args - Configuration for the withdrawal transaction.
77
+ * @param args.txHash - Hash of the transaction to track.
78
+ * @param args.chainId - Chain ID where the transaction is being executed.
79
+ * @param args.queryKey - The ID of the vault from which funds are withdrawn (used for query invalidation and UI links).
80
+ * @param args.entity - The `SgVault` entity associated with this transaction.
81
+ * @returns A new Transaction instance configured for withdrawal.
82
+ * @example
83
+ * const tx = await manager.createWithdrawTransaction({
84
+ * txHash: '0x123...',
85
+ * chainId: 1,
86
+ * queryKey: '0x789...', // Vault ID
87
+ * entity: sgVaultInstance
88
+ * });
89
+ */
90
+ createWithdrawTransaction(args: InternalTransactionArgs & {
91
+ entity: RaindexVault;
92
+ raindexClient: RaindexClient;
93
+ }): Promise<Transaction>;
94
+ /**
95
+ * Creates a multicall withdrawal transaction.
96
+ *
97
+ * Precondition: all provided vaults must share the same Raindex orderbook.
98
+ * This is enforced upstream in handleVaultsWithdrawAll.ts:
99
+ * if (vaults.some(v => v.orderbook !== vaults[0].orderbook)) { … }
100
+ *
101
+ * @param args.chainId the target chain ID
102
+ * @param args.vaults list of RaindexVault instances (must share an orderbook)
103
+ * @param args.txHash the transaction hash to wrap
104
+ * @param args.queryKey cache key for invalidation
105
+ * @param args.raindexClient Raindex API client * @example
106
+ * const tx = await manager.createVaultsWithdrawAllTransaction({
107
+ * txHash: '0x123...',
108
+ * chainId: 1,
109
+ * queryKey: 'QKEY_VAULTS',
110
+ * vaults: [vault1, vault2, vault3],
111
+ * raindexClient: clientInstance
112
+ * });
113
+ */
114
+ createVaultsWithdrawAllTransaction(args: InternalTransactionArgs & {
115
+ vaults: RaindexVault[];
116
+ raindexClient: RaindexClient;
117
+ }): Promise<Transaction>;
118
+ /**
119
+ * Creates and initializes a new transaction for approving token spend.
120
+ * @param args - Configuration for the approval transaction.
121
+ * @param args.txHash - Hash of the transaction to track.
122
+ * @param args.chainId - Chain ID where the transaction is being executed.
123
+ * @param args.queryKey - The ID of the vault or context for which approval is made (used for query invalidation and UI links).
124
+ * @param args.tokenSymbol - The symbol of the token being approved.
125
+ * @param args.entity - The `SgVault` entity associated with this transaction. (Optional, used for approvals to pre-existing vaults).
126
+ * @returns A new Transaction instance configured for token approval.
127
+ * @example
128
+ * const tx = await manager.createApprovalTransaction({
129
+ * txHash: '0xabc...',
130
+ * chainId: 1,
131
+ * queryKey: '0x789...', // Vault ID
132
+ * entity: sgVaultInstance
133
+ * });
134
+ */
135
+ createApprovalTransaction(args: InternalTransactionArgs & {
136
+ entity?: RaindexVault;
137
+ }): Promise<Transaction>;
138
+ /**
139
+ * Creates and initializes a new transaction for publishing metadata to the metaboard.
140
+ * @param args - Configuration for the metadata transaction.
141
+ * @param args.txHash - Hash of the metadata transaction.
142
+ * @param args.chainId - Chain ID where the transaction is executed.
143
+ * @param args.queryKey - Identifier used for query invalidation, typically the order hash.
144
+ */
145
+ createMetaTransaction(args: InternalTransactionArgs): Promise<Transaction>;
146
+ /**
147
+ * Creates and initializes a new transaction for depositing funds into a vault.
148
+ * @param args - Configuration for the deposit transaction.
149
+ * @param args.txHash - Hash of the transaction to track.
150
+ * @param args.chainId - Chain ID where the transaction is being executed.
151
+ * @param args.queryKey - The ID of the vault into which funds are deposited (used for query invalidation and UI links).
152
+ * @param args.entity - The `SgVault` entity associated with this transaction.
153
+ * @param args.amount - The amount of tokens being deposited.
154
+ * @returns A new Transaction instance configured for deposit.
155
+ * @example
156
+ * const tx = await manager.createDepositTransaction({
157
+ * txHash: '0xdef...',
158
+ * chainId: 1,
159
+ * queryKey: '0x789...', // Vault ID
160
+ * entity: sgVaultInstance,
161
+ * amount: 1000n
162
+ * });
163
+ */
164
+ createDepositTransaction(args: InternalTransactionArgs & {
165
+ amount: Float;
166
+ entity: RaindexVault;
167
+ raindexClient: RaindexClient;
168
+ }): Promise<Transaction>;
169
+ /**
170
+ * Creates and initializes a new transaction for deploying an order.
171
+ * @param args - Configuration for the deployment transaction.
172
+ * @param args.txHash - Hash of the transaction to track.
173
+ * @param args.chainId - Chain ID where the transaction is being executed.
174
+ * @param args.queryKey - The ID of the vault into which funds are deposited (used for query invalidation and UI links).
175
+ * @returns A new Transaction instance configured for deposit.
176
+ * @example
177
+ * const tx = await manager.createAddOrderTransaction({
178
+ * txHash: '0xdeploytxhash',
179
+ * chainId: 1,
180
+ * queryKey: '0x789...', // Vault ID
181
+ * });
182
+ */
183
+ createAddOrderTransaction(args: InternalTransactionArgs & {
184
+ orderbook: Address;
185
+ raindexClient: RaindexClient;
186
+ }): Promise<Transaction>;
187
+ /**
188
+ * Creates and initializes a new transaction for taking orders.
189
+ * @param args - Configuration for the take order transaction.
190
+ * @param args.txHash - Hash of the transaction to track.
191
+ * @param args.chainId - Chain ID where the transaction is being executed.
192
+ * @param args.queryKey - The hash of the order being taken (used for query invalidation).
193
+ * @param args.entity - The `RaindexOrder` entity associated with this transaction.
194
+ * @returns A new Transaction instance configured for taking orders.
195
+ * @example
196
+ * const tx = await manager.createTakeOrderTransaction({
197
+ * txHash: '0x123...',
198
+ * chainId: 1,
199
+ * queryKey: '0x456...', // Order hash
200
+ * entity: raindexOrderInstance,
201
+ * raindexClient: clientInstance
202
+ * });
203
+ */
204
+ createTakeOrderTransaction(args: InternalTransactionArgs & {
205
+ entity: RaindexOrder;
206
+ raindexClient: RaindexClient;
207
+ }): Promise<Transaction>;
208
+ /**
209
+ * Creates, initializes, and executes a new transaction instance.
210
+ * @param args - Configuration for the transaction.
211
+ * @param args.name - Name or title of the transaction.
212
+ * @param args.errorMessage - Message to display on transaction failure.
213
+ * @param args.successMessage - Message to display on transaction success.
214
+ * @param args.queryKey - Key used for query invalidation.
215
+ * @param args.toastLinks - Array of links to display in toast notifications.
216
+ * @param args.awaitIndexingFn - Optional function to await transaction indexing.
217
+ * @returns A new Transaction instance that has been initialized and started.
218
+ * @private
219
+ */
220
+ private createTransaction;
221
+ /**
222
+ * Retrieves the store containing all active transactions.
223
+ * @returns A readable store containing all active Transaction instances.
224
+ * @example
225
+ * const transactionsStore = manager.getTransactions();
226
+ * transactionsStore.subscribe(transactions => console.log(transactions));
227
+ */
228
+ getTransactions(): Readable<Transaction[]>;
229
+ /**
230
+ * Removes all transactions from the store, resetting the transaction tracking state.
231
+ * @example
232
+ * manager.clearTransactions(); // Clear all tracked transactions
233
+ */
234
+ clearTransactions(): void;
235
+ }