@rainlanguage/ui-components 0.0.1-alpha.21 → 0.0.1-alpha.211
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__fixtures__/settings.yaml +125 -0
- package/dist/__mocks__/CodeMirrorRainlang.svelte +4 -0
- package/dist/__mocks__/CodeMirrorRainlang.svelte.d.ts +18 -0
- package/dist/__mocks__/MockComponent.svelte +4 -0
- package/dist/__mocks__/MockComponent.svelte.d.ts +3 -1
- package/dist/__mocks__/stores.d.ts +47 -33
- package/dist/__mocks__/stores.js +61 -38
- package/dist/components/ButtonLoading.svelte +1 -1
- package/dist/components/ButtonVaultLink.svelte +11 -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/CheckboxMyItemsOnly.svelte +3 -2
- package/dist/components/CheckboxMyItemsOnly.svelte.d.ts +2 -3
- 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 +3 -12
- package/dist/components/CodeMirrorRainlang.svelte.d.ts +2 -2
- package/dist/components/EditableSpan.svelte +3 -14
- package/dist/components/EditableSpan.svelte.d.ts +0 -1
- package/dist/components/Hash.svelte +3 -3
- package/dist/components/License.svelte +5 -4
- package/dist/components/ListViewOrderbookFilters.svelte +45 -23
- package/dist/components/ListViewOrderbookFilters.svelte.d.ts +27 -22
- package/dist/components/LocalDbStatusBadge.svelte +27 -0
- package/dist/components/LocalDbStatusBadge.svelte.d.ts +19 -0
- package/dist/components/LocalDbStatusCard.svelte +40 -0
- package/dist/components/LocalDbStatusCard.svelte.d.ts +20 -0
- package/dist/components/LocalDbStatusModal.svelte +103 -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/TanstackAppTable.svelte +179 -28
- package/dist/components/TanstackAppTable.svelte.d.ts +14 -8
- 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 +300 -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 +2 -1
- package/dist/components/deployment/ComposedRainlangModal.svelte.d.ts +1 -4
- package/dist/components/deployment/DeploymentSectionHeader.svelte +7 -4
- package/dist/components/deployment/DeploymentSteps.svelte +209 -216
- 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 +8 -10
- package/dist/components/deployment/DepositInput.svelte.d.ts +1 -2
- package/dist/components/deployment/DisclaimerModal.svelte +6 -7
- package/dist/components/deployment/FieldDefinitionInput.svelte +7 -11
- package/dist/components/deployment/FieldDefinitionInput.svelte.d.ts +1 -2
- 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 +125 -48
- package/dist/components/deployment/SelectToken.svelte.d.ts +4 -3
- package/dist/components/deployment/TokenBalance.svelte +19 -0
- package/dist/components/deployment/TokenBalance.svelte.d.ts +19 -0
- package/dist/components/deployment/TokenIOInput.svelte +25 -15
- 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 +184 -80
- package/dist/components/detail/OrderDetail.svelte.d.ts +21 -15
- package/dist/components/detail/TanstackOrderQuote.svelte +92 -46
- package/dist/components/detail/TanstackOrderQuote.svelte.d.ts +14 -16
- package/dist/components/detail/VaultDetail.svelte +78 -77
- 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/DropdownOrderListAccounts.svelte +5 -2
- package/dist/components/dropdown/DropdownOrderListAccounts.svelte.d.ts +2 -3
- package/dist/components/dropdown/DropdownOrderbooksFilter.svelte +172 -0
- package/dist/components/dropdown/DropdownOrderbooksFilter.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 +2 -1
- package/dist/components/icon/Refresh.svelte.d.ts +1 -0
- package/dist/components/input/InputOrderHash.svelte +1 -1
- package/dist/components/input/InputOrderHash.svelte.d.ts +3 -3
- package/dist/components/input/InputRegistryUrl.svelte +36 -14
- package/dist/components/input/InputToken.svelte +2 -2
- package/dist/components/input/InputTokenAmount.svelte +16 -21
- 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 +84 -81
- 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 +200 -108
- package/dist/components/tables/OrdersListTable.svelte.d.ts +17 -21
- package/dist/components/tables/VaultBalanceChangesTable.svelte +83 -43
- package/dist/components/tables/VaultBalanceChangesTable.svelte.d.ts +13 -11
- package/dist/components/tables/VaultsListTable.svelte +268 -145
- package/dist/components/tables/VaultsListTable.svelte.d.ts +24 -32
- package/dist/components/transactions/FixedBottomTransaction.svelte +63 -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 +8 -2
- package/dist/errors/DeploymentStepsError.js +7 -1
- package/dist/hooks/useGui.d.ts +1 -1
- package/dist/hooks/useGui.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/index.d.ts +42 -19
- package/dist/index.js +41 -16
- package/dist/models/Transaction.d.ts +75 -0
- package/dist/models/Transaction.js +100 -0
- package/dist/providers/GuiProvider.svelte +1 -1
- package/dist/providers/GuiProvider.svelte.d.ts +1 -1
- 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/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 +40 -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 +133 -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 +235 -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 +1 -0
- package/dist/queries/queryClient.d.ts +1 -1
- package/dist/queries/queryClient.js +11 -6
- package/dist/services/awaitTransactionIndexing.d.ts +107 -0
- package/dist/services/awaitTransactionIndexing.js +58 -0
- package/dist/services/getExplorerLink.d.ts +1 -1
- package/dist/services/getExplorerLink.js +2 -4
- package/dist/services/handleShareChoices.d.ts +2 -2
- package/dist/services/handleShareChoices.js +7 -2
- package/dist/services/historicalOrderCharts.d.ts +2 -2
- package/dist/services/historicalOrderCharts.js +267 -333
- package/dist/services/index.d.ts +2 -1
- package/dist/services/index.js +2 -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 +190 -0
- package/dist/services/registry.d.ts +5 -5
- package/dist/services/registry.js +8 -208
- package/dist/services/time.d.ts +12 -0
- package/dist/services/time.js +88 -6
- package/dist/storesGeneric/cachedWritableStore.d.ts +57 -0
- package/dist/storesGeneric/cachedWritableStore.js +93 -0
- package/dist/types/account.d.ts +3 -0
- package/dist/types/appStores.d.ts +9 -14
- package/dist/types/modal.d.ts +26 -14
- package/dist/types/{strategy.d.ts → order.d.ts} +3 -3
- 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 +66 -21
- package/dist/types/transaction.js +31 -1
- 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 +115 -0
- package/dist/utils/getNetworkName.d.ts +1 -0
- package/dist/utils/getNetworkName.js +13 -0
- package/dist/utils/number.d.ts +0 -7
- package/dist/utils/number.js +0 -27
- 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 +39 -34
- 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/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/DropdownOrderStatus.svelte +0 -31
- package/dist/components/dropdown/DropdownOrderStatus.svelte.d.ts +0 -19
- package/dist/stores/transactionStore.d.ts +0 -98
- package/dist/stores/transactionStore.js +0 -303
- 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,228 +1,351 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script>import { toHex } from "viem";
|
|
2
|
+
import { useRaindexClient } from "../../hooks/useRaindexClient";
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
Checkbox,
|
|
6
|
+
Dropdown,
|
|
7
|
+
DropdownItem,
|
|
8
|
+
TableBodyCell,
|
|
9
|
+
TableHeadCell
|
|
10
|
+
} from "flowbite-svelte";
|
|
2
11
|
import { goto } from "$app/navigation";
|
|
3
|
-
import { DotsVerticalOutline } from "flowbite-svelte-icons";
|
|
4
|
-
import { createInfiniteQuery } from "@tanstack/svelte-query";
|
|
12
|
+
import { ArrowUpFromBracketOutline, DotsVerticalOutline } from "flowbite-svelte-icons";
|
|
13
|
+
import { createInfiniteQuery, createQuery } from "@tanstack/svelte-query";
|
|
5
14
|
import TanstackAppTable from "../TanstackAppTable.svelte";
|
|
6
15
|
import ListViewOrderbookFilters from "../ListViewOrderbookFilters.svelte";
|
|
7
16
|
import OrderOrVaultHash from "../OrderOrVaultHash.svelte";
|
|
8
17
|
import Hash, { HashType } from "../Hash.svelte";
|
|
9
18
|
import { DEFAULT_PAGE_SIZE, DEFAULT_REFRESH_INTERVAL } from "../../queries/constants";
|
|
10
|
-
import { vaultBalanceDisplay } from "../../utils/vault";
|
|
11
|
-
import { bigintStringToHex } from "../../utils/hex";
|
|
12
|
-
import {} from "@rainlanguage/orderbook/js_api";
|
|
13
|
-
import {} from "@rainlanguage/orderbook/js_api";
|
|
14
|
-
import { QKEY_VAULTS } from "../../queries/keys";
|
|
15
19
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
Float,
|
|
21
|
+
RaindexClient,
|
|
22
|
+
RaindexVault,
|
|
23
|
+
RaindexVaultsList
|
|
24
|
+
} from "@rainlanguage/orderbook";
|
|
25
|
+
import { QKEY_TOKENS, QKEY_VAULTS } from "../../queries/keys";
|
|
26
|
+
import { useAccount } from "../../providers/wallet/useAccount";
|
|
27
|
+
import { getNetworkName } from "../../utils/getNetworkName";
|
|
28
|
+
import { getAllContexts } from "svelte";
|
|
29
|
+
import Tooltip from "../Tooltip.svelte";
|
|
30
|
+
import { useToasts } from "../../providers/toasts/useToasts";
|
|
31
|
+
const context = getAllContexts();
|
|
32
|
+
const { errToast } = useToasts();
|
|
22
33
|
export let activeAccountsItems;
|
|
23
34
|
export let orderHash;
|
|
24
|
-
export let
|
|
25
|
-
export let settings;
|
|
26
|
-
export let activeOrderStatus;
|
|
35
|
+
export let showInactiveOrders;
|
|
27
36
|
export let hideZeroBalanceVaults;
|
|
28
|
-
export let
|
|
29
|
-
export let
|
|
30
|
-
export let
|
|
31
|
-
export let
|
|
32
|
-
export let
|
|
37
|
+
export let hideInactiveOrdersVaults;
|
|
38
|
+
export let activeTokens;
|
|
39
|
+
export let selectedChainIds;
|
|
40
|
+
export let showMyItemsOnly;
|
|
41
|
+
export let activeOrderbookAddresses;
|
|
33
42
|
export let handleDepositModal = void 0;
|
|
34
43
|
export let handleWithdrawModal = void 0;
|
|
35
|
-
export let
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
$:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
export let onWithdrawAll = void 0;
|
|
45
|
+
const { account } = useAccount();
|
|
46
|
+
const raindexClient = useRaindexClient();
|
|
47
|
+
$: owners = $activeAccountsItems && Object.values($activeAccountsItems).length > 0 ? Object.values($activeAccountsItems) : $showMyItemsOnly && $account ? [$account] : [];
|
|
48
|
+
$: tokensQuery = createQuery({
|
|
49
|
+
queryKey: [QKEY_TOKENS, $selectedChainIds],
|
|
50
|
+
queryFn: async () => {
|
|
51
|
+
const result = await raindexClient.getAllVaultTokens($selectedChainIds);
|
|
52
|
+
if (result.error) throw new Error(result.error.readableMsg);
|
|
53
|
+
return result.value;
|
|
54
|
+
},
|
|
55
|
+
enabled: true
|
|
56
|
+
});
|
|
57
|
+
$: selectedTokens = $activeTokens?.filter(
|
|
58
|
+
(address) => !$tokensQuery.data || $tokensQuery.data.some((t) => t.address === address)
|
|
59
|
+
) ?? [];
|
|
60
|
+
$: orderbooksMap = raindexClient.getAllOrderbooks()?.value ?? /* @__PURE__ */ new Map();
|
|
61
|
+
$: availableOrderbookAddresses = (() => {
|
|
62
|
+
const addrs = [];
|
|
63
|
+
orderbooksMap.forEach((cfg) => {
|
|
64
|
+
if ($selectedChainIds.length === 0 || $selectedChainIds.includes(cfg.network.chainId)) {
|
|
65
|
+
addrs.push(cfg.address.toLowerCase());
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return addrs;
|
|
69
|
+
})();
|
|
70
|
+
$: selectedOrderbookAddresses = $activeOrderbookAddresses?.filter(
|
|
71
|
+
(address) => availableOrderbookAddresses.includes(address.toLowerCase())
|
|
72
|
+
) ?? [];
|
|
45
73
|
$: query = createInfiniteQuery({
|
|
46
74
|
queryKey: [
|
|
47
75
|
QKEY_VAULTS,
|
|
48
|
-
$activeAccounts,
|
|
49
76
|
$hideZeroBalanceVaults,
|
|
50
|
-
$
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
77
|
+
$hideInactiveOrdersVaults,
|
|
78
|
+
$selectedChainIds,
|
|
79
|
+
owners,
|
|
80
|
+
selectedTokens,
|
|
81
|
+
selectedOrderbookAddresses
|
|
54
82
|
],
|
|
55
|
-
queryFn: ({ pageParam }) => {
|
|
56
|
-
|
|
57
|
-
|
|
83
|
+
queryFn: async ({ pageParam }) => {
|
|
84
|
+
const result = await raindexClient.getVaults(
|
|
85
|
+
$selectedChainIds,
|
|
58
86
|
{
|
|
59
87
|
owners,
|
|
60
|
-
hideZeroBalance: $hideZeroBalanceVaults
|
|
88
|
+
hideZeroBalance: $hideZeroBalanceVaults,
|
|
89
|
+
tokens: selectedTokens,
|
|
90
|
+
orderbookAddresses: selectedOrderbookAddresses.length > 0 ? selectedOrderbookAddresses : void 0,
|
|
91
|
+
onlyActiveOrders: $hideInactiveOrdersVaults
|
|
61
92
|
},
|
|
62
|
-
|
|
93
|
+
pageParam + 1
|
|
63
94
|
);
|
|
95
|
+
if (result.error) throw new Error(result.error.readableMsg);
|
|
96
|
+
return result.value;
|
|
64
97
|
},
|
|
65
98
|
initialPageParam: 0,
|
|
66
99
|
getNextPageParam(lastPage, _allPages, lastPageParam) {
|
|
67
|
-
return lastPage.length === DEFAULT_PAGE_SIZE ? lastPageParam + 1 : void 0;
|
|
100
|
+
return lastPage.items.length === DEFAULT_PAGE_SIZE ? lastPageParam + 1 : void 0;
|
|
68
101
|
},
|
|
69
102
|
refetchInterval: DEFAULT_REFRESH_INTERVAL,
|
|
70
|
-
enabled:
|
|
103
|
+
enabled: true
|
|
71
104
|
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
105
|
+
$: if (selectedVaults.size > 0 && !$account) {
|
|
106
|
+
selectedVaults = /* @__PURE__ */ new Set();
|
|
107
|
+
selectedVaultsOnChainId = null;
|
|
108
|
+
}
|
|
109
|
+
let selectedVaults = /* @__PURE__ */ new Set();
|
|
110
|
+
let selectedVaultsOnChainId = null;
|
|
111
|
+
const getToggleSelectVaultHandler = (vaultId, chainId) => (e) => {
|
|
112
|
+
e.stopPropagation();
|
|
113
|
+
if (selectedVaults.has(vaultId)) {
|
|
114
|
+
selectedVaults.delete(vaultId);
|
|
115
|
+
if (selectedVaults.size === 0) {
|
|
116
|
+
selectedVaultsOnChainId = null;
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
selectedVaults.add(vaultId);
|
|
120
|
+
if (selectedVaultsOnChainId === null) {
|
|
121
|
+
selectedVaultsOnChainId = chainId;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
selectedVaults = new Set(selectedVaults);
|
|
125
|
+
};
|
|
126
|
+
const stopPropagation = (e) => e.stopPropagation();
|
|
127
|
+
const handleWithdrawAll = () => {
|
|
128
|
+
const pages = $query.data?.pages ?? [];
|
|
129
|
+
if (!onWithdrawAll || pages.length === 0) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const selectedIds = Array.from(selectedVaults);
|
|
133
|
+
try {
|
|
134
|
+
const filteredVaultListResults = pages.reduce(
|
|
135
|
+
(prev, cur) => {
|
|
136
|
+
const result = cur.pickByIds(selectedIds);
|
|
137
|
+
if (result.error) {
|
|
138
|
+
throw new Error(result.error.readableMsg);
|
|
139
|
+
}
|
|
140
|
+
return [...prev, result.value];
|
|
141
|
+
},
|
|
142
|
+
[]
|
|
143
|
+
);
|
|
144
|
+
if (filteredVaultListResults.length === 0) {
|
|
145
|
+
errToast("No selected vaults found in the loaded pages. Please refresh and try again.");
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const [first, ...rest] = filteredVaultListResults;
|
|
149
|
+
const combinedVaultsList = rest.reduce((prev, cur) => {
|
|
150
|
+
const result = prev.concat(cur);
|
|
151
|
+
if (result.error) {
|
|
152
|
+
throw new Error(result.error.readableMsg);
|
|
153
|
+
}
|
|
154
|
+
return result.value;
|
|
155
|
+
}, first);
|
|
156
|
+
return onWithdrawAll(raindexClient, combinedVaultsList);
|
|
157
|
+
} catch (err) {
|
|
158
|
+
if (err instanceof Error) {
|
|
159
|
+
errToast(err.message);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
const ZERO_FLOAT = Float.parse("0").value;
|
|
164
|
+
const isZeroBalance = (item) => {
|
|
165
|
+
if (!ZERO_FLOAT) return true;
|
|
166
|
+
return item.balance.eq(ZERO_FLOAT).value;
|
|
167
|
+
};
|
|
168
|
+
const isSameChainId = (item, chainId) => {
|
|
169
|
+
return chainId === null || chainId === item.chainId;
|
|
170
|
+
};
|
|
171
|
+
const isDisabled = (item, chainId) => {
|
|
172
|
+
return !isSameChainId(item, chainId) || isZeroBalance(item);
|
|
75
173
|
};
|
|
76
|
-
$: isVaultsPage = currentRoute.startsWith("/vaults");
|
|
77
|
-
$: isOrdersPage = currentRoute.startsWith("/orders");
|
|
78
174
|
const AppTable = TanstackAppTable;
|
|
79
175
|
</script>
|
|
80
176
|
|
|
81
177
|
{#if $query}
|
|
82
178
|
<ListViewOrderbookFilters
|
|
83
|
-
{
|
|
84
|
-
{settings}
|
|
85
|
-
{accounts}
|
|
179
|
+
{selectedChainIds}
|
|
86
180
|
{activeAccountsItems}
|
|
87
181
|
{showMyItemsOnly}
|
|
88
|
-
{
|
|
182
|
+
{showInactiveOrders}
|
|
89
183
|
{orderHash}
|
|
90
184
|
{hideZeroBalanceVaults}
|
|
91
|
-
{
|
|
92
|
-
{
|
|
93
|
-
{
|
|
185
|
+
{hideInactiveOrdersVaults}
|
|
186
|
+
{activeTokens}
|
|
187
|
+
{tokensQuery}
|
|
188
|
+
{selectedTokens}
|
|
189
|
+
{activeOrderbookAddresses}
|
|
190
|
+
{selectedOrderbookAddresses}
|
|
94
191
|
/>
|
|
95
192
|
<AppTable
|
|
96
193
|
{query}
|
|
97
|
-
|
|
194
|
+
dataSelector={(page) => page.items}
|
|
195
|
+
queryKey={QKEY_VAULTS}
|
|
98
196
|
emptyMessage="No Vaults Found"
|
|
99
197
|
on:clickRow={(e) => {
|
|
100
|
-
|
|
101
|
-
goto(`/vaults/${e.detail.item.subgraphName}-${e.detail.item.vault.id}`);
|
|
198
|
+
goto(`/vaults/${e.detail.item.chainId}-${e.detail.item.orderbook}-${e.detail.item.id}`);
|
|
102
199
|
}}
|
|
103
200
|
>
|
|
104
201
|
<svelte:fragment slot="title">
|
|
105
202
|
<div class="mt-2 flex w-full justify-between">
|
|
106
203
|
<div class="flex items-center gap-x-6">
|
|
107
204
|
<div class="text-3xl font-medium dark:text-white">Vaults</div>
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
{/if}
|
|
205
|
+
<Button
|
|
206
|
+
size="xs"
|
|
207
|
+
on:click={handleWithdrawAll}
|
|
208
|
+
disabled={!onWithdrawAll || selectedVaults.size === 0}
|
|
209
|
+
data-testid="withdraw-all-button"
|
|
210
|
+
>
|
|
211
|
+
<ArrowUpFromBracketOutline size="xs" class="mr-2" />
|
|
212
|
+
{selectedVaults.size > 0
|
|
213
|
+
? `Withdraw selected (${selectedVaults.size})`
|
|
214
|
+
: 'Withdraw vaults'}
|
|
215
|
+
</Button>
|
|
120
216
|
</div>
|
|
121
217
|
</div>
|
|
122
218
|
</svelte:fragment>
|
|
123
219
|
<svelte:fragment slot="head">
|
|
124
|
-
<TableHeadCell padding="p-4">
|
|
125
|
-
|
|
126
|
-
<TableHeadCell padding="
|
|
127
|
-
<TableHeadCell padding="px-4 py-4">
|
|
128
|
-
<TableHeadCell padding="px-2 py-4">Token</TableHeadCell>
|
|
129
|
-
<TableHeadCell padding="px-
|
|
130
|
-
<TableHeadCell padding="px-3 py-4">
|
|
131
|
-
<TableHeadCell padding="
|
|
220
|
+
<TableHeadCell padding="p-0" class="w-[4%]"><span class="sr-only">Select</span></TableHeadCell
|
|
221
|
+
>
|
|
222
|
+
<TableHeadCell padding="pl-0 py-4" class="w-[8%]">Network</TableHeadCell>
|
|
223
|
+
<TableHeadCell padding="px-4 py-4" class="w-[22%]">Addresses</TableHeadCell>
|
|
224
|
+
<TableHeadCell padding="px-2 py-4" class="w-[22%]">Token</TableHeadCell>
|
|
225
|
+
<TableHeadCell padding="px-3 py-4" class="w-[20%]">Input For</TableHeadCell>
|
|
226
|
+
<TableHeadCell padding="px-3 py-4" class="w-[20%]">Output For</TableHeadCell>
|
|
227
|
+
<TableHeadCell padding="p-0" class="w-[4%]"
|
|
228
|
+
><span class="sr-only">Actions</span></TableHeadCell
|
|
229
|
+
>
|
|
132
230
|
</svelte:fragment>
|
|
133
231
|
|
|
134
232
|
<svelte:fragment slot="bodyRow" let:item>
|
|
135
|
-
<TableBodyCell tdClass="px-
|
|
136
|
-
|
|
233
|
+
<TableBodyCell tdClass="px-0" on:click={stopPropagation}>
|
|
234
|
+
<Checkbox
|
|
235
|
+
data-testid="vault-checkbox"
|
|
236
|
+
class={`block px-2 py-4 ${$account?.toLowerCase() !== item.owner.toLowerCase() ? 'invisible' : ''}`}
|
|
237
|
+
checked={selectedVaults.has(item.id)}
|
|
238
|
+
disabled={isDisabled(item, selectedVaultsOnChainId)}
|
|
239
|
+
on:change={getToggleSelectVaultHandler(item.id, item.chainId)}
|
|
240
|
+
on:click={stopPropagation}
|
|
241
|
+
aria-label={`Select vault ${item.id}`}
|
|
242
|
+
/>
|
|
243
|
+
{#if $account?.toLowerCase() === item.owner.toLowerCase() && isDisabled(item, selectedVaultsOnChainId)}
|
|
244
|
+
<Tooltip>
|
|
245
|
+
{isZeroBalance(item)
|
|
246
|
+
? 'This vault has a zero balance'
|
|
247
|
+
: 'This vault is on a different network'}
|
|
248
|
+
</Tooltip>
|
|
249
|
+
{/if}
|
|
137
250
|
</TableBodyCell>
|
|
138
251
|
|
|
139
|
-
<TableBodyCell tdClass="
|
|
140
|
-
|
|
141
|
-
</TableBodyCell>
|
|
142
|
-
<TableBodyCell tdClass="break-all px-4 py-2 min-w-48" data-testid="vault-orderbook">
|
|
143
|
-
<Hash type={HashType.Identifier} value={item.vault.orderbook.id} />
|
|
252
|
+
<TableBodyCell tdClass="px-4 py-2" data-testid="vault-network">
|
|
253
|
+
{getNetworkName(Number(item.chainId))}
|
|
144
254
|
</TableBodyCell>
|
|
145
|
-
|
|
146
|
-
|
|
255
|
+
|
|
256
|
+
<TableBodyCell data-testid="vaultAddresses" tdClass="px-4 py-2">
|
|
257
|
+
<div class="flex flex-col gap-1 text-sm">
|
|
258
|
+
<div class="flex items-center gap-1">
|
|
259
|
+
<span class="text-gray-500 dark:text-gray-400">Vault:</span>
|
|
260
|
+
<Hash type={HashType.Identifier} value={toHex(item.vaultId)} />
|
|
261
|
+
</div>
|
|
262
|
+
<div class="flex items-center gap-1">
|
|
263
|
+
<span class="text-gray-500 dark:text-gray-400">Orderbook:</span>
|
|
264
|
+
<Hash type={HashType.Identifier} value={item.orderbook} />
|
|
265
|
+
</div>
|
|
266
|
+
<div class="flex items-center gap-1">
|
|
267
|
+
<span class="text-gray-500 dark:text-gray-400">Owner:</span>
|
|
268
|
+
<Hash type={HashType.Wallet} value={item.owner} />
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
147
271
|
</TableBodyCell>
|
|
148
|
-
<TableBodyCell tdClass="
|
|
149
|
-
>
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
272
|
+
<TableBodyCell tdClass="p-2" data-testid="vault-token">
|
|
273
|
+
<div class="flex flex-col overflow-hidden">
|
|
274
|
+
<span class="truncate font-medium">{item.token.name}</span>
|
|
275
|
+
<span class="max-w-[200px] truncate text-sm text-gray-500 dark:text-gray-400"
|
|
276
|
+
>{item.formattedBalance} {item.token.symbol}</span
|
|
277
|
+
>
|
|
278
|
+
</div>
|
|
154
279
|
</TableBodyCell>
|
|
155
|
-
<TableBodyCell tdClass="break-all p-2
|
|
156
|
-
{#if item.
|
|
280
|
+
<TableBodyCell tdClass="break-all p-2">
|
|
281
|
+
{#if item.ordersAsInput.length > 0}
|
|
157
282
|
<div data-testid="vault-order-inputs" class="flex flex-wrap items-end justify-start">
|
|
158
|
-
{#each item.
|
|
283
|
+
{#each item.ordersAsInput.slice(0, 3) as order}
|
|
159
284
|
<OrderOrVaultHash
|
|
160
285
|
type="orders"
|
|
161
286
|
orderOrVault={order}
|
|
162
|
-
|
|
163
|
-
{
|
|
287
|
+
chainId={item.chainId}
|
|
288
|
+
orderbookAddress={item.orderbook}
|
|
164
289
|
/>
|
|
165
290
|
{/each}
|
|
166
|
-
{#if item.
|
|
291
|
+
{#if item.ordersAsInput.length > 3}...{/if}
|
|
167
292
|
</div>
|
|
168
293
|
{/if}
|
|
169
294
|
</TableBodyCell>
|
|
170
|
-
<TableBodyCell tdClass="break-all p-2
|
|
171
|
-
{#if item.
|
|
295
|
+
<TableBodyCell tdClass="break-all p-2">
|
|
296
|
+
{#if item.ordersAsOutput.length > 0}
|
|
172
297
|
<div data-testid="vault-order-outputs" class="flex flex-wrap items-end justify-start">
|
|
173
|
-
{#each item.
|
|
298
|
+
{#each item.ordersAsOutput.slice(0, 3) as order}
|
|
174
299
|
<OrderOrVaultHash
|
|
175
300
|
type="orders"
|
|
176
301
|
orderOrVault={order}
|
|
177
|
-
|
|
178
|
-
{
|
|
302
|
+
chainId={item.chainId}
|
|
303
|
+
orderbookAddress={item.orderbook}
|
|
179
304
|
/>
|
|
180
305
|
{/each}
|
|
181
|
-
{#if item.
|
|
306
|
+
{#if item.ordersAsOutput.length > 3}...{/if}
|
|
182
307
|
</div>
|
|
183
308
|
{/if}
|
|
184
309
|
</TableBodyCell>
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}}
|
|
197
|
-
>
|
|
198
|
-
<DotsVerticalOutline class="dark:text-white" />
|
|
199
|
-
</Button>
|
|
200
|
-
{/if}
|
|
201
|
-
</TableBodyCell>
|
|
202
|
-
{#if $walletAddressMatchesOrBlank(item.vault.owner)}
|
|
203
|
-
<Dropdown
|
|
204
|
-
data-testid="dropdown"
|
|
205
|
-
placement="bottom-end"
|
|
206
|
-
triggeredBy={`#vault-menu-${item.vault.id}`}
|
|
310
|
+
<TableBodyCell tdClass="px-0 text-right">
|
|
311
|
+
{#if handleDepositModal && handleWithdrawModal && item.owner.toLowerCase() === $account?.toLowerCase()}
|
|
312
|
+
<Button
|
|
313
|
+
color="alternative"
|
|
314
|
+
outline={false}
|
|
315
|
+
data-testid="vault-menu"
|
|
316
|
+
id={`vault-menu-${item.id}`}
|
|
317
|
+
class="mr-2 border-none px-2"
|
|
318
|
+
on:click={(e) => {
|
|
319
|
+
e.stopPropagation();
|
|
320
|
+
}}
|
|
207
321
|
>
|
|
208
|
-
<
|
|
209
|
-
|
|
210
|
-
on:click={(e) => {
|
|
211
|
-
e.stopPropagation();
|
|
212
|
-
handleDepositModal(item.vault, $query.refetch);
|
|
213
|
-
}}
|
|
214
|
-
>Deposit
|
|
215
|
-
</DropdownItem>
|
|
216
|
-
<DropdownItem
|
|
217
|
-
data-testid="withdraw-button"
|
|
218
|
-
on:click={(e) => {
|
|
219
|
-
e.stopPropagation();
|
|
220
|
-
handleWithdrawModal(item.vault, $query.refetch);
|
|
221
|
-
}}
|
|
222
|
-
>Withdraw
|
|
223
|
-
</DropdownItem>
|
|
224
|
-
</Dropdown>
|
|
322
|
+
<DotsVerticalOutline class="dark:text-white" />
|
|
323
|
+
</Button>
|
|
225
324
|
{/if}
|
|
325
|
+
</TableBodyCell>
|
|
326
|
+
{#if handleDepositModal && handleWithdrawModal && item.owner.toLowerCase() === $account?.toLowerCase()}
|
|
327
|
+
<Dropdown
|
|
328
|
+
data-testid="dropdown"
|
|
329
|
+
placement="bottom-end"
|
|
330
|
+
triggeredBy={`#vault-menu-${item.id}`}
|
|
331
|
+
>
|
|
332
|
+
<DropdownItem
|
|
333
|
+
data-testid="deposit-button"
|
|
334
|
+
on:click={(e) => {
|
|
335
|
+
e.stopPropagation();
|
|
336
|
+
handleDepositModal(item, $query.refetch, context);
|
|
337
|
+
}}
|
|
338
|
+
>Deposit
|
|
339
|
+
</DropdownItem>
|
|
340
|
+
<DropdownItem
|
|
341
|
+
data-testid="withdraw-button"
|
|
342
|
+
on:click={(e) => {
|
|
343
|
+
e.stopPropagation();
|
|
344
|
+
handleWithdrawModal(item, $query.refetch, context);
|
|
345
|
+
}}
|
|
346
|
+
>Withdraw
|
|
347
|
+
</DropdownItem>
|
|
348
|
+
</Dropdown>
|
|
226
349
|
{/if}
|
|
227
350
|
</svelte:fragment>
|
|
228
351
|
</AppTable>
|
|
@@ -1,40 +1,32 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import {
|
|
3
|
-
import { type SgVault } from '@rainlanguage/orderbook/js_api';
|
|
4
|
-
import { type Writable, type Readable } from 'svelte/store';
|
|
2
|
+
import { RaindexClient, RaindexVault, RaindexVaultsList } from '@rainlanguage/orderbook';
|
|
5
3
|
import type { AppStoresInterface } from '../../types/appStores.ts';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
hideZeroBalanceVaults: Writable<boolean>;
|
|
17
|
-
activeNetworkRef: Writable<string | undefined>;
|
|
18
|
-
activeOrderbookRef: Writable<string | undefined>;
|
|
19
|
-
activeAccounts: Readable<{
|
|
20
|
-
[k: string]: string;
|
|
21
|
-
}>;
|
|
22
|
-
walletAddressMatchesOrBlank: Readable<(otherAddress: string) => boolean>;
|
|
23
|
-
handleDepositGenericModal?: (() => void) | undefined;
|
|
24
|
-
handleDepositModal?: ((vault: SgVault, refetch: () => void) => void) | undefined;
|
|
25
|
-
handleWithdrawModal?: ((vault: SgVault, refetch: () => void) => void) | undefined;
|
|
26
|
-
currentRoute: string;
|
|
4
|
+
import { getAllContexts } from 'svelte';
|
|
5
|
+
declare const __propDef: {
|
|
6
|
+
props: {
|
|
7
|
+
activeAccountsItems: AppStoresInterface["activeAccountsItems"];
|
|
8
|
+
orderHash: AppStoresInterface["orderHash"];
|
|
9
|
+
showInactiveOrders: AppStoresInterface["showInactiveOrders"];
|
|
10
|
+
hideZeroBalanceVaults: AppStoresInterface["hideZeroBalanceVaults"];
|
|
11
|
+
hideInactiveOrdersVaults: AppStoresInterface["hideInactiveOrdersVaults"];
|
|
12
|
+
activeTokens: AppStoresInterface["activeTokens"];
|
|
13
|
+
selectedChainIds: AppStoresInterface["selectedChainIds"];
|
|
27
14
|
showMyItemsOnly: AppStoresInterface["showMyItemsOnly"];
|
|
28
|
-
|
|
15
|
+
activeOrderbookAddresses: AppStoresInterface["activeOrderbookAddresses"];
|
|
16
|
+
handleDepositModal?: ((vault: RaindexVault, refetch: () => void, context: ReturnType<typeof getAllContexts>) => void) | undefined;
|
|
17
|
+
handleWithdrawModal?: ((vault: RaindexVault, refetch: () => void, context: ReturnType<typeof getAllContexts>) => void) | undefined;
|
|
18
|
+
onWithdrawAll?: ((raindexClient: RaindexClient, vaultsList: RaindexVaultsList) => void | Promise<void>) | undefined;
|
|
29
19
|
};
|
|
30
|
-
events
|
|
20
|
+
events: {
|
|
31
21
|
[evt: string]: CustomEvent<any>;
|
|
32
22
|
};
|
|
33
|
-
slots
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export type
|
|
38
|
-
export
|
|
23
|
+
slots: {};
|
|
24
|
+
exports?: {} | undefined;
|
|
25
|
+
bindings?: string | undefined;
|
|
26
|
+
};
|
|
27
|
+
export type VaultsListTableProps = typeof __propDef.props;
|
|
28
|
+
export type VaultsListTableEvents = typeof __propDef.events;
|
|
29
|
+
export type VaultsListTableSlots = typeof __propDef.slots;
|
|
30
|
+
export default class VaultsListTable extends SvelteComponent<VaultsListTableProps, VaultsListTableEvents, VaultsListTableSlots> {
|
|
39
31
|
}
|
|
40
32
|
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script>import { useTransactions } from "../../providers/transactions/useTransactions";
|
|
2
|
+
import { CloseOutline } from "flowbite-svelte-icons";
|
|
3
|
+
import { writable } from "svelte/store";
|
|
4
|
+
import { getStatusEmoji } from "./getStatusEmoji";
|
|
5
|
+
const { transactions } = useTransactions();
|
|
6
|
+
const isDismissed = writable(false);
|
|
7
|
+
$: latestTransaction = $transactions.length > 0 ? $transactions[$transactions.length - 1].state : null;
|
|
8
|
+
$: if (latestTransaction) {
|
|
9
|
+
isDismissed.set(false);
|
|
10
|
+
}
|
|
11
|
+
function dismissTransaction() {
|
|
12
|
+
isDismissed.set(true);
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
{#if $latestTransaction && !$isDismissed}
|
|
17
|
+
<div
|
|
18
|
+
class="fixed bottom-0 left-0 right-0 z-40 border-t border-gray-200 bg-white lg:hidden dark:border-gray-700 dark:bg-gray-900"
|
|
19
|
+
>
|
|
20
|
+
<div class="flex items-start gap-3 p-3">
|
|
21
|
+
<!-- Transaction details -->
|
|
22
|
+
<div class="min-w-0 flex-1">
|
|
23
|
+
<div class="mb-1 flex items-center gap-2">
|
|
24
|
+
<span class="text-lg">{getStatusEmoji($latestTransaction.status)}</span>
|
|
25
|
+
<p class="truncate text-sm font-semibold text-gray-600 dark:text-gray-400">
|
|
26
|
+
{$latestTransaction.name}
|
|
27
|
+
</p>
|
|
28
|
+
</div>
|
|
29
|
+
<p class="truncate text-xs text-gray-600 dark:text-gray-400">
|
|
30
|
+
{$latestTransaction.status}
|
|
31
|
+
</p>
|
|
32
|
+
{#if $latestTransaction.errorDetails}
|
|
33
|
+
<p class="truncate text-xs text-red-600 dark:text-red-400">
|
|
34
|
+
{$latestTransaction.errorDetails}
|
|
35
|
+
</p>
|
|
36
|
+
{/if}
|
|
37
|
+
{#if $latestTransaction.links.length > 0}
|
|
38
|
+
<div class="mt-1 flex gap-2">
|
|
39
|
+
{#each $latestTransaction.links.slice(0, 2) as link}
|
|
40
|
+
<a
|
|
41
|
+
href={link.link}
|
|
42
|
+
target="_blank"
|
|
43
|
+
rel="noopener noreferrer"
|
|
44
|
+
class="truncate text-xs text-blue-500 hover:underline"
|
|
45
|
+
>
|
|
46
|
+
{link.label}
|
|
47
|
+
</a>
|
|
48
|
+
{/each}
|
|
49
|
+
</div>
|
|
50
|
+
{/if}
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<!-- Close button -->
|
|
54
|
+
<button
|
|
55
|
+
on:click={dismissTransaction}
|
|
56
|
+
class="flex-shrink-0 p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"
|
|
57
|
+
aria-label="Dismiss transaction"
|
|
58
|
+
>
|
|
59
|
+
<CloseOutline class="h-4 w-4" />
|
|
60
|
+
</button>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
{/if}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
exports?: {} | undefined;
|
|
9
|
+
bindings?: string | undefined;
|
|
10
|
+
};
|
|
11
|
+
export type FixedBottomTransactionProps = typeof __propDef.props;
|
|
12
|
+
export type FixedBottomTransactionEvents = typeof __propDef.events;
|
|
13
|
+
export type FixedBottomTransactionSlots = typeof __propDef.slots;
|
|
14
|
+
export default class FixedBottomTransaction extends SvelteComponent<FixedBottomTransactionProps, FixedBottomTransactionEvents, FixedBottomTransactionSlots> {
|
|
15
|
+
}
|
|
16
|
+
export {};
|