@funkit/connect 11.3.0 → 11.4.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 +34 -0
- package/dist/clients/{chunk-46L2KJJ4.js → chunk-3Y5EIONT.js} +5 -5
- package/dist/clients/{chunk-DGBIV3ZS.js → chunk-B7UU2ETA.js} +0 -13
- package/dist/clients/{chunk-QQEGNLGD.js → chunk-EQFVPSR2.js} +1 -1
- package/dist/clients/internal/nado/withdrawalCallback.js +3 -3
- package/dist/clients/internal/nado/withdrawalConfig.d.ts +2 -0
- package/dist/clients/internal/nado/withdrawalConfig.js +2 -2
- package/dist/clients/internal/nado/withdrawalForm.js +10 -55
- package/dist/clients/lighter.d.ts +0 -31
- package/dist/clients/lighter.js +5 -93
- package/dist/clients/nado.d.ts +2 -0
- package/dist/clients/nado.js +6 -5
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +4 -4
- package/dist/clients/polymarket/index.js +9 -9
- package/dist/domains/checkout.d.ts +6 -1
- package/dist/hooks/track/analytics/events.d.ts +5 -6
- package/dist/hooks/track/analytics/useTrackExecutionProgressEvents.d.ts +2 -33
- package/dist/hooks/track/useTrackV2.d.ts +2 -0
- package/dist/hooks/useAssetPrice.d.ts +1 -6
- package/dist/index.js +377 -537
- package/dist/providers/FunkitStatsigProvider.d.ts +1 -1
- package/dist/utils/withdrawal.d.ts +1 -21
- package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
- package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
- package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
- package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
- package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
- package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
- package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
- package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
- package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
- package/dist/wallets/walletConnectors/index.js +46 -46
- package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
- package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
- package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
- package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
- package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
- package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
- package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
- package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
- package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
- package/package.json +4 -4
- package/dist/clients/{chunk-L2XMI4EX.js → chunk-XJTRLB7W.js} +8 -8
- package/dist/wallets/walletConnectors/{chunk-W2LCLDPX.js → chunk-2VP2F6EK.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-IULPZP2Q.js → chunk-4T6ZSRJF.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-WAHGI5L7.js → chunk-6BW3HLBG.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-YO2K4MBH.js → chunk-CCQV2ZET.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-TKB2OY6G.js → chunk-CPI4TD43.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-OX37G4YT.js → chunk-F5XEEVG6.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-JPN6TWIT.js → chunk-HNRB7KJU.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-WKNQMP4A.js → chunk-HTHAK6XB.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-GUQM4QSL.js → chunk-MIQTHJ6X.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-4NV5BYRP.js → chunk-RB3HR4R2.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-SWFF3TWJ.js → chunk-RVOY537T.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-KI5Y2BBF.js → chunk-STVVP43G.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-OEEGYENV.js → chunk-UK7C2JXW.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-YQFGVZGR.js → chunk-VAPGUPHO.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-XCNHV3HS.js → chunk-VTM6EECM.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-NR2OGDHQ.js → chunk-X6CGV36L.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-AVDUNQUW.js → chunk-YEZM4CK4.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-KCRO2AGO.js → chunk-ZNX4EMPB.js} +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @funkit/connect
|
|
2
2
|
|
|
3
|
+
## 11.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- bbb0301: Lighter Native Bridge withdrawals record the same attribution row on every platform.
|
|
8
|
+
|
|
9
|
+
Move `trackLighterSecureWithdrawal` export from `connect` to `connect-core`
|
|
10
|
+
|
|
11
|
+
- 3e31f1c: Allow Nado withdrawals to start with the borrow toggle preselected.
|
|
12
|
+
- 3d95b7f: Risk assessment now screens on the transaction's chain: `getRiskAssessmentForAddress` accepts an optional `chainId`, and checkout and withdrawal screens send it.
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 480d658: Consolidate common event properties.
|
|
17
|
+
- 76dafe1: Withdrawal flat-fee deduction now comes from `@funkit/connect-core`, so web and React Native price the same amount.
|
|
18
|
+
- 993ac35: React Native token pricing now falls back to Relay when the funkit price API can't price a token, so configured USD withdrawal limits stay enforced.
|
|
19
|
+
- db08b0d: fix(connect): reject non-decimal withdrawal source balance values
|
|
20
|
+
- e1354ad: Update fiat default pill amounts
|
|
21
|
+
- Updated dependencies [fade45e]
|
|
22
|
+
- Updated dependencies [759b3f4]
|
|
23
|
+
- Updated dependencies [c667b94]
|
|
24
|
+
- Updated dependencies [c667b94]
|
|
25
|
+
- Updated dependencies [53d7f38]
|
|
26
|
+
- Updated dependencies [76dafe1]
|
|
27
|
+
- Updated dependencies [bbb0301]
|
|
28
|
+
- Updated dependencies [07a4ae6]
|
|
29
|
+
- Updated dependencies [3d95b7f]
|
|
30
|
+
- Updated dependencies [993ac35]
|
|
31
|
+
- Updated dependencies [db08b0d]
|
|
32
|
+
- Updated dependencies [e1354ad]
|
|
33
|
+
- @funkit/api-base@7.1.0
|
|
34
|
+
- @funkit/connect-core@3.1.0
|
|
35
|
+
- @funkit/fun-relay@2.12.0
|
|
36
|
+
|
|
3
37
|
## 11.3.0
|
|
4
38
|
|
|
5
39
|
### Minor Changes
|
|
@@ -10,9 +10,8 @@ import {
|
|
|
10
10
|
safeBigInt
|
|
11
11
|
} from "./chunk-63XTVHO3.js";
|
|
12
12
|
import {
|
|
13
|
-
deductFlatFee,
|
|
14
13
|
toWithdrawalAmountBaseUnit
|
|
15
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-B7UU2ETA.js";
|
|
16
15
|
import {
|
|
17
16
|
x18ToRawBaseUnit
|
|
18
17
|
} from "./chunk-6T6URLBM.js";
|
|
@@ -34,12 +33,12 @@ import {
|
|
|
34
33
|
signTypedData,
|
|
35
34
|
switchChain
|
|
36
35
|
} from "./chunk-OODIKHYE.js";
|
|
37
|
-
import {
|
|
38
|
-
generateClientMetadataForTokenTransfer
|
|
39
|
-
} from "./chunk-PENJ5JGH.js";
|
|
40
36
|
import {
|
|
41
37
|
i18n_default
|
|
42
38
|
} from "./chunk-C45VNQXY.js";
|
|
39
|
+
import {
|
|
40
|
+
generateClientMetadataForTokenTransfer
|
|
41
|
+
} from "./chunk-PENJ5JGH.js";
|
|
43
42
|
import {
|
|
44
43
|
logger
|
|
45
44
|
} from "./chunk-AHYOV7AV.js";
|
|
@@ -49,6 +48,7 @@ import {
|
|
|
49
48
|
NADO_API_KEY,
|
|
50
49
|
initializeCheckoutTokenTransferAddress
|
|
51
50
|
} from "@funkit/api-base";
|
|
51
|
+
import { deductFlatFee } from "@funkit/connect-core";
|
|
52
52
|
import { isEVMAddressEquivalent } from "@funkit/utils";
|
|
53
53
|
|
|
54
54
|
// src/utils/signature.ts
|
|
@@ -3,19 +3,7 @@
|
|
|
3
3
|
// src/utils/withdrawal.ts
|
|
4
4
|
import { chainMetadataById } from "@funkit/chains";
|
|
5
5
|
import { isEVMAddressEquivalent, isTokenEquivalent } from "@funkit/utils";
|
|
6
|
-
import * as dnum from "dnum";
|
|
7
6
|
import { parseUnits } from "viem";
|
|
8
|
-
function deductFlatFee(inputAmount, feeTokens) {
|
|
9
|
-
if (!feeTokens || feeTokens <= 0) {
|
|
10
|
-
return inputAmount;
|
|
11
|
-
}
|
|
12
|
-
try {
|
|
13
|
-
const net = dnum.subtract(inputAmount || "0", feeTokens);
|
|
14
|
-
return dnum.greaterThan(net, 0) ? dnum.toString(net) : "0";
|
|
15
|
-
} catch {
|
|
16
|
-
return "0";
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
7
|
function isCustomWithdrawalConfig(config) {
|
|
20
8
|
return "withdrawCallback" in config;
|
|
21
9
|
}
|
|
@@ -30,7 +18,6 @@ function toWithdrawalAmountBaseUnit(amount, decimals) {
|
|
|
30
18
|
}
|
|
31
19
|
|
|
32
20
|
export {
|
|
33
|
-
deductFlatFee,
|
|
34
21
|
isCustomWithdrawalConfig,
|
|
35
22
|
toWithdrawalAmountBaseUnit
|
|
36
23
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createNadoWithdrawalCallback
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-3Y5EIONT.js";
|
|
5
5
|
import "../../chunk-2576N7PQ.js";
|
|
6
6
|
import "../../chunk-VIAEAD75.js";
|
|
7
7
|
import "../../chunk-63XTVHO3.js";
|
|
8
|
-
import "../../chunk-
|
|
8
|
+
import "../../chunk-B7UU2ETA.js";
|
|
9
9
|
import "../../chunk-6T6URLBM.js";
|
|
10
10
|
import "../../chunk-TZGKB6WY.js";
|
|
11
11
|
import "../../chunk-3P2C436B.js";
|
|
12
12
|
import "../../chunk-WZRW6WUM.js";
|
|
13
13
|
import "../../chunk-Z7HTQFEO.js";
|
|
14
14
|
import "../../chunk-OODIKHYE.js";
|
|
15
|
-
import "../../chunk-PENJ5JGH.js";
|
|
16
15
|
import "../../chunk-C45VNQXY.js";
|
|
16
|
+
import "../../chunk-PENJ5JGH.js";
|
|
17
17
|
import "../../chunk-AHYOV7AV.js";
|
|
18
18
|
export {
|
|
19
19
|
createNadoWithdrawalCallback
|
|
@@ -9,6 +9,8 @@ import type { CustomWithdrawalConfig, FunkitWithdrawalConfig } from '../../../pr
|
|
|
9
9
|
import type { NadoWithdrawalCustomerConfig } from './withdrawalTypes';
|
|
10
10
|
export interface NadoWithdrawalConfig extends CustomWithdrawalConfig {
|
|
11
11
|
customerConfig: NadoWithdrawalCustomerConfig;
|
|
12
|
+
/** Initial state of the borrow (spot leverage) toggle; the user may still flip it. */
|
|
13
|
+
defaultSpotLeverage?: boolean;
|
|
12
14
|
}
|
|
13
15
|
export declare function isNadoWithdrawalConfig(config: FunkitWithdrawalConfig | null | undefined): config is NadoWithdrawalConfig;
|
|
14
16
|
/** Packed subaccount id, or undefined when one can't be built — the caller
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
isNadoWithdrawalConfig,
|
|
4
4
|
resolveNadoSubaccount
|
|
5
|
-
} from "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
5
|
+
} from "../../chunk-EQFVPSR2.js";
|
|
6
|
+
import "../../chunk-B7UU2ETA.js";
|
|
7
7
|
import "../../chunk-6T6URLBM.js";
|
|
8
8
|
import "../../chunk-AHYOV7AV.js";
|
|
9
9
|
export {
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
} from "../../chunk-63XTVHO3.js";
|
|
10
10
|
import {
|
|
11
11
|
isNadoWithdrawalConfig
|
|
12
|
-
} from "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
12
|
+
} from "../../chunk-EQFVPSR2.js";
|
|
13
|
+
import "../../chunk-B7UU2ETA.js";
|
|
14
14
|
import {
|
|
15
15
|
x18ToRawBaseUnit,
|
|
16
16
|
x18ToTokenUnits
|
|
@@ -41,13 +41,7 @@ import { useEffect, useMemo, useState } from "react";
|
|
|
41
41
|
import { formatUnits } from "viem";
|
|
42
42
|
|
|
43
43
|
// src/hooks/useAssetPrice.ts
|
|
44
|
-
import {
|
|
45
|
-
getAssetPriceInfo
|
|
46
|
-
} from "@funkit/api-base";
|
|
47
|
-
import {
|
|
48
|
-
convertFunToRelayTokenAddress,
|
|
49
|
-
getRelayAssetPriceInfo
|
|
50
|
-
} from "@funkit/fun-relay";
|
|
44
|
+
import { getAssetPriceInfoWithFallback } from "@funkit/connect-core";
|
|
51
45
|
import { skipToken, useQuery } from "@tanstack/react-query";
|
|
52
46
|
|
|
53
47
|
// src/hooks/useIsStablecoin.ts
|
|
@@ -87,48 +81,6 @@ var useIsStablecoin = () => {
|
|
|
87
81
|
};
|
|
88
82
|
|
|
89
83
|
// src/hooks/useAssetPrice.ts
|
|
90
|
-
async function getFormattedRelayAssetPriceInfo({
|
|
91
|
-
chainId,
|
|
92
|
-
assetTokenAddress
|
|
93
|
-
}) {
|
|
94
|
-
try {
|
|
95
|
-
const relayResponse = await getRelayAssetPriceInfo({
|
|
96
|
-
chainId,
|
|
97
|
-
address: convertFunToRelayTokenAddress(
|
|
98
|
-
assetTokenAddress,
|
|
99
|
-
Number(chainId)
|
|
100
|
-
)
|
|
101
|
-
});
|
|
102
|
-
return {
|
|
103
|
-
unitPrice: relayResponse.price,
|
|
104
|
-
amount: 1,
|
|
105
|
-
total: 1
|
|
106
|
-
};
|
|
107
|
-
} catch (error) {
|
|
108
|
-
logger.error("Unable to fetch token price from Relay", error);
|
|
109
|
-
throw error;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
async function getAssetPriceInfoWithFallback({
|
|
113
|
-
apiKey,
|
|
114
|
-
chainId,
|
|
115
|
-
assetTokenAddress
|
|
116
|
-
}) {
|
|
117
|
-
try {
|
|
118
|
-
return await getAssetPriceInfo({
|
|
119
|
-
apiKey,
|
|
120
|
-
assetTokenAddress,
|
|
121
|
-
chainId,
|
|
122
|
-
logger
|
|
123
|
-
});
|
|
124
|
-
} catch (primaryError) {
|
|
125
|
-
logger.warn(
|
|
126
|
-
"Unable to fetch token price from Primary provider, trying fallback",
|
|
127
|
-
{ primaryError }
|
|
128
|
-
);
|
|
129
|
-
return await getFormattedRelayAssetPriceInfo({ chainId, assetTokenAddress });
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
84
|
function useAssetAddressPrice({
|
|
133
85
|
chainId,
|
|
134
86
|
assetTokenAddress,
|
|
@@ -144,7 +96,8 @@ function useAssetAddressPrice({
|
|
|
144
96
|
queryFn: enabled && chainId && assetTokenAddress ? () => getAssetPriceInfoWithFallback({
|
|
145
97
|
apiKey,
|
|
146
98
|
chainId,
|
|
147
|
-
assetTokenAddress
|
|
99
|
+
assetTokenAddress,
|
|
100
|
+
logger
|
|
148
101
|
}) : skipToken,
|
|
149
102
|
refetchInterval
|
|
150
103
|
});
|
|
@@ -190,11 +143,13 @@ function useNadoWithdrawalForm(config, selectedSourceToken) {
|
|
|
190
143
|
const isNado = !!nadoConfig;
|
|
191
144
|
const subaccount = nadoConfig?.customerConfig.subaccount;
|
|
192
145
|
const { t } = useFunkitTranslation();
|
|
193
|
-
const [spotLeverage, setSpotLeverage] = useState(
|
|
146
|
+
const [spotLeverage, setSpotLeverage] = useState(
|
|
147
|
+
() => nadoConfig?.defaultSpotLeverage ?? false
|
|
148
|
+
);
|
|
194
149
|
const { data: feeRates } = useNadoFeeRates(subaccount);
|
|
195
150
|
useEffect(() => {
|
|
196
|
-
setSpotLeverage(false);
|
|
197
|
-
}, [subaccount]);
|
|
151
|
+
setSpotLeverage(nadoConfig?.defaultSpotLeverage ?? false);
|
|
152
|
+
}, [subaccount, nadoConfig?.defaultSpotLeverage]);
|
|
198
153
|
const amountToggle = {
|
|
199
154
|
label: t("withdrawal.enableBorrowing"),
|
|
200
155
|
tooltip: t("withdrawal.enableBorrowingTooltip"),
|
|
@@ -106,37 +106,6 @@ export interface LighterSecureWithdrawalConfig {
|
|
|
106
106
|
*/
|
|
107
107
|
onBeforeSign?: () => Promise<void> | void;
|
|
108
108
|
}
|
|
109
|
-
/**
|
|
110
|
-
* Records a Lighter Secure withdrawal in Fun's direct-execution table as
|
|
111
|
-
* `EXTERNALLY_FULFILLED` — tracking-only, since Fun is not in the execution
|
|
112
|
-
* path. The row is keyed off the L2 tx hash and exists purely for attribution
|
|
113
|
-
* and support tooling; the backend writes a one-time terminal `listenerInfo`
|
|
114
|
-
* and never polls for L1 settlement (see EXTERNALLY_FULFILLED design doc).
|
|
115
|
-
*
|
|
116
|
-
* Fire-and-forget: callers should not await this, and any failure here must
|
|
117
|
-
* not block the withdrawal success UI. Failures log at warn/error and return.
|
|
118
|
-
*/
|
|
119
|
-
export declare function trackLighterSecureWithdrawal({ apiKey, userId, txHash, recipientAddr, assetIndex, mainnetTokenAddress, amountTokenUnits, withdrawalUSD, }: {
|
|
120
|
-
apiKey: string;
|
|
121
|
-
userId: string;
|
|
122
|
-
txHash: string;
|
|
123
|
-
recipientAddr: Address;
|
|
124
|
-
/**
|
|
125
|
-
* Lighter L2 asset index. Used as `fromTokenAddress`
|
|
126
|
-
* (`pad(toHex(assetIndex))`) and to resolve symbol + mainnet decimals from
|
|
127
|
-
* {@link LIGHTER_SECURE_ASSETS_BY_INDEX}.
|
|
128
|
-
*/
|
|
129
|
-
assetIndex: number;
|
|
130
|
-
/** Mainnet ERC-20 address the L2 asset bridges to (resolved by the modal). */
|
|
131
|
-
mainnetTokenAddress: Address;
|
|
132
|
-
/** User-input amount in token units (e.g. "1.5" for 1.5 ETH). */
|
|
133
|
-
amountTokenUnits: string;
|
|
134
|
-
/**
|
|
135
|
-
* USD value of the withdrawal as computed by the modal (token amount × live
|
|
136
|
-
* spot price). Avoids a separate spot-price round-trip from this helper.
|
|
137
|
-
*/
|
|
138
|
-
withdrawalUSD: string;
|
|
139
|
-
}): Promise<void>;
|
|
140
109
|
/** Single-method config for Lighter's Secure withdrawal (bridge to Ethereum). */
|
|
141
110
|
export declare function createLighterSecureWithdrawalConfig(config: LighterSecureWithdrawalConfig): CustomWithdrawalConfig;
|
|
142
111
|
/**
|
package/dist/clients/lighter.js
CHANGED
|
@@ -28,17 +28,11 @@ import {
|
|
|
28
28
|
} from "./chunk-AHYOV7AV.js";
|
|
29
29
|
|
|
30
30
|
// src/clients/lighter.tsx
|
|
31
|
-
import {
|
|
32
|
-
|
|
33
|
-
LIGHTERXYZ_API_KEY,
|
|
34
|
-
createDirectExecution as createDirectExecution2
|
|
35
|
-
} from "@funkit/api-base";
|
|
36
|
-
import { LIGHTER_CHAIN_ID, SOLANA_MAINNET_CHAIN_ID } from "@funkit/chains";
|
|
31
|
+
import { LIGHTERXYZ_API_KEY } from "@funkit/api-base";
|
|
32
|
+
import { SOLANA_MAINNET_CHAIN_ID } from "@funkit/chains";
|
|
37
33
|
import { RELAY_LIGHTER_CHAIN_ID as RELAY_LIGHTER_CHAIN_ID2 } from "@funkit/fun-relay";
|
|
38
34
|
import i18next from "i18next";
|
|
39
35
|
import React4, { useMemo as useMemo2 } from "react";
|
|
40
|
-
import { v4 as uuid2 } from "uuid";
|
|
41
|
-
import { pad as pad2, parseUnits as parseUnits2, toHex } from "viem";
|
|
42
36
|
import { arbitrum, base, bsc, mainnet as mainnet2, optimism } from "viem/chains";
|
|
43
37
|
|
|
44
38
|
// src/components/ChainIcon/ChainIcon.tsx
|
|
@@ -158,12 +152,10 @@ var EvmWallet = ({ size = 20 }) => /* @__PURE__ */ React2.createElement(
|
|
|
158
152
|
import {
|
|
159
153
|
LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS as LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS2,
|
|
160
154
|
LIGHTER_FAST_MAX_WITHDRAWAL_USD as LIGHTER_FAST_MAX_WITHDRAWAL_USD2,
|
|
161
|
-
LIGHTER_SECURE_ASSETS_BY_INDEX as LIGHTER_SECURE_ASSETS_BY_INDEX2,
|
|
162
155
|
LIGHTER_USDC_SPOT_SYMBOL as LIGHTER_USDC_SPOT_SYMBOL2,
|
|
163
|
-
getLighterBaseSymbol as getLighterBaseSymbol3
|
|
164
|
-
} from "@funkit/connect-core/clients/lighter";
|
|
165
|
-
import {
|
|
156
|
+
getLighterBaseSymbol as getLighterBaseSymbol3,
|
|
166
157
|
createLighterAdaptedWallet,
|
|
158
|
+
trackLighterSecureWithdrawal,
|
|
167
159
|
useLighterWithdrawalDelaySeconds
|
|
168
160
|
} from "@funkit/connect-core/clients/lighter";
|
|
169
161
|
|
|
@@ -249,7 +241,6 @@ var LIGHTER_FAST_METHOD_ID = "lighter-fast";
|
|
|
249
241
|
var LIGHTER_SECURE_METHOD_ID = "lighter-secure";
|
|
250
242
|
|
|
251
243
|
// src/clients/lighter.tsx
|
|
252
|
-
import { truncateToDecimals as truncateToDecimals2 } from "@funkit/connect-core/clients/lighter";
|
|
253
244
|
import { LIGHTER_ROUTE_TYPE as LIGHTER_ROUTE_TYPE3 } from "@funkit/connect-core/clients/lighter";
|
|
254
245
|
import {
|
|
255
246
|
LIGHTER_WITHDRAW_ABI,
|
|
@@ -274,78 +265,6 @@ function useLighterSecureDelayText() {
|
|
|
274
265
|
true
|
|
275
266
|
);
|
|
276
267
|
}
|
|
277
|
-
async function trackLighterSecureWithdrawal({
|
|
278
|
-
apiKey,
|
|
279
|
-
userId,
|
|
280
|
-
txHash,
|
|
281
|
-
recipientAddr,
|
|
282
|
-
assetIndex,
|
|
283
|
-
mainnetTokenAddress,
|
|
284
|
-
amountTokenUnits,
|
|
285
|
-
withdrawalUSD
|
|
286
|
-
}) {
|
|
287
|
-
const assetMeta = LIGHTER_SECURE_ASSETS_BY_INDEX2[assetIndex];
|
|
288
|
-
if (!assetMeta) {
|
|
289
|
-
logger.error(
|
|
290
|
-
"lighter:withdrawal:secure:tracking:unknownAssetIndex",
|
|
291
|
-
new Error(`Unknown Lighter Secure asset index: ${assetIndex}`),
|
|
292
|
-
{ assetIndex, txHash }
|
|
293
|
-
);
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
const { symbol, decimals } = assetMeta;
|
|
297
|
-
const estTotalUsd = Number(withdrawalUSD);
|
|
298
|
-
const safeAmount = truncateToDecimals2(amountTokenUnits, decimals);
|
|
299
|
-
const baseUnitAmount = parseUnits2(safeAmount, decimals).toString();
|
|
300
|
-
const fromTokenAddress = pad2(toHex(assetIndex), { size: 20 });
|
|
301
|
-
await createDirectExecution2({
|
|
302
|
-
apiKey,
|
|
303
|
-
logger,
|
|
304
|
-
// Lighter L2 tx hashes are not 0x-prefixed EVM hashes — they're the L2's
|
|
305
|
-
// own format. We cast here for convenience to satisfy the DE row type;
|
|
306
|
-
// the backend stores the literal string and we never use it as an EVM hash.
|
|
307
|
-
txHash,
|
|
308
|
-
type: DirectExecutionType2.EXTERNALLY_FULFILLED,
|
|
309
|
-
userId,
|
|
310
|
-
recipientAddr,
|
|
311
|
-
fromChainId: LIGHTER_CHAIN_ID.toString(),
|
|
312
|
-
fromTokenAddress,
|
|
313
|
-
toChainId: mainnet2.id.toString(),
|
|
314
|
-
toTokenAddress: mainnetTokenAddress,
|
|
315
|
-
fromAmountBaseUnit: baseUnitAmount,
|
|
316
|
-
toAmountBaseUnit: baseUnitAmount,
|
|
317
|
-
estTotalUsd,
|
|
318
|
-
// Secure withdrawals come out of the user's Lighter account balance; the
|
|
319
|
-
// L1 owner of that account is the recipient (Secure locks to connected wallet).
|
|
320
|
-
sourceOfFund: `balance|lighter-secure|${recipientAddr}`,
|
|
321
|
-
clientMetadata: {
|
|
322
|
-
id: uuid2(),
|
|
323
|
-
startTimestampMs: Date.now(),
|
|
324
|
-
finalDollarValue: estTotalUsd,
|
|
325
|
-
latestQuote: null,
|
|
326
|
-
depositAddress: null,
|
|
327
|
-
initSettings: {
|
|
328
|
-
config: {
|
|
329
|
-
targetAsset: mainnetTokenAddress,
|
|
330
|
-
targetChain: mainnet2.id.toString(),
|
|
331
|
-
targetAssetTicker: symbol
|
|
332
|
-
}
|
|
333
|
-
},
|
|
334
|
-
selectedSourceAssetInfo: {
|
|
335
|
-
address: fromTokenAddress,
|
|
336
|
-
symbol,
|
|
337
|
-
chainId: LIGHTER_CHAIN_ID.toString(),
|
|
338
|
-
iconSrc: null
|
|
339
|
-
},
|
|
340
|
-
selectedPaymentMethodInfo: {
|
|
341
|
-
paymentMethod: "LIGHTER_SECURE_WITHDRAWAL",
|
|
342
|
-
title: "",
|
|
343
|
-
description: ""
|
|
344
|
-
},
|
|
345
|
-
isWithdrawal: true
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
268
|
function buildSecureWithdrawalCallback({
|
|
350
269
|
exec
|
|
351
270
|
}) {
|
|
@@ -391,6 +310,7 @@ function buildSecureWithdrawalCallback({
|
|
|
391
310
|
});
|
|
392
311
|
void trackLighterSecureWithdrawal({
|
|
393
312
|
apiKey: LIGHTERXYZ_API_KEY,
|
|
313
|
+
logger,
|
|
394
314
|
// Secure locks the destination to the connected wallet, so the L1
|
|
395
315
|
// recipient address doubles as the userId for tracking purposes.
|
|
396
316
|
userId: destinationAddress,
|
|
@@ -400,13 +320,6 @@ function buildSecureWithdrawalCallback({
|
|
|
400
320
|
mainnetTokenAddress: targetAssetAddress,
|
|
401
321
|
amountTokenUnits,
|
|
402
322
|
withdrawalUSD
|
|
403
|
-
}).catch((err) => {
|
|
404
|
-
logger.warn("lighter:withdrawal:secure:trackingFailed", {
|
|
405
|
-
error: err instanceof Error ? err.message : String(err),
|
|
406
|
-
txHash,
|
|
407
|
-
assetIndex,
|
|
408
|
-
amountTokenUnits
|
|
409
|
-
});
|
|
410
323
|
});
|
|
411
324
|
return txHash;
|
|
412
325
|
};
|
|
@@ -627,6 +540,5 @@ export {
|
|
|
627
540
|
createLighterSecureWithdrawalConfig,
|
|
628
541
|
isLighterWithdrawalRateLimitError2 as isLighterWithdrawalRateLimitError,
|
|
629
542
|
lighterWithdrawBaseUnits2 as lighterWithdrawBaseUnits,
|
|
630
|
-
trackLighterSecureWithdrawal,
|
|
631
543
|
useLighterWithdrawalConfig
|
|
632
544
|
};
|
package/dist/clients/nado.d.ts
CHANGED
|
@@ -52,6 +52,8 @@ export interface NadoWithdrawalOptions {
|
|
|
52
52
|
* sequencer fee, which Nado charges per asset, not per dollar.
|
|
53
53
|
*/
|
|
54
54
|
getMinWithdrawalAmount?: (symbol: string) => number;
|
|
55
|
+
/** Initial state of the borrow (spot leverage) toggle */
|
|
56
|
+
defaultSpotLeverage?: boolean;
|
|
55
57
|
}
|
|
56
58
|
/**
|
|
57
59
|
* Withdrawal config for a Nado subaccount, or `null` while one can't be built —
|
package/dist/clients/nado.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createNadoWithdrawalCallback
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3Y5EIONT.js";
|
|
5
5
|
import "./chunk-2576N7PQ.js";
|
|
6
6
|
import "./chunk-VIAEAD75.js";
|
|
7
7
|
import "./chunk-63XTVHO3.js";
|
|
8
8
|
import {
|
|
9
9
|
resolveNadoSubaccount
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-EQFVPSR2.js";
|
|
11
|
+
import "./chunk-B7UU2ETA.js";
|
|
12
12
|
import "./chunk-6T6URLBM.js";
|
|
13
13
|
import "./chunk-TZGKB6WY.js";
|
|
14
14
|
import {
|
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
import "./chunk-WZRW6WUM.js";
|
|
18
18
|
import "./chunk-Z7HTQFEO.js";
|
|
19
19
|
import "./chunk-OODIKHYE.js";
|
|
20
|
-
import "./chunk-PENJ5JGH.js";
|
|
21
20
|
import {
|
|
22
21
|
useAccount,
|
|
23
22
|
useConfig
|
|
@@ -25,6 +24,7 @@ import {
|
|
|
25
24
|
import {
|
|
26
25
|
i18n_default
|
|
27
26
|
} from "./chunk-C45VNQXY.js";
|
|
27
|
+
import "./chunk-PENJ5JGH.js";
|
|
28
28
|
import "./chunk-AHYOV7AV.js";
|
|
29
29
|
|
|
30
30
|
// src/clients/nado.tsx
|
|
@@ -65,7 +65,8 @@ function useNadoWithdrawalConfig(options) {
|
|
|
65
65
|
getMaxWithdrawalUSD: options.getMaxWithdrawalUSD,
|
|
66
66
|
getMinWithdrawalAmount: options.getMinWithdrawalAmount,
|
|
67
67
|
withdrawCallback,
|
|
68
|
-
customerConfig: { customerName: "nado", walletAddress, subaccount }
|
|
68
|
+
customerConfig: { customerName: "nado", walletAddress, subaccount },
|
|
69
|
+
defaultSpotLeverage: options.defaultSpotLeverage
|
|
69
70
|
};
|
|
70
71
|
}
|
|
71
72
|
export {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
PolymarketDepositAccountDropdown
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-XJTRLB7W.js";
|
|
5
5
|
import "../chunk-BPDLF2R6.js";
|
|
6
|
-
import "../chunk-Y7WLUPTX.js";
|
|
7
|
-
import "../chunk-IYCZWLAF.js";
|
|
8
6
|
import "../chunk-5MY7WMEJ.js";
|
|
9
7
|
import "../chunk-FNB7OPJI.js";
|
|
10
8
|
import "../chunk-6EU6CXNH.js";
|
|
11
9
|
import "../chunk-UK64SY6N.js";
|
|
12
10
|
import "../chunk-LUHEVXPD.js";
|
|
13
11
|
import "../chunk-YUZ3B2Q3.js";
|
|
14
|
-
import "../chunk-PENJ5JGH.js";
|
|
15
12
|
import "../chunk-UPZNKPYU.js";
|
|
16
13
|
import "../chunk-C45VNQXY.js";
|
|
14
|
+
import "../chunk-Y7WLUPTX.js";
|
|
15
|
+
import "../chunk-IYCZWLAF.js";
|
|
16
|
+
import "../chunk-PENJ5JGH.js";
|
|
17
17
|
import "../chunk-AHYOV7AV.js";
|
|
18
18
|
export {
|
|
19
19
|
PolymarketDepositAccountDropdown
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
PolymarketDepositAccountDropdown
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-XJTRLB7W.js";
|
|
5
5
|
import "../chunk-BPDLF2R6.js";
|
|
6
|
+
import "../chunk-5MY7WMEJ.js";
|
|
7
|
+
import "../chunk-FNB7OPJI.js";
|
|
8
|
+
import "../chunk-6EU6CXNH.js";
|
|
9
|
+
import "../chunk-UK64SY6N.js";
|
|
10
|
+
import "../chunk-LUHEVXPD.js";
|
|
11
|
+
import "../chunk-YUZ3B2Q3.js";
|
|
12
|
+
import "../chunk-UPZNKPYU.js";
|
|
13
|
+
import "../chunk-C45VNQXY.js";
|
|
6
14
|
import {
|
|
7
15
|
POLYMARKET_PERPS_ROUTING_ID,
|
|
8
16
|
POLYMARKET_PREDICTIONS_ROUTING_ID,
|
|
@@ -20,15 +28,7 @@ import {
|
|
|
20
28
|
createPerpsGenerateActionParams,
|
|
21
29
|
createPolymarketWithdrawalConfig
|
|
22
30
|
} from "../chunk-IYCZWLAF.js";
|
|
23
|
-
import "../chunk-5MY7WMEJ.js";
|
|
24
|
-
import "../chunk-FNB7OPJI.js";
|
|
25
|
-
import "../chunk-6EU6CXNH.js";
|
|
26
|
-
import "../chunk-UK64SY6N.js";
|
|
27
|
-
import "../chunk-LUHEVXPD.js";
|
|
28
|
-
import "../chunk-YUZ3B2Q3.js";
|
|
29
31
|
import "../chunk-PENJ5JGH.js";
|
|
30
|
-
import "../chunk-UPZNKPYU.js";
|
|
31
|
-
import "../chunk-C45VNQXY.js";
|
|
32
32
|
import "../chunk-AHYOV7AV.js";
|
|
33
33
|
export {
|
|
34
34
|
AMOUNT_PLACEHOLDER,
|
|
@@ -2,7 +2,12 @@ import type { FunAddress } from '@funkit/api-base';
|
|
|
2
2
|
import { CheckoutRefundState, CheckoutState } from '@funkit/api-base';
|
|
3
3
|
import type { GeneralWalletContextProps } from '../providers/GeneralWalletProvider';
|
|
4
4
|
/** Web's entry to the shared screen: resolves the kill switch and logger. */
|
|
5
|
-
export declare const hasRisk: (apiKey: string, walletAddress: GeneralWalletContextProps["walletAddress"], customRecipient?: FunAddress
|
|
5
|
+
export declare const hasRisk: (apiKey: string, walletAddress: GeneralWalletContextProps["walletAddress"], customRecipient?: FunAddress,
|
|
6
|
+
/** Internal decimal chain ids: the wallet pays on the source chain, the recipient receives on the target chain. */
|
|
7
|
+
chainIds?: {
|
|
8
|
+
sourceChainId?: string;
|
|
9
|
+
targetChainId?: string;
|
|
10
|
+
}) => Promise<boolean>;
|
|
6
11
|
export type CheckoutStatus = 'failed' | 'expired' | 'processing' | 'completed';
|
|
7
12
|
type CheckoutStateBooleans = {
|
|
8
13
|
isProcessing: boolean;
|
|
@@ -157,6 +157,7 @@ export type DepositQuoteConfirmedProperties = DepositQuoteContextProperties;
|
|
|
157
157
|
* quote, source asset, or broadcast hash.
|
|
158
158
|
*/
|
|
159
159
|
export type ExecutionTransactionSnapshotProperties = DepositAssetContextProperties & VisibleQuoteFeeProperties & {
|
|
160
|
+
checkout_id: string;
|
|
160
161
|
destination_address: string | null;
|
|
161
162
|
execution_type: DirectExecutionType | null;
|
|
162
163
|
sender_address: string | null;
|
|
@@ -164,6 +165,7 @@ export type ExecutionTransactionSnapshotProperties = DepositAssetContextProperti
|
|
|
164
165
|
target_amount: string | null;
|
|
165
166
|
trade_type: QuoteMode | null;
|
|
166
167
|
tx_hash: string | null;
|
|
168
|
+
user_id?: string;
|
|
167
169
|
};
|
|
168
170
|
export type TransactionSubmittedProperties = ExecutionTransactionSnapshotProperties & {
|
|
169
171
|
est_fulfillment_time_ms: number | null;
|
|
@@ -190,6 +192,7 @@ export type ModalOpenedProperties = {
|
|
|
190
192
|
custom_recipient: string | null;
|
|
191
193
|
dynamic_routing_id: string | null;
|
|
192
194
|
exchange_count: number;
|
|
195
|
+
flow: AnalyticsFlow;
|
|
193
196
|
primary_exchange: string | null;
|
|
194
197
|
primary_wallet: string | null;
|
|
195
198
|
source_asset: string | null;
|
|
@@ -203,6 +206,7 @@ export type ModalOpenedProperties = {
|
|
|
203
206
|
};
|
|
204
207
|
/** Payload specific to {@link AnalyticsEvent.TAB_SWITCHED}. */
|
|
205
208
|
export type TabSwitchedProperties = {
|
|
209
|
+
flow: AnalyticsFlow;
|
|
206
210
|
from_tab: PaymentMethodType;
|
|
207
211
|
/** 1-based switch ordinal for the current SourceChange visit. */
|
|
208
212
|
switch_count: number;
|
|
@@ -245,9 +249,4 @@ export type AnalyticsEventProperties = {
|
|
|
245
249
|
[AnalyticsEvent.WITHDRAWAL_SUCCEEDED]: ExecutionSucceededProperties;
|
|
246
250
|
[AnalyticsEvent.WITHDRAWAL_TRANSACTION_SUBMITTED]: TransactionSubmittedProperties;
|
|
247
251
|
};
|
|
248
|
-
type
|
|
249
|
-
type AnalyticsEventShape<T extends AnalyticsEvent> = CommonProperties & AnalyticsEventProperties[T];
|
|
250
|
-
export type AnalyticsEventPayload<T extends AnalyticsEvent> = {
|
|
251
|
-
[K in keyof AnalyticsEventShape<T>]: AnalyticsEventShape<T>[K] extends AnalyticsPropertyValue ? AnalyticsEventShape<T>[K] : never;
|
|
252
|
-
};
|
|
253
|
-
export {};
|
|
252
|
+
export type AnalyticsEventPayload<T extends AnalyticsEvent> = CommonProperties & AnalyticsEventProperties[T];
|
|
@@ -1,44 +1,13 @@
|
|
|
1
1
|
import type { NotificationItem } from '../../../modals/CheckoutModal/TransferToken/types';
|
|
2
2
|
import { type ExecutionTransactionSubmittedArgs } from './resolveExecutionProgressContext';
|
|
3
|
-
import { type AnalyticsFlow } from './events';
|
|
3
|
+
import { type AnalyticsFlow, type ExecutionTransactionSnapshotProperties } from './events';
|
|
4
4
|
export type TrackExecutionSucceededArgs = ExecutionTransactionSubmittedArgs & {
|
|
5
5
|
fulfillmentTimeMs: number | null;
|
|
6
6
|
};
|
|
7
7
|
export type TrackExecutionFailedArgs = ExecutionTransactionSubmittedArgs & {
|
|
8
8
|
errorCode: string | null;
|
|
9
9
|
};
|
|
10
|
-
export declare function buildExecutionTransactionSnapshotProperties(args: ExecutionTransactionSubmittedArgs,
|
|
11
|
-
app_fee_pct: number | null;
|
|
12
|
-
destination_chain_gas_usd: number | null;
|
|
13
|
-
card_processing_fee_usd: number | null;
|
|
14
|
-
exchange_processing_fee_usd: number | null;
|
|
15
|
-
liquidity_provider_cost_usd: number | null;
|
|
16
|
-
market_maker_gas_cost_usd: number | null;
|
|
17
|
-
max_slippage_pct: number | null;
|
|
18
|
-
moonpay_cost_usd: number | null;
|
|
19
|
-
network_cost_usd: number | null;
|
|
20
|
-
price_impact_pct: number | null;
|
|
21
|
-
source_chain_gas_usd: number | null;
|
|
22
|
-
swap_impact_pct: number | null;
|
|
23
|
-
wallet_gas_cost_usd: number | null;
|
|
24
|
-
checkout_id: string;
|
|
25
|
-
destination_address: string | null;
|
|
26
|
-
execution_type: import("@funkit/api-base").DirectExecutionType | null;
|
|
27
|
-
sender_address: string | null;
|
|
28
|
-
source_amount: string | null;
|
|
29
|
-
source_chain: string | null;
|
|
30
|
-
source_asset: string | null;
|
|
31
|
-
source_asset_ticker: string | null;
|
|
32
|
-
target_amount: string | null;
|
|
33
|
-
target_chain: string;
|
|
34
|
-
target_asset: string;
|
|
35
|
-
target_asset_ticker: string | null;
|
|
36
|
-
trade_type: import("../../../domains/quoteMode").QuoteMode | null;
|
|
37
|
-
tx_hash: string | null;
|
|
38
|
-
user_id: string | null;
|
|
39
|
-
payment_method: string;
|
|
40
|
-
provider: string | null;
|
|
41
|
-
};
|
|
10
|
+
export declare function buildExecutionTransactionSnapshotProperties(args: ExecutionTransactionSubmittedArgs, connectorId: string | undefined): ExecutionTransactionSnapshotProperties;
|
|
42
11
|
/** Builds and emits execution lifecycle events without owning any polling. */
|
|
43
12
|
export declare function useTrackExecutionProgressEvents(flow: AnalyticsFlow): {
|
|
44
13
|
trackExecutionFailed: (args: TrackExecutionFailedArgs, claimKey: string) => void;
|