@rainlanguage/ui-components 0.0.1-alpha.21 → 0.0.1-alpha.210
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__/settings.yaml +125 -0
- package/dist/__mocks__/CodeMirrorRainlang.svelte +4 -0
- package/dist/__mocks__/CodeMirrorRainlang.svelte.d.ts +18 -0
- package/dist/__mocks__/MockComponent.svelte +4 -0
- package/dist/__mocks__/MockComponent.svelte.d.ts +3 -1
- package/dist/__mocks__/stores.d.ts +47 -33
- package/dist/__mocks__/stores.js +61 -38
- package/dist/components/ButtonLoading.svelte +1 -1
- package/dist/components/ButtonVaultLink.svelte +11 -11
- package/dist/components/ButtonVaultLink.svelte.d.ts +4 -3
- package/dist/components/CheckboxInactiveOrdersVault.svelte +20 -0
- package/dist/components/CheckboxInactiveOrdersVault.svelte.d.ts +19 -0
- 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 +3 -12
- package/dist/components/CodeMirrorRainlang.svelte.d.ts +2 -2
- 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 +45 -23
- package/dist/components/ListViewOrderbookFilters.svelte.d.ts +27 -22
- package/dist/components/LocalDbStatusBadge.svelte +27 -0
- package/dist/components/LocalDbStatusBadge.svelte.d.ts +19 -0
- package/dist/components/LocalDbStatusCard.svelte +40 -0
- package/dist/components/LocalDbStatusCard.svelte.d.ts +20 -0
- package/dist/components/LocalDbStatusModal.svelte +103 -0
- package/dist/components/LocalDbStatusModal.svelte.d.ts +21 -0
- package/dist/components/OrderOrVaultHash.svelte +12 -12
- package/dist/components/OrderOrVaultHash.svelte.d.ts +4 -4
- package/dist/components/PageHeader.svelte +1 -1
- package/dist/components/TanstackAppTable.svelte +179 -28
- package/dist/components/TanstackAppTable.svelte.d.ts +14 -8
- 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/VaultBalanceChangeTypeFilter.svelte +23 -0
- package/dist/components/VaultBalanceChangeTypeFilter.svelte.d.ts +19 -0
- package/dist/components/VaultCard.svelte +18 -0
- package/dist/components/VaultCard.svelte.d.ts +19 -0
- package/dist/components/charts/LightweightChart.svelte +1 -1
- package/dist/components/charts/LightweightChart.svelte.d.ts +5 -5
- package/dist/components/charts/OrderTradesChart.svelte +300 -28
- package/dist/components/charts/OrderTradesChart.svelte.d.ts +4 -4
- package/dist/components/charts/TanstackLightweightChartLine.svelte +5 -9
- package/dist/components/charts/VaultBalanceChart.svelte +8 -26
- package/dist/components/charts/VaultBalanceChart.svelte.d.ts +1 -7
- 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 +2 -1
- package/dist/components/deployment/ComposedRainlangModal.svelte.d.ts +1 -4
- package/dist/components/deployment/DeploymentSectionHeader.svelte +7 -4
- package/dist/components/deployment/DeploymentSteps.svelte +209 -216
- package/dist/components/deployment/DeploymentSteps.svelte.d.ts +6 -12
- package/dist/components/deployment/DeploymentTile.svelte +2 -2
- package/dist/components/deployment/DeploymentTile.svelte.d.ts +1 -1
- package/dist/components/deployment/DeploymentsSection.svelte +15 -22
- package/dist/components/deployment/DeploymentsSection.svelte.d.ts +3 -2
- package/dist/components/deployment/DepositInput.svelte +8 -10
- package/dist/components/deployment/DepositInput.svelte.d.ts +1 -2
- package/dist/components/deployment/DisclaimerModal.svelte +6 -7
- package/dist/components/deployment/FieldDefinitionInput.svelte +7 -11
- package/dist/components/deployment/FieldDefinitionInput.svelte.d.ts +1 -2
- package/dist/components/deployment/InvalidOrdersSection.svelte +17 -0
- package/dist/components/deployment/InvalidOrdersSection.svelte.d.ts +19 -0
- package/dist/components/deployment/{StrategyPage.svelte → OrderPage.svelte} +15 -24
- package/dist/components/deployment/OrderPage.svelte.d.ts +21 -0
- package/dist/components/deployment/SelectToken.svelte +125 -48
- package/dist/components/deployment/SelectToken.svelte.d.ts +4 -3
- package/dist/components/deployment/TokenBalance.svelte +19 -0
- package/dist/components/deployment/TokenBalance.svelte.d.ts +19 -0
- package/dist/components/deployment/TokenIOInput.svelte +25 -15
- package/dist/components/deployment/TokenIOInput.svelte.d.ts +3 -3
- package/dist/components/deployment/TokenSelectionModal.svelte +148 -0
- package/dist/components/deployment/TokenSelectionModal.svelte.d.ts +20 -0
- package/dist/components/deployment/{ValidStrategiesSection.svelte → ValidOrdersSection.svelte} +7 -7
- package/dist/components/deployment/ValidOrdersSection.svelte.d.ts +19 -0
- package/dist/components/deployment/VaultIdInformation.svelte +17 -0
- package/dist/components/deployment/VaultIdInformation.svelte.d.ts +21 -0
- package/dist/components/detail/OrderDetail.svelte +184 -80
- package/dist/components/detail/OrderDetail.svelte.d.ts +21 -15
- package/dist/components/detail/TanstackOrderQuote.svelte +92 -46
- package/dist/components/detail/TanstackOrderQuote.svelte.d.ts +14 -16
- package/dist/components/detail/VaultDetail.svelte +78 -77
- package/dist/components/detail/VaultDetail.svelte.d.ts +12 -18
- package/dist/components/dropdown/DropdownActiveNetworks.svelte +44 -0
- package/dist/components/dropdown/DropdownActiveNetworks.svelte.d.ts +19 -0
- package/dist/components/dropdown/DropdownCheckbox.svelte +4 -4
- package/dist/components/dropdown/DropdownOrderListAccounts.svelte +5 -2
- package/dist/components/dropdown/DropdownOrderListAccounts.svelte.d.ts +2 -3
- package/dist/components/dropdown/DropdownOrderbooksFilter.svelte +172 -0
- package/dist/components/dropdown/DropdownOrderbooksFilter.svelte.d.ts +25 -0
- package/dist/components/dropdown/DropdownTokensFilter.svelte +152 -0
- package/dist/components/dropdown/DropdownTokensFilter.svelte.d.ts +28 -0
- 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 +3 -3
- package/dist/components/input/InputRegistryUrl.svelte +36 -14
- package/dist/components/input/InputToken.svelte +2 -2
- package/dist/components/input/InputTokenAmount.svelte +16 -21
- package/dist/components/input/InputTokenAmount.svelte.d.ts +3 -3
- package/dist/components/tables/OrderAPY.svelte +6 -33
- package/dist/components/tables/OrderAPY.svelte.d.ts +1 -4
- package/dist/components/tables/OrderTradesListTable.svelte +84 -81
- package/dist/components/tables/OrderTradesListTable.svelte.d.ts +4 -4
- package/dist/components/tables/OrderVaultsVolTable.svelte +17 -22
- package/dist/components/tables/OrderVaultsVolTable.svelte.d.ts +2 -2
- package/dist/components/tables/OrdersListTable.svelte +200 -108
- package/dist/components/tables/OrdersListTable.svelte.d.ts +17 -21
- package/dist/components/tables/VaultBalanceChangesTable.svelte +83 -43
- package/dist/components/tables/VaultBalanceChangesTable.svelte.d.ts +13 -11
- package/dist/components/tables/VaultsListTable.svelte +268 -145
- package/dist/components/tables/VaultsListTable.svelte.d.ts +24 -32
- 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 +8 -2
- package/dist/errors/DeploymentStepsError.js +7 -1
- package/dist/hooks/useGui.d.ts +1 -1
- package/dist/hooks/useGui.js +1 -1
- package/dist/hooks/useLocalDb.d.ts +3 -0
- package/dist/hooks/useLocalDb.js +10 -0
- package/dist/hooks/useRaindexClient.d.ts +3 -0
- package/dist/hooks/useRaindexClient.js +11 -0
- package/dist/index.d.ts +42 -19
- package/dist/index.js +41 -16
- package/dist/models/Transaction.d.ts +75 -0
- package/dist/models/Transaction.js +100 -0
- package/dist/providers/GuiProvider.svelte +1 -1
- package/dist/providers/GuiProvider.svelte.d.ts +1 -1
- package/dist/providers/LocalDbProvider.svelte +8 -0
- package/dist/providers/LocalDbProvider.svelte.d.ts +21 -0
- package/dist/providers/RaindexClientProvider.svelte +8 -0
- package/dist/providers/RaindexClientProvider.svelte.d.ts +21 -0
- package/dist/providers/dotrainRegistry/DotrainRegistryProvider.svelte +8 -0
- package/dist/providers/dotrainRegistry/DotrainRegistryProvider.svelte.d.ts +24 -0
- package/dist/providers/dotrainRegistry/context.d.ts +9 -0
- package/dist/providers/dotrainRegistry/context.js +40 -0
- package/dist/providers/dotrainRegistry/useDotrainRegistry.d.ts +5 -0
- package/dist/providers/dotrainRegistry/useDotrainRegistry.js +35 -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 +235 -0
- package/dist/providers/transactions/TransactionManager.js +509 -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/keys.d.ts +1 -0
- package/dist/queries/keys.js +1 -0
- package/dist/queries/queryClient.d.ts +1 -1
- package/dist/queries/queryClient.js +11 -6
- package/dist/services/awaitTransactionIndexing.d.ts +107 -0
- package/dist/services/awaitTransactionIndexing.js +58 -0
- package/dist/services/getExplorerLink.d.ts +1 -1
- package/dist/services/getExplorerLink.js +2 -4
- package/dist/services/handleShareChoices.d.ts +2 -2
- package/dist/services/handleShareChoices.js +7 -2
- package/dist/services/historicalOrderCharts.d.ts +2 -2
- package/dist/services/historicalOrderCharts.js +267 -333
- 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 +22 -0
- package/dist/services/pairTradesChartData.d.ts +47 -0
- package/dist/services/pairTradesChartData.js +190 -0
- package/dist/services/registry.d.ts +5 -5
- package/dist/services/registry.js +8 -208
- 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/appStores.d.ts +9 -14
- package/dist/types/modal.d.ts +26 -14
- package/dist/types/{strategy.d.ts → order.d.ts} +3 -3
- package/dist/types/order.js +1 -0
- package/dist/types/toast.d.ts +11 -0
- package/dist/types/toast.js +1 -0
- package/dist/types/tokenBalance.d.ts +6 -0
- package/dist/types/tokenBalance.js +1 -0
- package/dist/types/transaction.d.ts +66 -21
- package/dist/types/transaction.js +31 -1
- package/dist/utils/configHelpers.d.ts +4 -0
- package/dist/utils/configHelpers.js +21 -0
- package/dist/utils/constructHashLink.d.ts +24 -0
- package/dist/utils/constructHashLink.js +115 -0
- package/dist/utils/getNetworkName.d.ts +1 -0
- package/dist/utils/getNetworkName.js +13 -0
- package/dist/utils/number.d.ts +0 -7
- package/dist/utils/number.js +0 -27
- package/dist/utils/tokens.d.ts +2 -0
- package/dist/utils/tokens.js +3 -0
- package/dist/utils/vaultBalanceChangeLabels.d.ts +4 -0
- package/dist/utils/vaultBalanceChangeLabels.js +18 -0
- package/package.json +39 -34
- package/dist/__fixtures__/orderDetail.d.ts +0 -99
- package/dist/__fixtures__/orderDetail.js +0 -204
- 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/__mocks__/settings.d.ts +0 -3
- package/dist/__mocks__/settings.js +0 -37
- package/dist/components/deployment/InvalidStrategiesSection.svelte +0 -19
- package/dist/components/deployment/InvalidStrategiesSection.svelte.d.ts +0 -19
- package/dist/components/deployment/StrategyPage.svelte.d.ts +0 -19
- package/dist/components/deployment/ValidStrategiesSection.svelte.d.ts +0 -19
- package/dist/components/deployment/getDeploymentTransactionArgs.d.ts +0 -17
- package/dist/components/deployment/getDeploymentTransactionArgs.js +0 -28
- package/dist/components/detail/DepositOrWithdrawButtons.svelte +0 -44
- package/dist/components/detail/DepositOrWithdrawButtons.svelte.d.ts +0 -26
- package/dist/components/dropdown/DropdownActiveSubgraphs.svelte +0 -38
- package/dist/components/dropdown/DropdownActiveSubgraphs.svelte.d.ts +0 -21
- 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
- package/dist/utils/vault.d.ts +0 -2
- package/dist/utils/vault.js +0 -29
- /package/dist/types/{strategy.js → account.js} +0 -0
|
@@ -1,36 +1,308 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import { prepareHistoricalOrderChartData } from "../../services/historicalOrderCharts";
|
|
3
|
-
import TanstackLightweightChartLine from "./TanstackLightweightChartLine.svelte";
|
|
1
|
+
<script>import {} from "@rainlanguage/orderbook";
|
|
4
2
|
import { createQuery } from "@tanstack/svelte-query";
|
|
5
3
|
import { QKEY_ORDER_TRADES_LIST } from "../../queries/keys";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import {
|
|
5
|
+
CHART_COLORS,
|
|
6
|
+
extractPairsFromTrades,
|
|
7
|
+
findPairIndex,
|
|
8
|
+
flipTradingPair,
|
|
9
|
+
formatChartTimestamp,
|
|
10
|
+
getDefaultPair,
|
|
11
|
+
getTokenLabel,
|
|
12
|
+
transformPairTrades
|
|
13
|
+
} from "../../services/pairTradesChartData";
|
|
14
|
+
import {
|
|
15
|
+
TIME_DELTA_24_HOURS,
|
|
16
|
+
TIME_DELTA_7_DAYS,
|
|
17
|
+
TIME_DELTA_30_DAYS,
|
|
18
|
+
TIME_DELTA_1_YEAR
|
|
19
|
+
} from "../../services/time";
|
|
20
|
+
import { Button, ButtonGroup, Dropdown, DropdownItem, Spinner } from "flowbite-svelte";
|
|
21
|
+
import { ChevronDownSolid } from "flowbite-svelte-icons";
|
|
22
|
+
import {
|
|
23
|
+
createChart,
|
|
24
|
+
CrosshairMode
|
|
25
|
+
} from "lightweight-charts";
|
|
26
|
+
import { onDestroy, onMount } from "svelte";
|
|
27
|
+
export let order;
|
|
9
28
|
export let lightweightChartsTheme;
|
|
29
|
+
let chartElement = void 0;
|
|
30
|
+
let chart;
|
|
31
|
+
let priceSeries;
|
|
32
|
+
let buyVolumeSeries;
|
|
33
|
+
let sellVolumeSeries;
|
|
34
|
+
const TIME_OPTIONS = [
|
|
35
|
+
{ delta: TIME_DELTA_1_YEAR, label: "1Y" },
|
|
36
|
+
{ delta: TIME_DELTA_30_DAYS, label: "30D" },
|
|
37
|
+
{ delta: TIME_DELTA_7_DAYS, label: "7D" },
|
|
38
|
+
{ delta: TIME_DELTA_24_HOURS, label: "24H" }
|
|
39
|
+
];
|
|
40
|
+
let timeDelta = TIME_DELTA_1_YEAR;
|
|
41
|
+
let pairs = [];
|
|
42
|
+
let selectedPairIndex = 0;
|
|
43
|
+
let dropdownOpen = false;
|
|
44
|
+
$: selectedPair = pairs[selectedPairIndex] ?? null;
|
|
10
45
|
$: query = createQuery({
|
|
11
|
-
queryKey: [QKEY_ORDER_TRADES_LIST, id],
|
|
46
|
+
queryKey: [QKEY_ORDER_TRADES_LIST, order.id],
|
|
12
47
|
queryFn: async () => {
|
|
13
|
-
const data = await
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
48
|
+
const data = await order.getTradesList(void 0, void 0, 1);
|
|
49
|
+
if (data.error) throw new Error(data.error.readableMsg);
|
|
50
|
+
return data.value;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
$: trades = $query?.data ?? [];
|
|
54
|
+
$: {
|
|
55
|
+
if (trades.length > 0) {
|
|
56
|
+
const isFirstLoad = pairs.length === 0;
|
|
57
|
+
const extractedPairs = extractPairsFromTrades(trades);
|
|
58
|
+
for (const newPair of extractedPairs) {
|
|
59
|
+
if (findPairIndex(pairs, newPair) === -1) {
|
|
60
|
+
pairs = [...pairs, newPair];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (isFirstLoad && pairs.length > 0) {
|
|
64
|
+
const defaultPair = getDefaultPair(trades);
|
|
65
|
+
if (defaultPair) {
|
|
66
|
+
const idx = findPairIndex(pairs, defaultPair);
|
|
67
|
+
if (idx >= 0) selectedPairIndex = idx;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
$: chartData = selectedPair ? transformPairTrades({
|
|
73
|
+
trades,
|
|
74
|
+
baseTokenAddress: selectedPair.baseToken.address,
|
|
75
|
+
quoteTokenAddress: selectedPair.quoteToken.address,
|
|
76
|
+
timeDeltaSeconds: timeDelta
|
|
77
|
+
}) : null;
|
|
78
|
+
$: pairLabel = selectedPair ? `${getTokenLabel(selectedPair.baseToken)}/${getTokenLabel(selectedPair.quoteToken)}` : "Select pair";
|
|
79
|
+
function handleFlipPair() {
|
|
80
|
+
if (!selectedPair) return;
|
|
81
|
+
const flipped = flipTradingPair(selectedPair);
|
|
82
|
+
const existingIdx = findPairIndex(pairs, flipped);
|
|
83
|
+
if (existingIdx >= 0) {
|
|
84
|
+
selectedPairIndex = existingIdx;
|
|
85
|
+
} else {
|
|
86
|
+
pairs = [...pairs, flipped];
|
|
87
|
+
selectedPairIndex = pairs.length - 1;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function selectPair(index) {
|
|
91
|
+
selectedPairIndex = index;
|
|
92
|
+
dropdownOpen = false;
|
|
93
|
+
}
|
|
94
|
+
function setupChart() {
|
|
95
|
+
if (!chartElement) return;
|
|
96
|
+
chart = createChart(chartElement, {
|
|
97
|
+
autoSize: true,
|
|
98
|
+
leftPriceScale: {
|
|
99
|
+
visible: true,
|
|
100
|
+
borderVisible: false
|
|
101
|
+
},
|
|
102
|
+
rightPriceScale: {
|
|
103
|
+
visible: true,
|
|
104
|
+
borderVisible: false
|
|
105
|
+
},
|
|
106
|
+
crosshair: {
|
|
107
|
+
mode: CrosshairMode.Normal
|
|
108
|
+
},
|
|
109
|
+
timeScale: {
|
|
110
|
+
tickMarkFormatter: (time) => formatChartTimestamp(time, timeDelta)
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
buyVolumeSeries = chart.addHistogramSeries({
|
|
114
|
+
color: CHART_COLORS.BUY_VOLUME_TRANSPARENT,
|
|
115
|
+
priceFormat: { type: "volume" },
|
|
116
|
+
priceScaleId: "left"
|
|
117
|
+
});
|
|
118
|
+
sellVolumeSeries = chart.addHistogramSeries({
|
|
119
|
+
color: CHART_COLORS.SELL_VOLUME_TRANSPARENT,
|
|
120
|
+
priceFormat: { type: "volume" },
|
|
121
|
+
priceScaleId: "left"
|
|
122
|
+
});
|
|
123
|
+
buyVolumeSeries.createPriceLine({
|
|
124
|
+
price: 0,
|
|
125
|
+
color: CHART_COLORS.ZERO_LINE,
|
|
126
|
+
lineWidth: 1,
|
|
127
|
+
lineStyle: 0,
|
|
128
|
+
axisLabelVisible: false
|
|
129
|
+
});
|
|
130
|
+
sellVolumeSeries.createPriceLine({
|
|
131
|
+
price: 0,
|
|
132
|
+
color: CHART_COLORS.ZERO_LINE,
|
|
133
|
+
lineWidth: 1,
|
|
134
|
+
lineStyle: 0,
|
|
135
|
+
axisLabelVisible: false
|
|
136
|
+
});
|
|
137
|
+
priceSeries = chart.addLineSeries({
|
|
138
|
+
color: CHART_COLORS.PRICE_LINE,
|
|
139
|
+
lineWidth: 2,
|
|
140
|
+
priceScaleId: "right",
|
|
141
|
+
priceFormat: {
|
|
142
|
+
type: "price",
|
|
143
|
+
precision: 6,
|
|
144
|
+
minMove: 1e-6
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
chart.priceScale("left").applyOptions({
|
|
148
|
+
scaleMargins: { top: 0.1, bottom: 0.1 }
|
|
149
|
+
});
|
|
150
|
+
chart.priceScale("right").applyOptions({
|
|
151
|
+
scaleMargins: { top: 0.1, bottom: 0.1 }
|
|
152
|
+
});
|
|
153
|
+
setChartOptions();
|
|
154
|
+
updateChartData();
|
|
155
|
+
}
|
|
156
|
+
function setChartOptions() {
|
|
157
|
+
if (!chart) return;
|
|
158
|
+
chart.applyOptions({
|
|
159
|
+
...$lightweightChartsTheme,
|
|
160
|
+
autoSize: true
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function updateChartData() {
|
|
164
|
+
if (!chart || !priceSeries || !buyVolumeSeries || !sellVolumeSeries) return;
|
|
165
|
+
if (chartData) {
|
|
166
|
+
priceSeries.setData(chartData.pricePoints);
|
|
167
|
+
buyVolumeSeries.setData(chartData.buyVolumePoints);
|
|
168
|
+
sellVolumeSeries.setData(chartData.sellVolumePoints);
|
|
169
|
+
} else {
|
|
170
|
+
priceSeries.setData([]);
|
|
171
|
+
buyVolumeSeries.setData([]);
|
|
172
|
+
sellVolumeSeries.setData([]);
|
|
173
|
+
}
|
|
174
|
+
setTimeScale();
|
|
175
|
+
}
|
|
176
|
+
function setTimeScale() {
|
|
177
|
+
if (!chart) return;
|
|
178
|
+
chart.timeScale().applyOptions({
|
|
179
|
+
tickMarkFormatter: (time) => formatChartTimestamp(time, timeDelta)
|
|
180
|
+
});
|
|
181
|
+
if (chartData && chartData.pricePoints.length > 0) {
|
|
182
|
+
const now = Math.floor(Date.now() / 1e3);
|
|
183
|
+
const from = now - timeDelta;
|
|
184
|
+
chart.timeScale().setVisibleRange({ from, to: now });
|
|
185
|
+
} else {
|
|
186
|
+
chart.timeScale().fitContent();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function destroyChart() {
|
|
190
|
+
if (chart) {
|
|
191
|
+
chart.remove();
|
|
192
|
+
chart = void 0;
|
|
193
|
+
priceSeries = void 0;
|
|
194
|
+
buyVolumeSeries = void 0;
|
|
195
|
+
sellVolumeSeries = void 0;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
$: if (chartElement && trades.length > 0 && selectedPair && !chart) setupChart();
|
|
199
|
+
$: if (chart && chartData) updateChartData();
|
|
200
|
+
$: if (chart && $lightweightChartsTheme) setChartOptions();
|
|
201
|
+
onMount(() => {
|
|
202
|
+
if (trades.length > 0 && selectedPair) setupChart();
|
|
203
|
+
});
|
|
204
|
+
onDestroy(() => {
|
|
205
|
+
destroyChart();
|
|
26
206
|
});
|
|
27
207
|
</script>
|
|
28
208
|
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
209
|
+
<div
|
|
210
|
+
class="flex h-full flex-col overflow-hidden rounded-lg border bg-gray-50 dark:border-none dark:bg-gray-700"
|
|
211
|
+
>
|
|
212
|
+
<div
|
|
213
|
+
class="flex w-full flex-wrap items-center justify-between gap-2 border-b p-3 dark:border-gray-700"
|
|
214
|
+
>
|
|
215
|
+
<div class="flex items-center gap-2">
|
|
216
|
+
<div class="text-xl text-gray-900 dark:text-white" data-testid="chart-title">Trades</div>
|
|
217
|
+
{#if $query?.isLoading}
|
|
218
|
+
<Spinner class="h-4 w-4" color="white" data-testid="chart-spinner" />
|
|
219
|
+
{/if}
|
|
220
|
+
</div>
|
|
221
|
+
|
|
222
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
223
|
+
{#if pairs.length > 0}
|
|
224
|
+
<div class="flex items-center gap-1">
|
|
225
|
+
<Button
|
|
226
|
+
color="alternative"
|
|
227
|
+
size="xs"
|
|
228
|
+
class="flex items-center gap-1"
|
|
229
|
+
data-testid="pair-selector"
|
|
230
|
+
>
|
|
231
|
+
{pairLabel}
|
|
232
|
+
<ChevronDownSolid class="h-3 w-3" />
|
|
233
|
+
</Button>
|
|
234
|
+
<Dropdown bind:open={dropdownOpen} data-testid="pair-dropdown">
|
|
235
|
+
{#each pairs as pair, idx}
|
|
236
|
+
<DropdownItem on:click={() => selectPair(idx)} data-testid="pair-option-{idx}">
|
|
237
|
+
{getTokenLabel(pair.baseToken)}/{getTokenLabel(pair.quoteToken)}
|
|
238
|
+
</DropdownItem>
|
|
239
|
+
{/each}
|
|
240
|
+
</Dropdown>
|
|
241
|
+
<Button
|
|
242
|
+
color="alternative"
|
|
243
|
+
size="xs"
|
|
244
|
+
on:click={handleFlipPair}
|
|
245
|
+
title="Flip pair"
|
|
246
|
+
data-testid="flip-button"
|
|
247
|
+
>
|
|
248
|
+
<svg
|
|
249
|
+
class="h-4 w-4"
|
|
250
|
+
fill="none"
|
|
251
|
+
stroke="currentColor"
|
|
252
|
+
viewBox="0 0 24 24"
|
|
253
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
254
|
+
>
|
|
255
|
+
<path
|
|
256
|
+
stroke-linecap="round"
|
|
257
|
+
stroke-linejoin="round"
|
|
258
|
+
stroke-width="2"
|
|
259
|
+
d="M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"
|
|
260
|
+
/>
|
|
261
|
+
</svg>
|
|
262
|
+
</Button>
|
|
263
|
+
</div>
|
|
264
|
+
{/if}
|
|
265
|
+
|
|
266
|
+
{#if trades.length > 0}
|
|
267
|
+
<ButtonGroup class="bg-gray-800" data-testid="time-filters">
|
|
268
|
+
{#each TIME_OPTIONS as option}
|
|
269
|
+
<Button
|
|
270
|
+
on:click={() => (timeDelta = option.delta)}
|
|
271
|
+
color={timeDelta === option.delta ? 'primary' : 'alternative'}
|
|
272
|
+
size="xs"
|
|
273
|
+
class="px-2 py-1">{option.label}</Button
|
|
274
|
+
>
|
|
275
|
+
{/each}
|
|
276
|
+
</ButtonGroup>
|
|
277
|
+
{/if}
|
|
278
|
+
</div>
|
|
279
|
+
</div>
|
|
280
|
+
|
|
281
|
+
<div class="relative flex w-full grow items-center justify-center bg-white dark:bg-gray-800">
|
|
282
|
+
{#if $query?.isLoading}
|
|
283
|
+
<div class="text-gray-800 dark:text-gray-400">Loading...</div>
|
|
284
|
+
{:else if $query?.isError}
|
|
285
|
+
<div class="text-red-500" data-testid="chart-error">
|
|
286
|
+
Error: {$query?.error?.message ?? 'Failed to load trades'}
|
|
287
|
+
</div>
|
|
288
|
+
{:else if trades.length === 0 || !selectedPair}
|
|
289
|
+
<div class="text-gray-800 dark:text-gray-400" data-testid="chart-empty">No trades found</div>
|
|
290
|
+
{:else}
|
|
291
|
+
<div
|
|
292
|
+
bind:this={chartElement}
|
|
293
|
+
class="h-full w-full overflow-hidden"
|
|
294
|
+
data-testid="chart-element"
|
|
295
|
+
></div>
|
|
296
|
+
{#if chartData && chartData.pricePoints.length === 0}
|
|
297
|
+
<div
|
|
298
|
+
class="absolute inset-0 flex items-center justify-center bg-white/80 dark:bg-gray-800/80"
|
|
299
|
+
data-testid="chart-no-data"
|
|
300
|
+
>
|
|
301
|
+
<span class="text-gray-800 dark:text-gray-400"
|
|
302
|
+
>No trades found for selected pair and time range</span
|
|
303
|
+
>
|
|
304
|
+
</div>
|
|
305
|
+
{/if}
|
|
306
|
+
{/if}
|
|
307
|
+
</div>
|
|
308
|
+
</div>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { Readable } from 'svelte/store';
|
|
3
|
+
import { type RaindexOrder } from '@rainlanguage/orderbook';
|
|
2
4
|
declare const __propDef: {
|
|
3
5
|
props: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
colorTheme: any;
|
|
7
|
-
lightweightChartsTheme: any;
|
|
6
|
+
order: RaindexOrder;
|
|
7
|
+
lightweightChartsTheme: Readable<Record<string, unknown>>;
|
|
8
8
|
};
|
|
9
9
|
events: {
|
|
10
10
|
[evt: string]: CustomEvent<any>;
|
|
@@ -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,37 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { createQuery } from "@tanstack/svelte-query";
|
|
4
|
-
import {
|
|
5
|
-
getVaultBalanceChanges
|
|
6
|
-
} from "@rainlanguage/orderbook/js_api";
|
|
7
|
-
import TanstackLightweightChartLine from "../charts/TanstackLightweightChartLine.svelte";
|
|
8
|
-
import { QKEY_VAULT_CHANGES } from "../../queries/keys";
|
|
9
|
-
export let vault;
|
|
10
|
-
export let id;
|
|
11
|
-
export let subgraphUrl;
|
|
12
|
-
export let lightweightChartsTheme;
|
|
13
|
-
$: query = createQuery({
|
|
14
|
-
queryKey: [id, QKEY_VAULT_CHANGES + id, QKEY_VAULT_CHANGES],
|
|
15
|
-
queryFn: () => {
|
|
16
|
-
return getVaultBalanceChanges(subgraphUrl || "", vault.id, {
|
|
17
|
-
page: 1,
|
|
18
|
-
pageSize: 1e3
|
|
19
|
-
});
|
|
20
|
-
},
|
|
21
|
-
enabled: !!subgraphUrl
|
|
22
|
-
});
|
|
23
|
-
const Chart = TanstackLightweightChartLine;
|
|
24
|
-
</script>
|
|
1
|
+
<!-- TODO: Issue #1989 -->
|
|
2
|
+
<script></script>
|
|
25
3
|
|
|
4
|
+
<!--
|
|
26
5
|
{#if vault && $query.data}
|
|
27
6
|
<Chart
|
|
28
7
|
title="Balance history"
|
|
29
8
|
priceSymbol={vault.token.symbol}
|
|
30
9
|
{query}
|
|
31
10
|
timeTransform={(d) => timestampSecondsToUTCTimestamp(BigInt(d.timestamp))}
|
|
32
|
-
valueTransform={(d) =>
|
|
33
|
-
bigintToFloat(BigInt(d.newVaultBalance), Number(vault.token.decimals ?? 0))}
|
|
11
|
+
valueTransform={(d) => parseFloat(d.formattedNewBalance)}
|
|
34
12
|
emptyMessage="No deposits or withdrawals found"
|
|
35
13
|
{lightweightChartsTheme}
|
|
36
14
|
/>
|
|
15
|
+
{/if} -->
|
|
16
|
+
|
|
17
|
+
{#if false}
|
|
18
|
+
<div>TODO: Issue #1989</div>
|
|
37
19
|
{/if}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import type { SgVault } from '@rainlanguage/orderbook/js_api';
|
|
3
2
|
declare const __propDef: {
|
|
4
|
-
props:
|
|
5
|
-
vault: SgVault;
|
|
6
|
-
id: string;
|
|
7
|
-
subgraphUrl: string;
|
|
8
|
-
lightweightChartsTheme: any;
|
|
9
|
-
};
|
|
3
|
+
props: Record<string, never>;
|
|
10
4
|
events: {
|
|
11
5
|
[evt: string]: CustomEvent<any>;
|
|
12
6
|
};
|
|
@@ -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,6 +2,7 @@
|
|
|
2
2
|
export let active;
|
|
3
3
|
export let buttonText;
|
|
4
4
|
export let clickHandler;
|
|
5
|
+
export let dataTestId;
|
|
5
6
|
</script>
|
|
6
7
|
|
|
7
8
|
<Button
|
|
@@ -9,6 +10,7 @@ export let clickHandler;
|
|
|
9
10
|
color="alternative"
|
|
10
11
|
class={active ? 'border-2 border-blue-300 dark:border-blue-700' : 'border-2 border-transparent'}
|
|
11
12
|
on:click={clickHandler}
|
|
13
|
+
data-testid={dataTestId}
|
|
12
14
|
>
|
|
13
15
|
{buttonText}
|
|
14
16
|
</Button>
|
|
@@ -2,7 +2,8 @@
|
|
|
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() {
|
|
@@ -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>
|