@rainlanguage/ui-components 0.0.1-alpha.21 → 0.0.1-alpha.210
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,24 +1,31 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import type {
|
|
3
|
-
import type
|
|
4
|
-
import type { Hex } from 'viem';
|
|
5
|
-
import type { DepositOrWithdrawModalProps, OrderRemoveModalProps, QuoteDebugModalHandler, DebugTradeModalHandler } from '../../types/modal';
|
|
2
|
+
import type { DebugTradeModalHandler, QuoteDebugModalHandler } from '../../types/modal';
|
|
3
|
+
import { RaindexClient, RaindexOrder, RaindexVault, RaindexVaultsList, type Address, type Hex } from '@rainlanguage/orderbook';
|
|
6
4
|
declare const __propDef: {
|
|
7
5
|
props: {
|
|
8
|
-
handleDepositOrWithdrawModal?: ((props: DepositOrWithdrawModalProps) => void) | undefined;
|
|
9
|
-
handleOrderRemoveModal?: ((props: OrderRemoveModalProps) => void) | undefined;
|
|
10
6
|
handleQuoteDebugModal?: QuoteDebugModalHandler | undefined;
|
|
11
7
|
handleDebugTradeModal?: DebugTradeModalHandler | undefined;
|
|
12
|
-
colorTheme: any;
|
|
13
8
|
codeMirrorTheme: any;
|
|
14
9
|
lightweightChartsTheme: any;
|
|
15
|
-
orderbookAddress:
|
|
16
|
-
orderHash:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
orderbookAddress: Address;
|
|
11
|
+
orderHash: Hex;
|
|
12
|
+
chainId: number;
|
|
13
|
+
rpcs?: string[] | undefined;
|
|
14
|
+
/** Callback function when remove action is triggered for an order
|
|
15
|
+
* @param order The order to remove
|
|
16
|
+
*/ onRemove: (raindexClient: RaindexClient, order: RaindexOrder) => void;
|
|
17
|
+
/** Callback function when deposit action is triggered for a vault
|
|
18
|
+
* @param vault The vault to deposit into
|
|
19
|
+
*/ onDeposit: (raindexClient: RaindexClient, vault: RaindexVault) => void;
|
|
20
|
+
/** Callback function when withdraw action is triggered for a vault
|
|
21
|
+
* @param vault The vault to withdraw from
|
|
22
|
+
*/ onWithdraw: (raindexClient: RaindexClient, vault: RaindexVault) => void;
|
|
23
|
+
/** Callback function when withdraw all action is triggered for a vault
|
|
24
|
+
* @param vaultsList The VaultsList struct containing the vaults to withdraw from
|
|
25
|
+
*/ onWithdrawAll?: ((raindexClient: RaindexClient, vaultsList: RaindexVaultsList) => void) | undefined;
|
|
26
|
+
/** Callback function when take order action is triggered
|
|
27
|
+
* @param order The order to take
|
|
28
|
+
*/ onTakeOrder?: ((raindexClient: RaindexClient, order: RaindexOrder) => void) | undefined;
|
|
22
29
|
};
|
|
23
30
|
events: {
|
|
24
31
|
[evt: string]: CustomEvent<any>;
|
|
@@ -31,6 +38,5 @@ export type OrderDetailProps = typeof __propDef.props;
|
|
|
31
38
|
export type OrderDetailEvents = typeof __propDef.events;
|
|
32
39
|
export type OrderDetailSlots = typeof __propDef.slots;
|
|
33
40
|
export default class OrderDetail extends SvelteComponent<OrderDetailProps, OrderDetailEvents, OrderDetailSlots> {
|
|
34
|
-
get handleDebugTradeModal(): DebugTradeModalHandler;
|
|
35
41
|
}
|
|
36
42
|
export {};
|
|
@@ -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,13 +74,14 @@ $: 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"
|
|
57
86
|
on:click={refreshQuotes}
|
|
58
87
|
spin={$orderQuoteQuery.isLoading || $orderQuoteQuery.isFetching}
|
|
@@ -85,37 +114,45 @@ $: orderModalArg = order;
|
|
|
85
114
|
|
|
86
115
|
<TableBody>
|
|
87
116
|
{#if $orderQuoteQuery.data && $orderQuoteQuery.data.length > 0}
|
|
88
|
-
{#each $orderQuoteQuery.data as item}
|
|
117
|
+
{#each $orderQuoteQuery.data as item, index}
|
|
89
118
|
{#if item.success && item.data}
|
|
90
119
|
<TableBodyRow data-testid="bodyRow">
|
|
91
120
|
<TableBodyCell>{item.pair.pairName}</TableBodyCell>
|
|
92
|
-
<TableBodyCell>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
121
|
+
<TableBodyCell>
|
|
122
|
+
<span id={`max-output-${index}`} class="block max-w-[150px] truncate"
|
|
123
|
+
>{item.data.formattedMaxOutput}</span
|
|
124
|
+
>
|
|
125
|
+
<Tooltip triggeredBy={`#max-output-${index}`}>
|
|
126
|
+
{item.data.formattedMaxOutput}
|
|
127
|
+
</Tooltip>
|
|
128
|
+
</TableBodyCell>
|
|
129
|
+
<TableBodyCell>
|
|
130
|
+
<span id={`ratio-${index}`} class="block max-w-[200px] truncate"
|
|
131
|
+
>{item.data.formattedRatio}
|
|
132
|
+
<span class="text-gray-400">({item.data.formattedInverseRatio})</span></span
|
|
133
|
+
>
|
|
134
|
+
<Tooltip triggeredBy={`#ratio-${index}`}>
|
|
135
|
+
{item.data.formattedRatio} ({item.data.formattedInverseRatio})
|
|
136
|
+
</Tooltip>
|
|
137
|
+
</TableBodyCell>
|
|
138
|
+
<TableBodyCell>
|
|
139
|
+
<span id={`max-input-${index}`} class="block max-w-[150px] truncate"
|
|
140
|
+
>{item.data.formattedMaxInput}</span
|
|
141
|
+
>
|
|
142
|
+
<Tooltip triggeredBy={`#max-input-${index}`}>
|
|
143
|
+
{item.data.formattedMaxInput}
|
|
144
|
+
</Tooltip>
|
|
145
|
+
</TableBodyCell>
|
|
107
146
|
<TableBodyCell>
|
|
108
147
|
{#if handleQuoteDebugModal}
|
|
109
148
|
<button
|
|
110
149
|
on:click={() =>
|
|
111
150
|
handleQuoteDebugModal(
|
|
112
151
|
orderModalArg,
|
|
113
|
-
rpcUrl || '',
|
|
114
|
-
orderbookAddress || '',
|
|
115
152
|
item.pair.inputIndex,
|
|
116
153
|
item.pair.outputIndex,
|
|
117
154
|
item.pair.pairName,
|
|
118
|
-
$orderQuoteQuery.data[0].blockNumber
|
|
155
|
+
BigInt($orderQuoteQuery.data[0].blockNumber)
|
|
119
156
|
)}
|
|
120
157
|
>
|
|
121
158
|
<BugOutline size="sm" color="grey" />
|
|
@@ -126,31 +163,40 @@ $: orderModalArg = order;
|
|
|
126
163
|
{:else if !item.success && item.error}
|
|
127
164
|
<TableBodyRow>
|
|
128
165
|
<TableBodyCell>{item.pair.pairName}</TableBodyCell>
|
|
129
|
-
<TableBodyCell colspan="
|
|
130
|
-
<Tooltip
|
|
166
|
+
<TableBodyCell colspan="3" class="text-sm text-red-500 dark:text-red-400">
|
|
167
|
+
<Tooltip
|
|
168
|
+
triggeredBy={`#quote-error-${index}`}
|
|
169
|
+
customClass="max-w-sm whitespace-pre-wrap break-words"
|
|
170
|
+
>
|
|
131
171
|
{item.error}
|
|
132
172
|
</Tooltip>
|
|
133
|
-
<div
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
173
|
+
<div class="flex items-start gap-2">
|
|
174
|
+
<button
|
|
175
|
+
type="button"
|
|
176
|
+
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"
|
|
177
|
+
aria-label="Copy quote error"
|
|
178
|
+
on:click={() => copyQuoteError(item.error)}
|
|
179
|
+
>
|
|
180
|
+
<ClipboardOutline size="sm" />
|
|
181
|
+
</button>
|
|
182
|
+
<div
|
|
183
|
+
id={`quote-error-${index}`}
|
|
184
|
+
class="max-w-xl cursor-pointer self-start truncate border-dotted border-red-500 pr-2"
|
|
185
|
+
>
|
|
186
|
+
{item.error}
|
|
187
|
+
</div>
|
|
138
188
|
</div>
|
|
139
189
|
</TableBodyCell>
|
|
140
|
-
<TableBodyCell />
|
|
141
|
-
<TableBodyCell />
|
|
142
190
|
<TableBodyCell>
|
|
143
191
|
{#if handleQuoteDebugModal}
|
|
144
192
|
<button
|
|
145
193
|
on:click={() =>
|
|
146
194
|
handleQuoteDebugModal(
|
|
147
195
|
order,
|
|
148
|
-
rpcUrl || '',
|
|
149
|
-
orderbookAddress || '',
|
|
150
196
|
item.pair.inputIndex,
|
|
151
197
|
item.pair.outputIndex,
|
|
152
198
|
item.pair.pairName,
|
|
153
|
-
$orderQuoteQuery.data[0].blockNumber
|
|
199
|
+
BigInt($orderQuoteQuery.data[0].blockNumber)
|
|
154
200
|
)}
|
|
155
201
|
>
|
|
156
202
|
<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/orderbook';
|
|
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,58 @@
|
|
|
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
|
-
|
|
6
|
+
import {
|
|
7
|
+
RaindexClient
|
|
8
|
+
} from "@rainlanguage/orderbook";
|
|
9
|
+
import { toHex } from "viem";
|
|
11
10
|
import { createQuery } from "@tanstack/svelte-query";
|
|
12
11
|
import { onDestroy } from "svelte";
|
|
13
12
|
import { useQueryClient } from "@tanstack/svelte-query";
|
|
14
|
-
import { ArrowDownOutline, ArrowUpOutline } from "flowbite-svelte-icons";
|
|
15
13
|
import OrderOrVaultHash from "../OrderOrVaultHash.svelte";
|
|
16
|
-
import DepositOrWithdrawButtons from "./DepositOrWithdrawButtons.svelte";
|
|
17
14
|
import Refresh from "../icon/Refresh.svelte";
|
|
18
|
-
import {
|
|
19
|
-
|
|
15
|
+
import { invalidateTanstackQueries } from "../../queries/queryClient";
|
|
16
|
+
import { useAccount } from "../../providers/wallet/useAccount";
|
|
17
|
+
import { Button } from "flowbite-svelte";
|
|
18
|
+
import {
|
|
19
|
+
ArrowDownToBracketOutline,
|
|
20
|
+
ArrowUpFromBracketOutline,
|
|
21
|
+
WalletOutline
|
|
22
|
+
} from "flowbite-svelte-icons";
|
|
23
|
+
import { getExplorerLink } from "../../services/getExplorerLink";
|
|
24
|
+
import { useToasts } from "../../providers/toasts/useToasts";
|
|
25
|
+
import { useRaindexClient } from "../../hooks/useRaindexClient";
|
|
20
26
|
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"] || "";
|
|
27
|
+
export let orderbookAddress;
|
|
28
|
+
export let chainId;
|
|
29
|
+
export let onDeposit;
|
|
30
|
+
export let onWithdraw;
|
|
34
31
|
const queryClient = useQueryClient();
|
|
32
|
+
const { matchesAccount } = useAccount();
|
|
33
|
+
const { errToast } = useToasts();
|
|
34
|
+
const raindexClient = useRaindexClient();
|
|
35
35
|
$: vaultDetailQuery = createQuery({
|
|
36
36
|
queryKey: [id, QKEY_VAULT + id],
|
|
37
|
-
queryFn: () => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
queryFn: async () => {
|
|
38
|
+
const result = await raindexClient.getVault(chainId, orderbookAddress, id);
|
|
39
|
+
if (result.error) throw new Error(result.error.readableMsg);
|
|
40
|
+
return result.value;
|
|
41
|
+
}
|
|
41
42
|
});
|
|
42
|
-
const updateActiveNetworkAndOrderbook = (subgraphName) => {
|
|
43
|
-
activeNetworkRef.set(subgraphName);
|
|
44
|
-
activeOrderbookRef.set(subgraphName);
|
|
45
|
-
};
|
|
46
43
|
const interval = setInterval(async () => {
|
|
47
|
-
|
|
48
|
-
queryKey: [id],
|
|
49
|
-
refetchType: "active",
|
|
50
|
-
exact: false
|
|
51
|
-
});
|
|
44
|
+
invalidateTanstackQueries(queryClient, [id, QKEY_VAULT + id]);
|
|
52
45
|
}, 5e3);
|
|
53
46
|
onDestroy(() => {
|
|
54
47
|
clearInterval(interval);
|
|
55
48
|
});
|
|
49
|
+
const handleRefresh = async () => {
|
|
50
|
+
try {
|
|
51
|
+
await invalidateTanstackQueries(queryClient, [id, QKEY_VAULT + id]);
|
|
52
|
+
} catch {
|
|
53
|
+
errToast("Failed to refresh");
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
56
|
</script>
|
|
57
57
|
|
|
58
58
|
<TanstackPageContentDetail query={vaultDetailQuery} emptyMessage="Vault not found">
|
|
@@ -64,32 +64,30 @@ onDestroy(() => {
|
|
|
64
64
|
{data.token.name}
|
|
65
65
|
</div>
|
|
66
66
|
<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)}
|
|
67
|
+
{#if matchesAccount(data.owner)}
|
|
77
68
|
<Button
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
69
|
+
color="light"
|
|
70
|
+
size="xs"
|
|
71
|
+
data-testid="deposit-button"
|
|
72
|
+
aria-label="Deposit to vault"
|
|
73
|
+
on:click={() => onDeposit(raindexClient, data)}
|
|
82
74
|
>
|
|
75
|
+
<ArrowDownToBracketOutline size="xs" />
|
|
76
|
+
</Button>
|
|
83
77
|
<Button
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
78
|
+
color="light"
|
|
79
|
+
size="xs"
|
|
80
|
+
data-testid="withdraw-button"
|
|
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
|
+
on:click={handleRefresh}
|
|
93
91
|
spin={$vaultDetailQuery.isLoading || $vaultDetailQuery.isFetching}
|
|
94
92
|
/>
|
|
95
93
|
</div>
|
|
@@ -97,20 +95,33 @@ onDestroy(() => {
|
|
|
97
95
|
<svelte:fragment slot="card" let:data>
|
|
98
96
|
<CardProperty data-testid="vaultDetailVaultId">
|
|
99
97
|
<svelte:fragment slot="key">Vault ID</svelte:fragment>
|
|
100
|
-
<svelte:fragment slot="value">{
|
|
98
|
+
<svelte:fragment slot="value">{toHex(data.vaultId)}</svelte:fragment>
|
|
101
99
|
</CardProperty>
|
|
102
100
|
|
|
103
101
|
<CardProperty data-testid="vaultDetailOrderbookAddress">
|
|
104
102
|
<svelte:fragment slot="key">Orderbook</svelte:fragment>
|
|
105
103
|
<svelte:fragment slot="value">
|
|
106
|
-
<Hash type={HashType.Identifier} value={data.orderbook
|
|
104
|
+
<Hash type={HashType.Identifier} value={data.orderbook} />
|
|
107
105
|
</svelte:fragment>
|
|
108
106
|
</CardProperty>
|
|
109
107
|
|
|
110
108
|
<CardProperty data-testid="vaultDetailOwnerAddress">
|
|
111
|
-
<svelte:fragment slot="key">Owner
|
|
109
|
+
<svelte:fragment slot="key">Owner address</svelte:fragment>
|
|
112
110
|
<svelte:fragment slot="value">
|
|
113
|
-
|
|
111
|
+
{@const explorerLink = getExplorerLink(data.owner, chainId, 'address')}
|
|
112
|
+
{#if explorerLink}
|
|
113
|
+
<a
|
|
114
|
+
href={explorerLink}
|
|
115
|
+
target="_blank"
|
|
116
|
+
rel="noopener noreferrer"
|
|
117
|
+
class="flex items-center justify-start space-x-2 text-left text-blue-500 hover:underline"
|
|
118
|
+
>
|
|
119
|
+
<WalletOutline size="sm" />
|
|
120
|
+
<span>{data.owner}</span>
|
|
121
|
+
</a>
|
|
122
|
+
{:else}
|
|
123
|
+
<Hash type={HashType.Wallet} value={data.owner} />
|
|
124
|
+
{/if}
|
|
114
125
|
</svelte:fragment>
|
|
115
126
|
</CardProperty>
|
|
116
127
|
|
|
@@ -124,8 +135,7 @@ onDestroy(() => {
|
|
|
124
135
|
<CardProperty data-testid="vaultDetailBalance">
|
|
125
136
|
<svelte:fragment slot="key">Balance</svelte:fragment>
|
|
126
137
|
<svelte:fragment slot="value"
|
|
127
|
-
>{
|
|
128
|
-
{data.token.symbol}</svelte:fragment
|
|
138
|
+
>{`${data.formattedBalance} ${data.token.symbol}`}</svelte:fragment
|
|
129
139
|
>
|
|
130
140
|
</CardProperty>
|
|
131
141
|
|
|
@@ -135,12 +145,7 @@ onDestroy(() => {
|
|
|
135
145
|
<p data-testid="vaultDetailOrdersAsInput" class="flex flex-wrap justify-start">
|
|
136
146
|
{#if data.ordersAsInput && data.ordersAsInput.length > 0}
|
|
137
147
|
{#each data.ordersAsInput as order}
|
|
138
|
-
<OrderOrVaultHash
|
|
139
|
-
type="orders"
|
|
140
|
-
orderOrVault={order}
|
|
141
|
-
{network}
|
|
142
|
-
{updateActiveNetworkAndOrderbook}
|
|
143
|
-
/>
|
|
148
|
+
<OrderOrVaultHash type="orders" orderOrVault={order} {chainId} {orderbookAddress} />
|
|
144
149
|
{/each}
|
|
145
150
|
{:else}
|
|
146
151
|
None
|
|
@@ -152,15 +157,10 @@ onDestroy(() => {
|
|
|
152
157
|
<CardProperty>
|
|
153
158
|
<svelte:fragment slot="key">Orders as output</svelte:fragment>
|
|
154
159
|
<svelte:fragment slot="value">
|
|
155
|
-
<p data-testid="
|
|
160
|
+
<p data-testid="vaultDetailOrdersAsOutput" class="flex flex-wrap justify-start">
|
|
156
161
|
{#if data.ordersAsOutput && data.ordersAsOutput.length > 0}
|
|
157
162
|
{#each data.ordersAsOutput as order}
|
|
158
|
-
<OrderOrVaultHash
|
|
159
|
-
type="orders"
|
|
160
|
-
orderOrVault={order}
|
|
161
|
-
{network}
|
|
162
|
-
{updateActiveNetworkAndOrderbook}
|
|
163
|
-
/>
|
|
163
|
+
<OrderOrVaultHash type="orders" orderOrVault={order} {chainId} {orderbookAddress} />
|
|
164
164
|
{/each}
|
|
165
165
|
{:else}
|
|
166
166
|
None
|
|
@@ -170,9 +170,10 @@ onDestroy(() => {
|
|
|
170
170
|
</CardProperty>
|
|
171
171
|
</svelte:fragment>
|
|
172
172
|
|
|
173
|
-
<svelte:fragment slot="chart"
|
|
174
|
-
|
|
173
|
+
<svelte:fragment slot="chart">
|
|
174
|
+
<!-- TODO: Issue #1989: VaultBalanceChart temporarily disabled -->
|
|
175
|
+
<!-- <VaultBalanceChart /> -->
|
|
175
176
|
</svelte:fragment>
|
|
176
177
|
|
|
177
|
-
<svelte:fragment slot="below"><VaultBalanceChangesTable {
|
|
178
|
+
<svelte:fragment slot="below" let:data><VaultBalanceChangesTable vault={data} /></svelte:fragment>
|
|
178
179
|
</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/orderbook';
|
|
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
|
+
orderbookAddress: 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 {};
|