@rainlanguage/ui-components 0.0.1-alpha.237 → 0.0.1-alpha.239

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 (176) hide show
  1. package/README.md +14 -6
  2. package/dist/__fixtures__/settings.yaml +18 -20
  3. package/dist/__mocks__/MockCodeMirrorEditor.svelte +17 -0
  4. package/dist/__mocks__/MockCodeMirrorEditor.svelte.d.ts +21 -0
  5. package/dist/__mocks__/MockComponent.js +1 -1
  6. package/dist/__mocks__/MockComponent.svelte +7 -3
  7. package/dist/__mocks__/MockComponent.svelte.d.ts +1 -0
  8. package/dist/__mocks__/mockWeb3Config.d.ts +1 -1
  9. package/dist/__mocks__/mockWeb3Config.js +10 -7
  10. package/dist/__mocks__/queries.js +9 -9
  11. package/dist/__mocks__/stores.d.ts +4 -4
  12. package/dist/__mocks__/stores.js +40 -40
  13. package/dist/app.css +3 -3
  14. package/dist/components/ButtonDarkMode.svelte +7 -1
  15. package/dist/components/ButtonScrub.svelte +22 -0
  16. package/dist/components/ButtonScrub.svelte.d.ts +25 -0
  17. package/dist/components/ButtonVaultLink.svelte +3 -2
  18. package/dist/components/ButtonVaultLink.svelte.d.ts +2 -2
  19. package/dist/components/CodeMirrorRainlang.svelte +19 -2
  20. package/dist/components/CodeMirrorRainlang.svelte.d.ts +2 -1
  21. package/dist/components/Hash.svelte +3 -2
  22. package/dist/components/{ListViewOrderbookFilters.svelte → ListViewRaindexFilters.svelte} +7 -7
  23. package/dist/components/{ListViewOrderbookFilters.svelte.d.ts → ListViewRaindexFilters.svelte.d.ts} +7 -7
  24. package/dist/components/LocalDbStatusBadge.svelte.d.ts +1 -1
  25. package/dist/components/LocalDbStatusCard.svelte +7 -4
  26. package/dist/components/LocalDbStatusCard.svelte.d.ts +2 -2
  27. package/dist/components/LocalDbStatusModal.svelte +16 -14
  28. package/dist/components/LocalDbStatusModal.svelte.d.ts +2 -2
  29. package/dist/components/OrderOrVaultHash.svelte +2 -2
  30. package/dist/components/OrderOrVaultHash.svelte.d.ts +2 -2
  31. package/dist/components/Sensitive.svelte +16 -0
  32. package/dist/components/Sensitive.svelte.d.ts +28 -0
  33. package/dist/components/TanstackAppTable.svelte +146 -87
  34. package/dist/components/TanstackAppTable.svelte.d.ts +1 -1
  35. package/dist/components/VaultBalanceChangeTypeFilter.svelte +1 -1
  36. package/dist/components/VaultBalanceChangeTypeFilter.svelte.d.ts +1 -1
  37. package/dist/components/VaultCard.svelte +1 -1
  38. package/dist/components/VaultCard.svelte.d.ts +1 -1
  39. package/dist/components/charts/OrderTradesChart.svelte +116 -97
  40. package/dist/components/charts/OrderTradesChart.svelte.d.ts +2 -2
  41. package/dist/components/charts/transformAndSortData.d.ts +1 -1
  42. package/dist/components/charts/transformAndSortData.js +19 -19
  43. package/dist/components/deployment/DeploymentSteps.svelte +5 -2
  44. package/dist/components/deployment/DeploymentSteps.svelte.d.ts +1 -1
  45. package/dist/components/deployment/DeploymentsSection.svelte.d.ts +1 -1
  46. package/dist/components/deployment/DepositInput.svelte +1 -1
  47. package/dist/components/deployment/DepositInput.svelte.d.ts +1 -1
  48. package/dist/components/deployment/FieldDefinitionInput.svelte +1 -1
  49. package/dist/components/deployment/FieldDefinitionInput.svelte.d.ts +1 -1
  50. package/dist/components/deployment/OrderPage.svelte.d.ts +1 -1
  51. package/dist/components/deployment/SelectToken.svelte.d.ts +1 -1
  52. package/dist/components/deployment/TokenIOInput.svelte +1 -1
  53. package/dist/components/deployment/TokenIOInput.svelte.d.ts +1 -1
  54. package/dist/components/deployment/TokenSelectionModal.svelte.d.ts +1 -1
  55. package/dist/components/detail/OrderDetail.svelte +12 -6
  56. package/dist/components/detail/OrderDetail.svelte.d.ts +2 -2
  57. package/dist/components/detail/TanstackOrderQuote.svelte +22 -0
  58. package/dist/components/detail/TanstackOrderQuote.svelte.d.ts +1 -1
  59. package/dist/components/detail/VaultDetail.svelte +12 -10
  60. package/dist/components/detail/VaultDetail.svelte.d.ts +2 -2
  61. package/dist/components/dropdown/{DropdownOrderbooksFilter.svelte → DropdownRaindexesFilter.svelte} +54 -54
  62. package/dist/components/dropdown/DropdownRaindexesFilter.svelte.d.ts +25 -0
  63. package/dist/components/dropdown/DropdownTokensFilter.svelte.d.ts +1 -1
  64. package/dist/components/icon/Refresh.svelte +2 -1
  65. package/dist/components/icon/Refresh.svelte.d.ts +1 -0
  66. package/dist/components/input/InputTokenAmount.svelte +16 -1
  67. package/dist/components/input/InputTokenAmount.svelte.d.ts +1 -1
  68. package/dist/components/tables/OrderTradesListTable.svelte +113 -98
  69. package/dist/components/tables/OrderTradesListTable.svelte.d.ts +1 -1
  70. package/dist/components/tables/OrderVaultsVolTable.svelte +1 -1
  71. package/dist/components/tables/OrderVaultsVolTable.svelte.d.ts +1 -1
  72. package/dist/components/tables/OrdersListTable.svelte +19 -17
  73. package/dist/components/tables/OrdersListTable.svelte.d.ts +1 -1
  74. package/dist/components/tables/VaultBalanceChangesTable.svelte +1 -1
  75. package/dist/components/tables/VaultBalanceChangesTable.svelte.d.ts +1 -1
  76. package/dist/components/tables/VaultsListTable.svelte +24 -21
  77. package/dist/components/tables/VaultsListTable.svelte.d.ts +2 -2
  78. package/dist/components/transactions/FixedBottomTransaction.svelte +1 -0
  79. package/dist/components/transactions/getStatusEmoji.d.ts +1 -1
  80. package/dist/components/transactions/getStatusEmoji.js +13 -13
  81. package/dist/consts.js +1 -1
  82. package/dist/errors/DeploymentStepsError.js +3 -3
  83. package/dist/errors/index.d.ts +1 -1
  84. package/dist/errors/index.js +1 -1
  85. package/dist/hooks/useLocalDb.d.ts +1 -1
  86. package/dist/hooks/useLocalDb.js +3 -3
  87. package/dist/hooks/useRaindexClient.d.ts +1 -1
  88. package/dist/hooks/useRaindexClient.js +4 -4
  89. package/dist/hooks/useRaindexOrderBuilder.d.ts +1 -1
  90. package/dist/hooks/useRaindexOrderBuilder.js +4 -4
  91. package/dist/index.d.ts +122 -114
  92. package/dist/index.js +115 -109
  93. package/dist/models/Transaction.d.ts +4 -4
  94. package/dist/models/Transaction.js +9 -9
  95. package/dist/providers/RaindexClientProvider.svelte +1 -1
  96. package/dist/providers/RaindexClientProvider.svelte.d.ts +1 -1
  97. package/dist/providers/RaindexOrderBuilderProvider.svelte +1 -1
  98. package/dist/providers/RaindexOrderBuilderProvider.svelte.d.ts +1 -1
  99. package/dist/providers/dotrainRegistry/DotrainRegistryProvider.svelte.d.ts +1 -1
  100. package/dist/providers/dotrainRegistry/context.d.ts +2 -2
  101. package/dist/providers/dotrainRegistry/context.js +13 -10
  102. package/dist/providers/dotrainRegistry/useDotrainRegistry.d.ts +1 -1
  103. package/dist/providers/dotrainRegistry/useDotrainRegistry.js +8 -8
  104. package/dist/providers/registry/RegistryManager.js +8 -7
  105. package/dist/providers/registry/context.d.ts +1 -1
  106. package/dist/providers/registry/context.js +9 -9
  107. package/dist/providers/registry/useRegistry.d.ts +1 -1
  108. package/dist/providers/registry/useRegistry.js +5 -5
  109. package/dist/providers/toasts/context.d.ts +2 -2
  110. package/dist/providers/toasts/context.js +4 -4
  111. package/dist/providers/toasts/useToasts.d.ts +1 -1
  112. package/dist/providers/toasts/useToasts.js +4 -4
  113. package/dist/providers/transactions/TransactionManager.d.ts +14 -15
  114. package/dist/providers/transactions/TransactionManager.js +107 -107
  115. package/dist/providers/transactions/context.d.ts +1 -1
  116. package/dist/providers/transactions/context.js +4 -4
  117. package/dist/providers/transactions/useTransactions.js +2 -2
  118. package/dist/providers/wallet/context.d.ts +1 -1
  119. package/dist/providers/wallet/context.js +11 -11
  120. package/dist/providers/wallet/useAccount.js +27 -27
  121. package/dist/queries/keys.js +10 -10
  122. package/dist/queries/queryClient.d.ts +1 -1
  123. package/dist/queries/queryClient.js +8 -8
  124. package/dist/services/awaitTransactionIndexing.d.ts +8 -8
  125. package/dist/services/awaitTransactionIndexing.js +10 -8
  126. package/dist/services/getExplorerLink.js +2 -2
  127. package/dist/services/handleShareChoices.d.ts +1 -1
  128. package/dist/services/handleShareChoices.js +4 -4
  129. package/dist/services/historicalOrderCharts.d.ts +2 -2
  130. package/dist/services/historicalOrderCharts.js +260 -201
  131. package/dist/services/index.d.ts +5 -3
  132. package/dist/services/index.js +3 -2
  133. package/dist/services/loadRegistryUrl.d.ts +1 -1
  134. package/dist/services/loadRegistryUrl.js +5 -5
  135. package/dist/services/pairTradesChartData.d.ts +2 -2
  136. package/dist/services/pairTradesChartData.js +28 -24
  137. package/dist/services/registry.d.ts +1 -1
  138. package/dist/services/registry.js +10 -10
  139. package/dist/services/time.d.ts +1 -1
  140. package/dist/services/time.js +35 -35
  141. package/dist/services/validateAmount.d.ts +30 -0
  142. package/dist/services/validateAmount.js +53 -0
  143. package/dist/storesGeneric/cachedWritableStore.d.ts +2 -2
  144. package/dist/storesGeneric/cachedWritableStore.js +3 -3
  145. package/dist/storesGeneric/scrub.d.ts +14 -0
  146. package/dist/storesGeneric/scrub.js +22 -0
  147. package/dist/test/matchers.d.ts +2 -2
  148. package/dist/test/matchers.js +2 -2
  149. package/dist/types/account.d.ts +2 -2
  150. package/dist/types/appStores.d.ts +3 -3
  151. package/dist/types/modal.d.ts +3 -3
  152. package/dist/types/order.d.ts +1 -1
  153. package/dist/types/toast.d.ts +2 -2
  154. package/dist/types/tokenBalance.d.ts +1 -1
  155. package/dist/types/transaction.d.ts +4 -4
  156. package/dist/utils/breadcrumbs.js +2 -2
  157. package/dist/utils/codeMirrorThemes.js +80 -74
  158. package/dist/utils/configHelpers.d.ts +1 -1
  159. package/dist/utils/configHelpers.js +6 -6
  160. package/dist/utils/constructHashLink.d.ts +3 -3
  161. package/dist/utils/constructHashLink.js +39 -37
  162. package/dist/utils/getNetworkName.js +5 -5
  163. package/dist/utils/hex.js +1 -1
  164. package/dist/utils/lightweightChartsThemes.d.ts +1 -1
  165. package/dist/utils/lightweightChartsThemes.js +11 -11
  166. package/dist/utils/localDbStatus.d.ts +26 -0
  167. package/dist/utils/localDbStatus.js +22 -0
  168. package/dist/utils/number.js +5 -3
  169. package/dist/utils/stripTrailingWhitespace.d.ts +16 -0
  170. package/dist/utils/stripTrailingWhitespace.js +22 -0
  171. package/dist/utils/tokens.d.ts +1 -1
  172. package/dist/utils/tokens.js +1 -1
  173. package/dist/utils/vaultBalanceChangeLabels.d.ts +1 -1
  174. package/dist/utils/vaultBalanceChangeLabels.js +11 -11
  175. package/package.json +89 -89
  176. package/dist/components/dropdown/DropdownOrderbooksFilter.svelte.d.ts +0 -25
@@ -1,7 +1,7 @@
1
- import { get } from 'svelte/store';
2
- import { isAddress, isAddressEqual } from 'viem';
3
- import { getAccountContext } from './context';
4
- import { readable } from 'svelte/store';
1
+ import { get } from "svelte/store";
2
+ import { isAddress, isAddressEqual } from "viem";
3
+ import { getAccountContext } from "./context";
4
+ import { readable } from "svelte/store";
5
5
  /**
6
6
  * Hook to access wallet account information from context
7
7
  * Must be used within a component that is a child of WalletProvider
@@ -33,30 +33,30 @@ export function useAccount() {
33
33
  };
34
34
  return {
35
35
  account,
36
- matchesAccount
36
+ matchesAccount,
37
37
  };
38
38
  }
39
39
  if (import.meta.vitest) {
40
40
  const { describe, it, expect, vi, beforeEach } = import.meta.vitest;
41
- vi.mock('viem', async () => {
42
- const actual = await vi.importActual('viem');
41
+ vi.mock("viem", async () => {
42
+ const actual = await vi.importActual("viem");
43
43
  return {
44
44
  ...actual,
45
45
  isAddress: vi.fn(),
46
- isAddressEqual: vi.fn()
46
+ isAddressEqual: vi.fn(),
47
47
  };
48
48
  });
49
- vi.mock('./context', () => ({
50
- getAccountContext: vi.fn()
49
+ vi.mock("./context", () => ({
50
+ getAccountContext: vi.fn(),
51
51
  }));
52
- vi.mock('svelte/store', async () => {
53
- const actual = await vi.importActual('svelte/store');
52
+ vi.mock("svelte/store", async () => {
53
+ const actual = await vi.importActual("svelte/store");
54
54
  return {
55
55
  ...actual,
56
- get: vi.fn()
56
+ get: vi.fn(),
57
57
  };
58
58
  });
59
- describe('useAccount', () => {
59
+ describe("useAccount", () => {
60
60
  const mockGetAccountContext = vi.mocked(getAccountContext);
61
61
  const mockGet = vi.mocked(get);
62
62
  const mockIsAddress = vi.mocked(isAddress);
@@ -64,24 +64,24 @@ if (import.meta.vitest) {
64
64
  beforeEach(() => {
65
65
  vi.clearAllMocks();
66
66
  });
67
- it('should return account wrapped in an object', () => {
68
- const mockAccountStore = readable('0x123');
67
+ it("should return account wrapped in an object", () => {
68
+ const mockAccountStore = readable("0x123");
69
69
  mockGetAccountContext.mockReturnValue(mockAccountStore);
70
70
  const result = useAccount();
71
71
  expect(mockGetAccountContext).toHaveBeenCalled();
72
72
  expect(result.account).toBe(mockAccountStore);
73
73
  expect(result.matchesAccount).toBeInstanceOf(Function);
74
74
  });
75
- describe('matchesAccount', () => {
76
- const mockAccountStore = readable('0x123');
77
- const currentAccount = '0x123';
78
- const testAddress1 = '0x123';
79
- const testAddress2 = '0xdef';
80
- const invalidAddress = 'invalid';
75
+ describe("matchesAccount", () => {
76
+ const mockAccountStore = readable("0x123");
77
+ const currentAccount = "0x123";
78
+ const testAddress1 = "0x123";
79
+ const testAddress2 = "0xdef";
80
+ const invalidAddress = "invalid";
81
81
  beforeEach(() => {
82
82
  mockGetAccountContext.mockReturnValue(mockAccountStore);
83
83
  });
84
- it('should return true if addresses are valid and equal', () => {
84
+ it("should return true if addresses are valid and equal", () => {
85
85
  // Setup mocks
86
86
  mockGet.mockReturnValue(currentAccount);
87
87
  mockIsAddress.mockReturnValue(true);
@@ -94,7 +94,7 @@ if (import.meta.vitest) {
94
94
  expect(mockIsAddressEqual).toHaveBeenCalledWith(currentAccount, testAddress1);
95
95
  expect(result).toBe(true);
96
96
  });
97
- it('should return false if addresses are valid but not equal', () => {
97
+ it("should return false if addresses are valid but not equal", () => {
98
98
  // Setup mocks
99
99
  mockGet.mockReturnValue(currentAccount);
100
100
  mockIsAddress.mockReturnValue(true);
@@ -107,7 +107,7 @@ if (import.meta.vitest) {
107
107
  expect(mockIsAddressEqual).toHaveBeenCalledWith(currentAccount, testAddress2);
108
108
  expect(result).toBe(false);
109
109
  });
110
- it('should return false if current account is not set', () => {
110
+ it("should return false if current account is not set", () => {
111
111
  // Setup mocks
112
112
  mockGet.mockReturnValue(null);
113
113
  const { matchesAccount } = useAccount();
@@ -117,7 +117,7 @@ if (import.meta.vitest) {
117
117
  expect(mockIsAddressEqual).not.toHaveBeenCalled();
118
118
  expect(result).toBe(false);
119
119
  });
120
- it('should return false if provided address is invalid', () => {
120
+ it("should return false if provided address is invalid", () => {
121
121
  // Setup mocks
122
122
  mockGet.mockReturnValue(currentAccount);
123
123
  // This is crucial: we need to ensure short-circuit evaluation works correctly
@@ -134,7 +134,7 @@ if (import.meta.vitest) {
134
134
  expect(mockIsAddressEqual).not.toHaveBeenCalled(); // This should now pass
135
135
  expect(result).toBe(false);
136
136
  });
137
- it('should return false if provided address is null', () => {
137
+ it("should return false if provided address is null", () => {
138
138
  // Setup mocks
139
139
  mockGet.mockReturnValue(currentAccount);
140
140
  const { matchesAccount } = useAccount();
@@ -1,10 +1,10 @@
1
- export const QKEY_VAULTS = 'vaults';
2
- export const QKEY_VAULT = 'vault';
3
- export const QKEY_VAULT_CHANGES = 'vaultBalanceChanges';
4
- export const QKEY_ORDERS = 'orders';
5
- export const QKEY_ORDER = 'order';
6
- export const QKEY_ORDER_TRADES_LIST = 'orderTradesList';
7
- export const QKEY_ORDER_QUOTE = 'orderQuote';
8
- export const QKEY_VAULTS_VOL_LIST = 'orderVaultsVolumeList';
9
- export const QKEY_ORDER_APY = 'orderApy';
10
- export const QKEY_TOKENS = 'tokens';
1
+ export const QKEY_VAULTS = "vaults";
2
+ export const QKEY_VAULT = "vault";
3
+ export const QKEY_VAULT_CHANGES = "vaultBalanceChanges";
4
+ export const QKEY_ORDERS = "orders";
5
+ export const QKEY_ORDER = "order";
6
+ export const QKEY_ORDER_TRADES_LIST = "orderTradesList";
7
+ export const QKEY_ORDER_QUOTE = "orderQuote";
8
+ export const QKEY_VAULTS_VOL_LIST = "orderVaultsVolumeList";
9
+ export const QKEY_ORDER_APY = "orderApy";
10
+ export const QKEY_TOKENS = "tokens";
@@ -1,3 +1,3 @@
1
- import { QueryClient } from '@tanstack/svelte-query';
1
+ import { QueryClient } from "@tanstack/svelte-query";
2
2
  export declare const queryClient: QueryClient;
3
3
  export declare const invalidateTanstackQueries: (queryClient: QueryClient, queryKey: string[]) => Promise<void>;
@@ -1,21 +1,21 @@
1
- import { browser } from '$app/environment';
2
- import { QueryClient } from '@tanstack/svelte-query';
1
+ import { browser } from "$app/environment";
2
+ import { QueryClient } from "@tanstack/svelte-query";
3
3
  export const queryClient = new QueryClient({
4
4
  defaultOptions: {
5
5
  queries: {
6
- enabled: browser
7
- }
8
- }
6
+ enabled: browser,
7
+ },
8
+ },
9
9
  });
10
10
  export const invalidateTanstackQueries = async (queryClient, queryKey) => {
11
11
  try {
12
12
  await queryClient.invalidateQueries({
13
13
  queryKey,
14
- refetchType: 'all',
15
- exact: false
14
+ refetchType: "all",
15
+ exact: false,
16
16
  });
17
17
  }
18
18
  catch {
19
- throw new Error('Failed to refresh data.');
19
+ throw new Error("Failed to refresh data.");
20
20
  }
21
21
  };
@@ -2,13 +2,13 @@
2
2
  * @module awaitTransactionIndexing
3
3
  * @description Utilities for waiting for transactions to be indexed by a subgraph
4
4
  */
5
- import type { WasmEncodedResult, RaindexTransaction, RaindexOrder, Address, Hex } from '@rainlanguage/orderbook';
5
+ import type { WasmEncodedResult, RaindexTransaction, RaindexOrder, Address, Hex } from "@rainlanguage/raindex";
6
6
  export type AwaitSubgraphConfig = {
7
7
  chainId: number;
8
- orderbook: Address;
8
+ raindex: Address;
9
9
  txHash: Hex;
10
10
  successMessage: string;
11
- fetchEntityFn: (chainId: number, orderbook: Address, txHash: Hex) => Promise<WasmEncodedResult<RaindexTransaction | RaindexOrder[] | null | undefined>>;
11
+ fetchEntityFn: (chainId: number, raindex: Address, txHash: Hex) => Promise<WasmEncodedResult<RaindexTransaction | RaindexOrder[] | null | undefined>>;
12
12
  isSuccess: (data: RaindexTransaction | RaindexOrder[]) => boolean;
13
13
  };
14
14
  /**
@@ -53,7 +53,7 @@ export type IndexingResult<T> = {
53
53
  * @template T The type of data returned by the subgraph
54
54
  * @param options Configuration options for the indexing operation
55
55
  * @param options.chainId Chain ID to query
56
- * @param options.orderbook Orderbook address to query
56
+ * @param options.raindex Raindex address to query
57
57
  * @param options.txHash Transaction hash to check for indexing
58
58
  * @param options.successMessage Message to display on successful indexing
59
59
  * @param options.maxAttempts Maximum number of attempts before timing out (default: 10)
@@ -69,9 +69,9 @@ export declare const awaitSubgraphIndexing: <T>(options: {
69
69
  */
70
70
  chainId: number;
71
71
  /**
72
- * Orderbook address to query
72
+ * Raindex address to query
73
73
  */
74
- orderbook: Address;
74
+ raindex: Address;
75
75
  /**
76
76
  * Transaction hash to check for indexing
77
77
  */
@@ -95,10 +95,10 @@ export declare const awaitSubgraphIndexing: <T>(options: {
95
95
  /**
96
96
  * Function to fetch data from the subgraph
97
97
  * @param chainId Chain ID to query
98
- * @param orderbook Orderbook address to query
98
+ * @param raindex Raindex address to query
99
99
  * @param txHash Transaction hash to query
100
100
  */
101
- fetchEntityFn: (chainId: number, orderbook: Address, txHash: Hex) => Promise<WasmEncodedResult<T | null | undefined>>;
101
+ fetchEntityFn: (chainId: number, raindex: Address, txHash: Hex) => Promise<WasmEncodedResult<T | null | undefined>>;
102
102
  /**
103
103
  * Function to determine if the fetched data indicates success
104
104
  * @param data The data returned from the subgraph
@@ -2,7 +2,7 @@
2
2
  * @module awaitTransactionIndexing
3
3
  * @description Utilities for waiting for transactions to be indexed by a subgraph
4
4
  */
5
- import { TransactionStoreErrorMessage } from '../types/transaction';
5
+ import { TransactionStoreErrorMessage } from "../types/transaction";
6
6
  /**
7
7
  * Generic function to handle waiting for subgraph indexing
8
8
  * Returns a promise that resolves with an object containing either value or error
@@ -10,7 +10,7 @@ import { TransactionStoreErrorMessage } from '../types/transaction';
10
10
  * @template T The type of data returned by the subgraph
11
11
  * @param options Configuration options for the indexing operation
12
12
  * @param options.chainId Chain ID to query
13
- * @param options.orderbook Orderbook address to query
13
+ * @param options.raindex Raindex address to query
14
14
  * @param options.txHash Transaction hash to check for indexing
15
15
  * @param options.successMessage Message to display on successful indexing
16
16
  * @param options.maxAttempts Maximum number of attempts before timing out (default: 10)
@@ -21,15 +21,17 @@ import { TransactionStoreErrorMessage } from '../types/transaction';
21
21
  * @returns Promise resolving to an IndexingResult
22
22
  */
23
23
  export const awaitSubgraphIndexing = async (options) => {
24
- const { chainId, orderbook, txHash, successMessage, maxAttempts = 10, interval = 1000, network, fetchEntityFn, isSuccess } = options;
24
+ const { chainId, raindex, txHash, successMessage, maxAttempts = 10, interval = 1000, network, fetchEntityFn, isSuccess, } = options;
25
25
  const checkIndexing = async (attempt) => {
26
26
  try {
27
- const data = await fetchEntityFn(chainId, orderbook, txHash);
27
+ const data = await fetchEntityFn(chainId, raindex, txHash);
28
28
  if (data.value && isSuccess(data.value)) {
29
29
  let newOrderHash;
30
30
  // Extract orderHash from order data if it exists in the expected format
31
31
  // This only applies to addOrder transactions
32
- if (Array.isArray(data.value) && data.value.length > 0 && data.value[0]?.orderHash) {
32
+ if (Array.isArray(data.value) &&
33
+ data.value.length > 0 &&
34
+ data.value[0]?.orderHash) {
33
35
  newOrderHash = data.value[0].orderHash;
34
36
  }
35
37
  return {
@@ -38,8 +40,8 @@ export const awaitSubgraphIndexing = async (options) => {
38
40
  successMessage,
39
41
  orderHash: newOrderHash,
40
42
  network,
41
- data: data.value
42
- }
43
+ data: data.value,
44
+ },
43
45
  };
44
46
  }
45
47
  }
@@ -48,7 +50,7 @@ export const awaitSubgraphIndexing = async (options) => {
48
50
  }
49
51
  if (attempt >= maxAttempts) {
50
52
  return {
51
- error: TransactionStoreErrorMessage.SUBGRAPH_TIMEOUT_ERROR
53
+ error: TransactionStoreErrorMessage.SUBGRAPH_TIMEOUT_ERROR,
52
54
  };
53
55
  }
54
56
  await new Promise((resolve) => setTimeout(resolve, interval));
@@ -1,8 +1,8 @@
1
- import * as chains from 'viem/chains';
1
+ import * as chains from "viem/chains";
2
2
  export const getExplorerLink = (hash, chainId, type) => {
3
3
  const chain = Object.values(chains).find((chain) => chain.id === chainId);
4
4
  if (chain?.blockExplorers) {
5
5
  return chain.blockExplorers.default.url + `/${type}/${hash}`;
6
6
  }
7
- return '';
7
+ return "";
8
8
  };
@@ -1,2 +1,2 @@
1
- import type { RaindexOrderBuilder } from '@rainlanguage/orderbook';
1
+ import type { RaindexOrderBuilder } from "@rainlanguage/raindex";
2
2
  export declare function handleShareChoices(builder: RaindexOrderBuilder, registryUrl: string): Promise<void>;
@@ -1,5 +1,5 @@
1
- import { page } from '$app/stores';
2
- import { get } from 'svelte/store';
1
+ import { page } from "$app/stores";
2
+ import { get } from "svelte/store";
3
3
  export async function handleShareChoices(builder, registryUrl) {
4
4
  // get the current url
5
5
  const url = get(page).url;
@@ -9,7 +9,7 @@ export async function handleShareChoices(builder, registryUrl) {
9
9
  throw new Error(result.error.msg);
10
10
  }
11
11
  const state = result.value;
12
- url.searchParams.set('state', state || '');
13
- url.searchParams.set('registry', registryUrl);
12
+ url.searchParams.set("state", state || "");
13
+ url.searchParams.set("registry", registryUrl);
14
14
  navigator.clipboard.writeText(url.toString());
15
15
  }
@@ -1,5 +1,5 @@
1
- import type { RaindexTrade } from '@rainlanguage/orderbook';
2
- import type { UTCTimestamp } from 'lightweight-charts';
1
+ import type { RaindexTrade } from "@rainlanguage/raindex";
2
+ import type { UTCTimestamp } from "lightweight-charts";
3
3
  export type HistoricalOrderChartData = {
4
4
  value: number;
5
5
  time: UTCTimestamp;