@funkit/connect 10.6.0 → 11.0.0
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/CHANGELOG.md +27 -0
- package/dist/clients/chunk-2FSEE3AW.js +277 -0
- package/dist/clients/chunk-5MY7WMEJ.js +20 -0
- package/dist/clients/chunk-6CYZKITE.js +33 -0
- package/dist/clients/{chunk-TG2AACP2.js → chunk-C4SHJFOV.js} +2 -2
- package/dist/clients/{chunk-3LJQTM37.js → chunk-FNB7OPJI.js} +12 -198
- package/dist/clients/{chunk-2NBYHUIW.js → chunk-HZP4DXIZ.js} +1 -0
- package/dist/clients/{chunk-F6P4CN27.js → chunk-JD2J5K6S.js} +16 -8
- package/dist/clients/chunk-LT4EWLDA.js +30 -0
- package/dist/clients/chunk-MGQLVTSH.js +100 -0
- package/dist/clients/{chunk-FJ6GCMJ4.js → chunk-OODIKHYE.js} +3 -1
- package/dist/clients/chunk-SFDEST63.js +18 -0
- package/dist/clients/{chunk-OZ3KD24N.js → chunk-ZCCLJW6F.js} +0 -8
- package/dist/clients/fanatics.js +5 -6
- package/dist/clients/internal/nado/encoding.js +4 -25
- package/dist/clients/internal/nado/gateway.d.ts +0 -21
- package/dist/clients/internal/nado/gateway.js +1 -5
- package/dist/clients/internal/nado/hooks.d.ts +0 -158
- package/dist/clients/internal/nado/hooks.js +10 -121
- package/dist/clients/internal/nado/withdrawalConfig.js +3 -13
- package/dist/clients/internal/nado/withdrawalForm.css +17529 -0
- package/dist/clients/internal/nado/withdrawalForm.d.ts +41 -0
- package/dist/clients/internal/nado/withdrawalForm.js +283 -0
- package/dist/clients/internal/nado/withdrawalTypes.d.ts +7 -2
- package/dist/clients/lighter.d.ts +29 -1
- package/dist/clients/lighter.js +105 -99
- package/dist/clients/mallard.js +24 -3
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +6 -3
- package/dist/clients/polymarket/index.js +6 -3
- package/dist/domains/swapped.d.ts +1 -10
- package/dist/hooks/useTokenAndChainDropdown.d.ts +8 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1369 -892
- package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +20 -31
- package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +5 -9
- package/dist/providers/FunkitCheckoutContext/types.d.ts +61 -4
- package/dist/utils/customer.d.ts +349 -0
- package/dist/utils/withdrawal.d.ts +13 -6
- package/dist/wagmi/actions.d.ts +1 -1
- package/dist/wallets/Wallet.d.ts +21 -1
- package/dist/wallets/walletConnectors/index.js +11 -11
- package/package.json +3 -3
- package/dist/clients/chunk-A4WQS6QG.js +0 -207
- package/dist/clients/internal/nado/products.d.ts +0 -36
- package/dist/clients/internal/nado/products.js +0 -19
|
@@ -1,132 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
findSettlementForNonce,
|
|
13
|
-
getNadoWithdrawalEvents
|
|
14
|
-
} from "../../chunk-BNMZM23Q.js";
|
|
3
|
+
shouldRetryNadoQuery,
|
|
4
|
+
useNadoFeeRates,
|
|
5
|
+
useNadoMaxWithdrawable,
|
|
6
|
+
useNadoSettlementStatus,
|
|
7
|
+
useNadoSubaccountBalances
|
|
8
|
+
} from "../../chunk-MGQLVTSH.js";
|
|
9
|
+
import "../../chunk-ZCCLJW6F.js";
|
|
10
|
+
import "../../chunk-BNMZM23Q.js";
|
|
15
11
|
import "../../chunk-II5CZTBC.js";
|
|
16
12
|
import "../../chunk-L2KSNS7H.js";
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
} from "../../chunk-2YWQL3AO.js";
|
|
20
|
-
import "../../chunk-FJ6GCMJ4.js";
|
|
21
|
-
import {
|
|
22
|
-
useConfig
|
|
23
|
-
} from "../../chunk-UPZNKPYU.js";
|
|
24
|
-
import {
|
|
25
|
-
logger
|
|
26
|
-
} from "../../chunk-AHYOV7AV.js";
|
|
27
|
-
|
|
28
|
-
// src/clients/internal/nado/hooks.ts
|
|
29
|
-
import { skipToken, useQuery } from "@tanstack/react-query";
|
|
30
|
-
import { useEffect, useReducer } from "react";
|
|
31
|
-
var BALANCES_REFETCH_MS = 3e4;
|
|
32
|
-
var MAX_WITHDRAWABLE_REFETCH_MS = 3e4;
|
|
33
|
-
var FEE_RATES_STALE_MS = 5 * 6e4;
|
|
34
|
-
var SETTLEMENT_POLL_MS = 1e4;
|
|
35
|
-
var SETTLEMENT_TIMEOUT_MS = 10 * 6e4;
|
|
36
|
-
function shouldRetryNadoQuery(failureCount, error) {
|
|
37
|
-
if (error instanceof NadoGatewayError && (error.kind === "api" || error.kind === "timeout" || error.httpStatus === 429)) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
return failureCount < 2;
|
|
41
|
-
}
|
|
42
|
-
function useNadoProducts() {
|
|
43
|
-
const wagmiConfig = useConfig();
|
|
44
|
-
const query = useQuery({
|
|
45
|
-
queryKey: ["nadoProducts"],
|
|
46
|
-
queryFn: ({ signal }) => fetchNadoProducts(wagmiConfig, signal),
|
|
47
|
-
staleTime: Number.POSITIVE_INFINITY,
|
|
48
|
-
gcTime: Number.POSITIVE_INFINITY,
|
|
49
|
-
retry: shouldRetryNadoQuery
|
|
50
|
-
});
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
if (query.isError) {
|
|
53
|
-
logger.warn("nado:products_fallback", {
|
|
54
|
-
message: "gateway_error",
|
|
55
|
-
errorMessage: query.error instanceof Error ? query.error.message : String(query.error)
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}, [query.isError, query.error]);
|
|
59
|
-
return { ...query, data: query.data ?? NADO_SUPPORTED_PRODUCTS };
|
|
60
|
-
}
|
|
61
|
-
function useNadoSubaccountBalances(subaccount) {
|
|
62
|
-
return useQuery({
|
|
63
|
-
queryKey: ["nadoSubaccountInfo", subaccount],
|
|
64
|
-
queryFn: subaccount ? ({ signal }) => getNadoSubaccountInfo(subaccount, signal) : skipToken,
|
|
65
|
-
refetchInterval: BALANCES_REFETCH_MS,
|
|
66
|
-
retry: shouldRetryNadoQuery
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
function useNadoMaxWithdrawable(params) {
|
|
70
|
-
const { productId, sender, spotLeverage } = params;
|
|
71
|
-
return useQuery({
|
|
72
|
-
queryKey: ["nadoMaxWithdrawable", sender, productId, spotLeverage],
|
|
73
|
-
queryFn: productId !== void 0 && sender ? ({ signal }) => getNadoMaxWithdrawable({ productId, sender, spotLeverage }, signal) : skipToken,
|
|
74
|
-
refetchInterval: MAX_WITHDRAWABLE_REFETCH_MS,
|
|
75
|
-
retry: shouldRetryNadoQuery
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
function useNadoFeeRates(sender) {
|
|
79
|
-
return useQuery({
|
|
80
|
-
queryKey: ["nadoFeeRates", sender],
|
|
81
|
-
queryFn: sender ? ({ signal }) => getNadoFeeRates(sender, signal) : skipToken,
|
|
82
|
-
staleTime: FEE_RATES_STALE_MS,
|
|
83
|
-
retry: shouldRetryNadoQuery
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
function useNadoSettlementStatus(params) {
|
|
87
|
-
const { subaccount, nonce, submittedAtMs, enabled } = params;
|
|
88
|
-
const isPastTimeout = () => submittedAtMs !== void 0 && Date.now() - submittedAtMs >= SETTLEMENT_TIMEOUT_MS;
|
|
89
|
-
const query = useQuery({
|
|
90
|
-
queryKey: ["nadoSettlementStatus", subaccount, nonce?.toString()],
|
|
91
|
-
queryFn: subaccount && nonce !== void 0 ? async ({ signal }) => {
|
|
92
|
-
const { txs } = await getNadoWithdrawalEvents(
|
|
93
|
-
{ subaccount, limit: 3 },
|
|
94
|
-
signal
|
|
95
|
-
);
|
|
96
|
-
const settlement = findSettlementForNonce(txs, nonce);
|
|
97
|
-
return {
|
|
98
|
-
isSequenced: settlement !== void 0,
|
|
99
|
-
sequencedAt: settlement ? Number(settlement.timestamp) : void 0
|
|
100
|
-
};
|
|
101
|
-
} : skipToken,
|
|
102
|
-
enabled: enabled && submittedAtMs !== void 0,
|
|
103
|
-
// Only the 10s interval drives fetches — a sequenced result is final, so
|
|
104
|
-
// focus/remount refetches would re-ask an answered question
|
|
105
|
-
staleTime: Number.POSITIVE_INFINITY,
|
|
106
|
-
// No retry — the next 10s poll is the retry
|
|
107
|
-
retry: false,
|
|
108
|
-
refetchInterval: (query2) => query2.state.data?.isSequenced || isPastTimeout() ? false : SETTLEMENT_POLL_MS
|
|
109
|
-
});
|
|
110
|
-
const [, rerenderAtTimeout] = useReducer((n) => n + 1, 0);
|
|
111
|
-
useEffect(() => {
|
|
112
|
-
if (submittedAtMs === void 0 || !enabled) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
const remainingMs = submittedAtMs + SETTLEMENT_TIMEOUT_MS - Date.now();
|
|
116
|
-
if (remainingMs <= 0) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
const id = setTimeout(rerenderAtTimeout, remainingMs);
|
|
120
|
-
return () => clearTimeout(id);
|
|
121
|
-
}, [submittedAtMs, enabled]);
|
|
122
|
-
const isTimedOut = isPastTimeout() && query.data?.isSequenced !== true;
|
|
123
|
-
return { ...query, isTimedOut };
|
|
124
|
-
}
|
|
13
|
+
import "../../chunk-2YWQL3AO.js";
|
|
14
|
+
import "../../chunk-AHYOV7AV.js";
|
|
125
15
|
export {
|
|
126
16
|
shouldRetryNadoQuery,
|
|
127
17
|
useNadoFeeRates,
|
|
128
18
|
useNadoMaxWithdrawable,
|
|
129
|
-
useNadoProducts,
|
|
130
19
|
useNadoSettlementStatus,
|
|
131
20
|
useNadoSubaccountBalances
|
|
132
21
|
};
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import {
|
|
3
|
+
isNadoWithdrawalConfig
|
|
4
|
+
} from "../../chunk-SFDEST63.js";
|
|
2
5
|
import "../../chunk-AHYOV7AV.js";
|
|
3
|
-
|
|
4
|
-
// src/utils/withdrawal.ts
|
|
5
|
-
import { isEVMAddressEquivalent, isTokenEquivalent } from "@funkit/utils";
|
|
6
|
-
import * as dnum from "dnum";
|
|
7
|
-
import { parseUnits } from "viem";
|
|
8
|
-
function isCustomWithdrawalConfig(config) {
|
|
9
|
-
return "withdrawCallback" in config;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// src/clients/internal/nado/withdrawalConfig.ts
|
|
13
|
-
function isNadoWithdrawalConfig(config) {
|
|
14
|
-
return !!config && isCustomWithdrawalConfig(config) && config.customerConfig?.customerName === "nado";
|
|
15
|
-
}
|
|
16
6
|
export {
|
|
17
7
|
isNadoWithdrawalConfig
|
|
18
8
|
};
|