@rainlanguage/ui-components 0.0.1-alpha.22 → 0.0.1-alpha.221
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 +53 -43
- package/dist/__mocks__/stores.js +66 -49
- 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/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 +39 -33
- package/dist/components/ListViewOrderbookFilters.svelte.d.ts +26 -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/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/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 +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 +204 -113
- 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 +270 -148
- package/dist/components/tables/VaultsListTable.svelte.d.ts +24 -33
- 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 +43 -20
- package/dist/index.js +42 -17
- 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 -16
- 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/CheckboxMyItemsOnly.svelte +0 -23
- package/dist/components/CheckboxMyItemsOnly.svelte.d.ts +0 -21
- 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/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,350 @@
|
|
|
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
|
-
|
|
22
|
-
|
|
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();
|
|
23
33
|
export let orderHash;
|
|
24
|
-
export let
|
|
25
|
-
export let settings;
|
|
26
|
-
export let activeOrderStatus;
|
|
34
|
+
export let showInactiveOrders;
|
|
27
35
|
export let hideZeroBalanceVaults;
|
|
28
|
-
export let
|
|
29
|
-
export let
|
|
30
|
-
export let
|
|
31
|
-
export let
|
|
32
|
-
export let
|
|
36
|
+
export let hideInactiveOrdersVaults;
|
|
37
|
+
export let activeTokens;
|
|
38
|
+
export let selectedChainIds;
|
|
39
|
+
export let activeOrderbookAddresses;
|
|
40
|
+
export let ownerFilter;
|
|
33
41
|
export let handleDepositModal = void 0;
|
|
34
42
|
export let handleWithdrawModal = void 0;
|
|
35
|
-
export let
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
$:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
export let onWithdrawAll = void 0;
|
|
44
|
+
const { account } = useAccount();
|
|
45
|
+
const raindexClient = useRaindexClient();
|
|
46
|
+
$: ownerAddress = $ownerFilter?.trim() || "";
|
|
47
|
+
$: owners = ownerAddress ? [ownerAddress] : [];
|
|
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
|
+
ownerAddress,
|
|
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
|
-
{
|
|
85
|
-
{accounts}
|
|
86
|
-
{activeAccountsItems}
|
|
87
|
-
{showMyItemsOnly}
|
|
88
|
-
{activeOrderStatus}
|
|
179
|
+
{selectedChainIds}
|
|
180
|
+
{showInactiveOrders}
|
|
89
181
|
{orderHash}
|
|
90
182
|
{hideZeroBalanceVaults}
|
|
91
|
-
{
|
|
92
|
-
{
|
|
93
|
-
{
|
|
183
|
+
{hideInactiveOrdersVaults}
|
|
184
|
+
{activeTokens}
|
|
185
|
+
{tokensQuery}
|
|
186
|
+
{selectedTokens}
|
|
187
|
+
{activeOrderbookAddresses}
|
|
188
|
+
{selectedOrderbookAddresses}
|
|
189
|
+
{ownerFilter}
|
|
94
190
|
/>
|
|
95
191
|
<AppTable
|
|
96
192
|
{query}
|
|
97
|
-
|
|
193
|
+
dataSelector={(page) => page.items}
|
|
194
|
+
queryKey={QKEY_VAULTS}
|
|
98
195
|
emptyMessage="No Vaults Found"
|
|
99
196
|
on:clickRow={(e) => {
|
|
100
|
-
|
|
101
|
-
goto(`/vaults/${e.detail.item.subgraphName}-${e.detail.item.vault.id}`);
|
|
197
|
+
goto(`/vaults/${e.detail.item.chainId}-${e.detail.item.orderbook}-${e.detail.item.id}`);
|
|
102
198
|
}}
|
|
103
199
|
>
|
|
104
200
|
<svelte:fragment slot="title">
|
|
105
201
|
<div class="mt-2 flex w-full justify-between">
|
|
106
202
|
<div class="flex items-center gap-x-6">
|
|
107
203
|
<div class="text-3xl font-medium dark:text-white">Vaults</div>
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
{/if}
|
|
204
|
+
<Button
|
|
205
|
+
size="xs"
|
|
206
|
+
on:click={handleWithdrawAll}
|
|
207
|
+
disabled={!onWithdrawAll || selectedVaults.size === 0}
|
|
208
|
+
data-testid="withdraw-all-button"
|
|
209
|
+
>
|
|
210
|
+
<ArrowUpFromBracketOutline size="xs" class="mr-2" />
|
|
211
|
+
{selectedVaults.size > 0
|
|
212
|
+
? `Withdraw selected (${selectedVaults.size})`
|
|
213
|
+
: 'Withdraw vaults'}
|
|
214
|
+
</Button>
|
|
120
215
|
</div>
|
|
121
216
|
</div>
|
|
122
217
|
</svelte:fragment>
|
|
123
218
|
<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="
|
|
219
|
+
<TableHeadCell padding="p-0" class="w-[4%]"><span class="sr-only">Select</span></TableHeadCell
|
|
220
|
+
>
|
|
221
|
+
<TableHeadCell padding="pl-0 py-4" class="w-[8%]">Network</TableHeadCell>
|
|
222
|
+
<TableHeadCell padding="px-4 py-4" class="w-[22%]">Addresses</TableHeadCell>
|
|
223
|
+
<TableHeadCell padding="px-2 py-4" class="w-[22%]">Token</TableHeadCell>
|
|
224
|
+
<TableHeadCell padding="px-3 py-4" class="w-[20%]">Input For</TableHeadCell>
|
|
225
|
+
<TableHeadCell padding="px-3 py-4" class="w-[20%]">Output For</TableHeadCell>
|
|
226
|
+
<TableHeadCell padding="p-0" class="w-[4%]"
|
|
227
|
+
><span class="sr-only">Actions</span></TableHeadCell
|
|
228
|
+
>
|
|
132
229
|
</svelte:fragment>
|
|
133
230
|
|
|
134
231
|
<svelte:fragment slot="bodyRow" let:item>
|
|
135
|
-
<TableBodyCell tdClass="px-
|
|
136
|
-
|
|
232
|
+
<TableBodyCell tdClass="px-0" on:click={stopPropagation}>
|
|
233
|
+
<Checkbox
|
|
234
|
+
data-testid="vault-checkbox"
|
|
235
|
+
class={`block px-2 py-4 ${$account?.toLowerCase() !== item.owner.toLowerCase() ? 'invisible' : ''}`}
|
|
236
|
+
checked={selectedVaults.has(item.id)}
|
|
237
|
+
disabled={isDisabled(item, selectedVaultsOnChainId)}
|
|
238
|
+
on:change={getToggleSelectVaultHandler(item.id, item.chainId)}
|
|
239
|
+
on:click={stopPropagation}
|
|
240
|
+
aria-label={`Select vault ${item.id}`}
|
|
241
|
+
/>
|
|
242
|
+
{#if $account?.toLowerCase() === item.owner.toLowerCase() && isDisabled(item, selectedVaultsOnChainId)}
|
|
243
|
+
<Tooltip>
|
|
244
|
+
{isZeroBalance(item)
|
|
245
|
+
? 'This vault has a zero balance'
|
|
246
|
+
: 'This vault is on a different network'}
|
|
247
|
+
</Tooltip>
|
|
248
|
+
{/if}
|
|
137
249
|
</TableBodyCell>
|
|
138
250
|
|
|
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} />
|
|
251
|
+
<TableBodyCell tdClass="px-4 py-2" data-testid="vault-network">
|
|
252
|
+
{getNetworkName(Number(item.chainId))}
|
|
144
253
|
</TableBodyCell>
|
|
145
|
-
|
|
146
|
-
|
|
254
|
+
|
|
255
|
+
<TableBodyCell data-testid="vaultAddresses" tdClass="px-4 py-2">
|
|
256
|
+
<div class="flex flex-col gap-1 text-sm">
|
|
257
|
+
<div class="flex items-center gap-1">
|
|
258
|
+
<span class="text-gray-500 dark:text-gray-400">Vault:</span>
|
|
259
|
+
<Hash type={HashType.Identifier} value={toHex(item.vaultId)} />
|
|
260
|
+
</div>
|
|
261
|
+
<div class="flex items-center gap-1">
|
|
262
|
+
<span class="text-gray-500 dark:text-gray-400">Orderbook:</span>
|
|
263
|
+
<Hash type={HashType.Identifier} value={item.orderbook} />
|
|
264
|
+
</div>
|
|
265
|
+
<div class="flex items-center gap-1">
|
|
266
|
+
<span class="text-gray-500 dark:text-gray-400">Owner:</span>
|
|
267
|
+
<Hash type={HashType.Wallet} value={item.owner} />
|
|
268
|
+
</div>
|
|
269
|
+
</div>
|
|
147
270
|
</TableBodyCell>
|
|
148
|
-
<TableBodyCell tdClass="
|
|
149
|
-
>
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
271
|
+
<TableBodyCell tdClass="p-2" data-testid="vault-token">
|
|
272
|
+
<div class="flex flex-col overflow-hidden">
|
|
273
|
+
<span class="truncate font-medium">{item.token.name}</span>
|
|
274
|
+
<span class="max-w-[200px] truncate text-sm text-gray-500 dark:text-gray-400"
|
|
275
|
+
>{item.formattedBalance} {item.token.symbol}</span
|
|
276
|
+
>
|
|
277
|
+
</div>
|
|
154
278
|
</TableBodyCell>
|
|
155
|
-
<TableBodyCell tdClass="break-all p-2
|
|
156
|
-
{#if item.
|
|
279
|
+
<TableBodyCell tdClass="break-all p-2">
|
|
280
|
+
{#if item.ordersAsInput.length > 0}
|
|
157
281
|
<div data-testid="vault-order-inputs" class="flex flex-wrap items-end justify-start">
|
|
158
|
-
{#each item.
|
|
282
|
+
{#each item.ordersAsInput.slice(0, 3) as order}
|
|
159
283
|
<OrderOrVaultHash
|
|
160
284
|
type="orders"
|
|
161
285
|
orderOrVault={order}
|
|
162
|
-
|
|
163
|
-
{
|
|
286
|
+
chainId={item.chainId}
|
|
287
|
+
orderbookAddress={item.orderbook}
|
|
164
288
|
/>
|
|
165
289
|
{/each}
|
|
166
|
-
{#if item.
|
|
290
|
+
{#if item.ordersAsInput.length > 3}...{/if}
|
|
167
291
|
</div>
|
|
168
292
|
{/if}
|
|
169
293
|
</TableBodyCell>
|
|
170
|
-
<TableBodyCell tdClass="break-all p-2
|
|
171
|
-
{#if item.
|
|
294
|
+
<TableBodyCell tdClass="break-all p-2">
|
|
295
|
+
{#if item.ordersAsOutput.length > 0}
|
|
172
296
|
<div data-testid="vault-order-outputs" class="flex flex-wrap items-end justify-start">
|
|
173
|
-
{#each item.
|
|
297
|
+
{#each item.ordersAsOutput.slice(0, 3) as order}
|
|
174
298
|
<OrderOrVaultHash
|
|
175
299
|
type="orders"
|
|
176
300
|
orderOrVault={order}
|
|
177
|
-
|
|
178
|
-
{
|
|
301
|
+
chainId={item.chainId}
|
|
302
|
+
orderbookAddress={item.orderbook}
|
|
179
303
|
/>
|
|
180
304
|
{/each}
|
|
181
|
-
{#if item.
|
|
305
|
+
{#if item.ordersAsOutput.length > 3}...{/if}
|
|
182
306
|
</div>
|
|
183
307
|
{/if}
|
|
184
308
|
</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}`}
|
|
309
|
+
<TableBodyCell tdClass="px-0 text-right">
|
|
310
|
+
{#if handleDepositModal && handleWithdrawModal && item.owner.toLowerCase() === $account?.toLowerCase()}
|
|
311
|
+
<Button
|
|
312
|
+
color="alternative"
|
|
313
|
+
outline={false}
|
|
314
|
+
data-testid="vault-menu"
|
|
315
|
+
id={`vault-menu-${item.id}`}
|
|
316
|
+
class="mr-2 border-none px-2"
|
|
317
|
+
on:click={(e) => {
|
|
318
|
+
e.stopPropagation();
|
|
319
|
+
}}
|
|
207
320
|
>
|
|
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>
|
|
321
|
+
<DotsVerticalOutline class="dark:text-white" />
|
|
322
|
+
</Button>
|
|
225
323
|
{/if}
|
|
324
|
+
</TableBodyCell>
|
|
325
|
+
{#if handleDepositModal && handleWithdrawModal && item.owner.toLowerCase() === $account?.toLowerCase()}
|
|
326
|
+
<Dropdown
|
|
327
|
+
data-testid="dropdown"
|
|
328
|
+
placement="bottom-end"
|
|
329
|
+
triggeredBy={`#vault-menu-${item.id}`}
|
|
330
|
+
>
|
|
331
|
+
<DropdownItem
|
|
332
|
+
data-testid="deposit-button"
|
|
333
|
+
on:click={(e) => {
|
|
334
|
+
e.stopPropagation();
|
|
335
|
+
handleDepositModal(item, $query.refetch, context);
|
|
336
|
+
}}
|
|
337
|
+
>Deposit
|
|
338
|
+
</DropdownItem>
|
|
339
|
+
<DropdownItem
|
|
340
|
+
data-testid="withdraw-button"
|
|
341
|
+
on:click={(e) => {
|
|
342
|
+
e.stopPropagation();
|
|
343
|
+
handleWithdrawModal(item, $query.refetch, context);
|
|
344
|
+
}}
|
|
345
|
+
>Withdraw
|
|
346
|
+
</DropdownItem>
|
|
347
|
+
</Dropdown>
|
|
226
348
|
{/if}
|
|
227
349
|
</svelte:fragment>
|
|
228
350
|
</AppTable>
|
|
@@ -1,40 +1,31 @@
|
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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;
|
|
27
|
-
showMyItemsOnly: AppStoresInterface["showMyItemsOnly"];
|
|
28
|
-
signerAddress: Writable<string | null> | undefined;
|
|
4
|
+
import { getAllContexts } from 'svelte';
|
|
5
|
+
declare const __propDef: {
|
|
6
|
+
props: {
|
|
7
|
+
orderHash: AppStoresInterface["orderHash"];
|
|
8
|
+
showInactiveOrders: AppStoresInterface["showInactiveOrders"];
|
|
9
|
+
hideZeroBalanceVaults: AppStoresInterface["hideZeroBalanceVaults"];
|
|
10
|
+
hideInactiveOrdersVaults: AppStoresInterface["hideInactiveOrdersVaults"];
|
|
11
|
+
activeTokens: AppStoresInterface["activeTokens"];
|
|
12
|
+
selectedChainIds: AppStoresInterface["selectedChainIds"];
|
|
13
|
+
activeOrderbookAddresses: AppStoresInterface["activeOrderbookAddresses"];
|
|
14
|
+
ownerFilter: AppStoresInterface["ownerFilter"];
|
|
15
|
+
handleDepositModal?: ((vault: RaindexVault, refetch: () => void, context: ReturnType<typeof getAllContexts>) => void) | undefined;
|
|
16
|
+
handleWithdrawModal?: ((vault: RaindexVault, refetch: () => void, context: ReturnType<typeof getAllContexts>) => void) | undefined;
|
|
17
|
+
onWithdrawAll?: ((raindexClient: RaindexClient, vaultsList: RaindexVaultsList) => void | Promise<void>) | undefined;
|
|
29
18
|
};
|
|
30
|
-
events
|
|
19
|
+
events: {
|
|
31
20
|
[evt: string]: CustomEvent<any>;
|
|
32
21
|
};
|
|
33
|
-
slots
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export type
|
|
38
|
-
export
|
|
22
|
+
slots: {};
|
|
23
|
+
exports?: {} | undefined;
|
|
24
|
+
bindings?: string | undefined;
|
|
25
|
+
};
|
|
26
|
+
export type VaultsListTableProps = typeof __propDef.props;
|
|
27
|
+
export type VaultsListTableEvents = typeof __propDef.events;
|
|
28
|
+
export type VaultsListTableSlots = typeof __propDef.slots;
|
|
29
|
+
export default class VaultsListTable extends SvelteComponent<VaultsListTableProps, VaultsListTableEvents, VaultsListTableSlots> {
|
|
39
30
|
}
|
|
40
31
|
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 {};
|