@pear-protocol/symmio-client 0.3.1 → 0.3.3
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 +1 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +77 -194
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +77 -194
- package/dist/react/index.mjs.map +1 -1
- package/dist/react/provider.js +19 -95
- package/dist/react/provider.js.map +1 -1
- package/dist/react/provider.mjs +19 -95
- package/dist/react/provider.mjs.map +1 -1
- package/package.json +2 -2
package/dist/react/index.mjs
CHANGED
|
@@ -548,12 +548,6 @@ var useSymmWsStore = create((set) => ({
|
|
|
548
548
|
function asUnsubscribeFn(value) {
|
|
549
549
|
return typeof value === "function" ? value : null;
|
|
550
550
|
}
|
|
551
|
-
function logSymmWs(event, details) {
|
|
552
|
-
if (typeof window === "undefined") {
|
|
553
|
-
return;
|
|
554
|
-
}
|
|
555
|
-
console.debug("[symm-ws]", event, details ?? {});
|
|
556
|
-
}
|
|
557
551
|
function useSymmWs(params = {}) {
|
|
558
552
|
const ctx = useContext(SymmContext);
|
|
559
553
|
const queryClient = useQueryClient();
|
|
@@ -564,11 +558,6 @@ function useSymmWs(params = {}) {
|
|
|
564
558
|
const chainId = params.chainId ?? ctx?.chainId ?? 42161;
|
|
565
559
|
useEffect(() => {
|
|
566
560
|
if (!symmCoreClient || !accountAddress) {
|
|
567
|
-
logSymmWs("setup:skip", {
|
|
568
|
-
hasClient: !!symmCoreClient,
|
|
569
|
-
accountAddress,
|
|
570
|
-
chainId
|
|
571
|
-
});
|
|
572
561
|
setConnected(false);
|
|
573
562
|
return;
|
|
574
563
|
}
|
|
@@ -576,52 +565,21 @@ function useSymmWs(params = {}) {
|
|
|
576
565
|
const addr = accountAddress;
|
|
577
566
|
const unsubscribers = [];
|
|
578
567
|
let cancelled = false;
|
|
579
|
-
logSymmWs("setup:start", {
|
|
580
|
-
accountAddress: addr,
|
|
581
|
-
chainId,
|
|
582
|
-
alreadyConnected: typeof ws.isConnected === "function" ? ws.isConnected() : void 0
|
|
583
|
-
});
|
|
584
568
|
const removeOnConnect = ws.onConnect(() => {
|
|
585
|
-
logSymmWs("connection:connected", {
|
|
586
|
-
accountAddress: addr,
|
|
587
|
-
chainId
|
|
588
|
-
});
|
|
589
569
|
setConnected(true);
|
|
590
570
|
});
|
|
591
571
|
const removeOnDisconnect = ws.onDisconnect(() => {
|
|
592
|
-
logSymmWs("connection:disconnected", {
|
|
593
|
-
accountAddress: addr,
|
|
594
|
-
chainId
|
|
595
|
-
});
|
|
596
572
|
setConnected(false);
|
|
597
573
|
});
|
|
598
|
-
const removeOnError = asUnsubscribeFn(
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
chainId,
|
|
603
|
-
error: error instanceof Error ? error.message : String(error)
|
|
604
|
-
});
|
|
605
|
-
})
|
|
606
|
-
);
|
|
607
|
-
const removeOnWelcome = asUnsubscribeFn(
|
|
608
|
-
ws.onWelcome?.((message) => {
|
|
609
|
-
logSymmWs("connection:welcome", {
|
|
610
|
-
accountAddress: addr,
|
|
611
|
-
chainId,
|
|
612
|
-
message
|
|
613
|
-
});
|
|
614
|
-
})
|
|
615
|
-
);
|
|
574
|
+
const removeOnError = asUnsubscribeFn(ws.onError?.(() => {
|
|
575
|
+
}));
|
|
576
|
+
const removeOnWelcome = asUnsubscribeFn(ws.onWelcome?.(() => {
|
|
577
|
+
}));
|
|
616
578
|
unsubscribers.push(removeOnConnect, removeOnDisconnect);
|
|
617
579
|
if (removeOnError) unsubscribers.push(removeOnError);
|
|
618
580
|
if (removeOnWelcome) unsubscribers.push(removeOnWelcome);
|
|
619
581
|
const positionsUnsub = asUnsubscribeFn(
|
|
620
582
|
ws.subscribeToPositions(addr, chainId, () => {
|
|
621
|
-
logSymmWs("message:positions", {
|
|
622
|
-
accountAddress: addr,
|
|
623
|
-
chainId
|
|
624
|
-
});
|
|
625
583
|
queryClient.invalidateQueries({
|
|
626
584
|
queryKey: symmKeys.positionsRoot
|
|
627
585
|
});
|
|
@@ -630,10 +588,6 @@ function useSymmWs(params = {}) {
|
|
|
630
588
|
if (positionsUnsub) unsubscribers.push(positionsUnsub);
|
|
631
589
|
const openOrdersUnsub = asUnsubscribeFn(
|
|
632
590
|
ws.subscribeToOpenOrders(addr, chainId, () => {
|
|
633
|
-
logSymmWs("message:open-orders", {
|
|
634
|
-
accountAddress: addr,
|
|
635
|
-
chainId
|
|
636
|
-
});
|
|
637
591
|
queryClient.invalidateQueries({
|
|
638
592
|
queryKey: symmKeys.openOrdersRoot
|
|
639
593
|
});
|
|
@@ -642,10 +596,6 @@ function useSymmWs(params = {}) {
|
|
|
642
596
|
if (openOrdersUnsub) unsubscribers.push(openOrdersUnsub);
|
|
643
597
|
const tradesUnsub = asUnsubscribeFn(
|
|
644
598
|
ws.subscribeToTrades(addr, chainId, () => {
|
|
645
|
-
logSymmWs("message:trades", {
|
|
646
|
-
accountAddress: addr,
|
|
647
|
-
chainId
|
|
648
|
-
});
|
|
649
599
|
queryClient.invalidateQueries({
|
|
650
600
|
queryKey: symmKeys.tradeHistoryRoot
|
|
651
601
|
});
|
|
@@ -654,10 +604,6 @@ function useSymmWs(params = {}) {
|
|
|
654
604
|
if (tradesUnsub) unsubscribers.push(tradesUnsub);
|
|
655
605
|
const accountSummaryUnsub = asUnsubscribeFn(
|
|
656
606
|
ws.subscribeToAccountSummary(addr, chainId, () => {
|
|
657
|
-
logSymmWs("message:account-summary", {
|
|
658
|
-
accountAddress: addr,
|
|
659
|
-
chainId
|
|
660
|
-
});
|
|
661
607
|
queryClient.invalidateQueries({
|
|
662
608
|
queryKey: symmKeys.balances(accountAddress, chainId)
|
|
663
609
|
});
|
|
@@ -669,10 +615,6 @@ function useSymmWs(params = {}) {
|
|
|
669
615
|
if (accountSummaryUnsub) unsubscribers.push(accountSummaryUnsub);
|
|
670
616
|
const notificationsUnsub = asUnsubscribeFn(
|
|
671
617
|
ws.subscribeToNotifications(addr, chainId, () => {
|
|
672
|
-
logSymmWs("message:notifications", {
|
|
673
|
-
accountAddress: addr,
|
|
674
|
-
chainId
|
|
675
|
-
});
|
|
676
618
|
queryClient.invalidateQueries({
|
|
677
619
|
queryKey: symmKeys.notifications({ accountAddress, chainId })
|
|
678
620
|
});
|
|
@@ -684,10 +626,6 @@ function useSymmWs(params = {}) {
|
|
|
684
626
|
if (notificationsUnsub) unsubscribers.push(notificationsUnsub);
|
|
685
627
|
const tpslUnsub = asUnsubscribeFn(
|
|
686
628
|
ws.subscribeToTpsl(addr, chainId, () => {
|
|
687
|
-
logSymmWs("message:tpsl", {
|
|
688
|
-
accountAddress: addr,
|
|
689
|
-
chainId
|
|
690
|
-
});
|
|
691
629
|
queryClient.invalidateQueries({ queryKey: symmKeys.tpslOrdersRoot });
|
|
692
630
|
queryClient.invalidateQueries({ queryKey: symmKeys.openOrdersRoot });
|
|
693
631
|
})
|
|
@@ -695,10 +633,6 @@ function useSymmWs(params = {}) {
|
|
|
695
633
|
if (tpslUnsub) unsubscribers.push(tpslUnsub);
|
|
696
634
|
const twapUnsub = asUnsubscribeFn(
|
|
697
635
|
ws.subscribeToTwapOrders(addr, chainId, () => {
|
|
698
|
-
logSymmWs("message:twap-orders", {
|
|
699
|
-
accountAddress: addr,
|
|
700
|
-
chainId
|
|
701
|
-
});
|
|
702
636
|
queryClient.invalidateQueries({ queryKey: symmKeys.twapOrdersRoot });
|
|
703
637
|
queryClient.invalidateQueries({ queryKey: symmKeys.openOrdersRoot });
|
|
704
638
|
})
|
|
@@ -706,10 +640,6 @@ function useSymmWs(params = {}) {
|
|
|
706
640
|
if (twapUnsub) unsubscribers.push(twapUnsub);
|
|
707
641
|
const triggerOrdersUnsub = asUnsubscribeFn(
|
|
708
642
|
ws.subscribeToTriggerOrders(addr, chainId, () => {
|
|
709
|
-
logSymmWs("message:trigger-orders", {
|
|
710
|
-
accountAddress: addr,
|
|
711
|
-
chainId
|
|
712
|
-
});
|
|
713
643
|
queryClient.invalidateQueries({ queryKey: symmKeys.triggerOrdersRoot });
|
|
714
644
|
queryClient.invalidateQueries({ queryKey: symmKeys.openOrdersRoot });
|
|
715
645
|
})
|
|
@@ -717,10 +647,6 @@ function useSymmWs(params = {}) {
|
|
|
717
647
|
if (triggerOrdersUnsub) unsubscribers.push(triggerOrdersUnsub);
|
|
718
648
|
const executionsUnsub = asUnsubscribeFn(
|
|
719
649
|
ws.subscribeToExecutions(addr, chainId, () => {
|
|
720
|
-
logSymmWs("message:executions", {
|
|
721
|
-
accountAddress: addr,
|
|
722
|
-
chainId
|
|
723
|
-
});
|
|
724
650
|
queryClient.invalidateQueries({
|
|
725
651
|
queryKey: symmKeys.positionsRoot
|
|
726
652
|
});
|
|
@@ -734,27 +660,14 @@ function useSymmWs(params = {}) {
|
|
|
734
660
|
if (cancelled) {
|
|
735
661
|
return;
|
|
736
662
|
}
|
|
737
|
-
|
|
738
|
-
accountAddress: addr,
|
|
739
|
-
chainId
|
|
740
|
-
});
|
|
741
|
-
}).catch((error) => {
|
|
663
|
+
}).catch(() => {
|
|
742
664
|
if (cancelled) {
|
|
743
665
|
return;
|
|
744
666
|
}
|
|
745
|
-
logSymmWs("connection:connect-failed", {
|
|
746
|
-
accountAddress: addr,
|
|
747
|
-
chainId,
|
|
748
|
-
error: error instanceof Error ? error.message : String(error)
|
|
749
|
-
});
|
|
750
667
|
setConnected(false);
|
|
751
668
|
});
|
|
752
669
|
return () => {
|
|
753
670
|
cancelled = true;
|
|
754
|
-
logSymmWs("cleanup:start", {
|
|
755
|
-
accountAddress: addr,
|
|
756
|
-
chainId
|
|
757
|
-
});
|
|
758
671
|
unsubscribers.forEach((unsubscribe) => unsubscribe());
|
|
759
672
|
ws.disconnect();
|
|
760
673
|
setConnected(false);
|
|
@@ -762,6 +675,9 @@ function useSymmWs(params = {}) {
|
|
|
762
675
|
}, [symmCoreClient, accountAddress, chainId, queryClient, setConnected]);
|
|
763
676
|
return { isConnected };
|
|
764
677
|
}
|
|
678
|
+
function trimTrailingSlashes(value) {
|
|
679
|
+
return value.replace(/\/+$/, "");
|
|
680
|
+
}
|
|
765
681
|
function SymmProvider({
|
|
766
682
|
chainId = 42161,
|
|
767
683
|
address,
|
|
@@ -773,13 +689,21 @@ function SymmProvider({
|
|
|
773
689
|
symmioConfig,
|
|
774
690
|
children
|
|
775
691
|
}) {
|
|
692
|
+
const normalizedApiUrl = useMemo(
|
|
693
|
+
() => trimTrailingSlashes(symmCoreConfig.apiUrl),
|
|
694
|
+
[symmCoreConfig.apiUrl]
|
|
695
|
+
);
|
|
696
|
+
const normalizedWsUrl = useMemo(
|
|
697
|
+
() => symmCoreConfig.wsUrl ? trimTrailingSlashes(symmCoreConfig.wsUrl) : void 0,
|
|
698
|
+
[symmCoreConfig.wsUrl]
|
|
699
|
+
);
|
|
776
700
|
const symmCoreClient = useMemo(() => {
|
|
777
701
|
return createSymmSDK({
|
|
778
|
-
apiUrl:
|
|
779
|
-
wsUrl:
|
|
702
|
+
apiUrl: normalizedApiUrl,
|
|
703
|
+
wsUrl: normalizedWsUrl,
|
|
780
704
|
defaultChainId: chainId
|
|
781
705
|
});
|
|
782
|
-
}, [chainId,
|
|
706
|
+
}, [chainId, normalizedApiUrl, normalizedWsUrl]);
|
|
783
707
|
const value = useMemo(
|
|
784
708
|
() => ({
|
|
785
709
|
symmCoreClient,
|
|
@@ -1050,12 +974,6 @@ function clearAuthState(queryClient, accountAddress, chainId, signerAddress) {
|
|
|
1050
974
|
}
|
|
1051
975
|
|
|
1052
976
|
// src/react/hooks/use-symm-auth.ts
|
|
1053
|
-
function logSymmAuth(event, details) {
|
|
1054
|
-
if (typeof window === "undefined") {
|
|
1055
|
-
return;
|
|
1056
|
-
}
|
|
1057
|
-
console.log("[symm-auth]", event, details ?? {});
|
|
1058
|
-
}
|
|
1059
977
|
function useSymmAuth(params) {
|
|
1060
978
|
const context = useSymmContext();
|
|
1061
979
|
const queryClient = useQueryClient();
|
|
@@ -1069,20 +987,10 @@ function useSymmAuth(params) {
|
|
|
1069
987
|
async (accountAddress, options) => {
|
|
1070
988
|
const resolvedAccountAddress = accountAddress ?? activeAccountAddress;
|
|
1071
989
|
if (!resolvedAccountAddress) {
|
|
1072
|
-
logSymmAuth("refresh:skip-no-active-account", {
|
|
1073
|
-
signerAddress: address,
|
|
1074
|
-
chainId
|
|
1075
|
-
});
|
|
1076
990
|
return null;
|
|
1077
991
|
}
|
|
1078
992
|
if (!walletClient || !address) return null;
|
|
1079
993
|
try {
|
|
1080
|
-
logSymmAuth("refresh:fetch-start", {
|
|
1081
|
-
signerAddress: address,
|
|
1082
|
-
accountAddress: resolvedAccountAddress,
|
|
1083
|
-
chainId,
|
|
1084
|
-
force: options?.force ?? false
|
|
1085
|
-
});
|
|
1086
994
|
const tokenEntry = await resolveAuthTokenEntry({
|
|
1087
995
|
queryClient,
|
|
1088
996
|
walletClient,
|
|
@@ -1093,20 +1001,9 @@ function useSymmAuth(params) {
|
|
|
1093
1001
|
force: options?.force
|
|
1094
1002
|
});
|
|
1095
1003
|
const token2 = tokenEntry?.token ?? null;
|
|
1096
|
-
logSymmAuth("refresh:fetch-success", {
|
|
1097
|
-
signerAddress: address,
|
|
1098
|
-
accountAddress: resolvedAccountAddress,
|
|
1099
|
-
chainId
|
|
1100
|
-
});
|
|
1101
1004
|
return token2;
|
|
1102
1005
|
} catch (error) {
|
|
1103
1006
|
clearPersistedAuthState(resolvedAccountAddress, chainId);
|
|
1104
|
-
logSymmAuth("refresh:fetch-failed", {
|
|
1105
|
-
signerAddress: address,
|
|
1106
|
-
accountAddress: resolvedAccountAddress,
|
|
1107
|
-
chainId,
|
|
1108
|
-
error: error instanceof Error ? error.message : String(error)
|
|
1109
|
-
});
|
|
1110
1007
|
return null;
|
|
1111
1008
|
}
|
|
1112
1009
|
},
|
|
@@ -2354,9 +2251,53 @@ function useSymmApproveMutation(params, options) {
|
|
|
2354
2251
|
}
|
|
2355
2252
|
});
|
|
2356
2253
|
}
|
|
2254
|
+
function splitTradeHookArgs(paramsOrOptions, options) {
|
|
2255
|
+
if (paramsOrOptions && "mutation" in paramsOrOptions) {
|
|
2256
|
+
return {
|
|
2257
|
+
params: {},
|
|
2258
|
+
options: paramsOrOptions
|
|
2259
|
+
};
|
|
2260
|
+
}
|
|
2261
|
+
return {
|
|
2262
|
+
params: paramsOrOptions ?? {},
|
|
2263
|
+
options
|
|
2264
|
+
};
|
|
2265
|
+
}
|
|
2266
|
+
function useResolveTradeAuthToken(params = {}) {
|
|
2267
|
+
const context = useSymmContext();
|
|
2268
|
+
const queryClient = useQueryClient();
|
|
2269
|
+
const address = params.address ?? context.address;
|
|
2270
|
+
const chainId = params.chainId ?? context.chainId;
|
|
2271
|
+
return useCallback(
|
|
2272
|
+
async (providedAuthToken, accountAddress, overrideChainId) => {
|
|
2273
|
+
const resolvedChainId = overrideChainId ?? chainId;
|
|
2274
|
+
if (providedAuthToken) {
|
|
2275
|
+
return providedAuthToken;
|
|
2276
|
+
}
|
|
2277
|
+
const resolvedAccountAddress = accountAddress ?? address;
|
|
2278
|
+
if (!resolvedAccountAddress) {
|
|
2279
|
+
return null;
|
|
2280
|
+
}
|
|
2281
|
+
const inMemoryToken = getAuthTokenFromRuntimeCache(
|
|
2282
|
+
queryClient,
|
|
2283
|
+
resolvedAccountAddress,
|
|
2284
|
+
resolvedChainId,
|
|
2285
|
+
address
|
|
2286
|
+
);
|
|
2287
|
+
if (inMemoryToken) {
|
|
2288
|
+
return inMemoryToken;
|
|
2289
|
+
}
|
|
2290
|
+
return null;
|
|
2291
|
+
},
|
|
2292
|
+
[address, chainId, queryClient]
|
|
2293
|
+
);
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
// src/react/hooks/use-symm-cancel-close.ts
|
|
2357
2297
|
function useSymmCancelClose(options) {
|
|
2358
2298
|
const { symmCoreClient, chainId, address } = useSymmContext();
|
|
2359
2299
|
const queryClient = useQueryClient();
|
|
2300
|
+
const resolveAuthToken = useResolveTradeAuthToken({ address, chainId });
|
|
2360
2301
|
return useMutation({
|
|
2361
2302
|
...withSymmMutationConfig(options?.mutation, {
|
|
2362
2303
|
onSuccess: () => {
|
|
@@ -2373,14 +2314,12 @@ function useSymmCancelClose(options) {
|
|
|
2373
2314
|
if (!symmCoreClient) {
|
|
2374
2315
|
throw new Error("symm-core client not available");
|
|
2375
2316
|
}
|
|
2376
|
-
const resolvedAccountAddress = accountAddress ?? address;
|
|
2377
2317
|
const resolvedChainId = overrideChainId ?? chainId;
|
|
2378
|
-
const resolvedAuthToken =
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
resolvedChainId
|
|
2382
|
-
|
|
2383
|
-
) : null);
|
|
2318
|
+
const resolvedAuthToken = await resolveAuthToken(
|
|
2319
|
+
authToken,
|
|
2320
|
+
accountAddress,
|
|
2321
|
+
resolvedChainId
|
|
2322
|
+
);
|
|
2384
2323
|
if (!resolvedAuthToken) {
|
|
2385
2324
|
throw new Error("auth token is required to cancel a pending close");
|
|
2386
2325
|
}
|
|
@@ -2395,6 +2334,7 @@ function useSymmCancelClose(options) {
|
|
|
2395
2334
|
function useSymmCloseOrder(options) {
|
|
2396
2335
|
const { symmCoreClient, address, chainId } = useSymmContext();
|
|
2397
2336
|
const queryClient = useQueryClient();
|
|
2337
|
+
const resolveAuthToken = useResolveTradeAuthToken({ address, chainId });
|
|
2398
2338
|
return useMutation({
|
|
2399
2339
|
...withSymmMutationConfig(options?.mutation, {
|
|
2400
2340
|
onSuccess: () => {
|
|
@@ -2407,16 +2347,17 @@ function useSymmCloseOrder(options) {
|
|
|
2407
2347
|
throw new Error("symm-core client not available");
|
|
2408
2348
|
}
|
|
2409
2349
|
const typedRequest = request;
|
|
2410
|
-
const
|
|
2350
|
+
const authToken = await resolveAuthToken(
|
|
2351
|
+
typedRequest.authToken,
|
|
2352
|
+
typedRequest.accountAddress
|
|
2353
|
+
);
|
|
2354
|
+
if (!authToken) {
|
|
2355
|
+
throw new Error("auth token is required to close an order");
|
|
2356
|
+
}
|
|
2411
2357
|
return symmCoreClient.orders.close(request.id, {
|
|
2412
2358
|
kind: request.kind,
|
|
2413
2359
|
type: request.type,
|
|
2414
|
-
authToken
|
|
2415
|
-
queryClient,
|
|
2416
|
-
resolvedAccountAddress,
|
|
2417
|
-
chainId,
|
|
2418
|
-
address
|
|
2419
|
-
) ?? void 0 : void 0)
|
|
2360
|
+
authToken
|
|
2420
2361
|
});
|
|
2421
2362
|
}
|
|
2422
2363
|
});
|
|
@@ -25526,64 +25467,6 @@ function useSymmBalances(params) {
|
|
|
25526
25467
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
25527
25468
|
});
|
|
25528
25469
|
}
|
|
25529
|
-
function logTradeAuth(event, details) {
|
|
25530
|
-
if (typeof window === "undefined") {
|
|
25531
|
-
return;
|
|
25532
|
-
}
|
|
25533
|
-
console.debug("[symm-trade]", event, details ?? {});
|
|
25534
|
-
}
|
|
25535
|
-
function splitTradeHookArgs(paramsOrOptions, options) {
|
|
25536
|
-
if (paramsOrOptions && "mutation" in paramsOrOptions) {
|
|
25537
|
-
return {
|
|
25538
|
-
params: {},
|
|
25539
|
-
options: paramsOrOptions
|
|
25540
|
-
};
|
|
25541
|
-
}
|
|
25542
|
-
return {
|
|
25543
|
-
params: paramsOrOptions ?? {},
|
|
25544
|
-
options
|
|
25545
|
-
};
|
|
25546
|
-
}
|
|
25547
|
-
function useResolveTradeAuthToken(params = {}) {
|
|
25548
|
-
const context = useSymmContext();
|
|
25549
|
-
const queryClient = useQueryClient();
|
|
25550
|
-
const address = params.address ?? context.address;
|
|
25551
|
-
const chainId = params.chainId ?? context.chainId;
|
|
25552
|
-
return useCallback(
|
|
25553
|
-
async (providedAuthToken, accountAddress) => {
|
|
25554
|
-
if (providedAuthToken) {
|
|
25555
|
-
logTradeAuth("resolve-auth:provided", {
|
|
25556
|
-
accountAddress,
|
|
25557
|
-
chainId
|
|
25558
|
-
});
|
|
25559
|
-
return providedAuthToken;
|
|
25560
|
-
}
|
|
25561
|
-
const resolvedAccountAddress = accountAddress ?? address;
|
|
25562
|
-
if (!resolvedAccountAddress) {
|
|
25563
|
-
return null;
|
|
25564
|
-
}
|
|
25565
|
-
const inMemoryToken = getAuthTokenFromRuntimeCache(
|
|
25566
|
-
queryClient,
|
|
25567
|
-
resolvedAccountAddress,
|
|
25568
|
-
chainId,
|
|
25569
|
-
address
|
|
25570
|
-
);
|
|
25571
|
-
if (inMemoryToken) {
|
|
25572
|
-
logTradeAuth("resolve-auth:store-hit", {
|
|
25573
|
-
accountAddress: resolvedAccountAddress,
|
|
25574
|
-
chainId
|
|
25575
|
-
});
|
|
25576
|
-
return inMemoryToken;
|
|
25577
|
-
}
|
|
25578
|
-
logTradeAuth("resolve-auth:miss", {
|
|
25579
|
-
accountAddress: resolvedAccountAddress,
|
|
25580
|
-
chainId
|
|
25581
|
-
});
|
|
25582
|
-
return null;
|
|
25583
|
-
},
|
|
25584
|
-
[address, chainId, queryClient]
|
|
25585
|
-
);
|
|
25586
|
-
}
|
|
25587
25470
|
function useSymmOpenBasketMutation(options) {
|
|
25588
25471
|
const { symmCoreClient } = useSymmContext();
|
|
25589
25472
|
const queryClient = useQueryClient();
|