@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
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
import { CheckCircleOutline } from "flowbite-svelte-icons";
|
|
3
3
|
import { twMerge } from "tailwind-merge";
|
|
4
4
|
import truncateEthAddress from "truncate-eth-address";
|
|
5
|
+
import { useAccount } from "../../providers/wallet/useAccount";
|
|
5
6
|
export let appKitModal;
|
|
6
7
|
export let connected;
|
|
7
|
-
export let signerAddress;
|
|
8
8
|
export let classes = "";
|
|
9
|
+
const { account } = useAccount();
|
|
9
10
|
function handleClick() {
|
|
10
11
|
$appKitModal.open();
|
|
11
12
|
}
|
|
@@ -18,11 +19,11 @@ function handleClick() {
|
|
|
18
19
|
class={twMerge('flex border border-gray-700 px-2 md:px-4 dark:border-gray-200', classes)}
|
|
19
20
|
color={$connected ? 'alternative' : 'primary'}
|
|
20
21
|
>
|
|
21
|
-
{#if $connected && $
|
|
22
|
+
{#if $connected && $account}
|
|
22
23
|
<span class="flex flex-row items-center gap-2 text-sm"
|
|
23
|
-
><CheckCircleOutline color="green" size="sm" />{truncateEthAddress($
|
|
24
|
+
><CheckCircleOutline color="green" size="sm" />{truncateEthAddress($account)}</span
|
|
24
25
|
>
|
|
25
26
|
{:else}
|
|
26
|
-
<span>Connect
|
|
27
|
+
<span>Connect</span>
|
|
27
28
|
{/if}
|
|
28
29
|
</Button>
|
package/dist/consts.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LICENSE_URL = "https://raw.githubusercontent.com/rainlanguage/decentralicense/refs/heads/master/README.md";
|
package/dist/consts.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const LICENSE_URL = 'https://raw.githubusercontent.com/rainlanguage/decentralicense/refs/heads/master/README.md';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare enum DeploymentStepsErrorCode {
|
|
2
|
-
|
|
2
|
+
NO_GUI_PROVIDER = "No GUI provider found.",
|
|
3
|
+
NO_GUI = "Error loading GUI.",
|
|
3
4
|
NO_STRATEGY = "No valid strategy exists at this URL",
|
|
4
5
|
NO_SELECT_TOKENS = "Error loading tokens",
|
|
5
6
|
NO_TOKEN_INFO = "Error loading token information",
|
|
@@ -9,8 +10,11 @@ export declare enum DeploymentStepsErrorCode {
|
|
|
9
10
|
NO_TOKEN_OUTPUTS = "Error loading token outputs",
|
|
10
11
|
NO_GUI_DETAILS = "Error getting GUI details",
|
|
11
12
|
NO_CHAIN = "Unsupported chain ID",
|
|
13
|
+
NO_NETWORK_KEY = "No network key found",
|
|
12
14
|
SERIALIZE_ERROR = "Error serializing state",
|
|
13
|
-
ADD_ORDER_FAILED = "Failed to add order"
|
|
15
|
+
ADD_ORDER_FAILED = "Failed to add order",
|
|
16
|
+
NO_WALLET = "No account address found",
|
|
17
|
+
NO_GUI_CONFIG = "Error getting GUI configuration"
|
|
14
18
|
}
|
|
15
19
|
export declare class DeploymentStepsError extends Error {
|
|
16
20
|
code: DeploymentStepsErrorCode;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { writable } from 'svelte/store';
|
|
2
2
|
export var DeploymentStepsErrorCode;
|
|
3
3
|
(function (DeploymentStepsErrorCode) {
|
|
4
|
-
DeploymentStepsErrorCode["
|
|
4
|
+
DeploymentStepsErrorCode["NO_GUI_PROVIDER"] = "No GUI provider found.";
|
|
5
|
+
DeploymentStepsErrorCode["NO_GUI"] = "Error loading GUI.";
|
|
5
6
|
DeploymentStepsErrorCode["NO_STRATEGY"] = "No valid strategy exists at this URL";
|
|
6
7
|
DeploymentStepsErrorCode["NO_SELECT_TOKENS"] = "Error loading tokens";
|
|
7
8
|
DeploymentStepsErrorCode["NO_TOKEN_INFO"] = "Error loading token information";
|
|
@@ -11,8 +12,11 @@ export var DeploymentStepsErrorCode;
|
|
|
11
12
|
DeploymentStepsErrorCode["NO_TOKEN_OUTPUTS"] = "Error loading token outputs";
|
|
12
13
|
DeploymentStepsErrorCode["NO_GUI_DETAILS"] = "Error getting GUI details";
|
|
13
14
|
DeploymentStepsErrorCode["NO_CHAIN"] = "Unsupported chain ID";
|
|
15
|
+
DeploymentStepsErrorCode["NO_NETWORK_KEY"] = "No network key found";
|
|
14
16
|
DeploymentStepsErrorCode["SERIALIZE_ERROR"] = "Error serializing state";
|
|
15
17
|
DeploymentStepsErrorCode["ADD_ORDER_FAILED"] = "Failed to add order";
|
|
18
|
+
DeploymentStepsErrorCode["NO_WALLET"] = "No account address found";
|
|
19
|
+
DeploymentStepsErrorCode["NO_GUI_CONFIG"] = "Error getting GUI configuration";
|
|
16
20
|
})(DeploymentStepsErrorCode || (DeploymentStepsErrorCode = {}));
|
|
17
21
|
export class DeploymentStepsError extends Error {
|
|
18
22
|
code;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getContext } from 'svelte';
|
|
2
|
+
import { DotrainOrderGui } from '@rainlanguage/orderbook';
|
|
3
|
+
import { DeploymentStepsError, DeploymentStepsErrorCode } from '../errors/DeploymentStepsError';
|
|
4
|
+
export const GUI_CONTEXT_KEY = 'gui-context';
|
|
5
|
+
export function useGui() {
|
|
6
|
+
const gui = getContext(GUI_CONTEXT_KEY);
|
|
7
|
+
if (!gui) {
|
|
8
|
+
DeploymentStepsError.catch(null, DeploymentStepsErrorCode.NO_GUI_PROVIDER);
|
|
9
|
+
}
|
|
10
|
+
return gui;
|
|
11
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { default as DropdownCheckbox } from './components/dropdown/DropdownCheck
|
|
|
6
6
|
export { default as DropdownOrderListAccounts } from './components/dropdown/DropdownOrderListAccounts.svelte';
|
|
7
7
|
export { default as DropdownRadio } from './components/dropdown/DropdownRadio.svelte';
|
|
8
8
|
export { default as Refresh } from './components/icon/Refresh.svelte';
|
|
9
|
-
export { default as
|
|
9
|
+
export { default as CheckboxActiveOrders } from './components/checkbox/CheckboxActiveOrders.svelte';
|
|
10
10
|
export { default as InputOrderHash } from './components/input/InputOrderHash.svelte';
|
|
11
11
|
export { default as CheckboxZeroBalanceVault } from './components/CheckboxZeroBalanceVault.svelte';
|
|
12
12
|
export { default as ListViewOrderbookFilters } from './components/ListViewOrderbookFilters.svelte';
|
|
@@ -64,26 +64,42 @@ export { default as DisclaimerModal } from './components/deployment/DisclaimerMo
|
|
|
64
64
|
export { default as InvalidStrategiesSection } from './components/deployment/InvalidStrategiesSection.svelte';
|
|
65
65
|
export { default as ValidStrategiesSection } from './components/deployment/ValidStrategiesSection.svelte';
|
|
66
66
|
export { default as InputRegistryUrl } from './components/input/InputRegistryUrl.svelte';
|
|
67
|
+
export { default as TransactionList } from './components/transactions/TransactionList.svelte';
|
|
68
|
+
export { default as FixedBottomTransaction } from './components/transactions/FixedBottomTransaction.svelte';
|
|
67
69
|
export type { AppStoresInterface } from './types/appStores.ts';
|
|
68
|
-
export type {
|
|
69
|
-
export {
|
|
70
|
-
export type {
|
|
71
|
-
export type { DepositOrWithdrawModalProps, OrderRemoveModalProps, QuoteDebugModalHandler, DebugTradeModalHandler, DeployModalProps, DisclaimerModalProps } from './types/modal';
|
|
70
|
+
export type { OrderbookConfigSource, OrderbookCfgRef } from '@rainlanguage/orderbook';
|
|
71
|
+
export { TransactionStatusMessage, TransactionStoreErrorMessage, type TransactionArgs, type DeploymentArgs, type VaultActionArgs } from './types/transaction';
|
|
72
|
+
export type { VaultActionModalProps, QuoteDebugModalHandler, DebugTradeModalHandler, DisclaimerModalProps, TransactionConfirmationProps, HandleTransactionConfirmationModal } from './types/modal';
|
|
72
73
|
export type { ValidStrategyDetail, InvalidStrategyDetail } from './types/strategy';
|
|
74
|
+
export type { ToastProps } from './types/toast';
|
|
73
75
|
export { createResolvableQuery, createResolvableInfiniteQuery } from './__mocks__/queries';
|
|
74
|
-
export { formatTimestampSecondsAsLocal, timestampSecondsToUTCTimestamp, promiseTimeout } from './
|
|
76
|
+
export { formatTimestampSecondsAsLocal, timestampSecondsToUTCTimestamp, promiseTimeout } from './services/time';
|
|
75
77
|
export { bigintStringToHex, HEX_INPUT_REGEX } from './utils/hex';
|
|
76
78
|
export { vaultBalanceDisplay } from './utils/vault';
|
|
77
|
-
export { prepareHistoricalOrderChartData } from './services/historicalOrderCharts';
|
|
78
79
|
export { bigintToFloat } from './utils/number';
|
|
79
80
|
export { getExplorerLink } from './services/getExplorerLink';
|
|
81
|
+
export { invalidateTanstackQueries } from './queries/queryClient';
|
|
82
|
+
export { getToastsContext } from './providers/toasts/context';
|
|
80
83
|
export { DEFAULT_PAGE_SIZE, DEFAULT_REFRESH_INTERVAL } from './queries/constants';
|
|
81
84
|
export { QKEY_VAULTS, QKEY_VAULT, QKEY_VAULT_CHANGES, QKEY_ORDERS, QKEY_ORDER, QKEY_ORDER_TRADES_LIST, QKEY_ORDER_QUOTE, QKEY_VAULTS_VOL_LIST, QKEY_ORDER_APY } from './queries/keys';
|
|
82
85
|
export { darkChartTheme, lightChartTheme } from './utils/lightweightChartsThemes';
|
|
83
86
|
export { lightCodeMirrorTheme, darkCodeMirrorTheme } from './utils/codeMirrorThemes';
|
|
84
|
-
export {
|
|
85
|
-
export { mockSettingsStore } from './__mocks__/settings';
|
|
86
|
-
export { default as transactionStore } from './stores/transactionStore';
|
|
87
|
-
export { mockTransactionStore } from './__mocks__/mockTransactionStore';
|
|
87
|
+
export { cachedWritableStore, cachedWritableIntOptional, cachedWritableStringOptional, cachedWritableString } from './storesGeneric/cachedWritableStore';
|
|
88
88
|
export { default as logoLight } from './assets/logo-light.svg';
|
|
89
89
|
export { default as logoDark } from './assets/logo-dark.svg';
|
|
90
|
+
export { default as GuiProvider } from './providers/GuiProvider.svelte';
|
|
91
|
+
export { default as WalletProvider } from './providers/wallet/WalletProvider.svelte';
|
|
92
|
+
export { default as RegistryProvider } from './providers/registry/RegistryProvider.svelte';
|
|
93
|
+
export { default as ToastProvider } from './providers/toasts/ToastProvider.svelte';
|
|
94
|
+
export { default as TransactionProvider } from './providers/transactions/TransactionProvider.svelte';
|
|
95
|
+
export { useGui } from './hooks/useGui';
|
|
96
|
+
export { useAccount } from './providers/wallet/useAccount';
|
|
97
|
+
export { useRegistry } from './providers/registry/useRegistry';
|
|
98
|
+
export { useToasts } from './providers/toasts/useToasts';
|
|
99
|
+
export { useTransactions } from './providers/transactions/useTransactions';
|
|
100
|
+
export { RegistryManager } from './providers/registry/RegistryManager';
|
|
101
|
+
export { TransactionStore } from './models/Transaction';
|
|
102
|
+
export { TransactionManager } from './providers/transactions/TransactionManager';
|
|
103
|
+
export { mockPageStore } from './__mocks__/stores';
|
|
104
|
+
export { mockConfig } from './__mocks__/settings';
|
|
105
|
+
export { mockSettingsStore } from './__mocks__/settings';
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ export { default as DropdownCheckbox } from './components/dropdown/DropdownCheck
|
|
|
7
7
|
export { default as DropdownOrderListAccounts } from './components/dropdown/DropdownOrderListAccounts.svelte';
|
|
8
8
|
export { default as DropdownRadio } from './components/dropdown/DropdownRadio.svelte';
|
|
9
9
|
export { default as Refresh } from './components/icon/Refresh.svelte';
|
|
10
|
-
export { default as
|
|
10
|
+
export { default as CheckboxActiveOrders } from './components/checkbox/CheckboxActiveOrders.svelte';
|
|
11
11
|
export { default as InputOrderHash } from './components/input/InputOrderHash.svelte';
|
|
12
12
|
export { default as CheckboxZeroBalanceVault } from './components/CheckboxZeroBalanceVault.svelte';
|
|
13
13
|
export { default as ListViewOrderbookFilters } from './components/ListViewOrderbookFilters.svelte';
|
|
@@ -65,25 +65,45 @@ export { default as DisclaimerModal } from './components/deployment/DisclaimerMo
|
|
|
65
65
|
export { default as InvalidStrategiesSection } from './components/deployment/InvalidStrategiesSection.svelte';
|
|
66
66
|
export { default as ValidStrategiesSection } from './components/deployment/ValidStrategiesSection.svelte';
|
|
67
67
|
export { default as InputRegistryUrl } from './components/input/InputRegistryUrl.svelte';
|
|
68
|
-
export {
|
|
68
|
+
export { default as TransactionList } from './components/transactions/TransactionList.svelte';
|
|
69
|
+
export { default as FixedBottomTransaction } from './components/transactions/FixedBottomTransaction.svelte';
|
|
70
|
+
export { TransactionStatusMessage, TransactionStoreErrorMessage } from './types/transaction';
|
|
69
71
|
// Functions
|
|
70
72
|
export { createResolvableQuery, createResolvableInfiniteQuery } from './__mocks__/queries';
|
|
71
|
-
export { formatTimestampSecondsAsLocal, timestampSecondsToUTCTimestamp, promiseTimeout } from './
|
|
73
|
+
export { formatTimestampSecondsAsLocal, timestampSecondsToUTCTimestamp, promiseTimeout } from './services/time';
|
|
72
74
|
export { bigintStringToHex, HEX_INPUT_REGEX } from './utils/hex';
|
|
73
75
|
export { vaultBalanceDisplay } from './utils/vault';
|
|
74
|
-
export { prepareHistoricalOrderChartData } from './services/historicalOrderCharts';
|
|
75
76
|
export { bigintToFloat } from './utils/number';
|
|
76
77
|
export { getExplorerLink } from './services/getExplorerLink';
|
|
78
|
+
export { invalidateTanstackQueries } from './queries/queryClient';
|
|
79
|
+
export { getToastsContext } from './providers/toasts/context';
|
|
77
80
|
// Constants
|
|
78
81
|
export { DEFAULT_PAGE_SIZE, DEFAULT_REFRESH_INTERVAL } from './queries/constants';
|
|
79
82
|
export { QKEY_VAULTS, QKEY_VAULT, QKEY_VAULT_CHANGES, QKEY_ORDERS, QKEY_ORDER, QKEY_ORDER_TRADES_LIST, QKEY_ORDER_QUOTE, QKEY_VAULTS_VOL_LIST, QKEY_ORDER_APY } from './queries/keys';
|
|
80
83
|
export { darkChartTheme, lightChartTheme } from './utils/lightweightChartsThemes';
|
|
81
84
|
export { lightCodeMirrorTheme, darkCodeMirrorTheme } from './utils/codeMirrorThemes';
|
|
82
85
|
// Stores
|
|
83
|
-
export {
|
|
84
|
-
export { mockSettingsStore } from './__mocks__/settings';
|
|
85
|
-
export { default as transactionStore } from './stores/transactionStore';
|
|
86
|
-
export { mockTransactionStore } from './__mocks__/mockTransactionStore';
|
|
86
|
+
export { cachedWritableStore, cachedWritableIntOptional, cachedWritableStringOptional, cachedWritableString } from './storesGeneric/cachedWritableStore';
|
|
87
87
|
// Assets
|
|
88
88
|
export { default as logoLight } from './assets/logo-light.svg';
|
|
89
89
|
export { default as logoDark } from './assets/logo-dark.svg';
|
|
90
|
+
// Providers
|
|
91
|
+
export { default as GuiProvider } from './providers/GuiProvider.svelte';
|
|
92
|
+
export { default as WalletProvider } from './providers/wallet/WalletProvider.svelte';
|
|
93
|
+
export { default as RegistryProvider } from './providers/registry/RegistryProvider.svelte';
|
|
94
|
+
export { default as ToastProvider } from './providers/toasts/ToastProvider.svelte';
|
|
95
|
+
export { default as TransactionProvider } from './providers/transactions/TransactionProvider.svelte';
|
|
96
|
+
// Hooks
|
|
97
|
+
export { useGui } from './hooks/useGui';
|
|
98
|
+
export { useAccount } from './providers/wallet/useAccount';
|
|
99
|
+
export { useRegistry } from './providers/registry/useRegistry';
|
|
100
|
+
export { useToasts } from './providers/toasts/useToasts';
|
|
101
|
+
export { useTransactions } from './providers/transactions/useTransactions';
|
|
102
|
+
// Classes
|
|
103
|
+
export { RegistryManager } from './providers/registry/RegistryManager';
|
|
104
|
+
export { TransactionStore } from './models/Transaction';
|
|
105
|
+
export { TransactionManager } from './providers/transactions/TransactionManager';
|
|
106
|
+
// Mocks
|
|
107
|
+
export { mockPageStore } from './__mocks__/stores';
|
|
108
|
+
export { mockConfig } from './__mocks__/settings';
|
|
109
|
+
export { mockSettingsStore } from './__mocks__/settings';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { TransactionStatusMessage, TransactionStoreErrorMessage } from '../types/transaction';
|
|
2
|
+
import type { TransactionArgs } from '../types/transaction';
|
|
3
|
+
import type { Config } from '@wagmi/core';
|
|
4
|
+
import { type Writable } from 'svelte/store';
|
|
5
|
+
/**
|
|
6
|
+
* Represents the state of a transaction.
|
|
7
|
+
* @typedef {Object} TransactionStoreState
|
|
8
|
+
* @property {TransactionName} name - The user-friendly name of the transaction (e.g., "Order Removal").
|
|
9
|
+
* @property {TransactionStatusMessage} status - The current status of the transaction (e.g., PENDING_RECEIPT, SUCCESS, ERROR).
|
|
10
|
+
* @property {TransactionStoreErrorMessage} [errorDetails] - Optional error message if the transaction failed.
|
|
11
|
+
* @property {Array<{link: string, label: string}>} links - An array of relevant links for the transaction (e.g., explorer link, link to the affected entity).
|
|
12
|
+
*/
|
|
13
|
+
export type TransactionStoreState = {
|
|
14
|
+
name: string;
|
|
15
|
+
status: TransactionStatusMessage;
|
|
16
|
+
errorDetails?: TransactionStoreErrorMessage;
|
|
17
|
+
links: {
|
|
18
|
+
link: string;
|
|
19
|
+
label: string;
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Interface defining the structure of a transaction object.
|
|
24
|
+
* @interface Transaction
|
|
25
|
+
* @property {Writable<TransactionStoreState>} state - A writable store holding the current state of the transaction.
|
|
26
|
+
*/
|
|
27
|
+
export type Transaction = {
|
|
28
|
+
readonly state: Writable<TransactionStoreState>;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Manages the lifecycle of an individual transaction, including waiting for
|
|
32
|
+
* blockchain confirmation (receipt) and subgraph indexing.
|
|
33
|
+
* It exposes its state as a Svelte writable store.
|
|
34
|
+
* @class TransactionStore
|
|
35
|
+
* @implements {Transaction}
|
|
36
|
+
*/
|
|
37
|
+
export declare class TransactionStore implements Transaction {
|
|
38
|
+
private name;
|
|
39
|
+
private config;
|
|
40
|
+
private txHash;
|
|
41
|
+
private networkKey;
|
|
42
|
+
private links;
|
|
43
|
+
private onSuccess;
|
|
44
|
+
private onError;
|
|
45
|
+
private awaitSubgraphConfig?;
|
|
46
|
+
readonly state: Writable<TransactionStoreState>;
|
|
47
|
+
/**
|
|
48
|
+
* Creates a new TransactionStore instance.
|
|
49
|
+
* @param {TransactionArgs & { config: Config }} args - Configuration arguments for the transaction, including the wagmi `Config`.
|
|
50
|
+
* @param {() => void} onSuccess - Callback invoked when the transaction successfully completes (including indexing).
|
|
51
|
+
* @param {() => void} onError - Callback invoked if the transaction fails at any stage.
|
|
52
|
+
*/
|
|
53
|
+
constructor(args: TransactionArgs & {
|
|
54
|
+
config: Config;
|
|
55
|
+
}, onSuccess: () => void, onError: () => void);
|
|
56
|
+
/**
|
|
57
|
+
* Updates the internal Svelte store with new state values.
|
|
58
|
+
* @param {Partial<TransactionStoreState>} partialState - An object containing the state properties to update.
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
61
|
+
private updateState;
|
|
62
|
+
/**
|
|
63
|
+
* Executes the transaction and begins monitoring its status
|
|
64
|
+
* @returns {Promise<void>}
|
|
65
|
+
*/
|
|
66
|
+
execute(): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Waits for the transaction receipt to be confirmed on the blockchain
|
|
69
|
+
* @param {Hex} hash - The transaction hash to monitor
|
|
70
|
+
* @returns {Promise<void>}
|
|
71
|
+
* @private
|
|
72
|
+
*/
|
|
73
|
+
private waitForTxReceipt;
|
|
74
|
+
/**
|
|
75
|
+
* Monitors the transaction indexing status in the subgraph
|
|
76
|
+
* @returns {Promise<void>}
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
private indexTransaction;
|
|
80
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { waitForTransactionReceipt } from '@wagmi/core';
|
|
2
|
+
import { TransactionStatusMessage, TransactionStoreErrorMessage } from '../types/transaction';
|
|
3
|
+
import { awaitSubgraphIndexing } from '../services/awaitTransactionIndexing';
|
|
4
|
+
import { writable } from 'svelte/store';
|
|
5
|
+
/**
|
|
6
|
+
* Manages the lifecycle of an individual transaction, including waiting for
|
|
7
|
+
* blockchain confirmation (receipt) and subgraph indexing.
|
|
8
|
+
* It exposes its state as a Svelte writable store.
|
|
9
|
+
* @class TransactionStore
|
|
10
|
+
* @implements {Transaction}
|
|
11
|
+
*/
|
|
12
|
+
export class TransactionStore {
|
|
13
|
+
name;
|
|
14
|
+
config;
|
|
15
|
+
txHash;
|
|
16
|
+
networkKey;
|
|
17
|
+
links;
|
|
18
|
+
onSuccess;
|
|
19
|
+
onError;
|
|
20
|
+
// Optional subgraphConfig for transactions that need to wait for indexing (e.g. deposit, but not approval)
|
|
21
|
+
awaitSubgraphConfig;
|
|
22
|
+
state;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new TransactionStore instance.
|
|
25
|
+
* @param {TransactionArgs & { config: Config }} args - Configuration arguments for the transaction, including the wagmi `Config`.
|
|
26
|
+
* @param {() => void} onSuccess - Callback invoked when the transaction successfully completes (including indexing).
|
|
27
|
+
* @param {() => void} onError - Callback invoked if the transaction fails at any stage.
|
|
28
|
+
*/
|
|
29
|
+
constructor(args, onSuccess, onError) {
|
|
30
|
+
this.config = args.config;
|
|
31
|
+
this.txHash = args.txHash;
|
|
32
|
+
this.name = args.name;
|
|
33
|
+
this.networkKey = args.networkKey;
|
|
34
|
+
this.links = args.toastLinks;
|
|
35
|
+
this.state = writable({
|
|
36
|
+
name: this.name,
|
|
37
|
+
status: TransactionStatusMessage.IDLE,
|
|
38
|
+
links: this.links
|
|
39
|
+
});
|
|
40
|
+
this.awaitSubgraphConfig = args.awaitSubgraphConfig;
|
|
41
|
+
this.onSuccess = onSuccess;
|
|
42
|
+
this.onError = onError;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Updates the internal Svelte store with new state values.
|
|
46
|
+
* @param {Partial<TransactionStoreState>} partialState - An object containing the state properties to update.
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
49
|
+
updateState(partialState) {
|
|
50
|
+
this.state.update((currentState) => ({
|
|
51
|
+
...currentState,
|
|
52
|
+
...partialState
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Executes the transaction and begins monitoring its status
|
|
57
|
+
* @returns {Promise<void>}
|
|
58
|
+
*/
|
|
59
|
+
async execute() {
|
|
60
|
+
this.updateState({
|
|
61
|
+
status: TransactionStatusMessage.PENDING_RECEIPT
|
|
62
|
+
});
|
|
63
|
+
await this.waitForTxReceipt(this.txHash);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Waits for the transaction receipt to be confirmed on the blockchain
|
|
67
|
+
* @param {Hex} hash - The transaction hash to monitor
|
|
68
|
+
* @returns {Promise<void>}
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
71
|
+
async waitForTxReceipt(hash) {
|
|
72
|
+
try {
|
|
73
|
+
await waitForTransactionReceipt(this.config, { hash });
|
|
74
|
+
if (this.awaitSubgraphConfig) {
|
|
75
|
+
await this.indexTransaction();
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
this.updateState({
|
|
79
|
+
status: TransactionStatusMessage.SUCCESS
|
|
80
|
+
});
|
|
81
|
+
return this.onSuccess();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
this.updateState({
|
|
86
|
+
status: TransactionStatusMessage.ERROR,
|
|
87
|
+
errorDetails: TransactionStoreErrorMessage.RECEIPT_FAILED
|
|
88
|
+
});
|
|
89
|
+
return this.onError();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Monitors the transaction indexing status in the subgraph
|
|
94
|
+
* @returns {Promise<void>}
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
async indexTransaction() {
|
|
98
|
+
if (!this.awaitSubgraphConfig)
|
|
99
|
+
return;
|
|
100
|
+
this.updateState({
|
|
101
|
+
status: TransactionStatusMessage.PENDING_SUBGRAPH
|
|
102
|
+
});
|
|
103
|
+
const result = await awaitSubgraphIndexing(this.awaitSubgraphConfig);
|
|
104
|
+
if (result.error === TransactionStoreErrorMessage.SUBGRAPH_TIMEOUT_ERROR) {
|
|
105
|
+
this.updateState({
|
|
106
|
+
status: TransactionStatusMessage.ERROR,
|
|
107
|
+
errorDetails: TransactionStoreErrorMessage.SUBGRAPH_TIMEOUT_ERROR
|
|
108
|
+
});
|
|
109
|
+
return this.onError();
|
|
110
|
+
}
|
|
111
|
+
if (result.value) {
|
|
112
|
+
this.updateState({
|
|
113
|
+
status: TransactionStatusMessage.SUCCESS
|
|
114
|
+
});
|
|
115
|
+
const newOrderHash = result.value.orderHash;
|
|
116
|
+
// If we have a new order hash, add the "View order" link
|
|
117
|
+
if (newOrderHash) {
|
|
118
|
+
const newLink = {
|
|
119
|
+
link: `/orders/${this.networkKey}-${newOrderHash}`,
|
|
120
|
+
label: 'View order'
|
|
121
|
+
};
|
|
122
|
+
this.updateState({
|
|
123
|
+
links: [newLink, ...this.links]
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return this.onSuccess();
|
|
127
|
+
}
|
|
128
|
+
this.updateState({
|
|
129
|
+
status: TransactionStatusMessage.ERROR,
|
|
130
|
+
errorDetails: TransactionStoreErrorMessage.SUBGRAPH_FAILED
|
|
131
|
+
});
|
|
132
|
+
return this.onError();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { DotrainOrderGui } from '@rainlanguage/orderbook';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
gui: DotrainOrderGui;
|
|
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 GuiProviderProps = typeof __propDef.props;
|
|
17
|
+
export type GuiProviderEvents = typeof __propDef.events;
|
|
18
|
+
export type GuiProviderSlots = typeof __propDef.slots;
|
|
19
|
+
export default class GuiProvider extends SvelteComponent<GuiProviderProps, GuiProviderEvents, GuiProviderSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manages registry URL settings, persisting values in localStorage and URL parameters
|
|
3
|
+
*/
|
|
4
|
+
export declare class RegistryManager {
|
|
5
|
+
/** The default registry URL to fall back to */
|
|
6
|
+
private defaultRegistry;
|
|
7
|
+
/** The currently selected registry URL */
|
|
8
|
+
private currentRegistry;
|
|
9
|
+
/** Key used for localStorage and URL parameters */
|
|
10
|
+
private static STORAGE_KEY;
|
|
11
|
+
/**
|
|
12
|
+
* Create a new RegistryManager
|
|
13
|
+
* @param defaultRegistry The default registry URL to use.
|
|
14
|
+
*/
|
|
15
|
+
constructor(defaultRegistry: string);
|
|
16
|
+
/**
|
|
17
|
+
* Initialize registry from URL param or local storage
|
|
18
|
+
* @returns The registry URL to use
|
|
19
|
+
*/
|
|
20
|
+
private loadRegistryFromStorageOrUrl;
|
|
21
|
+
/**
|
|
22
|
+
* Get the registry from the URL param
|
|
23
|
+
* @returns The registry value from URL or null if not present
|
|
24
|
+
* @throws Error if URL parsing fails
|
|
25
|
+
*/
|
|
26
|
+
private getRegistryParamFromUrl;
|
|
27
|
+
/**
|
|
28
|
+
* Save the registry to local storage
|
|
29
|
+
* @param registry The registry URL to save
|
|
30
|
+
* @throws Error if localStorage is not available
|
|
31
|
+
*/
|
|
32
|
+
private setRegistryToLocalStorage;
|
|
33
|
+
/**
|
|
34
|
+
* Retrieve the registry from local storage
|
|
35
|
+
* @returns The stored registry URL or null if not found
|
|
36
|
+
* @throws Error if localStorage is not available
|
|
37
|
+
*/
|
|
38
|
+
private getRegistryFromLocalStorage;
|
|
39
|
+
/**
|
|
40
|
+
* Get the currently active registry
|
|
41
|
+
* @returns The current registry URL, falling back to default if not set
|
|
42
|
+
*/
|
|
43
|
+
getCurrentRegistry(): string;
|
|
44
|
+
/**
|
|
45
|
+
* Set the registry and update both localStorage and URL
|
|
46
|
+
* @param registry The new registry URL to set
|
|
47
|
+
*/
|
|
48
|
+
setRegistry(registry: string): void;
|
|
49
|
+
/**
|
|
50
|
+
* Reset to the default registry, clearing both localStorage and URL param
|
|
51
|
+
* @throws Error if localStorage is not available
|
|
52
|
+
*/
|
|
53
|
+
resetToDefault(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Update the URL param to reflect the current or specified registry
|
|
56
|
+
* @param value The registry value to set in URL, defaults to current registry
|
|
57
|
+
* @throws Error if URL manipulation fails
|
|
58
|
+
*/
|
|
59
|
+
updateUrlWithRegistry(value?: string | null): void;
|
|
60
|
+
/**
|
|
61
|
+
* Check if the current registry is custom (different from the default)
|
|
62
|
+
* @returns True if using a non-default registry
|
|
63
|
+
*/
|
|
64
|
+
isCustomRegistry(): boolean;
|
|
65
|
+
}
|