@pear-protocol/symmio-client 0.2.44 → 0.2.46
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 +2 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +17 -4
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +17 -4
- package/dist/react/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react/index.mjs
CHANGED
|
@@ -723,7 +723,7 @@ var symmKeys = {
|
|
|
723
723
|
twapOrders: (address, chainId) => ["symm", "twapOrders", address, chainId],
|
|
724
724
|
triggerOrders: (params) => ["symm", "triggerOrders", params],
|
|
725
725
|
triggerConfig: (orderId) => ["symm", "triggerConfig", orderId],
|
|
726
|
-
markets: (chainId, search) => ["symm", "markets", chainId, search],
|
|
726
|
+
markets: (chainId, search, pageSize) => ["symm", "markets", chainId, search, pageSize],
|
|
727
727
|
hedgerMarketById: (id, chainId) => ["symm", "hedgerMarketById", id, chainId],
|
|
728
728
|
hedgerMarketBySymbol: (symbol, chainId) => ["symm", "hedgerMarketBySymbol", symbol, chainId],
|
|
729
729
|
lockedParams: (marketName, leverage, chainId) => ["symm", "lockedParams", marketName, leverage, chainId],
|
|
@@ -25343,6 +25343,7 @@ function useResolveTradeAuthToken(params = {}) {
|
|
|
25343
25343
|
function useSymmOpenBasketMutation(options) {
|
|
25344
25344
|
const { symmCoreClient } = useSymmContext();
|
|
25345
25345
|
const queryClient = useQueryClient();
|
|
25346
|
+
const resolveAuthToken = useResolveTradeAuthToken();
|
|
25346
25347
|
return useMutation({
|
|
25347
25348
|
...withSymmMutationConfig(options?.mutation, {
|
|
25348
25349
|
onSuccess: () => {
|
|
@@ -25351,7 +25352,18 @@ function useSymmOpenBasketMutation(options) {
|
|
|
25351
25352
|
}),
|
|
25352
25353
|
mutationFn: async (request) => {
|
|
25353
25354
|
if (!symmCoreClient) throw new Error("symm-core client not available");
|
|
25354
|
-
|
|
25355
|
+
const typedRequest = request;
|
|
25356
|
+
const authToken = await resolveAuthToken(
|
|
25357
|
+
typedRequest.authToken,
|
|
25358
|
+
typedRequest.accountAddress
|
|
25359
|
+
);
|
|
25360
|
+
if (!authToken) {
|
|
25361
|
+
throw new Error("auth token is required to open a position");
|
|
25362
|
+
}
|
|
25363
|
+
return symmCoreClient.positions.openBasket({
|
|
25364
|
+
...request,
|
|
25365
|
+
authToken
|
|
25366
|
+
});
|
|
25355
25367
|
}
|
|
25356
25368
|
});
|
|
25357
25369
|
}
|
|
@@ -25688,15 +25700,16 @@ function useSymmMarkets(params) {
|
|
|
25688
25700
|
const { symmCoreClient, chainId: ctxChainId } = useSymmContext();
|
|
25689
25701
|
const chainId = params?.chainId ?? ctxChainId;
|
|
25690
25702
|
const searchText = params?.searchText;
|
|
25703
|
+
const pageSize = String(params?.pageSize ?? 100);
|
|
25691
25704
|
const internalEnabled = !!symmCoreClient;
|
|
25692
25705
|
return useQuery({
|
|
25693
25706
|
...params?.query,
|
|
25694
|
-
queryKey: symmKeys.markets(chainId, searchText),
|
|
25707
|
+
queryKey: symmKeys.markets(chainId, searchText, pageSize),
|
|
25695
25708
|
queryFn: () => {
|
|
25696
25709
|
if (searchText) {
|
|
25697
25710
|
return symmCoreClient.markets.search(searchText, { chainId });
|
|
25698
25711
|
}
|
|
25699
|
-
return symmCoreClient.markets.list({ pageSize
|
|
25712
|
+
return symmCoreClient.markets.list({ pageSize, chainId });
|
|
25700
25713
|
},
|
|
25701
25714
|
enabled: internalEnabled && (params?.query?.enabled ?? true)
|
|
25702
25715
|
});
|