@rainlanguage/ui-components 0.0.1-alpha.23 → 0.0.1-alpha.231
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 +185 -213
- 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 +212 -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 +206 -114
- 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 +2 -1
- 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
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
<script>import { Input, Button, Modal } from "flowbite-svelte";
|
|
2
|
+
import { SearchOutline, CheckCircleSolid, ChevronDownSolid } from "flowbite-svelte-icons";
|
|
3
|
+
import { useGui } from "../../hooks/useGui";
|
|
4
|
+
import { onMount, tick } from "svelte";
|
|
5
|
+
export let selectedToken = null;
|
|
6
|
+
export let onSelect;
|
|
7
|
+
let modalOpen = false;
|
|
8
|
+
let searchQuery = "";
|
|
9
|
+
let tokens = [];
|
|
10
|
+
let isSearching = false;
|
|
11
|
+
let failedImages = /* @__PURE__ */ new Set();
|
|
12
|
+
const gui = useGui();
|
|
13
|
+
async function loadTokens(search) {
|
|
14
|
+
isSearching = true;
|
|
15
|
+
const result = await gui.getAllTokens(search);
|
|
16
|
+
if (result.error) {
|
|
17
|
+
tokens = [];
|
|
18
|
+
} else {
|
|
19
|
+
tokens = result.value;
|
|
20
|
+
}
|
|
21
|
+
isSearching = false;
|
|
22
|
+
}
|
|
23
|
+
function handleSearch(event) {
|
|
24
|
+
const target = event.target;
|
|
25
|
+
searchQuery = target.value;
|
|
26
|
+
loadTokens(searchQuery || void 0);
|
|
27
|
+
}
|
|
28
|
+
onMount(() => loadTokens());
|
|
29
|
+
function formatAddress(address) {
|
|
30
|
+
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
31
|
+
}
|
|
32
|
+
function handleTokenSelect(token) {
|
|
33
|
+
onSelect(token);
|
|
34
|
+
modalOpen = false;
|
|
35
|
+
}
|
|
36
|
+
function handleImageError(address) {
|
|
37
|
+
failedImages = /* @__PURE__ */ new Set([...failedImages, address]);
|
|
38
|
+
}
|
|
39
|
+
$: displayText = selectedToken ? `${selectedToken.name} (${selectedToken.symbol})` : "Select a token...";
|
|
40
|
+
$: if (modalOpen) {
|
|
41
|
+
tick().then(() => {
|
|
42
|
+
const input = document.querySelector(".token-search-input");
|
|
43
|
+
if (input) {
|
|
44
|
+
input.focus();
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<div class="token-dropdown">
|
|
51
|
+
<div class="relative w-full">
|
|
52
|
+
<Button
|
|
53
|
+
color="alternative"
|
|
54
|
+
class="flex w-full justify-between overflow-hidden overflow-ellipsis pl-4 pr-2 text-left"
|
|
55
|
+
size="lg"
|
|
56
|
+
on:click={() => (modalOpen = true)}
|
|
57
|
+
>
|
|
58
|
+
<div class="flex-grow overflow-hidden">
|
|
59
|
+
<span class="text-gray-900 dark:text-white">{displayText}</span>
|
|
60
|
+
</div>
|
|
61
|
+
<ChevronDownSolid class="ml-2 h-4 w-4 text-black dark:text-white" />
|
|
62
|
+
</Button>
|
|
63
|
+
|
|
64
|
+
<Modal bind:open={modalOpen} size="md" class="w-full max-w-lg">
|
|
65
|
+
<div slot="header" class="flex w-full items-center justify-between">
|
|
66
|
+
<h3 class="text-xl font-medium text-gray-900 dark:text-white">Select a token</h3>
|
|
67
|
+
</div>
|
|
68
|
+
<div class="relative w-full border-b border-gray-200 p-2 dark:border-gray-600">
|
|
69
|
+
<div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-5">
|
|
70
|
+
<SearchOutline class="h-4 w-4 text-gray-500 dark:text-gray-400" />
|
|
71
|
+
</div>
|
|
72
|
+
<Input
|
|
73
|
+
type="text"
|
|
74
|
+
placeholder="Search tokens..."
|
|
75
|
+
bind:value={searchQuery}
|
|
76
|
+
on:input={handleSearch}
|
|
77
|
+
class="token-search-input pl-10"
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<div class="token-list max-h-80 overflow-y-auto">
|
|
82
|
+
{#if isSearching}
|
|
83
|
+
<div class="p-4 text-center text-gray-500 dark:text-gray-400">
|
|
84
|
+
<p>Searching tokens...</p>
|
|
85
|
+
</div>
|
|
86
|
+
{:else}
|
|
87
|
+
{#each tokens as token (token.address)}
|
|
88
|
+
<div
|
|
89
|
+
class="token-item flex cursor-pointer items-center border-b border-gray-100 p-3 last:border-b-0 hover:bg-gray-50 dark:border-gray-600 dark:hover:bg-gray-700"
|
|
90
|
+
class:bg-blue-50={selectedToken?.address === token.address}
|
|
91
|
+
class:dark:bg-blue-900={selectedToken?.address === token.address}
|
|
92
|
+
class:border-l-4={selectedToken?.address === token.address}
|
|
93
|
+
class:border-l-blue-500={selectedToken?.address === token.address}
|
|
94
|
+
on:click={() => handleTokenSelect(token)}
|
|
95
|
+
on:keydown={(e) => e.key === 'Enter' && handleTokenSelect(token)}
|
|
96
|
+
role="button"
|
|
97
|
+
tabindex="0"
|
|
98
|
+
>
|
|
99
|
+
{#if token.logoUri && !failedImages.has(token.address)}
|
|
100
|
+
<img
|
|
101
|
+
src={token.logoUri}
|
|
102
|
+
alt="{token.symbol} logo"
|
|
103
|
+
class="mr-3 h-8 w-8 rounded-full object-cover"
|
|
104
|
+
on:error={() => handleImageError(token.address)}
|
|
105
|
+
/>
|
|
106
|
+
{:else}
|
|
107
|
+
<div
|
|
108
|
+
class="mr-3 flex h-8 w-8 items-center justify-center rounded-full bg-gray-200 dark:bg-gray-600"
|
|
109
|
+
>
|
|
110
|
+
<span class="text-xs font-medium text-gray-500 dark:text-gray-400">
|
|
111
|
+
{token.symbol?.slice(0, 2) || '??'}
|
|
112
|
+
</span>
|
|
113
|
+
</div>
|
|
114
|
+
{/if}
|
|
115
|
+
<div class="token-info flex-grow">
|
|
116
|
+
<div class="token-name font-medium text-gray-900 dark:text-white">
|
|
117
|
+
{token.name}
|
|
118
|
+
</div>
|
|
119
|
+
<div class="token-details flex gap-2 text-sm text-gray-500 dark:text-gray-400">
|
|
120
|
+
<span class="symbol font-medium">{token.symbol}</span>
|
|
121
|
+
<span class="address">{formatAddress(token.address)}</span>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
{#if selectedToken?.address === token.address}
|
|
125
|
+
<CheckCircleSolid class="selected-icon h-5 w-5 text-green-500" />
|
|
126
|
+
{/if}
|
|
127
|
+
</div>
|
|
128
|
+
{/each}
|
|
129
|
+
|
|
130
|
+
{#if tokens.length === 0}
|
|
131
|
+
<div class="no-results p-4 text-center text-gray-500 dark:text-gray-400">
|
|
132
|
+
<p>No tokens found matching your search.</p>
|
|
133
|
+
<button
|
|
134
|
+
class="mt-2 text-blue-600 underline hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300"
|
|
135
|
+
on:click={() => {
|
|
136
|
+
searchQuery = '';
|
|
137
|
+
loadTokens();
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
140
|
+
Clear search
|
|
141
|
+
</button>
|
|
142
|
+
</div>
|
|
143
|
+
{/if}
|
|
144
|
+
{/if}
|
|
145
|
+
</div>
|
|
146
|
+
</Modal>
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ExtendedTokenInfo } from '@rainlanguage/orderbook';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
selectedToken?: ExtendedTokenInfo | null;
|
|
6
|
+
onSelect: (token: ExtendedTokenInfo) => void;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
exports?: {} | undefined;
|
|
13
|
+
bindings?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
export type TokenSelectionModalProps = typeof __propDef.props;
|
|
16
|
+
export type TokenSelectionModalEvents = typeof __propDef.events;
|
|
17
|
+
export type TokenSelectionModalSlots = typeof __propDef.slots;
|
|
18
|
+
export default class TokenSelectionModal extends SvelteComponent<TokenSelectionModalProps, TokenSelectionModalEvents, TokenSelectionModalSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
package/dist/components/deployment/{ValidStrategiesSection.svelte → ValidOrdersSection.svelte}
RENAMED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
<script>import { onMount } from "svelte";
|
|
2
2
|
import { page } from "$app/stores";
|
|
3
|
-
export let
|
|
3
|
+
export let orders;
|
|
4
4
|
let customRegistryParam = "";
|
|
5
5
|
onMount(async () => {
|
|
6
6
|
customRegistryParam = $page.url.searchParams.get("registry") ? `?registry=${$page.url.searchParams.get("registry")}` : "";
|
|
7
7
|
});
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
|
-
<div class="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3" data-testid="valid-
|
|
11
|
-
{#each
|
|
10
|
+
<div class="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3" data-testid="valid-orders">
|
|
11
|
+
{#each orders as order}
|
|
12
12
|
<a
|
|
13
|
-
href={`/deploy/${
|
|
14
|
-
data-testid="
|
|
13
|
+
href={`/deploy/${order.name}${customRegistryParam}`}
|
|
14
|
+
data-testid="order-short-tile"
|
|
15
15
|
class="flex flex-col gap-y-2 rounded-xl border border-gray-200 p-4 hover:bg-gray-50 dark:border-gray-800 dark:hover:bg-gray-900"
|
|
16
16
|
>
|
|
17
17
|
<h3 class="text-2xl font-semibold text-gray-900 dark:text-white">
|
|
18
|
-
{
|
|
18
|
+
{order.details.name}
|
|
19
19
|
</h3>
|
|
20
20
|
<p class="text-lg text-gray-600 dark:text-gray-400">
|
|
21
|
-
{
|
|
21
|
+
{order.details.short_description}
|
|
22
22
|
</p>
|
|
23
23
|
</a>
|
|
24
24
|
{/each}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ValidOrderDetail } from '../../types/order';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
orders: ValidOrderDetail[];
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
exports?: {} | undefined;
|
|
12
|
+
bindings?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type ValidOrdersSectionProps = typeof __propDef.props;
|
|
15
|
+
export type ValidOrdersSectionEvents = typeof __propDef.events;
|
|
16
|
+
export type ValidOrdersSectionSlots = typeof __propDef.slots;
|
|
17
|
+
export default class ValidOrdersSection extends SvelteComponent<ValidOrdersSectionProps, ValidOrdersSectionEvents, ValidOrdersSectionSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script>import TokenBalanceComponent from "./TokenBalance.svelte";
|
|
2
|
+
export let title;
|
|
3
|
+
export let description;
|
|
4
|
+
export let tokenBalance;
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<div class="flex max-w-xl flex-grow flex-col gap-y-4 text-left">
|
|
8
|
+
<h1 class="break-words text-xl font-semibold text-gray-900 lg:text-2xl dark:text-white">
|
|
9
|
+
{title}
|
|
10
|
+
</h1>
|
|
11
|
+
<div class="flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400">
|
|
12
|
+
<div class="text-gray-600 dark:text-gray-400">
|
|
13
|
+
{description}
|
|
14
|
+
</div>
|
|
15
|
+
<TokenBalanceComponent {tokenBalance} />
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { TokenBalance } from '../../types/tokenBalance';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
tokenBalance: TokenBalance | undefined;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
exports?: {} | undefined;
|
|
14
|
+
bindings?: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
export type VaultIdInformationProps = typeof __propDef.props;
|
|
17
|
+
export type VaultIdInformationEvents = typeof __propDef.events;
|
|
18
|
+
export type VaultIdInformationSlots = typeof __propDef.slots;
|
|
19
|
+
export default class VaultIdInformation extends SvelteComponent<VaultIdInformationProps, VaultIdInformationEvents, VaultIdInformationSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -5,52 +5,88 @@ import OrderTradesListTable from "../tables/OrderTradesListTable.svelte";
|
|
|
5
5
|
import TanstackOrderQuote from "./TanstackOrderQuote.svelte";
|
|
6
6
|
import TanstackPageContentDetail from "./TanstackPageContentDetail.svelte";
|
|
7
7
|
import CardProperty from "../CardProperty.svelte";
|
|
8
|
-
import { formatTimestampSecondsAsLocal } from "../../
|
|
8
|
+
import { formatTimestampSecondsAsLocal } from "../../services/time";
|
|
9
9
|
import ButtonVaultLink from "../ButtonVaultLink.svelte";
|
|
10
10
|
import OrderVaultsVolTable from "../tables/OrderVaultsVolTable.svelte";
|
|
11
11
|
import { QKEY_ORDER } from "../../queries/keys";
|
|
12
12
|
import CodeMirrorRainlang from "../CodeMirrorRainlang.svelte";
|
|
13
|
-
import { getOrderByHash } from "@rainlanguage/orderbook/js_api";
|
|
14
13
|
import { createQuery, useQueryClient } from "@tanstack/svelte-query";
|
|
15
14
|
import { Button, TabItem, Tabs, Tooltip } from "flowbite-svelte";
|
|
16
15
|
import { onDestroy } from "svelte";
|
|
17
|
-
import OrderApy from "../tables/OrderAPY.svelte";
|
|
18
|
-
import { page } from "$app/stores";
|
|
19
|
-
import DepositOrWithdrawButtons from "./DepositOrWithdrawButtons.svelte";
|
|
20
16
|
import Refresh from "../icon/Refresh.svelte";
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
import { invalidateTanstackQueries } from "../../queries/queryClient";
|
|
18
|
+
import {
|
|
19
|
+
ArrowDownToBracketOutline,
|
|
20
|
+
ArrowUpFromBracketOutline,
|
|
21
|
+
InfoCircleOutline,
|
|
22
|
+
WalletOutline
|
|
23
|
+
} from "flowbite-svelte-icons";
|
|
24
|
+
import { getExplorerLink } from "../../services/getExplorerLink";
|
|
25
|
+
import { useAccount } from "../../providers/wallet/useAccount";
|
|
26
|
+
import {
|
|
27
|
+
RaindexClient,
|
|
28
|
+
RaindexOrder,
|
|
29
|
+
RaindexVault,
|
|
30
|
+
RaindexVaultsList
|
|
31
|
+
} from "@rainlanguage/orderbook";
|
|
32
|
+
import { useToasts } from "../../providers/toasts/useToasts";
|
|
33
|
+
import { useRaindexClient } from "../../hooks/useRaindexClient";
|
|
25
34
|
export let handleQuoteDebugModal = void 0;
|
|
26
|
-
export
|
|
27
|
-
export let colorTheme;
|
|
35
|
+
export let handleDebugTradeModal = void 0;
|
|
28
36
|
export let codeMirrorTheme;
|
|
29
37
|
export let lightweightChartsTheme;
|
|
30
38
|
export let orderbookAddress;
|
|
31
39
|
export let orderHash;
|
|
32
|
-
export let rpcUrl;
|
|
33
|
-
export let subgraphUrl;
|
|
34
40
|
export let chainId;
|
|
35
|
-
export let
|
|
36
|
-
export let
|
|
41
|
+
export let rpcs = void 0;
|
|
42
|
+
export let onRemove;
|
|
43
|
+
export let onDeposit;
|
|
44
|
+
export let onWithdraw;
|
|
45
|
+
export let onWithdrawAll = void 0;
|
|
46
|
+
export let onTakeOrder = void 0;
|
|
37
47
|
let codeMirrorDisabled = true;
|
|
38
48
|
let codeMirrorStyles = {};
|
|
39
49
|
const queryClient = useQueryClient();
|
|
50
|
+
const { matchesAccount } = useAccount();
|
|
51
|
+
const { errToast } = useToasts();
|
|
52
|
+
const raindexClient = useRaindexClient();
|
|
40
53
|
$: orderDetailQuery = createQuery({
|
|
41
|
-
queryKey: [
|
|
42
|
-
queryFn: () => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
54
|
+
queryKey: [QKEY_ORDER, orderHash],
|
|
55
|
+
queryFn: async () => {
|
|
56
|
+
const result = await raindexClient.getOrderByHash(chainId, orderbookAddress, orderHash);
|
|
57
|
+
if (result.error) throw new Error(result.error.readableMsg);
|
|
58
|
+
return result.value;
|
|
59
|
+
}
|
|
46
60
|
});
|
|
47
61
|
const interval = setInterval(async () => {
|
|
48
|
-
await
|
|
62
|
+
await invalidateTanstackQueries(queryClient, [orderHash]);
|
|
49
63
|
}, 1e4);
|
|
50
64
|
onDestroy(() => {
|
|
51
65
|
clearInterval(interval);
|
|
52
66
|
});
|
|
53
|
-
|
|
67
|
+
const handleRefresh = async () => {
|
|
68
|
+
try {
|
|
69
|
+
await invalidateTanstackQueries(queryClient, [orderHash]);
|
|
70
|
+
} catch {
|
|
71
|
+
errToast("Failed to refresh");
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const vaultTypesMap = [
|
|
75
|
+
{ key: "Output vaults", type: "output", getter: "outputsList" },
|
|
76
|
+
{ key: "Input vaults", type: "input", getter: "inputsList" },
|
|
77
|
+
{
|
|
78
|
+
key: "Input & output vaults",
|
|
79
|
+
type: "inputOutput",
|
|
80
|
+
getter: "inputsOutputsList"
|
|
81
|
+
}
|
|
82
|
+
];
|
|
83
|
+
const formatGuiState = (guiState) => {
|
|
84
|
+
try {
|
|
85
|
+
return JSON.stringify(JSON.parse(guiState), null, 2);
|
|
86
|
+
} catch {
|
|
87
|
+
return "Invalid GUI state";
|
|
88
|
+
}
|
|
89
|
+
};
|
|
54
90
|
</script>
|
|
55
91
|
|
|
56
92
|
<TanstackPageContentDetail query={orderDetailQuery} emptyMessage="Order not found">
|
|
@@ -61,35 +97,30 @@ $: subgraphName = $page.url.pathname.split("/")[2]?.split("-")[0];
|
|
|
61
97
|
<div class="flex items-center gap-x-2">
|
|
62
98
|
<div class="flex gap-x-2">
|
|
63
99
|
<span class="font-light">Order</span>
|
|
64
|
-
<Hash shorten value={data.
|
|
100
|
+
<Hash shorten value={data.orderHash} />
|
|
65
101
|
</div>
|
|
66
|
-
|
|
67
|
-
<BadgeActive active={data.order.active} large />
|
|
102
|
+
<BadgeActive active={data.active} large />
|
|
68
103
|
</div>
|
|
69
104
|
|
|
70
105
|
<div class="flex items-center gap-2">
|
|
71
|
-
{#if data
|
|
106
|
+
{#if matchesAccount(data.owner) && data.active}
|
|
72
107
|
<Button
|
|
108
|
+
on:click={() => onRemove(raindexClient, data)}
|
|
73
109
|
data-testid="remove-button"
|
|
74
|
-
|
|
75
|
-
on:click={() =>
|
|
76
|
-
handleOrderRemoveModal({
|
|
77
|
-
open: true,
|
|
78
|
-
args: {
|
|
79
|
-
order: data.order,
|
|
80
|
-
onRemove: $orderDetailQuery.refetch,
|
|
81
|
-
chainId,
|
|
82
|
-
orderbookAddress,
|
|
83
|
-
subgraphUrl
|
|
84
|
-
}
|
|
85
|
-
})}
|
|
86
|
-
disabled={!handleOrderRemoveModal}
|
|
110
|
+
aria-label="Remove order">Remove</Button
|
|
87
111
|
>
|
|
88
|
-
Remove
|
|
89
|
-
</Button>
|
|
90
112
|
{/if}
|
|
113
|
+
{#if data.active && onTakeOrder}
|
|
114
|
+
<Button
|
|
115
|
+
on:click={() => onTakeOrder(raindexClient, data)}
|
|
116
|
+
data-testid="take-order-button"
|
|
117
|
+
aria-label="Take order">Take Order</Button
|
|
118
|
+
>
|
|
119
|
+
{/if}
|
|
120
|
+
|
|
91
121
|
<Refresh
|
|
92
|
-
|
|
122
|
+
testId="top-refresh"
|
|
123
|
+
on:click={handleRefresh}
|
|
93
124
|
spin={$orderDetailQuery.isLoading || $orderDetailQuery.isFetching}
|
|
94
125
|
/>
|
|
95
126
|
</div>
|
|
@@ -100,50 +131,119 @@ $: subgraphName = $page.url.pathname.split("/")[2]?.split("-")[0];
|
|
|
100
131
|
<CardProperty>
|
|
101
132
|
<svelte:fragment slot="key">Orderbook</svelte:fragment>
|
|
102
133
|
<svelte:fragment slot="value">
|
|
103
|
-
<Hash type={HashType.Identifier} shorten={false} value={data.
|
|
134
|
+
<Hash type={HashType.Identifier} shorten={false} value={data.orderbook} />
|
|
104
135
|
</svelte:fragment>
|
|
105
136
|
</CardProperty>
|
|
106
137
|
|
|
107
138
|
<CardProperty>
|
|
108
139
|
<svelte:fragment slot="key">Owner</svelte:fragment>
|
|
109
140
|
<svelte:fragment slot="value">
|
|
110
|
-
|
|
141
|
+
{@const explorerLink = getExplorerLink(data.owner, chainId, 'address')}
|
|
142
|
+
{#if explorerLink}
|
|
143
|
+
<a
|
|
144
|
+
href={explorerLink}
|
|
145
|
+
target="_blank"
|
|
146
|
+
rel="noopener noreferrer"
|
|
147
|
+
class="flex items-center justify-start space-x-2 text-left text-blue-500 hover:underline"
|
|
148
|
+
>
|
|
149
|
+
<WalletOutline size="sm" />
|
|
150
|
+
<span>{data.owner}</span>
|
|
151
|
+
</a>
|
|
152
|
+
{:else}
|
|
153
|
+
<Hash type={HashType.Wallet} shorten={false} value={data.owner} />
|
|
154
|
+
{/if}
|
|
111
155
|
</svelte:fragment>
|
|
112
156
|
</CardProperty>
|
|
113
157
|
|
|
114
158
|
<CardProperty>
|
|
115
159
|
<svelte:fragment slot="key">Created</svelte:fragment>
|
|
116
160
|
<svelte:fragment slot="value">
|
|
117
|
-
{formatTimestampSecondsAsLocal(
|
|
161
|
+
{formatTimestampSecondsAsLocal(data.timestampAdded)}
|
|
118
162
|
</svelte:fragment>
|
|
119
163
|
</CardProperty>
|
|
120
164
|
|
|
121
|
-
{#
|
|
122
|
-
|
|
165
|
+
{#if data.oracleUrl}
|
|
166
|
+
<CardProperty>
|
|
167
|
+
<svelte:fragment slot="key">
|
|
168
|
+
<div class="flex items-center gap-x-2">
|
|
169
|
+
Oracle
|
|
170
|
+
<InfoCircleOutline class="h-4 w-4" /><Tooltip
|
|
171
|
+
>This order uses a signed context oracle for external data (e.g. price feeds).
|
|
172
|
+
Quotes include oracle data automatically.</Tooltip
|
|
173
|
+
>
|
|
174
|
+
</div>
|
|
175
|
+
</svelte:fragment>
|
|
176
|
+
<svelte:fragment slot="value">
|
|
177
|
+
{#if data.oracleUrl.startsWith('https://') || data.oracleUrl.startsWith('http://')}
|
|
178
|
+
<a
|
|
179
|
+
href={data.oracleUrl}
|
|
180
|
+
target="_blank"
|
|
181
|
+
rel="noopener noreferrer"
|
|
182
|
+
class="break-all text-blue-500 hover:underline"
|
|
183
|
+
>
|
|
184
|
+
{data.oracleUrl}
|
|
185
|
+
</a>
|
|
186
|
+
{:else}
|
|
187
|
+
<span class="break-all text-gray-500">{data.oracleUrl}</span>
|
|
188
|
+
{/if}
|
|
189
|
+
</svelte:fragment>
|
|
190
|
+
</CardProperty>
|
|
191
|
+
{/if}
|
|
192
|
+
|
|
193
|
+
{#each vaultTypesMap as { key, type, getter }}
|
|
194
|
+
{@const filteredVaults = data.vaultsList.items.filter((vault) => vault.vaultType === type)}
|
|
195
|
+
{@const vaultsListByType = data[getter]}
|
|
196
|
+
{#if filteredVaults.length !== 0}
|
|
123
197
|
<CardProperty>
|
|
124
|
-
<svelte:fragment slot="key"
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
198
|
+
<svelte:fragment slot="key">
|
|
199
|
+
<div class="flex items-center justify-between">
|
|
200
|
+
<div class="flex items-center gap-x-2">
|
|
201
|
+
{key}
|
|
202
|
+
{#if type === 'inputOutput'}
|
|
203
|
+
<InfoCircleOutline class="h-4 w-4" /><Tooltip
|
|
204
|
+
>{'These vaults can be an input or an output for this order'}</Tooltip
|
|
205
|
+
>{/if}
|
|
206
|
+
</div>
|
|
207
|
+
{#if onWithdrawAll}
|
|
208
|
+
<Button
|
|
209
|
+
color="light"
|
|
210
|
+
size="xs"
|
|
211
|
+
on:click={() =>
|
|
212
|
+
vaultsListByType && onWithdrawAll(raindexClient, vaultsListByType)}
|
|
213
|
+
disabled={!vaultsListByType ||
|
|
214
|
+
vaultsListByType.getWithdrawableVaults()?.value?.length === 0}
|
|
215
|
+
data-testid="withdraw-all-button"
|
|
216
|
+
>
|
|
217
|
+
<ArrowUpFromBracketOutline size="xs" class="mr-2" />
|
|
218
|
+
Withdraw all
|
|
219
|
+
</Button>
|
|
220
|
+
{/if}
|
|
221
|
+
</div>
|
|
222
|
+
</svelte:fragment>
|
|
133
223
|
<svelte:fragment slot="value">
|
|
134
224
|
<div class="mt-2 space-y-2">
|
|
135
|
-
{#each
|
|
136
|
-
<ButtonVaultLink tokenVault={vault} {
|
|
225
|
+
{#each filteredVaults as vault}
|
|
226
|
+
<ButtonVaultLink tokenVault={vault} {chainId} {orderbookAddress}>
|
|
137
227
|
<svelte:fragment slot="buttons">
|
|
138
|
-
{#if
|
|
139
|
-
<
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
228
|
+
{#if matchesAccount(vault.owner)}
|
|
229
|
+
<div class="flex gap-1">
|
|
230
|
+
<Button
|
|
231
|
+
color="light"
|
|
232
|
+
size="xs"
|
|
233
|
+
data-testid="deposit-button"
|
|
234
|
+
on:click={() => onDeposit(raindexClient, vault)}
|
|
235
|
+
>
|
|
236
|
+
<ArrowDownToBracketOutline size="xs" />
|
|
237
|
+
</Button>
|
|
238
|
+
<Button
|
|
239
|
+
color="light"
|
|
240
|
+
size="xs"
|
|
241
|
+
data-testid="withdraw-button"
|
|
242
|
+
on:click={() => onWithdraw(raindexClient, vault)}
|
|
243
|
+
>
|
|
244
|
+
<ArrowUpFromBracketOutline size="xs" />
|
|
245
|
+
</Button>
|
|
246
|
+
</div>
|
|
147
247
|
{/if}
|
|
148
248
|
</svelte:fragment>
|
|
149
249
|
</ButtonVaultLink>
|
|
@@ -153,42 +253,74 @@ $: subgraphName = $page.url.pathname.split("/")[2]?.split("-")[0];
|
|
|
153
253
|
</CardProperty>
|
|
154
254
|
{/if}
|
|
155
255
|
{/each}
|
|
256
|
+
{#if onWithdrawAll}
|
|
257
|
+
<Button
|
|
258
|
+
size="xs"
|
|
259
|
+
on:click={() =>
|
|
260
|
+
$orderDetailQuery.data?.vaultsList &&
|
|
261
|
+
onWithdrawAll(raindexClient, $orderDetailQuery.data.vaultsList)}
|
|
262
|
+
disabled={!$orderDetailQuery.data?.vaultsList ||
|
|
263
|
+
$orderDetailQuery.data?.vaultsList?.getWithdrawableVaults()?.value?.length === 0}
|
|
264
|
+
data-testid="withdraw-all-button"
|
|
265
|
+
>
|
|
266
|
+
<ArrowUpFromBracketOutline size="xs" class="mr-2" />
|
|
267
|
+
Withdraw all vaults
|
|
268
|
+
</Button>
|
|
269
|
+
{/if}
|
|
156
270
|
</div>
|
|
157
271
|
</svelte:fragment>
|
|
158
272
|
<svelte:fragment slot="chart" let:data>
|
|
159
|
-
<OrderTradesChart
|
|
273
|
+
<OrderTradesChart order={data} {lightweightChartsTheme} />
|
|
160
274
|
</svelte:fragment>
|
|
161
275
|
<svelte:fragment slot="below" let:data>
|
|
162
|
-
<TanstackOrderQuote
|
|
163
|
-
id={data.order.id}
|
|
164
|
-
order={data.order}
|
|
165
|
-
{rpcUrl}
|
|
166
|
-
{orderbookAddress}
|
|
167
|
-
{handleQuoteDebugModal}
|
|
168
|
-
/>
|
|
276
|
+
<TanstackOrderQuote order={data} {handleQuoteDebugModal} />
|
|
169
277
|
<Tabs
|
|
170
278
|
style="underline"
|
|
171
279
|
contentClass="mt-4"
|
|
172
280
|
defaultClass="flex flex-wrap space-x-2 rtl:space-x-reverse mt-4 list-none"
|
|
173
281
|
>
|
|
174
|
-
|
|
282
|
+
{#if data.dotrainSource}
|
|
283
|
+
<TabItem title="Dotrain">
|
|
284
|
+
<div class="mb-8 overflow-hidden rounded-lg border dark:border-none">
|
|
285
|
+
<CodeMirrorRainlang
|
|
286
|
+
rainlangText={data.dotrainSource}
|
|
287
|
+
codeMirrorTheme={$codeMirrorTheme}
|
|
288
|
+
{codeMirrorDisabled}
|
|
289
|
+
{codeMirrorStyles}
|
|
290
|
+
></CodeMirrorRainlang>
|
|
291
|
+
</div>
|
|
292
|
+
</TabItem>
|
|
293
|
+
{/if}
|
|
294
|
+
<TabItem title="On-chain Rainlang">
|
|
175
295
|
<div class="mb-8 overflow-hidden rounded-lg border dark:border-none">
|
|
176
296
|
<CodeMirrorRainlang
|
|
177
|
-
|
|
297
|
+
rainlangText={data.rainlang}
|
|
178
298
|
codeMirrorTheme={$codeMirrorTheme}
|
|
179
299
|
{codeMirrorDisabled}
|
|
180
300
|
{codeMirrorStyles}
|
|
181
301
|
></CodeMirrorRainlang>
|
|
182
302
|
</div>
|
|
183
303
|
</TabItem>
|
|
304
|
+
{#if data.dotrainGuiState}
|
|
305
|
+
<TabItem title="Gui State">
|
|
306
|
+
<div class="mb-4">
|
|
307
|
+
<div class="overflow-auto rounded-lg border bg-gray-50 p-4 dark:bg-gray-800">
|
|
308
|
+
<pre class="text-sm" data-testid="gui-state-json">
|
|
309
|
+
{formatGuiState(data.dotrainGuiState)}
|
|
310
|
+
</pre>
|
|
311
|
+
</div>
|
|
312
|
+
</div>
|
|
313
|
+
</TabItem>
|
|
314
|
+
{/if}
|
|
184
315
|
<TabItem open title="Trades">
|
|
185
|
-
<OrderTradesListTable
|
|
316
|
+
<OrderTradesListTable order={data} {handleDebugTradeModal} {rpcs} />
|
|
186
317
|
</TabItem>
|
|
187
318
|
<TabItem title="Volume">
|
|
188
|
-
<OrderVaultsVolTable
|
|
319
|
+
<OrderVaultsVolTable order={data} />
|
|
189
320
|
</TabItem>
|
|
190
321
|
<TabItem title="APY">
|
|
191
|
-
<
|
|
322
|
+
<div>TODO: Issue #1989</div>
|
|
323
|
+
<!-- <OrderApy order={data} /> -->
|
|
192
324
|
</TabItem>
|
|
193
325
|
</Tabs>
|
|
194
326
|
</svelte:fragment>
|