@pear-protocol/symmio-client 0.3.18 → 0.3.19

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.
@@ -5,7 +5,7 @@ import { create } from 'zustand';
5
5
  import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
6
6
  import { jsx } from 'react/jsx-runtime';
7
7
  import { SiweMessage } from 'siwe';
8
- import { parseEventLogs, isAddress, encodeFunctionData } from 'viem';
8
+ import { isAddress, encodeFunctionData } from 'viem';
9
9
 
10
10
  var SymmContext = createContext(null);
11
11
  function useSymmContext() {
@@ -1716,6 +1716,12 @@ function validateAddress(address, name) {
1716
1716
  return address;
1717
1717
  }
1718
1718
  function validateAmount(amount, name) {
1719
+ if (typeof amount !== "bigint") {
1720
+ throw new SymmioSDKError(
1721
+ `${name} must be a bigint, got ${amount === void 0 ? "undefined" : typeof amount} (${amount})`,
1722
+ "INVALID_AMOUNT"
1723
+ );
1724
+ }
1719
1725
  if (amount <= 0n) {
1720
1726
  throw new SymmioSDKError(
1721
1727
  `${name} must be a positive amount, got ${amount}`,
@@ -2662,288 +2668,24 @@ function useSymmDepositAndAllocateMutation(params = {}, options) {
2662
2668
  }
2663
2669
  });
2664
2670
  }
2665
-
2666
- // src/abis/WithdrawFacet.ts
2667
- var WithdrawFacetABI = [
2668
- // ─── Mutations ──────────────────────────────────────────────────
2669
- {
2670
- type: "function",
2671
- name: "initiateWithdraw",
2672
- stateMutability: "nonpayable",
2673
- inputs: [
2674
- {
2675
- name: "parts",
2676
- type: "tuple[]",
2677
- internalType: "struct WithdrawReceiverPart[]",
2678
- components: [
2679
- { name: "id", type: "uint256", internalType: "uint256" },
2680
- { name: "amount", type: "uint256", internalType: "uint256" },
2681
- { name: "chainId", type: "int256", internalType: "int256" },
2682
- { name: "receiver", type: "bytes", internalType: "bytes" },
2683
- { name: "virtualProvider", type: "address", internalType: "address" },
2684
- { name: "expressProvider", type: "address", internalType: "address" }
2685
- ]
2686
- },
2687
- { name: "speedUp", type: "bool", internalType: "bool" },
2688
- { name: "data", type: "bytes", internalType: "bytes" }
2689
- ],
2690
- outputs: [
2691
- { name: "requestId", type: "uint256", internalType: "uint256" },
2692
- { name: "cooldownEndTime", type: "uint256", internalType: "uint256" }
2693
- ]
2694
- },
2695
- {
2696
- type: "function",
2697
- name: "finalizeWithdrawRequest",
2698
- stateMutability: "nonpayable",
2699
- inputs: [
2700
- { name: "user", type: "address", internalType: "address" },
2701
- { name: "requestId", type: "uint256", internalType: "uint256" }
2702
- ],
2703
- outputs: []
2704
- },
2705
- {
2706
- type: "function",
2707
- name: "requestCancelWithdraw",
2708
- stateMutability: "nonpayable",
2709
- inputs: [{ name: "requestId", type: "uint256", internalType: "uint256" }],
2710
- outputs: []
2711
- },
2712
- // ─── Views ──────────────────────────────────────────────────────
2713
- {
2714
- type: "function",
2715
- name: "getWithdrawableTime",
2716
- stateMutability: "view",
2717
- inputs: [{ name: "user", type: "address", internalType: "address" }],
2718
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }]
2719
- },
2720
- {
2721
- type: "function",
2722
- name: "getLastWithdrawRequestId",
2723
- stateMutability: "view",
2724
- inputs: [{ name: "user", type: "address", internalType: "address" }],
2725
- outputs: [{ name: "", type: "uint256", internalType: "uint256" }]
2726
- },
2727
- {
2728
- type: "function",
2729
- name: "isSpeedUpEligible",
2730
- stateMutability: "view",
2731
- inputs: [{ name: "user", type: "address", internalType: "address" }],
2732
- outputs: [{ name: "", type: "bool", internalType: "bool" }]
2733
- },
2734
- {
2735
- type: "function",
2736
- name: "isExpressProviderRegistered",
2737
- stateMutability: "view",
2738
- inputs: [{ name: "provider", type: "address", internalType: "address" }],
2739
- outputs: [{ name: "", type: "bool", internalType: "bool" }]
2740
- },
2741
- {
2742
- type: "function",
2743
- name: "isVirtualProviderRegistered",
2744
- stateMutability: "view",
2745
- inputs: [{ name: "provider", type: "address", internalType: "address" }],
2746
- outputs: [{ name: "", type: "bool", internalType: "bool" }]
2747
- },
2748
- // ─── Events ─────────────────────────────────────────────────────
2749
- {
2750
- type: "event",
2751
- name: "WithdrawInitiated",
2752
- anonymous: false,
2753
- inputs: [
2754
- { name: "requestId", type: "uint256", indexed: true, internalType: "uint256" },
2755
- { name: "user", type: "address", indexed: true, internalType: "address" },
2756
- {
2757
- name: "parts",
2758
- type: "tuple[]",
2759
- indexed: false,
2760
- internalType: "struct WithdrawReceiverPart[]",
2761
- components: [
2762
- { name: "id", type: "uint256", internalType: "uint256" },
2763
- { name: "amount", type: "uint256", internalType: "uint256" },
2764
- { name: "chainId", type: "int256", internalType: "int256" },
2765
- { name: "receiver", type: "bytes", internalType: "bytes" },
2766
- { name: "virtualProvider", type: "address", internalType: "address" },
2767
- { name: "expressProvider", type: "address", internalType: "address" }
2768
- ]
2769
- },
2770
- { name: "speedUp", type: "bool", indexed: false, internalType: "bool" },
2771
- { name: "providerData", type: "bytes", indexed: false, internalType: "bytes" },
2772
- { name: "cooldownEndTime", type: "uint256", indexed: false, internalType: "uint256" }
2773
- ]
2774
- },
2775
- {
2776
- type: "event",
2777
- name: "WithdrawAccepted",
2778
- anonymous: false,
2779
- inputs: [
2780
- { name: "requestId", type: "uint256", indexed: true, internalType: "uint256" },
2781
- { name: "user", type: "address", indexed: true, internalType: "address" }
2782
- ]
2783
- },
2784
- {
2785
- type: "event",
2786
- name: "WithdrawFinalized",
2787
- anonymous: false,
2788
- inputs: [
2789
- { name: "requestId", type: "uint256", indexed: true, internalType: "uint256" },
2790
- { name: "user", type: "address", indexed: true, internalType: "address" }
2791
- ]
2792
- },
2793
- {
2794
- type: "event",
2795
- name: "WithdrawCancelRequested",
2796
- anonymous: false,
2797
- inputs: [
2798
- { name: "requestId", type: "uint256", indexed: true, internalType: "uint256" },
2799
- { name: "user", type: "address", indexed: true, internalType: "address" }
2800
- ]
2801
- },
2802
- {
2803
- type: "event",
2804
- name: "WithdrawCancelled",
2805
- anonymous: false,
2806
- inputs: [
2807
- { name: "requestId", type: "uint256", indexed: true, internalType: "uint256" },
2808
- { name: "user", type: "address", indexed: true, internalType: "address" }
2809
- ]
2810
- },
2811
- {
2812
- type: "event",
2813
- name: "WithdrawRejected",
2814
- anonymous: false,
2815
- inputs: [
2816
- { name: "requestId", type: "uint256", indexed: false, internalType: "uint256" },
2817
- { name: "user", type: "address", indexed: false, internalType: "address" }
2818
- ]
2819
- },
2820
- {
2821
- type: "event",
2822
- name: "WithdrawSuspended",
2823
- anonymous: false,
2824
- inputs: [
2825
- { name: "requestId", type: "uint256", indexed: false, internalType: "uint256" },
2826
- { name: "user", type: "address", indexed: false, internalType: "address" }
2827
- ]
2828
- },
2829
- {
2830
- type: "event",
2831
- name: "WithdrawSpeedUpAccepted",
2832
- anonymous: false,
2833
- inputs: [
2834
- { name: "requestId", type: "uint256", indexed: false, internalType: "uint256" },
2835
- { name: "user", type: "address", indexed: false, internalType: "address" },
2836
- { name: "newCooldown", type: "uint256", indexed: false, internalType: "uint256" }
2837
- ]
2838
- }
2839
- ];
2840
-
2841
- // src/types/withdraw.ts
2842
- var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
2843
- function wrapInProxyCall(accountDiamondAbi, subAccount, callDatas) {
2671
+ function prepareWithdraw(multiAccount, account, params) {
2672
+ validateAmount(params.amount, "withdraw amount");
2673
+ validateAddress(params.account, "account");
2844
2674
  const data = encodeFunctionData({
2845
- abi: accountDiamondAbi,
2846
- functionName: "_call",
2847
- args: [subAccount, callDatas]
2848
- });
2849
- return {
2850
- functionName: "_call",
2851
- args: [subAccount, callDatas],
2852
- data
2853
- };
2854
- }
2855
-
2856
- // src/actions/withdraw.ts
2857
- function buildExpressWithdrawPart(amount, chainId, receiver, expressProvider, partId = 0n) {
2858
- return {
2859
- id: partId,
2860
- amount,
2861
- chainId,
2862
- receiver,
2863
- virtualProvider: ZERO_ADDRESS,
2864
- expressProvider
2865
- };
2866
- }
2867
- function validateParts(parts) {
2868
- if (parts.length === 0) {
2869
- throw new Error("initiateWithdraw: at least one withdraw part is required");
2870
- }
2871
- for (const part of parts) {
2872
- validateAmount(part.amount, "withdraw part amount");
2873
- if (part.expressProvider !== ZERO_ADDRESS && part.expressProvider === part.virtualProvider) {
2874
- throw new Error(
2875
- "initiateWithdraw: a single provider cannot be set as both express and virtual"
2876
- );
2877
- }
2878
- }
2879
- }
2880
- function prepareInitiateWithdraw(multiAccount, account, subAccount, params) {
2881
- validateParts(params.parts);
2882
- const innerData = encodeFunctionData({
2883
- abi: WithdrawFacetABI,
2884
- functionName: "initiateWithdraw",
2885
- args: [params.parts, params.speedUp, params.providerData]
2886
- });
2887
- const proxy = wrapInProxyCall(MultiAccountABI, subAccount, [innerData]);
2888
- return {
2889
- functionName: "_call",
2890
- args: proxy.args,
2891
- config: { account, to: multiAccount, data: proxy.data, value: 0n }
2892
- };
2893
- }
2894
- function prepareFinalizeWithdraw(multiAccount, account, subAccount, params) {
2895
- validateAddress(params.user, "user");
2896
- const innerData = encodeFunctionData({
2897
- abi: WithdrawFacetABI,
2898
- functionName: "finalizeWithdrawRequest",
2899
- args: [params.user, params.requestId]
2900
- });
2901
- const proxy = wrapInProxyCall(MultiAccountABI, subAccount, [innerData]);
2902
- return {
2903
- functionName: "_call",
2904
- args: proxy.args,
2905
- config: { account, to: multiAccount, data: proxy.data, value: 0n }
2906
- };
2907
- }
2908
- function prepareRequestCancelWithdraw(multiAccount, account, subAccount, params) {
2909
- const innerData = encodeFunctionData({
2910
- abi: WithdrawFacetABI,
2911
- functionName: "requestCancelWithdraw",
2912
- args: [params.requestId]
2675
+ abi: MultiAccountABI,
2676
+ functionName: "withdrawFromAccount",
2677
+ args: [params.account, params.amount]
2913
2678
  });
2914
- const proxy = wrapInProxyCall(MultiAccountABI, subAccount, [innerData]);
2915
2679
  return {
2916
- functionName: "_call",
2917
- args: proxy.args,
2918
- config: { account, to: multiAccount, data: proxy.data, value: 0n }
2680
+ functionName: "withdrawFromAccount",
2681
+ args: [params.account, params.amount],
2682
+ config: { account, to: multiAccount, data, value: 0n }
2919
2683
  };
2920
2684
  }
2921
- async function initiateWithdraw(walletClient, publicClient, multiAccount, subAccount, params) {
2922
- const account = walletClient.account?.address;
2923
- if (!account) throw new Error("Wallet client has no account");
2924
- const prepared = prepareInitiateWithdraw(multiAccount, account, subAccount, params);
2925
- const gas = await publicClient.estimateGas(prepared.config);
2926
- return walletClient.sendTransaction({
2927
- ...prepared.config,
2928
- gas: calculateGasMargin(gas),
2929
- chain: walletClient.chain
2930
- });
2931
- }
2932
- async function finalizeWithdraw(walletClient, publicClient, multiAccount, subAccount, params) {
2685
+ async function withdraw(walletClient, publicClient, multiAccount, params) {
2933
2686
  const account = walletClient.account?.address;
2934
2687
  if (!account) throw new Error("Wallet client has no account");
2935
- const prepared = prepareFinalizeWithdraw(multiAccount, account, subAccount, params);
2936
- const gas = await publicClient.estimateGas(prepared.config);
2937
- return walletClient.sendTransaction({
2938
- ...prepared.config,
2939
- gas: calculateGasMargin(gas),
2940
- chain: walletClient.chain
2941
- });
2942
- }
2943
- async function requestCancelWithdraw(walletClient, publicClient, multiAccount, subAccount, params) {
2944
- const account = walletClient.account?.address;
2945
- if (!account) throw new Error("Wallet client has no account");
2946
- const prepared = prepareRequestCancelWithdraw(multiAccount, account, subAccount, params);
2688
+ const prepared = prepareWithdraw(multiAccount, account, params);
2947
2689
  const gas = await publicClient.estimateGas(prepared.config);
2948
2690
  return walletClient.sendTransaction({
2949
2691
  ...prepared.config,
@@ -2953,201 +2695,26 @@ async function requestCancelWithdraw(walletClient, publicClient, multiAccount, s
2953
2695
  }
2954
2696
 
2955
2697
  // src/react/hooks/use-symm-withdraw.ts
2956
- function useResolvedWithdrawConfig(params) {
2698
+ function useSymmWithdraw(params = {}, options) {
2957
2699
  const { chainId, symmioConfig } = useSymmContext();
2958
- const multiAccount = symmioConfig?.multiAccountAddress ?? getAddress(MULTI_ACCOUNT_ADDRESS, chainId, "MultiAccount");
2959
- return {
2960
- multiAccount,
2961
- publicClient: params.publicClient,
2962
- walletClient: params.walletClient,
2963
- contextSubAccount: params.subAccount
2964
- };
2965
- }
2966
- function useSymmInitiateWithdraw(params = {}, options) {
2967
- const queryClient = useQueryClient();
2968
- const { multiAccount, publicClient, walletClient, contextSubAccount } = useResolvedWithdrawConfig(params);
2969
- return useMutation({
2970
- ...withSymmMutationConfig(options?.mutation, {
2971
- onSuccess: () => invalidateBalances(queryClient)
2972
- }),
2973
- mutationFn: async (vars) => {
2974
- if (!walletClient || !publicClient) throw new Error("Clients not available");
2975
- const subAccount = vars.subAccount ?? contextSubAccount;
2976
- if (!subAccount) throw new Error("subAccount required");
2977
- return initiateWithdraw(walletClient, publicClient, multiAccount, subAccount, {
2978
- parts: vars.parts,
2979
- speedUp: vars.speedUp,
2980
- providerData: vars.providerData
2981
- });
2982
- }
2983
- });
2984
- }
2985
- function useSymmFinalizeWithdraw(params = {}, options) {
2986
- const queryClient = useQueryClient();
2987
- const { multiAccount, publicClient, walletClient, contextSubAccount } = useResolvedWithdrawConfig(params);
2988
- return useMutation({
2989
- ...withSymmMutationConfig(options?.mutation, {
2990
- onSuccess: () => invalidateBalances(queryClient)
2991
- }),
2992
- mutationFn: async (vars) => {
2993
- if (!walletClient || !publicClient) throw new Error("Clients not available");
2994
- const subAccount = vars.subAccount ?? contextSubAccount;
2995
- if (!subAccount) throw new Error("subAccount required");
2996
- return finalizeWithdraw(walletClient, publicClient, multiAccount, subAccount, {
2997
- user: vars.user,
2998
- requestId: vars.requestId
2999
- });
3000
- }
3001
- });
3002
- }
3003
- function useSymmRequestCancelWithdraw(params = {}, options) {
2700
+ const { publicClient, walletClient } = params;
3004
2701
  const queryClient = useQueryClient();
3005
- const { multiAccount, publicClient, walletClient, contextSubAccount } = useResolvedWithdrawConfig(params);
2702
+ const multiAccount = symmioConfig?.multiAccountAddress ?? getAddress(MULTI_ACCOUNT_ADDRESS, chainId, "MultiAccount");
3006
2703
  return useMutation({
3007
2704
  ...withSymmMutationConfig(options?.mutation, {
3008
- onSuccess: () => invalidateBalances(queryClient)
2705
+ onSuccess: () => {
2706
+ invalidateBalances(queryClient);
2707
+ }
3009
2708
  }),
3010
- mutationFn: async (vars) => {
2709
+ mutationFn: async ({
2710
+ account,
2711
+ amount
2712
+ }) => {
3011
2713
  if (!walletClient || !publicClient) throw new Error("Clients not available");
3012
- const subAccount = vars.subAccount ?? contextSubAccount;
3013
- if (!subAccount) throw new Error("subAccount required");
3014
- return requestCancelWithdraw(walletClient, publicClient, multiAccount, subAccount, {
3015
- requestId: vars.requestId
3016
- });
2714
+ return withdraw(walletClient, publicClient, multiAccount, { account, amount });
3017
2715
  }
3018
2716
  });
3019
2717
  }
3020
- function useSymmWithdraw(params = {}) {
3021
- return {
3022
- initiate: useSymmInitiateWithdraw(params),
3023
- finalize: useSymmFinalizeWithdraw(params),
3024
- requestCancel: useSymmRequestCancelWithdraw(params)
3025
- };
3026
- }
3027
- var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
3028
- function useSymmInstantWithdraw(params = {}) {
3029
- const queryClient = useQueryClient();
3030
- const { chainId, symmioConfig } = useSymmContext();
3031
- const { multiAccount, publicClient, walletClient, contextSubAccount } = useResolvedWithdrawConfig(params);
3032
- const diamond = params.diamond ?? symmioConfig?.symmioDiamondAddress ?? getAddress(SYMMIO_DIAMOND_ADDRESS, chainId, "SymmioDiamond");
3033
- const providerTimeoutMs = params.providerAcceptanceTimeoutMs ?? 6e4;
3034
- const pollIntervalMs = params.pollIntervalMs ?? 3e3;
3035
- const [status, setStatus] = useState("idle" /* IDLE */);
3036
- const [requestId, setRequestId] = useState();
3037
- const [txHashes, setTxHashes] = useState({});
3038
- const [error, setError] = useState();
3039
- const reset = useCallback(() => {
3040
- setStatus("idle" /* IDLE */);
3041
- setRequestId(void 0);
3042
- setTxHashes({});
3043
- setError(void 0);
3044
- }, []);
3045
- const withdraw = useCallback(
3046
- async (vars) => {
3047
- setError(void 0);
3048
- setRequestId(void 0);
3049
- setTxHashes({});
3050
- try {
3051
- if (!walletClient || !publicClient) throw new Error("Clients not available");
3052
- const subAccount = vars.subAccount ?? contextSubAccount;
3053
- if (!subAccount) throw new Error("subAccount required");
3054
- setStatus("initiating" /* INITIATING */);
3055
- const part = buildExpressWithdrawPart(
3056
- vars.amount,
3057
- vars.chainId,
3058
- vars.receiver,
3059
- vars.expressProvider,
3060
- vars.partId ?? 0n
3061
- );
3062
- const initiateHash = await initiateWithdraw(
3063
- walletClient,
3064
- publicClient,
3065
- multiAccount,
3066
- subAccount,
3067
- {
3068
- parts: [part],
3069
- speedUp: vars.speedUp ?? false,
3070
- providerData: vars.providerData ?? "0x"
3071
- }
3072
- );
3073
- setTxHashes({ initiate: initiateHash });
3074
- const initiateReceipt = await publicClient.waitForTransactionReceipt({
3075
- hash: initiateHash
3076
- });
3077
- const [initiated] = parseEventLogs({
3078
- abi: WithdrawFacetABI,
3079
- eventName: "WithdrawInitiated",
3080
- logs: initiateReceipt.logs
3081
- });
3082
- if (!initiated) {
3083
- throw new Error("WithdrawInitiated event not found in initiate receipt");
3084
- }
3085
- const reqId = initiated.args.requestId;
3086
- const cooldownEndTime = initiated.args.cooldownEndTime;
3087
- setRequestId(reqId);
3088
- setStatus("awaitingProvider" /* AWAITING_PROVIDER */);
3089
- const acceptanceDeadline = Date.now() + providerTimeoutMs;
3090
- let fromBlock = initiateReceipt.blockNumber;
3091
- let accepted = false;
3092
- while (Date.now() < acceptanceDeadline) {
3093
- const events = await publicClient.getContractEvents({
3094
- address: diamond,
3095
- abi: WithdrawFacetABI,
3096
- eventName: "WithdrawAccepted",
3097
- args: { requestId: reqId, user: subAccount },
3098
- fromBlock,
3099
- toBlock: "latest"
3100
- });
3101
- if (events.length > 0) {
3102
- accepted = true;
3103
- break;
3104
- }
3105
- await sleep(pollIntervalMs);
3106
- }
3107
- if (!accepted) {
3108
- throw new Error(
3109
- `Express provider did not accept within ${providerTimeoutMs}ms (requestId=${reqId})`
3110
- );
3111
- }
3112
- setStatus("awaitingCooldown" /* AWAITING_COOLDOWN */);
3113
- const nowSec = Math.floor(Date.now() / 1e3);
3114
- const remainingSec = Number(cooldownEndTime) - nowSec;
3115
- if (remainingSec > 0) {
3116
- await sleep((remainingSec + 1) * 1e3);
3117
- }
3118
- setStatus("finalizing" /* FINALIZING */);
3119
- const finalizeHash = await finalizeWithdraw(
3120
- walletClient,
3121
- publicClient,
3122
- multiAccount,
3123
- subAccount,
3124
- { user: subAccount, requestId: reqId }
3125
- );
3126
- setTxHashes((t) => ({ ...t, finalize: finalizeHash }));
3127
- await publicClient.waitForTransactionReceipt({ hash: finalizeHash });
3128
- setStatus("completed" /* COMPLETED */);
3129
- invalidateBalances(queryClient);
3130
- return { requestId: reqId, initiateHash, finalizeHash };
3131
- } catch (e) {
3132
- const err = e instanceof Error ? e : new Error(String(e));
3133
- setError(err);
3134
- setStatus("failed" /* FAILED */);
3135
- throw err;
3136
- }
3137
- },
3138
- [
3139
- walletClient,
3140
- publicClient,
3141
- multiAccount,
3142
- diamond,
3143
- contextSubAccount,
3144
- providerTimeoutMs,
3145
- pollIntervalMs,
3146
- queryClient
3147
- ]
3148
- );
3149
- return { withdraw, status, requestId, txHashes, error, reset };
3150
- }
3151
2718
 
3152
2719
  // src/abis/SymmioDiamond.ts
3153
2720
  var SymmioDiamondABI = [
@@ -25533,6 +25100,18 @@ var SymmioDiamondABI = [
25533
25100
  type: "function"
25534
25101
  }
25535
25102
  ];
25103
+ function wrapInProxyCall(accountDiamondAbi, subAccount, callDatas) {
25104
+ const data = encodeFunctionData({
25105
+ abi: accountDiamondAbi,
25106
+ functionName: "_call",
25107
+ args: [subAccount, callDatas]
25108
+ });
25109
+ return {
25110
+ functionName: "_call",
25111
+ args: [subAccount, callDatas],
25112
+ data
25113
+ };
25114
+ }
25536
25115
 
25537
25116
  // src/actions/allocate.ts
25538
25117
  function prepareAllocate(multiAccount, account, subAccount, params) {
@@ -26527,8 +26106,8 @@ function computeSymmNetDeposited(totals, decimals = 6) {
26527
26106
  return "0";
26528
26107
  }
26529
26108
  const deposit2 = parseRawCollateralUnits(totals.deposit);
26530
- const withdraw = parseRawCollateralUnits(totals.withdraw);
26531
- const value = deposit2 - withdraw;
26109
+ const withdraw2 = parseRawCollateralUnits(totals.withdraw);
26110
+ const value = deposit2 - withdraw2;
26532
26111
  const negative = value < 0n;
26533
26112
  const absolute = negative ? -value : value;
26534
26113
  const scale = 10n ** BigInt(decimals);
@@ -28337,6 +27916,6 @@ function getSymmErrorMessage(error) {
28337
27916
  return "An unexpected error occurred.";
28338
27917
  }
28339
27918
 
28340
- export { SymmProvider, computeSymmAccountOverview, computeSymmAccountOverviewFromData, computeSymmNetDeposited, computeSymmPositionUpnl, computeSymmPositionsUpnl, getSymmAccountBalanceInfo, getSymmAccountData, getSymmErrorMessage, normalizeSymmUpnlWebSocketMessage, symmKeys, useBinanceMarkPriceStore, useSymmAccountCurrentPnl, useSymmAccountData, useSymmAccountOverview, useSymmAccountSummary, useSymmAccountsApi, useSymmAccountsLength, useSymmAccountsQuery, useSymmAccountsWithPositions, useSymmAllocateCollateralMutation, useSymmApprovalQuery, useSymmApproveMutation, useSymmAuth, useSymmAvailableMargin, useSymmBalances, useSymmCancelClose, useSymmCancelOpenMutation, useSymmCancelTpslMutation, useSymmCancelTwapOrderMutation, useSymmChartCandles, useSymmChartSelection, useSymmClearTriggerConfigMutation, useSymmCloseAllPositionsMutation, useSymmCloseOrder, useSymmClosePositionMutation, useSymmContext, useSymmCoreClient, useSymmCreateAccountMutation, useSymmDeallocateCollateralMutation, useSymmDelegateAccessMutation, useSymmDelegation, useSymmDepositAndAllocateMutation, useSymmDepositMutation, useSymmEditAccountNameMutation, useSymmFinalizeWithdraw, useSymmFunding, useSymmFundingHistory, useSymmFundingPayments, useSymmHedgerMarketById, useSymmHedgerMarketBySymbol, useSymmHedgerMarkets, useSymmInitiateWithdraw, useSymmInstantTradeEnsureReadyMutation, useSymmInstantTradeExecuteMutation, useSymmInstantWithdraw, useSymmInternalTransferCollateralMutation, useSymmLockedParams, useSymmMarkReadNotificationMutation, useSymmMarketPositioning, useSymmMarkets, useSymmNotificationsQuery, useSymmOpenBasketMutation, useSymmOpenOrders, useSymmPendingIds, useSymmPendingInstantOpens, useSymmPerformanceOverlays, useSymmPortfolio, useSymmPositions, useSymmProposeRevokeDelegationMutation, useSymmRequestCancelWithdraw, useSymmRevokeDelegationMutation, useSymmSetTpslMutation, useSymmSetTriggerConfigMutation, useSymmSignTermsMutation, useSymmSignatureQuery, useSymmTokenMarkPrice, useSymmTokenSelectionMarkets, useSymmTokenSelectionMetadata, useSymmTpslOrders, useSymmTradeHistory, useSymmTriggerConfigQuery, useSymmTriggerOrders, useSymmTwapOrder, useSymmTwapOrdersQuery, useSymmUnreadCountQuery, useSymmUpdatePositionMutation, useSymmUpnlWebSocket, useSymmWithdraw, useSymmWsStore };
27919
+ export { SymmProvider, computeSymmAccountOverview, computeSymmAccountOverviewFromData, computeSymmNetDeposited, computeSymmPositionUpnl, computeSymmPositionsUpnl, getSymmAccountBalanceInfo, getSymmAccountData, getSymmErrorMessage, normalizeSymmUpnlWebSocketMessage, symmKeys, useBinanceMarkPriceStore, useSymmAccountCurrentPnl, useSymmAccountData, useSymmAccountOverview, useSymmAccountSummary, useSymmAccountsApi, useSymmAccountsLength, useSymmAccountsQuery, useSymmAccountsWithPositions, useSymmAllocateCollateralMutation, useSymmApprovalQuery, useSymmApproveMutation, useSymmAuth, useSymmAvailableMargin, useSymmBalances, useSymmCancelClose, useSymmCancelOpenMutation, useSymmCancelTpslMutation, useSymmCancelTwapOrderMutation, useSymmChartCandles, useSymmChartSelection, useSymmClearTriggerConfigMutation, useSymmCloseAllPositionsMutation, useSymmCloseOrder, useSymmClosePositionMutation, useSymmContext, useSymmCoreClient, useSymmCreateAccountMutation, useSymmDeallocateCollateralMutation, useSymmDelegateAccessMutation, useSymmDelegation, useSymmDepositAndAllocateMutation, useSymmDepositMutation, useSymmEditAccountNameMutation, useSymmFunding, useSymmFundingHistory, useSymmFundingPayments, useSymmHedgerMarketById, useSymmHedgerMarketBySymbol, useSymmHedgerMarkets, useSymmInstantTradeEnsureReadyMutation, useSymmInstantTradeExecuteMutation, useSymmInternalTransferCollateralMutation, useSymmLockedParams, useSymmMarkReadNotificationMutation, useSymmMarketPositioning, useSymmMarkets, useSymmNotificationsQuery, useSymmOpenBasketMutation, useSymmOpenOrders, useSymmPendingIds, useSymmPendingInstantOpens, useSymmPerformanceOverlays, useSymmPortfolio, useSymmPositions, useSymmProposeRevokeDelegationMutation, useSymmRevokeDelegationMutation, useSymmSetTpslMutation, useSymmSetTriggerConfigMutation, useSymmSignTermsMutation, useSymmSignatureQuery, useSymmTokenMarkPrice, useSymmTokenSelectionMarkets, useSymmTokenSelectionMetadata, useSymmTpslOrders, useSymmTradeHistory, useSymmTriggerConfigQuery, useSymmTriggerOrders, useSymmTwapOrder, useSymmTwapOrdersQuery, useSymmUnreadCountQuery, useSymmUpdatePositionMutation, useSymmUpnlWebSocket, useSymmWithdraw, useSymmWsStore };
28341
27920
  //# sourceMappingURL=index.mjs.map
28342
27921
  //# sourceMappingURL=index.mjs.map