@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,67 @@
|
|
|
1
|
+
<script>import { createInfiniteQuery } from "@tanstack/svelte-query";
|
|
2
|
+
import TanstackAppTable from "../TanstackAppTable.svelte";
|
|
3
|
+
import { QKEY_VAULTS_VOL_LIST } from "../../queries/keys";
|
|
4
|
+
import { getOrderVaultsVolume } from "@rainlanguage/orderbook/js_api";
|
|
5
|
+
import { TableBodyCell, TableHeadCell } from "flowbite-svelte";
|
|
6
|
+
import Hash, { HashType } from "../Hash.svelte";
|
|
7
|
+
import { formatUnits } from "viem";
|
|
8
|
+
import TableTimeFilters from "../charts/TableTimeFilters.svelte";
|
|
9
|
+
import { bigintStringToHex } from "../../utils/hex";
|
|
10
|
+
export let id;
|
|
11
|
+
export let subgraphUrl;
|
|
12
|
+
let startTimestamp;
|
|
13
|
+
let endTimestamp;
|
|
14
|
+
$: queryStartTime = startTimestamp ? BigInt(startTimestamp) : void 0;
|
|
15
|
+
$: queryEndTime = endTimestamp ? BigInt(endTimestamp) : void 0;
|
|
16
|
+
$: vaultsVol = createInfiniteQuery({
|
|
17
|
+
queryKey: [id, QKEY_VAULTS_VOL_LIST + id],
|
|
18
|
+
queryFn: () => getOrderVaultsVolume(subgraphUrl || "", id, queryStartTime, queryEndTime),
|
|
19
|
+
initialPageParam: 0,
|
|
20
|
+
getNextPageParam: () => void 0,
|
|
21
|
+
enabled: !!subgraphUrl
|
|
22
|
+
});
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<TanstackAppTable
|
|
26
|
+
query={vaultsVol}
|
|
27
|
+
emptyMessage="No trades found"
|
|
28
|
+
rowHoverable={false}
|
|
29
|
+
queryKey={id}
|
|
30
|
+
>
|
|
31
|
+
<svelte:fragment slot="timeFilter">
|
|
32
|
+
<TableTimeFilters bind:startTimestamp bind:endTimestamp />
|
|
33
|
+
</svelte:fragment>
|
|
34
|
+
<svelte:fragment slot="head">
|
|
35
|
+
<TableHeadCell padding="p-4">Vault</TableHeadCell>
|
|
36
|
+
<TableHeadCell padding="p-0">Token</TableHeadCell>
|
|
37
|
+
<TableHeadCell padding="p-0">In Volume</TableHeadCell>
|
|
38
|
+
<TableHeadCell padding="p-0">Out Volume</TableHeadCell>
|
|
39
|
+
<TableHeadCell padding="p-0">Net Volume</TableHeadCell>
|
|
40
|
+
<TableHeadCell padding="p-0">Total Volume</TableHeadCell>
|
|
41
|
+
</svelte:fragment>
|
|
42
|
+
|
|
43
|
+
<svelte:fragment slot="bodyRow" let:item>
|
|
44
|
+
<TableBodyCell tdClass="px-4 py-2">
|
|
45
|
+
<Hash type={HashType.Identifier} shorten value={bigintStringToHex(item.id)} />
|
|
46
|
+
</TableBodyCell>
|
|
47
|
+
<TableBodyCell tdClass="break-all py-2 min-w-32">
|
|
48
|
+
<div class="flex gap-x-3">
|
|
49
|
+
<Hash type={HashType.Address} shorten value={item.token.address} />
|
|
50
|
+
{item.token.symbol}
|
|
51
|
+
</div>
|
|
52
|
+
</TableBodyCell>
|
|
53
|
+
<TableBodyCell tdClass="break-all py-2 min-w-32" data-testid="total-in">
|
|
54
|
+
{formatUnits(BigInt(item.volDetails.totalIn), Number(item.token.decimals ?? 0))}
|
|
55
|
+
</TableBodyCell>
|
|
56
|
+
<TableBodyCell tdClass="break-all py-2" data-testid="total-out">
|
|
57
|
+
{formatUnits(BigInt(item.volDetails.totalOut), Number(item.token.decimals ?? 0))}
|
|
58
|
+
</TableBodyCell>
|
|
59
|
+
<TableBodyCell tdClass="break-all py-2" data-testid="net-vol">
|
|
60
|
+
{(BigInt(item.volDetails.totalIn) >= BigInt(item.volDetails.totalOut) ? '' : '-') +
|
|
61
|
+
formatUnits(BigInt(item.volDetails.netVol), Number(item.token.decimals ?? 0))}
|
|
62
|
+
</TableBodyCell>
|
|
63
|
+
<TableBodyCell tdClass="break-all py-2" data-testid="total-vol">
|
|
64
|
+
{formatUnits(BigInt(item.volDetails.totalVol), Number(item.token.decimals ?? 0))}
|
|
65
|
+
</TableBodyCell>
|
|
66
|
+
</svelte:fragment>
|
|
67
|
+
</TanstackAppTable>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
id: string;
|
|
5
|
+
subgraphUrl: string;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
exports?: {} | undefined;
|
|
12
|
+
bindings?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type OrderVaultsVolTableProps = typeof __propDef.props;
|
|
15
|
+
export type OrderVaultsVolTableEvents = typeof __propDef.events;
|
|
16
|
+
export type OrderVaultsVolTableSlots = typeof __propDef.slots;
|
|
17
|
+
export default class OrderVaultsVolTable extends SvelteComponent<OrderVaultsVolTableProps, OrderVaultsVolTableEvents, OrderVaultsVolTableSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
<script generics="T">import { goto } from "$app/navigation";
|
|
2
|
+
import { DotsVerticalOutline } from "flowbite-svelte-icons";
|
|
3
|
+
import {} from "@rainlanguage/orderbook/js_api";
|
|
4
|
+
import { createInfiniteQuery } from "@tanstack/svelte-query";
|
|
5
|
+
import { getOrders } from "@rainlanguage/orderbook/js_api";
|
|
6
|
+
import TanstackAppTable from "../TanstackAppTable.svelte";
|
|
7
|
+
import { formatTimestampSecondsAsLocal } from "../../utils/time";
|
|
8
|
+
import ListViewOrderbookFilters from "../ListViewOrderbookFilters.svelte";
|
|
9
|
+
import Hash, { HashType } from "../Hash.svelte";
|
|
10
|
+
import { DEFAULT_PAGE_SIZE, DEFAULT_REFRESH_INTERVAL } from "../../queries/constants";
|
|
11
|
+
import { QKEY_ORDERS } from "../../queries/keys";
|
|
12
|
+
import {
|
|
13
|
+
Badge,
|
|
14
|
+
Button,
|
|
15
|
+
Dropdown,
|
|
16
|
+
DropdownItem,
|
|
17
|
+
TableBodyCell,
|
|
18
|
+
TableHeadCell
|
|
19
|
+
} from "flowbite-svelte";
|
|
20
|
+
export const walletAddressMatchesOrBlank = void 0;
|
|
21
|
+
export const handleOrderRemoveModal = void 0;
|
|
22
|
+
export let activeSubgraphs;
|
|
23
|
+
export let settings;
|
|
24
|
+
export let accounts;
|
|
25
|
+
export let activeAccountsItems;
|
|
26
|
+
export let activeOrderStatus;
|
|
27
|
+
export let orderHash;
|
|
28
|
+
export let hideZeroBalanceVaults;
|
|
29
|
+
export let showMyItemsOnly;
|
|
30
|
+
export let currentRoute;
|
|
31
|
+
export let signerAddress;
|
|
32
|
+
export let activeNetworkRef;
|
|
33
|
+
export let activeOrderbookRef;
|
|
34
|
+
$: multiSubgraphArgs = Object.entries(
|
|
35
|
+
Object.keys($activeSubgraphs ?? {}).length ? $activeSubgraphs : $settings?.subgraphs ?? {}
|
|
36
|
+
).map(([name, url]) => ({
|
|
37
|
+
name,
|
|
38
|
+
url
|
|
39
|
+
}));
|
|
40
|
+
$: owners = $activeAccountsItems && Object.values($activeAccountsItems).length > 0 ? Object.values($activeAccountsItems) : $showMyItemsOnly && $signerAddress ? [$signerAddress] : [];
|
|
41
|
+
$: query = createInfiniteQuery({
|
|
42
|
+
queryKey: [
|
|
43
|
+
QKEY_ORDERS,
|
|
44
|
+
$activeSubgraphs,
|
|
45
|
+
$settings,
|
|
46
|
+
multiSubgraphArgs,
|
|
47
|
+
owners,
|
|
48
|
+
$activeOrderStatus,
|
|
49
|
+
$orderHash
|
|
50
|
+
],
|
|
51
|
+
queryFn: ({ pageParam }) => {
|
|
52
|
+
return getOrders(
|
|
53
|
+
multiSubgraphArgs,
|
|
54
|
+
{
|
|
55
|
+
owners,
|
|
56
|
+
active: $activeOrderStatus,
|
|
57
|
+
orderHash: $orderHash || void 0
|
|
58
|
+
},
|
|
59
|
+
{ page: pageParam + 1, pageSize: DEFAULT_PAGE_SIZE }
|
|
60
|
+
);
|
|
61
|
+
},
|
|
62
|
+
initialPageParam: 0,
|
|
63
|
+
getNextPageParam(lastPage, _allPages, lastPageParam) {
|
|
64
|
+
return lastPage.length === DEFAULT_PAGE_SIZE ? lastPageParam + 1 : void 0;
|
|
65
|
+
},
|
|
66
|
+
refetchInterval: DEFAULT_REFRESH_INTERVAL,
|
|
67
|
+
enabled: true
|
|
68
|
+
});
|
|
69
|
+
const AppTable = TanstackAppTable;
|
|
70
|
+
$: isVaultsPage = currentRoute.startsWith("/vaults");
|
|
71
|
+
$: isOrdersPage = currentRoute.startsWith("/orders");
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<ListViewOrderbookFilters
|
|
75
|
+
{activeSubgraphs}
|
|
76
|
+
{settings}
|
|
77
|
+
{accounts}
|
|
78
|
+
{activeAccountsItems}
|
|
79
|
+
{showMyItemsOnly}
|
|
80
|
+
{activeOrderStatus}
|
|
81
|
+
{orderHash}
|
|
82
|
+
{hideZeroBalanceVaults}
|
|
83
|
+
{isVaultsPage}
|
|
84
|
+
{isOrdersPage}
|
|
85
|
+
{signerAddress}
|
|
86
|
+
/>
|
|
87
|
+
|
|
88
|
+
<AppTable
|
|
89
|
+
{query}
|
|
90
|
+
queryKey={undefined}
|
|
91
|
+
emptyMessage="No Orders Found"
|
|
92
|
+
on:clickRow={(e) => {
|
|
93
|
+
activeNetworkRef.set(e.detail.item.subgraphName);
|
|
94
|
+
activeOrderbookRef.set(e.detail.item.subgraphName);
|
|
95
|
+
goto(`/orders/${e.detail.item.subgraphName}-${e.detail.item.order.orderHash}`);
|
|
96
|
+
}}
|
|
97
|
+
>
|
|
98
|
+
<svelte:fragment slot="title">
|
|
99
|
+
<slot name="filters" />
|
|
100
|
+
</svelte:fragment>
|
|
101
|
+
|
|
102
|
+
<svelte:fragment slot="head">
|
|
103
|
+
<TableHeadCell data-testid="orderListHeadingNetwork" padding="p-4">Network</TableHeadCell>
|
|
104
|
+
<TableHeadCell data-testid="orderListHeadingActive" padding="p-4">Active</TableHeadCell>
|
|
105
|
+
<TableHeadCell data-testid="orderListHeadingID" padding="p-4">Order</TableHeadCell>
|
|
106
|
+
<TableHeadCell data-testid="orderListHeadingOwner" padding="p-4">Owner</TableHeadCell>
|
|
107
|
+
<TableHeadCell data-testid="orderListHeadingOrderbook" padding="p-4">Orderbook</TableHeadCell>
|
|
108
|
+
<TableHeadCell data-testid="orderListHeadingLastAdded" padding="p-4">Last Added</TableHeadCell>
|
|
109
|
+
<TableHeadCell data-testid="orderListHeadingInputs" padding="px-2 py-4"
|
|
110
|
+
>Input Token(s)</TableHeadCell
|
|
111
|
+
>
|
|
112
|
+
<TableHeadCell data-testid="orderListHeadingOutputs" padding="px-2 py-4"
|
|
113
|
+
>Output Token(s)</TableHeadCell
|
|
114
|
+
>
|
|
115
|
+
<TableHeadCell data-testid="orderListHeadingTrades" padding="px-2 py-4">Trades</TableHeadCell>
|
|
116
|
+
</svelte:fragment>
|
|
117
|
+
|
|
118
|
+
<svelte:fragment slot="bodyRow" let:item>
|
|
119
|
+
<TableBodyCell data-testid="orderListRowNetwork" tdClass="px-4 py-2">
|
|
120
|
+
{item.subgraphName}
|
|
121
|
+
</TableBodyCell>
|
|
122
|
+
<TableBodyCell data-testid="orderListRowActive" tdClass="px-4 py-2">
|
|
123
|
+
{#if item.order.active}
|
|
124
|
+
<Badge color="green">Active</Badge>
|
|
125
|
+
{:else}
|
|
126
|
+
<Badge color="yellow">Inactive</Badge>
|
|
127
|
+
{/if}
|
|
128
|
+
</TableBodyCell>
|
|
129
|
+
<TableBodyCell data-testid="orderListRowID" tdClass="break-all px-4 py-4">
|
|
130
|
+
<Hash type={HashType.Identifier} value={item.order.orderHash} />
|
|
131
|
+
</TableBodyCell>
|
|
132
|
+
<TableBodyCell data-testid="orderListRowOwner" tdClass="break-all px-4 py-2">
|
|
133
|
+
<Hash type={HashType.Wallet} value={item.order.owner} />
|
|
134
|
+
</TableBodyCell>
|
|
135
|
+
<TableBodyCell data-testid="orderListRowOrderbook" tdClass="break-all px-4 py-2">
|
|
136
|
+
<Hash type={HashType.Identifier} value={item.order.orderbook.id} />
|
|
137
|
+
</TableBodyCell>
|
|
138
|
+
<TableBodyCell data-testid="orderListRowLastAdded" tdClass="break-word px-4 py-2">
|
|
139
|
+
{formatTimestampSecondsAsLocal(BigInt(item.order.timestampAdded))}
|
|
140
|
+
</TableBodyCell>
|
|
141
|
+
<TableBodyCell data-testid="orderListRowInputs" tdClass="break-word p-2">
|
|
142
|
+
{item.order.inputs?.map((t) => t.token.symbol)}
|
|
143
|
+
</TableBodyCell>
|
|
144
|
+
<TableBodyCell data-testid="orderListRowOutputs" tdClass="break-word p-2">
|
|
145
|
+
{item.order.outputs?.map((t) => t.token.symbol)}
|
|
146
|
+
</TableBodyCell>
|
|
147
|
+
<TableBodyCell data-testid="orderListRowTrades" tdClass="break-word p-2"
|
|
148
|
+
>{item.order.trades.length > 99 ? '>99' : item.order.trades.length}</TableBodyCell
|
|
149
|
+
>
|
|
150
|
+
{#if walletAddressMatchesOrBlank && handleOrderRemoveModal}
|
|
151
|
+
<div data-testid="wallet-actions">
|
|
152
|
+
<TableBodyCell tdClass="px-0 text-right">
|
|
153
|
+
{#if $walletAddressMatchesOrBlank(item.order.owner) && item.order.active}
|
|
154
|
+
<Button
|
|
155
|
+
color="alternative"
|
|
156
|
+
outline={false}
|
|
157
|
+
data-testid={`order-menu-${item.order.id}`}
|
|
158
|
+
id={`order-menu-${item.order.id}`}
|
|
159
|
+
class="mr-2 border-none px-2"
|
|
160
|
+
on:click={(e) => {
|
|
161
|
+
e.stopPropagation();
|
|
162
|
+
}}
|
|
163
|
+
>
|
|
164
|
+
<DotsVerticalOutline class="dark:text-white" />
|
|
165
|
+
</Button>
|
|
166
|
+
{/if}
|
|
167
|
+
</TableBodyCell>
|
|
168
|
+
{#if $walletAddressMatchesOrBlank(item.order.owner) && item.order.active}
|
|
169
|
+
<Dropdown placement="bottom-end" triggeredBy={`#order-menu-${item.order.id}`}>
|
|
170
|
+
<DropdownItem
|
|
171
|
+
on:click={(e) => {
|
|
172
|
+
e.stopPropagation();
|
|
173
|
+
handleOrderRemoveModal(item.order, $query.refetch);
|
|
174
|
+
}}>Remove</DropdownItem
|
|
175
|
+
>
|
|
176
|
+
</Dropdown>
|
|
177
|
+
{/if}
|
|
178
|
+
</div>
|
|
179
|
+
{/if}
|
|
180
|
+
</svelte:fragment>
|
|
181
|
+
</AppTable>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { AppStoresInterface } from '../../types/appStores';
|
|
3
|
+
import type { Writable } from 'svelte/store';
|
|
4
|
+
declare class __sveltets_Render<T> {
|
|
5
|
+
props(): {
|
|
6
|
+
walletAddressMatchesOrBlank?: any;
|
|
7
|
+
handleOrderRemoveModal?: any;
|
|
8
|
+
activeSubgraphs: AppStoresInterface["activeSubgraphs"];
|
|
9
|
+
settings: AppStoresInterface["settings"];
|
|
10
|
+
accounts: AppStoresInterface["accounts"] | undefined;
|
|
11
|
+
activeAccountsItems: AppStoresInterface["activeAccountsItems"] | undefined;
|
|
12
|
+
activeOrderStatus: AppStoresInterface["activeOrderStatus"];
|
|
13
|
+
orderHash: AppStoresInterface["orderHash"];
|
|
14
|
+
hideZeroBalanceVaults: AppStoresInterface["hideZeroBalanceVaults"];
|
|
15
|
+
showMyItemsOnly: AppStoresInterface["showMyItemsOnly"];
|
|
16
|
+
currentRoute: string;
|
|
17
|
+
signerAddress: Writable<string | null> | undefined;
|
|
18
|
+
activeNetworkRef: AppStoresInterface["activeNetworkRef"];
|
|
19
|
+
activeOrderbookRef: AppStoresInterface["activeOrderbookRef"];
|
|
20
|
+
};
|
|
21
|
+
events(): {} & {
|
|
22
|
+
[evt: string]: CustomEvent<any>;
|
|
23
|
+
};
|
|
24
|
+
slots(): {
|
|
25
|
+
filters: {};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export type OrdersListTableProps<T> = ReturnType<__sveltets_Render<T>['props']>;
|
|
29
|
+
export type OrdersListTableEvents<T> = ReturnType<__sveltets_Render<T>['events']>;
|
|
30
|
+
export type OrdersListTableSlots<T> = ReturnType<__sveltets_Render<T>['slots']>;
|
|
31
|
+
export default class OrdersListTable<T> extends SvelteComponent<OrdersListTableProps<T>, OrdersListTableEvents<T>, OrdersListTableSlots<T>> {
|
|
32
|
+
get walletAddressMatchesOrBlank(): any;
|
|
33
|
+
get handleOrderRemoveModal(): any;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script generics="T">import { Heading, TableHeadCell, TableBodyCell } from "flowbite-svelte";
|
|
2
|
+
import { formatUnits } from "viem";
|
|
3
|
+
import { createInfiniteQuery } from "@tanstack/svelte-query";
|
|
4
|
+
import {
|
|
5
|
+
getVaultBalanceChanges
|
|
6
|
+
} from "@rainlanguage/orderbook/js_api";
|
|
7
|
+
import { formatTimestampSecondsAsLocal } from "../../utils/time";
|
|
8
|
+
import Hash, { HashType } from "../Hash.svelte";
|
|
9
|
+
import { QKEY_VAULT_CHANGES } from "../../queries/keys";
|
|
10
|
+
import { DEFAULT_PAGE_SIZE } from "../../queries/constants";
|
|
11
|
+
import TanstackAppTable from "../TanstackAppTable.svelte";
|
|
12
|
+
export let id;
|
|
13
|
+
export let subgraphUrl;
|
|
14
|
+
$: balanceChangesQuery = createInfiniteQuery({
|
|
15
|
+
queryKey: [id, QKEY_VAULT_CHANGES + id],
|
|
16
|
+
queryFn: ({ pageParam }) => {
|
|
17
|
+
return getVaultBalanceChanges(subgraphUrl || "", id, {
|
|
18
|
+
page: pageParam + 1,
|
|
19
|
+
pageSize: DEFAULT_PAGE_SIZE
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
initialPageParam: 0,
|
|
23
|
+
getNextPageParam(lastPage, _allPages, lastPageParam) {
|
|
24
|
+
return lastPage.length === DEFAULT_PAGE_SIZE ? lastPageParam + 1 : void 0;
|
|
25
|
+
},
|
|
26
|
+
enabled: !!subgraphUrl
|
|
27
|
+
});
|
|
28
|
+
const AppTable = TanstackAppTable;
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<AppTable
|
|
32
|
+
query={balanceChangesQuery}
|
|
33
|
+
queryKey={undefined}
|
|
34
|
+
emptyMessage="No deposits or withdrawals found"
|
|
35
|
+
rowHoverable={false}
|
|
36
|
+
>
|
|
37
|
+
<svelte:fragment slot="title">
|
|
38
|
+
<Heading tag="h5" class="mb-4 mt-6 font-normal">Vault Balance Changes</Heading>
|
|
39
|
+
</svelte:fragment>
|
|
40
|
+
<svelte:fragment slot="head">
|
|
41
|
+
<TableHeadCell padding="p-4">Date</TableHeadCell>
|
|
42
|
+
<TableHeadCell padding="p-0">Sender</TableHeadCell>
|
|
43
|
+
<TableHeadCell padding="p-0">Transaction Hash</TableHeadCell>
|
|
44
|
+
<TableHeadCell padding="p-0">Balance Change</TableHeadCell>
|
|
45
|
+
<TableHeadCell padding="p-0">Balance</TableHeadCell>
|
|
46
|
+
<TableHeadCell padding="p--">Type</TableHeadCell>
|
|
47
|
+
</svelte:fragment>
|
|
48
|
+
|
|
49
|
+
<svelte:fragment slot="bodyRow" let:item>
|
|
50
|
+
<TableBodyCell tdClass="px-4 py-2" data-testid="vaultBalanceChangesTableDate">
|
|
51
|
+
{formatTimestampSecondsAsLocal(BigInt(item.timestamp))}
|
|
52
|
+
</TableBodyCell>
|
|
53
|
+
<TableBodyCell tdClass="break-all py-2 min-w-48" data-testid="vaultBalanceChangesTableFrom">
|
|
54
|
+
<Hash type={HashType.Wallet} value={item.transaction.from} />
|
|
55
|
+
</TableBodyCell>
|
|
56
|
+
<TableBodyCell tdClass="break-all py-2 min-w-48" data-testid="vaultBalanceChangesTableTx">
|
|
57
|
+
<Hash type={HashType.Transaction} value={item.transaction.id} />
|
|
58
|
+
</TableBodyCell>
|
|
59
|
+
<TableBodyCell
|
|
60
|
+
tdClass="break-word p-0 text-left"
|
|
61
|
+
data-testid="vaultBalanceChangesTableBalanceChange"
|
|
62
|
+
>
|
|
63
|
+
{formatUnits(BigInt(item.amount), Number(item.vault.token.decimals ?? 0))}
|
|
64
|
+
{item.vault.token.symbol}
|
|
65
|
+
</TableBodyCell>
|
|
66
|
+
<TableBodyCell tdClass="break-word p-0 text-left" data-testid="vaultBalanceChangesTableBalance">
|
|
67
|
+
{formatUnits(BigInt(item.newVaultBalance), Number(item.vault.token.decimals ?? 0))}
|
|
68
|
+
{item.vault.token.symbol}
|
|
69
|
+
</TableBodyCell>
|
|
70
|
+
<TableBodyCell tdClass="break-word p-0 text-left" data-testid="vaultBalanceChangesTableType">
|
|
71
|
+
{item.__typename}
|
|
72
|
+
</TableBodyCell>
|
|
73
|
+
</svelte:fragment>
|
|
74
|
+
</AppTable>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare class __sveltets_Render<T> {
|
|
3
|
+
props(): {
|
|
4
|
+
id: string;
|
|
5
|
+
subgraphUrl: string;
|
|
6
|
+
};
|
|
7
|
+
events(): {} & {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots(): {};
|
|
11
|
+
}
|
|
12
|
+
export type VaultBalanceChangesTableProps<T> = ReturnType<__sveltets_Render<T>['props']>;
|
|
13
|
+
export type VaultBalanceChangesTableEvents<T> = ReturnType<__sveltets_Render<T>['events']>;
|
|
14
|
+
export type VaultBalanceChangesTableSlots<T> = ReturnType<__sveltets_Render<T>['slots']>;
|
|
15
|
+
export default class VaultBalanceChangesTable<T> extends SvelteComponent<VaultBalanceChangesTableProps<T>, VaultBalanceChangesTableEvents<T>, VaultBalanceChangesTableSlots<T>> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
<script generics="T">import { Button, Dropdown, DropdownItem, TableBodyCell, TableHeadCell } from "flowbite-svelte";
|
|
2
|
+
import { goto } from "$app/navigation";
|
|
3
|
+
import { DotsVerticalOutline } from "flowbite-svelte-icons";
|
|
4
|
+
import { createInfiniteQuery } from "@tanstack/svelte-query";
|
|
5
|
+
import TanstackAppTable from "../TanstackAppTable.svelte";
|
|
6
|
+
import ListViewOrderbookFilters from "../ListViewOrderbookFilters.svelte";
|
|
7
|
+
import OrderOrVaultHash from "../OrderOrVaultHash.svelte";
|
|
8
|
+
import Hash, { HashType } from "../Hash.svelte";
|
|
9
|
+
import { DEFAULT_PAGE_SIZE, DEFAULT_REFRESH_INTERVAL } from "../../queries/constants";
|
|
10
|
+
import { vaultBalanceDisplay } from "../../utils/vault";
|
|
11
|
+
import { bigintStringToHex } from "../../utils/hex";
|
|
12
|
+
import {} from "@rainlanguage/orderbook/js_api";
|
|
13
|
+
import {} from "@rainlanguage/orderbook/js_api";
|
|
14
|
+
import { QKEY_VAULTS } from "../../queries/keys";
|
|
15
|
+
import {
|
|
16
|
+
getVaults
|
|
17
|
+
} from "@rainlanguage/orderbook/js_api";
|
|
18
|
+
import {} from "svelte/store";
|
|
19
|
+
export let activeOrderbook;
|
|
20
|
+
export let subgraphUrl;
|
|
21
|
+
export let accounts;
|
|
22
|
+
export let activeAccountsItems;
|
|
23
|
+
export let orderHash;
|
|
24
|
+
export let activeSubgraphs;
|
|
25
|
+
export let settings;
|
|
26
|
+
export let activeOrderStatus;
|
|
27
|
+
export let hideZeroBalanceVaults;
|
|
28
|
+
export let activeNetworkRef;
|
|
29
|
+
export let activeOrderbookRef;
|
|
30
|
+
export let activeAccounts;
|
|
31
|
+
export let walletAddressMatchesOrBlank;
|
|
32
|
+
export let handleDepositGenericModal = void 0;
|
|
33
|
+
export let handleDepositModal = void 0;
|
|
34
|
+
export let handleWithdrawModal = void 0;
|
|
35
|
+
export let currentRoute;
|
|
36
|
+
export let showMyItemsOnly;
|
|
37
|
+
export let signerAddress;
|
|
38
|
+
$: multiSubgraphArgs = Object.entries(
|
|
39
|
+
Object.keys($activeSubgraphs ?? {}).length ? $activeSubgraphs : $settings?.subgraphs ?? {}
|
|
40
|
+
).map(([name, url]) => ({
|
|
41
|
+
name,
|
|
42
|
+
url
|
|
43
|
+
}));
|
|
44
|
+
$: owners = $activeAccountsItems && Object.values($activeAccountsItems).length > 0 ? Object.values($activeAccountsItems) : $showMyItemsOnly && $signerAddress ? [$signerAddress] : [];
|
|
45
|
+
$: query = createInfiniteQuery({
|
|
46
|
+
queryKey: [
|
|
47
|
+
QKEY_VAULTS,
|
|
48
|
+
$activeAccounts,
|
|
49
|
+
$hideZeroBalanceVaults,
|
|
50
|
+
$activeSubgraphs,
|
|
51
|
+
multiSubgraphArgs,
|
|
52
|
+
$settings,
|
|
53
|
+
owners
|
|
54
|
+
],
|
|
55
|
+
queryFn: ({ pageParam }) => {
|
|
56
|
+
return getVaults(
|
|
57
|
+
multiSubgraphArgs,
|
|
58
|
+
{
|
|
59
|
+
owners,
|
|
60
|
+
hideZeroBalance: $hideZeroBalanceVaults
|
|
61
|
+
},
|
|
62
|
+
{ page: pageParam + 1, pageSize: DEFAULT_PAGE_SIZE }
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
initialPageParam: 0,
|
|
66
|
+
getNextPageParam(lastPage, _allPages, lastPageParam) {
|
|
67
|
+
return lastPage.length === DEFAULT_PAGE_SIZE ? lastPageParam + 1 : void 0;
|
|
68
|
+
},
|
|
69
|
+
refetchInterval: DEFAULT_REFRESH_INTERVAL,
|
|
70
|
+
enabled: !!$subgraphUrl
|
|
71
|
+
});
|
|
72
|
+
const updateActiveNetworkAndOrderbook = (subgraphName) => {
|
|
73
|
+
activeNetworkRef.set(subgraphName);
|
|
74
|
+
activeOrderbookRef.set(subgraphName);
|
|
75
|
+
};
|
|
76
|
+
$: isVaultsPage = currentRoute.startsWith("/vaults");
|
|
77
|
+
$: isOrdersPage = currentRoute.startsWith("/orders");
|
|
78
|
+
const AppTable = TanstackAppTable;
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
{#if $query}
|
|
82
|
+
<ListViewOrderbookFilters
|
|
83
|
+
{activeSubgraphs}
|
|
84
|
+
{settings}
|
|
85
|
+
{accounts}
|
|
86
|
+
{activeAccountsItems}
|
|
87
|
+
{showMyItemsOnly}
|
|
88
|
+
{activeOrderStatus}
|
|
89
|
+
{orderHash}
|
|
90
|
+
{hideZeroBalanceVaults}
|
|
91
|
+
{isVaultsPage}
|
|
92
|
+
{isOrdersPage}
|
|
93
|
+
{signerAddress}
|
|
94
|
+
/>
|
|
95
|
+
<AppTable
|
|
96
|
+
{query}
|
|
97
|
+
queryKey={undefined}
|
|
98
|
+
emptyMessage="No Vaults Found"
|
|
99
|
+
on:clickRow={(e) => {
|
|
100
|
+
updateActiveNetworkAndOrderbook(e.detail.item.subgraphName);
|
|
101
|
+
goto(`/vaults/${e.detail.item.subgraphName}-${e.detail.item.vault.id}`);
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
<svelte:fragment slot="title">
|
|
105
|
+
<div class="mt-2 flex w-full justify-between">
|
|
106
|
+
<div class="flex items-center gap-x-6">
|
|
107
|
+
<div class="text-3xl font-medium dark:text-white">Vaults</div>
|
|
108
|
+
{#if handleDepositGenericModal}
|
|
109
|
+
<Button
|
|
110
|
+
disabled={!$activeOrderbook}
|
|
111
|
+
size="sm"
|
|
112
|
+
color="primary"
|
|
113
|
+
data-testid="new-vault-button"
|
|
114
|
+
on:click={() => {
|
|
115
|
+
handleDepositGenericModal();
|
|
116
|
+
}}
|
|
117
|
+
>New vault
|
|
118
|
+
</Button>
|
|
119
|
+
{/if}
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</svelte:fragment>
|
|
123
|
+
<svelte:fragment slot="head">
|
|
124
|
+
<TableHeadCell padding="p-4">Network</TableHeadCell>
|
|
125
|
+
<TableHeadCell padding="px-4 py-4">Vault ID</TableHeadCell>
|
|
126
|
+
<TableHeadCell padding="px-4 py-4">Orderbook</TableHeadCell>
|
|
127
|
+
<TableHeadCell padding="px-4 py-4">Owner</TableHeadCell>
|
|
128
|
+
<TableHeadCell padding="px-2 py-4">Token</TableHeadCell>
|
|
129
|
+
<TableHeadCell padding="px-2 py-4">Balance</TableHeadCell>
|
|
130
|
+
<TableHeadCell padding="px-3 py-4">Input For</TableHeadCell>
|
|
131
|
+
<TableHeadCell padding="px-3 py-4">Output For</TableHeadCell>
|
|
132
|
+
</svelte:fragment>
|
|
133
|
+
|
|
134
|
+
<svelte:fragment slot="bodyRow" let:item>
|
|
135
|
+
<TableBodyCell tdClass="px-4 py-2" data-testid="vault-network">
|
|
136
|
+
{item.subgraphName}
|
|
137
|
+
</TableBodyCell>
|
|
138
|
+
|
|
139
|
+
<TableBodyCell tdClass="break-all px-4 py-4" data-testid="vault-id">
|
|
140
|
+
<Hash type={HashType.Identifier} value={bigintStringToHex(item.vault.vaultId)} />
|
|
141
|
+
</TableBodyCell>
|
|
142
|
+
<TableBodyCell tdClass="break-all px-4 py-2 min-w-48" data-testid="vault-orderbook">
|
|
143
|
+
<Hash type={HashType.Identifier} value={item.vault.orderbook.id} />
|
|
144
|
+
</TableBodyCell>
|
|
145
|
+
<TableBodyCell tdClass="break-all px-4 py-2 min-w-48" data-testid="vault-owner">
|
|
146
|
+
<Hash type={HashType.Wallet} value={item.vault.owner} />
|
|
147
|
+
</TableBodyCell>
|
|
148
|
+
<TableBodyCell tdClass="break-word p-2 min-w-48" data-testid="vault-token"
|
|
149
|
+
>{item.vault.token.name}</TableBodyCell
|
|
150
|
+
>
|
|
151
|
+
<TableBodyCell tdClass="break-all p-2 min-w-48" data-testid="vault-balance">
|
|
152
|
+
{vaultBalanceDisplay(item.vault)}
|
|
153
|
+
{item.vault.token.symbol}
|
|
154
|
+
</TableBodyCell>
|
|
155
|
+
<TableBodyCell tdClass="break-all p-2 min-w-48">
|
|
156
|
+
{#if item.vault.ordersAsInput.length > 0}
|
|
157
|
+
<div data-testid="vault-order-inputs" class="flex flex-wrap items-end justify-start">
|
|
158
|
+
{#each item.vault.ordersAsInput.slice(0, 3) as order}
|
|
159
|
+
<OrderOrVaultHash
|
|
160
|
+
type="orders"
|
|
161
|
+
orderOrVault={order}
|
|
162
|
+
network={item.subgraphName}
|
|
163
|
+
{updateActiveNetworkAndOrderbook}
|
|
164
|
+
/>
|
|
165
|
+
{/each}
|
|
166
|
+
{#if item.vault.ordersAsInput.length > 3}...{/if}
|
|
167
|
+
</div>
|
|
168
|
+
{/if}
|
|
169
|
+
</TableBodyCell>
|
|
170
|
+
<TableBodyCell tdClass="break-all p-2 min-w-48">
|
|
171
|
+
{#if item.vault.ordersAsOutput.length > 0}
|
|
172
|
+
<div data-testid="vault-order-outputs" class="flex flex-wrap items-end justify-start">
|
|
173
|
+
{#each item.vault.ordersAsOutput.slice(0, 3) as order}
|
|
174
|
+
<OrderOrVaultHash
|
|
175
|
+
type="orders"
|
|
176
|
+
orderOrVault={order}
|
|
177
|
+
network={item.subgraphName}
|
|
178
|
+
{updateActiveNetworkAndOrderbook}
|
|
179
|
+
/>
|
|
180
|
+
{/each}
|
|
181
|
+
{#if item.vault.ordersAsOutput.length > 3}...{/if}
|
|
182
|
+
</div>
|
|
183
|
+
{/if}
|
|
184
|
+
</TableBodyCell>
|
|
185
|
+
{#if handleDepositModal && handleWithdrawModal && $walletAddressMatchesOrBlank(item.vault.owner)}
|
|
186
|
+
<TableBodyCell tdClass="px-0 text-right">
|
|
187
|
+
{#if $walletAddressMatchesOrBlank(item.vault.owner)}
|
|
188
|
+
<Button
|
|
189
|
+
color="alternative"
|
|
190
|
+
outline={false}
|
|
191
|
+
data-testid="vault-menu"
|
|
192
|
+
id={`vault-menu-${item.vault.id}`}
|
|
193
|
+
class="mr-2 border-none px-2"
|
|
194
|
+
on:click={(e) => {
|
|
195
|
+
e.stopPropagation();
|
|
196
|
+
}}
|
|
197
|
+
>
|
|
198
|
+
<DotsVerticalOutline class="dark:text-white" />
|
|
199
|
+
</Button>
|
|
200
|
+
{/if}
|
|
201
|
+
</TableBodyCell>
|
|
202
|
+
{#if $walletAddressMatchesOrBlank(item.vault.owner)}
|
|
203
|
+
<Dropdown
|
|
204
|
+
data-testid="dropdown"
|
|
205
|
+
placement="bottom-end"
|
|
206
|
+
triggeredBy={`#vault-menu-${item.vault.id}`}
|
|
207
|
+
>
|
|
208
|
+
<DropdownItem
|
|
209
|
+
data-testid="deposit-button"
|
|
210
|
+
on:click={(e) => {
|
|
211
|
+
e.stopPropagation();
|
|
212
|
+
handleDepositModal(item.vault, $query.refetch);
|
|
213
|
+
}}
|
|
214
|
+
>Deposit
|
|
215
|
+
</DropdownItem>
|
|
216
|
+
<DropdownItem
|
|
217
|
+
data-testid="withdraw-button"
|
|
218
|
+
on:click={(e) => {
|
|
219
|
+
e.stopPropagation();
|
|
220
|
+
handleWithdrawModal(item.vault, $query.refetch);
|
|
221
|
+
}}
|
|
222
|
+
>Withdraw
|
|
223
|
+
</DropdownItem>
|
|
224
|
+
</Dropdown>
|
|
225
|
+
{/if}
|
|
226
|
+
{/if}
|
|
227
|
+
</svelte:fragment>
|
|
228
|
+
</AppTable>
|
|
229
|
+
{/if}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type ConfigSource, type OrderbookConfigSource } from '@rainlanguage/orderbook/js_api';
|
|
3
|
+
import { type SgVault } from '@rainlanguage/orderbook/js_api';
|
|
4
|
+
import { type Writable, type Readable } from 'svelte/store';
|
|
5
|
+
import type { AppStoresInterface } from '../../types/appStores.ts';
|
|
6
|
+
declare class __sveltets_Render<T> {
|
|
7
|
+
props(): {
|
|
8
|
+
activeOrderbook: Readable<OrderbookConfigSource | undefined>;
|
|
9
|
+
subgraphUrl: Readable<string | undefined>;
|
|
10
|
+
accounts: AppStoresInterface["accounts"] | undefined;
|
|
11
|
+
activeAccountsItems: AppStoresInterface["activeAccountsItems"] | undefined;
|
|
12
|
+
orderHash: Writable<string>;
|
|
13
|
+
activeSubgraphs: Writable<Record<string, string>>;
|
|
14
|
+
settings: Writable<ConfigSource | undefined>;
|
|
15
|
+
activeOrderStatus: Writable<boolean | undefined>;
|
|
16
|
+
hideZeroBalanceVaults: Writable<boolean>;
|
|
17
|
+
activeNetworkRef: Writable<string | undefined>;
|
|
18
|
+
activeOrderbookRef: Writable<string | undefined>;
|
|
19
|
+
activeAccounts: Readable<{
|
|
20
|
+
[k: string]: string;
|
|
21
|
+
}>;
|
|
22
|
+
walletAddressMatchesOrBlank: Readable<(otherAddress: string) => boolean>;
|
|
23
|
+
handleDepositGenericModal?: (() => void) | undefined;
|
|
24
|
+
handleDepositModal?: ((vault: SgVault, refetch: () => void) => void) | undefined;
|
|
25
|
+
handleWithdrawModal?: ((vault: SgVault, refetch: () => void) => void) | undefined;
|
|
26
|
+
currentRoute: string;
|
|
27
|
+
showMyItemsOnly: AppStoresInterface["showMyItemsOnly"];
|
|
28
|
+
signerAddress: Writable<string | null> | undefined;
|
|
29
|
+
};
|
|
30
|
+
events(): {} & {
|
|
31
|
+
[evt: string]: CustomEvent<any>;
|
|
32
|
+
};
|
|
33
|
+
slots(): {};
|
|
34
|
+
}
|
|
35
|
+
export type VaultsListTableProps<T> = ReturnType<__sveltets_Render<T>['props']>;
|
|
36
|
+
export type VaultsListTableEvents<T> = ReturnType<__sveltets_Render<T>['events']>;
|
|
37
|
+
export type VaultsListTableSlots<T> = ReturnType<__sveltets_Render<T>['slots']>;
|
|
38
|
+
export default class VaultsListTable<T> extends SvelteComponent<VaultsListTableProps<T>, VaultsListTableEvents<T>, VaultsListTableSlots<T>> {
|
|
39
|
+
}
|
|
40
|
+
export {};
|