@rainlanguage/ui-components 0.0.1-alpha.24 → 0.0.1-alpha.241
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.
- package/README.md +14 -6
- package/dist/__fixtures__/settings.yaml +123 -0
- package/dist/__mocks__/CodeMirrorRainlang.svelte +4 -0
- package/dist/__mocks__/CodeMirrorRainlang.svelte.d.ts +18 -0
- package/dist/__mocks__/MockCodeMirrorEditor.svelte +17 -0
- package/dist/__mocks__/MockCodeMirrorEditor.svelte.d.ts +21 -0
- package/dist/__mocks__/MockComponent.js +1 -1
- package/dist/__mocks__/MockComponent.svelte +10 -2
- package/dist/__mocks__/MockComponent.svelte.d.ts +4 -1
- package/dist/__mocks__/mockWeb3Config.d.ts +1 -1
- package/dist/__mocks__/mockWeb3Config.js +10 -7
- package/dist/__mocks__/queries.js +9 -9
- package/dist/__mocks__/stores.d.ts +55 -45
- package/dist/__mocks__/stores.js +85 -68
- package/dist/app.css +3 -3
- package/dist/components/ButtonDarkMode.svelte +7 -1
- package/dist/components/ButtonLoading.svelte +1 -1
- package/dist/components/ButtonScrub.svelte +22 -0
- package/dist/components/ButtonScrub.svelte.d.ts +25 -0
- package/dist/components/ButtonVaultLink.svelte +12 -11
- package/dist/components/ButtonVaultLink.svelte.d.ts +4 -3
- package/dist/components/CheckboxInactiveOrdersVault.svelte +20 -0
- package/dist/components/CheckboxInactiveOrdersVault.svelte.d.ts +19 -0
- package/dist/components/CheckboxZeroBalanceVault.svelte.d.ts +2 -2
- package/dist/components/CodeMirrorDotrain.svelte +4 -0
- package/dist/components/CodeMirrorDotrain.svelte.d.ts +1 -0
- package/dist/components/CodeMirrorRainlang.svelte +20 -12
- package/dist/components/CodeMirrorRainlang.svelte.d.ts +3 -2
- package/dist/components/EditableSpan.svelte +3 -14
- package/dist/components/EditableSpan.svelte.d.ts +0 -1
- package/dist/components/Hash.svelte +6 -5
- package/dist/components/License.svelte +5 -4
- package/dist/components/ListViewRaindexFilters.svelte +64 -0
- package/dist/components/ListViewRaindexFilters.svelte.d.ts +32 -0
- package/dist/components/LocalDbStatusBadge.svelte +27 -0
- package/dist/components/LocalDbStatusBadge.svelte.d.ts +19 -0
- package/dist/components/LocalDbStatusCard.svelte +43 -0
- package/dist/components/LocalDbStatusCard.svelte.d.ts +20 -0
- package/dist/components/LocalDbStatusModal.svelte +105 -0
- package/dist/components/LocalDbStatusModal.svelte.d.ts +21 -0
- package/dist/components/OrderOrVaultHash.svelte +12 -12
- package/dist/components/OrderOrVaultHash.svelte.d.ts +4 -4
- package/dist/components/PageHeader.svelte +1 -1
- package/dist/components/Sensitive.svelte +16 -0
- package/dist/components/Sensitive.svelte.d.ts +28 -0
- package/dist/components/TanstackAppTable.svelte +270 -60
- package/dist/components/TanstackAppTable.svelte.d.ts +15 -9
- package/dist/components/ToastDetail.svelte +42 -0
- package/dist/components/ToastDetail.svelte.d.ts +20 -0
- package/dist/components/Tooltip.svelte +8 -0
- package/dist/components/Tooltip.svelte.d.ts +21 -0
- package/dist/components/VaultBalanceChangeTypeFilter.svelte +23 -0
- package/dist/components/VaultBalanceChangeTypeFilter.svelte.d.ts +19 -0
- package/dist/components/VaultCard.svelte +18 -0
- package/dist/components/VaultCard.svelte.d.ts +19 -0
- package/dist/components/charts/LightweightChart.svelte +1 -1
- package/dist/components/charts/LightweightChart.svelte.d.ts +5 -5
- package/dist/components/charts/OrderTradesChart.svelte +319 -28
- package/dist/components/charts/OrderTradesChart.svelte.d.ts +4 -4
- package/dist/components/charts/TanstackLightweightChartLine.svelte +5 -9
- package/dist/components/charts/VaultBalanceChart.svelte +8 -26
- package/dist/components/charts/VaultBalanceChart.svelte.d.ts +1 -7
- package/dist/components/charts/transformAndSortData.d.ts +24 -0
- package/dist/components/charts/transformAndSortData.js +111 -0
- package/dist/components/checkbox/CheckboxActiveOrders.svelte +11 -0
- package/dist/components/checkbox/CheckboxActiveOrders.svelte.d.ts +19 -0
- package/dist/components/deployment/ButtonSelectOption.svelte +2 -0
- package/dist/components/deployment/ButtonSelectOption.svelte.d.ts +1 -0
- package/dist/components/deployment/ComposedRainlangModal.svelte +3 -2
- package/dist/components/deployment/ComposedRainlangModal.svelte.d.ts +1 -4
- package/dist/components/deployment/DeploymentSectionHeader.svelte +7 -4
- package/dist/components/deployment/DeploymentSteps.svelte +196 -221
- package/dist/components/deployment/DeploymentSteps.svelte.d.ts +6 -12
- package/dist/components/deployment/DeploymentTile.svelte +2 -2
- package/dist/components/deployment/DeploymentTile.svelte.d.ts +1 -1
- package/dist/components/deployment/DeploymentsSection.svelte +15 -22
- package/dist/components/deployment/DeploymentsSection.svelte.d.ts +3 -2
- package/dist/components/deployment/DepositInput.svelte +10 -11
- package/dist/components/deployment/DepositInput.svelte.d.ts +2 -3
- package/dist/components/deployment/DisclaimerModal.svelte +6 -7
- package/dist/components/deployment/FieldDefinitionInput.svelte +10 -14
- package/dist/components/deployment/FieldDefinitionInput.svelte.d.ts +2 -3
- package/dist/components/deployment/InvalidOrdersSection.svelte +17 -0
- package/dist/components/deployment/InvalidOrdersSection.svelte.d.ts +19 -0
- package/dist/components/deployment/{StrategyPage.svelte → OrderPage.svelte} +15 -24
- package/dist/components/deployment/OrderPage.svelte.d.ts +21 -0
- package/dist/components/deployment/SelectToken.svelte +127 -50
- package/dist/components/deployment/SelectToken.svelte.d.ts +5 -4
- package/dist/components/deployment/TokenBalance.svelte +19 -0
- package/dist/components/deployment/TokenBalance.svelte.d.ts +19 -0
- package/dist/components/deployment/TokenIOInput.svelte +27 -17
- package/dist/components/deployment/TokenIOInput.svelte.d.ts +3 -3
- package/dist/components/deployment/TokenSelectionModal.svelte +148 -0
- package/dist/components/deployment/TokenSelectionModal.svelte.d.ts +20 -0
- package/dist/components/deployment/{ValidStrategiesSection.svelte → ValidOrdersSection.svelte} +7 -7
- package/dist/components/deployment/ValidOrdersSection.svelte.d.ts +19 -0
- package/dist/components/deployment/VaultIdInformation.svelte +17 -0
- package/dist/components/deployment/VaultIdInformation.svelte.d.ts +21 -0
- package/dist/components/detail/OrderDetail.svelte +220 -82
- package/dist/components/detail/OrderDetail.svelte.d.ts +21 -15
- package/dist/components/detail/TanstackOrderQuote.svelte +114 -46
- package/dist/components/detail/TanstackOrderQuote.svelte.d.ts +14 -16
- package/dist/components/detail/VaultDetail.svelte +82 -79
- package/dist/components/detail/VaultDetail.svelte.d.ts +12 -18
- package/dist/components/dropdown/DropdownActiveNetworks.svelte +44 -0
- package/dist/components/dropdown/DropdownActiveNetworks.svelte.d.ts +19 -0
- package/dist/components/dropdown/DropdownCheckbox.svelte +4 -4
- package/dist/components/dropdown/DropdownRaindexesFilter.svelte +172 -0
- package/dist/components/dropdown/DropdownRaindexesFilter.svelte.d.ts +25 -0
- package/dist/components/dropdown/DropdownTokensFilter.svelte +152 -0
- package/dist/components/dropdown/DropdownTokensFilter.svelte.d.ts +28 -0
- package/dist/components/icon/Refresh.svelte +4 -2
- package/dist/components/icon/Refresh.svelte.d.ts +2 -0
- package/dist/components/input/InputOrderHash.svelte +1 -1
- package/dist/components/input/InputOrderHash.svelte.d.ts +3 -3
- package/dist/components/input/InputOwnerFilter.svelte +48 -0
- package/dist/components/input/InputOwnerFilter.svelte.d.ts +19 -0
- package/dist/components/input/InputRegistryUrl.svelte +36 -14
- package/dist/components/input/InputToken.svelte +2 -2
- package/dist/components/input/InputTokenAmount.svelte +30 -20
- package/dist/components/input/InputTokenAmount.svelte.d.ts +3 -3
- package/dist/components/tables/OrderAPY.svelte +6 -33
- package/dist/components/tables/OrderAPY.svelte.d.ts +1 -4
- package/dist/components/tables/OrderTradesListTable.svelte +132 -124
- package/dist/components/tables/OrderTradesListTable.svelte.d.ts +4 -4
- package/dist/components/tables/OrderVaultsVolTable.svelte +17 -22
- package/dist/components/tables/OrderVaultsVolTable.svelte.d.ts +2 -2
- package/dist/components/tables/OrdersListTable.svelte +206 -115
- package/dist/components/tables/OrdersListTable.svelte.d.ts +18 -23
- package/dist/components/tables/VaultBalanceChangesTable.svelte +83 -43
- package/dist/components/tables/VaultBalanceChangesTable.svelte.d.ts +13 -11
- package/dist/components/tables/VaultsListTable.svelte +275 -150
- package/dist/components/tables/VaultsListTable.svelte.d.ts +24 -33
- package/dist/components/transactions/FixedBottomTransaction.svelte +64 -0
- package/dist/components/transactions/FixedBottomTransaction.svelte.d.ts +16 -0
- package/dist/components/transactions/TransactionDetail.svelte +31 -0
- package/dist/components/transactions/TransactionDetail.svelte.d.ts +20 -0
- package/dist/components/transactions/TransactionList.svelte +17 -0
- package/dist/components/transactions/TransactionList.svelte.d.ts +16 -0
- package/dist/components/transactions/getStatusEmoji.d.ts +2 -0
- package/dist/components/transactions/getStatusEmoji.js +20 -0
- package/dist/components/wallet/WalletConnect.svelte +5 -4
- package/dist/components/wallet/WalletConnect.svelte.d.ts +0 -1
- package/dist/consts.d.ts +1 -0
- package/dist/consts.js +1 -0
- package/dist/errors/DeploymentStepsError.d.ts +11 -5
- package/dist/errors/DeploymentStepsError.js +13 -7
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/hooks/useLocalDb.d.ts +3 -0
- package/dist/hooks/useLocalDb.js +10 -0
- package/dist/hooks/useRaindexClient.d.ts +3 -0
- package/dist/hooks/useRaindexClient.js +11 -0
- package/dist/hooks/useRaindexOrderBuilder.d.ts +3 -0
- package/dist/hooks/useRaindexOrderBuilder.js +11 -0
- package/dist/index.d.ts +122 -91
- package/dist/index.js +118 -87
- package/dist/models/Transaction.d.ts +75 -0
- package/dist/models/Transaction.js +100 -0
- package/dist/providers/LocalDbProvider.svelte +8 -0
- package/dist/providers/LocalDbProvider.svelte.d.ts +21 -0
- package/dist/providers/RaindexClientProvider.svelte +8 -0
- package/dist/providers/RaindexClientProvider.svelte.d.ts +21 -0
- package/dist/providers/RaindexOrderBuilderProvider.svelte +8 -0
- package/dist/providers/RaindexOrderBuilderProvider.svelte.d.ts +21 -0
- package/dist/providers/dotrainRegistry/DotrainRegistryProvider.svelte +8 -0
- package/dist/providers/dotrainRegistry/DotrainRegistryProvider.svelte.d.ts +24 -0
- package/dist/providers/dotrainRegistry/context.d.ts +9 -0
- package/dist/providers/dotrainRegistry/context.js +43 -0
- package/dist/providers/dotrainRegistry/useDotrainRegistry.d.ts +5 -0
- package/dist/providers/dotrainRegistry/useDotrainRegistry.js +35 -0
- package/dist/providers/registry/RegistryManager.d.ts +65 -0
- package/dist/providers/registry/RegistryManager.js +134 -0
- package/dist/providers/registry/RegistryProvider.svelte +6 -0
- package/dist/providers/registry/RegistryProvider.svelte.d.ts +21 -0
- package/dist/providers/registry/context.d.ts +10 -0
- package/dist/providers/registry/context.js +46 -0
- package/dist/providers/registry/useRegistry.d.ts +7 -0
- package/dist/providers/registry/useRegistry.js +29 -0
- package/dist/providers/toasts/ToastProvider.svelte +17 -0
- package/dist/providers/toasts/ToastProvider.svelte.d.ts +18 -0
- package/dist/providers/toasts/context.d.ts +14 -0
- package/dist/providers/toasts/context.js +22 -0
- package/dist/providers/toasts/useToasts.d.ts +16 -0
- package/dist/providers/toasts/useToasts.js +63 -0
- package/dist/providers/transactions/TransactionManager.d.ts +234 -0
- package/dist/providers/transactions/TransactionManager.js +509 -0
- package/dist/providers/transactions/TransactionProvider.svelte +11 -0
- package/dist/providers/transactions/TransactionProvider.svelte.d.ts +24 -0
- package/dist/providers/transactions/context.d.ts +19 -0
- package/dist/providers/transactions/context.js +28 -0
- package/dist/providers/transactions/useTransactions.d.ts +13 -0
- package/dist/providers/transactions/useTransactions.js +18 -0
- package/dist/providers/wallet/WalletProvider.svelte +7 -0
- package/dist/providers/wallet/WalletProvider.svelte.d.ts +21 -0
- package/dist/providers/wallet/context.d.ts +10 -0
- package/dist/providers/wallet/context.js +47 -0
- package/dist/providers/wallet/useAccount.d.ts +8 -0
- package/dist/providers/wallet/useAccount.js +148 -0
- package/dist/queries/keys.d.ts +1 -0
- package/dist/queries/keys.js +10 -9
- package/dist/queries/queryClient.d.ts +2 -2
- package/dist/queries/queryClient.js +16 -11
- package/dist/services/awaitTransactionIndexing.d.ts +107 -0
- package/dist/services/awaitTransactionIndexing.js +60 -0
- package/dist/services/getExplorerLink.d.ts +1 -1
- package/dist/services/getExplorerLink.js +3 -5
- package/dist/services/handleShareChoices.d.ts +2 -2
- package/dist/services/handleShareChoices.js +6 -5
- package/dist/services/historicalOrderCharts.d.ts +3 -3
- package/dist/services/historicalOrderCharts.js +364 -371
- package/dist/services/index.d.ts +5 -2
- package/dist/services/index.js +3 -1
- package/dist/services/loadRegistryUrl.d.ts +2 -0
- package/dist/services/loadRegistryUrl.js +22 -0
- package/dist/services/pairTradesChartData.d.ts +47 -0
- package/dist/services/pairTradesChartData.js +194 -0
- package/dist/services/registry.d.ts +5 -5
- package/dist/services/registry.js +17 -217
- package/dist/services/time.d.ts +12 -0
- package/dist/services/time.js +88 -6
- package/dist/services/validateAmount.d.ts +30 -0
- package/dist/services/validateAmount.js +53 -0
- package/dist/storesGeneric/cachedWritableStore.d.ts +57 -0
- package/dist/storesGeneric/cachedWritableStore.js +93 -0
- package/dist/storesGeneric/scrub.d.ts +14 -0
- package/dist/storesGeneric/scrub.js +22 -0
- package/dist/test/matchers.d.ts +2 -2
- package/dist/test/matchers.js +2 -2
- package/dist/types/account.d.ts +3 -0
- package/dist/types/appStores.d.ts +9 -16
- package/dist/types/modal.d.ts +26 -14
- package/dist/types/order.d.ts +10 -0
- package/dist/types/order.js +1 -0
- package/dist/types/toast.d.ts +11 -0
- package/dist/types/toast.js +1 -0
- package/dist/types/tokenBalance.d.ts +6 -0
- package/dist/types/tokenBalance.js +1 -0
- package/dist/types/transaction.d.ts +67 -22
- package/dist/types/transaction.js +31 -1
- package/dist/utils/breadcrumbs.js +2 -2
- package/dist/utils/codeMirrorThemes.js +80 -74
- package/dist/utils/configHelpers.d.ts +4 -0
- package/dist/utils/configHelpers.js +21 -0
- package/dist/utils/constructHashLink.d.ts +24 -0
- package/dist/utils/constructHashLink.js +117 -0
- package/dist/utils/getNetworkName.d.ts +1 -0
- package/dist/utils/getNetworkName.js +13 -0
- package/dist/utils/hex.js +1 -1
- package/dist/utils/lightweightChartsThemes.d.ts +1 -1
- package/dist/utils/lightweightChartsThemes.js +11 -11
- package/dist/utils/localDbStatus.d.ts +26 -0
- package/dist/utils/localDbStatus.js +22 -0
- package/dist/utils/number.d.ts +0 -7
- package/dist/utils/number.js +5 -30
- package/dist/utils/stripTrailingWhitespace.d.ts +16 -0
- package/dist/utils/stripTrailingWhitespace.js +22 -0
- package/dist/utils/tokens.d.ts +2 -0
- package/dist/utils/tokens.js +3 -0
- package/dist/utils/vaultBalanceChangeLabels.d.ts +4 -0
- package/dist/utils/vaultBalanceChangeLabels.js +18 -0
- package/package.json +89 -84
- package/dist/__fixtures__/orderDetail.d.ts +0 -99
- package/dist/__fixtures__/orderDetail.js +0 -204
- package/dist/__fixtures__/settings-12-11-24.json +0 -160
- package/dist/__mocks__/mockTransactionStore.d.ts +0 -22
- package/dist/__mocks__/mockTransactionStore.js +0 -56
- package/dist/__mocks__/settings.d.ts +0 -3
- package/dist/__mocks__/settings.js +0 -37
- package/dist/components/CheckboxMyItemsOnly.svelte +0 -23
- package/dist/components/CheckboxMyItemsOnly.svelte.d.ts +0 -21
- package/dist/components/ListViewOrderbookFilters.svelte +0 -58
- package/dist/components/ListViewOrderbookFilters.svelte.d.ts +0 -28
- package/dist/components/deployment/InvalidStrategiesSection.svelte +0 -19
- package/dist/components/deployment/InvalidStrategiesSection.svelte.d.ts +0 -19
- package/dist/components/deployment/StrategyPage.svelte.d.ts +0 -19
- package/dist/components/deployment/ValidStrategiesSection.svelte.d.ts +0 -19
- package/dist/components/deployment/getDeploymentTransactionArgs.d.ts +0 -17
- package/dist/components/deployment/getDeploymentTransactionArgs.js +0 -28
- package/dist/components/detail/DepositOrWithdrawButtons.svelte +0 -44
- package/dist/components/detail/DepositOrWithdrawButtons.svelte.d.ts +0 -26
- package/dist/components/dropdown/DropdownActiveSubgraphs.svelte +0 -38
- package/dist/components/dropdown/DropdownActiveSubgraphs.svelte.d.ts +0 -21
- package/dist/components/dropdown/DropdownOrderListAccounts.svelte +0 -15
- package/dist/components/dropdown/DropdownOrderListAccounts.svelte.d.ts +0 -20
- package/dist/components/dropdown/DropdownOrderStatus.svelte +0 -31
- package/dist/components/dropdown/DropdownOrderStatus.svelte.d.ts +0 -19
- package/dist/hooks/useGui.d.ts +0 -3
- package/dist/hooks/useGui.js +0 -11
- package/dist/providers/GuiProvider.svelte +0 -8
- package/dist/providers/GuiProvider.svelte.d.ts +0 -21
- package/dist/stores/transactionStore.d.ts +0 -98
- package/dist/stores/transactionStore.js +0 -303
- package/dist/types/strategy.d.ts +0 -10
- package/dist/utils/time.d.ts +0 -12
- package/dist/utils/time.js +0 -27
- package/dist/utils/vault.d.ts +0 -2
- package/dist/utils/vault.js +0 -29
- /package/dist/types/{strategy.js → account.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,93 +1,124 @@
|
|
|
1
1
|
// Components
|
|
2
|
-
export { default as CardProperty } from
|
|
3
|
-
export { default as Hash, HashType } from
|
|
4
|
-
export { default as TanstackAppTable } from
|
|
5
|
-
export { default as
|
|
6
|
-
export { default as
|
|
7
|
-
export { default as
|
|
8
|
-
export { default as
|
|
9
|
-
export { default as
|
|
10
|
-
export { default as
|
|
11
|
-
export { default as
|
|
12
|
-
export { default as
|
|
13
|
-
export { default as
|
|
14
|
-
export { default as
|
|
15
|
-
export { default as
|
|
16
|
-
export { default as
|
|
17
|
-
export { default as
|
|
18
|
-
export { default as
|
|
19
|
-
export { default as
|
|
20
|
-
export { default as
|
|
21
|
-
export { default as
|
|
22
|
-
export { default as
|
|
23
|
-
export { default as
|
|
24
|
-
export { default as
|
|
25
|
-
export { default as
|
|
26
|
-
export { default as
|
|
27
|
-
export { default as
|
|
28
|
-
export { default as
|
|
29
|
-
export { default as
|
|
30
|
-
export { default as
|
|
31
|
-
export { default as
|
|
32
|
-
export { default as
|
|
33
|
-
export { default as
|
|
34
|
-
export { default as
|
|
35
|
-
export { default as
|
|
36
|
-
export { default as
|
|
37
|
-
export { default as
|
|
38
|
-
export { default as
|
|
39
|
-
export { default as
|
|
40
|
-
export { default as
|
|
41
|
-
export { default as
|
|
42
|
-
export { default as
|
|
43
|
-
export { default as
|
|
44
|
-
export { default as
|
|
45
|
-
export { default as
|
|
46
|
-
export { default as
|
|
47
|
-
export { default as
|
|
48
|
-
export { default as
|
|
49
|
-
export { default as
|
|
50
|
-
export { default as
|
|
51
|
-
export { default as
|
|
52
|
-
export { default as
|
|
53
|
-
export { default as
|
|
54
|
-
export { default as
|
|
55
|
-
export { default as
|
|
56
|
-
export { default as
|
|
57
|
-
export { default as
|
|
58
|
-
export { default as
|
|
59
|
-
export { default as
|
|
60
|
-
export { default as
|
|
61
|
-
export { default as
|
|
62
|
-
export { default as
|
|
63
|
-
export { default as
|
|
64
|
-
export { default as
|
|
65
|
-
export { default as
|
|
66
|
-
export { default as
|
|
67
|
-
export { default as
|
|
68
|
-
export {
|
|
2
|
+
export { default as CardProperty } from "./components/CardProperty.svelte";
|
|
3
|
+
export { default as Hash, HashType } from "./components/Hash.svelte";
|
|
4
|
+
export { default as TanstackAppTable } from "./components/TanstackAppTable.svelte";
|
|
5
|
+
export { default as DropdownCheckbox } from "./components/dropdown/DropdownCheckbox.svelte";
|
|
6
|
+
export { default as DropdownTokensFilter } from "./components/dropdown/DropdownTokensFilter.svelte";
|
|
7
|
+
export { default as DropdownRaindexesFilter } from "./components/dropdown/DropdownRaindexesFilter.svelte";
|
|
8
|
+
export { default as InputOwnerFilter } from "./components/input/InputOwnerFilter.svelte";
|
|
9
|
+
export { default as DropdownRadio } from "./components/dropdown/DropdownRadio.svelte";
|
|
10
|
+
export { default as Refresh } from "./components/icon/Refresh.svelte";
|
|
11
|
+
export { default as CheckboxActiveOrders } from "./components/checkbox/CheckboxActiveOrders.svelte";
|
|
12
|
+
export { default as InputOrderHash } from "./components/input/InputOrderHash.svelte";
|
|
13
|
+
export { default as CheckboxZeroBalanceVault } from "./components/CheckboxZeroBalanceVault.svelte";
|
|
14
|
+
export { default as CheckboxInactiveOrdersVault } from "./components/CheckboxInactiveOrdersVault.svelte";
|
|
15
|
+
export { default as ListViewRaindexFilters } from "./components/ListViewRaindexFilters.svelte";
|
|
16
|
+
export { default as OrdersListTable } from "./components/tables/OrdersListTable.svelte";
|
|
17
|
+
export { default as VaultsListTable } from "./components/tables/VaultsListTable.svelte";
|
|
18
|
+
export { default as PageHeader } from "./components/PageHeader.svelte";
|
|
19
|
+
export { default as CodeMirrorRainlang } from "./components/CodeMirrorRainlang.svelte";
|
|
20
|
+
export { default as BadgeActive } from "./components/BadgeActive.svelte";
|
|
21
|
+
export { default as ButtonVaultLink } from "./components/ButtonVaultLink.svelte";
|
|
22
|
+
export { default as ButtonTab } from "./components/ButtonTab.svelte";
|
|
23
|
+
export { default as ChartTimeFilters } from "./components/charts/ChartTimeFilters.svelte";
|
|
24
|
+
export { default as LightweightChart } from "./components/charts/LightweightChart.svelte";
|
|
25
|
+
export { default as TanstackLightweightChartLine } from "./components/charts/TanstackLightweightChartLine.svelte";
|
|
26
|
+
export { default as MockComponent } from "./__mocks__/MockComponent.svelte";
|
|
27
|
+
export { default as OrderTradesChart } from "./components/charts/OrderTradesChart.svelte";
|
|
28
|
+
export { default as TableTimeFilters } from "./components/charts/TableTimeFilters.svelte";
|
|
29
|
+
export { default as OrderTradesListTable } from "./components/tables/OrderTradesListTable.svelte";
|
|
30
|
+
export { default as Checkbox } from "./components/checkbox/Checkbox.svelte";
|
|
31
|
+
export { default as TanstackPageContentDetail } from "./components/detail/TanstackPageContentDetail.svelte";
|
|
32
|
+
export { default as TanstackOrderQuote } from "./components/detail/TanstackOrderQuote.svelte";
|
|
33
|
+
export { default as EditableSpan } from "./components/EditableSpan.svelte";
|
|
34
|
+
export { default as OrderVaultsVolTable } from "./components/tables/OrderVaultsVolTable.svelte";
|
|
35
|
+
export { default as OrderDetail } from "./components/detail/OrderDetail.svelte";
|
|
36
|
+
export { default as BlockQuote } from "./components/BlockQuote.svelte";
|
|
37
|
+
export { default as Heading } from "./components/Heading.svelte";
|
|
38
|
+
export { default as Text } from "./components/Text.svelte";
|
|
39
|
+
export { default as DropdownProperty } from "./components/DropdownProperty.svelte";
|
|
40
|
+
export { default as IconError } from "./components/IconError.svelte";
|
|
41
|
+
export { default as ButtonLoading } from "./components/ButtonLoading.svelte";
|
|
42
|
+
export { default as IconExternalLink } from "./components/IconExternalLink.svelte";
|
|
43
|
+
export { default as IconInfo } from "./components/IconInfo.svelte";
|
|
44
|
+
export { default as IconLedger } from "./components/IconLedger.svelte";
|
|
45
|
+
export { default as IconSuccess } from "./components/IconSuccess.svelte";
|
|
46
|
+
export { default as IconTelegram } from "./components/IconTelegram.svelte";
|
|
47
|
+
export { default as IconWalletConnect } from "./components/IconWalletConnect.svelte";
|
|
48
|
+
export { default as IconWarning } from "./components/IconWarning.svelte";
|
|
49
|
+
export { default as FieldDefinitionInput } from "./components/deployment/FieldDefinitionInput.svelte";
|
|
50
|
+
export { default as DepositInput } from "./components/deployment/DepositInput.svelte";
|
|
51
|
+
export { default as DeploymentSteps } from "./components/deployment/DeploymentSteps.svelte";
|
|
52
|
+
export { default as TokenIOInput } from "./components/deployment/TokenIOInput.svelte";
|
|
53
|
+
export { default as SelectToken } from "./components/deployment/SelectToken.svelte";
|
|
54
|
+
export { default as VaultBalanceChangesTable } from "./components/tables/VaultBalanceChangesTable.svelte";
|
|
55
|
+
export { default as VaultBalanceChangeTypeFilter } from "./components/VaultBalanceChangeTypeFilter.svelte";
|
|
56
|
+
export { default as VaultBalanceChart } from "./components/charts/VaultBalanceChart.svelte";
|
|
57
|
+
export { default as VaultDetail } from "./components/detail/VaultDetail.svelte";
|
|
58
|
+
export { default as InputToken } from "./components/input/InputToken.svelte";
|
|
59
|
+
export { default as CodeMirrorDotrain } from "./components/CodeMirrorDotrain.svelte";
|
|
60
|
+
export { default as OrderOrVaultHash } from "./components/OrderOrVaultHash.svelte";
|
|
61
|
+
export { default as License } from "./components/License.svelte";
|
|
62
|
+
export { default as ButtonDarkMode } from "./components/ButtonDarkMode.svelte";
|
|
63
|
+
export { default as ButtonScrub } from "./components/ButtonScrub.svelte";
|
|
64
|
+
export { default as Sensitive } from "./components/Sensitive.svelte";
|
|
65
|
+
export { default as OrderPage } from "./components/deployment/OrderPage.svelte";
|
|
66
|
+
export { default as InputHex } from "./components/input/InputHex.svelte";
|
|
67
|
+
export { default as InputTokenAmount } from "./components/input/InputTokenAmount.svelte";
|
|
68
|
+
export { default as WalletConnect } from "./components/wallet/WalletConnect.svelte";
|
|
69
|
+
export { default as DisclaimerModal } from "./components/deployment/DisclaimerModal.svelte";
|
|
70
|
+
export { default as InvalidOrdersSection } from "./components/deployment/InvalidOrdersSection.svelte";
|
|
71
|
+
export { default as ValidOrdersSection } from "./components/deployment/ValidOrdersSection.svelte";
|
|
72
|
+
export { default as InputRegistryUrl } from "./components/input/InputRegistryUrl.svelte";
|
|
73
|
+
export { default as TransactionList } from "./components/transactions/TransactionList.svelte";
|
|
74
|
+
export { default as FixedBottomTransaction } from "./components/transactions/FixedBottomTransaction.svelte";
|
|
75
|
+
export { default as LocalDbStatusCard } from "./components/LocalDbStatusCard.svelte";
|
|
76
|
+
export { default as LocalDbStatusBadge } from "./components/LocalDbStatusBadge.svelte";
|
|
77
|
+
export { default as LocalDbStatusModal } from "./components/LocalDbStatusModal.svelte";
|
|
78
|
+
export { aggregateLocalDbStatus } from "./utils/localDbStatus";
|
|
79
|
+
export { TransactionStatusMessage, TransactionStoreErrorMessage, } from "./types/transaction";
|
|
69
80
|
// Functions
|
|
70
|
-
export { createResolvableQuery, createResolvableInfiniteQuery } from
|
|
71
|
-
export { formatTimestampSecondsAsLocal, timestampSecondsToUTCTimestamp, promiseTimeout } from
|
|
72
|
-
export { bigintStringToHex, HEX_INPUT_REGEX } from
|
|
73
|
-
export {
|
|
74
|
-
export {
|
|
75
|
-
export {
|
|
76
|
-
export {
|
|
81
|
+
export { createResolvableQuery, createResolvableInfiniteQuery, } from "./__mocks__/queries";
|
|
82
|
+
export { formatTimestampSecondsAsLocal, timestampSecondsToUTCTimestamp, promiseTimeout, } from "./services/time";
|
|
83
|
+
export { bigintStringToHex, HEX_INPUT_REGEX } from "./utils/hex";
|
|
84
|
+
export { getExplorerLink } from "./services/getExplorerLink";
|
|
85
|
+
export { validateAmount, countDecimalPlaces, MAX_DECIMALS, } from "./services/validateAmount";
|
|
86
|
+
export { invalidateTanstackQueries } from "./queries/queryClient";
|
|
87
|
+
export { getToastsContext } from "./providers/toasts/context";
|
|
88
|
+
export { getNetworkName } from "./utils/getNetworkName";
|
|
89
|
+
export { stripTrailingWhitespace } from "./utils/stripTrailingWhitespace";
|
|
77
90
|
// Constants
|
|
78
|
-
export { DEFAULT_PAGE_SIZE, DEFAULT_REFRESH_INTERVAL } from
|
|
79
|
-
export { QKEY_VAULTS, QKEY_VAULT, QKEY_VAULT_CHANGES, QKEY_ORDERS, QKEY_ORDER, QKEY_ORDER_TRADES_LIST, QKEY_ORDER_QUOTE, QKEY_VAULTS_VOL_LIST, QKEY_ORDER_APY } from
|
|
80
|
-
export { darkChartTheme, lightChartTheme } from
|
|
81
|
-
export { lightCodeMirrorTheme, darkCodeMirrorTheme } from
|
|
91
|
+
export { DEFAULT_PAGE_SIZE, DEFAULT_REFRESH_INTERVAL, } from "./queries/constants";
|
|
92
|
+
export { QKEY_VAULTS, QKEY_VAULT, QKEY_VAULT_CHANGES, QKEY_ORDERS, QKEY_ORDER, QKEY_ORDER_TRADES_LIST, QKEY_ORDER_QUOTE, QKEY_VAULTS_VOL_LIST, QKEY_ORDER_APY, } from "./queries/keys";
|
|
93
|
+
export { darkChartTheme, lightChartTheme, } from "./utils/lightweightChartsThemes";
|
|
94
|
+
export { lightCodeMirrorTheme, darkCodeMirrorTheme, } from "./utils/codeMirrorThemes";
|
|
82
95
|
// Stores
|
|
83
|
-
export {
|
|
84
|
-
export {
|
|
85
|
-
export { default as transactionStore } from './stores/transactionStore';
|
|
86
|
-
export { mockTransactionStore } from './__mocks__/mockTransactionStore';
|
|
96
|
+
export { cachedWritableStore, cachedWritableIntOptional, cachedWritableStringOptional, cachedWritableString, } from "./storesGeneric/cachedWritableStore";
|
|
97
|
+
export { scrub } from "./storesGeneric/scrub";
|
|
87
98
|
// Assets
|
|
88
|
-
export { default as logoLight } from
|
|
89
|
-
export { default as logoDark } from
|
|
90
|
-
// Hooks
|
|
91
|
-
export { useGui } from './hooks/useGui';
|
|
99
|
+
export { default as logoLight } from "./assets/logo-light.svg";
|
|
100
|
+
export { default as logoDark } from "./assets/logo-dark.svg";
|
|
92
101
|
// Providers
|
|
93
|
-
export { default as
|
|
102
|
+
export { default as RaindexOrderBuilderProvider } from "./providers/RaindexOrderBuilderProvider.svelte";
|
|
103
|
+
export { default as RaindexClientProvider } from "./providers/RaindexClientProvider.svelte";
|
|
104
|
+
export { default as WalletProvider } from "./providers/wallet/WalletProvider.svelte";
|
|
105
|
+
export { default as RegistryProvider } from "./providers/registry/RegistryProvider.svelte";
|
|
106
|
+
export { default as ToastProvider } from "./providers/toasts/ToastProvider.svelte";
|
|
107
|
+
export { default as TransactionProvider } from "./providers/transactions/TransactionProvider.svelte";
|
|
108
|
+
export { default as LocalDbProvider } from "./providers/LocalDbProvider.svelte";
|
|
109
|
+
export { default as DotrainRegistryProvider } from "./providers/dotrainRegistry/DotrainRegistryProvider.svelte";
|
|
110
|
+
// Hooks
|
|
111
|
+
export { useRaindexOrderBuilder } from "./hooks/useRaindexOrderBuilder";
|
|
112
|
+
export { useRaindexClient, RAINDEX_CLIENT_CONTEXT_KEY, } from "./hooks/useRaindexClient";
|
|
113
|
+
export { useLocalDb } from "./hooks/useLocalDb";
|
|
114
|
+
export { useAccount } from "./providers/wallet/useAccount";
|
|
115
|
+
export { useRegistry } from "./providers/registry/useRegistry";
|
|
116
|
+
export { useToasts } from "./providers/toasts/useToasts";
|
|
117
|
+
export { useTransactions } from "./providers/transactions/useTransactions";
|
|
118
|
+
export { useDotrainRegistry } from "./providers/dotrainRegistry/useDotrainRegistry";
|
|
119
|
+
// Classes
|
|
120
|
+
export { RegistryManager } from "./providers/registry/RegistryManager";
|
|
121
|
+
export { TransactionStore } from "./models/Transaction";
|
|
122
|
+
export { TransactionManager } from "./providers/transactions/TransactionManager";
|
|
123
|
+
// Mocks
|
|
124
|
+
export { mockPageStore } from "./__mocks__/stores";
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { TransactionStatusMessage, TransactionStoreErrorMessage } from "../types/transaction";
|
|
2
|
+
import type { TransactionArgs } from "../types/transaction";
|
|
3
|
+
import type { Config } from "@wagmi/core";
|
|
4
|
+
import { type Writable } from "svelte/store";
|
|
5
|
+
/**
|
|
6
|
+
* Represents the state of a transaction.
|
|
7
|
+
* @typedef {Object} TransactionStoreState
|
|
8
|
+
* @property {TransactionName} name - The user-friendly name of the transaction (e.g., "Order Removal").
|
|
9
|
+
* @property {TransactionStatusMessage} status - The current status of the transaction (e.g., PENDING_RECEIPT, SUCCESS, ERROR).
|
|
10
|
+
* @property {TransactionStoreErrorMessage} [errorDetails] - Optional error message if the transaction failed.
|
|
11
|
+
* @property {Array<{link: string, label: string}>} links - An array of relevant links for the transaction (e.g., explorer link, link to the affected entity).
|
|
12
|
+
*/
|
|
13
|
+
export type TransactionStoreState = {
|
|
14
|
+
name: string;
|
|
15
|
+
status: TransactionStatusMessage;
|
|
16
|
+
errorDetails?: TransactionStoreErrorMessage;
|
|
17
|
+
links: {
|
|
18
|
+
link: string;
|
|
19
|
+
label: string;
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Interface defining the structure of a transaction object.
|
|
24
|
+
* @interface Transaction
|
|
25
|
+
* @property {Writable<TransactionStoreState>} state - A writable store holding the current state of the transaction.
|
|
26
|
+
*/
|
|
27
|
+
export type Transaction = {
|
|
28
|
+
readonly state: Writable<TransactionStoreState>;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Manages the lifecycle of an individual transaction, including waiting for
|
|
32
|
+
* blockchain confirmation (receipt) and subgraph indexing.
|
|
33
|
+
* It exposes its state as a Svelte writable store.
|
|
34
|
+
* @class TransactionStore
|
|
35
|
+
* @implements {Transaction}
|
|
36
|
+
*/
|
|
37
|
+
export declare class TransactionStore implements Transaction {
|
|
38
|
+
private name;
|
|
39
|
+
private config;
|
|
40
|
+
private txHash;
|
|
41
|
+
private links;
|
|
42
|
+
private onSuccess;
|
|
43
|
+
private onError;
|
|
44
|
+
private awaitIndexingFn?;
|
|
45
|
+
readonly state: Writable<TransactionStoreState>;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a new TransactionStore instance.
|
|
48
|
+
* @param {TransactionArgs & { config: Config }} args - Configuration arguments for the transaction, including the wagmi `Config`.
|
|
49
|
+
* @param {() => void} onSuccess - Callback invoked when the transaction successfully completes (including indexing).
|
|
50
|
+
* @param {() => void} onError - Callback invoked if the transaction fails at any stage.
|
|
51
|
+
*/
|
|
52
|
+
constructor(args: TransactionArgs & {
|
|
53
|
+
config: Config;
|
|
54
|
+
}, onSuccess: () => void, onError: () => void);
|
|
55
|
+
/**
|
|
56
|
+
* Updates the internal Svelte store with new state values.
|
|
57
|
+
* @param {Partial<TransactionStoreState>} partialState - An object containing the state properties to update.
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
60
|
+
private updateState;
|
|
61
|
+
/**
|
|
62
|
+
* Executes the transaction and begins monitoring its status
|
|
63
|
+
* @returns {Promise<void>}
|
|
64
|
+
*/
|
|
65
|
+
execute(): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Waits for the transaction receipt to be confirmed on the blockchain.
|
|
68
|
+
* If an indexing function is provided, it will be called after receipt confirmation.
|
|
69
|
+
* TransactionStore doesn't know what the indexing function does - it just calls it.
|
|
70
|
+
* @param {Hex} hash - The transaction hash to monitor
|
|
71
|
+
* @returns {Promise<void>}
|
|
72
|
+
* @private
|
|
73
|
+
*/
|
|
74
|
+
private waitForTxReceipt;
|
|
75
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { waitForTransactionReceipt } from "@wagmi/core";
|
|
2
|
+
import { TransactionStatusMessage, TransactionStoreErrorMessage, } from "../types/transaction";
|
|
3
|
+
import { writable } from "svelte/store";
|
|
4
|
+
/**
|
|
5
|
+
* Manages the lifecycle of an individual transaction, including waiting for
|
|
6
|
+
* blockchain confirmation (receipt) and subgraph indexing.
|
|
7
|
+
* It exposes its state as a Svelte writable store.
|
|
8
|
+
* @class TransactionStore
|
|
9
|
+
* @implements {Transaction}
|
|
10
|
+
*/
|
|
11
|
+
export class TransactionStore {
|
|
12
|
+
name;
|
|
13
|
+
config;
|
|
14
|
+
txHash;
|
|
15
|
+
links;
|
|
16
|
+
onSuccess;
|
|
17
|
+
onError;
|
|
18
|
+
// Optional indexing function called after receipt confirmation.
|
|
19
|
+
// TransactionStore doesn't know what this function does - it just calls it.
|
|
20
|
+
awaitIndexingFn;
|
|
21
|
+
state;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new TransactionStore instance.
|
|
24
|
+
* @param {TransactionArgs & { config: Config }} args - Configuration arguments for the transaction, including the wagmi `Config`.
|
|
25
|
+
* @param {() => void} onSuccess - Callback invoked when the transaction successfully completes (including indexing).
|
|
26
|
+
* @param {() => void} onError - Callback invoked if the transaction fails at any stage.
|
|
27
|
+
*/
|
|
28
|
+
constructor(args, onSuccess, onError) {
|
|
29
|
+
this.config = args.config;
|
|
30
|
+
this.txHash = args.txHash;
|
|
31
|
+
this.name = args.name;
|
|
32
|
+
this.links = args.toastLinks;
|
|
33
|
+
this.state = writable({
|
|
34
|
+
name: this.name,
|
|
35
|
+
status: TransactionStatusMessage.IDLE,
|
|
36
|
+
links: this.links,
|
|
37
|
+
});
|
|
38
|
+
this.awaitIndexingFn = args.awaitIndexingFn;
|
|
39
|
+
this.onSuccess = onSuccess;
|
|
40
|
+
this.onError = onError;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Updates the internal Svelte store with new state values.
|
|
44
|
+
* @param {Partial<TransactionStoreState>} partialState - An object containing the state properties to update.
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
updateState(partialState) {
|
|
48
|
+
this.state.update((currentState) => ({
|
|
49
|
+
...currentState,
|
|
50
|
+
...partialState,
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Executes the transaction and begins monitoring its status
|
|
55
|
+
* @returns {Promise<void>}
|
|
56
|
+
*/
|
|
57
|
+
async execute() {
|
|
58
|
+
this.updateState({
|
|
59
|
+
status: TransactionStatusMessage.PENDING_RECEIPT,
|
|
60
|
+
});
|
|
61
|
+
await this.waitForTxReceipt(this.txHash);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Waits for the transaction receipt to be confirmed on the blockchain.
|
|
65
|
+
* If an indexing function is provided, it will be called after receipt confirmation.
|
|
66
|
+
* TransactionStore doesn't know what the indexing function does - it just calls it.
|
|
67
|
+
* @param {Hex} hash - The transaction hash to monitor
|
|
68
|
+
* @returns {Promise<void>}
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
71
|
+
async waitForTxReceipt(hash) {
|
|
72
|
+
try {
|
|
73
|
+
await waitForTransactionReceipt(this.config, { hash });
|
|
74
|
+
if (this.awaitIndexingFn) {
|
|
75
|
+
// Call the indexing function with the context it needs.
|
|
76
|
+
// The function handles everything: updating state, calling callbacks, etc.
|
|
77
|
+
await this.awaitIndexingFn({
|
|
78
|
+
updateState: this.updateState.bind(this),
|
|
79
|
+
onSuccess: this.onSuccess,
|
|
80
|
+
onError: this.onError,
|
|
81
|
+
links: this.links,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
// No indexing needed, mark as success immediately
|
|
86
|
+
this.updateState({
|
|
87
|
+
status: TransactionStatusMessage.SUCCESS,
|
|
88
|
+
});
|
|
89
|
+
return this.onSuccess();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
this.updateState({
|
|
94
|
+
status: TransactionStatusMessage.ERROR,
|
|
95
|
+
errorDetails: TransactionStoreErrorMessage.RECEIPT_FAILED,
|
|
96
|
+
});
|
|
97
|
+
return this.onError();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { SQLiteWasmDatabase } from '@rainlanguage/sqlite-web';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
localDb: SQLiteWasmDatabase;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {
|
|
11
|
+
default: {};
|
|
12
|
+
};
|
|
13
|
+
exports?: {} | undefined;
|
|
14
|
+
bindings?: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
export type LocalDbProviderProps = typeof __propDef.props;
|
|
17
|
+
export type LocalDbProviderEvents = typeof __propDef.events;
|
|
18
|
+
export type LocalDbProviderSlots = typeof __propDef.slots;
|
|
19
|
+
export default class LocalDbProvider extends SvelteComponent<LocalDbProviderProps, LocalDbProviderEvents, LocalDbProviderSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<script>import { setContext } from "svelte";
|
|
2
|
+
import { RaindexClient } from "@rainlanguage/raindex";
|
|
3
|
+
import { RAINDEX_CLIENT_CONTEXT_KEY } from "../hooks/useRaindexClient";
|
|
4
|
+
export let raindexClient;
|
|
5
|
+
setContext(RAINDEX_CLIENT_CONTEXT_KEY, raindexClient);
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<slot />
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { RaindexClient } from '@rainlanguage/raindex';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
raindexClient: RaindexClient;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {
|
|
11
|
+
default: {};
|
|
12
|
+
};
|
|
13
|
+
exports?: {} | undefined;
|
|
14
|
+
bindings?: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
export type RaindexClientProviderProps = typeof __propDef.props;
|
|
17
|
+
export type RaindexClientProviderEvents = typeof __propDef.events;
|
|
18
|
+
export type RaindexClientProviderSlots = typeof __propDef.slots;
|
|
19
|
+
export default class RaindexClientProvider extends SvelteComponent<RaindexClientProviderProps, RaindexClientProviderEvents, RaindexClientProviderSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<script>import { setContext } from "svelte";
|
|
2
|
+
import { RaindexOrderBuilder } from "@rainlanguage/raindex";
|
|
3
|
+
import { RAINDEX_ORDER_BUILDER_CONTEXT_KEY } from "../hooks/useRaindexOrderBuilder";
|
|
4
|
+
export let builder;
|
|
5
|
+
setContext(RAINDEX_ORDER_BUILDER_CONTEXT_KEY, builder);
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<slot />
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { RaindexOrderBuilder } from "@rainlanguage/raindex";
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
builder: RaindexOrderBuilder;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {
|
|
11
|
+
default: {};
|
|
12
|
+
};
|
|
13
|
+
exports?: {} | undefined;
|
|
14
|
+
bindings?: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
export type RaindexOrderBuilderProviderProps = typeof __propDef.props;
|
|
17
|
+
export type RaindexOrderBuilderProviderEvents = typeof __propDef.events;
|
|
18
|
+
export type RaindexOrderBuilderProviderSlots = typeof __propDef.slots;
|
|
19
|
+
export default class RaindexOrderBuilderProvider extends SvelteComponent<RaindexOrderBuilderProviderProps, RaindexOrderBuilderProviderEvents, RaindexOrderBuilderProviderSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { DotrainRegistry } from '@rainlanguage/raindex';
|
|
3
|
+
import type { RegistryManager } from '../registry/RegistryManager';
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
registry?: DotrainRegistry | null;
|
|
7
|
+
error: string | undefined;
|
|
8
|
+
manager: RegistryManager;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {
|
|
14
|
+
default: {};
|
|
15
|
+
};
|
|
16
|
+
exports?: {} | undefined;
|
|
17
|
+
bindings?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
export type DotrainRegistryProviderProps = typeof __propDef.props;
|
|
20
|
+
export type DotrainRegistryProviderEvents = typeof __propDef.events;
|
|
21
|
+
export type DotrainRegistryProviderSlots = typeof __propDef.slots;
|
|
22
|
+
export default class DotrainRegistryProvider extends SvelteComponent<DotrainRegistryProviderProps, DotrainRegistryProviderEvents, DotrainRegistryProviderSlots> {
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DotrainRegistry } from "@rainlanguage/raindex";
|
|
2
|
+
import type { RegistryManager } from "../registry/RegistryManager";
|
|
3
|
+
export type DotrainRegistryContext = {
|
|
4
|
+
registry: DotrainRegistry | null;
|
|
5
|
+
error?: string;
|
|
6
|
+
manager: RegistryManager;
|
|
7
|
+
};
|
|
8
|
+
export declare const setDotrainRegistryContext: (context: DotrainRegistryContext) => void;
|
|
9
|
+
export declare const getDotrainRegistryContext: () => DotrainRegistryContext;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { getContext, setContext } from "svelte";
|
|
2
|
+
const DOTRAIN_REGISTRY_CONTEXT_KEY = "dotrain-registry-context";
|
|
3
|
+
export const setDotrainRegistryContext = (context) => {
|
|
4
|
+
setContext(DOTRAIN_REGISTRY_CONTEXT_KEY, context);
|
|
5
|
+
};
|
|
6
|
+
export const getDotrainRegistryContext = () => {
|
|
7
|
+
const ctx = getContext(DOTRAIN_REGISTRY_CONTEXT_KEY);
|
|
8
|
+
if (!ctx) {
|
|
9
|
+
throw new Error("Dotrain registry context not found. Did you forget to wrap your app in DotrainRegistryProvider?");
|
|
10
|
+
}
|
|
11
|
+
return ctx;
|
|
12
|
+
};
|
|
13
|
+
if (import.meta.vitest) {
|
|
14
|
+
const { describe, it, expect, vi, beforeEach } = import.meta.vitest;
|
|
15
|
+
vi.mock("svelte", async (importOriginal) => ({
|
|
16
|
+
...(await importOriginal()),
|
|
17
|
+
getContext: vi.fn(),
|
|
18
|
+
}));
|
|
19
|
+
describe("getDotrainRegistryContext", () => {
|
|
20
|
+
const mockGetContext = vi.mocked(getContext);
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
mockGetContext.mockReset();
|
|
23
|
+
});
|
|
24
|
+
it("should return the context when it exists", () => {
|
|
25
|
+
const mockCtx = {
|
|
26
|
+
registry: null,
|
|
27
|
+
manager: {},
|
|
28
|
+
};
|
|
29
|
+
mockGetContext.mockImplementation((key) => {
|
|
30
|
+
if (key === DOTRAIN_REGISTRY_CONTEXT_KEY)
|
|
31
|
+
return mockCtx;
|
|
32
|
+
return undefined;
|
|
33
|
+
});
|
|
34
|
+
const result = getDotrainRegistryContext();
|
|
35
|
+
expect(mockGetContext).toHaveBeenCalledWith(DOTRAIN_REGISTRY_CONTEXT_KEY);
|
|
36
|
+
expect(result).toEqual(mockCtx);
|
|
37
|
+
});
|
|
38
|
+
it("should throw an error when context is not set", () => {
|
|
39
|
+
mockGetContext.mockReturnValue(undefined);
|
|
40
|
+
expect(() => getDotrainRegistryContext()).toThrow("Dotrain registry context not found. Did you forget to wrap your app in DotrainRegistryProvider?");
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { getDotrainRegistryContext, } from "./context";
|
|
2
|
+
/**
|
|
3
|
+
* Hook to access the current Dotrain registry context.
|
|
4
|
+
*/
|
|
5
|
+
export function useDotrainRegistry() {
|
|
6
|
+
return getDotrainRegistryContext();
|
|
7
|
+
}
|
|
8
|
+
if (import.meta.vitest) {
|
|
9
|
+
const { describe, it, expect, vi, beforeEach } = import.meta.vitest;
|
|
10
|
+
vi.mock("./context", () => ({
|
|
11
|
+
getDotrainRegistryContext: vi.fn(),
|
|
12
|
+
}));
|
|
13
|
+
describe("useDotrainRegistry", () => {
|
|
14
|
+
const mockGetContext = vi.mocked(getDotrainRegistryContext);
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
mockGetContext.mockReset();
|
|
17
|
+
});
|
|
18
|
+
it("should return the registry context", () => {
|
|
19
|
+
const mockContext = {
|
|
20
|
+
registry: null,
|
|
21
|
+
manager: {
|
|
22
|
+
getCurrentRegistry: vi.fn().mockReturnValue(""),
|
|
23
|
+
setRegistry: vi.fn(),
|
|
24
|
+
resetToDefault: vi.fn(),
|
|
25
|
+
updateUrlWithRegistry: vi.fn(),
|
|
26
|
+
isCustomRegistry: vi.fn().mockReturnValue(false),
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
mockGetContext.mockReturnValue(mockContext);
|
|
30
|
+
const result = useDotrainRegistry();
|
|
31
|
+
expect(mockGetContext).toHaveBeenCalled();
|
|
32
|
+
expect(result).toEqual(mockContext);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|