@rainlanguage/ui-components 0.0.1-alpha.8 → 0.0.1-alpha.80
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 +86 -19
- package/dist/__mocks__/stores.js +26 -17
- 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 +0 -1
- package/dist/components/CodeMirrorDotrain.svelte +4 -0
- package/dist/components/CodeMirrorDotrain.svelte.d.ts +1 -0
- package/dist/components/CodeMirrorRainlang.svelte +2 -2
- package/dist/components/CodeMirrorRainlang.svelte.d.ts +1 -1
- package/dist/components/Hash.svelte +3 -3
- package/dist/components/License.svelte +5 -4
- package/dist/components/ListViewOrderbookFilters.svelte +14 -13
- package/dist/components/ListViewOrderbookFilters.svelte.d.ts +2 -5
- 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/Tooltip.svelte +8 -0
- package/dist/components/Tooltip.svelte.d.ts +21 -0
- package/dist/components/charts/OrderTradesChart.svelte +1 -1
- package/dist/components/charts/TanstackLightweightChartLine.svelte +5 -9
- package/dist/components/charts/VaultBalanceChart.svelte +1 -1
- 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 +180 -155
- package/dist/components/deployment/DeploymentSteps.svelte.d.ts +7 -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 +46 -41
- package/dist/components/detail/OrderDetail.svelte.d.ts +11 -8
- package/dist/components/detail/TanstackOrderQuote.svelte +6 -6
- package/dist/components/detail/TanstackOrderQuote.svelte.d.ts +1 -1
- package/dist/components/detail/VaultDetail.svelte +29 -40
- package/dist/components/detail/VaultDetail.svelte.d.ts +10 -10
- package/dist/components/dropdown/DropdownActiveSubgraphs.svelte.d.ts +1 -1
- 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/InputRegistryUrl.svelte +2 -2
- package/dist/components/input/InputToken.svelte +2 -2
- package/dist/components/input/InputTokenAmount.svelte +1 -1
- package/dist/components/tables/OrderAPY.svelte +1 -1
- package/dist/components/tables/OrderTradesListTable.svelte +1 -1
- package/dist/components/tables/OrderVaultsVolTable.svelte +1 -1
- package/dist/components/tables/OrdersListTable.svelte +16 -18
- package/dist/components/tables/OrdersListTable.svelte.d.ts +0 -6
- package/dist/components/tables/VaultBalanceChangesTable.svelte +3 -3
- package/dist/components/tables/VaultsListTable.svelte +43 -52
- package/dist/components/tables/VaultsListTable.svelte.d.ts +3 -6
- 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 +12 -6
- package/dist/index.js +14 -5
- package/dist/providers/GuiProvider.svelte +8 -0
- package/dist/providers/GuiProvider.svelte.d.ts +21 -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 +3 -3
- package/dist/services/awaitTransactionIndexing.d.ts +163 -0
- package/dist/services/awaitTransactionIndexing.js +120 -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/index.d.ts +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/registry.d.ts +6 -0
- package/dist/services/registry.js +156 -0
- package/dist/stores/transactionStore.d.ts +7 -10
- package/dist/stores/transactionStore.js +35 -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 +2 -2
- package/dist/types/modal.d.ts +1 -1
- package/dist/types/strategy.d.ts +1 -1
- 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
|
@@ -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;
|
|
@@ -25,9 +39,9 @@ export declare const mockActiveAccountsItemsStore: {
|
|
|
25
39
|
mockSetSubscribeValue: (value: Record<string, string>) => void;
|
|
26
40
|
};
|
|
27
41
|
export declare const mockActiveOrderStatusStore: {
|
|
28
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<boolean
|
|
29
|
-
set: (this: void, value: boolean
|
|
30
|
-
mockSetSubscribeValue: (value: boolean
|
|
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 mockActiveOrderStatusWritable = writable(
|
|
26
|
+
const mockActiveOrderStatusWritable = 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,
|
|
@@ -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>
|
|
@@ -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;
|
|
@@ -9,7 +9,7 @@ export let codeMirrorStyles = {};
|
|
|
9
9
|
$: extendedOrder = order ? extendOrder(order) : void 0;
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
|
-
{#if extendedOrder?.rainlang}
|
|
12
|
+
{#if rainlangText || extendedOrder?.rainlang}
|
|
13
13
|
<CodeMirror
|
|
14
14
|
value={rainlangText || extendedOrder.rainlang}
|
|
15
15
|
extensions={[RainlangLR]}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
})(HashType || {});
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
|
-
<script>import
|
|
10
|
+
<script>import Tooltip from "./Tooltip.svelte";
|
|
11
11
|
import {
|
|
12
12
|
WalletOutline,
|
|
13
13
|
FingerprintOutline,
|
|
@@ -60,7 +60,7 @@ function copy(e) {
|
|
|
60
60
|
{#if showCopiedMessage}
|
|
61
61
|
<div
|
|
62
62
|
out:fade
|
|
63
|
-
class="fixed rounded bg-green-500 px-2 py-1 text-xs text-white
|
|
63
|
+
class="fixed rounded bg-green-500 px-2 py-1 text-xs text-white"
|
|
64
64
|
style="top: {cursorY + 10}px; left: {cursorX + 10}px"
|
|
65
65
|
>
|
|
66
66
|
Copied to clipboard
|
|
@@ -68,7 +68,7 @@ function copy(e) {
|
|
|
68
68
|
{/if}
|
|
69
69
|
|
|
70
70
|
{#if shorten}
|
|
71
|
-
<Tooltip triggeredBy={`#${id}`}
|
|
71
|
+
<Tooltip triggeredBy={`#${id}`}>
|
|
72
72
|
<div class="flex items-center justify-start space-x-2">
|
|
73
73
|
{#if type === HashType.Wallet}
|
|
74
74
|
<WalletOutline size="sm" />
|
|
@@ -2,19 +2,20 @@
|
|
|
2
2
|
import { Heading, Text, BlockQuote } from '@rainlanguage/ui-components';
|
|
3
3
|
import Markdown from 'svelte-markdown';
|
|
4
4
|
import { onMount } from 'svelte';
|
|
5
|
+
import { LICENSE_URL } from '../consts';
|
|
5
6
|
|
|
6
7
|
let source = '';
|
|
7
8
|
|
|
8
9
|
onMount(async () => {
|
|
9
10
|
try {
|
|
10
|
-
const response = await fetch(
|
|
11
|
-
'https://raw.githubusercontent.com/rainlanguage/decentralicense/refs/heads/master/README.md'
|
|
12
|
-
);
|
|
11
|
+
const response = await fetch(LICENSE_URL);
|
|
13
12
|
if (response.ok) {
|
|
14
13
|
source = await response.text();
|
|
14
|
+
} else {
|
|
15
|
+
source = `Failed to fetch license: HTTP ${response.status}`;
|
|
15
16
|
}
|
|
16
17
|
} catch {
|
|
17
|
-
source = '';
|
|
18
|
+
source = 'Failed to fetch license.';
|
|
18
19
|
}
|
|
19
20
|
});
|
|
20
21
|
</script>
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
<script generics="T">import {
|
|
2
|
-
import {
|
|
1
|
+
<script generics="T">import { page } from "$app/stores";
|
|
2
|
+
import { isEmpty } from "lodash";
|
|
3
|
+
import { Alert } from "flowbite-svelte";
|
|
4
|
+
import Tooltip from "./Tooltip.svelte";
|
|
3
5
|
import DropdownActiveSubgraphs from "./dropdown/DropdownActiveSubgraphs.svelte";
|
|
4
|
-
import
|
|
6
|
+
import CheckboxActiveOrders from "./checkbox/CheckboxActiveOrders.svelte";
|
|
5
7
|
import DropdownOrderListAccounts from "./dropdown/DropdownOrderListAccounts.svelte";
|
|
6
8
|
import InputOrderHash from "./input/InputOrderHash.svelte";
|
|
7
9
|
import CheckboxZeroBalanceVault from "./CheckboxZeroBalanceVault.svelte";
|
|
8
10
|
import CheckboxMyItemsOnly from "./CheckboxMyItemsOnly.svelte";
|
|
11
|
+
import { useAccount } from "../providers/wallet/useAccount";
|
|
9
12
|
export let settings;
|
|
10
13
|
export let accounts;
|
|
11
14
|
export let hideZeroBalanceVaults;
|
|
@@ -14,9 +17,9 @@ export let showMyItemsOnly;
|
|
|
14
17
|
export let activeSubgraphs;
|
|
15
18
|
export let activeOrderStatus;
|
|
16
19
|
export let orderHash;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
$: isVaultsPage = $page.url.pathname === "/vaults";
|
|
21
|
+
$: isOrdersPage = $page.url.pathname === "/orders";
|
|
22
|
+
const { account } = useAccount();
|
|
20
23
|
</script>
|
|
21
24
|
|
|
22
25
|
<div
|
|
@@ -30,12 +33,8 @@ export let signerAddress;
|
|
|
30
33
|
{:else}
|
|
31
34
|
{#if $accounts && !Object.values($accounts).length}
|
|
32
35
|
<div class="mt-4 w-full lg:w-auto" data-testid="my-items-only">
|
|
33
|
-
<CheckboxMyItemsOnly
|
|
34
|
-
|
|
35
|
-
{showMyItemsOnly}
|
|
36
|
-
{signerAddress}
|
|
37
|
-
/>
|
|
38
|
-
{#if !$signerAddress}
|
|
36
|
+
<CheckboxMyItemsOnly context={isVaultsPage ? 'vaults' : 'orders'} {showMyItemsOnly} />
|
|
37
|
+
{#if !$account}
|
|
39
38
|
<Tooltip>Connect a wallet to filter by {isVaultsPage ? 'vault' : 'order'} owner</Tooltip>
|
|
40
39
|
{/if}
|
|
41
40
|
</div>
|
|
@@ -48,7 +47,9 @@ export let signerAddress;
|
|
|
48
47
|
|
|
49
48
|
{#if isOrdersPage}
|
|
50
49
|
<InputOrderHash {orderHash} />
|
|
51
|
-
<
|
|
50
|
+
<div class="mt-4">
|
|
51
|
+
<CheckboxActiveOrders {activeOrderStatus} />
|
|
52
|
+
</div>
|
|
52
53
|
{/if}
|
|
53
54
|
{#if $accounts && Object.values($accounts).length > 0}
|
|
54
55
|
<DropdownOrderListAccounts {accounts} {activeAccountsItems} />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type { Readable, Writable } from 'svelte/store';
|
|
3
|
-
import type { ConfigSource } from '@rainlanguage/orderbook
|
|
3
|
+
import type { ConfigSource } from '@rainlanguage/orderbook';
|
|
4
4
|
declare class __sveltets_Render<T> {
|
|
5
5
|
props(): {
|
|
6
6
|
settings: Writable<ConfigSource | undefined>;
|
|
@@ -9,11 +9,8 @@ declare class __sveltets_Render<T> {
|
|
|
9
9
|
activeAccountsItems: Writable<Record<string, string>> | undefined;
|
|
10
10
|
showMyItemsOnly: Writable<boolean>;
|
|
11
11
|
activeSubgraphs: Writable<Record<string, string>>;
|
|
12
|
-
activeOrderStatus: Writable<boolean
|
|
12
|
+
activeOrderStatus: Writable<boolean>;
|
|
13
13
|
orderHash: Writable<string>;
|
|
14
|
-
isVaultsPage: boolean;
|
|
15
|
-
isOrdersPage: boolean;
|
|
16
|
-
signerAddress: Writable<string | null> | undefined;
|
|
17
14
|
};
|
|
18
15
|
events(): {} & {
|
|
19
16
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
<script>import { Button } from "flowbite-svelte";
|
|
2
2
|
import Hash, { HashType } from "./Hash.svelte";
|
|
3
|
+
import {
|
|
4
|
+
constructHashLink,
|
|
5
|
+
isOrderOrVaultActive,
|
|
6
|
+
extractHash
|
|
7
|
+
} from "../utils/constructHashLink";
|
|
3
8
|
export let orderOrVault;
|
|
4
9
|
export let type;
|
|
5
10
|
export let network;
|
|
6
11
|
export let updateActiveNetworkAndOrderbook;
|
|
7
|
-
|
|
8
|
-
$:
|
|
9
|
-
$:
|
|
10
|
-
$: hash = isOrder ? orderOrVault.orderHash : orderOrVault?.id || "";
|
|
11
|
-
$: isActive = isOrder ? orderOrVault.active : false;
|
|
12
|
+
$: hash = extractHash(orderOrVault);
|
|
13
|
+
$: isActive = isOrderOrVaultActive(orderOrVault);
|
|
14
|
+
$: linkPath = constructHashLink(orderOrVault, type, network);
|
|
12
15
|
</script>
|
|
13
16
|
|
|
14
|
-
<a href={
|
|
17
|
+
<a data-testid="order-or-vault-hash" href={linkPath}>
|
|
15
18
|
<Button
|
|
16
19
|
class="mr-1 mt-1 px-2 py-1 text-sm"
|
|
17
20
|
color={isActive ? 'green' : 'yellow'}
|
|
18
21
|
data-testid="vault-order-input"
|
|
19
|
-
data-id={
|
|
22
|
+
data-id={hash}
|
|
20
23
|
on:click={() => {
|
|
21
24
|
updateActiveNetworkAndOrderbook(network);
|
|
22
25
|
}}><Hash type={HashType.Identifier} value={hash} copyOnClick={false} /></Button
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import type { SgOrderAsIO, SgOrder, SgVault } from '@rainlanguage/orderbook
|
|
2
|
+
import type { SgOrderAsIO, SgOrder, SgVault } from '@rainlanguage/orderbook';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
orderOrVault: SgOrder | SgVault | SgOrderAsIO;
|