@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
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
<script>import { Input } from "flowbite-svelte";
|
|
2
|
-
import {
|
|
3
|
-
} from "@rainlanguage/orderbook/js_api";
|
|
4
|
-
import DeploymentSectionHeader from "./DeploymentSectionHeader.svelte";
|
|
2
|
+
import {} from "@rainlanguage/raindex";
|
|
5
3
|
import { onMount } from "svelte";
|
|
6
|
-
|
|
4
|
+
import { useRaindexOrderBuilder } from "../../hooks/useRaindexOrderBuilder";
|
|
5
|
+
import VaultIdInformation from "./VaultIdInformation.svelte";
|
|
6
|
+
const builder = useRaindexOrderBuilder();
|
|
7
7
|
export let label;
|
|
8
8
|
export let vault;
|
|
9
|
-
export let
|
|
9
|
+
export let tokenBalances = /* @__PURE__ */ new Map();
|
|
10
10
|
let tokenInfo = null;
|
|
11
11
|
let inputValue = "";
|
|
12
12
|
let error = "";
|
|
13
13
|
onMount(() => {
|
|
14
|
-
|
|
14
|
+
if (!vault.token?.key) return;
|
|
15
|
+
const result = builder.getVaultIds();
|
|
15
16
|
if (result.error) {
|
|
16
17
|
error = result.error.msg;
|
|
17
18
|
return;
|
|
18
19
|
}
|
|
19
20
|
const vaultIds = result.value;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
inputValue =
|
|
21
|
+
const vaultMap = vaultIds.get(label.toLowerCase());
|
|
22
|
+
if (vaultMap) {
|
|
23
|
+
const vaultId = vaultMap.get(vault.token.key);
|
|
24
|
+
inputValue = vaultId || "";
|
|
24
25
|
}
|
|
25
26
|
});
|
|
26
27
|
const handleGetTokenInfo = async () => {
|
|
27
28
|
if (!vault.token?.key) return;
|
|
28
29
|
try {
|
|
29
|
-
let result = await
|
|
30
|
+
let result = await builder.getTokenInfo(vault.token?.key);
|
|
30
31
|
if (result.error) {
|
|
31
32
|
error = result.error.msg;
|
|
32
33
|
return;
|
|
@@ -38,10 +39,13 @@ const handleGetTokenInfo = async () => {
|
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
41
|
const handleInput = async () => {
|
|
41
|
-
|
|
42
|
+
if (!vault.token) {
|
|
43
|
+
error = "Vault token is not set.";
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
42
46
|
error = "";
|
|
43
47
|
try {
|
|
44
|
-
|
|
48
|
+
builder.setVaultId(label.toLowerCase(), vault.token.key, inputValue);
|
|
45
49
|
} catch (e) {
|
|
46
50
|
const errorMessage = e.message ? e.message : "Error setting vault ID.";
|
|
47
51
|
error = errorMessage;
|
|
@@ -53,12 +57,18 @@ $: if (vault.token?.key) {
|
|
|
53
57
|
</script>
|
|
54
58
|
|
|
55
59
|
<div class="flex w-full flex-col gap-6">
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
<div class="flex w-full flex-col gap-2">
|
|
61
|
+
<div class="flex items-center gap-2">
|
|
62
|
+
<VaultIdInformation
|
|
63
|
+
title={`${label} ${tokenInfo?.symbol ? `(${tokenInfo.symbol})` : ''}`}
|
|
64
|
+
description={`${tokenInfo?.symbol || 'Token'} vault ID`}
|
|
65
|
+
tokenBalance={tokenBalances.get(vault.token?.key || '')}
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
60
69
|
<div class="flex flex-col gap-2">
|
|
61
70
|
<Input
|
|
71
|
+
data-testid="vault-id-input"
|
|
62
72
|
size="lg"
|
|
63
73
|
type="text"
|
|
64
74
|
placeholder="Enter vault ID"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import { type OrderIOCfg
|
|
2
|
+
import { type OrderIOCfg } from '@rainlanguage/raindex';
|
|
3
|
+
import type { TokenBalance } from '../../types/tokenBalance';
|
|
3
4
|
declare const __propDef: {
|
|
4
5
|
props: {
|
|
5
|
-
i: number;
|
|
6
6
|
label: "Input" | "Output";
|
|
7
7
|
vault: OrderIOCfg;
|
|
8
|
-
|
|
8
|
+
tokenBalances?: Map<string, TokenBalance>;
|
|
9
9
|
};
|
|
10
10
|
events: {
|
|
11
11
|
[evt: string]: CustomEvent<any>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
<script>import { Input, Button, Modal } from "flowbite-svelte";
|
|
2
|
+
import { SearchOutline, CheckCircleSolid, ChevronDownSolid } from "flowbite-svelte-icons";
|
|
3
|
+
import { useRaindexOrderBuilder } from "../../hooks/useRaindexOrderBuilder";
|
|
4
|
+
import { onMount, tick } from "svelte";
|
|
5
|
+
export let selectedToken = null;
|
|
6
|
+
export let onSelect;
|
|
7
|
+
let modalOpen = false;
|
|
8
|
+
let searchQuery = "";
|
|
9
|
+
let tokens = [];
|
|
10
|
+
let isSearching = false;
|
|
11
|
+
let failedImages = /* @__PURE__ */ new Set();
|
|
12
|
+
const builder = useRaindexOrderBuilder();
|
|
13
|
+
async function loadTokens(search) {
|
|
14
|
+
isSearching = true;
|
|
15
|
+
const result = await builder.getAllTokens(search);
|
|
16
|
+
if (result.error) {
|
|
17
|
+
tokens = [];
|
|
18
|
+
} else {
|
|
19
|
+
tokens = result.value;
|
|
20
|
+
}
|
|
21
|
+
isSearching = false;
|
|
22
|
+
}
|
|
23
|
+
function handleSearch(event) {
|
|
24
|
+
const target = event.target;
|
|
25
|
+
searchQuery = target.value;
|
|
26
|
+
loadTokens(searchQuery || void 0);
|
|
27
|
+
}
|
|
28
|
+
onMount(() => loadTokens());
|
|
29
|
+
function formatAddress(address) {
|
|
30
|
+
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
31
|
+
}
|
|
32
|
+
function handleTokenSelect(token) {
|
|
33
|
+
onSelect(token);
|
|
34
|
+
modalOpen = false;
|
|
35
|
+
}
|
|
36
|
+
function handleImageError(address) {
|
|
37
|
+
failedImages = /* @__PURE__ */ new Set([...failedImages, address]);
|
|
38
|
+
}
|
|
39
|
+
$: displayText = selectedToken ? `${selectedToken.name} (${selectedToken.symbol})` : "Select a token...";
|
|
40
|
+
$: if (modalOpen) {
|
|
41
|
+
tick().then(() => {
|
|
42
|
+
const input = document.querySelector(".token-search-input");
|
|
43
|
+
if (input) {
|
|
44
|
+
input.focus();
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<div class="token-dropdown">
|
|
51
|
+
<div class="relative w-full">
|
|
52
|
+
<Button
|
|
53
|
+
color="alternative"
|
|
54
|
+
class="flex w-full justify-between overflow-hidden overflow-ellipsis pl-4 pr-2 text-left"
|
|
55
|
+
size="lg"
|
|
56
|
+
on:click={() => (modalOpen = true)}
|
|
57
|
+
>
|
|
58
|
+
<div class="flex-grow overflow-hidden">
|
|
59
|
+
<span class="text-gray-900 dark:text-white">{displayText}</span>
|
|
60
|
+
</div>
|
|
61
|
+
<ChevronDownSolid class="ml-2 h-4 w-4 text-black dark:text-white" />
|
|
62
|
+
</Button>
|
|
63
|
+
|
|
64
|
+
<Modal bind:open={modalOpen} size="md" class="w-full max-w-lg">
|
|
65
|
+
<div slot="header" class="flex w-full items-center justify-between">
|
|
66
|
+
<h3 class="text-xl font-medium text-gray-900 dark:text-white">Select a token</h3>
|
|
67
|
+
</div>
|
|
68
|
+
<div class="relative w-full border-b border-gray-200 p-2 dark:border-gray-600">
|
|
69
|
+
<div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-5">
|
|
70
|
+
<SearchOutline class="h-4 w-4 text-gray-500 dark:text-gray-400" />
|
|
71
|
+
</div>
|
|
72
|
+
<Input
|
|
73
|
+
type="text"
|
|
74
|
+
placeholder="Search tokens..."
|
|
75
|
+
bind:value={searchQuery}
|
|
76
|
+
on:input={handleSearch}
|
|
77
|
+
class="token-search-input pl-10"
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<div class="token-list max-h-80 overflow-y-auto">
|
|
82
|
+
{#if isSearching}
|
|
83
|
+
<div class="p-4 text-center text-gray-500 dark:text-gray-400">
|
|
84
|
+
<p>Searching tokens...</p>
|
|
85
|
+
</div>
|
|
86
|
+
{:else}
|
|
87
|
+
{#each tokens as token (token.address)}
|
|
88
|
+
<div
|
|
89
|
+
class="token-item flex cursor-pointer items-center border-b border-gray-100 p-3 last:border-b-0 hover:bg-gray-50 dark:border-gray-600 dark:hover:bg-gray-700"
|
|
90
|
+
class:bg-blue-50={selectedToken?.address === token.address}
|
|
91
|
+
class:dark:bg-blue-900={selectedToken?.address === token.address}
|
|
92
|
+
class:border-l-4={selectedToken?.address === token.address}
|
|
93
|
+
class:border-l-blue-500={selectedToken?.address === token.address}
|
|
94
|
+
on:click={() => handleTokenSelect(token)}
|
|
95
|
+
on:keydown={(e) => e.key === 'Enter' && handleTokenSelect(token)}
|
|
96
|
+
role="button"
|
|
97
|
+
tabindex="0"
|
|
98
|
+
>
|
|
99
|
+
{#if token.logoUri && !failedImages.has(token.address)}
|
|
100
|
+
<img
|
|
101
|
+
src={token.logoUri}
|
|
102
|
+
alt="{token.symbol} logo"
|
|
103
|
+
class="mr-3 h-8 w-8 rounded-full object-cover"
|
|
104
|
+
on:error={() => handleImageError(token.address)}
|
|
105
|
+
/>
|
|
106
|
+
{:else}
|
|
107
|
+
<div
|
|
108
|
+
class="mr-3 flex h-8 w-8 items-center justify-center rounded-full bg-gray-200 dark:bg-gray-600"
|
|
109
|
+
>
|
|
110
|
+
<span class="text-xs font-medium text-gray-500 dark:text-gray-400">
|
|
111
|
+
{token.symbol?.slice(0, 2) || '??'}
|
|
112
|
+
</span>
|
|
113
|
+
</div>
|
|
114
|
+
{/if}
|
|
115
|
+
<div class="token-info flex-grow">
|
|
116
|
+
<div class="token-name font-medium text-gray-900 dark:text-white">
|
|
117
|
+
{token.name}
|
|
118
|
+
</div>
|
|
119
|
+
<div class="token-details flex gap-2 text-sm text-gray-500 dark:text-gray-400">
|
|
120
|
+
<span class="symbol font-medium">{token.symbol}</span>
|
|
121
|
+
<span class="address">{formatAddress(token.address)}</span>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
{#if selectedToken?.address === token.address}
|
|
125
|
+
<CheckCircleSolid class="selected-icon h-5 w-5 text-green-500" />
|
|
126
|
+
{/if}
|
|
127
|
+
</div>
|
|
128
|
+
{/each}
|
|
129
|
+
|
|
130
|
+
{#if tokens.length === 0}
|
|
131
|
+
<div class="no-results p-4 text-center text-gray-500 dark:text-gray-400">
|
|
132
|
+
<p>No tokens found matching your search.</p>
|
|
133
|
+
<button
|
|
134
|
+
class="mt-2 text-blue-600 underline hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300"
|
|
135
|
+
on:click={() => {
|
|
136
|
+
searchQuery = '';
|
|
137
|
+
loadTokens();
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
140
|
+
Clear search
|
|
141
|
+
</button>
|
|
142
|
+
</div>
|
|
143
|
+
{/if}
|
|
144
|
+
{/if}
|
|
145
|
+
</div>
|
|
146
|
+
</Modal>
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ExtendedTokenInfo } from '@rainlanguage/raindex';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
selectedToken?: ExtendedTokenInfo | null;
|
|
6
|
+
onSelect: (token: ExtendedTokenInfo) => void;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
exports?: {} | undefined;
|
|
13
|
+
bindings?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
export type TokenSelectionModalProps = typeof __propDef.props;
|
|
16
|
+
export type TokenSelectionModalEvents = typeof __propDef.events;
|
|
17
|
+
export type TokenSelectionModalSlots = typeof __propDef.slots;
|
|
18
|
+
export default class TokenSelectionModal extends SvelteComponent<TokenSelectionModalProps, TokenSelectionModalEvents, TokenSelectionModalSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
package/dist/components/deployment/{ValidStrategiesSection.svelte → ValidOrdersSection.svelte}
RENAMED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
<script>import { onMount } from "svelte";
|
|
2
2
|
import { page } from "$app/stores";
|
|
3
|
-
export let
|
|
3
|
+
export let orders;
|
|
4
4
|
let customRegistryParam = "";
|
|
5
5
|
onMount(async () => {
|
|
6
6
|
customRegistryParam = $page.url.searchParams.get("registry") ? `?registry=${$page.url.searchParams.get("registry")}` : "";
|
|
7
7
|
});
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
|
-
<div class="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3" data-testid="valid-
|
|
11
|
-
{#each
|
|
10
|
+
<div class="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3" data-testid="valid-orders">
|
|
11
|
+
{#each orders as order}
|
|
12
12
|
<a
|
|
13
|
-
href={`/deploy/${
|
|
14
|
-
data-testid="
|
|
13
|
+
href={`/deploy/${order.name}${customRegistryParam}`}
|
|
14
|
+
data-testid="order-short-tile"
|
|
15
15
|
class="flex flex-col gap-y-2 rounded-xl border border-gray-200 p-4 hover:bg-gray-50 dark:border-gray-800 dark:hover:bg-gray-900"
|
|
16
16
|
>
|
|
17
17
|
<h3 class="text-2xl font-semibold text-gray-900 dark:text-white">
|
|
18
|
-
{
|
|
18
|
+
{order.details.name}
|
|
19
19
|
</h3>
|
|
20
20
|
<p class="text-lg text-gray-600 dark:text-gray-400">
|
|
21
|
-
{
|
|
21
|
+
{order.details.short_description}
|
|
22
22
|
</p>
|
|
23
23
|
</a>
|
|
24
24
|
{/each}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ValidOrderDetail } from '../../types/order';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
orders: ValidOrderDetail[];
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
exports?: {} | undefined;
|
|
12
|
+
bindings?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type ValidOrdersSectionProps = typeof __propDef.props;
|
|
15
|
+
export type ValidOrdersSectionEvents = typeof __propDef.events;
|
|
16
|
+
export type ValidOrdersSectionSlots = typeof __propDef.slots;
|
|
17
|
+
export default class ValidOrdersSection extends SvelteComponent<ValidOrdersSectionProps, ValidOrdersSectionEvents, ValidOrdersSectionSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script>import TokenBalanceComponent from "./TokenBalance.svelte";
|
|
2
|
+
export let title;
|
|
3
|
+
export let description;
|
|
4
|
+
export let tokenBalance;
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<div class="flex max-w-xl flex-grow flex-col gap-y-4 text-left">
|
|
8
|
+
<h1 class="break-words text-xl font-semibold text-gray-900 lg:text-2xl dark:text-white">
|
|
9
|
+
{title}
|
|
10
|
+
</h1>
|
|
11
|
+
<div class="flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400">
|
|
12
|
+
<div class="text-gray-600 dark:text-gray-400">
|
|
13
|
+
{description}
|
|
14
|
+
</div>
|
|
15
|
+
<TokenBalanceComponent {tokenBalance} />
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { TokenBalance } from '../../types/tokenBalance';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
tokenBalance: TokenBalance | undefined;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
exports?: {} | undefined;
|
|
14
|
+
bindings?: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
export type VaultIdInformationProps = typeof __propDef.props;
|
|
17
|
+
export type VaultIdInformationEvents = typeof __propDef.events;
|
|
18
|
+
export type VaultIdInformationSlots = typeof __propDef.slots;
|
|
19
|
+
export default class VaultIdInformation extends SvelteComponent<VaultIdInformationProps, VaultIdInformationEvents, VaultIdInformationSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|