@rainlanguage/ui-components 0.0.1-alpha.10
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 +58 -0
- package/dist/__fixtures__/orderDetail.d.ts +99 -0
- package/dist/__fixtures__/orderDetail.js +204 -0
- package/dist/__fixtures__/settings-12-11-24.json +160 -0
- package/dist/__mocks__/MockComponent.d.ts +1 -0
- package/dist/__mocks__/MockComponent.js +2 -0
- package/dist/__mocks__/MockComponent.svelte +3 -0
- package/dist/__mocks__/MockComponent.svelte.d.ts +18 -0
- package/dist/__mocks__/mockTransactionStore.d.ts +22 -0
- package/dist/__mocks__/mockTransactionStore.js +56 -0
- package/dist/__mocks__/mockWeb3Config.d.ts +2 -0
- package/dist/__mocks__/mockWeb3Config.js +15 -0
- package/dist/__mocks__/queries.d.ts +13 -0
- package/dist/__mocks__/queries.js +64 -0
- package/dist/__mocks__/settings.d.ts +3 -0
- package/dist/__mocks__/settings.js +37 -0
- package/dist/__mocks__/stores.d.ts +94 -0
- package/dist/__mocks__/stores.js +113 -0
- package/dist/app.css +3 -0
- package/dist/assets/ledger.svg +6 -0
- package/dist/assets/logo-dark.svg +15 -0
- package/dist/assets/logo-light.svg +15 -0
- package/dist/assets/walletconnect.svg +1 -0
- package/dist/components/BadgeActive.svelte +9 -0
- package/dist/components/BadgeActive.svelte.d.ts +19 -0
- package/dist/components/BlockQuote.svelte +1 -0
- package/dist/components/BlockQuote.svelte.d.ts +29 -0
- package/dist/components/ButtonDarkMode.svelte +14 -0
- package/dist/components/ButtonDarkMode.svelte.d.ts +18 -0
- package/dist/components/ButtonLoading.svelte +11 -0
- package/dist/components/ButtonLoading.svelte.d.ts +24 -0
- package/dist/components/ButtonTab.svelte +7 -0
- package/dist/components/ButtonTab.svelte.d.ts +23 -0
- package/dist/components/ButtonVaultLink.svelte +29 -0
- package/dist/components/ButtonVaultLink.svelte.d.ts +22 -0
- package/dist/components/CardProperty.svelte +11 -0
- package/dist/components/CardProperty.svelte.d.ts +31 -0
- package/dist/components/CheckboxMyItemsOnly.svelte +23 -0
- package/dist/components/CheckboxMyItemsOnly.svelte.d.ts +21 -0
- package/dist/components/CheckboxZeroBalanceVault.svelte +20 -0
- package/dist/components/CheckboxZeroBalanceVault.svelte.d.ts +19 -0
- package/dist/components/CodeMirrorDotrain.svelte +35 -0
- package/dist/components/CodeMirrorDotrain.svelte.d.ts +23 -0
- package/dist/components/CodeMirrorRainlang.svelte +34 -0
- package/dist/components/CodeMirrorRainlang.svelte.d.ts +23 -0
- package/dist/components/DropdownProperty.svelte +12 -0
- package/dist/components/DropdownProperty.svelte.d.ts +19 -0
- package/dist/components/EditableSpan.svelte +46 -0
- package/dist/components/EditableSpan.svelte.d.ts +21 -0
- package/dist/components/Hash.svelte +85 -0
- package/dist/components/Hash.svelte.d.ts +28 -0
- package/dist/components/Heading.svelte +19 -0
- package/dist/components/Heading.svelte.d.ts +29 -0
- package/dist/components/IconError.svelte +8 -0
- package/dist/components/IconError.svelte.d.ts +16 -0
- package/dist/components/IconExternalLink.svelte +18 -0
- package/dist/components/IconExternalLink.svelte.d.ts +18 -0
- package/dist/components/IconInfo.svelte +8 -0
- package/dist/components/IconInfo.svelte.d.ts +16 -0
- package/dist/components/IconLedger.svelte +13 -0
- package/dist/components/IconLedger.svelte.d.ts +16 -0
- package/dist/components/IconSuccess.svelte +8 -0
- package/dist/components/IconSuccess.svelte.d.ts +16 -0
- package/dist/components/IconTelegram.svelte +12 -0
- package/dist/components/IconTelegram.svelte.d.ts +25 -0
- package/dist/components/IconWalletConnect.svelte +13 -0
- package/dist/components/IconWalletConnect.svelte.d.ts +16 -0
- package/dist/components/IconWarning.svelte +8 -0
- package/dist/components/IconWarning.svelte.d.ts +16 -0
- package/dist/components/License.svelte +29 -0
- package/dist/components/License.svelte.d.ts +25 -0
- package/dist/components/ListViewOrderbookFilters.svelte +58 -0
- package/dist/components/ListViewOrderbookFilters.svelte.d.ts +28 -0
- package/dist/components/OrderOrVaultHash.svelte +24 -0
- package/dist/components/OrderOrVaultHash.svelte.d.ts +22 -0
- package/dist/components/PageHeader.svelte +33 -0
- package/dist/components/PageHeader.svelte.d.ts +21 -0
- package/dist/components/TanstackAppTable.svelte +73 -0
- package/dist/components/TanstackAppTable.svelte.d.ts +30 -0
- package/dist/components/Text.svelte +12 -0
- package/dist/components/Text.svelte.d.ts +31 -0
- package/dist/components/charts/APYTimeFilters.svelte +47 -0
- package/dist/components/charts/APYTimeFilters.svelte.d.ts +19 -0
- package/dist/components/charts/ChartTimeFilters.svelte +35 -0
- package/dist/components/charts/ChartTimeFilters.svelte.d.ts +18 -0
- package/dist/components/charts/LightweightChart.svelte +110 -0
- package/dist/components/charts/LightweightChart.svelte.d.ts +29 -0
- package/dist/components/charts/OrderTradesChart.svelte +36 -0
- package/dist/components/charts/OrderTradesChart.svelte.d.ts +21 -0
- package/dist/components/charts/TableTimeFilters.svelte +48 -0
- package/dist/components/charts/TableTimeFilters.svelte.d.ts +19 -0
- package/dist/components/charts/TanstackLightweightChartLine.svelte +24 -0
- package/dist/components/charts/TanstackLightweightChartLine.svelte.d.ts +23 -0
- package/dist/components/charts/VaultBalanceChart.svelte +37 -0
- package/dist/components/charts/VaultBalanceChart.svelte.d.ts +22 -0
- package/dist/components/checkbox/Checkbox.svelte +17 -0
- package/dist/components/checkbox/Checkbox.svelte.d.ts +21 -0
- package/dist/components/deployment/ButtonSelectOption.svelte +14 -0
- package/dist/components/deployment/ButtonSelectOption.svelte.d.ts +20 -0
- package/dist/components/deployment/ComposedRainlangModal.svelte +35 -0
- package/dist/components/deployment/ComposedRainlangModal.svelte.d.ts +19 -0
- package/dist/components/deployment/DeploymentSectionHeader.svelte +14 -0
- package/dist/components/deployment/DeploymentSectionHeader.svelte.d.ts +19 -0
- package/dist/components/deployment/DeploymentSteps.svelte +252 -0
- package/dist/components/deployment/DeploymentSteps.svelte.d.ts +38 -0
- package/dist/components/deployment/DeploymentTile.svelte +19 -0
- package/dist/components/deployment/DeploymentTile.svelte.d.ts +21 -0
- package/dist/components/deployment/DeploymentsSection.svelte +20 -0
- package/dist/components/deployment/DeploymentsSection.svelte.d.ts +19 -0
- package/dist/components/deployment/DepositInput.svelte +93 -0
- package/dist/components/deployment/DepositInput.svelte.d.ts +20 -0
- package/dist/components/deployment/DepositsSection.svelte +8 -0
- package/dist/components/deployment/DepositsSection.svelte.d.ts +20 -0
- package/dist/components/deployment/DisclaimerModal.svelte +54 -0
- package/dist/components/deployment/DisclaimerModal.svelte.d.ts +19 -0
- package/dist/components/deployment/FieldDefinitionInput.svelte +66 -0
- package/dist/components/deployment/FieldDefinitionInput.svelte.d.ts +20 -0
- package/dist/components/deployment/FieldDefinitionsSection.svelte +9 -0
- package/dist/components/deployment/FieldDefinitionsSection.svelte.d.ts +20 -0
- package/dist/components/deployment/InvalidStrategiesSection.svelte +19 -0
- package/dist/components/deployment/InvalidStrategiesSection.svelte.d.ts +19 -0
- package/dist/components/deployment/SelectToken.svelte +88 -0
- package/dist/components/deployment/SelectToken.svelte.d.ts +21 -0
- package/dist/components/deployment/SelectTokensSection.svelte +17 -0
- package/dist/components/deployment/SelectTokensSection.svelte.d.ts +21 -0
- package/dist/components/deployment/ShareChoicesButton.svelte +26 -0
- package/dist/components/deployment/ShareChoicesButton.svelte.d.ts +18 -0
- package/dist/components/deployment/StrategyPage.svelte +70 -0
- package/dist/components/deployment/StrategyPage.svelte.d.ts +19 -0
- package/dist/components/deployment/TokenIOInput.svelte +62 -0
- package/dist/components/deployment/TokenIOInput.svelte.d.ts +22 -0
- package/dist/components/deployment/TokenIOSection.svelte +17 -0
- package/dist/components/deployment/TokenIOSection.svelte.d.ts +21 -0
- package/dist/components/deployment/ValidStrategiesSection.svelte +25 -0
- package/dist/components/deployment/ValidStrategiesSection.svelte.d.ts +19 -0
- package/dist/components/deployment/getDeploymentTransactionArgs.d.ts +17 -0
- package/dist/components/deployment/getDeploymentTransactionArgs.js +24 -0
- package/dist/components/detail/DepositOrWithdrawButtons.svelte +44 -0
- package/dist/components/detail/DepositOrWithdrawButtons.svelte.d.ts +26 -0
- package/dist/components/detail/OrderDetail.svelte +195 -0
- package/dist/components/detail/OrderDetail.svelte.d.ts +36 -0
- package/dist/components/detail/TanstackOrderQuote.svelte +173 -0
- package/dist/components/detail/TanstackOrderQuote.svelte.d.ts +22 -0
- package/dist/components/detail/TanstackPageContentDetail.svelte +56 -0
- package/dist/components/detail/TanstackPageContentDetail.svelte.d.ts +31 -0
- package/dist/components/detail/VaultDetail.svelte +178 -0
- package/dist/components/detail/VaultDetail.svelte.d.ts +35 -0
- package/dist/components/dropdown/DropdownActiveSubgraphs.svelte +38 -0
- package/dist/components/dropdown/DropdownActiveSubgraphs.svelte.d.ts +21 -0
- package/dist/components/dropdown/DropdownCheckbox.svelte +77 -0
- package/dist/components/dropdown/DropdownCheckbox.svelte.d.ts +26 -0
- package/dist/components/dropdown/DropdownOrderListAccounts.svelte +15 -0
- package/dist/components/dropdown/DropdownOrderListAccounts.svelte.d.ts +20 -0
- package/dist/components/dropdown/DropdownOrderStatus.svelte +31 -0
- package/dist/components/dropdown/DropdownOrderStatus.svelte.d.ts +19 -0
- package/dist/components/dropdown/DropdownRadio.svelte +45 -0
- package/dist/components/dropdown/DropdownRadio.svelte.d.ts +30 -0
- package/dist/components/icon/RainLogo.svelte +54 -0
- package/dist/components/icon/RainLogo.svelte.d.ts +25 -0
- package/dist/components/icon/Refresh.svelte +57 -0
- package/dist/components/icon/Refresh.svelte.d.ts +40 -0
- package/dist/components/input/InputHex.svelte +42 -0
- package/dist/components/input/InputHex.svelte.d.ts +19 -0
- package/dist/components/input/InputOrderHash.svelte +22 -0
- package/dist/components/input/InputOrderHash.svelte.d.ts +20 -0
- package/dist/components/input/InputRegistryUrl.svelte +18 -0
- package/dist/components/input/InputRegistryUrl.svelte.d.ts +16 -0
- package/dist/components/input/InputToken.svelte +53 -0
- package/dist/components/input/InputToken.svelte.d.ts +19 -0
- package/dist/components/input/InputTokenAmount.svelte +63 -0
- package/dist/components/input/InputTokenAmount.svelte.d.ts +21 -0
- package/dist/components/tables/OrderAPY.svelte +57 -0
- package/dist/components/tables/OrderAPY.svelte.d.ts +19 -0
- package/dist/components/tables/OrderTradesListTable.svelte +145 -0
- package/dist/components/tables/OrderTradesListTable.svelte.d.ts +21 -0
- package/dist/components/tables/OrderVaultsVolTable.svelte +67 -0
- package/dist/components/tables/OrderVaultsVolTable.svelte.d.ts +19 -0
- package/dist/components/tables/OrdersListTable.svelte +181 -0
- package/dist/components/tables/OrdersListTable.svelte.d.ts +35 -0
- package/dist/components/tables/VaultBalanceChangesTable.svelte +74 -0
- package/dist/components/tables/VaultBalanceChangesTable.svelte.d.ts +17 -0
- package/dist/components/tables/VaultsListTable.svelte +229 -0
- package/dist/components/tables/VaultsListTable.svelte.d.ts +40 -0
- package/dist/components/wallet/WalletConnect.svelte +28 -0
- package/dist/components/wallet/WalletConnect.svelte.d.ts +23 -0
- package/dist/errors/DeploymentStepsError.d.ts +24 -0
- package/dist/errors/DeploymentStepsError.js +45 -0
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.js +1 -0
- package/dist/index.d.ts +89 -0
- package/dist/index.js +89 -0
- package/dist/queries/constants.d.ts +2 -0
- package/dist/queries/constants.js +2 -0
- package/dist/queries/keys.d.ts +9 -0
- package/dist/queries/keys.js +9 -0
- package/dist/queries/queryClient.d.ts +3 -0
- package/dist/queries/queryClient.js +16 -0
- package/dist/services/getExplorerLink.d.ts +1 -0
- package/dist/services/getExplorerLink.js +10 -0
- package/dist/services/handleShareChoices.d.ts +2 -0
- package/dist/services/handleShareChoices.js +10 -0
- package/dist/services/historicalOrderCharts.d.ts +12 -0
- package/dist/services/historicalOrderCharts.js +496 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.js +1 -0
- package/dist/services/registry.d.ts +25 -0
- package/dist/services/registry.js +133 -0
- package/dist/services/time.d.ts +6 -0
- package/dist/services/time.js +17 -0
- package/dist/stores/transactionStore.d.ts +98 -0
- package/dist/stores/transactionStore.js +303 -0
- package/dist/test/matchers.d.ts +6 -0
- package/dist/test/matchers.js +4 -0
- package/dist/types/appStores.d.ts +19 -0
- package/dist/types/appStores.js +1 -0
- package/dist/types/modal.d.ts +20 -0
- package/dist/types/modal.js +1 -0
- package/dist/types/strategy.d.ts +10 -0
- package/dist/types/strategy.js +1 -0
- package/dist/types/transaction.d.ts +27 -0
- package/dist/types/transaction.js +1 -0
- package/dist/utils/breadcrumbs.d.ts +5 -0
- package/dist/utils/breadcrumbs.js +9 -0
- package/dist/utils/codeMirrorThemes.d.ts +2 -0
- package/dist/utils/codeMirrorThemes.js +86 -0
- package/dist/utils/hex.d.ts +2 -0
- package/dist/utils/hex.js +3 -0
- package/dist/utils/lightweightChartsThemes.d.ts +52 -0
- package/dist/utils/lightweightChartsThemes.js +21 -0
- package/dist/utils/number.d.ts +14 -0
- package/dist/utils/number.js +43 -0
- package/dist/utils/time.d.ts +12 -0
- package/dist/utils/time.js +27 -0
- package/dist/utils/vault.d.ts +2 -0
- package/dist/utils/vault.js +29 -0
- package/package.json +86 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
<script>import Hash, { HashType } from "../Hash.svelte";
|
|
2
|
+
import BadgeActive from "../BadgeActive.svelte";
|
|
3
|
+
import OrderTradesChart from "../charts/OrderTradesChart.svelte";
|
|
4
|
+
import OrderTradesListTable from "../tables/OrderTradesListTable.svelte";
|
|
5
|
+
import TanstackOrderQuote from "./TanstackOrderQuote.svelte";
|
|
6
|
+
import TanstackPageContentDetail from "./TanstackPageContentDetail.svelte";
|
|
7
|
+
import CardProperty from "../CardProperty.svelte";
|
|
8
|
+
import { formatTimestampSecondsAsLocal } from "../../utils/time";
|
|
9
|
+
import ButtonVaultLink from "../ButtonVaultLink.svelte";
|
|
10
|
+
import OrderVaultsVolTable from "../tables/OrderVaultsVolTable.svelte";
|
|
11
|
+
import { QKEY_ORDER } from "../../queries/keys";
|
|
12
|
+
import CodeMirrorRainlang from "../CodeMirrorRainlang.svelte";
|
|
13
|
+
import { getOrderByHash } from "@rainlanguage/orderbook/js_api";
|
|
14
|
+
import { createQuery, useQueryClient } from "@tanstack/svelte-query";
|
|
15
|
+
import { Button, TabItem, Tabs, Tooltip } from "flowbite-svelte";
|
|
16
|
+
import { onDestroy } from "svelte";
|
|
17
|
+
import OrderApy from "../tables/OrderAPY.svelte";
|
|
18
|
+
import { page } from "$app/stores";
|
|
19
|
+
import DepositOrWithdrawButtons from "./DepositOrWithdrawButtons.svelte";
|
|
20
|
+
import Refresh from "../icon/Refresh.svelte";
|
|
21
|
+
import { invalidateIdQuery } from "../../queries/queryClient";
|
|
22
|
+
import { InfoCircleOutline } from "flowbite-svelte-icons";
|
|
23
|
+
export let handleDepositOrWithdrawModal = void 0;
|
|
24
|
+
export let handleOrderRemoveModal = void 0;
|
|
25
|
+
export let handleQuoteDebugModal = void 0;
|
|
26
|
+
export const handleDebugTradeModal = void 0;
|
|
27
|
+
export let colorTheme;
|
|
28
|
+
export let codeMirrorTheme;
|
|
29
|
+
export let lightweightChartsTheme;
|
|
30
|
+
export let orderbookAddress;
|
|
31
|
+
export let orderHash;
|
|
32
|
+
export let rpcUrl;
|
|
33
|
+
export let subgraphUrl;
|
|
34
|
+
export let chainId;
|
|
35
|
+
export let wagmiConfig = void 0;
|
|
36
|
+
export let signerAddress = void 0;
|
|
37
|
+
let codeMirrorDisabled = true;
|
|
38
|
+
let codeMirrorStyles = {};
|
|
39
|
+
const queryClient = useQueryClient();
|
|
40
|
+
$: orderDetailQuery = createQuery({
|
|
41
|
+
queryKey: [orderHash, QKEY_ORDER + orderHash],
|
|
42
|
+
queryFn: () => {
|
|
43
|
+
return getOrderByHash(subgraphUrl, orderHash);
|
|
44
|
+
},
|
|
45
|
+
enabled: !!subgraphUrl
|
|
46
|
+
});
|
|
47
|
+
const interval = setInterval(async () => {
|
|
48
|
+
await invalidateIdQuery(queryClient, orderHash);
|
|
49
|
+
}, 1e4);
|
|
50
|
+
onDestroy(() => {
|
|
51
|
+
clearInterval(interval);
|
|
52
|
+
});
|
|
53
|
+
$: subgraphName = $page.url.pathname.split("/")[2]?.split("-")[0];
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<TanstackPageContentDetail query={orderDetailQuery} emptyMessage="Order not found">
|
|
57
|
+
<svelte:fragment slot="top" let:data>
|
|
58
|
+
<div
|
|
59
|
+
class="flex w-full flex-wrap items-center justify-between gap-4 text-3xl font-medium lg:justify-between dark:text-white"
|
|
60
|
+
>
|
|
61
|
+
<div class="flex items-center gap-x-2">
|
|
62
|
+
<div class="flex gap-x-2">
|
|
63
|
+
<span class="font-light">Order</span>
|
|
64
|
+
<Hash shorten value={data.order.orderHash} />
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<BadgeActive active={data.order.active} large />
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<div class="flex items-center gap-2">
|
|
71
|
+
{#if data && $signerAddress === data.order.owner && data.order.active && handleOrderRemoveModal && $wagmiConfig && chainId && orderbookAddress}
|
|
72
|
+
<Button
|
|
73
|
+
data-testid="remove-button"
|
|
74
|
+
color="dark"
|
|
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}
|
|
87
|
+
>
|
|
88
|
+
Remove
|
|
89
|
+
</Button>
|
|
90
|
+
{/if}
|
|
91
|
+
<Refresh
|
|
92
|
+
on:click={async () => await invalidateIdQuery(queryClient, orderHash)}
|
|
93
|
+
spin={$orderDetailQuery.isLoading || $orderDetailQuery.isFetching}
|
|
94
|
+
/>
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
</svelte:fragment>
|
|
98
|
+
<svelte:fragment slot="card" let:data>
|
|
99
|
+
<div class="flex flex-col gap-y-6">
|
|
100
|
+
<CardProperty>
|
|
101
|
+
<svelte:fragment slot="key">Orderbook</svelte:fragment>
|
|
102
|
+
<svelte:fragment slot="value">
|
|
103
|
+
<Hash type={HashType.Identifier} shorten={false} value={data.order.orderbook.id} />
|
|
104
|
+
</svelte:fragment>
|
|
105
|
+
</CardProperty>
|
|
106
|
+
|
|
107
|
+
<CardProperty>
|
|
108
|
+
<svelte:fragment slot="key">Owner</svelte:fragment>
|
|
109
|
+
<svelte:fragment slot="value">
|
|
110
|
+
<Hash type={HashType.Wallet} shorten={false} value={data.order.owner} />
|
|
111
|
+
</svelte:fragment>
|
|
112
|
+
</CardProperty>
|
|
113
|
+
|
|
114
|
+
<CardProperty>
|
|
115
|
+
<svelte:fragment slot="key">Created</svelte:fragment>
|
|
116
|
+
<svelte:fragment slot="value">
|
|
117
|
+
{formatTimestampSecondsAsLocal(BigInt(data.order.timestampAdded))}
|
|
118
|
+
</svelte:fragment>
|
|
119
|
+
</CardProperty>
|
|
120
|
+
|
|
121
|
+
{#each [{ key: 'Input vaults', type: 'inputs' }, { key: 'Output vaults', type: 'outputs' }, { key: 'Input & output vaults', type: 'inputs_outputs' }] as { key, type }}
|
|
122
|
+
{#if data.vaults.get(type)?.length !== 0}
|
|
123
|
+
<CardProperty>
|
|
124
|
+
<svelte:fragment slot="key"
|
|
125
|
+
><div class="flex items-center gap-x-2">
|
|
126
|
+
{key}
|
|
127
|
+
{#if type === 'inputs_outputs'}
|
|
128
|
+
<InfoCircleOutline class="h-4 w-4" /><Tooltip
|
|
129
|
+
>{'These vaults can be an input or an output for this order'}</Tooltip
|
|
130
|
+
>{/if}
|
|
131
|
+
</div></svelte:fragment
|
|
132
|
+
>
|
|
133
|
+
<svelte:fragment slot="value">
|
|
134
|
+
<div class="mt-2 space-y-2">
|
|
135
|
+
{#each data.vaults.get(type) || [] as vault}
|
|
136
|
+
<ButtonVaultLink tokenVault={vault} {subgraphName}>
|
|
137
|
+
<svelte:fragment slot="buttons">
|
|
138
|
+
{#if handleDepositOrWithdrawModal && $signerAddress === vault.owner && chainId}
|
|
139
|
+
<DepositOrWithdrawButtons
|
|
140
|
+
{vault}
|
|
141
|
+
{chainId}
|
|
142
|
+
{rpcUrl}
|
|
143
|
+
query={orderDetailQuery}
|
|
144
|
+
{handleDepositOrWithdrawModal}
|
|
145
|
+
{subgraphUrl}
|
|
146
|
+
/>
|
|
147
|
+
{/if}
|
|
148
|
+
</svelte:fragment>
|
|
149
|
+
</ButtonVaultLink>
|
|
150
|
+
{/each}
|
|
151
|
+
</div>
|
|
152
|
+
</svelte:fragment>
|
|
153
|
+
</CardProperty>
|
|
154
|
+
{/if}
|
|
155
|
+
{/each}
|
|
156
|
+
</div>
|
|
157
|
+
</svelte:fragment>
|
|
158
|
+
<svelte:fragment slot="chart" let:data>
|
|
159
|
+
<OrderTradesChart id={data.order.id} {subgraphUrl} {lightweightChartsTheme} {colorTheme} />
|
|
160
|
+
</svelte:fragment>
|
|
161
|
+
<svelte:fragment slot="below" let:data>
|
|
162
|
+
<TanstackOrderQuote
|
|
163
|
+
id={data.order.id}
|
|
164
|
+
order={data.order}
|
|
165
|
+
{rpcUrl}
|
|
166
|
+
{orderbookAddress}
|
|
167
|
+
{handleQuoteDebugModal}
|
|
168
|
+
/>
|
|
169
|
+
<Tabs
|
|
170
|
+
style="underline"
|
|
171
|
+
contentClass="mt-4"
|
|
172
|
+
defaultClass="flex flex-wrap space-x-2 rtl:space-x-reverse mt-4 list-none"
|
|
173
|
+
>
|
|
174
|
+
<TabItem title="Rainlang source">
|
|
175
|
+
<div class="mb-8 overflow-hidden rounded-lg border dark:border-none">
|
|
176
|
+
<CodeMirrorRainlang
|
|
177
|
+
order={data.order}
|
|
178
|
+
codeMirrorTheme={$codeMirrorTheme}
|
|
179
|
+
{codeMirrorDisabled}
|
|
180
|
+
{codeMirrorStyles}
|
|
181
|
+
></CodeMirrorRainlang>
|
|
182
|
+
</div>
|
|
183
|
+
</TabItem>
|
|
184
|
+
<TabItem open title="Trades">
|
|
185
|
+
<OrderTradesListTable id={data.order.id} {subgraphUrl} />
|
|
186
|
+
</TabItem>
|
|
187
|
+
<TabItem title="Volume">
|
|
188
|
+
<OrderVaultsVolTable id={data.order.id} {subgraphUrl} />
|
|
189
|
+
</TabItem>
|
|
190
|
+
<TabItem title="APY">
|
|
191
|
+
<OrderApy id={data.order.id} {subgraphUrl} />
|
|
192
|
+
</TabItem>
|
|
193
|
+
</Tabs>
|
|
194
|
+
</svelte:fragment>
|
|
195
|
+
</TanstackPageContentDetail>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { Writable } from 'svelte/store';
|
|
3
|
+
import type { Config } from 'wagmi';
|
|
4
|
+
import type { Hex } from 'viem';
|
|
5
|
+
import type { DepositOrWithdrawModalProps, OrderRemoveModalProps, QuoteDebugModalHandler, DebugTradeModalHandler } from '../../types/modal';
|
|
6
|
+
declare const __propDef: {
|
|
7
|
+
props: {
|
|
8
|
+
handleDepositOrWithdrawModal?: ((props: DepositOrWithdrawModalProps) => void) | undefined;
|
|
9
|
+
handleOrderRemoveModal?: ((props: OrderRemoveModalProps) => void) | undefined;
|
|
10
|
+
handleQuoteDebugModal?: QuoteDebugModalHandler | undefined;
|
|
11
|
+
handleDebugTradeModal?: DebugTradeModalHandler | undefined;
|
|
12
|
+
colorTheme: any;
|
|
13
|
+
codeMirrorTheme: any;
|
|
14
|
+
lightweightChartsTheme: any;
|
|
15
|
+
orderbookAddress: Hex;
|
|
16
|
+
orderHash: string;
|
|
17
|
+
rpcUrl: string;
|
|
18
|
+
subgraphUrl: string;
|
|
19
|
+
chainId: number | undefined;
|
|
20
|
+
wagmiConfig?: Writable<Config> | undefined;
|
|
21
|
+
signerAddress?: Writable<string | null> | undefined;
|
|
22
|
+
};
|
|
23
|
+
events: {
|
|
24
|
+
[evt: string]: CustomEvent<any>;
|
|
25
|
+
};
|
|
26
|
+
slots: {};
|
|
27
|
+
exports?: {} | undefined;
|
|
28
|
+
bindings?: string | undefined;
|
|
29
|
+
};
|
|
30
|
+
export type OrderDetailProps = typeof __propDef.props;
|
|
31
|
+
export type OrderDetailEvents = typeof __propDef.events;
|
|
32
|
+
export type OrderDetailSlots = typeof __propDef.slots;
|
|
33
|
+
export default class OrderDetail extends SvelteComponent<OrderDetailProps, OrderDetailEvents, OrderDetailSlots> {
|
|
34
|
+
get handleDebugTradeModal(): DebugTradeModalHandler;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
<script generics="T">import { invalidateIdQuery } from "../../queries/queryClient";
|
|
2
|
+
import Refresh from "../icon/Refresh.svelte";
|
|
3
|
+
import EditableSpan from "../EditableSpan.svelte";
|
|
4
|
+
import { getOrderQuote } from "@rainlanguage/orderbook/quote";
|
|
5
|
+
import { QKEY_ORDER_QUOTE } from "../../queries/keys";
|
|
6
|
+
import { formatUnits, hexToNumber, isHex } from "viem";
|
|
7
|
+
import { createQuery, useQueryClient } from "@tanstack/svelte-query";
|
|
8
|
+
import {
|
|
9
|
+
Table,
|
|
10
|
+
TableBody,
|
|
11
|
+
TableBodyCell,
|
|
12
|
+
TableBodyRow,
|
|
13
|
+
TableHead,
|
|
14
|
+
TableHeadCell,
|
|
15
|
+
Tooltip
|
|
16
|
+
} from "flowbite-svelte";
|
|
17
|
+
import { BugOutline, PauseSolid, PlaySolid } from "flowbite-svelte-icons";
|
|
18
|
+
export let id;
|
|
19
|
+
export let order;
|
|
20
|
+
export let rpcUrl;
|
|
21
|
+
export let orderbookAddress;
|
|
22
|
+
export let handleQuoteDebugModal = void 0;
|
|
23
|
+
let enabled = true;
|
|
24
|
+
const queryClient = useQueryClient();
|
|
25
|
+
const refreshQuotes = async () => {
|
|
26
|
+
await invalidateIdQuery(queryClient, id);
|
|
27
|
+
};
|
|
28
|
+
$: orderQuoteQuery = createQuery({
|
|
29
|
+
queryKey: [id, QKEY_ORDER_QUOTE + id],
|
|
30
|
+
queryFn: () => getOrderQuote([order], rpcUrl),
|
|
31
|
+
enabled: !!id && enabled
|
|
32
|
+
});
|
|
33
|
+
let blockNumber;
|
|
34
|
+
$: orderModalArg = order;
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<div class="mt-4">
|
|
38
|
+
<div class="mb-4 flex items-center justify-between">
|
|
39
|
+
<h2 class="text-lg font-semibold">Order Quotes</h2>
|
|
40
|
+
<div class="flex items-center gap-x-1">
|
|
41
|
+
{#if $orderQuoteQuery.data && $orderQuoteQuery.data.length > 0 && isHex($orderQuoteQuery.data[0].blockNumber)}
|
|
42
|
+
<EditableSpan
|
|
43
|
+
displayValue={blockNumber?.toString() ||
|
|
44
|
+
hexToNumber($orderQuoteQuery.data[0].blockNumber).toString()}
|
|
45
|
+
on:focus={() => {
|
|
46
|
+
enabled = false;
|
|
47
|
+
}}
|
|
48
|
+
on:blur={({ detail: { value } }) => {
|
|
49
|
+
blockNumber = parseInt(value);
|
|
50
|
+
refreshQuotes();
|
|
51
|
+
}}
|
|
52
|
+
/>
|
|
53
|
+
{/if}
|
|
54
|
+
<span></span>
|
|
55
|
+
<Refresh
|
|
56
|
+
class="h-8 w-5 cursor-pointer text-gray-400 dark:text-gray-400"
|
|
57
|
+
on:click={refreshQuotes}
|
|
58
|
+
spin={$orderQuoteQuery.isLoading || $orderQuoteQuery.isFetching}
|
|
59
|
+
/>
|
|
60
|
+
<PauseSolid
|
|
61
|
+
class={`ml-2 h-8 w-3 cursor-pointer text-gray-400 dark:text-gray-400 ${!enabled ? 'hidden' : ''}`}
|
|
62
|
+
on:click={() => {
|
|
63
|
+
enabled = false;
|
|
64
|
+
}}
|
|
65
|
+
/>
|
|
66
|
+
<PlaySolid
|
|
67
|
+
on:click={() => {
|
|
68
|
+
enabled = true;
|
|
69
|
+
blockNumber = undefined;
|
|
70
|
+
refreshQuotes();
|
|
71
|
+
}}
|
|
72
|
+
class={`ml-2 h-8 w-3 cursor-pointer text-gray-400 dark:text-gray-400 ${enabled ? 'hidden' : ''}`}
|
|
73
|
+
/>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<Table divClass="rounded-lg lg:overflow-hidden overflow-auto dark:border-none border">
|
|
78
|
+
<TableHead data-testid="head">
|
|
79
|
+
<TableHeadCell class="w-[80px]" data-testid="orderQuotesPair">Pair</TableHeadCell>
|
|
80
|
+
<TableHeadCell class="w-1/4" data-testid="orderQuotesMaxOutput">Maximum Output</TableHeadCell>
|
|
81
|
+
<TableHeadCell class="w-1/4" data-testid="orderQuotesPrice">Price</TableHeadCell>
|
|
82
|
+
<TableHeadCell data-testid="orderQuotesPrice">Maximum Input</TableHeadCell>
|
|
83
|
+
<TableHeadCell class="w-[50px]" />
|
|
84
|
+
</TableHead>
|
|
85
|
+
|
|
86
|
+
<TableBody>
|
|
87
|
+
{#if $orderQuoteQuery.data && $orderQuoteQuery.data.length > 0}
|
|
88
|
+
{#each $orderQuoteQuery.data as item}
|
|
89
|
+
{#if item.success && item.data}
|
|
90
|
+
<TableBodyRow data-testid="bodyRow">
|
|
91
|
+
<TableBodyCell>{item.pair.pairName}</TableBodyCell>
|
|
92
|
+
<TableBodyCell>{formatUnits(BigInt(item.data.maxOutput), 18)}</TableBodyCell>
|
|
93
|
+
<TableBodyCell
|
|
94
|
+
>{formatUnits(BigInt(item.data.ratio), 18)}
|
|
95
|
+
<span class="text-gray-400"
|
|
96
|
+
>({BigInt(item.data.ratio) > 0n
|
|
97
|
+
? formatUnits(10n ** 36n / BigInt(item.data.ratio), 18)
|
|
98
|
+
: '0'})</span
|
|
99
|
+
></TableBodyCell
|
|
100
|
+
>
|
|
101
|
+
<TableBodyCell
|
|
102
|
+
>{formatUnits(
|
|
103
|
+
BigInt(item.data.maxOutput) * BigInt(item.data.ratio),
|
|
104
|
+
36
|
|
105
|
+
)}</TableBodyCell
|
|
106
|
+
>
|
|
107
|
+
<TableBodyCell>
|
|
108
|
+
{#if handleQuoteDebugModal}
|
|
109
|
+
<button
|
|
110
|
+
on:click={() =>
|
|
111
|
+
handleQuoteDebugModal(
|
|
112
|
+
orderModalArg,
|
|
113
|
+
rpcUrl || '',
|
|
114
|
+
orderbookAddress || '',
|
|
115
|
+
item.pair.inputIndex,
|
|
116
|
+
item.pair.outputIndex,
|
|
117
|
+
item.pair.pairName,
|
|
118
|
+
$orderQuoteQuery.data[0].blockNumber
|
|
119
|
+
)}
|
|
120
|
+
>
|
|
121
|
+
<BugOutline size="sm" color="grey" />
|
|
122
|
+
</button>
|
|
123
|
+
{/if}
|
|
124
|
+
</TableBodyCell>
|
|
125
|
+
</TableBodyRow>
|
|
126
|
+
{:else if !item.success && item.error}
|
|
127
|
+
<TableBodyRow>
|
|
128
|
+
<TableBodyCell>{item.pair.pairName}</TableBodyCell>
|
|
129
|
+
<TableBodyCell colspan="2" class="flex flex-col justify-start text-gray-400">
|
|
130
|
+
<Tooltip triggeredBy="#quote-error">
|
|
131
|
+
{item.error}
|
|
132
|
+
</Tooltip>
|
|
133
|
+
<div
|
|
134
|
+
id="quote-error"
|
|
135
|
+
class="overflow-x cursor-pointer self-start border-dotted border-red-500"
|
|
136
|
+
>
|
|
137
|
+
Error fetching quote
|
|
138
|
+
</div>
|
|
139
|
+
</TableBodyCell>
|
|
140
|
+
<TableBodyCell />
|
|
141
|
+
<TableBodyCell />
|
|
142
|
+
<TableBodyCell>
|
|
143
|
+
{#if handleQuoteDebugModal}
|
|
144
|
+
<button
|
|
145
|
+
on:click={() =>
|
|
146
|
+
handleQuoteDebugModal(
|
|
147
|
+
order,
|
|
148
|
+
rpcUrl || '',
|
|
149
|
+
orderbookAddress || '',
|
|
150
|
+
item.pair.inputIndex,
|
|
151
|
+
item.pair.outputIndex,
|
|
152
|
+
item.pair.pairName,
|
|
153
|
+
$orderQuoteQuery.data[0].blockNumber
|
|
154
|
+
)}
|
|
155
|
+
>
|
|
156
|
+
<BugOutline size="sm" color="grey" />
|
|
157
|
+
</button>
|
|
158
|
+
{/if}
|
|
159
|
+
</TableBodyCell>
|
|
160
|
+
</TableBodyRow>
|
|
161
|
+
{/if}
|
|
162
|
+
{/each}
|
|
163
|
+
{:else if $orderQuoteQuery.isError}
|
|
164
|
+
<TableBodyRow>
|
|
165
|
+
<TableBodyCell colspan="3" class="text-center text-red-500 dark:text-red-400">
|
|
166
|
+
{'Error fetching quotes:'} <br />
|
|
167
|
+
{$orderQuoteQuery.error}
|
|
168
|
+
</TableBodyCell>
|
|
169
|
+
</TableBodyRow>
|
|
170
|
+
{/if}
|
|
171
|
+
</TableBody>
|
|
172
|
+
</Table>
|
|
173
|
+
</div>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { Hex } from 'viem';
|
|
3
|
+
import type { SgOrder } from '@rainlanguage/orderbook/js_api';
|
|
4
|
+
declare class __sveltets_Render<T> {
|
|
5
|
+
props(): {
|
|
6
|
+
id: string;
|
|
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;
|
|
11
|
+
};
|
|
12
|
+
events(): {} & {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots(): {};
|
|
16
|
+
}
|
|
17
|
+
export type TanstackOrderQuoteProps<T> = ReturnType<__sveltets_Render<T>['props']>;
|
|
18
|
+
export type TanstackOrderQuoteEvents<T> = ReturnType<__sveltets_Render<T>['events']>;
|
|
19
|
+
export type TanstackOrderQuoteSlots<T> = ReturnType<__sveltets_Render<T>['slots']>;
|
|
20
|
+
export default class TanstackOrderQuote<T> extends SvelteComponent<TanstackOrderQuoteProps<T>, TanstackOrderQuoteEvents<T>, TanstackOrderQuoteSlots<T>> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script generics="T">import { Spinner } from "flowbite-svelte";
|
|
2
|
+
export let query;
|
|
3
|
+
export let emptyMessage = "Not found";
|
|
4
|
+
let data;
|
|
5
|
+
$: if ($query.data) {
|
|
6
|
+
data = $query.data;
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
{#if data}
|
|
11
|
+
<div class="mb-6 flex items-end justify-between">
|
|
12
|
+
<slot name="top" {data} />
|
|
13
|
+
</div>
|
|
14
|
+
<div class="tanstack-detail-grid">
|
|
15
|
+
<div class="flex flex-col gap-y-6 lg:col-span-1">
|
|
16
|
+
<slot name="card" {data} />
|
|
17
|
+
</div>
|
|
18
|
+
<div class="h-[500px] lg:col-span-2">
|
|
19
|
+
<slot name="chart" {data} />
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="w-full">
|
|
23
|
+
<slot name="below" {data} />
|
|
24
|
+
</div>
|
|
25
|
+
{:else if $query.isFetching || $query.isLoading}
|
|
26
|
+
<div class="flex h-16 w-full items-center justify-center">
|
|
27
|
+
<Spinner class="h-8 w-8" color="white" data-testid="loadingSpinner" />
|
|
28
|
+
</div>
|
|
29
|
+
{:else}
|
|
30
|
+
<div data-testid="emptyMessage" class="text-center text-gray-900 dark:text-white">
|
|
31
|
+
{emptyMessage}
|
|
32
|
+
</div>
|
|
33
|
+
{/if}
|
|
34
|
+
|
|
35
|
+
<style>
|
|
36
|
+
.tanstack-detail-grid {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
gap: 1rem;
|
|
40
|
+
width: 100%;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@media (min-width: 1024px) {
|
|
44
|
+
.tanstack-detail-grid {
|
|
45
|
+
flex-direction: row;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.tanstack-detail-grid > :first-child {
|
|
49
|
+
flex: 1;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.tanstack-detail-grid > :last-child {
|
|
53
|
+
flex: 2;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { CreateQueryResult } from '@tanstack/svelte-query';
|
|
3
|
+
declare class __sveltets_Render<T> {
|
|
4
|
+
props(): {
|
|
5
|
+
query: CreateQueryResult<T>;
|
|
6
|
+
emptyMessage?: string;
|
|
7
|
+
};
|
|
8
|
+
events(): {} & {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots(): {
|
|
12
|
+
top: {
|
|
13
|
+
data: NonNullable<T>;
|
|
14
|
+
};
|
|
15
|
+
card: {
|
|
16
|
+
data: NonNullable<T>;
|
|
17
|
+
};
|
|
18
|
+
chart: {
|
|
19
|
+
data: NonNullable<T>;
|
|
20
|
+
};
|
|
21
|
+
below: {
|
|
22
|
+
data: NonNullable<T>;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export type TanstackPageContentDetailProps<T> = ReturnType<__sveltets_Render<T>['props']>;
|
|
27
|
+
export type TanstackPageContentDetailEvents<T> = ReturnType<__sveltets_Render<T>['events']>;
|
|
28
|
+
export type TanstackPageContentDetailSlots<T> = ReturnType<__sveltets_Render<T>['slots']>;
|
|
29
|
+
export default class TanstackPageContentDetail<T> extends SvelteComponent<TanstackPageContentDetailProps<T>, TanstackPageContentDetailEvents<T>, TanstackPageContentDetailSlots<T>> {
|
|
30
|
+
}
|
|
31
|
+
export {};
|