@funkit/connect 11.1.0 → 11.3.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 +118 -0
- package/dist/clients/{chunk-YZSO4EMO.js → chunk-2576N7PQ.js} +1 -1
- package/dist/clients/{chunk-II5CZTBC.js → chunk-3P2C436B.js} +3 -1
- package/dist/clients/{chunk-YMGRBJAS.js → chunk-46L2KJJ4.js} +14 -16
- package/dist/clients/chunk-6EU6CXNH.js +20 -0
- package/dist/clients/{chunk-2QYQNTOI.js → chunk-C45VNQXY.js} +24 -16
- package/dist/clients/{chunk-SO756ELD.js → chunk-DGBIV3ZS.js} +1 -0
- package/dist/clients/{chunk-SYFHMTUO.js → chunk-FM7SFGAV.js} +2 -2
- package/dist/clients/{chunk-EJKHMZW3.js → chunk-IYCZWLAF.js} +2 -1
- package/dist/clients/{chunk-OJZNF6EM.js → chunk-JFDRLSYM.js} +1 -1
- package/dist/clients/{chunk-QIMCURVA.js → chunk-L2XMI4EX.js} +9 -9
- package/dist/clients/{chunk-A6OXZWCN.js → chunk-QQEGNLGD.js} +1 -1
- package/dist/clients/{chunk-A44M6EAG.js → chunk-TZGKB6WY.js} +1 -1
- package/dist/clients/{chunk-C53FRCUM.js → chunk-UK64SY6N.js} +1 -1
- package/dist/clients/{chunk-WVM4ZJD2.js → chunk-VIAEAD75.js} +1 -1
- package/dist/clients/{chunk-SH3MHRHX.js → chunk-Y7WLUPTX.js} +1 -1
- package/dist/clients/{chunk-FAYBQQNB.js → chunk-YUZ3B2Q3.js} +1 -1
- package/dist/clients/fanatics.js +2 -2
- package/dist/clients/internal/nado/consts.d.ts +6 -0
- package/dist/clients/internal/nado/consts.js +5 -3
- package/dist/clients/internal/nado/gateway.js +2 -2
- package/dist/clients/internal/nado/hooks.js +4 -4
- package/dist/clients/internal/nado/indexer.js +2 -2
- package/dist/clients/internal/nado/typedData.js +2 -2
- package/dist/clients/internal/nado/withdrawalCallback.js +7 -7
- package/dist/clients/internal/nado/withdrawalConfig.d.ts +4 -4
- package/dist/clients/internal/nado/withdrawalConfig.js +2 -2
- package/dist/clients/internal/nado/withdrawalErrors.js +2 -2
- package/dist/clients/internal/nado/withdrawalForm.css +43 -35
- package/dist/clients/internal/nado/withdrawalForm.d.ts +3 -0
- package/dist/clients/internal/nado/withdrawalForm.js +15 -11
- package/dist/clients/internal/nado/withdrawalStatus.js +3 -3
- package/dist/clients/lighter.css +43 -35
- package/dist/clients/lighter.d.ts +4 -30
- package/dist/clients/lighter.js +74 -260
- package/dist/clients/mallard.js +2 -2
- package/dist/clients/nado.js +9 -9
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +43 -35
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +8 -8
- package/dist/clients/polymarket/createPolymarketDepositConfig.d.ts +6 -0
- package/dist/clients/polymarket/createPolymarketDepositConfig.js +2 -2
- package/dist/clients/polymarket/index.css +43 -35
- package/dist/clients/polymarket/index.js +11 -11
- package/dist/clients/polymarket/polymarket.js +1 -1
- package/dist/components/Dialog/Dialog.d.ts +3 -1
- package/dist/components/Dialog/DialogContent.css.d.ts +6 -0
- package/dist/components/FunCheckbox/FunCheckbox.d.ts +3 -1
- package/dist/components/FunCheckoutHistory/FunCheckoutHistoryContent.d.ts +3 -1
- package/dist/components/FunCheckoutHistory/PendingSuccessScreen.d.ts +3 -1
- package/dist/components/FunTransactionSummary/PaymentFeesSummary.d.ts +2 -1
- package/dist/domains/checkout.d.ts +2 -1
- package/dist/domains/nado.d.ts +11 -2
- package/dist/domains/quoteMode/types.d.ts +16 -0
- package/dist/domains/relay.d.ts +0 -3
- package/dist/hooks/track/analytics/claimAnalyticsEvent.d.ts +5 -0
- package/dist/hooks/track/analytics/events.d.ts +203 -7
- package/dist/hooks/track/analytics/mappers.d.ts +17 -0
- package/dist/hooks/track/analytics/quote.d.ts +12 -0
- package/dist/hooks/track/analytics/resolveExecutionProgressContext.d.ts +40 -0
- package/dist/hooks/track/analytics/useDepositAnalytics.d.ts +87 -2
- package/dist/hooks/track/analytics/useTrackExecutionProgressEvents.d.ts +48 -0
- package/dist/hooks/track/analytics/useWithdrawalAnalytics.d.ts +18 -0
- package/dist/hooks/track/useTrack.d.ts +1 -1
- package/dist/hooks/useFunkitTranslation.d.ts +5 -0
- package/dist/hooks/useIsBlacklistedWithdrawalAddress.d.ts +4 -1
- package/dist/hooks/useTokenAndChainDropdown.d.ts +4 -1
- package/dist/index.css +43 -35
- package/dist/index.js +5301 -3619
- package/dist/modals/CheckoutModal/ConfirmationStep/useCheckoutConfirmation.d.ts +2 -1
- package/dist/modals/CheckoutModal/ConfirmationStep/useQuoteRefresh.d.ts +5 -1
- package/dist/modals/CheckoutModal/ConfirmationStep/useTrackDepositQuoteEvents.d.ts +20 -0
- package/dist/modals/CheckoutModal/InputAmount/InputAmount.d.ts +5 -1
- package/dist/modals/CheckoutModal/InputAmount/state.d.ts +13 -0
- package/dist/modals/CheckoutModal/InputAmount/useMeld.d.ts +4 -3
- package/dist/modals/CheckoutModal/InputAmount/utils.d.ts +9 -1
- package/dist/modals/CheckoutModal/MeldQuotes/MeldQuotes.d.ts +3 -1
- package/dist/modals/CheckoutModal/MeldQuotes/useMeldQuotes.d.ts +1 -1
- package/dist/modals/CheckoutModal/MeldRedirect/MeldRedirect.d.ts +4 -1
- package/dist/modals/CheckoutModal/SourceChange/useBottomBarCloseLabel.d.ts +7 -0
- package/dist/modals/CheckoutModal/SourceChange/useTrackSourceChangeEvents.d.ts +10 -0
- package/dist/modals/CheckoutModal/TransferToken/useTrackDepositNotificationEvents.d.ts +6 -0
- package/dist/modals/CheckoutModal/TransferToken/useTransferTokenTracking.d.ts +9 -3
- package/dist/modals/PolymarketPerpsTransfer/recordPerpsTransfer.d.ts +40 -0
- package/dist/modals/PolymarketPerpsTransfer/useRecordPerpsTransfer.d.ts +24 -0
- package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +14 -92
- package/dist/modals/WithdrawalModal/LockedReceiveDisplay.d.ts +22 -0
- package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +3 -1
- package/dist/modals/WithdrawalModal/useTrackWithdrawalEvents.d.ts +1 -0
- package/dist/modals/WithdrawalModal/withdrawalFormHelpers.d.ts +18 -1
- package/dist/modals/WithdrawalModal/withdrawalHooks.d.ts +1 -1
- package/dist/providers/FunkitCheckoutContext/index.d.ts +10 -2
- package/dist/providers/FunkitCheckoutContext/types.d.ts +21 -4
- package/dist/providers/FunkitStatsigProvider.d.ts +7 -0
- package/dist/utils/customer.d.ts +45 -504
- package/dist/utils/lighter.d.ts +1 -83
- package/dist/utils/signature.d.ts +1 -2
- package/dist/utils/withdrawal.d.ts +11 -1
- package/dist/wallets/walletConnectors/index.js +49 -49
- package/package.json +4 -5
- package/dist/clients/chunk-NAVU6W7V.js +0 -89
package/dist/utils/lighter.d.ts
CHANGED
|
@@ -1,83 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const LIGHTER_DEPOSIT_ADDRESS: Address;
|
|
3
|
-
export declare const LIGHTER_SLOW_DEPOSIT_TIME_ESTIMATE_SECONDS: number;
|
|
4
|
-
export declare const LIGHTER_DELAYED_AUTO_TRIGGER_CUTOFF: number;
|
|
5
|
-
/**
|
|
6
|
-
* zkLighter L1 `withdraw` ABI — selector `0xd20191bd`, non-payable, on the same
|
|
7
|
-
* contract as deposits. `amount` is in Lighter base units (see
|
|
8
|
-
* {@link lighterWithdrawBaseUnits}).
|
|
9
|
-
*/
|
|
10
|
-
export declare const LIGHTER_WITHDRAW_ABI: readonly [{
|
|
11
|
-
readonly type: "function";
|
|
12
|
-
readonly name: "withdraw";
|
|
13
|
-
readonly stateMutability: "nonpayable";
|
|
14
|
-
readonly inputs: readonly [{
|
|
15
|
-
readonly name: "accountIndex";
|
|
16
|
-
readonly type: "uint48";
|
|
17
|
-
}, {
|
|
18
|
-
readonly name: "assetIndex";
|
|
19
|
-
readonly type: "uint16";
|
|
20
|
-
}, {
|
|
21
|
-
readonly name: "routeType";
|
|
22
|
-
readonly type: "uint8";
|
|
23
|
-
}, {
|
|
24
|
-
readonly name: "amount";
|
|
25
|
-
readonly type: "uint64";
|
|
26
|
-
}];
|
|
27
|
-
readonly outputs: readonly [];
|
|
28
|
-
}];
|
|
29
|
-
/** Strips fractional digits beyond `decimals` (string-based, no float math). */
|
|
30
|
-
export declare function truncateToDecimals(amount: string, decimals: number): string;
|
|
31
|
-
/**
|
|
32
|
-
* Converts a token-unit amount to Lighter L1 `withdraw` base units.
|
|
33
|
-
*
|
|
34
|
-
* Uses the L2 convention — USDC (asset index 3) = 6 decimals, all other assets
|
|
35
|
-
* = 8 — NOT the mainnet ERC-20 decimals (LIT/ETH would be 18). Confirmed on
|
|
36
|
-
* chain: 1 USDC → `1_000_000`, 1 LIT → `100_000_000`.
|
|
37
|
-
*/
|
|
38
|
-
export declare function lighterWithdrawBaseUnits(assetIndex: number, amountTokenUnits: string): bigint;
|
|
39
|
-
/**
|
|
40
|
-
* Builds the on-chain `withdraw` transaction for the L1 fallback. `value` is 0
|
|
41
|
-
* (no protocol fee — the user pays gas only).
|
|
42
|
-
*/
|
|
43
|
-
export declare function buildLighterL1WithdrawTransaction(params: {
|
|
44
|
-
accountIndex: number;
|
|
45
|
-
assetIndex: number;
|
|
46
|
-
routeType: number;
|
|
47
|
-
amountBaseUnit: bigint;
|
|
48
|
-
}): {
|
|
49
|
-
to: Address;
|
|
50
|
-
data: Hex;
|
|
51
|
-
value: bigint;
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Explorer link for a Lighter Secure withdrawal tx. The L1 on-chain fallback
|
|
55
|
-
* produces a canonical 32-byte mainnet tx hash → Etherscan; L2 Secure hashes
|
|
56
|
-
* are Lighter's own (non-EVM) format → Lighter explorer. Detecting the EVM hash
|
|
57
|
-
* keeps L1-vs-L2 routing self-contained (no extra state threaded through the
|
|
58
|
-
* modal step machine).
|
|
59
|
-
*/
|
|
60
|
-
export declare function resolveLighterWithdrawalExplorerUrl(txHash: string): string;
|
|
61
|
-
/**
|
|
62
|
-
* True when an error is Lighter's **L2 (Secure) withdrawal** rate limit —
|
|
63
|
-
* codes 23004 / 23005, e.g. "Too Many L2 Withdrawal Requests!: L2 withdrawal
|
|
64
|
-
* rate limit exceeded. Only 3 withdrawals allowed per 2 hours". Used to offer
|
|
65
|
-
* the on-chain L1 fallback (Secure withdrawals only).
|
|
66
|
-
*
|
|
67
|
-
* The L2 SDK usually surfaces this as a plain string (the numeric code isn't
|
|
68
|
-
* always preserved), so we match message content — plus the structured `code`
|
|
69
|
-
* field when the error carries one.
|
|
70
|
-
*/
|
|
71
|
-
export declare function isLighterWithdrawalRateLimitError(error: unknown): boolean;
|
|
72
|
-
export declare const LIGHTER_DYNAMIC_ROUTING_ID: {
|
|
73
|
-
ETH_SPOT: string;
|
|
74
|
-
USDC_PERPS: string;
|
|
75
|
-
ETH_SPOT_NEW_USER: string;
|
|
76
|
-
USDC_PERPS_NEW_USER: string;
|
|
77
|
-
LINK_SPOT_NEW_USER: string;
|
|
78
|
-
UNI_SPOT_NEW_USER: string;
|
|
79
|
-
AAVE_SPOT_NEW_USER: string;
|
|
80
|
-
SKY_SPOT_NEW_USER: string;
|
|
81
|
-
LDO_SPOT_NEW_USER: string;
|
|
82
|
-
LIT_SPOT_NEW_USER: string;
|
|
83
|
-
};
|
|
1
|
+
export { LIGHTER_DELAYED_AUTO_TRIGGER_CUTOFF, LIGHTER_DEPOSIT_ADDRESS, LIGHTER_DYNAMIC_ROUTING_ID, LIGHTER_SLOW_DEPOSIT_TIME_ESTIMATE_SECONDS, LIGHTER_WITHDRAW_ABI, buildLighterL1WithdrawTransaction, isLighterWithdrawalRateLimitError, lighterWithdrawBaseUnits, resolveLighterWithdrawalExplorerUrl, truncateToDecimals, } from '@funkit/connect-core/clients/lighter';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare function isSwitchChainError(error: unknown): boolean;
|
|
1
|
+
export { isSwitchChainError, isUserRejectedError } from '@funkit/connect-core';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CustomWithdrawalConfig, FunkitWithdrawalConfig, MultiMethodWithdrawalConfig, WalletWithdrawalConfig, WithdrawalSourceTokenBalanceParams } from '../providers/FunkitCheckoutContext';
|
|
1
|
+
import type { CustomWithdrawalConfig, FunkitWithdrawalConfig, MultiMethodWithdrawalConfig, SourceTokenOption, WalletWithdrawalConfig, WithdrawalSourceTokenBalanceParams } from '../providers/FunkitCheckoutContext';
|
|
2
2
|
/**
|
|
3
3
|
* Deducts a flat fee (in token units) from a withdrawal input amount, clamped
|
|
4
4
|
* at 0. Uses `dnum` fixed-point math so decimal strings straight off the amount
|
|
@@ -35,6 +35,16 @@ export declare function isNoOpSelfWithdrawal({ config, recipientAddress, selecte
|
|
|
35
35
|
selectedChainId: number | undefined;
|
|
36
36
|
destinationTokenAddress: string | undefined;
|
|
37
37
|
}): boolean;
|
|
38
|
+
/** A source-token option that can only move as-is — its receive target is the
|
|
39
|
+
* option's own asset. */
|
|
40
|
+
export type DirectTransferOnlyOption = SourceTokenOption & {
|
|
41
|
+
asset: NonNullable<SourceTokenOption['asset']>;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* True when the selected source option supports direct transfer only: xStocks
|
|
45
|
+
* have no Relay liquidity, so the only viable route is a same-token same-chain sweep.
|
|
46
|
+
*/
|
|
47
|
+
export declare function isDirectTransferOnlyOption(sourceTokenOption: SourceTokenOption | undefined): sourceTokenOption is DirectTransferOnlyOption;
|
|
38
48
|
/**
|
|
39
49
|
* Type guard to check if withdrawal config uses custom callback flow
|
|
40
50
|
*/
|
|
@@ -5,6 +5,9 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
zerionWallet
|
|
7
7
|
} from "./chunk-SWFF3TWJ.js";
|
|
8
|
+
import {
|
|
9
|
+
tahoWallet
|
|
10
|
+
} from "./chunk-7ZYCBDQ4.js";
|
|
8
11
|
import {
|
|
9
12
|
talismanWallet
|
|
10
13
|
} from "./chunk-4DCO3TGL.js";
|
|
@@ -14,9 +17,6 @@ import {
|
|
|
14
17
|
import {
|
|
15
18
|
tokenaryWallet
|
|
16
19
|
} from "./chunk-VH3THHJY.js";
|
|
17
|
-
import {
|
|
18
|
-
oneKeyWallet
|
|
19
|
-
} from "./chunk-WVT6BBJH.js";
|
|
20
20
|
import {
|
|
21
21
|
trustWallet
|
|
22
22
|
} from "./chunk-KCRO2AGO.js";
|
|
@@ -30,14 +30,20 @@ import {
|
|
|
30
30
|
xdefiWallet
|
|
31
31
|
} from "./chunk-JN5I3DNC.js";
|
|
32
32
|
import {
|
|
33
|
-
|
|
34
|
-
} from "./chunk-
|
|
33
|
+
rabbyWallet
|
|
34
|
+
} from "./chunk-RB66PKPA.js";
|
|
35
|
+
import {
|
|
36
|
+
ramperWallet
|
|
37
|
+
} from "./chunk-OQB55QXP.js";
|
|
38
|
+
import {
|
|
39
|
+
rainbowWallet
|
|
40
|
+
} from "./chunk-W2LCLDPX.js";
|
|
35
41
|
import {
|
|
36
42
|
safeWallet
|
|
37
43
|
} from "./chunk-RCY66YHF.js";
|
|
38
44
|
import {
|
|
39
|
-
|
|
40
|
-
} from "./chunk-
|
|
45
|
+
roninWallet
|
|
46
|
+
} from "./chunk-YQFGVZGR.js";
|
|
41
47
|
import {
|
|
42
48
|
safeheronWallet
|
|
43
49
|
} from "./chunk-76S7R2ND.js";
|
|
@@ -48,11 +54,11 @@ import {
|
|
|
48
54
|
subWallet
|
|
49
55
|
} from "./chunk-NR2OGDHQ.js";
|
|
50
56
|
import {
|
|
51
|
-
|
|
52
|
-
} from "./chunk-
|
|
57
|
+
mewWallet
|
|
58
|
+
} from "./chunk-MQM45ADF.js";
|
|
53
59
|
import {
|
|
54
|
-
|
|
55
|
-
} from "./chunk-
|
|
60
|
+
ledgerWallet
|
|
61
|
+
} from "./chunk-RPV27V2Y.js";
|
|
56
62
|
import {
|
|
57
63
|
oktoWallet
|
|
58
64
|
} from "./chunk-YWOVAU6O.js";
|
|
@@ -63,56 +69,44 @@ import {
|
|
|
63
69
|
oneInchWallet
|
|
64
70
|
} from "./chunk-QG6ZHI7B.js";
|
|
65
71
|
import {
|
|
66
|
-
|
|
67
|
-
} from "./chunk-
|
|
72
|
+
oneKeyWallet
|
|
73
|
+
} from "./chunk-WVT6BBJH.js";
|
|
74
|
+
import {
|
|
75
|
+
okxWallet
|
|
76
|
+
} from "./chunk-KI5Y2BBF.js";
|
|
68
77
|
import {
|
|
69
78
|
phantomWallet
|
|
70
79
|
} from "./chunk-QY53O7WG.js";
|
|
71
|
-
import {
|
|
72
|
-
rabbyWallet
|
|
73
|
-
} from "./chunk-RB66PKPA.js";
|
|
74
|
-
import {
|
|
75
|
-
rainbowWallet
|
|
76
|
-
} from "./chunk-W2LCLDPX.js";
|
|
77
|
-
import {
|
|
78
|
-
ramperWallet
|
|
79
|
-
} from "./chunk-OQB55QXP.js";
|
|
80
|
-
import {
|
|
81
|
-
foxWallet
|
|
82
|
-
} from "./chunk-GUQM4QSL.js";
|
|
83
|
-
import {
|
|
84
|
-
frameWallet
|
|
85
|
-
} from "./chunk-BU3ZAT5X.js";
|
|
86
80
|
import {
|
|
87
81
|
gateWallet
|
|
88
82
|
} from "./chunk-JPN6TWIT.js";
|
|
89
83
|
import {
|
|
90
84
|
frontierWallet
|
|
91
85
|
} from "./chunk-AVDUNQUW.js";
|
|
86
|
+
import {
|
|
87
|
+
coin98Wallet
|
|
88
|
+
} from "./chunk-WAHGI5L7.js";
|
|
92
89
|
import {
|
|
93
90
|
imTokenWallet
|
|
94
91
|
} from "./chunk-WNAGGFMG.js";
|
|
95
92
|
import {
|
|
96
|
-
|
|
97
|
-
} from "./chunk-
|
|
98
|
-
import {
|
|
99
|
-
mewWallet
|
|
100
|
-
} from "./chunk-MQM45ADF.js";
|
|
93
|
+
coinbaseWallet
|
|
94
|
+
} from "./chunk-2DLDAZRH.js";
|
|
101
95
|
import {
|
|
102
96
|
injectedWallet
|
|
103
97
|
} from "./chunk-T6LGKC3F.js";
|
|
104
98
|
import {
|
|
105
|
-
|
|
106
|
-
} from "./chunk-
|
|
99
|
+
kresusWallet
|
|
100
|
+
} from "./chunk-RICTB3FA.js";
|
|
107
101
|
import {
|
|
108
|
-
|
|
109
|
-
} from "./chunk-
|
|
102
|
+
metaMaskWallet
|
|
103
|
+
} from "./chunk-YO2K4MBH.js";
|
|
110
104
|
import {
|
|
111
|
-
|
|
112
|
-
} from "./chunk-
|
|
105
|
+
bybitWallet
|
|
106
|
+
} from "./chunk-OX37G4YT.js";
|
|
113
107
|
import {
|
|
114
|
-
|
|
115
|
-
} from "./chunk-
|
|
108
|
+
clvWallet
|
|
109
|
+
} from "./chunk-OEEGYENV.js";
|
|
116
110
|
import {
|
|
117
111
|
coreWallet
|
|
118
112
|
} from "./chunk-4NV5BYRP.js";
|
|
@@ -126,14 +120,17 @@ import {
|
|
|
126
120
|
enkryptWallet
|
|
127
121
|
} from "./chunk-HBQK5RD5.js";
|
|
128
122
|
import {
|
|
129
|
-
|
|
130
|
-
} from "./chunk-
|
|
123
|
+
foxWallet
|
|
124
|
+
} from "./chunk-GUQM4QSL.js";
|
|
125
|
+
import {
|
|
126
|
+
frameWallet
|
|
127
|
+
} from "./chunk-BU3ZAT5X.js";
|
|
131
128
|
import {
|
|
132
129
|
argentWallet
|
|
133
130
|
} from "./chunk-NTMBEOR2.js";
|
|
134
131
|
import {
|
|
135
|
-
|
|
136
|
-
} from "./chunk-
|
|
132
|
+
bifrostWallet
|
|
133
|
+
} from "./chunk-IULPZP2Q.js";
|
|
137
134
|
import {
|
|
138
135
|
bitgetWallet
|
|
139
136
|
} from "./chunk-TKB2OY6G.js";
|
|
@@ -141,12 +138,15 @@ import {
|
|
|
141
138
|
bitverseWallet
|
|
142
139
|
} from "./chunk-NSK6A7TI.js";
|
|
143
140
|
import {
|
|
144
|
-
|
|
145
|
-
} from "./chunk-
|
|
141
|
+
bitskiWallet
|
|
142
|
+
} from "./chunk-7HRFUZFX.js";
|
|
146
143
|
import {
|
|
147
|
-
|
|
148
|
-
} from "./chunk-
|
|
144
|
+
bloomWallet
|
|
145
|
+
} from "./chunk-PJ7Y57EH.js";
|
|
149
146
|
import "./chunk-N4IJLYFY.js";
|
|
147
|
+
import {
|
|
148
|
+
braveWallet
|
|
149
|
+
} from "./chunk-DS73TZ6O.js";
|
|
150
150
|
import "./chunk-OLZ7626J.js";
|
|
151
151
|
import "./chunk-IGKXZBTA.js";
|
|
152
152
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funkit/connect",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.3.0",
|
|
4
4
|
"description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -87,7 +87,6 @@
|
|
|
87
87
|
"@bluvo/react": "3.0.0-beta.1",
|
|
88
88
|
"@bluvo/sdk-ts": "3.0.0-beta.1",
|
|
89
89
|
"@datadog/browser-logs": "5.22.0",
|
|
90
|
-
"@lifeomic/attempt": "3.1.0",
|
|
91
90
|
"@number-flow/react": "^0.5.5",
|
|
92
91
|
"@radix-ui/react-dropdown-menu": "^2.1.7",
|
|
93
92
|
"@radix-ui/react-tooltip": "^1.2.0",
|
|
@@ -107,10 +106,10 @@
|
|
|
107
106
|
"ua-parser-js": "^1.0.37",
|
|
108
107
|
"use-debounce": "^10.0.5",
|
|
109
108
|
"uuid": "^11.1.1",
|
|
110
|
-
"@funkit/api-base": "
|
|
109
|
+
"@funkit/api-base": "7.0.0",
|
|
111
110
|
"@funkit/chains": "2.2.0",
|
|
112
|
-
"@funkit/connect-core": "
|
|
113
|
-
"@funkit/fun-relay": "2.
|
|
111
|
+
"@funkit/connect-core": "3.0.0",
|
|
112
|
+
"@funkit/fun-relay": "2.11.0",
|
|
114
113
|
"@funkit/utils": "4.0.0"
|
|
115
114
|
},
|
|
116
115
|
"repository": {
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/utils/customer.ts
|
|
4
|
-
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
5
|
-
import { useCallback } from "react";
|
|
6
|
-
var LIGHTER_MAIN_ACCOUNT_TYPE = 0;
|
|
7
|
-
var LIGHTER_TRADING_MODE = {
|
|
8
|
-
SIMPLE: 0,
|
|
9
|
-
UNIFIED: 1
|
|
10
|
-
};
|
|
11
|
-
async function getLighterAccountsByL1Address(address) {
|
|
12
|
-
const response = await fetch(
|
|
13
|
-
`https://mainnet.zklighter.elliot.ai/api/v1/accountsByL1Address?l1_address=${address}`
|
|
14
|
-
);
|
|
15
|
-
if (!response.ok) {
|
|
16
|
-
throw new Error(`Failed to fetch lighter accounts: ${response.statusText}`);
|
|
17
|
-
}
|
|
18
|
-
const data = await response.json();
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
async function getLighterAccount(lookup, activeOnly) {
|
|
22
|
-
const params = new URLSearchParams({
|
|
23
|
-
by: lookup.by,
|
|
24
|
-
value: String(lookup.value),
|
|
25
|
-
...activeOnly !== void 0 && { active_only: String(activeOnly) }
|
|
26
|
-
});
|
|
27
|
-
const response = await fetch(
|
|
28
|
-
`https://mainnet.zklighter.elliot.ai/api/v1/account?${params}`
|
|
29
|
-
);
|
|
30
|
-
if (!response.ok) {
|
|
31
|
-
throw new Error(`Failed to fetch lighter account: ${response.statusText}`);
|
|
32
|
-
}
|
|
33
|
-
return response.json();
|
|
34
|
-
}
|
|
35
|
-
function useLighterAccountQuery(lookup, options) {
|
|
36
|
-
const enabled = lookup !== null && (lookup.by === "index" ? true : !!lookup.value && lookup.value !== "0x");
|
|
37
|
-
const query = useQuery({
|
|
38
|
-
queryKey: [
|
|
39
|
-
"lighterAccount",
|
|
40
|
-
lookup?.by,
|
|
41
|
-
lookup?.value,
|
|
42
|
-
options?.activeOnly
|
|
43
|
-
],
|
|
44
|
-
// biome-ignore lint/style/noNonNullAssertion: already checked for null
|
|
45
|
-
queryFn: () => getLighterAccount(lookup, options?.activeOnly),
|
|
46
|
-
enabled,
|
|
47
|
-
// Refetch on every (re)mount so reopening the withdraw widget shows a fresh
|
|
48
|
-
// balance after a spot→perps transfer; 10s stale window keeps it current.
|
|
49
|
-
staleTime: 1e4,
|
|
50
|
-
refetchOnMount: "always",
|
|
51
|
-
retry: false
|
|
52
|
-
});
|
|
53
|
-
return {
|
|
54
|
-
...query,
|
|
55
|
-
account: query.data?.accounts?.[0]
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function useLighterAccountsQuery({
|
|
59
|
-
address
|
|
60
|
-
}) {
|
|
61
|
-
const enabled = !!address && address !== "0x";
|
|
62
|
-
const query = useQuery({
|
|
63
|
-
queryKey: ["lighterAccounts", address],
|
|
64
|
-
queryFn: () => getLighterAccountsByL1Address(address),
|
|
65
|
-
enabled,
|
|
66
|
-
staleTime: Number.POSITIVE_INFINITY,
|
|
67
|
-
gcTime: Number.POSITIVE_INFINITY,
|
|
68
|
-
retry: false,
|
|
69
|
-
// allows us to always refetch the data but return the previous data until the new data is fetched
|
|
70
|
-
refetchOnMount: "always"
|
|
71
|
-
});
|
|
72
|
-
const subAccounts = query.data?.sub_accounts;
|
|
73
|
-
const mainAccount = subAccounts?.find(
|
|
74
|
-
(account) => account.account_type === LIGHTER_MAIN_ACCOUNT_TYPE
|
|
75
|
-
);
|
|
76
|
-
return {
|
|
77
|
-
...query,
|
|
78
|
-
mainAccountIndex: mainAccount?.index?.toString(),
|
|
79
|
-
// False until the accounts load — consumers fall back to the simple-mode
|
|
80
|
-
// UI (both USDC variants shown) while the trading mode is unknown.
|
|
81
|
-
isUnifiedTradingMode: mainAccount?.account_trading_mode === LIGHTER_TRADING_MODE.UNIFIED,
|
|
82
|
-
subAccounts
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export {
|
|
87
|
-
useLighterAccountQuery,
|
|
88
|
-
useLighterAccountsQuery
|
|
89
|
-
};
|