@rainlanguage/ui-components 0.0.1-alpha.10 → 0.0.1-alpha.100
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__/orderDetail.d.ts +1 -1
- package/dist/__mocks__/MockComponent.svelte +4 -0
- package/dist/__mocks__/MockComponent.svelte.d.ts +3 -1
- package/dist/__mocks__/mockTransactionStore.d.ts +3 -21
- package/dist/__mocks__/mockTransactionStore.js +26 -13
- package/dist/__mocks__/settings.d.ts +6 -2
- package/dist/__mocks__/settings.js +6 -1
- package/dist/__mocks__/stores.d.ts +87 -20
- package/dist/__mocks__/stores.js +30 -21
- package/dist/components/ButtonLoading.svelte +1 -1
- package/dist/components/ButtonVaultLink.svelte +3 -3
- package/dist/components/ButtonVaultLink.svelte.d.ts +1 -1
- package/dist/components/CheckboxMyItemsOnly.svelte +3 -2
- package/dist/components/CheckboxMyItemsOnly.svelte.d.ts +2 -3
- package/dist/components/CheckboxZeroBalanceVault.svelte.d.ts +2 -2
- package/dist/components/CodeMirrorDotrain.svelte +4 -0
- package/dist/components/CodeMirrorDotrain.svelte.d.ts +1 -0
- package/dist/components/CodeMirrorRainlang.svelte +12 -4
- package/dist/components/CodeMirrorRainlang.svelte.d.ts +1 -1
- 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 +15 -14
- package/dist/components/ListViewOrderbookFilters.svelte.d.ts +9 -13
- package/dist/components/OrderOrVaultHash.svelte +10 -7
- package/dist/components/OrderOrVaultHash.svelte.d.ts +1 -1
- package/dist/components/PageHeader.svelte +20 -22
- package/dist/components/PageHeader.svelte.d.ts +1 -0
- package/dist/components/TanstackAppTable.svelte +2 -3
- package/dist/components/TanstackAppTable.svelte.d.ts +1 -1
- package/dist/components/ToastDetail.svelte +16 -0
- package/dist/components/ToastDetail.svelte.d.ts +19 -0
- package/dist/components/Tooltip.svelte +8 -0
- package/dist/components/Tooltip.svelte.d.ts +21 -0
- package/dist/components/charts/OrderTradesChart.svelte +3 -2
- package/dist/components/charts/TanstackLightweightChartLine.svelte +5 -9
- package/dist/components/charts/VaultBalanceChart.svelte +6 -6
- package/dist/components/charts/VaultBalanceChart.svelte.d.ts +1 -1
- 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/ComposedRainlangModal.svelte +7 -5
- package/dist/components/deployment/ComposedRainlangModal.svelte.d.ts +1 -4
- package/dist/components/deployment/DeploymentSectionHeader.svelte +7 -4
- package/dist/components/deployment/DeploymentSteps.svelte +181 -155
- package/dist/components/deployment/DeploymentSteps.svelte.d.ts +6 -13
- package/dist/components/deployment/DeploymentsSection.svelte +18 -14
- package/dist/components/deployment/DepositInput.svelte +31 -14
- package/dist/components/deployment/DepositInput.svelte.d.ts +1 -2
- package/dist/components/deployment/FieldDefinitionInput.svelte +20 -14
- package/dist/components/deployment/FieldDefinitionInput.svelte.d.ts +1 -2
- package/dist/components/deployment/SelectToken.svelte +12 -3
- package/dist/components/deployment/SelectToken.svelte.d.ts +1 -2
- package/dist/components/deployment/StrategyPage.svelte +6 -2
- package/dist/components/deployment/TokenIOInput.svelte +15 -5
- package/dist/components/deployment/TokenIOInput.svelte.d.ts +1 -2
- package/dist/components/deployment/handleDeployment.d.ts +11 -0
- package/dist/components/deployment/handleDeployment.js +33 -0
- package/dist/components/detail/OrderDetail.svelte +51 -44
- package/dist/components/detail/OrderDetail.svelte.d.ts +11 -8
- package/dist/components/detail/TanstackOrderQuote.svelte +11 -7
- package/dist/components/detail/TanstackOrderQuote.svelte.d.ts +1 -1
- package/dist/components/detail/VaultDetail.svelte +33 -42
- package/dist/components/detail/VaultDetail.svelte.d.ts +11 -11
- package/dist/components/dropdown/DropdownActiveSubgraphs.svelte.d.ts +4 -4
- package/dist/components/dropdown/DropdownOrderListAccounts.svelte.d.ts +3 -3
- 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 +2 -2
- package/dist/components/input/InputRegistryUrl.svelte +36 -14
- package/dist/components/input/InputToken.svelte +2 -2
- package/dist/components/input/InputTokenAmount.svelte +1 -1
- package/dist/components/tables/OrderAPY.svelte +4 -9
- package/dist/components/tables/OrderTradesListTable.svelte +7 -3
- package/dist/components/tables/OrderVaultsVolTable.svelte +11 -2
- package/dist/components/tables/OrdersListTable.svelte +24 -24
- package/dist/components/tables/OrdersListTable.svelte.d.ts +1 -7
- package/dist/components/tables/VaultBalanceChangesTable.svelte +8 -6
- package/dist/components/tables/VaultsListTable.svelte +48 -57
- package/dist/components/tables/VaultsListTable.svelte.d.ts +13 -20
- 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 +5 -2
- package/dist/errors/DeploymentStepsError.js +4 -1
- package/dist/hooks/useGui.d.ts +3 -0
- package/dist/hooks/useGui.js +11 -0
- package/dist/index.d.ts +19 -7
- package/dist/index.js +21 -6
- package/dist/providers/GuiProvider.svelte +8 -0
- package/dist/providers/GuiProvider.svelte.d.ts +21 -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 +22 -0
- package/dist/providers/toasts/context.d.ts +11 -0
- package/dist/providers/toasts/context.js +19 -0
- package/dist/providers/toasts/useToasts.d.ts +12 -0
- package/dist/providers/toasts/useToasts.js +54 -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/queryClient.d.ts +1 -1
- package/dist/queries/queryClient.js +11 -6
- package/dist/services/awaitTransactionIndexing.d.ts +163 -0
- package/dist/services/awaitTransactionIndexing.js +122 -0
- package/dist/services/handleShareChoices.d.ts +2 -2
- package/dist/services/handleShareChoices.js +7 -2
- package/dist/services/historicalOrderCharts.d.ts +1 -1
- package/dist/services/historicalOrderCharts.js +1 -1
- 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 +19 -0
- package/dist/services/registry.d.ts +6 -0
- package/dist/services/registry.js +33 -77
- package/dist/services/time.d.ts +12 -0
- package/dist/services/time.js +88 -6
- package/dist/stores/transactionStore.d.ts +9 -12
- package/dist/stores/transactionStore.js +38 -61
- 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/account.js +1 -0
- package/dist/types/appStores.d.ts +5 -4
- package/dist/types/modal.d.ts +1 -1
- package/dist/types/strategy.d.ts +1 -1
- package/dist/types/toast.d.ts +6 -0
- package/dist/types/toast.js +1 -0
- package/dist/types/transaction.d.ts +3 -3
- package/dist/utils/constructHashLink.d.ts +23 -0
- package/dist/utils/constructHashLink.js +110 -0
- package/dist/utils/vault.d.ts +1 -1
- package/package.json +34 -34
- package/dist/components/deployment/DepositsSection.svelte +0 -8
- package/dist/components/deployment/DepositsSection.svelte.d.ts +0 -20
- package/dist/components/deployment/FieldDefinitionsSection.svelte +0 -9
- package/dist/components/deployment/FieldDefinitionsSection.svelte.d.ts +0 -20
- package/dist/components/deployment/SelectTokensSection.svelte +0 -17
- package/dist/components/deployment/SelectTokensSection.svelte.d.ts +0 -21
- package/dist/components/deployment/TokenIOSection.svelte +0 -17
- package/dist/components/deployment/TokenIOSection.svelte.d.ts +0 -21
- package/dist/components/deployment/getDeploymentTransactionArgs.d.ts +0 -17
- package/dist/components/deployment/getDeploymentTransactionArgs.js +0 -24
- package/dist/components/detail/DepositOrWithdrawButtons.svelte +0 -44
- package/dist/components/detail/DepositOrWithdrawButtons.svelte.d.ts +0 -26
- package/dist/components/dropdown/DropdownOrderStatus.svelte +0 -31
- package/dist/components/dropdown/DropdownOrderStatus.svelte.d.ts +0 -19
- package/dist/utils/time.d.ts +0 -12
- package/dist/utils/time.js +0 -27
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
<script generics="T">import {
|
|
2
|
-
import {
|
|
1
|
+
<script generics="T">import { page } from "$app/stores";
|
|
2
|
+
import { isEmpty } from "lodash";
|
|
3
|
+
import { Alert } from "flowbite-svelte";
|
|
4
|
+
import Tooltip from "./Tooltip.svelte";
|
|
3
5
|
import DropdownActiveSubgraphs from "./dropdown/DropdownActiveSubgraphs.svelte";
|
|
4
|
-
import
|
|
6
|
+
import CheckboxActiveOrders from "./checkbox/CheckboxActiveOrders.svelte";
|
|
5
7
|
import DropdownOrderListAccounts from "./dropdown/DropdownOrderListAccounts.svelte";
|
|
6
8
|
import InputOrderHash from "./input/InputOrderHash.svelte";
|
|
7
9
|
import CheckboxZeroBalanceVault from "./CheckboxZeroBalanceVault.svelte";
|
|
8
10
|
import CheckboxMyItemsOnly from "./CheckboxMyItemsOnly.svelte";
|
|
11
|
+
import { useAccount } from "../providers/wallet/useAccount";
|
|
9
12
|
export let settings;
|
|
10
13
|
export let accounts;
|
|
11
14
|
export let hideZeroBalanceVaults;
|
|
12
15
|
export let activeAccountsItems;
|
|
13
16
|
export let showMyItemsOnly;
|
|
14
17
|
export let activeSubgraphs;
|
|
15
|
-
export let
|
|
18
|
+
export let showInactiveOrders;
|
|
16
19
|
export let orderHash;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
$: isVaultsPage = $page.url.pathname === "/vaults";
|
|
21
|
+
$: isOrdersPage = $page.url.pathname === "/orders";
|
|
22
|
+
const { account } = useAccount();
|
|
20
23
|
</script>
|
|
21
24
|
|
|
22
25
|
<div
|
|
@@ -30,12 +33,8 @@ export let signerAddress;
|
|
|
30
33
|
{:else}
|
|
31
34
|
{#if $accounts && !Object.values($accounts).length}
|
|
32
35
|
<div class="mt-4 w-full lg:w-auto" data-testid="my-items-only">
|
|
33
|
-
<CheckboxMyItemsOnly
|
|
34
|
-
|
|
35
|
-
{showMyItemsOnly}
|
|
36
|
-
{signerAddress}
|
|
37
|
-
/>
|
|
38
|
-
{#if !$signerAddress}
|
|
36
|
+
<CheckboxMyItemsOnly context={isVaultsPage ? 'vaults' : 'orders'} {showMyItemsOnly} />
|
|
37
|
+
{#if !$account}
|
|
39
38
|
<Tooltip>Connect a wallet to filter by {isVaultsPage ? 'vault' : 'order'} owner</Tooltip>
|
|
40
39
|
{/if}
|
|
41
40
|
</div>
|
|
@@ -48,7 +47,9 @@ export let signerAddress;
|
|
|
48
47
|
|
|
49
48
|
{#if isOrdersPage}
|
|
50
49
|
<InputOrderHash {orderHash} />
|
|
51
|
-
<
|
|
50
|
+
<div class="mt-4">
|
|
51
|
+
<CheckboxActiveOrders {showInactiveOrders} />
|
|
52
|
+
</div>
|
|
52
53
|
{/if}
|
|
53
54
|
{#if $accounts && Object.values($accounts).length > 0}
|
|
54
55
|
<DropdownOrderListAccounts {accounts} {activeAccountsItems} />
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import type {
|
|
3
|
-
import type { ConfigSource } from '@rainlanguage/orderbook/js_api';
|
|
2
|
+
import type { AppStoresInterface } from '../types/appStores';
|
|
4
3
|
declare class __sveltets_Render<T> {
|
|
5
4
|
props(): {
|
|
6
|
-
settings:
|
|
7
|
-
accounts:
|
|
8
|
-
hideZeroBalanceVaults:
|
|
9
|
-
activeAccountsItems:
|
|
10
|
-
showMyItemsOnly:
|
|
11
|
-
activeSubgraphs:
|
|
12
|
-
|
|
13
|
-
orderHash:
|
|
14
|
-
isVaultsPage: boolean;
|
|
15
|
-
isOrdersPage: boolean;
|
|
16
|
-
signerAddress: Writable<string | null> | undefined;
|
|
5
|
+
settings: AppStoresInterface["settings"];
|
|
6
|
+
accounts: AppStoresInterface["accounts"];
|
|
7
|
+
hideZeroBalanceVaults: AppStoresInterface["hideZeroBalanceVaults"];
|
|
8
|
+
activeAccountsItems: AppStoresInterface["activeAccountsItems"];
|
|
9
|
+
showMyItemsOnly: AppStoresInterface["showMyItemsOnly"];
|
|
10
|
+
activeSubgraphs: AppStoresInterface["activeSubgraphs"];
|
|
11
|
+
showInactiveOrders: AppStoresInterface["showInactiveOrders"];
|
|
12
|
+
orderHash: AppStoresInterface["orderHash"];
|
|
17
13
|
};
|
|
18
14
|
events(): {} & {
|
|
19
15
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
<script>import { Button } from "flowbite-svelte";
|
|
2
2
|
import Hash, { HashType } from "./Hash.svelte";
|
|
3
|
+
import {
|
|
4
|
+
constructHashLink,
|
|
5
|
+
isOrderOrVaultActive,
|
|
6
|
+
extractHash
|
|
7
|
+
} from "../utils/constructHashLink";
|
|
3
8
|
export let orderOrVault;
|
|
4
9
|
export let type;
|
|
5
10
|
export let network;
|
|
6
11
|
export let updateActiveNetworkAndOrderbook;
|
|
7
|
-
|
|
8
|
-
$:
|
|
9
|
-
$:
|
|
10
|
-
$: hash = isOrder ? orderOrVault.orderHash : orderOrVault?.id || "";
|
|
11
|
-
$: isActive = isOrder ? orderOrVault.active : false;
|
|
12
|
+
$: hash = extractHash(orderOrVault);
|
|
13
|
+
$: isActive = isOrderOrVaultActive(orderOrVault);
|
|
14
|
+
$: linkPath = constructHashLink(orderOrVault, type, network);
|
|
12
15
|
</script>
|
|
13
16
|
|
|
14
|
-
<a href={
|
|
17
|
+
<a data-testid="order-or-vault-hash" href={linkPath}>
|
|
15
18
|
<Button
|
|
16
19
|
class="mr-1 mt-1 px-2 py-1 text-sm"
|
|
17
20
|
color={isActive ? 'green' : 'yellow'}
|
|
18
21
|
data-testid="vault-order-input"
|
|
19
|
-
data-id={
|
|
22
|
+
data-id={hash}
|
|
20
23
|
on:click={() => {
|
|
21
24
|
updateActiveNetworkAndOrderbook(network);
|
|
22
25
|
}}><Hash type={HashType.Identifier} value={hash} copyOnClick={false} /></Button
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import type { SgOrderAsIO, SgOrder, SgVault } from '@rainlanguage/orderbook
|
|
2
|
+
import type { SgOrderAsIO, SgOrder, SgVault } from '@rainlanguage/orderbook';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
orderOrVault: SgOrder | SgVault | SgOrderAsIO;
|
|
@@ -5,29 +5,27 @@ export let pathname;
|
|
|
5
5
|
$: breadcrumbs = generateBreadcrumbs(pathname);
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
|
-
<div class="mb-4 flex w-full items-center">
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
>
|
|
14
|
-
|
|
15
|
-
{#each breadcrumbs as crumb}
|
|
16
|
-
<BreadcrumbItem
|
|
17
|
-
href={crumb.href}
|
|
18
|
-
linkClass="mx-2 text-sm font-medium text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white first-letter:uppercase"
|
|
19
|
-
>{crumb.label}</BreadcrumbItem
|
|
20
|
-
>
|
|
21
|
-
{/each}
|
|
8
|
+
<div class="mb-4 flex w-full items-center justify-between" data-testid="page-header">
|
|
9
|
+
<Breadcrumb
|
|
10
|
+
olClass="inline-flex items-center rtl:space-x-reverse"
|
|
11
|
+
aria-label="Default breadcrumb example"
|
|
12
|
+
>
|
|
13
|
+
<BreadcrumbItem href="/" home></BreadcrumbItem>
|
|
14
|
+
{#each breadcrumbs as crumb}
|
|
22
15
|
<BreadcrumbItem
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
href={crumb.href}
|
|
17
|
+
linkClass="mx-2 text-sm font-medium text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white first-letter:uppercase"
|
|
18
|
+
>{crumb.label}</BreadcrumbItem
|
|
25
19
|
>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
{/each}
|
|
21
|
+
<BreadcrumbItem
|
|
22
|
+
spanClass="mx-2 text-sm font-medium text-gray-700 dark:text-gray-300 first-letter:uppercase"
|
|
23
|
+
><span data-testid="breadcrumb-page-title">{title}</span></BreadcrumbItem
|
|
24
|
+
>
|
|
25
|
+
</Breadcrumb>
|
|
26
|
+
|
|
27
|
+
<div class="flex flex-col items-end gap-2 lg:flex-row lg:items-center">
|
|
28
|
+
<slot name="warning" />
|
|
29
|
+
<slot name="actions" />
|
|
32
30
|
</div>
|
|
33
31
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script generics="T">import {
|
|
1
|
+
<script generics="T">import { invalidateTanstackQueries } from "../queries/queryClient";
|
|
2
2
|
import Refresh from "./icon/Refresh.svelte";
|
|
3
3
|
import { Button, Table, TableBody, TableBodyRow, TableHead } from "flowbite-svelte";
|
|
4
4
|
import { createEventDispatcher } from "svelte";
|
|
@@ -21,9 +21,8 @@ export let rowHoverable = true;
|
|
|
21
21
|
spin={$query.isLoading || $query.isFetching}
|
|
22
22
|
on:click={async () => {
|
|
23
23
|
if (queryKey) {
|
|
24
|
-
|
|
24
|
+
invalidateTanstackQueries(queryClient, [queryKey]);
|
|
25
25
|
}
|
|
26
|
-
$query.refetch();
|
|
27
26
|
}}
|
|
28
27
|
/>
|
|
29
28
|
</div>
|
|
@@ -2,7 +2,7 @@ import { SvelteComponent } from "svelte";
|
|
|
2
2
|
import type { CreateInfiniteQueryResult, InfiniteData } from '@tanstack/svelte-query';
|
|
3
3
|
declare class __sveltets_Render<T> {
|
|
4
4
|
props(): {
|
|
5
|
-
queryKey: string
|
|
5
|
+
queryKey: string;
|
|
6
6
|
query: CreateInfiniteQueryResult<InfiniteData<T[], unknown>, Error>;
|
|
7
7
|
emptyMessage?: string;
|
|
8
8
|
rowHoverable?: boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script>import { Toast } from "flowbite-svelte";
|
|
2
|
+
import { slide } from "svelte/transition";
|
|
3
|
+
import { CheckCircleSolid, CloseCircleSolid } from "flowbite-svelte-icons";
|
|
4
|
+
export let toast;
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<Toast dismissable={true} transition={slide} color={toast.color} class="mb-2">
|
|
8
|
+
<svelte:fragment slot="icon">
|
|
9
|
+
{#if toast.type === 'success'}
|
|
10
|
+
<CheckCircleSolid class="h-5 w-5" />
|
|
11
|
+
{:else if toast.type === 'error'}
|
|
12
|
+
<CloseCircleSolid class="h-5 w-5" />
|
|
13
|
+
{/if}
|
|
14
|
+
</svelte:fragment>
|
|
15
|
+
{toast.message}
|
|
16
|
+
</Toast>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ToastProps } from '../types/toast';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
toast: ToastProps;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
exports?: {} | undefined;
|
|
12
|
+
bindings?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type ToastDetailProps = typeof __propDef.props;
|
|
15
|
+
export type ToastDetailEvents = typeof __propDef.events;
|
|
16
|
+
export type ToastDetailSlots = typeof __propDef.slots;
|
|
17
|
+
export default class ToastDetail extends SvelteComponent<ToastDetailProps, ToastDetailEvents, ToastDetailSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
triggeredBy?: string;
|
|
5
|
+
customClass?: string;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {
|
|
11
|
+
default: {};
|
|
12
|
+
};
|
|
13
|
+
exports?: {} | undefined;
|
|
14
|
+
bindings?: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
export type TooltipProps = typeof __propDef.props;
|
|
17
|
+
export type TooltipEvents = typeof __propDef.events;
|
|
18
|
+
export type TooltipSlots = typeof __propDef.slots;
|
|
19
|
+
export default class Tooltip extends SvelteComponent<TooltipProps, TooltipEvents, TooltipSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import { getOrderTradesList } from "@rainlanguage/orderbook
|
|
1
|
+
<script>import { getOrderTradesList } from "@rainlanguage/orderbook";
|
|
2
2
|
import { prepareHistoricalOrderChartData } from "../../services/historicalOrderCharts";
|
|
3
3
|
import TanstackLightweightChartLine from "./TanstackLightweightChartLine.svelte";
|
|
4
4
|
import { createQuery } from "@tanstack/svelte-query";
|
|
@@ -20,7 +20,8 @@ $: query = createQuery({
|
|
|
20
20
|
BigInt(1e3),
|
|
21
21
|
void 0
|
|
22
22
|
);
|
|
23
|
-
|
|
23
|
+
if (data.error) throw new Error(data.error.msg);
|
|
24
|
+
return prepareHistoricalOrderChartData(data.value, $colorTheme);
|
|
24
25
|
},
|
|
25
26
|
enabled: !!subgraphUrl
|
|
26
27
|
});
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
<script generics="T">import LightweightChart from "./LightweightChart.svelte";
|
|
2
|
-
import {
|
|
2
|
+
import { transformAndSortData } from "./transformAndSortData";
|
|
3
3
|
export let query;
|
|
4
4
|
export let timeTransform;
|
|
5
5
|
export let valueTransform;
|
|
6
6
|
export let lightweightChartsTheme;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}));
|
|
12
|
-
return sortBy(transformedData, (d) => d.time);
|
|
13
|
-
};
|
|
14
|
-
$: data = transformAndSortData($query.data ?? []);
|
|
7
|
+
$: data = transformAndSortData($query.data ?? [], {
|
|
8
|
+
valueTransform,
|
|
9
|
+
timeTransform
|
|
10
|
+
});
|
|
15
11
|
const createSeries = (chart) => chart.addLineSeries({ lineWidth: 1 });
|
|
16
12
|
</script>
|
|
17
13
|
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
<script>import { timestampSecondsToUTCTimestamp } from "../../
|
|
1
|
+
<script>import { timestampSecondsToUTCTimestamp } from "../../services/time";
|
|
2
2
|
import { bigintToFloat } from "../../utils/number";
|
|
3
3
|
import { createQuery } from "@tanstack/svelte-query";
|
|
4
|
-
import {
|
|
5
|
-
getVaultBalanceChanges
|
|
6
|
-
} from "@rainlanguage/orderbook/js_api";
|
|
4
|
+
import { getVaultBalanceChanges } from "@rainlanguage/orderbook";
|
|
7
5
|
import TanstackLightweightChartLine from "../charts/TanstackLightweightChartLine.svelte";
|
|
8
6
|
import { QKEY_VAULT_CHANGES } from "../../queries/keys";
|
|
9
7
|
export let vault;
|
|
@@ -12,11 +10,13 @@ export let subgraphUrl;
|
|
|
12
10
|
export let lightweightChartsTheme;
|
|
13
11
|
$: query = createQuery({
|
|
14
12
|
queryKey: [id, QKEY_VAULT_CHANGES + id, QKEY_VAULT_CHANGES],
|
|
15
|
-
queryFn: () => {
|
|
16
|
-
|
|
13
|
+
queryFn: async () => {
|
|
14
|
+
const result = await getVaultBalanceChanges(subgraphUrl || "", vault.id, {
|
|
17
15
|
page: 1,
|
|
18
16
|
pageSize: 1e3
|
|
19
17
|
});
|
|
18
|
+
if (result.error) throw new Error(result.error.msg);
|
|
19
|
+
return result.value;
|
|
20
20
|
},
|
|
21
21
|
enabled: !!subgraphUrl
|
|
22
22
|
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { UTCTimestamp } from 'lightweight-charts';
|
|
2
|
+
/**
|
|
3
|
+
* Filters out data points with duplicate timestamps, keeping only the first occurrence.
|
|
4
|
+
*
|
|
5
|
+
* @param data Array of data points with time and value properties
|
|
6
|
+
* @returns A new array with only unique timestamps
|
|
7
|
+
*/
|
|
8
|
+
export declare const deduplicateByTime: <T extends {
|
|
9
|
+
time: UTCTimestamp;
|
|
10
|
+
}>(data: T[]) => T[];
|
|
11
|
+
/**
|
|
12
|
+
* Transforms and sorts data, ensuring unique timestamps.
|
|
13
|
+
*
|
|
14
|
+
* @param data The source data to transform
|
|
15
|
+
* @param options Configuration object with transform functions
|
|
16
|
+
* @returns Transformed, sorted, and deduplicated data
|
|
17
|
+
*/
|
|
18
|
+
export declare const transformAndSortData: <T>(data: T[], options: {
|
|
19
|
+
valueTransform: (item: T) => number;
|
|
20
|
+
timeTransform: (item: T) => UTCTimestamp;
|
|
21
|
+
}) => Array<{
|
|
22
|
+
value: number;
|
|
23
|
+
time: UTCTimestamp;
|
|
24
|
+
}>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { sortBy } from 'lodash';
|
|
2
|
+
/**
|
|
3
|
+
* Filters out data points with duplicate timestamps, keeping only the first occurrence.
|
|
4
|
+
*
|
|
5
|
+
* @param data Array of data points with time and value properties
|
|
6
|
+
* @returns A new array with only unique timestamps
|
|
7
|
+
*/
|
|
8
|
+
export const deduplicateByTime = (data) => {
|
|
9
|
+
const uniqueData = [];
|
|
10
|
+
const seenTimes = new Set();
|
|
11
|
+
for (const dataPoint of data) {
|
|
12
|
+
if (!seenTimes.has(dataPoint.time)) {
|
|
13
|
+
uniqueData.push(dataPoint);
|
|
14
|
+
seenTimes.add(dataPoint.time);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return uniqueData;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Transforms and sorts data, ensuring unique timestamps.
|
|
21
|
+
*
|
|
22
|
+
* @param data The source data to transform
|
|
23
|
+
* @param options Configuration object with transform functions
|
|
24
|
+
* @returns Transformed, sorted, and deduplicated data
|
|
25
|
+
*/
|
|
26
|
+
export const transformAndSortData = (data, options) => {
|
|
27
|
+
const { valueTransform, timeTransform } = options;
|
|
28
|
+
const transformedData = data.map((d) => ({
|
|
29
|
+
value: valueTransform(d),
|
|
30
|
+
time: timeTransform(d)
|
|
31
|
+
}));
|
|
32
|
+
const sortedData = sortBy(transformedData, (d) => d.time);
|
|
33
|
+
return deduplicateByTime(sortedData);
|
|
34
|
+
};
|
|
35
|
+
if (import.meta.vitest) {
|
|
36
|
+
const { it, expect, describe } = import.meta.vitest;
|
|
37
|
+
describe('deduplicateByTime', () => {
|
|
38
|
+
it('should remove entries with duplicate timestamps', () => {
|
|
39
|
+
const data = [
|
|
40
|
+
{ time: 100, value: 10 },
|
|
41
|
+
{ time: 200, value: 20 },
|
|
42
|
+
{ time: 200, value: 25 }, // Duplicate timestamp
|
|
43
|
+
{ time: 300, value: 30 }
|
|
44
|
+
];
|
|
45
|
+
const result = deduplicateByTime(data);
|
|
46
|
+
const expected = [
|
|
47
|
+
{ time: 100, value: 10 },
|
|
48
|
+
{ time: 200, value: 20 }, // First occurrence kept
|
|
49
|
+
{ time: 300, value: 30 }
|
|
50
|
+
];
|
|
51
|
+
expect(result).toEqual(expected);
|
|
52
|
+
});
|
|
53
|
+
it('should handle multiple duplicate timestamps', () => {
|
|
54
|
+
const data = [
|
|
55
|
+
{ time: 100, value: 10 },
|
|
56
|
+
{ time: 100, value: 15 }, // Duplicate
|
|
57
|
+
{ time: 100, value: 18 }, // Duplicate
|
|
58
|
+
{ time: 200, value: 20 }
|
|
59
|
+
];
|
|
60
|
+
const result = deduplicateByTime(data);
|
|
61
|
+
const expected = [
|
|
62
|
+
{ time: 100, value: 10 }, // Only first one kept
|
|
63
|
+
{ time: 200, value: 20 }
|
|
64
|
+
];
|
|
65
|
+
expect(result).toEqual(expected);
|
|
66
|
+
});
|
|
67
|
+
it('should return original array if no duplicates', () => {
|
|
68
|
+
const data = [
|
|
69
|
+
{ time: 100, value: 10 },
|
|
70
|
+
{ time: 200, value: 20 },
|
|
71
|
+
{ time: 300, value: 30 }
|
|
72
|
+
];
|
|
73
|
+
const result = deduplicateByTime(data);
|
|
74
|
+
expect(result).toEqual(data);
|
|
75
|
+
expect(result).not.toBe(data);
|
|
76
|
+
});
|
|
77
|
+
it('should handle empty array', () => {
|
|
78
|
+
const data = [];
|
|
79
|
+
const result = deduplicateByTime(data);
|
|
80
|
+
expect(result).toEqual([]);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
describe('transformAndSortData', () => {
|
|
84
|
+
it('should transform, sort, and deduplicate data', () => {
|
|
85
|
+
const rawData = [
|
|
86
|
+
{ timestamp: 3000, price: 300 },
|
|
87
|
+
{ timestamp: 1000, price: 100 },
|
|
88
|
+
{ timestamp: 2000, price: 200 },
|
|
89
|
+
{ timestamp: 2000, price: 250 } // Duplicate timestamp
|
|
90
|
+
];
|
|
91
|
+
const result = transformAndSortData(rawData, {
|
|
92
|
+
valueTransform: (item) => item.price,
|
|
93
|
+
timeTransform: (item) => item.timestamp
|
|
94
|
+
});
|
|
95
|
+
const expected = [
|
|
96
|
+
{ time: 1000, value: 100 },
|
|
97
|
+
{ time: 2000, value: 200 }, // First occurrence kept after sorting
|
|
98
|
+
{ time: 3000, value: 300 }
|
|
99
|
+
];
|
|
100
|
+
expect(result).toEqual(expected);
|
|
101
|
+
});
|
|
102
|
+
it('should handle empty data array', () => {
|
|
103
|
+
const rawData = [];
|
|
104
|
+
const result = transformAndSortData(rawData, {
|
|
105
|
+
valueTransform: (item) => item.price,
|
|
106
|
+
timeTransform: (item) => item.timestamp
|
|
107
|
+
});
|
|
108
|
+
expect(result).toEqual([]);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<script>import { Checkbox } from "flowbite-svelte";
|
|
2
|
+
export let showInactiveOrders;
|
|
3
|
+
let checked = $showInactiveOrders ? true : false;
|
|
4
|
+
function handleChange() {
|
|
5
|
+
$showInactiveOrders = !$showInactiveOrders;
|
|
6
|
+
}
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<div data-testid="order-status-checkbox">
|
|
10
|
+
<Checkbox {checked} on:change={handleChange}>Include inactive orders</Checkbox>
|
|
11
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { AppStoresInterface } from '../../types/appStores';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
showInactiveOrders: AppStoresInterface["showInactiveOrders"];
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
exports?: {} | undefined;
|
|
12
|
+
bindings?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type CheckboxActiveOrdersProps = typeof __propDef.props;
|
|
15
|
+
export type CheckboxActiveOrdersEvents = typeof __propDef.events;
|
|
16
|
+
export type CheckboxActiveOrdersSlots = typeof __propDef.slots;
|
|
17
|
+
export default class CheckboxActiveOrders extends SvelteComponent<CheckboxActiveOrdersProps, CheckboxActiveOrdersEvents, CheckboxActiveOrdersSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
import { RainlangLR } from "codemirror-rainlang";
|
|
3
3
|
import { lightCodeMirrorTheme } from "../../utils/codeMirrorThemes";
|
|
4
4
|
import { Button, Modal } from "flowbite-svelte";
|
|
5
|
-
|
|
5
|
+
import { useGui } from "../../hooks/useGui";
|
|
6
|
+
const gui = useGui();
|
|
6
7
|
let rainlangText = null;
|
|
7
8
|
let open = false;
|
|
8
9
|
async function generateRainlang() {
|
|
9
|
-
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
open = true;
|
|
10
|
+
let result = await gui.getComposedRainlang();
|
|
11
|
+
if (result.error) {
|
|
12
|
+
throw new Error(result.error.msg);
|
|
13
13
|
}
|
|
14
|
+
rainlangText = result.value;
|
|
15
|
+
open = true;
|
|
14
16
|
}
|
|
15
17
|
</script>
|
|
16
18
|
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import type { DotrainOrderGui } from '@rainlanguage/orderbook/js_api';
|
|
3
2
|
declare const __propDef: {
|
|
4
|
-
props:
|
|
5
|
-
gui: DotrainOrderGui;
|
|
6
|
-
};
|
|
3
|
+
props: Record<string, never>;
|
|
7
4
|
events: {
|
|
8
5
|
[evt: string]: CustomEvent<any>;
|
|
9
6
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script>import Markdown from "svelte-markdown";
|
|
2
|
+
export let title;
|
|
2
3
|
export let description = "";
|
|
3
4
|
</script>
|
|
4
5
|
|
|
@@ -7,8 +8,10 @@ export let description = "";
|
|
|
7
8
|
{title}
|
|
8
9
|
</h1>
|
|
9
10
|
{#if description}
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
<div
|
|
12
|
+
class="prose prose-sm lg:prose-base prose-neutral dark:prose-invert text-gray-600 dark:text-gray-400"
|
|
13
|
+
>
|
|
14
|
+
<Markdown source={description} />
|
|
15
|
+
</div>
|
|
13
16
|
{/if}
|
|
14
17
|
</div>
|