@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,9 +1,9 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script>import { useToasts } from "../../providers/toasts/useToasts";
|
|
2
|
+
import { invalidateTanstackQueries } from "../../queries/queryClient";
|
|
2
3
|
import Refresh from "../icon/Refresh.svelte";
|
|
3
4
|
import EditableSpan from "../EditableSpan.svelte";
|
|
4
|
-
import { getOrderQuote } from "@rainlanguage/orderbook/quote";
|
|
5
5
|
import { QKEY_ORDER_QUOTE } from "../../queries/keys";
|
|
6
|
-
import {
|
|
6
|
+
import { hexToNumber, isHex } from "viem";
|
|
7
7
|
import { createQuery, useQueryClient } from "@tanstack/svelte-query";
|
|
8
8
|
import {
|
|
9
9
|
Table,
|
|
@@ -11,24 +11,52 @@ import {
|
|
|
11
11
|
TableBodyCell,
|
|
12
12
|
TableBodyRow,
|
|
13
13
|
TableHead,
|
|
14
|
-
TableHeadCell
|
|
15
|
-
Tooltip
|
|
14
|
+
TableHeadCell
|
|
16
15
|
} from "flowbite-svelte";
|
|
17
|
-
import { BugOutline, PauseSolid, PlaySolid } from "flowbite-svelte-icons";
|
|
18
|
-
|
|
16
|
+
import { BugOutline, ClipboardOutline, PauseSolid, PlaySolid } from "flowbite-svelte-icons";
|
|
17
|
+
import Tooltip from "../Tooltip.svelte";
|
|
19
18
|
export let order;
|
|
20
|
-
export let rpcUrl;
|
|
21
|
-
export let orderbookAddress;
|
|
22
19
|
export let handleQuoteDebugModal = void 0;
|
|
23
20
|
let enabled = true;
|
|
24
21
|
const queryClient = useQueryClient();
|
|
22
|
+
const { errToast, addToast } = useToasts();
|
|
25
23
|
const refreshQuotes = async () => {
|
|
26
|
-
|
|
24
|
+
try {
|
|
25
|
+
await invalidateTanstackQueries(queryClient, [order.id, QKEY_ORDER_QUOTE + order.id]);
|
|
26
|
+
} catch {
|
|
27
|
+
errToast("Failed to refresh");
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const copyQuoteError = async (error) => {
|
|
31
|
+
if (!error) {
|
|
32
|
+
errToast("No quote error to copy");
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
if (typeof navigator === "undefined" || !navigator.clipboard?.writeText) {
|
|
37
|
+
throw new Error("Clipboard API unavailable");
|
|
38
|
+
}
|
|
39
|
+
await navigator.clipboard.writeText(error);
|
|
40
|
+
addToast({
|
|
41
|
+
message: "Copied quote error",
|
|
42
|
+
type: "success",
|
|
43
|
+
color: "green"
|
|
44
|
+
});
|
|
45
|
+
} catch (copyError) {
|
|
46
|
+
errToast(
|
|
47
|
+
"Failed to copy quote error",
|
|
48
|
+
copyError instanceof Error ? copyError.message : void 0
|
|
49
|
+
);
|
|
50
|
+
}
|
|
27
51
|
};
|
|
28
52
|
$: orderQuoteQuery = createQuery({
|
|
29
|
-
queryKey: [id, QKEY_ORDER_QUOTE + id],
|
|
30
|
-
queryFn: () =>
|
|
31
|
-
|
|
53
|
+
queryKey: [order.id, QKEY_ORDER_QUOTE + order.id],
|
|
54
|
+
queryFn: async () => {
|
|
55
|
+
const result = await order.getQuotes(blockNumber);
|
|
56
|
+
if (result.error) throw new Error(result.error.msg);
|
|
57
|
+
return result.value;
|
|
58
|
+
},
|
|
59
|
+
enabled: !!order.id && enabled
|
|
32
60
|
});
|
|
33
61
|
let blockNumber;
|
|
34
62
|
$: orderModalArg = order;
|
|
@@ -36,7 +64,7 @@ $: orderModalArg = order;
|
|
|
36
64
|
|
|
37
65
|
<div class="mt-4">
|
|
38
66
|
<div class="mb-4 flex items-center justify-between">
|
|
39
|
-
<h2 class="text-lg font-semibold">Order
|
|
67
|
+
<h2 class="text-lg font-semibold">Order quotes</h2>
|
|
40
68
|
<div class="flex items-center gap-x-1">
|
|
41
69
|
{#if $orderQuoteQuery.data && $orderQuoteQuery.data.length > 0 && isHex($orderQuoteQuery.data[0].blockNumber)}
|
|
42
70
|
<EditableSpan
|
|
@@ -46,24 +74,33 @@ $: orderModalArg = order;
|
|
|
46
74
|
enabled = false;
|
|
47
75
|
}}
|
|
48
76
|
on:blur={({ detail: { value } }) => {
|
|
49
|
-
blockNumber =
|
|
77
|
+
blockNumber = BigInt(value);
|
|
50
78
|
refreshQuotes();
|
|
51
79
|
}}
|
|
52
80
|
/>
|
|
53
81
|
{/if}
|
|
54
82
|
<span></span>
|
|
55
83
|
<Refresh
|
|
84
|
+
data-testid="refresh-button"
|
|
56
85
|
class="h-8 w-5 cursor-pointer text-gray-400 dark:text-gray-400"
|
|
86
|
+
title="Refresh quotes"
|
|
87
|
+
ariaLabel="Refresh quotes"
|
|
57
88
|
on:click={refreshQuotes}
|
|
58
89
|
spin={$orderQuoteQuery.isLoading || $orderQuoteQuery.isFetching}
|
|
59
90
|
/>
|
|
60
91
|
<PauseSolid
|
|
92
|
+
data-testid="pause-refresh-button"
|
|
93
|
+
title="Pause auto-refresh"
|
|
94
|
+
ariaLabel="Pause auto-refresh"
|
|
61
95
|
class={`ml-2 h-8 w-3 cursor-pointer text-gray-400 dark:text-gray-400 ${!enabled ? 'hidden' : ''}`}
|
|
62
96
|
on:click={() => {
|
|
63
97
|
enabled = false;
|
|
64
98
|
}}
|
|
65
99
|
/>
|
|
66
100
|
<PlaySolid
|
|
101
|
+
data-testid="resume-refresh-button"
|
|
102
|
+
title="Resume auto-refresh"
|
|
103
|
+
ariaLabel="Resume auto-refresh"
|
|
67
104
|
on:click={() => {
|
|
68
105
|
enabled = true;
|
|
69
106
|
blockNumber = undefined;
|
|
@@ -85,37 +122,55 @@ $: orderModalArg = order;
|
|
|
85
122
|
|
|
86
123
|
<TableBody>
|
|
87
124
|
{#if $orderQuoteQuery.data && $orderQuoteQuery.data.length > 0}
|
|
88
|
-
{#each $orderQuoteQuery.data as item}
|
|
125
|
+
{#each $orderQuoteQuery.data as item, index}
|
|
89
126
|
{#if item.success && item.data}
|
|
90
127
|
<TableBodyRow data-testid="bodyRow">
|
|
91
128
|
<TableBodyCell>{item.pair.pairName}</TableBodyCell>
|
|
92
|
-
<TableBodyCell>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
>
|
|
129
|
+
<TableBodyCell>
|
|
130
|
+
<span id={`max-output-${index}`} class="block max-w-[150px] truncate"
|
|
131
|
+
>{item.data.formattedMaxOutput}</span
|
|
132
|
+
>
|
|
133
|
+
<Tooltip triggeredBy={`#max-output-${index}`}>
|
|
134
|
+
{item.data.formattedMaxOutput}
|
|
135
|
+
</Tooltip>
|
|
136
|
+
{#if item.data.formattedMaxOutputAsPercentOfVault}
|
|
137
|
+
<span
|
|
138
|
+
data-testid={`max-output-percent-${index}`}
|
|
139
|
+
class="block max-w-[150px] truncate text-xs text-gray-400"
|
|
140
|
+
>{item.data.formattedMaxOutputAsPercentOfVault}% of vault</span
|
|
141
|
+
>
|
|
142
|
+
{/if}
|
|
143
|
+
</TableBodyCell>
|
|
144
|
+
<TableBodyCell>
|
|
145
|
+
<span id={`ratio-${index}`} class="block max-w-[200px] truncate"
|
|
146
|
+
>{item.data.formattedRatio}
|
|
147
|
+
<span class="text-gray-400">({item.data.formattedInverseRatio})</span></span
|
|
148
|
+
>
|
|
149
|
+
<Tooltip triggeredBy={`#ratio-${index}`}>
|
|
150
|
+
{item.data.formattedRatio} ({item.data.formattedInverseRatio})
|
|
151
|
+
</Tooltip>
|
|
152
|
+
</TableBodyCell>
|
|
153
|
+
<TableBodyCell>
|
|
154
|
+
<span id={`max-input-${index}`} class="block max-w-[150px] truncate"
|
|
155
|
+
>{item.data.formattedMaxInput}</span
|
|
156
|
+
>
|
|
157
|
+
<Tooltip triggeredBy={`#max-input-${index}`}>
|
|
158
|
+
{item.data.formattedMaxInput}
|
|
159
|
+
</Tooltip>
|
|
160
|
+
</TableBodyCell>
|
|
107
161
|
<TableBodyCell>
|
|
108
162
|
{#if handleQuoteDebugModal}
|
|
109
163
|
<button
|
|
164
|
+
data-testid="debug-quote-button"
|
|
165
|
+
title="Debug quote"
|
|
166
|
+
aria-label="Debug quote"
|
|
110
167
|
on:click={() =>
|
|
111
168
|
handleQuoteDebugModal(
|
|
112
169
|
orderModalArg,
|
|
113
|
-
rpcUrl || '',
|
|
114
|
-
orderbookAddress || '',
|
|
115
170
|
item.pair.inputIndex,
|
|
116
171
|
item.pair.outputIndex,
|
|
117
172
|
item.pair.pairName,
|
|
118
|
-
$orderQuoteQuery.data[0].blockNumber
|
|
173
|
+
BigInt($orderQuoteQuery.data[0].blockNumber)
|
|
119
174
|
)}
|
|
120
175
|
>
|
|
121
176
|
<BugOutline size="sm" color="grey" />
|
|
@@ -126,31 +181,44 @@ $: orderModalArg = order;
|
|
|
126
181
|
{:else if !item.success && item.error}
|
|
127
182
|
<TableBodyRow>
|
|
128
183
|
<TableBodyCell>{item.pair.pairName}</TableBodyCell>
|
|
129
|
-
<TableBodyCell colspan="
|
|
130
|
-
<Tooltip
|
|
184
|
+
<TableBodyCell colspan="3" class="text-sm text-red-500 dark:text-red-400">
|
|
185
|
+
<Tooltip
|
|
186
|
+
triggeredBy={`#quote-error-${index}`}
|
|
187
|
+
customClass="max-w-sm whitespace-pre-wrap break-words"
|
|
188
|
+
>
|
|
131
189
|
{item.error}
|
|
132
190
|
</Tooltip>
|
|
133
|
-
<div
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
191
|
+
<div class="flex items-start gap-2">
|
|
192
|
+
<button
|
|
193
|
+
type="button"
|
|
194
|
+
class="mt-0.5 rounded border border-transparent p-1 text-gray-400 transition hover:bg-gray-100 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-gray-100"
|
|
195
|
+
title="Copy quote error"
|
|
196
|
+
aria-label="Copy quote error"
|
|
197
|
+
on:click={() => copyQuoteError(item.error)}
|
|
198
|
+
>
|
|
199
|
+
<ClipboardOutline size="sm" />
|
|
200
|
+
</button>
|
|
201
|
+
<div
|
|
202
|
+
id={`quote-error-${index}`}
|
|
203
|
+
class="max-w-xl cursor-pointer self-start truncate border-dotted border-red-500 pr-2"
|
|
204
|
+
>
|
|
205
|
+
{item.error}
|
|
206
|
+
</div>
|
|
138
207
|
</div>
|
|
139
208
|
</TableBodyCell>
|
|
140
|
-
<TableBodyCell />
|
|
141
|
-
<TableBodyCell />
|
|
142
209
|
<TableBodyCell>
|
|
143
210
|
{#if handleQuoteDebugModal}
|
|
144
211
|
<button
|
|
212
|
+
data-testid="debug-quote-error-button"
|
|
213
|
+
title="Debug quote"
|
|
214
|
+
aria-label="Debug quote"
|
|
145
215
|
on:click={() =>
|
|
146
216
|
handleQuoteDebugModal(
|
|
147
217
|
order,
|
|
148
|
-
rpcUrl || '',
|
|
149
|
-
orderbookAddress || '',
|
|
150
218
|
item.pair.inputIndex,
|
|
151
219
|
item.pair.outputIndex,
|
|
152
220
|
item.pair.pairName,
|
|
153
|
-
$orderQuoteQuery.data[0].blockNumber
|
|
221
|
+
BigInt($orderQuoteQuery.data[0].blockNumber)
|
|
154
222
|
)}
|
|
155
223
|
>
|
|
156
224
|
<BugOutline size="sm" color="grey" />
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
order: SgOrder;
|
|
8
|
-
rpcUrl: string;
|
|
9
|
-
orderbookAddress: Hex;
|
|
10
|
-
handleQuoteDebugModal?: ((order: SgOrder, rpcUrl: string, orderbookAddress: Hex, inputIndex: number, outputIndex: number, pairName: string, blockNumber?: number) => void) | undefined;
|
|
2
|
+
import type { RaindexOrder } from '@rainlanguage/raindex';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
order: RaindexOrder;
|
|
6
|
+
handleQuoteDebugModal?: undefined | ((order: RaindexOrder, inputIndex: number, outputIndex: number, pairName: string, blockNumber?: bigint) => void);
|
|
11
7
|
};
|
|
12
|
-
events
|
|
8
|
+
events: {
|
|
13
9
|
[evt: string]: CustomEvent<any>;
|
|
14
10
|
};
|
|
15
|
-
slots
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export type
|
|
20
|
-
export
|
|
11
|
+
slots: {};
|
|
12
|
+
exports?: {} | undefined;
|
|
13
|
+
bindings?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
export type TanstackOrderQuoteProps = typeof __propDef.props;
|
|
16
|
+
export type TanstackOrderQuoteEvents = typeof __propDef.events;
|
|
17
|
+
export type TanstackOrderQuoteSlots = typeof __propDef.slots;
|
|
18
|
+
export default class TanstackOrderQuote extends SvelteComponent<TanstackOrderQuoteProps, TanstackOrderQuoteEvents, TanstackOrderQuoteSlots> {
|
|
21
19
|
}
|
|
22
20
|
export {};
|
|
@@ -1,58 +1,56 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import { bigintStringToHex } from "../../utils/hex";
|
|
3
|
-
import Hash, { HashType } from "../Hash.svelte";
|
|
1
|
+
<script>import Hash, { HashType } from "../Hash.svelte";
|
|
4
2
|
import VaultBalanceChangesTable from "../tables/VaultBalanceChangesTable.svelte";
|
|
5
|
-
import VaultBalanceChart from "../charts/VaultBalanceChart.svelte";
|
|
6
3
|
import TanstackPageContentDetail from "./TanstackPageContentDetail.svelte";
|
|
7
4
|
import CardProperty from "../CardProperty.svelte";
|
|
8
5
|
import { QKEY_VAULT } from "../../queries/keys";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
6
|
+
import { RaindexClient } from "@rainlanguage/raindex";
|
|
7
|
+
import { toHex } from "viem";
|
|
11
8
|
import { createQuery } from "@tanstack/svelte-query";
|
|
12
9
|
import { onDestroy } from "svelte";
|
|
13
10
|
import { useQueryClient } from "@tanstack/svelte-query";
|
|
14
|
-
import { ArrowDownOutline, ArrowUpOutline } from "flowbite-svelte-icons";
|
|
15
11
|
import OrderOrVaultHash from "../OrderOrVaultHash.svelte";
|
|
16
|
-
import DepositOrWithdrawButtons from "./DepositOrWithdrawButtons.svelte";
|
|
17
12
|
import Refresh from "../icon/Refresh.svelte";
|
|
18
|
-
import {
|
|
19
|
-
|
|
13
|
+
import { invalidateTanstackQueries } from "../../queries/queryClient";
|
|
14
|
+
import { useAccount } from "../../providers/wallet/useAccount";
|
|
15
|
+
import { Button } from "flowbite-svelte";
|
|
16
|
+
import {
|
|
17
|
+
ArrowDownToBracketOutline,
|
|
18
|
+
ArrowUpFromBracketOutline,
|
|
19
|
+
WalletOutline
|
|
20
|
+
} from "flowbite-svelte-icons";
|
|
21
|
+
import { getExplorerLink } from "../../services/getExplorerLink";
|
|
22
|
+
import { useToasts } from "../../providers/toasts/useToasts";
|
|
23
|
+
import { useRaindexClient } from "../../hooks/useRaindexClient";
|
|
20
24
|
export let id;
|
|
21
|
-
export let
|
|
22
|
-
export let
|
|
23
|
-
export let
|
|
24
|
-
export let
|
|
25
|
-
export let lightweightChartsTheme = void 0;
|
|
26
|
-
export let activeNetworkRef;
|
|
27
|
-
export let activeOrderbookRef;
|
|
28
|
-
export let settings;
|
|
29
|
-
export let wagmiConfig = void 0;
|
|
30
|
-
export let signerAddress = void 0;
|
|
31
|
-
const subgraphUrl = $settings?.subgraphs?.[network] || "";
|
|
32
|
-
const chainId = $settings?.networks?.[network]?.["chain-id"] || 0;
|
|
33
|
-
const rpcUrl = $settings?.networks?.[network]?.["rpc"] || "";
|
|
25
|
+
export let raindexAddress;
|
|
26
|
+
export let chainId;
|
|
27
|
+
export let onDeposit;
|
|
28
|
+
export let onWithdraw;
|
|
34
29
|
const queryClient = useQueryClient();
|
|
30
|
+
const { matchesAccount } = useAccount();
|
|
31
|
+
const { errToast } = useToasts();
|
|
32
|
+
const raindexClient = useRaindexClient();
|
|
35
33
|
$: vaultDetailQuery = createQuery({
|
|
36
34
|
queryKey: [id, QKEY_VAULT + id],
|
|
37
|
-
queryFn: () => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
queryFn: async () => {
|
|
36
|
+
const result = await raindexClient.getVault(chainId, raindexAddress, id);
|
|
37
|
+
if (result.error) throw new Error(result.error.readableMsg);
|
|
38
|
+
return result.value;
|
|
39
|
+
}
|
|
41
40
|
});
|
|
42
|
-
const updateActiveNetworkAndOrderbook = (subgraphName) => {
|
|
43
|
-
activeNetworkRef.set(subgraphName);
|
|
44
|
-
activeOrderbookRef.set(subgraphName);
|
|
45
|
-
};
|
|
46
41
|
const interval = setInterval(async () => {
|
|
47
|
-
|
|
48
|
-
queryKey: [id],
|
|
49
|
-
refetchType: "active",
|
|
50
|
-
exact: false
|
|
51
|
-
});
|
|
42
|
+
invalidateTanstackQueries(queryClient, [id, QKEY_VAULT + id]);
|
|
52
43
|
}, 5e3);
|
|
53
44
|
onDestroy(() => {
|
|
54
45
|
clearInterval(interval);
|
|
55
46
|
});
|
|
47
|
+
const handleRefresh = async () => {
|
|
48
|
+
try {
|
|
49
|
+
await invalidateTanstackQueries(queryClient, [id, QKEY_VAULT + id]);
|
|
50
|
+
} catch {
|
|
51
|
+
errToast("Failed to refresh");
|
|
52
|
+
}
|
|
53
|
+
};
|
|
56
54
|
</script>
|
|
57
55
|
|
|
58
56
|
<TanstackPageContentDetail query={vaultDetailQuery} emptyMessage="Vault not found">
|
|
@@ -64,32 +62,34 @@ onDestroy(() => {
|
|
|
64
62
|
{data.token.name}
|
|
65
63
|
</div>
|
|
66
64
|
<div class="flex items-center gap-2">
|
|
67
|
-
{#if
|
|
68
|
-
<DepositOrWithdrawButtons
|
|
69
|
-
vault={data}
|
|
70
|
-
{chainId}
|
|
71
|
-
{rpcUrl}
|
|
72
|
-
query={vaultDetailQuery}
|
|
73
|
-
{handleDepositOrWithdrawModal}
|
|
74
|
-
{subgraphUrl}
|
|
75
|
-
/>
|
|
76
|
-
{:else if handleDepositModal && handleWithdrawModal && $walletAddressMatchesOrBlank?.(data.owner)}
|
|
65
|
+
{#if matchesAccount(data.owner)}
|
|
77
66
|
<Button
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
67
|
+
color="light"
|
|
68
|
+
size="xs"
|
|
69
|
+
data-testid="deposit-button"
|
|
70
|
+
title="Deposit to vault"
|
|
71
|
+
aria-label="Deposit to vault"
|
|
72
|
+
on:click={() => onDeposit(raindexClient, data)}
|
|
82
73
|
>
|
|
74
|
+
<ArrowDownToBracketOutline size="xs" />
|
|
75
|
+
</Button>
|
|
83
76
|
<Button
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
77
|
+
color="light"
|
|
78
|
+
size="xs"
|
|
79
|
+
data-testid="withdraw-button"
|
|
80
|
+
title="Withdraw from vault"
|
|
81
|
+
aria-label="Withdraw from vault"
|
|
82
|
+
on:click={() => onWithdraw(raindexClient, data)}
|
|
88
83
|
>
|
|
84
|
+
<ArrowUpFromBracketOutline size="xs" />
|
|
85
|
+
</Button>
|
|
89
86
|
{/if}
|
|
90
87
|
|
|
91
88
|
<Refresh
|
|
92
|
-
|
|
89
|
+
testId="top-refresh"
|
|
90
|
+
title="Refresh vault"
|
|
91
|
+
ariaLabel="Refresh vault"
|
|
92
|
+
on:click={handleRefresh}
|
|
93
93
|
spin={$vaultDetailQuery.isLoading || $vaultDetailQuery.isFetching}
|
|
94
94
|
/>
|
|
95
95
|
</div>
|
|
@@ -97,20 +97,33 @@ onDestroy(() => {
|
|
|
97
97
|
<svelte:fragment slot="card" let:data>
|
|
98
98
|
<CardProperty data-testid="vaultDetailVaultId">
|
|
99
99
|
<svelte:fragment slot="key">Vault ID</svelte:fragment>
|
|
100
|
-
<svelte:fragment slot="value">{
|
|
100
|
+
<svelte:fragment slot="value">{toHex(data.vaultId)}</svelte:fragment>
|
|
101
101
|
</CardProperty>
|
|
102
102
|
|
|
103
|
-
<CardProperty data-testid="
|
|
104
|
-
<svelte:fragment slot="key">
|
|
103
|
+
<CardProperty data-testid="vaultDetailRaindexAddress">
|
|
104
|
+
<svelte:fragment slot="key">Raindex</svelte:fragment>
|
|
105
105
|
<svelte:fragment slot="value">
|
|
106
|
-
<Hash type={HashType.Identifier} value={data.
|
|
106
|
+
<Hash type={HashType.Identifier} value={data.raindex} />
|
|
107
107
|
</svelte:fragment>
|
|
108
108
|
</CardProperty>
|
|
109
109
|
|
|
110
110
|
<CardProperty data-testid="vaultDetailOwnerAddress">
|
|
111
|
-
<svelte:fragment slot="key">Owner
|
|
111
|
+
<svelte:fragment slot="key">Owner address</svelte:fragment>
|
|
112
112
|
<svelte:fragment slot="value">
|
|
113
|
-
|
|
113
|
+
{@const explorerLink = getExplorerLink(data.owner, chainId, 'address')}
|
|
114
|
+
{#if explorerLink}
|
|
115
|
+
<a
|
|
116
|
+
href={explorerLink}
|
|
117
|
+
target="_blank"
|
|
118
|
+
rel="noopener noreferrer"
|
|
119
|
+
class="flex items-center justify-start space-x-2 text-left text-blue-500 hover:underline"
|
|
120
|
+
>
|
|
121
|
+
<WalletOutline size="sm" />
|
|
122
|
+
<span>{data.owner}</span>
|
|
123
|
+
</a>
|
|
124
|
+
{:else}
|
|
125
|
+
<Hash type={HashType.Wallet} value={data.owner} />
|
|
126
|
+
{/if}
|
|
114
127
|
</svelte:fragment>
|
|
115
128
|
</CardProperty>
|
|
116
129
|
|
|
@@ -124,8 +137,7 @@ onDestroy(() => {
|
|
|
124
137
|
<CardProperty data-testid="vaultDetailBalance">
|
|
125
138
|
<svelte:fragment slot="key">Balance</svelte:fragment>
|
|
126
139
|
<svelte:fragment slot="value"
|
|
127
|
-
>{
|
|
128
|
-
{data.token.symbol}</svelte:fragment
|
|
140
|
+
>{`${data.formattedBalance} ${data.token.symbol}`}</svelte:fragment
|
|
129
141
|
>
|
|
130
142
|
</CardProperty>
|
|
131
143
|
|
|
@@ -135,12 +147,7 @@ onDestroy(() => {
|
|
|
135
147
|
<p data-testid="vaultDetailOrdersAsInput" class="flex flex-wrap justify-start">
|
|
136
148
|
{#if data.ordersAsInput && data.ordersAsInput.length > 0}
|
|
137
149
|
{#each data.ordersAsInput as order}
|
|
138
|
-
<OrderOrVaultHash
|
|
139
|
-
type="orders"
|
|
140
|
-
orderOrVault={order}
|
|
141
|
-
{network}
|
|
142
|
-
{updateActiveNetworkAndOrderbook}
|
|
143
|
-
/>
|
|
150
|
+
<OrderOrVaultHash type="orders" orderOrVault={order} {chainId} {raindexAddress} />
|
|
144
151
|
{/each}
|
|
145
152
|
{:else}
|
|
146
153
|
None
|
|
@@ -152,15 +159,10 @@ onDestroy(() => {
|
|
|
152
159
|
<CardProperty>
|
|
153
160
|
<svelte:fragment slot="key">Orders as output</svelte:fragment>
|
|
154
161
|
<svelte:fragment slot="value">
|
|
155
|
-
<p data-testid="
|
|
162
|
+
<p data-testid="vaultDetailOrdersAsOutput" class="flex flex-wrap justify-start">
|
|
156
163
|
{#if data.ordersAsOutput && data.ordersAsOutput.length > 0}
|
|
157
164
|
{#each data.ordersAsOutput as order}
|
|
158
|
-
<OrderOrVaultHash
|
|
159
|
-
type="orders"
|
|
160
|
-
orderOrVault={order}
|
|
161
|
-
{network}
|
|
162
|
-
{updateActiveNetworkAndOrderbook}
|
|
163
|
-
/>
|
|
165
|
+
<OrderOrVaultHash type="orders" orderOrVault={order} {chainId} {raindexAddress} />
|
|
164
166
|
{/each}
|
|
165
167
|
{:else}
|
|
166
168
|
None
|
|
@@ -170,9 +172,10 @@ onDestroy(() => {
|
|
|
170
172
|
</CardProperty>
|
|
171
173
|
</svelte:fragment>
|
|
172
174
|
|
|
173
|
-
<svelte:fragment slot="chart"
|
|
174
|
-
|
|
175
|
+
<svelte:fragment slot="chart">
|
|
176
|
+
<!-- TODO: Issue #1989: VaultBalanceChart temporarily disabled -->
|
|
177
|
+
<!-- <VaultBalanceChart /> -->
|
|
175
178
|
</svelte:fragment>
|
|
176
179
|
|
|
177
|
-
<svelte:fragment slot="below"><VaultBalanceChangesTable {
|
|
180
|
+
<svelte:fragment slot="below" let:data><VaultBalanceChangesTable vault={data} /></svelte:fragment>
|
|
178
181
|
</TanstackPageContentDetail>
|
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import type
|
|
3
|
-
import type { Readable, Writable } from 'svelte/store';
|
|
4
|
-
import type { SgVault } from '@rainlanguage/orderbook/js_api';
|
|
5
|
-
import type { AppStoresInterface } from '../../types/appStores';
|
|
6
|
-
import type { Config } from 'wagmi';
|
|
7
|
-
import type { DepositOrWithdrawModalProps } from '../../types/modal';
|
|
2
|
+
import { RaindexClient, type Address, type Hex, type RaindexVault } from '@rainlanguage/raindex';
|
|
8
3
|
declare const __propDef: {
|
|
9
4
|
props: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
signerAddress?: Writable<string | null> | undefined;
|
|
5
|
+
id: Hex;
|
|
6
|
+
raindexAddress: Address;
|
|
7
|
+
chainId: number;
|
|
8
|
+
/**
|
|
9
|
+
* Required callback function when deposit action is triggered for a vault
|
|
10
|
+
* @param vault The vault to deposit into
|
|
11
|
+
*/ onDeposit: (raindexClient: RaindexClient, vault: RaindexVault) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Required callback function when withdraw action is triggered for a vault
|
|
14
|
+
* @param vault The vault to withdraw from
|
|
15
|
+
*/ onWithdraw: (raindexClient: RaindexClient, vault: RaindexVault) => void;
|
|
22
16
|
};
|
|
23
17
|
events: {
|
|
24
18
|
[evt: string]: CustomEvent<any>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script>import DropdownCheckbox from "./DropdownCheckbox.svelte";
|
|
2
|
+
import { getNetworkName } from "../../utils/getNetworkName";
|
|
3
|
+
import { useRaindexClient } from "../../hooks/useRaindexClient";
|
|
4
|
+
const raindexClient = useRaindexClient();
|
|
5
|
+
export let selectedChainIds;
|
|
6
|
+
let dropdownOptions = {};
|
|
7
|
+
$: {
|
|
8
|
+
const uniqueChainIds = raindexClient.getUniqueChainIds();
|
|
9
|
+
if (uniqueChainIds.error) {
|
|
10
|
+
dropdownOptions = {};
|
|
11
|
+
} else {
|
|
12
|
+
dropdownOptions = Object.fromEntries(
|
|
13
|
+
uniqueChainIds.value.map((chainId) => [
|
|
14
|
+
String(chainId),
|
|
15
|
+
getNetworkName(chainId) ?? `Chain ${chainId}`
|
|
16
|
+
])
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function handleStatusChange(event) {
|
|
21
|
+
const chainIds = Object.keys(event.detail).map(Number);
|
|
22
|
+
selectedChainIds.set(chainIds);
|
|
23
|
+
}
|
|
24
|
+
let value = {};
|
|
25
|
+
$: {
|
|
26
|
+
value = Object.fromEntries(
|
|
27
|
+
$selectedChainIds.map((chainId) => [
|
|
28
|
+
String(chainId),
|
|
29
|
+
getNetworkName(chainId) ?? `Chain ${chainId}`
|
|
30
|
+
])
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<div data-testid="subgraphs-dropdown">
|
|
36
|
+
<DropdownCheckbox
|
|
37
|
+
options={dropdownOptions}
|
|
38
|
+
on:change={handleStatusChange}
|
|
39
|
+
label="Networks"
|
|
40
|
+
showAllLabel={false}
|
|
41
|
+
onlyTitle={true}
|
|
42
|
+
{value}
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { AppStoresInterface } from '../../types/appStores';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
selectedChainIds: AppStoresInterface["selectedChainIds"];
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
exports?: {} | undefined;
|
|
12
|
+
bindings?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type DropdownActiveNetworksProps = typeof __propDef.props;
|
|
15
|
+
export type DropdownActiveNetworksEvents = typeof __propDef.events;
|
|
16
|
+
export type DropdownActiveNetworksSlots = typeof __propDef.slots;
|
|
17
|
+
export default class DropdownActiveNetworks extends SvelteComponent<DropdownActiveNetworksProps, DropdownActiveNetworksEvents, DropdownActiveNetworksSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -31,8 +31,8 @@ function toggleItem(key) {
|
|
|
31
31
|
}
|
|
32
32
|
</script>
|
|
33
33
|
|
|
34
|
-
<
|
|
35
|
-
<
|
|
34
|
+
<div class="flex flex-col items-center gap-2">
|
|
35
|
+
<Label>{label}</Label>
|
|
36
36
|
<Button
|
|
37
37
|
color="alternative"
|
|
38
38
|
class="flex w-full justify-between overflow-hidden pl-2 pr-0 text-left"
|
|
@@ -66,9 +66,9 @@ function toggleItem(key) {
|
|
|
66
66
|
checked={key in value}
|
|
67
67
|
>
|
|
68
68
|
<div class="ml-2">
|
|
69
|
-
<div class="text-sm font-medium">{
|
|
69
|
+
<div class="text-sm font-medium">{optionValue}</div>
|
|
70
70
|
{#if !onlyTitle}
|
|
71
|
-
<div class="text-xs text-gray-500">{
|
|
71
|
+
<div class="text-xs text-gray-500">{key}</div>
|
|
72
72
|
{/if}
|
|
73
73
|
</div>
|
|
74
74
|
</Checkbox>
|