@pear-protocol/symmio-client 0.2.45 → 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.js +13 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +13 -1
- package/dist/react/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -25345,6 +25345,7 @@ function useResolveTradeAuthToken(params = {}) {
|
|
|
25345
25345
|
function useSymmOpenBasketMutation(options) {
|
|
25346
25346
|
const { symmCoreClient } = useSymmContext();
|
|
25347
25347
|
const queryClient = reactQuery.useQueryClient();
|
|
25348
|
+
const resolveAuthToken = useResolveTradeAuthToken();
|
|
25348
25349
|
return reactQuery.useMutation({
|
|
25349
25350
|
...withSymmMutationConfig(options?.mutation, {
|
|
25350
25351
|
onSuccess: () => {
|
|
@@ -25353,7 +25354,18 @@ function useSymmOpenBasketMutation(options) {
|
|
|
25353
25354
|
}),
|
|
25354
25355
|
mutationFn: async (request) => {
|
|
25355
25356
|
if (!symmCoreClient) throw new Error("symm-core client not available");
|
|
25356
|
-
|
|
25357
|
+
const typedRequest = request;
|
|
25358
|
+
const authToken = await resolveAuthToken(
|
|
25359
|
+
typedRequest.authToken,
|
|
25360
|
+
typedRequest.accountAddress
|
|
25361
|
+
);
|
|
25362
|
+
if (!authToken) {
|
|
25363
|
+
throw new Error("auth token is required to open a position");
|
|
25364
|
+
}
|
|
25365
|
+
return symmCoreClient.positions.openBasket({
|
|
25366
|
+
...request,
|
|
25367
|
+
authToken
|
|
25368
|
+
});
|
|
25357
25369
|
}
|
|
25358
25370
|
});
|
|
25359
25371
|
}
|