@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
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import fc from 'fast-check';
|
|
2
|
+
import { test } from '@fast-check/vitest';
|
|
3
|
+
function isOrder(obj) {
|
|
4
|
+
return obj && 'orderHash' in obj;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Constructs a link path for an order or vault based on its type and network
|
|
8
|
+
* @param orderOrVault - The order or vault object
|
|
9
|
+
* @param type - The type of resource ('orders' or 'vaults')
|
|
10
|
+
* @param network - The network name
|
|
11
|
+
* @returns The constructed link path
|
|
12
|
+
*/
|
|
13
|
+
export function constructHashLink(orderOrVault, type, network) {
|
|
14
|
+
if (!orderOrVault) {
|
|
15
|
+
return `/${type}/${network}`;
|
|
16
|
+
}
|
|
17
|
+
const slug = isOrder(orderOrVault) ? orderOrVault.orderHash : orderOrVault?.id;
|
|
18
|
+
return `/${type}/${network}-${slug || ''}`;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Determines if an order or vault is active
|
|
22
|
+
* @param orderOrVault - The order or vault object
|
|
23
|
+
* @returns True if the order is active, false otherwise
|
|
24
|
+
*/
|
|
25
|
+
export function isOrderOrVaultActive(orderOrVault) {
|
|
26
|
+
const _isOrder = isOrder(orderOrVault);
|
|
27
|
+
return _isOrder ? orderOrVault.active : false;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Extracts the hash value from an order or vault
|
|
31
|
+
* @param orderOrVault - The order or vault object
|
|
32
|
+
* @returns The hash value
|
|
33
|
+
*/
|
|
34
|
+
export function extractHash(orderOrVault) {
|
|
35
|
+
const _isOrder = isOrder(orderOrVault);
|
|
36
|
+
return _isOrder ? orderOrVault.orderHash : orderOrVault?.id || '';
|
|
37
|
+
}
|
|
38
|
+
if (import.meta.vitest) {
|
|
39
|
+
const { expect, it, describe } = import.meta.vitest;
|
|
40
|
+
describe('constructHashLink', () => {
|
|
41
|
+
test.prop([
|
|
42
|
+
fc.record({
|
|
43
|
+
orderHash: fc.string(),
|
|
44
|
+
active: fc.boolean()
|
|
45
|
+
}),
|
|
46
|
+
fc.oneof(fc.constant('orders'), fc.constant('vaults')),
|
|
47
|
+
fc.string()
|
|
48
|
+
])('constructs correct link for orders', (order, type, network) => {
|
|
49
|
+
const result = constructHashLink(order, type, network);
|
|
50
|
+
expect(result).toBe(`/${type}/${network}-${order.orderHash}`);
|
|
51
|
+
});
|
|
52
|
+
test.prop([
|
|
53
|
+
fc.record({
|
|
54
|
+
id: fc.string(),
|
|
55
|
+
owner: fc.string()
|
|
56
|
+
}),
|
|
57
|
+
fc.oneof(fc.constant('orders'), fc.constant('vaults')),
|
|
58
|
+
fc.string()
|
|
59
|
+
])('constructs correct link for vaults', (vault, type, network) => {
|
|
60
|
+
const result = constructHashLink(vault, type, network);
|
|
61
|
+
expect(result).toBe(`/${type}/${network}-${vault.id}`);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
describe('isOrderOrVaultActive', () => {
|
|
65
|
+
test.prop([
|
|
66
|
+
fc.record({
|
|
67
|
+
orderHash: fc.string(),
|
|
68
|
+
active: fc.boolean()
|
|
69
|
+
})
|
|
70
|
+
])('returns correct active status for orders', (order) => {
|
|
71
|
+
const result = isOrderOrVaultActive(order);
|
|
72
|
+
expect(result).toBe(order.active);
|
|
73
|
+
});
|
|
74
|
+
test.prop([
|
|
75
|
+
fc.record({
|
|
76
|
+
id: fc.string(),
|
|
77
|
+
owner: fc.string()
|
|
78
|
+
})
|
|
79
|
+
])('returns false for vaults', (vault) => {
|
|
80
|
+
const result = isOrderOrVaultActive(vault);
|
|
81
|
+
expect(result).toBe(false);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
describe('extractHash', () => {
|
|
85
|
+
test.prop([
|
|
86
|
+
fc.record({
|
|
87
|
+
orderHash: fc.string(),
|
|
88
|
+
active: fc.boolean()
|
|
89
|
+
})
|
|
90
|
+
])('extracts hash from orders', (order) => {
|
|
91
|
+
const result = extractHash(order);
|
|
92
|
+
expect(result).toBe(order.orderHash);
|
|
93
|
+
});
|
|
94
|
+
test.prop([
|
|
95
|
+
fc.record({
|
|
96
|
+
id: fc.string(),
|
|
97
|
+
owner: fc.string()
|
|
98
|
+
})
|
|
99
|
+
])('extracts hash from vaults', (vault) => {
|
|
100
|
+
const result = extractHash(vault);
|
|
101
|
+
expect(result).toBe(vault.id);
|
|
102
|
+
});
|
|
103
|
+
it('handles undefined vault id', () => {
|
|
104
|
+
// Create a partial vault object with undefined id
|
|
105
|
+
const vault = { id: undefined };
|
|
106
|
+
const result = extractHash(vault);
|
|
107
|
+
expect(result).toBe('');
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
}
|
package/dist/utils/vault.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { SgVault } from '@rainlanguage/orderbook
|
|
1
|
+
import type { SgVault } from '@rainlanguage/orderbook';
|
|
2
2
|
export declare const vaultBalanceDisplay: (vault: SgVault) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rainlanguage/ui-components",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.80",
|
|
4
4
|
"description": "A component library for building Svelte applications to be used with Raindex.",
|
|
5
5
|
"license": "LicenseRef-DCL-1.0",
|
|
6
6
|
"author": "Rain Open Source Software Ltd",
|
|
@@ -49,38 +49,38 @@
|
|
|
49
49
|
"types": "./dist/index.d.ts",
|
|
50
50
|
"type": "module",
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@codemirror/lang-yaml": "
|
|
53
|
-
"@fontsource/dm-sans": "
|
|
54
|
-
"@imask/svelte": "
|
|
55
|
-
"@observablehq/plot": "
|
|
56
|
-
"@rainlanguage/orderbook": "
|
|
57
|
-
"@reown/appkit": "
|
|
58
|
-
"@reown/appkit-adapter-wagmi": "
|
|
59
|
-
"@sentry/sveltekit": "
|
|
60
|
-
"@square/svelte-store": "
|
|
61
|
-
"@sveltejs/kit": "
|
|
62
|
-
"@tanstack/svelte-query": "
|
|
63
|
-
"@wagmi/core": "
|
|
64
|
-
"@walletconnect/ethereum-provider": "
|
|
65
|
-
"@walletconnect/modal": "
|
|
66
|
-
"@web3modal/ethers5": "
|
|
67
|
-
"camelcase-keys": "
|
|
68
|
-
"codemirror-rainlang": "
|
|
69
|
-
"dayjs": "
|
|
70
|
-
"ethers": "
|
|
71
|
-
"flowbite": "
|
|
72
|
-
"flowbite-svelte": "
|
|
73
|
-
"flowbite-svelte-icons": "
|
|
74
|
-
"fuse.js": "
|
|
75
|
-
"lightweight-charts": "
|
|
76
|
-
"lodash": "
|
|
77
|
-
"svelte": "
|
|
78
|
-
"svelte-codemirror-editor": "
|
|
79
|
-
"svelte-markdown": "
|
|
80
|
-
"tailwind-merge": "
|
|
81
|
-
"thememirror": "
|
|
82
|
-
"uuid": "
|
|
83
|
-
"viem": "
|
|
84
|
-
"wagmi": "
|
|
52
|
+
"@codemirror/lang-yaml": "6.1.1",
|
|
53
|
+
"@fontsource/dm-sans": "5.1.0",
|
|
54
|
+
"@imask/svelte": "7.6.1",
|
|
55
|
+
"@observablehq/plot": "0.6.16",
|
|
56
|
+
"@rainlanguage/orderbook": "0.0.1-alpha.80",
|
|
57
|
+
"@reown/appkit": "1.6.4",
|
|
58
|
+
"@reown/appkit-adapter-wagmi": "1.6.4",
|
|
59
|
+
"@sentry/sveltekit": "7.120.0",
|
|
60
|
+
"@square/svelte-store": "1.0.18",
|
|
61
|
+
"@sveltejs/kit": "2.8.1",
|
|
62
|
+
"@tanstack/svelte-query": "5.59.20",
|
|
63
|
+
"@wagmi/core": "2.16.3",
|
|
64
|
+
"@walletconnect/ethereum-provider": "2.17.2",
|
|
65
|
+
"@walletconnect/modal": "2.7.0",
|
|
66
|
+
"@web3modal/ethers5": "4.2.3",
|
|
67
|
+
"camelcase-keys": "9.1.3",
|
|
68
|
+
"codemirror-rainlang": "3.0.13",
|
|
69
|
+
"dayjs": "1.11.13",
|
|
70
|
+
"ethers": "5.7.2",
|
|
71
|
+
"flowbite": "2.5.2",
|
|
72
|
+
"flowbite-svelte": "0.44.24",
|
|
73
|
+
"flowbite-svelte-icons": "0.4.5",
|
|
74
|
+
"fuse.js": "7.0.0",
|
|
75
|
+
"lightweight-charts": "4.2.1",
|
|
76
|
+
"lodash": "4.17.21",
|
|
77
|
+
"svelte": "4.2.19",
|
|
78
|
+
"svelte-codemirror-editor": "1.4.1",
|
|
79
|
+
"svelte-markdown": "0.4.1",
|
|
80
|
+
"tailwind-merge": "2.5.4",
|
|
81
|
+
"thememirror": "2.0.1",
|
|
82
|
+
"uuid": "9.0.1",
|
|
83
|
+
"viem": "2.24.3",
|
|
84
|
+
"wagmi": "2.14.7"
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
|
-
import type { DotrainOrderGui, GuiDepositCfg } from '@rainlanguage/orderbook/js_api';
|
|
3
|
-
declare const __propDef: {
|
|
4
|
-
props: {
|
|
5
|
-
allDepositFields: GuiDepositCfg[];
|
|
6
|
-
gui: DotrainOrderGui;
|
|
7
|
-
};
|
|
8
|
-
events: {
|
|
9
|
-
[evt: string]: CustomEvent<any>;
|
|
10
|
-
};
|
|
11
|
-
slots: {};
|
|
12
|
-
exports?: {} | undefined;
|
|
13
|
-
bindings?: string | undefined;
|
|
14
|
-
};
|
|
15
|
-
export type DepositsSectionProps = typeof __propDef.props;
|
|
16
|
-
export type DepositsSectionEvents = typeof __propDef.events;
|
|
17
|
-
export type DepositsSectionSlots = typeof __propDef.slots;
|
|
18
|
-
export default class DepositsSection extends SvelteComponent<DepositsSectionProps, DepositsSectionEvents, DepositsSectionSlots> {
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<script>import FieldDefinitionInput from "./FieldDefinitionInput.svelte";
|
|
2
|
-
import {} from "@rainlanguage/orderbook/js_api";
|
|
3
|
-
export let allFieldDefinitions;
|
|
4
|
-
export let gui;
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
{#each allFieldDefinitions as fieldDefinition}
|
|
8
|
-
<FieldDefinitionInput {fieldDefinition} {gui} />
|
|
9
|
-
{/each}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
|
-
import { type DotrainOrderGui, type GuiFieldDefinitionCfg } from '@rainlanguage/orderbook/js_api';
|
|
3
|
-
declare const __propDef: {
|
|
4
|
-
props: {
|
|
5
|
-
allFieldDefinitions: GuiFieldDefinitionCfg[];
|
|
6
|
-
gui: DotrainOrderGui;
|
|
7
|
-
};
|
|
8
|
-
events: {
|
|
9
|
-
[evt: string]: CustomEvent<any>;
|
|
10
|
-
};
|
|
11
|
-
slots: {};
|
|
12
|
-
exports?: {} | undefined;
|
|
13
|
-
bindings?: string | undefined;
|
|
14
|
-
};
|
|
15
|
-
export type FieldDefinitionsSectionProps = typeof __propDef.props;
|
|
16
|
-
export type FieldDefinitionsSectionEvents = typeof __propDef.events;
|
|
17
|
-
export type FieldDefinitionsSectionSlots = typeof __propDef.slots;
|
|
18
|
-
export default class FieldDefinitionsSection extends SvelteComponent<FieldDefinitionsSectionProps, FieldDefinitionsSectionEvents, FieldDefinitionsSectionSlots> {
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<script>import DeploymentSectionHeader from "./DeploymentSectionHeader.svelte";
|
|
2
|
-
import SelectToken from "./SelectToken.svelte";
|
|
3
|
-
import { DotrainOrderGui } from "@rainlanguage/orderbook/js_api";
|
|
4
|
-
export let gui;
|
|
5
|
-
export let selectTokens;
|
|
6
|
-
export let onSelectTokenSelect;
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<div class="flex w-full flex-col gap-4">
|
|
10
|
-
<DeploymentSectionHeader
|
|
11
|
-
title="Select Tokens"
|
|
12
|
-
description="Select the tokens that you want to use in your order."
|
|
13
|
-
/>
|
|
14
|
-
{#each selectTokens as token}
|
|
15
|
-
<SelectToken {token} bind:gui {onSelectTokenSelect} />
|
|
16
|
-
{/each}
|
|
17
|
-
</div>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
|
-
import { DotrainOrderGui, type SelectTokens } from '@rainlanguage/orderbook/js_api';
|
|
3
|
-
declare const __propDef: {
|
|
4
|
-
props: {
|
|
5
|
-
gui: DotrainOrderGui;
|
|
6
|
-
selectTokens: SelectTokens;
|
|
7
|
-
onSelectTokenSelect: () => void;
|
|
8
|
-
};
|
|
9
|
-
events: {
|
|
10
|
-
[evt: string]: CustomEvent<any>;
|
|
11
|
-
};
|
|
12
|
-
slots: {};
|
|
13
|
-
exports?: {} | undefined;
|
|
14
|
-
bindings?: string | undefined;
|
|
15
|
-
};
|
|
16
|
-
export type SelectTokensSectionProps = typeof __propDef.props;
|
|
17
|
-
export type SelectTokensSectionEvents = typeof __propDef.events;
|
|
18
|
-
export type SelectTokensSectionSlots = typeof __propDef.slots;
|
|
19
|
-
export default class SelectTokensSection extends SvelteComponent<SelectTokensSectionProps, SelectTokensSectionEvents, SelectTokensSectionSlots> {
|
|
20
|
-
}
|
|
21
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<script>import TokenIOInput from "./TokenIOInput.svelte";
|
|
2
|
-
export let allTokenInputs = [];
|
|
3
|
-
export let allTokenOutputs = [];
|
|
4
|
-
export let gui;
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
{#if allTokenInputs.length > 0}
|
|
8
|
-
{#each allTokenInputs as input, i}
|
|
9
|
-
<TokenIOInput {i} label="Input" vault={input} {gui} />
|
|
10
|
-
{/each}
|
|
11
|
-
{/if}
|
|
12
|
-
|
|
13
|
-
{#if allTokenOutputs.length > 0}
|
|
14
|
-
{#each allTokenOutputs as output, i}
|
|
15
|
-
<TokenIOInput {i} label="Output" vault={output} {gui} />
|
|
16
|
-
{/each}
|
|
17
|
-
{/if}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
|
-
import type { DotrainOrderGui, OrderIOCfg } from '@rainlanguage/orderbook/js_api';
|
|
3
|
-
declare const __propDef: {
|
|
4
|
-
props: {
|
|
5
|
-
allTokenInputs?: OrderIOCfg[];
|
|
6
|
-
allTokenOutputs?: OrderIOCfg[];
|
|
7
|
-
gui: DotrainOrderGui;
|
|
8
|
-
};
|
|
9
|
-
events: {
|
|
10
|
-
[evt: string]: CustomEvent<any>;
|
|
11
|
-
};
|
|
12
|
-
slots: {};
|
|
13
|
-
exports?: {} | undefined;
|
|
14
|
-
bindings?: string | undefined;
|
|
15
|
-
};
|
|
16
|
-
export type TokenIoSectionProps = typeof __propDef.props;
|
|
17
|
-
export type TokenIoSectionEvents = typeof __propDef.events;
|
|
18
|
-
export type TokenIoSectionSlots = typeof __propDef.slots;
|
|
19
|
-
export default class TokenIoSection extends SvelteComponent<TokenIoSectionProps, TokenIoSectionEvents, TokenIoSectionSlots> {
|
|
20
|
-
}
|
|
21
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Config } from '@wagmi/core';
|
|
2
|
-
import type { DepositAndAddOrderCalldataResult, DotrainOrderGui } from '@rainlanguage/orderbook/js_api';
|
|
3
|
-
import type { Hex } from 'viem';
|
|
4
|
-
import type { ExtendedApprovalCalldata } from '../../stores/transactionStore';
|
|
5
|
-
export declare enum AddOrderErrors {
|
|
6
|
-
ADD_ORDER_FAILED = "Failed to add order",
|
|
7
|
-
MISSING_GUI = "Order GUI is required",
|
|
8
|
-
MISSING_CONFIG = "Wagmi config is required",
|
|
9
|
-
NO_WALLET = "No wallet address found"
|
|
10
|
-
}
|
|
11
|
-
export interface HandleAddOrderResult {
|
|
12
|
-
approvals: ExtendedApprovalCalldata[];
|
|
13
|
-
deploymentCalldata: DepositAndAddOrderCalldataResult;
|
|
14
|
-
orderbookAddress: Hex;
|
|
15
|
-
chainId: number;
|
|
16
|
-
}
|
|
17
|
-
export declare function getDeploymentTransactionArgs(gui: DotrainOrderGui, wagmiConfig: Config | undefined): Promise<HandleAddOrderResult>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { getAccount } from '@wagmi/core';
|
|
2
|
-
export var AddOrderErrors;
|
|
3
|
-
(function (AddOrderErrors) {
|
|
4
|
-
AddOrderErrors["ADD_ORDER_FAILED"] = "Failed to add order";
|
|
5
|
-
AddOrderErrors["MISSING_GUI"] = "Order GUI is required";
|
|
6
|
-
AddOrderErrors["MISSING_CONFIG"] = "Wagmi config is required";
|
|
7
|
-
AddOrderErrors["NO_WALLET"] = "No wallet address found";
|
|
8
|
-
})(AddOrderErrors || (AddOrderErrors = {}));
|
|
9
|
-
export async function getDeploymentTransactionArgs(gui, wagmiConfig) {
|
|
10
|
-
if (!wagmiConfig) {
|
|
11
|
-
throw new Error(AddOrderErrors.MISSING_CONFIG);
|
|
12
|
-
}
|
|
13
|
-
const { address } = getAccount(wagmiConfig);
|
|
14
|
-
if (!address) {
|
|
15
|
-
throw new Error(AddOrderErrors.NO_WALLET);
|
|
16
|
-
}
|
|
17
|
-
const { approvals, deploymentCalldata, orderbookAddress, chainId } = await gui.getDeploymentTransactionArgs(address);
|
|
18
|
-
return {
|
|
19
|
-
approvals,
|
|
20
|
-
deploymentCalldata,
|
|
21
|
-
orderbookAddress: orderbookAddress,
|
|
22
|
-
chainId
|
|
23
|
-
};
|
|
24
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<script>import { Button } from "flowbite-svelte";
|
|
2
|
-
import { ArrowDownOutline, ArrowUpOutline } from "flowbite-svelte-icons";
|
|
3
|
-
export let handleDepositOrWithdrawModal;
|
|
4
|
-
export let vault;
|
|
5
|
-
export let chainId;
|
|
6
|
-
export let rpcUrl;
|
|
7
|
-
export let query;
|
|
8
|
-
export let subgraphUrl;
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<Button
|
|
12
|
-
data-testid="depositOrWithdrawButton"
|
|
13
|
-
color="light"
|
|
14
|
-
size="xs"
|
|
15
|
-
on:click={() =>
|
|
16
|
-
handleDepositOrWithdrawModal({
|
|
17
|
-
open: true,
|
|
18
|
-
args: {
|
|
19
|
-
vault,
|
|
20
|
-
onDepositOrWithdraw: $query.refetch,
|
|
21
|
-
action: 'deposit',
|
|
22
|
-
chainId,
|
|
23
|
-
rpcUrl,
|
|
24
|
-
subgraphUrl
|
|
25
|
-
}
|
|
26
|
-
})}><ArrowUpOutline size="xs" /></Button
|
|
27
|
-
>
|
|
28
|
-
<Button
|
|
29
|
-
data-testid="depositOrWithdrawButton"
|
|
30
|
-
color="light"
|
|
31
|
-
size="xs"
|
|
32
|
-
on:click={() =>
|
|
33
|
-
handleDepositOrWithdrawModal({
|
|
34
|
-
open: true,
|
|
35
|
-
args: {
|
|
36
|
-
vault,
|
|
37
|
-
onDepositOrWithdraw: $query.refetch,
|
|
38
|
-
action: 'withdraw',
|
|
39
|
-
chainId,
|
|
40
|
-
rpcUrl,
|
|
41
|
-
subgraphUrl
|
|
42
|
-
}
|
|
43
|
-
})}><ArrowDownOutline size="xs" /></Button
|
|
44
|
-
>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
|
-
import type { SgVault } from '@rainlanguage/orderbook/js_api';
|
|
3
|
-
import type { CreateQueryResult } from '@tanstack/svelte-query';
|
|
4
|
-
import type { DepositOrWithdrawModalProps } from '../../types/modal';
|
|
5
|
-
declare const __propDef: {
|
|
6
|
-
props: {
|
|
7
|
-
handleDepositOrWithdrawModal: (props: DepositOrWithdrawModalProps) => void;
|
|
8
|
-
vault: SgVault;
|
|
9
|
-
chainId: number;
|
|
10
|
-
rpcUrl: string;
|
|
11
|
-
query: CreateQueryResult;
|
|
12
|
-
subgraphUrl: string;
|
|
13
|
-
};
|
|
14
|
-
events: {
|
|
15
|
-
[evt: string]: CustomEvent<any>;
|
|
16
|
-
};
|
|
17
|
-
slots: {};
|
|
18
|
-
exports?: {} | undefined;
|
|
19
|
-
bindings?: string | undefined;
|
|
20
|
-
};
|
|
21
|
-
export type DepositOrWithdrawButtonsProps = typeof __propDef.props;
|
|
22
|
-
export type DepositOrWithdrawButtonsEvents = typeof __propDef.events;
|
|
23
|
-
export type DepositOrWithdrawButtonsSlots = typeof __propDef.slots;
|
|
24
|
-
export default class DepositOrWithdrawButtons extends SvelteComponent<DepositOrWithdrawButtonsProps, DepositOrWithdrawButtonsEvents, DepositOrWithdrawButtonsSlots> {
|
|
25
|
-
}
|
|
26
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<script>import DropdownCheckbox from "./DropdownCheckbox.svelte";
|
|
2
|
-
export let activeOrderStatus;
|
|
3
|
-
const orderStatusOptions = {
|
|
4
|
-
Active: "active",
|
|
5
|
-
Inactive: "inactive"
|
|
6
|
-
};
|
|
7
|
-
function handleStatusChange(event) {
|
|
8
|
-
let status = void 0;
|
|
9
|
-
let items = Object.keys(event.detail);
|
|
10
|
-
if (items.length === 0 || items.length === 2) {
|
|
11
|
-
status = void 0;
|
|
12
|
-
} else if (items.includes("Active")) {
|
|
13
|
-
status = true;
|
|
14
|
-
} else if (items.includes("Inactive")) {
|
|
15
|
-
status = false;
|
|
16
|
-
}
|
|
17
|
-
activeOrderStatus.set(status);
|
|
18
|
-
}
|
|
19
|
-
$: value = $activeOrderStatus === void 0 ? {} : $activeOrderStatus ? { Active: "active" } : { Inactive: "inactive" };
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<div data-testid="order-status-dropdown">
|
|
23
|
-
<DropdownCheckbox
|
|
24
|
-
options={orderStatusOptions}
|
|
25
|
-
on:change={handleStatusChange}
|
|
26
|
-
label="Status"
|
|
27
|
-
showAllLabel={false}
|
|
28
|
-
onlyTitle={true}
|
|
29
|
-
{value}
|
|
30
|
-
/>
|
|
31
|
-
</div>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
|
-
import type { Writable } from 'svelte/store';
|
|
3
|
-
declare const __propDef: {
|
|
4
|
-
props: {
|
|
5
|
-
activeOrderStatus: Writable<boolean | undefined>;
|
|
6
|
-
};
|
|
7
|
-
events: {
|
|
8
|
-
[evt: string]: CustomEvent<any>;
|
|
9
|
-
};
|
|
10
|
-
slots: {};
|
|
11
|
-
exports?: {} | undefined;
|
|
12
|
-
bindings?: string | undefined;
|
|
13
|
-
};
|
|
14
|
-
export type DropdownOrderStatusProps = typeof __propDef.props;
|
|
15
|
-
export type DropdownOrderStatusEvents = typeof __propDef.events;
|
|
16
|
-
export type DropdownOrderStatusSlots = typeof __propDef.slots;
|
|
17
|
-
export default class DropdownOrderStatus extends SvelteComponent<DropdownOrderStatusProps, DropdownOrderStatusEvents, DropdownOrderStatusSlots> {
|
|
18
|
-
}
|
|
19
|
-
export {};
|