@pear-protocol/symmio-client 0.2.8 → 0.2.10
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/react/index.d.mts +16 -17
- package/dist/react/index.d.ts +16 -17
- package/dist/react/index.js +45 -44
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +45 -44
- package/dist/react/index.mjs.map +1 -1
- package/dist/react/{provider-xhUge8b7.d.mts → provider-BoNiSPy9.d.mts} +2 -8
- package/dist/react/{provider-xhUge8b7.d.ts → provider-BoNiSPy9.d.ts} +2 -8
- package/dist/react/provider.d.mts +1 -1
- package/dist/react/provider.d.ts +1 -1
- package/dist/react/provider.js +14 -20
- package/dist/react/provider.js.map +1 -1
- package/dist/react/provider.mjs +15 -21
- package/dist/react/provider.mjs.map +1 -1
- package/package.json +3 -3
package/dist/react/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { S as SymmioSDKConfig } from './provider-
|
|
2
|
-
export { a as SymmProvider, b as SymmProviderProps } from './provider-
|
|
3
|
-
import { Address, WalletClient, Hex, PublicClient } from 'viem';
|
|
1
|
+
import { S as SymmioSDKConfig } from './provider-BoNiSPy9.mjs';
|
|
2
|
+
export { a as SymmProvider, b as SymmProviderProps } from './provider-BoNiSPy9.mjs';
|
|
4
3
|
import * as _pear_protocol_symm_core from '@pear-protocol/symm-core';
|
|
5
4
|
import { SymmSDK, CloseOrderRequest, OpenBasketPositionRequest, ClosePositionRequest, CancelOpenRequest, UpdatePositionRequest, SetTpslRequest, CancelTpslRequest, GetTpslOrdersRequest, UpsertTriggerConfigRequest, GetSymmHedgerMarketsRequest, MarketItem } from '@pear-protocol/symm-core';
|
|
5
|
+
import { Address, WalletClient, Hex, PublicClient } from 'viem';
|
|
6
6
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
7
7
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
8
8
|
import * as node_modules__pear_protocol_symm_core_dist_types from 'node_modules/@pear-protocol/symm-core/dist/types';
|
|
@@ -15,9 +15,6 @@ type SymmContextValue = {
|
|
|
15
15
|
chainId: number;
|
|
16
16
|
address?: `0x${string}`;
|
|
17
17
|
symmioConfig?: Partial<SymmioSDKConfig>;
|
|
18
|
-
accessToken: string | null;
|
|
19
|
-
authToken: string | null;
|
|
20
|
-
refreshAuth: (accountAddress?: Address) => Promise<string | null>;
|
|
21
18
|
};
|
|
22
19
|
declare function useSymmContext(): SymmContextValue;
|
|
23
20
|
|
|
@@ -29,7 +26,7 @@ type UseSymmAuthParams = {
|
|
|
29
26
|
walletClient?: WalletClient;
|
|
30
27
|
siweDomain?: string;
|
|
31
28
|
};
|
|
32
|
-
declare function useSymmAuth(params
|
|
29
|
+
declare function useSymmAuth(params?: UseSymmAuthParams): {
|
|
33
30
|
accessToken: string | null;
|
|
34
31
|
authToken: string | null;
|
|
35
32
|
isAuthenticated: boolean;
|
|
@@ -123,7 +120,7 @@ type Account = {
|
|
|
123
120
|
name: string;
|
|
124
121
|
};
|
|
125
122
|
|
|
126
|
-
declare function useSymmAccounts(params
|
|
123
|
+
declare function useSymmAccounts(params?: {
|
|
127
124
|
userAddress?: Address;
|
|
128
125
|
publicClient?: PublicClient;
|
|
129
126
|
walletClient?: WalletClient;
|
|
@@ -213,7 +210,7 @@ declare function useSymmCloseOrder(): {
|
|
|
213
210
|
closeOrder: _tanstack_react_query.UseMutationResult<_pear_protocol_symm_core.CloseOrderResponse, Error, CloseOrderRequest, unknown>;
|
|
214
211
|
};
|
|
215
212
|
|
|
216
|
-
declare function useSymmDeposit(params
|
|
213
|
+
declare function useSymmDeposit(params?: {
|
|
217
214
|
publicClient?: PublicClient;
|
|
218
215
|
walletClient?: WalletClient;
|
|
219
216
|
}): {
|
|
@@ -227,7 +224,7 @@ declare function useSymmDeposit(params: {
|
|
|
227
224
|
}, unknown>;
|
|
228
225
|
};
|
|
229
226
|
|
|
230
|
-
declare function useSymmWithdraw(params
|
|
227
|
+
declare function useSymmWithdraw(params?: {
|
|
231
228
|
publicClient?: PublicClient;
|
|
232
229
|
walletClient?: WalletClient;
|
|
233
230
|
}): {
|
|
@@ -242,7 +239,7 @@ type InternalTransferParams = {
|
|
|
242
239
|
amount: bigint;
|
|
243
240
|
};
|
|
244
241
|
|
|
245
|
-
declare function useSymmCollateral(params
|
|
242
|
+
declare function useSymmCollateral(params?: {
|
|
246
243
|
publicClient?: PublicClient;
|
|
247
244
|
walletClient?: WalletClient;
|
|
248
245
|
}): {
|
|
@@ -260,7 +257,7 @@ declare function useSymmCollateral(params: {
|
|
|
260
257
|
}, unknown>;
|
|
261
258
|
};
|
|
262
259
|
|
|
263
|
-
declare function useSymmSignature(params
|
|
260
|
+
declare function useSymmSignature(params?: {
|
|
264
261
|
userAddress?: Address;
|
|
265
262
|
publicClient?: PublicClient;
|
|
266
263
|
walletClient?: WalletClient;
|
|
@@ -462,9 +459,11 @@ declare function useSymmMarkets(params?: {
|
|
|
462
459
|
searchText?: string;
|
|
463
460
|
query?: SymmQueryConfig;
|
|
464
461
|
}): {
|
|
465
|
-
markets:
|
|
462
|
+
markets: unknown[];
|
|
466
463
|
isLoading: boolean;
|
|
467
|
-
refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<
|
|
464
|
+
refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<{
|
|
465
|
+
markets?: unknown[];
|
|
466
|
+
}, Error>>;
|
|
468
467
|
};
|
|
469
468
|
|
|
470
469
|
declare function useSymmHedgerMarketById(params: {
|
|
@@ -653,10 +652,10 @@ declare function useSymmTwapOrder(params: {
|
|
|
653
652
|
refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<node_modules__pear_protocol_symm_core_dist_types.TwapOrderResponse, Error>>;
|
|
654
653
|
};
|
|
655
654
|
|
|
656
|
-
declare function useSymmWs(params
|
|
657
|
-
symmCoreClient
|
|
655
|
+
declare function useSymmWs(params?: {
|
|
656
|
+
symmCoreClient?: SymmSDK | null;
|
|
658
657
|
accountAddress?: Address;
|
|
659
|
-
chainId
|
|
658
|
+
chainId?: number;
|
|
660
659
|
}): {
|
|
661
660
|
isConnected: boolean;
|
|
662
661
|
};
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { S as SymmioSDKConfig } from './provider-
|
|
2
|
-
export { a as SymmProvider, b as SymmProviderProps } from './provider-
|
|
3
|
-
import { Address, WalletClient, Hex, PublicClient } from 'viem';
|
|
1
|
+
import { S as SymmioSDKConfig } from './provider-BoNiSPy9.js';
|
|
2
|
+
export { a as SymmProvider, b as SymmProviderProps } from './provider-BoNiSPy9.js';
|
|
4
3
|
import * as _pear_protocol_symm_core from '@pear-protocol/symm-core';
|
|
5
4
|
import { SymmSDK, CloseOrderRequest, OpenBasketPositionRequest, ClosePositionRequest, CancelOpenRequest, UpdatePositionRequest, SetTpslRequest, CancelTpslRequest, GetTpslOrdersRequest, UpsertTriggerConfigRequest, GetSymmHedgerMarketsRequest, MarketItem } from '@pear-protocol/symm-core';
|
|
5
|
+
import { Address, WalletClient, Hex, PublicClient } from 'viem';
|
|
6
6
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
7
7
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
8
8
|
import * as node_modules__pear_protocol_symm_core_dist_types from 'node_modules/@pear-protocol/symm-core/dist/types';
|
|
@@ -15,9 +15,6 @@ type SymmContextValue = {
|
|
|
15
15
|
chainId: number;
|
|
16
16
|
address?: `0x${string}`;
|
|
17
17
|
symmioConfig?: Partial<SymmioSDKConfig>;
|
|
18
|
-
accessToken: string | null;
|
|
19
|
-
authToken: string | null;
|
|
20
|
-
refreshAuth: (accountAddress?: Address) => Promise<string | null>;
|
|
21
18
|
};
|
|
22
19
|
declare function useSymmContext(): SymmContextValue;
|
|
23
20
|
|
|
@@ -29,7 +26,7 @@ type UseSymmAuthParams = {
|
|
|
29
26
|
walletClient?: WalletClient;
|
|
30
27
|
siweDomain?: string;
|
|
31
28
|
};
|
|
32
|
-
declare function useSymmAuth(params
|
|
29
|
+
declare function useSymmAuth(params?: UseSymmAuthParams): {
|
|
33
30
|
accessToken: string | null;
|
|
34
31
|
authToken: string | null;
|
|
35
32
|
isAuthenticated: boolean;
|
|
@@ -123,7 +120,7 @@ type Account = {
|
|
|
123
120
|
name: string;
|
|
124
121
|
};
|
|
125
122
|
|
|
126
|
-
declare function useSymmAccounts(params
|
|
123
|
+
declare function useSymmAccounts(params?: {
|
|
127
124
|
userAddress?: Address;
|
|
128
125
|
publicClient?: PublicClient;
|
|
129
126
|
walletClient?: WalletClient;
|
|
@@ -213,7 +210,7 @@ declare function useSymmCloseOrder(): {
|
|
|
213
210
|
closeOrder: _tanstack_react_query.UseMutationResult<_pear_protocol_symm_core.CloseOrderResponse, Error, CloseOrderRequest, unknown>;
|
|
214
211
|
};
|
|
215
212
|
|
|
216
|
-
declare function useSymmDeposit(params
|
|
213
|
+
declare function useSymmDeposit(params?: {
|
|
217
214
|
publicClient?: PublicClient;
|
|
218
215
|
walletClient?: WalletClient;
|
|
219
216
|
}): {
|
|
@@ -227,7 +224,7 @@ declare function useSymmDeposit(params: {
|
|
|
227
224
|
}, unknown>;
|
|
228
225
|
};
|
|
229
226
|
|
|
230
|
-
declare function useSymmWithdraw(params
|
|
227
|
+
declare function useSymmWithdraw(params?: {
|
|
231
228
|
publicClient?: PublicClient;
|
|
232
229
|
walletClient?: WalletClient;
|
|
233
230
|
}): {
|
|
@@ -242,7 +239,7 @@ type InternalTransferParams = {
|
|
|
242
239
|
amount: bigint;
|
|
243
240
|
};
|
|
244
241
|
|
|
245
|
-
declare function useSymmCollateral(params
|
|
242
|
+
declare function useSymmCollateral(params?: {
|
|
246
243
|
publicClient?: PublicClient;
|
|
247
244
|
walletClient?: WalletClient;
|
|
248
245
|
}): {
|
|
@@ -260,7 +257,7 @@ declare function useSymmCollateral(params: {
|
|
|
260
257
|
}, unknown>;
|
|
261
258
|
};
|
|
262
259
|
|
|
263
|
-
declare function useSymmSignature(params
|
|
260
|
+
declare function useSymmSignature(params?: {
|
|
264
261
|
userAddress?: Address;
|
|
265
262
|
publicClient?: PublicClient;
|
|
266
263
|
walletClient?: WalletClient;
|
|
@@ -462,9 +459,11 @@ declare function useSymmMarkets(params?: {
|
|
|
462
459
|
searchText?: string;
|
|
463
460
|
query?: SymmQueryConfig;
|
|
464
461
|
}): {
|
|
465
|
-
markets:
|
|
462
|
+
markets: unknown[];
|
|
466
463
|
isLoading: boolean;
|
|
467
|
-
refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<
|
|
464
|
+
refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<{
|
|
465
|
+
markets?: unknown[];
|
|
466
|
+
}, Error>>;
|
|
468
467
|
};
|
|
469
468
|
|
|
470
469
|
declare function useSymmHedgerMarketById(params: {
|
|
@@ -653,10 +652,10 @@ declare function useSymmTwapOrder(params: {
|
|
|
653
652
|
refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<node_modules__pear_protocol_symm_core_dist_types.TwapOrderResponse, Error>>;
|
|
654
653
|
};
|
|
655
654
|
|
|
656
|
-
declare function useSymmWs(params
|
|
657
|
-
symmCoreClient
|
|
655
|
+
declare function useSymmWs(params?: {
|
|
656
|
+
symmCoreClient?: SymmSDK | null;
|
|
658
657
|
accountAddress?: Address;
|
|
659
|
-
chainId
|
|
658
|
+
chainId?: number;
|
|
660
659
|
}): {
|
|
661
660
|
isConnected: boolean;
|
|
662
661
|
};
|
package/dist/react/index.js
CHANGED
|
@@ -64,11 +64,14 @@ var useSymmWsStore = zustand.create((set) => ({
|
|
|
64
64
|
function asUnsubscribeFn(value) {
|
|
65
65
|
return typeof value === "function" ? value : null;
|
|
66
66
|
}
|
|
67
|
-
function useSymmWs(params) {
|
|
67
|
+
function useSymmWs(params = {}) {
|
|
68
|
+
const { symmCoreClient: ctxClient, address: ctxAddress, chainId: ctxChainId } = useSymmContext();
|
|
68
69
|
const queryClient = reactQuery.useQueryClient();
|
|
69
70
|
const isConnected = useSymmWsStore((state) => state.isConnected);
|
|
70
71
|
const setConnected = useSymmWsStore((state) => state.setConnected);
|
|
71
|
-
const
|
|
72
|
+
const symmCoreClient = params.symmCoreClient ?? ctxClient;
|
|
73
|
+
const accountAddress = params.accountAddress ?? ctxAddress;
|
|
74
|
+
const chainId = params.chainId ?? ctxChainId;
|
|
72
75
|
react.useEffect(() => {
|
|
73
76
|
if (!symmCoreClient || !accountAddress) {
|
|
74
77
|
setConnected(false);
|
|
@@ -152,13 +155,9 @@ function useSymmWs(params) {
|
|
|
152
155
|
}, [symmCoreClient, accountAddress, chainId, queryClient, setConnected]);
|
|
153
156
|
return { isConnected };
|
|
154
157
|
}
|
|
155
|
-
var noopRefreshAuth = async () => null;
|
|
156
158
|
function SymmProvider({
|
|
157
159
|
chainId = 42161,
|
|
158
160
|
address,
|
|
159
|
-
accessToken = null,
|
|
160
|
-
authToken,
|
|
161
|
-
refreshAuth = noopRefreshAuth,
|
|
162
161
|
symmCoreConfig,
|
|
163
162
|
symmioConfig,
|
|
164
163
|
children
|
|
@@ -170,27 +169,15 @@ function SymmProvider({
|
|
|
170
169
|
defaultChainId: chainId
|
|
171
170
|
});
|
|
172
171
|
}, [chainId, symmCoreConfig.apiUrl, symmCoreConfig.wsUrl]);
|
|
173
|
-
const resolvedAuthToken = authToken ?? accessToken;
|
|
174
172
|
useSymmWs({ symmCoreClient, accountAddress: address, chainId });
|
|
175
173
|
const value = react.useMemo(
|
|
176
174
|
() => ({
|
|
177
175
|
symmCoreClient,
|
|
178
176
|
chainId,
|
|
179
177
|
address,
|
|
180
|
-
symmioConfig
|
|
181
|
-
accessToken,
|
|
182
|
-
authToken: resolvedAuthToken,
|
|
183
|
-
refreshAuth
|
|
178
|
+
symmioConfig
|
|
184
179
|
}),
|
|
185
|
-
[
|
|
186
|
-
symmCoreClient,
|
|
187
|
-
chainId,
|
|
188
|
-
address,
|
|
189
|
-
symmioConfig,
|
|
190
|
-
accessToken,
|
|
191
|
-
resolvedAuthToken,
|
|
192
|
-
refreshAuth
|
|
193
|
-
]
|
|
180
|
+
[symmCoreClient, chainId, address, symmioConfig]
|
|
194
181
|
);
|
|
195
182
|
return /* @__PURE__ */ jsxRuntime.jsx(SymmContext.Provider, { value, children });
|
|
196
183
|
}
|
|
@@ -411,10 +398,17 @@ var useSymmAuthStore = zustand.create((set, get) => ({
|
|
|
411
398
|
|
|
412
399
|
// src/react/hooks/use-symm-auth.ts
|
|
413
400
|
function useSymmAuth(params) {
|
|
414
|
-
const
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
|
|
401
|
+
const ctx = useSymmContext();
|
|
402
|
+
const address = params?.address ?? ctx.address;
|
|
403
|
+
const chainId = params?.chainId ?? ctx.chainId ?? 42161;
|
|
404
|
+
const walletClient = params?.walletClient ?? ctx.walletClient;
|
|
405
|
+
const siweDomain = params?.siweDomain;
|
|
406
|
+
const accessToken = useSymmAuthStore((state) => {
|
|
407
|
+
if (address) {
|
|
408
|
+
return state.tokensByKey[symmAuthTokenKey(address, chainId)] ?? null;
|
|
409
|
+
}
|
|
410
|
+
return ctx.accessToken ?? ctx.authToken ?? null;
|
|
411
|
+
});
|
|
418
412
|
const setToken = useSymmAuthStore((state) => state.setToken);
|
|
419
413
|
const getToken = useSymmAuthStore((state) => state.getToken);
|
|
420
414
|
const clearToken = useSymmAuthStore((state) => state.clearToken);
|
|
@@ -1063,8 +1057,7 @@ function useSymmInstantTrade(params) {
|
|
|
1063
1057
|
symmCoreClient,
|
|
1064
1058
|
chainId,
|
|
1065
1059
|
address,
|
|
1066
|
-
symmioConfig
|
|
1067
|
-
refreshAuth
|
|
1060
|
+
symmioConfig
|
|
1068
1061
|
} = useSymmContext();
|
|
1069
1062
|
const { publicClient, walletClient } = params;
|
|
1070
1063
|
const queryClient = reactQuery.useQueryClient();
|
|
@@ -1090,9 +1083,9 @@ function useSymmInstantTrade(params) {
|
|
|
1090
1083
|
if (selectors.length === 0) {
|
|
1091
1084
|
throw new Error("at least one delegation selector is required");
|
|
1092
1085
|
}
|
|
1093
|
-
const accessToken = useSymmAuthStore.getState().getToken(accountAddress, chainId)
|
|
1086
|
+
const accessToken = useSymmAuthStore.getState().getToken(accountAddress, chainId);
|
|
1094
1087
|
if (!accessToken) {
|
|
1095
|
-
throw new Error("
|
|
1088
|
+
throw new Error("auth token is required for instant trading");
|
|
1096
1089
|
}
|
|
1097
1090
|
const accessStates = await Promise.all(
|
|
1098
1091
|
selectors.map(
|
|
@@ -1206,7 +1199,7 @@ async function getAccounts(publicClient, multiAccount, user, start = 0, size = 1
|
|
|
1206
1199
|
|
|
1207
1200
|
// src/react/hooks/use-symm-accounts.ts
|
|
1208
1201
|
var EMPTY_ACCOUNTS = [];
|
|
1209
|
-
function useSymmAccounts(params, options) {
|
|
1202
|
+
function useSymmAccounts(params = {}, options) {
|
|
1210
1203
|
const { chainId, symmioConfig } = useSymmContext();
|
|
1211
1204
|
const { userAddress, publicClient, walletClient } = params;
|
|
1212
1205
|
const queryClient = reactQuery.useQueryClient();
|
|
@@ -1477,7 +1470,7 @@ function useSymmApproval(params) {
|
|
|
1477
1470
|
};
|
|
1478
1471
|
}
|
|
1479
1472
|
function useSymmCancelClose() {
|
|
1480
|
-
const { symmCoreClient,
|
|
1473
|
+
const { symmCoreClient, chainId, address } = useSymmContext();
|
|
1481
1474
|
const queryClient = reactQuery.useQueryClient();
|
|
1482
1475
|
const cancelClose = reactQuery.useMutation({
|
|
1483
1476
|
mutationFn: async ({
|
|
@@ -1489,14 +1482,16 @@ function useSymmCancelClose() {
|
|
|
1489
1482
|
if (!symmCoreClient) {
|
|
1490
1483
|
throw new Error("symm-core client not available");
|
|
1491
1484
|
}
|
|
1492
|
-
const
|
|
1485
|
+
const resolvedAccountAddress = accountAddress ?? address;
|
|
1486
|
+
const resolvedChainId = overrideChainId ?? chainId;
|
|
1487
|
+
const resolvedAuthToken = authToken ?? (resolvedAccountAddress ? useSymmAuthStore.getState().getToken(resolvedAccountAddress, resolvedChainId) : null);
|
|
1493
1488
|
if (!resolvedAuthToken) {
|
|
1494
1489
|
throw new Error("auth token is required to cancel a pending close");
|
|
1495
1490
|
}
|
|
1496
1491
|
return symmCoreClient.orders.cancelClose({
|
|
1497
1492
|
quoteId,
|
|
1498
1493
|
authToken: resolvedAuthToken,
|
|
1499
|
-
chainId:
|
|
1494
|
+
chainId: resolvedChainId
|
|
1500
1495
|
});
|
|
1501
1496
|
},
|
|
1502
1497
|
onSuccess: () => {
|
|
@@ -1507,7 +1502,7 @@ function useSymmCancelClose() {
|
|
|
1507
1502
|
return { cancelClose };
|
|
1508
1503
|
}
|
|
1509
1504
|
function useSymmCloseOrder() {
|
|
1510
|
-
const { symmCoreClient,
|
|
1505
|
+
const { symmCoreClient, address, chainId } = useSymmContext();
|
|
1511
1506
|
const queryClient = reactQuery.useQueryClient();
|
|
1512
1507
|
const closeOrder = reactQuery.useMutation({
|
|
1513
1508
|
mutationFn: async (request) => {
|
|
@@ -1517,7 +1512,7 @@ function useSymmCloseOrder() {
|
|
|
1517
1512
|
return symmCoreClient.orders.close(request.id, {
|
|
1518
1513
|
kind: request.kind,
|
|
1519
1514
|
type: request.type,
|
|
1520
|
-
authToken: request.authToken ??
|
|
1515
|
+
authToken: request.authToken ?? (address ? useSymmAuthStore.getState().getToken(address, chainId) ?? void 0 : void 0)
|
|
1521
1516
|
});
|
|
1522
1517
|
},
|
|
1523
1518
|
onSuccess: () => {
|
|
@@ -1579,7 +1574,7 @@ async function depositAndAllocate(walletClient, publicClient, multiAccount, para
|
|
|
1579
1574
|
}
|
|
1580
1575
|
|
|
1581
1576
|
// src/react/hooks/use-symm-deposit.ts
|
|
1582
|
-
function useSymmDeposit(params) {
|
|
1577
|
+
function useSymmDeposit(params = {}) {
|
|
1583
1578
|
const { chainId, symmioConfig } = useSymmContext();
|
|
1584
1579
|
const { publicClient, walletClient } = params;
|
|
1585
1580
|
const queryClient = reactQuery.useQueryClient();
|
|
@@ -1639,7 +1634,7 @@ async function withdraw(walletClient, publicClient, multiAccount, params) {
|
|
|
1639
1634
|
}
|
|
1640
1635
|
|
|
1641
1636
|
// src/react/hooks/use-symm-withdraw.ts
|
|
1642
|
-
function useSymmWithdraw(params) {
|
|
1637
|
+
function useSymmWithdraw(params = {}) {
|
|
1643
1638
|
const { chainId, symmioConfig } = useSymmContext();
|
|
1644
1639
|
const { publicClient, walletClient } = params;
|
|
1645
1640
|
const queryClient = reactQuery.useQueryClient();
|
|
@@ -24307,7 +24302,7 @@ var MuonClient = class {
|
|
|
24307
24302
|
};
|
|
24308
24303
|
|
|
24309
24304
|
// src/react/hooks/use-symm-collateral.ts
|
|
24310
|
-
function useSymmCollateral(params) {
|
|
24305
|
+
function useSymmCollateral(params = {}) {
|
|
24311
24306
|
const { chainId, symmioConfig } = useSymmContext();
|
|
24312
24307
|
const { publicClient, walletClient } = params;
|
|
24313
24308
|
const queryClient = reactQuery.useQueryClient();
|
|
@@ -24460,7 +24455,7 @@ async function hasSignedCurrentVersion(publicClient, signatureStore, user) {
|
|
|
24460
24455
|
}
|
|
24461
24456
|
|
|
24462
24457
|
// src/react/hooks/use-symm-signature.ts
|
|
24463
|
-
function useSymmSignature(params, options) {
|
|
24458
|
+
function useSymmSignature(params = {}, options) {
|
|
24464
24459
|
const { chainId, symmioConfig } = useSymmContext();
|
|
24465
24460
|
const { userAddress, publicClient, walletClient } = params;
|
|
24466
24461
|
const queryClient = reactQuery.useQueryClient();
|
|
@@ -24693,6 +24688,13 @@ function useSymmPositions(params) {
|
|
|
24693
24688
|
const resolvedAddress = accountAddress ? void 0 : address;
|
|
24694
24689
|
const chainId = params.chainId ?? ctxChainId;
|
|
24695
24690
|
const internalEnabled = !!symmCoreClient && !!(accountAddress || resolvedAddress);
|
|
24691
|
+
console.log({
|
|
24692
|
+
symmCoreClient,
|
|
24693
|
+
accountAddress,
|
|
24694
|
+
resolvedAddress,
|
|
24695
|
+
chainId,
|
|
24696
|
+
internalEnabled
|
|
24697
|
+
});
|
|
24696
24698
|
const query = reactQuery.useQuery({
|
|
24697
24699
|
...params.query,
|
|
24698
24700
|
queryKey: symmKeys.positions({
|
|
@@ -24947,10 +24949,11 @@ function useSymmMarkets(params) {
|
|
|
24947
24949
|
...params?.query,
|
|
24948
24950
|
queryKey: symmKeys.markets(chainId, searchText),
|
|
24949
24951
|
queryFn: () => {
|
|
24952
|
+
const marketsApi = symmCoreClient.markets;
|
|
24950
24953
|
if (searchText) {
|
|
24951
|
-
return
|
|
24954
|
+
return marketsApi.search(searchText, chainId);
|
|
24952
24955
|
}
|
|
24953
|
-
return
|
|
24956
|
+
return marketsApi.list({ pageSize: "500", chainId });
|
|
24954
24957
|
},
|
|
24955
24958
|
enabled: internalEnabled && (params?.query?.enabled ?? true)
|
|
24956
24959
|
});
|
|
@@ -25239,9 +25242,7 @@ function useSymmPendingIds(params) {
|
|
|
25239
25242
|
function useSymmPendingInstantOpens(params) {
|
|
25240
25243
|
const {
|
|
25241
25244
|
symmCoreClient,
|
|
25242
|
-
chainId: ctxChainId
|
|
25243
|
-
authToken: ctxAuthToken,
|
|
25244
|
-
refreshAuth
|
|
25245
|
+
chainId: ctxChainId
|
|
25245
25246
|
} = useSymmContext();
|
|
25246
25247
|
const { accountAddress, authToken: providedAuthToken } = params;
|
|
25247
25248
|
const chainId = params.chainId ?? ctxChainId;
|
|
@@ -25250,7 +25251,7 @@ function useSymmPendingInstantOpens(params) {
|
|
|
25250
25251
|
...params.query,
|
|
25251
25252
|
queryKey: symmKeys.pendingInstantOpens(accountAddress, chainId),
|
|
25252
25253
|
queryFn: async () => {
|
|
25253
|
-
const authToken = providedAuthToken ?? useSymmAuthStore.getState().getToken(accountAddress, chainId)
|
|
25254
|
+
const authToken = providedAuthToken ?? useSymmAuthStore.getState().getToken(accountAddress, chainId);
|
|
25254
25255
|
if (!authToken) {
|
|
25255
25256
|
throw new Error("failed to acquire auth token for pending instant opens");
|
|
25256
25257
|
}
|