@rainlanguage/ui-components 0.0.1-alpha.10 → 0.0.1-alpha.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__fixtures__/orderDetail.d.ts +1 -1
- package/dist/__mocks__/MockComponent.svelte +4 -0
- package/dist/__mocks__/MockComponent.svelte.d.ts +3 -1
- package/dist/__mocks__/mockTransactionStore.d.ts +3 -21
- package/dist/__mocks__/mockTransactionStore.js +26 -13
- package/dist/__mocks__/settings.d.ts +6 -2
- package/dist/__mocks__/settings.js +6 -1
- package/dist/__mocks__/stores.d.ts +87 -20
- package/dist/__mocks__/stores.js +30 -21
- package/dist/components/ButtonLoading.svelte +1 -1
- package/dist/components/ButtonVaultLink.svelte +3 -3
- package/dist/components/ButtonVaultLink.svelte.d.ts +1 -1
- package/dist/components/CheckboxMyItemsOnly.svelte +3 -2
- package/dist/components/CheckboxMyItemsOnly.svelte.d.ts +2 -3
- package/dist/components/CheckboxZeroBalanceVault.svelte.d.ts +2 -2
- package/dist/components/CodeMirrorDotrain.svelte +4 -0
- package/dist/components/CodeMirrorDotrain.svelte.d.ts +1 -0
- package/dist/components/CodeMirrorRainlang.svelte +12 -4
- package/dist/components/CodeMirrorRainlang.svelte.d.ts +1 -1
- package/dist/components/EditableSpan.svelte +3 -14
- package/dist/components/EditableSpan.svelte.d.ts +0 -1
- package/dist/components/Hash.svelte +3 -3
- package/dist/components/License.svelte +5 -4
- package/dist/components/ListViewOrderbookFilters.svelte +15 -14
- package/dist/components/ListViewOrderbookFilters.svelte.d.ts +9 -13
- package/dist/components/OrderOrVaultHash.svelte +10 -7
- package/dist/components/OrderOrVaultHash.svelte.d.ts +1 -1
- package/dist/components/PageHeader.svelte +20 -22
- package/dist/components/PageHeader.svelte.d.ts +1 -0
- package/dist/components/TanstackAppTable.svelte +2 -3
- package/dist/components/TanstackAppTable.svelte.d.ts +1 -1
- package/dist/components/ToastDetail.svelte +16 -0
- package/dist/components/ToastDetail.svelte.d.ts +19 -0
- package/dist/components/Tooltip.svelte +8 -0
- package/dist/components/Tooltip.svelte.d.ts +21 -0
- package/dist/components/charts/OrderTradesChart.svelte +3 -2
- package/dist/components/charts/TanstackLightweightChartLine.svelte +5 -9
- package/dist/components/charts/VaultBalanceChart.svelte +6 -6
- package/dist/components/charts/VaultBalanceChart.svelte.d.ts +1 -1
- package/dist/components/charts/transformAndSortData.d.ts +24 -0
- package/dist/components/charts/transformAndSortData.js +111 -0
- package/dist/components/checkbox/CheckboxActiveOrders.svelte +11 -0
- package/dist/components/checkbox/CheckboxActiveOrders.svelte.d.ts +19 -0
- package/dist/components/deployment/ComposedRainlangModal.svelte +7 -5
- package/dist/components/deployment/ComposedRainlangModal.svelte.d.ts +1 -4
- package/dist/components/deployment/DeploymentSectionHeader.svelte +7 -4
- package/dist/components/deployment/DeploymentSteps.svelte +181 -155
- package/dist/components/deployment/DeploymentSteps.svelte.d.ts +6 -13
- package/dist/components/deployment/DeploymentsSection.svelte +18 -14
- package/dist/components/deployment/DepositInput.svelte +31 -14
- package/dist/components/deployment/DepositInput.svelte.d.ts +1 -2
- package/dist/components/deployment/FieldDefinitionInput.svelte +20 -14
- package/dist/components/deployment/FieldDefinitionInput.svelte.d.ts +1 -2
- package/dist/components/deployment/SelectToken.svelte +12 -3
- package/dist/components/deployment/SelectToken.svelte.d.ts +1 -2
- package/dist/components/deployment/StrategyPage.svelte +6 -2
- package/dist/components/deployment/TokenIOInput.svelte +15 -5
- package/dist/components/deployment/TokenIOInput.svelte.d.ts +1 -2
- package/dist/components/deployment/handleDeployment.d.ts +11 -0
- package/dist/components/deployment/handleDeployment.js +33 -0
- package/dist/components/detail/OrderDetail.svelte +51 -44
- package/dist/components/detail/OrderDetail.svelte.d.ts +11 -8
- package/dist/components/detail/TanstackOrderQuote.svelte +11 -7
- package/dist/components/detail/TanstackOrderQuote.svelte.d.ts +1 -1
- package/dist/components/detail/VaultDetail.svelte +33 -42
- package/dist/components/detail/VaultDetail.svelte.d.ts +11 -11
- package/dist/components/dropdown/DropdownActiveSubgraphs.svelte.d.ts +4 -4
- package/dist/components/dropdown/DropdownOrderListAccounts.svelte.d.ts +3 -3
- package/dist/components/icon/Refresh.svelte +2 -1
- package/dist/components/icon/Refresh.svelte.d.ts +1 -0
- package/dist/components/input/InputOrderHash.svelte +1 -1
- package/dist/components/input/InputOrderHash.svelte.d.ts +2 -2
- package/dist/components/input/InputRegistryUrl.svelte +36 -14
- package/dist/components/input/InputToken.svelte +2 -2
- package/dist/components/input/InputTokenAmount.svelte +1 -1
- package/dist/components/tables/OrderAPY.svelte +4 -9
- package/dist/components/tables/OrderTradesListTable.svelte +7 -3
- package/dist/components/tables/OrderVaultsVolTable.svelte +11 -2
- package/dist/components/tables/OrdersListTable.svelte +24 -24
- package/dist/components/tables/OrdersListTable.svelte.d.ts +1 -7
- package/dist/components/tables/VaultBalanceChangesTable.svelte +8 -6
- package/dist/components/tables/VaultsListTable.svelte +48 -57
- package/dist/components/tables/VaultsListTable.svelte.d.ts +13 -20
- package/dist/components/wallet/WalletConnect.svelte +5 -4
- package/dist/components/wallet/WalletConnect.svelte.d.ts +0 -1
- package/dist/consts.d.ts +1 -0
- package/dist/consts.js +1 -0
- package/dist/errors/DeploymentStepsError.d.ts +5 -2
- package/dist/errors/DeploymentStepsError.js +4 -1
- package/dist/hooks/useGui.d.ts +3 -0
- package/dist/hooks/useGui.js +11 -0
- package/dist/index.d.ts +19 -7
- package/dist/index.js +21 -6
- package/dist/providers/GuiProvider.svelte +8 -0
- package/dist/providers/GuiProvider.svelte.d.ts +21 -0
- package/dist/providers/registry/RegistryManager.d.ts +65 -0
- package/dist/providers/registry/RegistryManager.js +133 -0
- package/dist/providers/registry/RegistryProvider.svelte +6 -0
- package/dist/providers/registry/RegistryProvider.svelte.d.ts +21 -0
- package/dist/providers/registry/context.d.ts +10 -0
- package/dist/providers/registry/context.js +46 -0
- package/dist/providers/registry/useRegistry.d.ts +7 -0
- package/dist/providers/registry/useRegistry.js +29 -0
- package/dist/providers/toasts/ToastProvider.svelte +17 -0
- package/dist/providers/toasts/ToastProvider.svelte.d.ts +22 -0
- package/dist/providers/toasts/context.d.ts +11 -0
- package/dist/providers/toasts/context.js +19 -0
- package/dist/providers/toasts/useToasts.d.ts +12 -0
- package/dist/providers/toasts/useToasts.js +54 -0
- package/dist/providers/wallet/WalletProvider.svelte +7 -0
- package/dist/providers/wallet/WalletProvider.svelte.d.ts +21 -0
- package/dist/providers/wallet/context.d.ts +10 -0
- package/dist/providers/wallet/context.js +47 -0
- package/dist/providers/wallet/useAccount.d.ts +8 -0
- package/dist/providers/wallet/useAccount.js +148 -0
- package/dist/queries/queryClient.d.ts +1 -1
- package/dist/queries/queryClient.js +11 -6
- package/dist/services/awaitTransactionIndexing.d.ts +163 -0
- package/dist/services/awaitTransactionIndexing.js +122 -0
- package/dist/services/handleShareChoices.d.ts +2 -2
- package/dist/services/handleShareChoices.js +7 -2
- package/dist/services/historicalOrderCharts.d.ts +1 -1
- package/dist/services/historicalOrderCharts.js +1 -1
- package/dist/services/index.d.ts +2 -1
- package/dist/services/index.js +2 -1
- package/dist/services/loadRegistryUrl.d.ts +2 -0
- package/dist/services/loadRegistryUrl.js +19 -0
- package/dist/services/registry.d.ts +6 -0
- package/dist/services/registry.js +33 -77
- package/dist/services/time.d.ts +12 -0
- package/dist/services/time.js +88 -6
- package/dist/stores/transactionStore.d.ts +9 -12
- package/dist/stores/transactionStore.js +38 -61
- package/dist/storesGeneric/cachedWritableStore.d.ts +57 -0
- package/dist/storesGeneric/cachedWritableStore.js +93 -0
- package/dist/types/account.d.ts +3 -0
- package/dist/types/account.js +1 -0
- package/dist/types/appStores.d.ts +5 -4
- package/dist/types/modal.d.ts +1 -1
- package/dist/types/strategy.d.ts +1 -1
- package/dist/types/toast.d.ts +6 -0
- package/dist/types/toast.js +1 -0
- package/dist/types/transaction.d.ts +3 -3
- package/dist/utils/constructHashLink.d.ts +23 -0
- package/dist/utils/constructHashLink.js +110 -0
- package/dist/utils/vault.d.ts +1 -1
- package/package.json +34 -34
- package/dist/components/deployment/DepositsSection.svelte +0 -8
- package/dist/components/deployment/DepositsSection.svelte.d.ts +0 -20
- package/dist/components/deployment/FieldDefinitionsSection.svelte +0 -9
- package/dist/components/deployment/FieldDefinitionsSection.svelte.d.ts +0 -20
- package/dist/components/deployment/SelectTokensSection.svelte +0 -17
- package/dist/components/deployment/SelectTokensSection.svelte.d.ts +0 -21
- package/dist/components/deployment/TokenIOSection.svelte +0 -17
- package/dist/components/deployment/TokenIOSection.svelte.d.ts +0 -21
- package/dist/components/deployment/getDeploymentTransactionArgs.d.ts +0 -17
- package/dist/components/deployment/getDeploymentTransactionArgs.js +0 -24
- package/dist/components/detail/DepositOrWithdrawButtons.svelte +0 -44
- package/dist/components/detail/DepositOrWithdrawButtons.svelte.d.ts +0 -26
- package/dist/components/dropdown/DropdownOrderStatus.svelte +0 -31
- package/dist/components/dropdown/DropdownOrderStatus.svelte.d.ts +0 -19
- package/dist/utils/time.d.ts +0 -12
- package/dist/utils/time.js +0 -27
|
@@ -1,22 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
error: string;
|
|
5
|
-
hash: string;
|
|
6
|
-
data: null;
|
|
7
|
-
functionName: string;
|
|
8
|
-
message: string;
|
|
1
|
+
import { type TransactionState, type TransactionStore } from '../stores/transactionStore';
|
|
2
|
+
export declare const mockTransactionStore: Partial<TransactionStore> & {
|
|
3
|
+
mockSetSubscribeValue: (value: Partial<TransactionState>) => void;
|
|
9
4
|
};
|
|
10
|
-
export declare const mockTransactionStore: {
|
|
11
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<MockTransactionStoreState>, invalidate?: import("svelte/store").Invalidator<MockTransactionStoreState> | undefined) => import("svelte/store").Unsubscriber;
|
|
12
|
-
set: (this: void, value: MockTransactionStoreState) => void;
|
|
13
|
-
reset: () => void;
|
|
14
|
-
handleDeploymentTransaction: () => Promise<void>;
|
|
15
|
-
checkingWalletAllowance: (message?: string) => void;
|
|
16
|
-
awaitWalletConfirmation: (message?: string) => void;
|
|
17
|
-
awaitApprovalTx: (hash: string) => void;
|
|
18
|
-
transactionSuccess: (hash: string, message?: string) => void;
|
|
19
|
-
transactionError: (error: TransactionErrorMessage, hash?: string) => void;
|
|
20
|
-
mockSetSubscribeValue: (value: Partial<MockTransactionStoreState>) => void;
|
|
21
|
-
};
|
|
22
|
-
export {};
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
import { writable } from 'svelte/store';
|
|
2
|
-
import { TransactionStatus, TransactionErrorMessage } from '../stores/transactionStore';
|
|
3
|
-
const initialState = {
|
|
4
|
-
status: TransactionStatus.IDLE,
|
|
5
|
-
error: '',
|
|
6
|
-
hash: '',
|
|
7
|
-
data: null,
|
|
8
|
-
functionName: '',
|
|
9
|
-
message: ''
|
|
10
|
-
};
|
|
2
|
+
import { TransactionStatus, initialState, TransactionErrorMessage } from '../stores/transactionStore';
|
|
11
3
|
const mockTransactionWritable = writable(initialState);
|
|
12
4
|
export const mockTransactionStore = {
|
|
13
5
|
subscribe: mockTransactionWritable.subscribe,
|
|
14
|
-
set: mockTransactionWritable.set,
|
|
15
6
|
reset: () => mockTransactionWritable.set(initialState),
|
|
16
7
|
handleDeploymentTransaction: async () => {
|
|
17
8
|
mockTransactionWritable.update((state) => ({
|
|
@@ -20,6 +11,25 @@ export const mockTransactionStore = {
|
|
|
20
11
|
message: 'Strategy deployed successfully!',
|
|
21
12
|
hash: '0x123'
|
|
22
13
|
}));
|
|
14
|
+
return Promise.resolve();
|
|
15
|
+
},
|
|
16
|
+
handleDepositOrWithdrawTransaction: async () => {
|
|
17
|
+
mockTransactionWritable.update((state) => ({
|
|
18
|
+
...state,
|
|
19
|
+
status: TransactionStatus.SUCCESS,
|
|
20
|
+
message: 'Transaction successful!',
|
|
21
|
+
hash: '0x456'
|
|
22
|
+
}));
|
|
23
|
+
return Promise.resolve();
|
|
24
|
+
},
|
|
25
|
+
handleRemoveOrderTransaction: async () => {
|
|
26
|
+
mockTransactionWritable.update((state) => ({
|
|
27
|
+
...state,
|
|
28
|
+
status: TransactionStatus.SUCCESS,
|
|
29
|
+
message: 'Order removed successfully',
|
|
30
|
+
hash: '0x789'
|
|
31
|
+
}));
|
|
32
|
+
return Promise.resolve();
|
|
23
33
|
},
|
|
24
34
|
checkingWalletAllowance: (message = '') => mockTransactionWritable.update((state) => ({
|
|
25
35
|
...state,
|
|
@@ -35,13 +45,15 @@ export const mockTransactionStore = {
|
|
|
35
45
|
...state,
|
|
36
46
|
hash,
|
|
37
47
|
status: TransactionStatus.PENDING_APPROVAL,
|
|
38
|
-
message: ''
|
|
48
|
+
message: 'Approving token spend...'
|
|
39
49
|
})),
|
|
40
|
-
transactionSuccess: (hash, message = '') => mockTransactionWritable.update((state) => ({
|
|
50
|
+
transactionSuccess: (hash, message = '', newOrderHash = '', network = '') => mockTransactionWritable.update((state) => ({
|
|
41
51
|
...state,
|
|
42
52
|
status: TransactionStatus.SUCCESS,
|
|
43
53
|
hash,
|
|
44
|
-
message
|
|
54
|
+
message,
|
|
55
|
+
newOrderHash,
|
|
56
|
+
network
|
|
45
57
|
})),
|
|
46
58
|
transactionError: (error, hash = '') => mockTransactionWritable.update((state) => ({
|
|
47
59
|
...state,
|
|
@@ -49,6 +61,7 @@ export const mockTransactionStore = {
|
|
|
49
61
|
error,
|
|
50
62
|
hash
|
|
51
63
|
})),
|
|
64
|
+
// Extra function for testing purposes
|
|
52
65
|
mockSetSubscribeValue: (value) => mockTransactionWritable.update((state) => ({
|
|
53
66
|
...state,
|
|
54
67
|
...value
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import type { ConfigSource } from '@rainlanguage/orderbook
|
|
1
|
+
import type { ConfigSource } from '@rainlanguage/orderbook';
|
|
2
2
|
export declare const mockConfigSource: ConfigSource;
|
|
3
|
-
export declare const mockSettingsStore:
|
|
3
|
+
export declare const mockSettingsStore: {
|
|
4
|
+
subscribe: (this: void, run: import("svelte/store").Subscriber<ConfigSource>, invalidate?: import("svelte/store").Invalidator<ConfigSource> | undefined) => import("svelte/store").Unsubscriber;
|
|
5
|
+
set: (this: void, value: ConfigSource) => void;
|
|
6
|
+
mockSetSubscribeValue: (value: ConfigSource) => void;
|
|
7
|
+
};
|
|
@@ -34,4 +34,9 @@ export const mockConfigSource = {
|
|
|
34
34
|
name_two: 'address_two'
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
|
|
37
|
+
const mockSettingsStoreWritable = writable(mockConfigSource);
|
|
38
|
+
export const mockSettingsStore = {
|
|
39
|
+
subscribe: mockSettingsStoreWritable.subscribe,
|
|
40
|
+
set: mockSettingsStoreWritable.set,
|
|
41
|
+
mockSetSubscribeValue: (value) => mockSettingsStoreWritable.set(value)
|
|
42
|
+
};
|
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
import type { ConfigSource } from '@rainlanguage/orderbook
|
|
1
|
+
import type { ConfigSource } from '@rainlanguage/orderbook';
|
|
2
2
|
import { type Config } from '@wagmi/core';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
declare const initialPageState: {
|
|
4
|
+
data: {
|
|
5
|
+
stores: {
|
|
6
|
+
settings: {};
|
|
7
|
+
};
|
|
8
|
+
dotrain: string;
|
|
9
|
+
deployment: {
|
|
10
|
+
key: string;
|
|
11
|
+
};
|
|
12
|
+
strategyDetail: {};
|
|
13
|
+
};
|
|
14
|
+
url: URL;
|
|
15
|
+
params: {};
|
|
16
|
+
form: {};
|
|
17
|
+
status: number;
|
|
18
|
+
error: null;
|
|
19
|
+
route: {
|
|
20
|
+
id: null;
|
|
21
|
+
};
|
|
8
22
|
};
|
|
9
23
|
export declare const mockSettingsStore: {
|
|
10
24
|
subscribe: (this: void, run: import("svelte/store").Subscriber<ConfigSource | undefined>, invalidate?: import("svelte/store").Invalidator<ConfigSource | undefined> | undefined) => import("svelte/store").Unsubscriber;
|
|
@@ -24,10 +38,10 @@ export declare const mockActiveAccountsItemsStore: {
|
|
|
24
38
|
set: (this: void, value: Record<string, string>) => void;
|
|
25
39
|
mockSetSubscribeValue: (value: Record<string, string>) => void;
|
|
26
40
|
};
|
|
27
|
-
export declare const
|
|
28
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<boolean
|
|
29
|
-
set: (this: void, value: boolean
|
|
30
|
-
mockSetSubscribeValue: (value: boolean
|
|
41
|
+
export declare const mockShowInactiveOrdersStore: {
|
|
42
|
+
subscribe: (this: void, run: import("svelte/store").Subscriber<boolean>, invalidate?: import("svelte/store").Invalidator<boolean> | undefined) => import("svelte/store").Unsubscriber;
|
|
43
|
+
set: (this: void, value: boolean) => void;
|
|
44
|
+
mockSetSubscribeValue: (value: boolean) => void;
|
|
31
45
|
};
|
|
32
46
|
export declare const mockOrderHashStore: {
|
|
33
47
|
subscribe: (this: void, run: import("svelte/store").Subscriber<string>, invalidate?: import("svelte/store").Invalidator<string> | undefined) => import("svelte/store").Unsubscriber;
|
|
@@ -59,12 +73,6 @@ export declare const mockSubgraphUrlStore: {
|
|
|
59
73
|
set: (this: void, value: string) => void;
|
|
60
74
|
mockSetSubscribeValue: (value: string) => void;
|
|
61
75
|
};
|
|
62
|
-
export declare const mockSignerAddressStore: {
|
|
63
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<string>, invalidate?: import("svelte/store").Invalidator<string> | undefined) => import("svelte/store").Unsubscriber;
|
|
64
|
-
set: (this: void, value: string) => void;
|
|
65
|
-
mockSetSubscribeValue: (value: string) => void;
|
|
66
|
-
update: (this: void, updater: import("svelte/store").Updater<string>) => void;
|
|
67
|
-
};
|
|
68
76
|
export declare const mockChainIdStore: {
|
|
69
77
|
subscribe: (this: void, run: import("svelte/store").Subscriber<number>, invalidate?: import("svelte/store").Invalidator<number> | undefined) => import("svelte/store").Unsubscriber;
|
|
70
78
|
set: (this: void, value: number) => void;
|
|
@@ -88,7 +96,66 @@ export declare const mockShowMyItemsOnlyStore: {
|
|
|
88
96
|
mockSetSubscribeValue: (value: boolean) => void;
|
|
89
97
|
};
|
|
90
98
|
export declare const mockPageStore: {
|
|
91
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
};
|
|
99
|
+
subscribe: (this: void, run: import("svelte/store").Subscriber<{
|
|
100
|
+
data: {
|
|
101
|
+
stores: {
|
|
102
|
+
settings: {};
|
|
103
|
+
};
|
|
104
|
+
dotrain: string;
|
|
105
|
+
deployment: {
|
|
106
|
+
key: string;
|
|
107
|
+
};
|
|
108
|
+
strategyDetail: {};
|
|
109
|
+
};
|
|
110
|
+
url: URL;
|
|
111
|
+
params: {};
|
|
112
|
+
form: {};
|
|
113
|
+
status: number;
|
|
114
|
+
error: null;
|
|
115
|
+
route: {
|
|
116
|
+
id: null;
|
|
117
|
+
};
|
|
118
|
+
}>, invalidate?: import("svelte/store").Invalidator<{
|
|
119
|
+
data: {
|
|
120
|
+
stores: {
|
|
121
|
+
settings: {};
|
|
122
|
+
};
|
|
123
|
+
dotrain: string;
|
|
124
|
+
deployment: {
|
|
125
|
+
key: string;
|
|
126
|
+
};
|
|
127
|
+
strategyDetail: {};
|
|
128
|
+
};
|
|
129
|
+
url: URL;
|
|
130
|
+
params: {};
|
|
131
|
+
form: {};
|
|
132
|
+
status: number;
|
|
133
|
+
error: null;
|
|
134
|
+
route: {
|
|
135
|
+
id: null;
|
|
136
|
+
};
|
|
137
|
+
}> | undefined) => import("svelte/store").Unsubscriber;
|
|
138
|
+
set: (this: void, value: {
|
|
139
|
+
data: {
|
|
140
|
+
stores: {
|
|
141
|
+
settings: {};
|
|
142
|
+
};
|
|
143
|
+
dotrain: string;
|
|
144
|
+
deployment: {
|
|
145
|
+
key: string;
|
|
146
|
+
};
|
|
147
|
+
strategyDetail: {};
|
|
148
|
+
};
|
|
149
|
+
url: URL;
|
|
150
|
+
params: {};
|
|
151
|
+
form: {};
|
|
152
|
+
status: number;
|
|
153
|
+
error: null;
|
|
154
|
+
route: {
|
|
155
|
+
id: null;
|
|
156
|
+
};
|
|
157
|
+
}) => void;
|
|
158
|
+
mockSetSubscribeValue: (newValue: Partial<typeof initialPageState>) => void;
|
|
159
|
+
reset: () => void;
|
|
160
|
+
};
|
|
161
|
+
export {};
|
package/dist/__mocks__/stores.js
CHANGED
|
@@ -2,29 +2,38 @@ import { writable } from 'svelte/store';
|
|
|
2
2
|
import settingsFixture from '../__fixtures__/settings-12-11-24.json';
|
|
3
3
|
import {} from '@wagmi/core';
|
|
4
4
|
import { mockWeb3Config } from './mockWeb3Config';
|
|
5
|
+
const initialPageState = {
|
|
6
|
+
data: {
|
|
7
|
+
stores: { settings: {} },
|
|
8
|
+
dotrain: 'some dotrain content',
|
|
9
|
+
deployment: { key: 'deploy-key' },
|
|
10
|
+
strategyDetail: {}
|
|
11
|
+
},
|
|
12
|
+
url: new URL('http://localhost:3000/deploy'),
|
|
13
|
+
params: {},
|
|
14
|
+
form: {},
|
|
15
|
+
status: 200,
|
|
16
|
+
error: null,
|
|
17
|
+
route: {
|
|
18
|
+
id: null
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const mockPageWritable = writable(initialPageState);
|
|
5
22
|
const mockSettingsWritable = writable(settingsFixture);
|
|
6
23
|
const mockActiveSubgraphsWritable = writable({});
|
|
7
24
|
const mockAccountsWritable = writable({});
|
|
8
25
|
const mockActiveAccountsItemsWritable = writable({});
|
|
9
|
-
const
|
|
26
|
+
const mockShowInactiveOrdersWritable = writable(true);
|
|
10
27
|
const mockOrderHashWritable = writable('');
|
|
11
28
|
const mockHideZeroBalanceVaultsWritable = writable(false);
|
|
12
29
|
const mockActiveNetworkRefWritable = writable('');
|
|
13
30
|
const mockActiveOrderbookRefWritable = writable('');
|
|
14
31
|
const mockActiveAccountsWritable = writable({});
|
|
15
32
|
const mockSubgraphUrlWritable = writable('');
|
|
16
|
-
const mockWalletAddressMatchesOrBlankWritable = writable(() => false);
|
|
17
|
-
const mockSignerAddressWritable = writable('');
|
|
18
33
|
const mockChainIdWritable = writable(0);
|
|
19
|
-
const mockConnectedWritable = writable(
|
|
34
|
+
const mockConnectedWritable = writable(true);
|
|
20
35
|
const mockWagmiConfigWritable = writable(mockWeb3Config);
|
|
21
36
|
const mockShowMyItemsOnlyWritable = writable(false);
|
|
22
|
-
const mockPageWritable = writable();
|
|
23
|
-
export const mockWalletAddressMatchesOrBlankStore = {
|
|
24
|
-
subscribe: mockWalletAddressMatchesOrBlankWritable.subscribe,
|
|
25
|
-
set: mockWalletAddressMatchesOrBlankWritable.set,
|
|
26
|
-
mockSetSubscribeValue: (value) => mockWalletAddressMatchesOrBlankWritable.set(value)
|
|
27
|
-
};
|
|
28
37
|
export const mockSettingsStore = {
|
|
29
38
|
subscribe: mockSettingsWritable.subscribe,
|
|
30
39
|
set: mockSettingsWritable.set,
|
|
@@ -43,10 +52,10 @@ export const mockActiveAccountsItemsStore = {
|
|
|
43
52
|
set: mockActiveAccountsItemsWritable.set,
|
|
44
53
|
mockSetSubscribeValue: (value) => mockActiveAccountsItemsWritable.set(value)
|
|
45
54
|
};
|
|
46
|
-
export const
|
|
47
|
-
subscribe:
|
|
48
|
-
set:
|
|
49
|
-
mockSetSubscribeValue: (value) =>
|
|
55
|
+
export const mockShowInactiveOrdersStore = {
|
|
56
|
+
subscribe: mockShowInactiveOrdersWritable.subscribe,
|
|
57
|
+
set: mockShowInactiveOrdersWritable.set,
|
|
58
|
+
mockSetSubscribeValue: (value) => mockShowInactiveOrdersWritable.set(value)
|
|
50
59
|
};
|
|
51
60
|
export const mockOrderHashStore = {
|
|
52
61
|
subscribe: mockOrderHashWritable.subscribe,
|
|
@@ -78,12 +87,6 @@ export const mockSubgraphUrlStore = {
|
|
|
78
87
|
set: mockSubgraphUrlWritable.set,
|
|
79
88
|
mockSetSubscribeValue: (value) => mockSubgraphUrlWritable.set(value)
|
|
80
89
|
};
|
|
81
|
-
export const mockSignerAddressStore = {
|
|
82
|
-
subscribe: mockSignerAddressWritable.subscribe,
|
|
83
|
-
set: mockSignerAddressWritable.set,
|
|
84
|
-
mockSetSubscribeValue: (value) => mockSignerAddressWritable.set(value),
|
|
85
|
-
update: mockSignerAddressWritable.update
|
|
86
|
-
};
|
|
87
90
|
export const mockChainIdStore = {
|
|
88
91
|
subscribe: mockChainIdWritable.subscribe,
|
|
89
92
|
set: mockChainIdWritable.set,
|
|
@@ -109,5 +112,11 @@ export const mockShowMyItemsOnlyStore = {
|
|
|
109
112
|
export const mockPageStore = {
|
|
110
113
|
subscribe: mockPageWritable.subscribe,
|
|
111
114
|
set: mockPageWritable.set,
|
|
112
|
-
mockSetSubscribeValue: (
|
|
115
|
+
mockSetSubscribeValue: (newValue) => {
|
|
116
|
+
mockPageWritable.update((currentValue) => ({
|
|
117
|
+
...currentValue,
|
|
118
|
+
...newValue
|
|
119
|
+
}));
|
|
120
|
+
},
|
|
121
|
+
reset: () => mockPageWritable.set(initialPageState)
|
|
113
122
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>import { bigintStringToHex } from "../utils/hex";
|
|
2
|
-
import
|
|
2
|
+
import Tooltip from "./Tooltip.svelte";
|
|
3
3
|
import { formatUnits } from "viem";
|
|
4
4
|
export let tokenVault;
|
|
5
5
|
export let subgraphName;
|
|
@@ -10,10 +10,10 @@ export let subgraphName;
|
|
|
10
10
|
data-testid="vault-link"
|
|
11
11
|
>
|
|
12
12
|
<div class="flex flex-col items-start gap-y-2">
|
|
13
|
-
<Tooltip triggeredBy=
|
|
13
|
+
<Tooltip triggeredBy={`#token-info-${tokenVault.vaultId}`}>
|
|
14
14
|
ID: <span class="font-mono">{bigintStringToHex(tokenVault.vaultId)}</span>
|
|
15
15
|
</Tooltip>
|
|
16
|
-
<a href={`/vaults/${subgraphName}-${tokenVault.id}`} id=
|
|
16
|
+
<a href={`/vaults/${subgraphName}-${tokenVault.id}`} id={`token-info-${tokenVault.vaultId}`}>
|
|
17
17
|
{tokenVault.token.name} ({tokenVault.token.symbol})
|
|
18
18
|
</a>
|
|
19
19
|
<span class="text-sm text-gray-500 dark:text-gray-400">
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script>import { Checkbox, Label } from "flowbite-svelte";
|
|
2
|
+
import { useAccount } from "../providers/wallet/useAccount";
|
|
2
3
|
export let showMyItemsOnly;
|
|
3
4
|
export let context;
|
|
4
|
-
|
|
5
|
+
const { account } = useAccount();
|
|
5
6
|
function handleShowMyItemsChange() {
|
|
6
7
|
$showMyItemsOnly = !$showMyItemsOnly;
|
|
7
8
|
}
|
|
@@ -18,6 +19,6 @@ function handleShowMyItemsChange() {
|
|
|
18
19
|
id="show-my-items"
|
|
19
20
|
checked={$showMyItemsOnly}
|
|
20
21
|
on:change={handleShowMyItemsChange}
|
|
21
|
-
disabled={!$
|
|
22
|
+
disabled={!$account}
|
|
22
23
|
/>
|
|
23
24
|
</div>
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import type {
|
|
2
|
+
import type { AppStoresInterface } from '../types/appStores';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
showMyItemsOnly:
|
|
5
|
+
showMyItemsOnly: AppStoresInterface["showMyItemsOnly"];
|
|
6
6
|
context: "orders" | "vaults";
|
|
7
|
-
signerAddress: Writable<string | null> | undefined;
|
|
8
7
|
};
|
|
9
8
|
events: {
|
|
10
9
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import type {
|
|
2
|
+
import type { AppStoresInterface } from '../types/appStores';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
hideZeroBalanceVaults:
|
|
5
|
+
hideZeroBalanceVaults: AppStoresInterface["hideZeroBalanceVaults"];
|
|
6
6
|
};
|
|
7
7
|
events: {
|
|
8
8
|
[evt: string]: CustomEvent<any>;
|
|
@@ -6,6 +6,7 @@ export let disabled = false;
|
|
|
6
6
|
export let styles = {};
|
|
7
7
|
export let rainlangExtension;
|
|
8
8
|
export let codeMirrorTheme;
|
|
9
|
+
export let onTextChange;
|
|
9
10
|
</script>
|
|
10
11
|
|
|
11
12
|
<div data-testid="codemirror-dotrain">
|
|
@@ -22,6 +23,9 @@ export let codeMirrorTheme;
|
|
|
22
23
|
},
|
|
23
24
|
...styles
|
|
24
25
|
}}
|
|
26
|
+
on:change={(e) => {
|
|
27
|
+
onTextChange(e.detail);
|
|
28
|
+
}}
|
|
25
29
|
on:ready={(e) => {
|
|
26
30
|
openLintPanel(e.detail);
|
|
27
31
|
}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import { extendOrder } from "@rainlanguage/orderbook
|
|
1
|
+
<script>import { extendOrder } from "@rainlanguage/orderbook";
|
|
2
2
|
import CodeMirror from "svelte-codemirror-editor";
|
|
3
3
|
import { RainlangLR } from "codemirror-rainlang";
|
|
4
4
|
export let order = void 0;
|
|
@@ -6,12 +6,16 @@ export let rainlangText = void 0;
|
|
|
6
6
|
export let codeMirrorTheme;
|
|
7
7
|
export let codeMirrorDisabled = true;
|
|
8
8
|
export let codeMirrorStyles = {};
|
|
9
|
-
|
|
9
|
+
let result;
|
|
10
|
+
let extendedOrder;
|
|
11
|
+
$: result = order ? extendOrder(order) : void 0;
|
|
12
|
+
$: extendedOrder = result && !result.error ? result.value : void 0;
|
|
13
|
+
$: extendOrderError = result && result.error ? result.error : void 0;
|
|
10
14
|
</script>
|
|
11
15
|
|
|
12
|
-
{#if extendedOrder?.rainlang}
|
|
16
|
+
{#if rainlangText || extendedOrder?.rainlang}
|
|
13
17
|
<CodeMirror
|
|
14
|
-
value={rainlangText || extendedOrder
|
|
18
|
+
value={rainlangText || extendedOrder?.rainlang}
|
|
15
19
|
extensions={[RainlangLR]}
|
|
16
20
|
theme={codeMirrorTheme}
|
|
17
21
|
readonly={codeMirrorDisabled}
|
|
@@ -24,6 +28,10 @@ $: extendedOrder = order ? extendOrder(order) : void 0;
|
|
|
24
28
|
...codeMirrorStyles
|
|
25
29
|
}}
|
|
26
30
|
/>
|
|
31
|
+
{:else if extendOrderError}
|
|
32
|
+
<div class="w-full tracking-tight text-red-600 dark:text-red-400" data-testid="rainlang-error">
|
|
33
|
+
{extendOrderError.readableMsg}
|
|
34
|
+
</div>
|
|
27
35
|
{:else if !extendedOrder?.rainlang && !rainlangText}
|
|
28
36
|
<div
|
|
29
37
|
class="w-full tracking-tight text-gray-900 dark:text-white"
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
import { PenSolid } from "flowbite-svelte-icons";
|
|
2
3
|
export let displayValue;
|
|
3
|
-
let focussed = false;
|
|
4
4
|
let textContent;
|
|
5
5
|
let editableSpan;
|
|
6
6
|
let dispatch = createEventDispatcher();
|
|
7
|
-
const inputFocussed = () => {
|
|
8
|
-
focussed = true;
|
|
9
|
-
dispatch("focus");
|
|
10
|
-
};
|
|
11
7
|
const inputBlurred = () => {
|
|
12
|
-
focussed = false;
|
|
13
8
|
displayValue = textContent;
|
|
14
9
|
dispatch("blur", { value: textContent });
|
|
15
10
|
};
|
|
@@ -20,27 +15,21 @@ const handleKeyDown = (event) => {
|
|
|
20
15
|
};
|
|
21
16
|
</script>
|
|
22
17
|
|
|
23
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
24
18
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
25
19
|
<div
|
|
26
20
|
data-testid="editableSpanWrapper"
|
|
27
|
-
|
|
28
|
-
class="flex gap-x-1 border-b-2 border-dotted text-sm text-gray-400 dark:text-gray-400"
|
|
21
|
+
class="flex items-center gap-x-1 border-b-2 border-dotted text-sm text-gray-400 dark:text-gray-400"
|
|
29
22
|
>
|
|
23
|
+
<PenSolid class="h-3 w-3 cursor-pointer" />
|
|
30
24
|
<span>Block:</span>
|
|
31
25
|
<div class="relative">
|
|
32
26
|
<span
|
|
33
27
|
data-testid="editableSpan"
|
|
34
|
-
class="absolute"
|
|
35
|
-
class:opacity-0={!focussed}
|
|
36
28
|
bind:this={editableSpan}
|
|
37
29
|
bind:textContent
|
|
38
30
|
contenteditable="true"
|
|
39
31
|
on:keydown={handleKeyDown}
|
|
40
32
|
on:blur={inputBlurred}>{displayValue}</span
|
|
41
33
|
>
|
|
42
|
-
<span data-testid="displayElement" class="pointer-events-none" class:opacity-0={focussed}
|
|
43
|
-
>{displayValue}</span
|
|
44
|
-
>
|
|
45
34
|
</div>
|
|
46
35
|
</div>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
})(HashType || {});
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
|
-
<script>import
|
|
10
|
+
<script>import Tooltip from "./Tooltip.svelte";
|
|
11
11
|
import {
|
|
12
12
|
WalletOutline,
|
|
13
13
|
FingerprintOutline,
|
|
@@ -60,7 +60,7 @@ function copy(e) {
|
|
|
60
60
|
{#if showCopiedMessage}
|
|
61
61
|
<div
|
|
62
62
|
out:fade
|
|
63
|
-
class="fixed rounded bg-green-500 px-2 py-1 text-xs text-white
|
|
63
|
+
class="fixed rounded bg-green-500 px-2 py-1 text-xs text-white"
|
|
64
64
|
style="top: {cursorY + 10}px; left: {cursorX + 10}px"
|
|
65
65
|
>
|
|
66
66
|
Copied to clipboard
|
|
@@ -68,7 +68,7 @@ function copy(e) {
|
|
|
68
68
|
{/if}
|
|
69
69
|
|
|
70
70
|
{#if shorten}
|
|
71
|
-
<Tooltip triggeredBy={`#${id}`}
|
|
71
|
+
<Tooltip triggeredBy={`#${id}`}>
|
|
72
72
|
<div class="flex items-center justify-start space-x-2">
|
|
73
73
|
{#if type === HashType.Wallet}
|
|
74
74
|
<WalletOutline size="sm" />
|
|
@@ -2,19 +2,20 @@
|
|
|
2
2
|
import { Heading, Text, BlockQuote } from '@rainlanguage/ui-components';
|
|
3
3
|
import Markdown from 'svelte-markdown';
|
|
4
4
|
import { onMount } from 'svelte';
|
|
5
|
+
import { LICENSE_URL } from '../consts';
|
|
5
6
|
|
|
6
7
|
let source = '';
|
|
7
8
|
|
|
8
9
|
onMount(async () => {
|
|
9
10
|
try {
|
|
10
|
-
const response = await fetch(
|
|
11
|
-
'https://raw.githubusercontent.com/rainlanguage/decentralicense/refs/heads/master/README.md'
|
|
12
|
-
);
|
|
11
|
+
const response = await fetch(LICENSE_URL);
|
|
13
12
|
if (response.ok) {
|
|
14
13
|
source = await response.text();
|
|
14
|
+
} else {
|
|
15
|
+
source = `Failed to fetch license: HTTP ${response.status}`;
|
|
15
16
|
}
|
|
16
17
|
} catch {
|
|
17
|
-
source = '';
|
|
18
|
+
source = 'Failed to fetch license.';
|
|
18
19
|
}
|
|
19
20
|
});
|
|
20
21
|
</script>
|