@rainlanguage/ui-components 0.0.1-alpha.39 → 0.0.1-alpha.41
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/__mocks__/stores.d.ts +0 -6
- package/dist/__mocks__/stores.js +0 -7
- package/dist/components/CheckboxMyItemsOnly.svelte +3 -2
- package/dist/components/CheckboxMyItemsOnly.svelte.d.ts +0 -1
- package/dist/components/ListViewOrderbookFilters.svelte +7 -8
- package/dist/components/ListViewOrderbookFilters.svelte.d.ts +0 -1
- package/dist/components/deployment/DeploymentSteps.svelte +12 -6
- package/dist/components/deployment/DeploymentSteps.svelte.d.ts +0 -1
- package/dist/components/deployment/FieldDefinitionInput.svelte +3 -4
- package/dist/components/deployment/FieldDefinitionInput.svelte.d.ts +1 -2
- package/dist/components/deployment/getDeploymentTransactionArgs.d.ts +2 -6
- package/dist/components/deployment/getDeploymentTransactionArgs.js +2 -13
- package/dist/components/detail/DepositOrWithdrawButtons.svelte +6 -2
- package/dist/components/detail/OrderDetail.svelte +6 -4
- package/dist/components/detail/OrderDetail.svelte.d.ts +0 -1
- package/dist/components/detail/VaultDetail.svelte +3 -2
- package/dist/components/detail/VaultDetail.svelte.d.ts +0 -1
- package/dist/components/tables/OrdersListTable.svelte +3 -3
- package/dist/components/tables/OrdersListTable.svelte.d.ts +0 -2
- package/dist/components/tables/VaultsListTable.svelte +3 -3
- package/dist/components/tables/VaultsListTable.svelte.d.ts +0 -1
- package/dist/components/wallet/WalletConnect.svelte +4 -3
- package/dist/components/wallet/WalletConnect.svelte.d.ts +0 -1
- package/dist/errors/DeploymentStepsError.d.ts +2 -1
- package/dist/errors/DeploymentStepsError.js +1 -0
- package/dist/types/transaction.d.ts +4 -0
- package/package.json +2 -2
|
@@ -59,12 +59,6 @@ export declare const mockSubgraphUrlStore: {
|
|
|
59
59
|
set: (this: void, value: string) => void;
|
|
60
60
|
mockSetSubscribeValue: (value: string) => void;
|
|
61
61
|
};
|
|
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
62
|
export declare const mockChainIdStore: {
|
|
69
63
|
subscribe: (this: void, run: import("svelte/store").Subscriber<number>, invalidate?: import("svelte/store").Invalidator<number> | undefined) => import("svelte/store").Unsubscriber;
|
|
70
64
|
set: (this: void, value: number) => void;
|
package/dist/__mocks__/stores.js
CHANGED
|
@@ -14,7 +14,6 @@ const mockActiveOrderbookRefWritable = writable('');
|
|
|
14
14
|
const mockActiveAccountsWritable = writable({});
|
|
15
15
|
const mockSubgraphUrlWritable = writable('');
|
|
16
16
|
const mockWalletAddressMatchesOrBlankWritable = writable(() => false);
|
|
17
|
-
const mockSignerAddressWritable = writable('');
|
|
18
17
|
const mockChainIdWritable = writable(0);
|
|
19
18
|
const mockConnectedWritable = writable(true);
|
|
20
19
|
const mockWagmiConfigWritable = writable(mockWeb3Config);
|
|
@@ -78,12 +77,6 @@ export const mockSubgraphUrlStore = {
|
|
|
78
77
|
set: mockSubgraphUrlWritable.set,
|
|
79
78
|
mockSetSubscribeValue: (value) => mockSubgraphUrlWritable.set(value)
|
|
80
79
|
};
|
|
81
|
-
export const mockSignerAddressStore = {
|
|
82
|
-
subscribe: mockSignerAddressWritable.subscribe,
|
|
83
|
-
set: mockSignerAddressWritable.set,
|
|
84
|
-
mockSetSubscribeValue: (value) => mockSignerAddressWritable.set(value),
|
|
85
|
-
update: mockSignerAddressWritable.update
|
|
86
|
-
};
|
|
87
80
|
export const mockChainIdStore = {
|
|
88
81
|
subscribe: mockChainIdWritable.subscribe,
|
|
89
82
|
set: mockChainIdWritable.set,
|
|
@@ -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 @@ import DropdownOrderListAccounts from "./dropdown/DropdownOrderListAccounts.svel
|
|
|
6
6
|
import InputOrderHash from "./input/InputOrderHash.svelte";
|
|
7
7
|
import CheckboxZeroBalanceVault from "./CheckboxZeroBalanceVault.svelte";
|
|
8
8
|
import CheckboxMyItemsOnly from "./CheckboxMyItemsOnly.svelte";
|
|
9
|
+
import { useAccount } from "../providers/wallet/useAccount";
|
|
9
10
|
export let settings;
|
|
10
11
|
export let accounts;
|
|
11
12
|
export let hideZeroBalanceVaults;
|
|
@@ -16,7 +17,7 @@ export let activeOrderStatus;
|
|
|
16
17
|
export let orderHash;
|
|
17
18
|
export let isVaultsPage;
|
|
18
19
|
export let isOrdersPage;
|
|
19
|
-
|
|
20
|
+
const { account } = useAccount();
|
|
20
21
|
</script>
|
|
21
22
|
|
|
22
23
|
<div
|
|
@@ -30,13 +31,11 @@ export let signerAddress;
|
|
|
30
31
|
{:else}
|
|
31
32
|
{#if $accounts && !Object.values($accounts).length}
|
|
32
33
|
<div class="mt-4 w-full lg:w-auto" data-testid="my-items-only">
|
|
33
|
-
<CheckboxMyItemsOnly
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
{#if !$signerAddress}
|
|
39
|
-
<Tooltip>Connect a wallet to filter by {isVaultsPage ? 'vault' : 'order'} owner</Tooltip>
|
|
34
|
+
<CheckboxMyItemsOnly context={isVaultsPage ? 'vaults' : 'orders'} {showMyItemsOnly} />
|
|
35
|
+
{#if !$account}
|
|
36
|
+
<Tooltip class="z-50"
|
|
37
|
+
>Connect a wallet to filter by {isVaultsPage ? 'vault' : 'order'} owner</Tooltip
|
|
38
|
+
>
|
|
40
39
|
{/if}
|
|
41
40
|
</div>
|
|
42
41
|
{/if}
|
|
@@ -20,6 +20,7 @@ import DepositInput from "./DepositInput.svelte";
|
|
|
20
20
|
import SelectToken from "./SelectToken.svelte";
|
|
21
21
|
import DeploymentSectionHeader from "./DeploymentSectionHeader.svelte";
|
|
22
22
|
import { useGui } from "../../hooks/useGui";
|
|
23
|
+
import { useAccount } from "../../providers/wallet/useAccount";
|
|
23
24
|
export let settings;
|
|
24
25
|
export let dotrain;
|
|
25
26
|
export let deployment;
|
|
@@ -34,6 +35,7 @@ let allTokensSelected = false;
|
|
|
34
35
|
let showAdvancedOptions = false;
|
|
35
36
|
let checkingDeployment = false;
|
|
36
37
|
let allTokenInfos = [];
|
|
38
|
+
const { account } = useAccount();
|
|
37
39
|
const gui = useGui();
|
|
38
40
|
let selectTokens = void 0;
|
|
39
41
|
let networkKey = "";
|
|
@@ -42,7 +44,6 @@ let deploymentStepsError = DeploymentStepsError.error;
|
|
|
42
44
|
export let wagmiConfig;
|
|
43
45
|
export let wagmiConnected;
|
|
44
46
|
export let appKitModal;
|
|
45
|
-
export let signerAddress;
|
|
46
47
|
onMount(async () => {
|
|
47
48
|
const selectTokensResult = gui.getSelectTokens();
|
|
48
49
|
if (selectTokensResult.error) {
|
|
@@ -153,10 +154,14 @@ async function handleDeployButtonClick() {
|
|
|
153
154
|
DeploymentStepsError.catch(null, DeploymentStepsErrorCode.NO_CHAIN);
|
|
154
155
|
return;
|
|
155
156
|
}
|
|
157
|
+
if (!$account) {
|
|
158
|
+
DeploymentStepsError.catch(null, DeploymentStepsErrorCode.NO_WALLET);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
156
161
|
let result = null;
|
|
157
162
|
checkingDeployment = true;
|
|
158
163
|
try {
|
|
159
|
-
result = await getDeploymentTransactionArgs(gui, $
|
|
164
|
+
result = await getDeploymentTransactionArgs(gui, $account);
|
|
160
165
|
} catch (e) {
|
|
161
166
|
checkingDeployment = false;
|
|
162
167
|
DeploymentStepsError.catch(e, DeploymentStepsErrorCode.ADD_ORDER_FAILED);
|
|
@@ -177,7 +182,8 @@ async function handleDeployButtonClick() {
|
|
|
177
182
|
args: {
|
|
178
183
|
...result,
|
|
179
184
|
subgraphUrl,
|
|
180
|
-
network: networkKey
|
|
185
|
+
network: networkKey,
|
|
186
|
+
account
|
|
181
187
|
}
|
|
182
188
|
});
|
|
183
189
|
};
|
|
@@ -254,7 +260,7 @@ const areAllTokensSelected = async () => {
|
|
|
254
260
|
{#if allTokensSelected || selectTokens?.length === 0}
|
|
255
261
|
{#if allFieldDefinitionsWithoutDefaults.length > 0}
|
|
256
262
|
{#each allFieldDefinitionsWithoutDefaults as fieldDefinition}
|
|
257
|
-
<FieldDefinitionInput {fieldDefinition}
|
|
263
|
+
<FieldDefinitionInput {fieldDefinition} />
|
|
258
264
|
{/each}
|
|
259
265
|
{/if}
|
|
260
266
|
|
|
@@ -262,7 +268,7 @@ const areAllTokensSelected = async () => {
|
|
|
262
268
|
|
|
263
269
|
{#if allFieldDefinitionsWithDefaults.length > 0 && showAdvancedOptions}
|
|
264
270
|
{#each allFieldDefinitionsWithDefaults as fieldDefinition}
|
|
265
|
-
<FieldDefinitionInput {fieldDefinition}
|
|
271
|
+
<FieldDefinitionInput {fieldDefinition} />
|
|
266
272
|
{/each}
|
|
267
273
|
{/if}
|
|
268
274
|
|
|
@@ -306,7 +312,7 @@ const areAllTokensSelected = async () => {
|
|
|
306
312
|
{/if}
|
|
307
313
|
</Button>
|
|
308
314
|
{:else}
|
|
309
|
-
<WalletConnect {appKitModal} connected={wagmiConnected}
|
|
315
|
+
<WalletConnect {appKitModal} connected={wagmiConnected} />
|
|
310
316
|
{/if}
|
|
311
317
|
<ComposedRainlangModal {gui} />
|
|
312
318
|
<ShareChoicesButton handleShareChoices={_handleShareChoices} />
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
<script>import { Input } from "flowbite-svelte";
|
|
2
|
-
import {
|
|
3
|
-
DotrainOrderGui
|
|
4
|
-
} from "@rainlanguage/orderbook/js_api";
|
|
2
|
+
import {} from "@rainlanguage/orderbook/js_api";
|
|
5
3
|
import ButtonSelectOption from "./ButtonSelectOption.svelte";
|
|
6
4
|
import DeploymentSectionHeader from "./DeploymentSectionHeader.svelte";
|
|
7
5
|
import { onMount } from "svelte";
|
|
6
|
+
import { useGui } from "../../hooks/useGui";
|
|
8
7
|
export let fieldDefinition;
|
|
9
|
-
|
|
8
|
+
const gui = useGui();
|
|
10
9
|
let currentValue;
|
|
11
10
|
let inputValue = currentValue?.value ? currentValue?.value : fieldDefinition.default || null;
|
|
12
11
|
onMount(() => {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import {
|
|
2
|
+
import { type GuiFieldDefinitionCfg } from '@rainlanguage/orderbook/js_api';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
fieldDefinition: GuiFieldDefinitionCfg;
|
|
6
|
-
gui: DotrainOrderGui;
|
|
7
6
|
};
|
|
8
7
|
events: {
|
|
9
8
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import type { Config } from '@wagmi/core';
|
|
2
1
|
import type { DepositAndAddOrderCalldataResult, DotrainOrderGui } from '@rainlanguage/orderbook/js_api';
|
|
3
2
|
import type { Hex } from 'viem';
|
|
4
3
|
import type { ExtendedApprovalCalldata } from '../../stores/transactionStore';
|
|
5
4
|
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"
|
|
5
|
+
ADD_ORDER_FAILED = "Failed to add order"
|
|
10
6
|
}
|
|
11
7
|
export interface HandleAddOrderResult {
|
|
12
8
|
approvals: ExtendedApprovalCalldata[];
|
|
@@ -14,4 +10,4 @@ export interface HandleAddOrderResult {
|
|
|
14
10
|
orderbookAddress: Hex;
|
|
15
11
|
chainId: number;
|
|
16
12
|
}
|
|
17
|
-
export declare function getDeploymentTransactionArgs(gui: DotrainOrderGui,
|
|
13
|
+
export declare function getDeploymentTransactionArgs(gui: DotrainOrderGui, account: Hex): Promise<HandleAddOrderResult>;
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
import { getAccount } from '@wagmi/core';
|
|
2
1
|
export var AddOrderErrors;
|
|
3
2
|
(function (AddOrderErrors) {
|
|
4
3
|
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
4
|
})(AddOrderErrors || (AddOrderErrors = {}));
|
|
9
|
-
export async function getDeploymentTransactionArgs(gui,
|
|
10
|
-
|
|
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 result = await gui.getDeploymentTransactionArgs(address);
|
|
5
|
+
export async function getDeploymentTransactionArgs(gui, account) {
|
|
6
|
+
const result = await gui.getDeploymentTransactionArgs(account);
|
|
18
7
|
if (result.error) {
|
|
19
8
|
throw new Error(result.error.msg);
|
|
20
9
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
<script>import { Button } from "flowbite-svelte";
|
|
2
2
|
import { ArrowDownOutline, ArrowUpOutline } from "flowbite-svelte-icons";
|
|
3
|
+
import { useAccount } from "../../providers/wallet/useAccount";
|
|
3
4
|
export let handleDepositOrWithdrawModal;
|
|
4
5
|
export let vault;
|
|
5
6
|
export let chainId;
|
|
6
7
|
export let rpcUrl;
|
|
7
8
|
export let query;
|
|
8
9
|
export let subgraphUrl;
|
|
10
|
+
const { account } = useAccount();
|
|
9
11
|
</script>
|
|
10
12
|
|
|
11
13
|
<Button
|
|
@@ -21,7 +23,8 @@ export let subgraphUrl;
|
|
|
21
23
|
action: 'deposit',
|
|
22
24
|
chainId,
|
|
23
25
|
rpcUrl,
|
|
24
|
-
subgraphUrl
|
|
26
|
+
subgraphUrl,
|
|
27
|
+
account
|
|
25
28
|
}
|
|
26
29
|
})}><ArrowUpOutline size="xs" /></Button
|
|
27
30
|
>
|
|
@@ -38,7 +41,8 @@ export let subgraphUrl;
|
|
|
38
41
|
action: 'withdraw',
|
|
39
42
|
chainId,
|
|
40
43
|
rpcUrl,
|
|
41
|
-
subgraphUrl
|
|
44
|
+
subgraphUrl,
|
|
45
|
+
account
|
|
42
46
|
}
|
|
43
47
|
})}><ArrowDownOutline size="xs" /></Button
|
|
44
48
|
>
|
|
@@ -20,6 +20,7 @@ import DepositOrWithdrawButtons from "./DepositOrWithdrawButtons.svelte";
|
|
|
20
20
|
import Refresh from "../icon/Refresh.svelte";
|
|
21
21
|
import { invalidateIdQuery } from "../../queries/queryClient";
|
|
22
22
|
import { InfoCircleOutline } from "flowbite-svelte-icons";
|
|
23
|
+
import { useAccount } from "../../providers/wallet/useAccount";
|
|
23
24
|
import { isAddressEqual, isAddress } from "viem";
|
|
24
25
|
export let handleDepositOrWithdrawModal = void 0;
|
|
25
26
|
export let handleOrderRemoveModal = void 0;
|
|
@@ -34,10 +35,10 @@ export let rpcUrl;
|
|
|
34
35
|
export let subgraphUrl;
|
|
35
36
|
export let chainId;
|
|
36
37
|
export let wagmiConfig = void 0;
|
|
37
|
-
export let signerAddress = void 0;
|
|
38
38
|
let codeMirrorDisabled = true;
|
|
39
39
|
let codeMirrorStyles = {};
|
|
40
40
|
const queryClient = useQueryClient();
|
|
41
|
+
const { account } = useAccount();
|
|
41
42
|
$: orderDetailQuery = createQuery({
|
|
42
43
|
queryKey: [orderHash, QKEY_ORDER + orderHash],
|
|
43
44
|
queryFn: () => {
|
|
@@ -69,7 +70,7 @@ $: subgraphName = $page.url.pathname.split("/")[2]?.split("-")[0];
|
|
|
69
70
|
</div>
|
|
70
71
|
|
|
71
72
|
<div class="flex items-center gap-2">
|
|
72
|
-
{#if data && $
|
|
73
|
+
{#if data && $account && isAddress($account) && isAddress(data.order.owner) && isAddressEqual($account, data.order.owner) && data.order.active && handleOrderRemoveModal && $wagmiConfig && chainId && orderbookAddress}
|
|
73
74
|
<Button
|
|
74
75
|
data-testid="remove-button"
|
|
75
76
|
color="dark"
|
|
@@ -81,7 +82,8 @@ $: subgraphName = $page.url.pathname.split("/")[2]?.split("-")[0];
|
|
|
81
82
|
onRemove: $orderDetailQuery.refetch,
|
|
82
83
|
chainId,
|
|
83
84
|
orderbookAddress,
|
|
84
|
-
subgraphUrl
|
|
85
|
+
subgraphUrl,
|
|
86
|
+
account
|
|
85
87
|
}
|
|
86
88
|
})}
|
|
87
89
|
disabled={!handleOrderRemoveModal}
|
|
@@ -136,7 +138,7 @@ $: subgraphName = $page.url.pathname.split("/")[2]?.split("-")[0];
|
|
|
136
138
|
{#each data.vaults.get(type) || [] as vault}
|
|
137
139
|
<ButtonVaultLink tokenVault={vault} {subgraphName}>
|
|
138
140
|
<svelte:fragment slot="buttons">
|
|
139
|
-
{#if handleDepositOrWithdrawModal && $
|
|
141
|
+
{#if handleDepositOrWithdrawModal && $account && isAddress($account) && isAddress(vault.owner) && isAddressEqual($account, vault.owner) && chainId}
|
|
140
142
|
<DepositOrWithdrawButtons
|
|
141
143
|
{vault}
|
|
142
144
|
{chainId}
|
|
@@ -16,6 +16,7 @@ import OrderOrVaultHash from "../OrderOrVaultHash.svelte";
|
|
|
16
16
|
import DepositOrWithdrawButtons from "./DepositOrWithdrawButtons.svelte";
|
|
17
17
|
import Refresh from "../icon/Refresh.svelte";
|
|
18
18
|
import { invalidateIdQuery } from "../../queries/queryClient";
|
|
19
|
+
import { useAccount } from "../../providers/wallet/useAccount";
|
|
19
20
|
export let handleDepositOrWithdrawModal = void 0;
|
|
20
21
|
export let id;
|
|
21
22
|
export let network;
|
|
@@ -27,11 +28,11 @@ export let activeNetworkRef;
|
|
|
27
28
|
export let activeOrderbookRef;
|
|
28
29
|
export let settings;
|
|
29
30
|
export let wagmiConfig = void 0;
|
|
30
|
-
export let signerAddress = void 0;
|
|
31
31
|
const subgraphUrl = $settings?.subgraphs?.[network] || "";
|
|
32
32
|
const chainId = $settings?.networks?.[network]?.["chain-id"] || 0;
|
|
33
33
|
const rpcUrl = $settings?.networks?.[network]?.["rpc"] || "";
|
|
34
34
|
const queryClient = useQueryClient();
|
|
35
|
+
const { account } = useAccount();
|
|
35
36
|
$: vaultDetailQuery = createQuery({
|
|
36
37
|
queryKey: [id, QKEY_VAULT + id],
|
|
37
38
|
queryFn: () => {
|
|
@@ -64,7 +65,7 @@ onDestroy(() => {
|
|
|
64
65
|
{data.token.name}
|
|
65
66
|
</div>
|
|
66
67
|
<div class="flex items-center gap-2">
|
|
67
|
-
{#if $wagmiConfig && handleDepositOrWithdrawModal && $
|
|
68
|
+
{#if $wagmiConfig && handleDepositOrWithdrawModal && $account && isAddress($account) && isAddressEqual($account, data.owner)}
|
|
68
69
|
<DepositOrWithdrawButtons
|
|
69
70
|
vault={data}
|
|
70
71
|
{chainId}
|
|
@@ -18,7 +18,6 @@ declare const __propDef: {
|
|
|
18
18
|
activeOrderbookRef: AppStoresInterface["activeOrderbookRef"];
|
|
19
19
|
settings: any;
|
|
20
20
|
wagmiConfig?: Writable<Config> | undefined;
|
|
21
|
-
signerAddress?: Writable<string | null> | undefined;
|
|
22
21
|
};
|
|
23
22
|
events: {
|
|
24
23
|
[evt: string]: CustomEvent<any>;
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
TableBodyCell,
|
|
18
18
|
TableHeadCell
|
|
19
19
|
} from "flowbite-svelte";
|
|
20
|
+
import { useAccount } from "../../providers/wallet/useAccount";
|
|
20
21
|
export const walletAddressMatchesOrBlank = void 0;
|
|
21
22
|
export const handleOrderRemoveModal = void 0;
|
|
22
23
|
export let activeSubgraphs;
|
|
@@ -28,16 +29,16 @@ export let orderHash;
|
|
|
28
29
|
export let hideZeroBalanceVaults;
|
|
29
30
|
export let showMyItemsOnly;
|
|
30
31
|
export let currentRoute;
|
|
31
|
-
export let signerAddress;
|
|
32
32
|
export let activeNetworkRef;
|
|
33
33
|
export let activeOrderbookRef;
|
|
34
|
+
const { account } = useAccount();
|
|
34
35
|
$: multiSubgraphArgs = Object.entries(
|
|
35
36
|
Object.keys($activeSubgraphs ?? {}).length ? $activeSubgraphs : $settings?.subgraphs ?? {}
|
|
36
37
|
).map(([name, url]) => ({
|
|
37
38
|
name,
|
|
38
39
|
url
|
|
39
40
|
}));
|
|
40
|
-
$: owners = $activeAccountsItems && Object.values($activeAccountsItems).length > 0 ? Object.values($activeAccountsItems) : $showMyItemsOnly && $
|
|
41
|
+
$: owners = $activeAccountsItems && Object.values($activeAccountsItems).length > 0 ? Object.values($activeAccountsItems) : $showMyItemsOnly && $account ? [$account] : [];
|
|
41
42
|
$: query = createInfiniteQuery({
|
|
42
43
|
queryKey: [
|
|
43
44
|
QKEY_ORDERS,
|
|
@@ -82,7 +83,6 @@ $: isOrdersPage = currentRoute.startsWith("/orders");
|
|
|
82
83
|
{hideZeroBalanceVaults}
|
|
83
84
|
{isVaultsPage}
|
|
84
85
|
{isOrdersPage}
|
|
85
|
-
{signerAddress}
|
|
86
86
|
/>
|
|
87
87
|
|
|
88
88
|
<AppTable
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type { AppStoresInterface } from '../../types/appStores';
|
|
3
|
-
import type { Writable } from 'svelte/store';
|
|
4
3
|
declare class __sveltets_Render<T> {
|
|
5
4
|
props(): {
|
|
6
5
|
walletAddressMatchesOrBlank?: any;
|
|
@@ -14,7 +13,6 @@ declare class __sveltets_Render<T> {
|
|
|
14
13
|
hideZeroBalanceVaults: AppStoresInterface["hideZeroBalanceVaults"];
|
|
15
14
|
showMyItemsOnly: AppStoresInterface["showMyItemsOnly"];
|
|
16
15
|
currentRoute: string;
|
|
17
|
-
signerAddress: Writable<string | null> | undefined;
|
|
18
16
|
activeNetworkRef: AppStoresInterface["activeNetworkRef"];
|
|
19
17
|
activeOrderbookRef: AppStoresInterface["activeOrderbookRef"];
|
|
20
18
|
};
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
getVaults
|
|
17
17
|
} from "@rainlanguage/orderbook/js_api";
|
|
18
18
|
import {} from "svelte/store";
|
|
19
|
+
import { useAccount } from "../../providers/wallet/useAccount";
|
|
19
20
|
export let activeOrderbook;
|
|
20
21
|
export let subgraphUrl;
|
|
21
22
|
export let accounts;
|
|
@@ -34,14 +35,14 @@ export let handleDepositModal = void 0;
|
|
|
34
35
|
export let handleWithdrawModal = void 0;
|
|
35
36
|
export let currentRoute;
|
|
36
37
|
export let showMyItemsOnly;
|
|
37
|
-
|
|
38
|
+
const { account } = useAccount();
|
|
38
39
|
$: multiSubgraphArgs = Object.entries(
|
|
39
40
|
Object.keys($activeSubgraphs ?? {}).length ? $activeSubgraphs : $settings?.subgraphs ?? {}
|
|
40
41
|
).map(([name, url]) => ({
|
|
41
42
|
name,
|
|
42
43
|
url
|
|
43
44
|
}));
|
|
44
|
-
$: owners = $activeAccountsItems && Object.values($activeAccountsItems).length > 0 ? Object.values($activeAccountsItems) : $showMyItemsOnly && $
|
|
45
|
+
$: owners = $activeAccountsItems && Object.values($activeAccountsItems).length > 0 ? Object.values($activeAccountsItems) : $showMyItemsOnly && $account ? [$account] : [];
|
|
45
46
|
$: query = createInfiniteQuery({
|
|
46
47
|
queryKey: [
|
|
47
48
|
QKEY_VAULTS,
|
|
@@ -90,7 +91,6 @@ const AppTable = TanstackAppTable;
|
|
|
90
91
|
{hideZeroBalanceVaults}
|
|
91
92
|
{isVaultsPage}
|
|
92
93
|
{isOrdersPage}
|
|
93
|
-
{signerAddress}
|
|
94
94
|
/>
|
|
95
95
|
<AppTable
|
|
96
96
|
{query}
|
|
@@ -25,7 +25,6 @@ declare class __sveltets_Render<T> {
|
|
|
25
25
|
handleWithdrawModal?: ((vault: SgVault, refetch: () => void) => void) | undefined;
|
|
26
26
|
currentRoute: string;
|
|
27
27
|
showMyItemsOnly: AppStoresInterface["showMyItemsOnly"];
|
|
28
|
-
signerAddress: Writable<string | null> | undefined;
|
|
29
28
|
};
|
|
30
29
|
events(): {} & {
|
|
31
30
|
[evt: string]: CustomEvent<any>;
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
import { CheckCircleOutline } from "flowbite-svelte-icons";
|
|
3
3
|
import { twMerge } from "tailwind-merge";
|
|
4
4
|
import truncateEthAddress from "truncate-eth-address";
|
|
5
|
+
import { useAccount } from "../../providers/wallet/useAccount";
|
|
5
6
|
export let appKitModal;
|
|
6
7
|
export let connected;
|
|
7
|
-
export let signerAddress;
|
|
8
8
|
export let classes = "";
|
|
9
|
+
const { account } = useAccount();
|
|
9
10
|
function handleClick() {
|
|
10
11
|
$appKitModal.open();
|
|
11
12
|
}
|
|
@@ -18,9 +19,9 @@ function handleClick() {
|
|
|
18
19
|
class={twMerge('flex border border-gray-700 px-2 md:px-4 dark:border-gray-200', classes)}
|
|
19
20
|
color={$connected ? 'alternative' : 'primary'}
|
|
20
21
|
>
|
|
21
|
-
{#if $connected && $
|
|
22
|
+
{#if $connected && $account}
|
|
22
23
|
<span class="flex flex-row items-center gap-2 text-sm"
|
|
23
|
-
><CheckCircleOutline color="green" size="sm" />{truncateEthAddress($
|
|
24
|
+
><CheckCircleOutline color="green" size="sm" />{truncateEthAddress($account)}</span
|
|
24
25
|
>
|
|
25
26
|
{:else}
|
|
26
27
|
<span>Connect Wallet</span>
|
|
@@ -11,7 +11,8 @@ export declare enum DeploymentStepsErrorCode {
|
|
|
11
11
|
NO_GUI_DETAILS = "Error getting GUI details",
|
|
12
12
|
NO_CHAIN = "Unsupported chain ID",
|
|
13
13
|
SERIALIZE_ERROR = "Error serializing state",
|
|
14
|
-
ADD_ORDER_FAILED = "Failed to add order"
|
|
14
|
+
ADD_ORDER_FAILED = "Failed to add order",
|
|
15
|
+
NO_WALLET = "No account address found"
|
|
15
16
|
}
|
|
16
17
|
export declare class DeploymentStepsError extends Error {
|
|
17
18
|
code: DeploymentStepsErrorCode;
|
|
@@ -14,6 +14,7 @@ export var DeploymentStepsErrorCode;
|
|
|
14
14
|
DeploymentStepsErrorCode["NO_CHAIN"] = "Unsupported chain ID";
|
|
15
15
|
DeploymentStepsErrorCode["SERIALIZE_ERROR"] = "Error serializing state";
|
|
16
16
|
DeploymentStepsErrorCode["ADD_ORDER_FAILED"] = "Failed to add order";
|
|
17
|
+
DeploymentStepsErrorCode["NO_WALLET"] = "No account address found";
|
|
17
18
|
})(DeploymentStepsErrorCode || (DeploymentStepsErrorCode = {}));
|
|
18
19
|
export class DeploymentStepsError extends Error {
|
|
19
20
|
code;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ExtendedApprovalCalldata } from '../stores/transactionStore';
|
|
2
2
|
import type { Hex } from 'viem';
|
|
3
3
|
import type { DepositAndAddOrderCalldataResult, SgOrder, SgVault } from '@rainlanguage/orderbook/js_api';
|
|
4
|
+
import type { Account } from './account';
|
|
4
5
|
export type DeploymentArgs = {
|
|
5
6
|
approvals: ExtendedApprovalCalldata[];
|
|
6
7
|
deploymentCalldata: DepositAndAddOrderCalldataResult;
|
|
@@ -8,6 +9,7 @@ export type DeploymentArgs = {
|
|
|
8
9
|
chainId: number;
|
|
9
10
|
subgraphUrl: string;
|
|
10
11
|
network: string;
|
|
12
|
+
account: Account;
|
|
11
13
|
};
|
|
12
14
|
export type DepositOrWithdrawArgs = {
|
|
13
15
|
vault: SgVault;
|
|
@@ -16,6 +18,7 @@ export type DepositOrWithdrawArgs = {
|
|
|
16
18
|
chainId: number;
|
|
17
19
|
rpcUrl: string;
|
|
18
20
|
subgraphUrl: string;
|
|
21
|
+
account: Account;
|
|
19
22
|
};
|
|
20
23
|
export type OrderRemoveArgs = {
|
|
21
24
|
order: SgOrder;
|
|
@@ -23,4 +26,5 @@ export type OrderRemoveArgs = {
|
|
|
23
26
|
chainId: number;
|
|
24
27
|
orderbookAddress: Hex;
|
|
25
28
|
subgraphUrl: string;
|
|
29
|
+
account: Account;
|
|
26
30
|
};
|
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.41",
|
|
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",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@fontsource/dm-sans": "5.1.0",
|
|
54
54
|
"@imask/svelte": "7.6.1",
|
|
55
55
|
"@observablehq/plot": "0.6.16",
|
|
56
|
-
"@rainlanguage/orderbook": "0.0.1-alpha.
|
|
56
|
+
"@rainlanguage/orderbook": "0.0.1-alpha.41",
|
|
57
57
|
"@reown/appkit": "1.6.4",
|
|
58
58
|
"@reown/appkit-adapter-wagmi": "1.6.4",
|
|
59
59
|
"@sentry/sveltekit": "7.120.0",
|