@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
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import { type
|
|
3
|
-
import { DotrainOrderGui, type NameAndDescriptionCfg } from '@rainlanguage/orderbook/js_api';
|
|
4
|
-
import { type Config } from '@wagmi/core';
|
|
2
|
+
import { type NameAndDescriptionCfg, type NewConfig, DotrainOrderGui } from '@rainlanguage/orderbook';
|
|
5
3
|
import { type Writable } from 'svelte/store';
|
|
6
4
|
import type { AppKit } from '@reown/appkit';
|
|
7
|
-
import type {
|
|
5
|
+
import type { Account } from '../../types/account';
|
|
8
6
|
declare const __propDef: {
|
|
9
7
|
props: {
|
|
10
|
-
|
|
11
|
-
dotrain: string;
|
|
12
|
-
deployment: {
|
|
8
|
+
/** The deployment configuration containing key, name and description */ deployment: {
|
|
13
9
|
key: string;
|
|
14
10
|
name: string;
|
|
15
11
|
description: string;
|
|
16
12
|
};
|
|
17
|
-
strategyDetail: NameAndDescriptionCfg;
|
|
18
|
-
gui: DotrainOrderGui;
|
|
19
|
-
handleDeployModal: (args: DeployModalProps) => void;
|
|
20
|
-
handleDisclaimerModal: (args: DisclaimerModalProps) => void;
|
|
21
|
-
wagmiConfig: Writable<Config | undefined>;
|
|
13
|
+
/** Strategy details containing name and description configuration */ strategyDetail: NameAndDescriptionCfg;
|
|
14
|
+
/** Handlers for deployment modals */ onDeploy: (gui: DotrainOrderGui, subgraphUrl?: string) => void;
|
|
22
15
|
wagmiConnected: Writable<boolean>;
|
|
23
16
|
appKitModal: Writable<AppKit>;
|
|
24
|
-
|
|
17
|
+
settings: Writable<NewConfig>;
|
|
18
|
+
account: Account;
|
|
25
19
|
};
|
|
26
20
|
events: {
|
|
27
21
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
<script>import { DotrainOrderGui } from "@rainlanguage/orderbook
|
|
1
|
+
<script>import { DotrainOrderGui } from "@rainlanguage/orderbook";
|
|
2
2
|
import DeploymentTile from "./DeploymentTile.svelte";
|
|
3
3
|
export let dotrain;
|
|
4
4
|
export let strategyName;
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
|
-
{#await DotrainOrderGui.getDeploymentDetails(dotrain) then
|
|
8
|
-
|
|
9
|
-
class="
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
{#await DotrainOrderGui.getDeploymentDetails(dotrain) then result}
|
|
8
|
+
{#if result.error}
|
|
9
|
+
<p class="text-red-500">Error loading deployments:</p>
|
|
10
|
+
<p class="text-gray-500">
|
|
11
|
+
{result.error.msg}
|
|
12
|
+
</p>
|
|
13
|
+
{/if}
|
|
14
|
+
|
|
15
|
+
{#if result.value}
|
|
16
|
+
<div
|
|
17
|
+
class="mr-auto grid w-full grid-cols-1 justify-items-start gap-4 md:grid-cols-2 lg:w-auto lg:grid-cols-3"
|
|
18
|
+
>
|
|
19
|
+
{#each result.value as [key, { name, description }]}
|
|
20
|
+
<DeploymentTile {name} {description} {key} {strategyName} />
|
|
21
|
+
{/each}
|
|
22
|
+
</div>
|
|
23
|
+
{/if}
|
|
20
24
|
{/await}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
DotrainOrderGui
|
|
3
|
-
} from "@rainlanguage/orderbook/js_api";
|
|
1
|
+
<script>import {} from "@rainlanguage/orderbook";
|
|
4
2
|
import { Input } from "flowbite-svelte";
|
|
5
3
|
import ButtonSelectOption from "./ButtonSelectOption.svelte";
|
|
6
4
|
import DeploymentSectionHeader from "./DeploymentSectionHeader.svelte";
|
|
7
5
|
import { CloseCircleSolid } from "flowbite-svelte-icons";
|
|
8
6
|
import { onMount } from "svelte";
|
|
7
|
+
import { useGui } from "../../hooks/useGui";
|
|
9
8
|
export let deposit;
|
|
10
|
-
|
|
9
|
+
const gui = useGui();
|
|
11
10
|
let error = "";
|
|
12
11
|
let currentDeposit;
|
|
13
12
|
let inputValue = "";
|
|
@@ -15,18 +14,30 @@ let tokenInfo = null;
|
|
|
15
14
|
onMount(() => {
|
|
16
15
|
setCurrentDeposit();
|
|
17
16
|
});
|
|
18
|
-
const
|
|
17
|
+
const getCurrentDeposit = () => {
|
|
18
|
+
const deposits = gui.getDeposits();
|
|
19
|
+
if (deposits.error) {
|
|
20
|
+
throw new Error(deposits.error.msg);
|
|
21
|
+
}
|
|
22
|
+
return deposits.value.find((d) => d.token === deposit.token?.key);
|
|
23
|
+
};
|
|
24
|
+
const setCurrentDeposit = () => {
|
|
19
25
|
try {
|
|
20
|
-
currentDeposit =
|
|
26
|
+
currentDeposit = getCurrentDeposit();
|
|
21
27
|
inputValue = currentDeposit?.amount || "";
|
|
22
|
-
} catch {
|
|
28
|
+
} catch (e) {
|
|
23
29
|
currentDeposit = void 0;
|
|
30
|
+
error = e.message ? e.message : "Error setting current deposit.";
|
|
24
31
|
}
|
|
25
32
|
};
|
|
26
33
|
const getTokenSymbol = async () => {
|
|
27
34
|
if (!deposit.token?.key) return;
|
|
28
35
|
try {
|
|
29
|
-
|
|
36
|
+
let result = await gui.getTokenInfo(deposit.token?.key);
|
|
37
|
+
if (result.error) {
|
|
38
|
+
throw new Error(result.error.msg);
|
|
39
|
+
}
|
|
40
|
+
tokenInfo = result.value;
|
|
30
41
|
} catch (e) {
|
|
31
42
|
const errorMessage = e.message ? e.message : "Error getting token info.";
|
|
32
43
|
error = errorMessage;
|
|
@@ -35,18 +46,24 @@ const getTokenSymbol = async () => {
|
|
|
35
46
|
function handlePresetClick(preset) {
|
|
36
47
|
if (deposit.token?.key) {
|
|
37
48
|
inputValue = preset;
|
|
38
|
-
gui
|
|
39
|
-
|
|
40
|
-
|
|
49
|
+
gui.saveDeposit(deposit.token?.key, preset);
|
|
50
|
+
try {
|
|
51
|
+
currentDeposit = getCurrentDeposit();
|
|
52
|
+
} catch (e) {
|
|
53
|
+
error = e.message ? e.message : "Error handling preset click.";
|
|
54
|
+
}
|
|
41
55
|
}
|
|
42
56
|
}
|
|
43
57
|
function handleInput(e) {
|
|
44
58
|
if (deposit.token?.key) {
|
|
45
59
|
if (e.currentTarget instanceof HTMLInputElement) {
|
|
46
60
|
inputValue = e.currentTarget.value;
|
|
47
|
-
gui
|
|
48
|
-
|
|
49
|
-
|
|
61
|
+
gui.saveDeposit(deposit.token.key, e.currentTarget.value);
|
|
62
|
+
try {
|
|
63
|
+
currentDeposit = getCurrentDeposit();
|
|
64
|
+
} catch (e2) {
|
|
65
|
+
error = e2.message ? e2.message : "Error handling input.";
|
|
66
|
+
}
|
|
50
67
|
}
|
|
51
68
|
}
|
|
52
69
|
}
|
|
@@ -68,6 +85,7 @@ $: if (deposit.token?.key) {
|
|
|
68
85
|
<div class="flex w-full flex-wrap gap-4">
|
|
69
86
|
{#each deposit.presets as preset}
|
|
70
87
|
<ButtonSelectOption
|
|
88
|
+
dataTestId={`deposit-preset-${preset}`}
|
|
71
89
|
active={currentDeposit?.amount === preset}
|
|
72
90
|
buttonText={preset}
|
|
73
91
|
clickHandler={() => handlePresetClick(preset)}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import {
|
|
2
|
+
import { type GuiDepositCfg } from '@rainlanguage/orderbook';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
deposit: GuiDepositCfg;
|
|
6
|
-
gui: DotrainOrderGui;
|
|
7
6
|
};
|
|
8
7
|
events: {
|
|
9
8
|
[evt: string]: CustomEvent<any>;
|
|
@@ -13,6 +13,7 @@ async function handleAcceptDisclaimer() {
|
|
|
13
13
|
bind:open
|
|
14
14
|
class="max-h-full dark:border dark:border-gray-700 dark:bg-gray-900"
|
|
15
15
|
dialogClass="fixed top-0 start-0 end-1 h-modal md:inset-0 md:h-full z-50 w-full p-4 flex justify-center items-center h-full"
|
|
16
|
+
data-testid="deployment-disclaimer-modal"
|
|
16
17
|
>
|
|
17
18
|
<div class="flex flex-col items-start gap-y-8 p-4">
|
|
18
19
|
<div class="space-y-4">
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
<script>import { Input } from "flowbite-svelte";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "@rainlanguage/orderbook/js_api";
|
|
3
|
+
} from "@rainlanguage/orderbook";
|
|
5
4
|
import ButtonSelectOption from "./ButtonSelectOption.svelte";
|
|
6
5
|
import DeploymentSectionHeader from "./DeploymentSectionHeader.svelte";
|
|
7
6
|
import { onMount } from "svelte";
|
|
7
|
+
import { useGui } from "../../hooks/useGui";
|
|
8
8
|
export let fieldDefinition;
|
|
9
|
-
|
|
9
|
+
const gui = useGui();
|
|
10
10
|
let currentValue;
|
|
11
11
|
let inputValue = currentValue?.value ? currentValue?.value : fieldDefinition.default || null;
|
|
12
12
|
onMount(() => {
|
|
13
13
|
try {
|
|
14
|
-
|
|
14
|
+
const result = gui.getFieldValue(fieldDefinition.binding);
|
|
15
|
+
if (result.error) {
|
|
16
|
+
throw new Error(result.error.msg);
|
|
17
|
+
}
|
|
18
|
+
currentValue = result.value;
|
|
15
19
|
inputValue = currentValue?.value ? currentValue?.value : fieldDefinition.default || null;
|
|
16
20
|
} catch {
|
|
17
21
|
currentValue = void 0;
|
|
@@ -19,19 +23,21 @@ onMount(() => {
|
|
|
19
23
|
});
|
|
20
24
|
async function handlePresetClick(preset) {
|
|
21
25
|
inputValue = preset.value;
|
|
22
|
-
gui
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
gui.saveFieldValue(fieldDefinition.binding, inputValue);
|
|
27
|
+
const result = gui.getFieldValue(fieldDefinition.binding);
|
|
28
|
+
if (result.error) {
|
|
29
|
+
throw new Error(result.error.msg);
|
|
30
|
+
}
|
|
31
|
+
currentValue = result.value;
|
|
27
32
|
}
|
|
28
33
|
async function handleCustomInputChange(value) {
|
|
29
34
|
inputValue = value;
|
|
30
|
-
gui
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
gui.saveFieldValue(fieldDefinition.binding, inputValue);
|
|
36
|
+
const result = gui.getFieldValue(fieldDefinition.binding);
|
|
37
|
+
if (result.error) {
|
|
38
|
+
throw new Error(result.error.msg);
|
|
39
|
+
}
|
|
40
|
+
currentValue = result.value;
|
|
35
41
|
}
|
|
36
42
|
</script>
|
|
37
43
|
|
|
@@ -42,6 +48,7 @@ async function handleCustomInputChange(value) {
|
|
|
42
48
|
<div class="flex w-full flex-wrap gap-4">
|
|
43
49
|
{#each fieldDefinition.presets as preset}
|
|
44
50
|
<ButtonSelectOption
|
|
51
|
+
dataTestId={`binding-${fieldDefinition.binding}-preset-${preset.name || preset.value}`}
|
|
45
52
|
buttonText={preset.name || preset.value}
|
|
46
53
|
clickHandler={() => handlePresetClick(preset)}
|
|
47
54
|
active={currentValue?.value === preset.value}
|
|
@@ -52,6 +59,7 @@ async function handleCustomInputChange(value) {
|
|
|
52
59
|
|
|
53
60
|
{#if !fieldDefinition.presets || fieldDefinition.showCustomField}
|
|
54
61
|
<Input
|
|
62
|
+
data-testid={`binding-${fieldDefinition.binding}-input`}
|
|
55
63
|
size="lg"
|
|
56
64
|
placeholder="Enter custom value"
|
|
57
65
|
bind:value={inputValue}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import {
|
|
2
|
+
import { type GuiFieldDefinitionCfg } from '@rainlanguage/orderbook';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
fieldDefinition: GuiFieldDefinitionCfg;
|
|
6
|
-
gui: DotrainOrderGui;
|
|
7
6
|
};
|
|
8
7
|
events: {
|
|
9
8
|
[evt: string]: CustomEvent<any>;
|
|
@@ -2,16 +2,21 @@
|
|
|
2
2
|
import { CheckCircleSolid, CloseCircleSolid } from "flowbite-svelte-icons";
|
|
3
3
|
import { Spinner } from "flowbite-svelte";
|
|
4
4
|
import { onMount } from "svelte";
|
|
5
|
+
import { useGui } from "../../hooks/useGui";
|
|
5
6
|
export let token;
|
|
6
|
-
export let gui;
|
|
7
7
|
export let onSelectTokenSelect;
|
|
8
8
|
let inputValue = null;
|
|
9
9
|
let tokenInfo = null;
|
|
10
10
|
let error = "";
|
|
11
11
|
let checking = false;
|
|
12
|
+
const gui = useGui();
|
|
12
13
|
onMount(async () => {
|
|
13
14
|
try {
|
|
14
|
-
|
|
15
|
+
let result = await gui.getTokenInfo(token.key);
|
|
16
|
+
if (result.error) {
|
|
17
|
+
throw new Error(result.error.msg);
|
|
18
|
+
}
|
|
19
|
+
tokenInfo = result.value;
|
|
15
20
|
if (tokenInfo?.address) {
|
|
16
21
|
inputValue = tokenInfo.address;
|
|
17
22
|
}
|
|
@@ -21,7 +26,11 @@ onMount(async () => {
|
|
|
21
26
|
async function getInfoForSelectedToken() {
|
|
22
27
|
error = "";
|
|
23
28
|
try {
|
|
24
|
-
|
|
29
|
+
let result = await gui.getTokenInfo(token.key);
|
|
30
|
+
if (result.error) {
|
|
31
|
+
throw new Error(result.error.msg);
|
|
32
|
+
}
|
|
33
|
+
tokenInfo = result.value;
|
|
25
34
|
error = "";
|
|
26
35
|
} catch {
|
|
27
36
|
return error = "No token exists at this address.";
|
|
@@ -72,7 +81,10 @@ async function handleInput(event) {
|
|
|
72
81
|
<span>Checking...</span>
|
|
73
82
|
</div>
|
|
74
83
|
{:else if tokenInfo}
|
|
75
|
-
<div
|
|
84
|
+
<div
|
|
85
|
+
class="flex h-5 flex-row items-center gap-2"
|
|
86
|
+
data-testid={`select-token-success-${token.key}`}
|
|
87
|
+
>
|
|
76
88
|
<CheckCircleSolid class="h-5 w-5" color="green" />
|
|
77
89
|
<span>{tokenInfo.name}</span>
|
|
78
90
|
</div>
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import type {
|
|
2
|
+
import type { GuiSelectTokensCfg } from '@rainlanguage/orderbook';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
token: GuiSelectTokensCfg;
|
|
6
|
-
gui: DotrainOrderGui;
|
|
7
6
|
onSelectTokenSelect: () => void;
|
|
8
7
|
};
|
|
9
8
|
events: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>import { fade } from "svelte/transition";
|
|
2
|
-
import { DotrainOrderGui } from "@rainlanguage/orderbook
|
|
2
|
+
import { DotrainOrderGui } from "@rainlanguage/orderbook";
|
|
3
3
|
import DeploymentsSection from "./DeploymentsSection.svelte";
|
|
4
4
|
import SvelteMarkdown from "svelte-markdown";
|
|
5
5
|
export let strategyName = "";
|
|
@@ -21,7 +21,11 @@ const fetchMarkdownContent = async (url) => {
|
|
|
21
21
|
};
|
|
22
22
|
const getStrategyWithMarkdown = async () => {
|
|
23
23
|
try {
|
|
24
|
-
const
|
|
24
|
+
const result = await DotrainOrderGui.getStrategyDetails(dotrain);
|
|
25
|
+
if (result.error) {
|
|
26
|
+
throw new Error(result.error.msg);
|
|
27
|
+
}
|
|
28
|
+
const strategyDetails = result.value;
|
|
25
29
|
if (strategyDetails.description && isMarkdownUrl(strategyDetails.description)) {
|
|
26
30
|
await fetchMarkdownContent(strategyDetails.description);
|
|
27
31
|
}
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
<script>import { Input } from "flowbite-svelte";
|
|
2
|
-
import {
|
|
3
|
-
} from "@rainlanguage/orderbook/js_api";
|
|
2
|
+
import {} from "@rainlanguage/orderbook";
|
|
4
3
|
import DeploymentSectionHeader from "./DeploymentSectionHeader.svelte";
|
|
5
4
|
import { onMount } from "svelte";
|
|
5
|
+
import { useGui } from "../../hooks/useGui";
|
|
6
|
+
const gui = useGui();
|
|
6
7
|
export let i;
|
|
7
8
|
export let label;
|
|
8
9
|
export let vault;
|
|
9
|
-
export let gui;
|
|
10
10
|
let tokenInfo = null;
|
|
11
11
|
let inputValue = "";
|
|
12
12
|
let error = "";
|
|
13
13
|
onMount(() => {
|
|
14
|
-
const
|
|
14
|
+
const result = gui.getVaultIds();
|
|
15
|
+
if (result.error) {
|
|
16
|
+
error = result.error.msg;
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const vaultIds = result.value;
|
|
15
20
|
if (label === "Input") {
|
|
16
21
|
inputValue = vaultIds.get("input")?.[i];
|
|
17
22
|
} else if (label === "Output") {
|
|
@@ -21,7 +26,12 @@ onMount(() => {
|
|
|
21
26
|
const handleGetTokenInfo = async () => {
|
|
22
27
|
if (!vault.token?.key) return;
|
|
23
28
|
try {
|
|
24
|
-
|
|
29
|
+
let result = await gui.getTokenInfo(vault.token?.key);
|
|
30
|
+
if (result.error) {
|
|
31
|
+
error = result.error.msg;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
tokenInfo = result.value;
|
|
25
35
|
} catch (e) {
|
|
26
36
|
const errorMessage = e.message ? e.message : "Error getting token info.";
|
|
27
37
|
error = errorMessage;
|
|
@@ -49,6 +59,7 @@ $: if (vault.token?.key) {
|
|
|
49
59
|
/>
|
|
50
60
|
<div class="flex flex-col gap-2">
|
|
51
61
|
<Input
|
|
62
|
+
data-testid="vault-id-input"
|
|
52
63
|
size="lg"
|
|
53
64
|
type="text"
|
|
54
65
|
placeholder="Enter vault ID"
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import { type OrderIOCfg
|
|
2
|
+
import { type OrderIOCfg } from '@rainlanguage/orderbook';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
i: number;
|
|
6
6
|
label: "Input" | "Output";
|
|
7
7
|
vault: OrderIOCfg;
|
|
8
|
-
gui: DotrainOrderGui;
|
|
9
8
|
};
|
|
10
9
|
events: {
|
|
11
10
|
[evt: string]: CustomEvent<any>;
|
|
@@ -5,23 +5,28 @@ import OrderTradesListTable from "../tables/OrderTradesListTable.svelte";
|
|
|
5
5
|
import TanstackOrderQuote from "./TanstackOrderQuote.svelte";
|
|
6
6
|
import TanstackPageContentDetail from "./TanstackPageContentDetail.svelte";
|
|
7
7
|
import CardProperty from "../CardProperty.svelte";
|
|
8
|
-
import { formatTimestampSecondsAsLocal } from "../../
|
|
8
|
+
import { formatTimestampSecondsAsLocal } from "../../services/time";
|
|
9
9
|
import ButtonVaultLink from "../ButtonVaultLink.svelte";
|
|
10
10
|
import OrderVaultsVolTable from "../tables/OrderVaultsVolTable.svelte";
|
|
11
11
|
import { QKEY_ORDER } from "../../queries/keys";
|
|
12
12
|
import CodeMirrorRainlang from "../CodeMirrorRainlang.svelte";
|
|
13
|
-
import { getOrderByHash } from "@rainlanguage/orderbook/js_api";
|
|
14
13
|
import { createQuery, useQueryClient } from "@tanstack/svelte-query";
|
|
15
14
|
import { Button, TabItem, Tabs, Tooltip } from "flowbite-svelte";
|
|
16
15
|
import { onDestroy } from "svelte";
|
|
17
16
|
import OrderApy from "../tables/OrderAPY.svelte";
|
|
18
17
|
import { page } from "$app/stores";
|
|
19
|
-
import DepositOrWithdrawButtons from "./DepositOrWithdrawButtons.svelte";
|
|
20
18
|
import Refresh from "../icon/Refresh.svelte";
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
import { invalidateTanstackQueries } from "../../queries/queryClient";
|
|
20
|
+
import {
|
|
21
|
+
ArrowDownToBracketOutline,
|
|
22
|
+
ArrowUpFromBracketOutline,
|
|
23
|
+
InfoCircleOutline
|
|
24
|
+
} from "flowbite-svelte-icons";
|
|
25
|
+
import { useAccount } from "../../providers/wallet/useAccount";
|
|
26
|
+
import {
|
|
27
|
+
getOrderByHash
|
|
28
|
+
} from "@rainlanguage/orderbook";
|
|
29
|
+
import { useToasts } from "../../providers/toasts/useToasts";
|
|
25
30
|
export let handleQuoteDebugModal = void 0;
|
|
26
31
|
export const handleDebugTradeModal = void 0;
|
|
27
32
|
export let colorTheme;
|
|
@@ -31,25 +36,36 @@ export let orderbookAddress;
|
|
|
31
36
|
export let orderHash;
|
|
32
37
|
export let rpcUrl;
|
|
33
38
|
export let subgraphUrl;
|
|
34
|
-
export let
|
|
35
|
-
export let
|
|
36
|
-
export let
|
|
39
|
+
export let onRemove;
|
|
40
|
+
export let onDeposit;
|
|
41
|
+
export let onWithdraw;
|
|
37
42
|
let codeMirrorDisabled = true;
|
|
38
43
|
let codeMirrorStyles = {};
|
|
39
44
|
const queryClient = useQueryClient();
|
|
45
|
+
const { matchesAccount } = useAccount();
|
|
46
|
+
const { errToast } = useToasts();
|
|
40
47
|
$: orderDetailQuery = createQuery({
|
|
41
48
|
queryKey: [orderHash, QKEY_ORDER + orderHash],
|
|
42
|
-
queryFn: () => {
|
|
43
|
-
|
|
49
|
+
queryFn: async () => {
|
|
50
|
+
const result = await getOrderByHash(subgraphUrl, orderHash);
|
|
51
|
+
if (result.error) throw new Error(result.error.msg);
|
|
52
|
+
return result.value;
|
|
44
53
|
},
|
|
45
54
|
enabled: !!subgraphUrl
|
|
46
55
|
});
|
|
47
56
|
const interval = setInterval(async () => {
|
|
48
|
-
await
|
|
57
|
+
await invalidateTanstackQueries(queryClient, [orderHash]);
|
|
49
58
|
}, 1e4);
|
|
50
59
|
onDestroy(() => {
|
|
51
60
|
clearInterval(interval);
|
|
52
61
|
});
|
|
62
|
+
const handleRefresh = async () => {
|
|
63
|
+
try {
|
|
64
|
+
await invalidateTanstackQueries(queryClient, [orderHash]);
|
|
65
|
+
} catch {
|
|
66
|
+
errToast("Failed to refresh");
|
|
67
|
+
}
|
|
68
|
+
};
|
|
53
69
|
$: subgraphName = $page.url.pathname.split("/")[2]?.split("-")[0];
|
|
54
70
|
</script>
|
|
55
71
|
|
|
@@ -63,33 +79,23 @@ $: subgraphName = $page.url.pathname.split("/")[2]?.split("-")[0];
|
|
|
63
79
|
<span class="font-light">Order</span>
|
|
64
80
|
<Hash shorten value={data.order.orderHash} />
|
|
65
81
|
</div>
|
|
66
|
-
|
|
67
82
|
<BadgeActive active={data.order.active} large />
|
|
68
83
|
</div>
|
|
69
84
|
|
|
70
85
|
<div class="flex items-center gap-2">
|
|
71
|
-
{#if data
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
order: data.order,
|
|
80
|
-
onRemove: $orderDetailQuery.refetch,
|
|
81
|
-
chainId,
|
|
82
|
-
orderbookAddress,
|
|
83
|
-
subgraphUrl
|
|
84
|
-
}
|
|
85
|
-
})}
|
|
86
|
-
disabled={!handleOrderRemoveModal}
|
|
87
|
-
>
|
|
88
|
-
Remove
|
|
89
|
-
</Button>
|
|
86
|
+
{#if matchesAccount(data.order.owner)}
|
|
87
|
+
{#if data.order.active}
|
|
88
|
+
<Button
|
|
89
|
+
on:click={() => onRemove(data.order)}
|
|
90
|
+
data-testid="remove-button"
|
|
91
|
+
aria-label="Remove order">Remove</Button
|
|
92
|
+
>
|
|
93
|
+
{/if}
|
|
90
94
|
{/if}
|
|
95
|
+
|
|
91
96
|
<Refresh
|
|
92
|
-
|
|
97
|
+
testId="top-refresh"
|
|
98
|
+
on:click={handleRefresh}
|
|
93
99
|
spin={$orderDetailQuery.isLoading || $orderDetailQuery.isFetching}
|
|
94
100
|
/>
|
|
95
101
|
</div>
|
|
@@ -118,7 +124,7 @@ $: subgraphName = $page.url.pathname.split("/")[2]?.split("-")[0];
|
|
|
118
124
|
</svelte:fragment>
|
|
119
125
|
</CardProperty>
|
|
120
126
|
|
|
121
|
-
{#each [{ key: '
|
|
127
|
+
{#each [{ key: 'Output vaults', type: 'outputs' }, { key: 'Input vaults', type: 'inputs' }, { key: 'Input & output vaults', type: 'inputs_outputs' }] as { key, type }}
|
|
122
128
|
{#if data.vaults.get(type)?.length !== 0}
|
|
123
129
|
<CardProperty>
|
|
124
130
|
<svelte:fragment slot="key"
|
|
@@ -135,15 +141,25 @@ $: subgraphName = $page.url.pathname.split("/")[2]?.split("-")[0];
|
|
|
135
141
|
{#each data.vaults.get(type) || [] as vault}
|
|
136
142
|
<ButtonVaultLink tokenVault={vault} {subgraphName}>
|
|
137
143
|
<svelte:fragment slot="buttons">
|
|
138
|
-
{#if
|
|
139
|
-
<
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
{#if matchesAccount(vault.owner)}
|
|
145
|
+
<div class="flex gap-1">
|
|
146
|
+
<Button
|
|
147
|
+
color="light"
|
|
148
|
+
size="xs"
|
|
149
|
+
data-testid="deposit-button"
|
|
150
|
+
on:click={() => onDeposit(vault)}
|
|
151
|
+
>
|
|
152
|
+
<ArrowDownToBracketOutline size="xs" />
|
|
153
|
+
</Button>
|
|
154
|
+
<Button
|
|
155
|
+
color="light"
|
|
156
|
+
size="xs"
|
|
157
|
+
data-testid="withdraw-button"
|
|
158
|
+
on:click={() => onWithdraw(vault)}
|
|
159
|
+
>
|
|
160
|
+
<ArrowUpFromBracketOutline size="xs" />
|
|
161
|
+
</Button>
|
|
162
|
+
</div>
|
|
147
163
|
{/if}
|
|
148
164
|
</svelte:fragment>
|
|
149
165
|
</ButtonVaultLink>
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import type { Writable } from 'svelte/store';
|
|
3
|
-
import type { Config } from 'wagmi';
|
|
4
2
|
import type { Hex } from 'viem';
|
|
5
|
-
import type {
|
|
3
|
+
import type { QuoteDebugModalHandler, DebugTradeModalHandler } from '../../types/modal';
|
|
4
|
+
import { type SgOrder, type SgVault } from '@rainlanguage/orderbook';
|
|
6
5
|
declare const __propDef: {
|
|
7
6
|
props: {
|
|
8
|
-
handleDepositOrWithdrawModal?: ((props: DepositOrWithdrawModalProps) => void) | undefined;
|
|
9
|
-
handleOrderRemoveModal?: ((props: OrderRemoveModalProps) => void) | undefined;
|
|
10
7
|
handleQuoteDebugModal?: QuoteDebugModalHandler | undefined;
|
|
11
8
|
handleDebugTradeModal?: DebugTradeModalHandler | undefined;
|
|
12
9
|
colorTheme: any;
|
|
@@ -16,9 +13,15 @@ declare const __propDef: {
|
|
|
16
13
|
orderHash: string;
|
|
17
14
|
rpcUrl: string;
|
|
18
15
|
subgraphUrl: string;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
/** Callback function when remove action is triggered for an order
|
|
17
|
+
* @param order The order to remove
|
|
18
|
+
*/ onRemove: (order: SgOrder) => void;
|
|
19
|
+
/** Callback function when deposit action is triggered for a vault
|
|
20
|
+
* @param vault The vault to deposit into
|
|
21
|
+
*/ onDeposit: (vault: SgVault) => void;
|
|
22
|
+
/** Callback function when withdraw action is triggered for a vault
|
|
23
|
+
* @param vault The vault to withdraw from
|
|
24
|
+
*/ onWithdraw: (vault: SgVault) => void;
|
|
22
25
|
};
|
|
23
26
|
events: {
|
|
24
27
|
[evt: string]: CustomEvent<any>;
|