@rainlanguage/ui-components 0.0.1-alpha.13 → 0.0.1-alpha.131
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/__fixtures__/settings.yaml +183 -0
- package/dist/__mocks__/MockComponent.svelte +4 -0
- package/dist/__mocks__/MockComponent.svelte.d.ts +3 -1
- package/dist/__mocks__/settings.d.ts +7 -3
- package/dist/__mocks__/settings.js +68 -33
- package/dist/__mocks__/stores.d.ts +94 -27
- package/dist/__mocks__/stores.js +45 -22
- 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 +11 -3
- 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 +16 -15
- 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 +1 -1
- package/dist/components/TanstackAppTable.svelte +2 -3
- package/dist/components/TanstackAppTable.svelte.d.ts +1 -1
- package/dist/components/ToastDetail.svelte +42 -0
- package/dist/components/ToastDetail.svelte.d.ts +20 -0
- package/dist/components/Tooltip.svelte +8 -0
- package/dist/components/Tooltip.svelte.d.ts +21 -0
- package/dist/components/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/ButtonSelectOption.svelte +2 -0
- package/dist/components/deployment/ButtonSelectOption.svelte.d.ts +1 -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 +169 -185
- package/dist/components/deployment/DeploymentSteps.svelte.d.ts +7 -13
- package/dist/components/deployment/DeploymentsSection.svelte +18 -14
- package/dist/components/deployment/DepositInput.svelte +32 -14
- package/dist/components/deployment/DepositInput.svelte.d.ts +1 -2
- package/dist/components/deployment/DisclaimerModal.svelte +1 -0
- package/dist/components/deployment/FieldDefinitionInput.svelte +22 -14
- package/dist/components/deployment/FieldDefinitionInput.svelte.d.ts +1 -2
- package/dist/components/deployment/SelectToken.svelte +16 -4
- package/dist/components/deployment/SelectToken.svelte.d.ts +1 -2
- package/dist/components/deployment/StrategyPage.svelte +6 -2
- package/dist/components/deployment/TokenIOInput.svelte +16 -5
- package/dist/components/deployment/TokenIOInput.svelte.d.ts +1 -2
- package/dist/components/detail/OrderDetail.svelte +60 -44
- package/dist/components/detail/OrderDetail.svelte.d.ts +11 -8
- package/dist/components/detail/TanstackOrderQuote.svelte +17 -7
- package/dist/components/detail/TanstackOrderQuote.svelte.d.ts +1 -1
- package/dist/components/detail/VaultDetail.svelte +43 -43
- package/dist/components/detail/VaultDetail.svelte.d.ts +11 -11
- package/dist/components/dropdown/DropdownActiveSubgraphs.svelte +2 -2
- package/dist/components/dropdown/DropdownActiveSubgraphs.svelte.d.ts +4 -4
- package/dist/components/dropdown/DropdownOrderListAccounts.svelte +2 -1
- 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 +27 -31
- package/dist/components/tables/OrdersListTable.svelte.d.ts +2 -8
- package/dist/components/tables/VaultBalanceChangesTable.svelte +8 -6
- package/dist/components/tables/VaultsListTable.svelte +53 -67
- package/dist/components/tables/VaultsListTable.svelte.d.ts +12 -20
- package/dist/components/transactions/FixedBottomTransaction.svelte +63 -0
- package/dist/components/transactions/FixedBottomTransaction.svelte.d.ts +16 -0
- package/dist/components/transactions/TransactionDetail.svelte +31 -0
- package/dist/components/transactions/TransactionDetail.svelte.d.ts +20 -0
- package/dist/components/transactions/TransactionList.svelte +17 -0
- package/dist/components/transactions/TransactionList.svelte.d.ts +16 -0
- package/dist/components/transactions/getStatusEmoji.d.ts +2 -0
- package/dist/components/transactions/getStatusEmoji.js +20 -0
- package/dist/components/wallet/WalletConnect.svelte +5 -4
- package/dist/components/wallet/WalletConnect.svelte.d.ts +0 -1
- package/dist/consts.d.ts +1 -0
- package/dist/consts.js +1 -0
- package/dist/errors/DeploymentStepsError.d.ts +6 -2
- package/dist/errors/DeploymentStepsError.js +5 -1
- package/dist/hooks/useGui.d.ts +3 -0
- package/dist/hooks/useGui.js +11 -0
- package/dist/index.d.ts +27 -11
- package/dist/index.js +28 -8
- package/dist/models/Transaction.d.ts +80 -0
- package/dist/models/Transaction.js +134 -0
- 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 +18 -0
- package/dist/providers/toasts/context.d.ts +14 -0
- package/dist/providers/toasts/context.js +22 -0
- package/dist/providers/toasts/useToasts.d.ts +16 -0
- package/dist/providers/toasts/useToasts.js +63 -0
- package/dist/providers/transactions/TransactionManager.d.ts +183 -0
- package/dist/providers/transactions/TransactionManager.js +353 -0
- package/dist/providers/transactions/TransactionProvider.svelte +11 -0
- package/dist/providers/transactions/TransactionProvider.svelte.d.ts +24 -0
- package/dist/providers/transactions/context.d.ts +19 -0
- package/dist/providers/transactions/context.js +28 -0
- package/dist/providers/transactions/useTransactions.d.ts +13 -0
- package/dist/providers/transactions/useTransactions.js +18 -0
- package/dist/providers/wallet/WalletProvider.svelte +7 -0
- package/dist/providers/wallet/WalletProvider.svelte.d.ts +21 -0
- package/dist/providers/wallet/context.d.ts +10 -0
- package/dist/providers/wallet/context.js +47 -0
- package/dist/providers/wallet/useAccount.d.ts +8 -0
- package/dist/providers/wallet/useAccount.js +148 -0
- package/dist/queries/queryClient.d.ts +1 -1
- package/dist/queries/queryClient.js +11 -6
- package/dist/services/awaitTransactionIndexing.d.ts +100 -0
- package/dist/services/awaitTransactionIndexing.js +57 -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/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 +10 -9
- package/dist/types/modal.d.ts +24 -12
- package/dist/types/strategy.d.ts +1 -1
- package/dist/types/toast.d.ts +11 -0
- package/dist/types/toast.js +1 -0
- package/dist/types/transaction.d.ts +54 -15
- package/dist/types/transaction.js +29 -1
- package/dist/utils/configHelpers.d.ts +8 -0
- package/dist/utils/configHelpers.js +38 -0
- 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/__fixtures__/settings-12-11-24.json +0 -160
- package/dist/__mocks__/mockTransactionStore.d.ts +0 -22
- package/dist/__mocks__/mockTransactionStore.js +0 -56
- package/dist/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/stores/transactionStore.d.ts +0 -98
- package/dist/stores/transactionStore.js +0 -303
- package/dist/utils/time.d.ts +0 -12
- package/dist/utils/time.js +0 -27
|
@@ -6,6 +6,7 @@ export let disabled = false;
|
|
|
6
6
|
export let styles = {};
|
|
7
7
|
export let rainlangExtension;
|
|
8
8
|
export let codeMirrorTheme;
|
|
9
|
+
export let onTextChange;
|
|
9
10
|
</script>
|
|
10
11
|
|
|
11
12
|
<div data-testid="codemirror-dotrain">
|
|
@@ -22,6 +23,9 @@ export let codeMirrorTheme;
|
|
|
22
23
|
},
|
|
23
24
|
...styles
|
|
24
25
|
}}
|
|
26
|
+
on:change={(e) => {
|
|
27
|
+
onTextChange(e.detail);
|
|
28
|
+
}}
|
|
25
29
|
on:ready={(e) => {
|
|
26
30
|
openLintPanel(e.detail);
|
|
27
31
|
}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import { extendOrder } from "@rainlanguage/orderbook
|
|
1
|
+
<script>import { extendOrder } from "@rainlanguage/orderbook";
|
|
2
2
|
import CodeMirror from "svelte-codemirror-editor";
|
|
3
3
|
import { RainlangLR } from "codemirror-rainlang";
|
|
4
4
|
export let order = void 0;
|
|
@@ -6,12 +6,16 @@ export let rainlangText = void 0;
|
|
|
6
6
|
export let codeMirrorTheme;
|
|
7
7
|
export let codeMirrorDisabled = true;
|
|
8
8
|
export let codeMirrorStyles = {};
|
|
9
|
-
|
|
9
|
+
let result;
|
|
10
|
+
let extendedOrder;
|
|
11
|
+
$: result = order ? extendOrder(order) : void 0;
|
|
12
|
+
$: extendedOrder = result && !result.error ? result.value : void 0;
|
|
13
|
+
$: extendOrderError = result && result.error ? result.error : void 0;
|
|
10
14
|
</script>
|
|
11
15
|
|
|
12
16
|
{#if rainlangText || extendedOrder?.rainlang}
|
|
13
17
|
<CodeMirror
|
|
14
|
-
value={rainlangText || extendedOrder
|
|
18
|
+
value={rainlangText || extendedOrder?.rainlang}
|
|
15
19
|
extensions={[RainlangLR]}
|
|
16
20
|
theme={codeMirrorTheme}
|
|
17
21
|
readonly={codeMirrorDisabled}
|
|
@@ -24,6 +28,10 @@ $: extendedOrder = order ? extendOrder(order) : void 0;
|
|
|
24
28
|
...codeMirrorStyles
|
|
25
29
|
}}
|
|
26
30
|
/>
|
|
31
|
+
{:else if extendOrderError}
|
|
32
|
+
<div class="w-full tracking-tight text-red-600 dark:text-red-400" data-testid="rainlang-error">
|
|
33
|
+
{extendOrderError.readableMsg}
|
|
34
|
+
</div>
|
|
27
35
|
{:else if !extendedOrder?.rainlang && !rainlangText}
|
|
28
36
|
<div
|
|
29
37
|
class="w-full tracking-tight text-gray-900 dark:text-white"
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
import { PenSolid } from "flowbite-svelte-icons";
|
|
2
3
|
export let displayValue;
|
|
3
|
-
let focussed = false;
|
|
4
4
|
let textContent;
|
|
5
5
|
let editableSpan;
|
|
6
6
|
let dispatch = createEventDispatcher();
|
|
7
|
-
const inputFocussed = () => {
|
|
8
|
-
focussed = true;
|
|
9
|
-
dispatch("focus");
|
|
10
|
-
};
|
|
11
7
|
const inputBlurred = () => {
|
|
12
|
-
focussed = false;
|
|
13
8
|
displayValue = textContent;
|
|
14
9
|
dispatch("blur", { value: textContent });
|
|
15
10
|
};
|
|
@@ -20,27 +15,21 @@ const handleKeyDown = (event) => {
|
|
|
20
15
|
};
|
|
21
16
|
</script>
|
|
22
17
|
|
|
23
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
24
18
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
25
19
|
<div
|
|
26
20
|
data-testid="editableSpanWrapper"
|
|
27
|
-
|
|
28
|
-
class="flex gap-x-1 border-b-2 border-dotted text-sm text-gray-400 dark:text-gray-400"
|
|
21
|
+
class="flex items-center gap-x-1 border-b-2 border-dotted text-sm text-gray-400 dark:text-gray-400"
|
|
29
22
|
>
|
|
23
|
+
<PenSolid class="h-3 w-3 cursor-pointer" />
|
|
30
24
|
<span>Block:</span>
|
|
31
25
|
<div class="relative">
|
|
32
26
|
<span
|
|
33
27
|
data-testid="editableSpan"
|
|
34
|
-
class="absolute"
|
|
35
|
-
class:opacity-0={!focussed}
|
|
36
28
|
bind:this={editableSpan}
|
|
37
29
|
bind:textContent
|
|
38
30
|
contenteditable="true"
|
|
39
31
|
on:keydown={handleKeyDown}
|
|
40
32
|
on:blur={inputBlurred}>{displayValue}</span
|
|
41
33
|
>
|
|
42
|
-
<span data-testid="displayElement" class="pointer-events-none" class:opacity-0={focussed}
|
|
43
|
-
>{displayValue}</span
|
|
44
|
-
>
|
|
45
34
|
</div>
|
|
46
35
|
</div>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
})(HashType || {});
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
|
-
<script>import
|
|
10
|
+
<script>import Tooltip from "./Tooltip.svelte";
|
|
11
11
|
import {
|
|
12
12
|
WalletOutline,
|
|
13
13
|
FingerprintOutline,
|
|
@@ -60,7 +60,7 @@ function copy(e) {
|
|
|
60
60
|
{#if showCopiedMessage}
|
|
61
61
|
<div
|
|
62
62
|
out:fade
|
|
63
|
-
class="fixed rounded bg-green-500 px-2 py-1 text-xs text-white
|
|
63
|
+
class="fixed rounded bg-green-500 px-2 py-1 text-xs text-white"
|
|
64
64
|
style="top: {cursorY + 10}px; left: {cursorX + 10}px"
|
|
65
65
|
>
|
|
66
66
|
Copied to clipboard
|
|
@@ -68,7 +68,7 @@ function copy(e) {
|
|
|
68
68
|
{/if}
|
|
69
69
|
|
|
70
70
|
{#if shorten}
|
|
71
|
-
<Tooltip triggeredBy={`#${id}`}
|
|
71
|
+
<Tooltip triggeredBy={`#${id}`}>
|
|
72
72
|
<div class="flex items-center justify-start space-x-2">
|
|
73
73
|
{#if type === HashType.Wallet}
|
|
74
74
|
<WalletOutline size="sm" />
|
|
@@ -2,19 +2,20 @@
|
|
|
2
2
|
import { Heading, Text, BlockQuote } from '@rainlanguage/ui-components';
|
|
3
3
|
import Markdown from 'svelte-markdown';
|
|
4
4
|
import { onMount } from 'svelte';
|
|
5
|
+
import { LICENSE_URL } from '../consts';
|
|
5
6
|
|
|
6
7
|
let source = '';
|
|
7
8
|
|
|
8
9
|
onMount(async () => {
|
|
9
10
|
try {
|
|
10
|
-
const response = await fetch(
|
|
11
|
-
'https://raw.githubusercontent.com/rainlanguage/decentralicense/refs/heads/master/README.md'
|
|
12
|
-
);
|
|
11
|
+
const response = await fetch(LICENSE_URL);
|
|
13
12
|
if (response.ok) {
|
|
14
13
|
source = await response.text();
|
|
14
|
+
} else {
|
|
15
|
+
source = `Failed to fetch license: HTTP ${response.status}`;
|
|
15
16
|
}
|
|
16
17
|
} catch {
|
|
17
|
-
source = '';
|
|
18
|
+
source = 'Failed to fetch license.';
|
|
18
19
|
}
|
|
19
20
|
});
|
|
20
21
|
</script>
|
|
@@ -1,41 +1,40 @@
|
|
|
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
|
|
23
26
|
class="grid w-full items-center gap-4 md:flex md:justify-end lg:min-w-[600px]"
|
|
24
27
|
style="grid-template-columns: repeat(2, minmax(0, 1fr));"
|
|
25
28
|
>
|
|
26
|
-
{#if isEmpty($settings
|
|
29
|
+
{#if isEmpty($settings.orderbook.networks)}
|
|
27
30
|
<Alert color="gray" data-testid="no-networks-alert" class="w-full">
|
|
28
31
|
No networks added to <a class="underline" href="/settings">settings</a>
|
|
29
32
|
</Alert>
|
|
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,7 +5,7 @@ export let pathname;
|
|
|
5
5
|
$: breadcrumbs = generateBreadcrumbs(pathname);
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
|
-
<div class="mb-4 flex w-full items-center justify-between">
|
|
8
|
+
<div class="mb-4 flex w-full items-center justify-between" data-testid="page-header">
|
|
9
9
|
<Breadcrumb
|
|
10
10
|
olClass="inline-flex items-center rtl:space-x-reverse"
|
|
11
11
|
aria-label="Default breadcrumb example"
|
|
@@ -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,42 @@
|
|
|
1
|
+
<script>import { Toast } from "flowbite-svelte";
|
|
2
|
+
import { slide } from "svelte/transition";
|
|
3
|
+
import { CheckCircleSolid, CloseCircleSolid } from "flowbite-svelte-icons";
|
|
4
|
+
import { useToasts } from "../providers/toasts/useToasts";
|
|
5
|
+
export let toast;
|
|
6
|
+
export let i;
|
|
7
|
+
const { removeToast } = useToasts();
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<Toast
|
|
11
|
+
on:close={() => removeToast(i)}
|
|
12
|
+
dismissable={true}
|
|
13
|
+
transition={slide}
|
|
14
|
+
color={toast.color}
|
|
15
|
+
class="mb-2"
|
|
16
|
+
>
|
|
17
|
+
<svelte:fragment slot="icon">
|
|
18
|
+
{#if toast.type === 'success'}
|
|
19
|
+
<CheckCircleSolid class="h-5 w-5" data-testid="success-icon" />
|
|
20
|
+
{:else if toast.type === 'error'}
|
|
21
|
+
<CloseCircleSolid class="h-5 w-5" data-testid="error-icon" />
|
|
22
|
+
{/if}
|
|
23
|
+
</svelte:fragment>
|
|
24
|
+
<p class="font-semibold">{toast.message}</p>
|
|
25
|
+
{#if toast.detail}
|
|
26
|
+
<p>{toast.detail}</p>
|
|
27
|
+
{/if}
|
|
28
|
+
{#if toast.links}
|
|
29
|
+
<div class="flex flex-col">
|
|
30
|
+
{#each toast.links as { link, label }}
|
|
31
|
+
<a
|
|
32
|
+
href={link}
|
|
33
|
+
target="_blank"
|
|
34
|
+
rel="noopener noreferrer"
|
|
35
|
+
class="text-blue-500 hover:underline"
|
|
36
|
+
>
|
|
37
|
+
{label}
|
|
38
|
+
</a>
|
|
39
|
+
{/each}
|
|
40
|
+
</div>
|
|
41
|
+
{/if}
|
|
42
|
+
</Toast>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ToastProps } from '../types/toast';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
toast: ToastProps;
|
|
6
|
+
i: number;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
exports?: {} | undefined;
|
|
13
|
+
bindings?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
export type ToastDetailProps = typeof __propDef.props;
|
|
16
|
+
export type ToastDetailEvents = typeof __propDef.events;
|
|
17
|
+
export type ToastDetailSlots = typeof __propDef.slots;
|
|
18
|
+
export default class ToastDetail extends SvelteComponent<ToastDetailProps, ToastDetailEvents, ToastDetailSlots> {
|
|
19
|
+
}
|
|
20
|
+
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
|
+
}>;
|