@funkit/connect 10.0.0 → 10.1.0-next.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 +7 -0
- package/dist/clients/chunk-42XZD2Y3.js +1112 -0
- package/dist/clients/chunk-5UIZBNLC.js +1175 -0
- package/dist/clients/chunk-BO7AZVPG.js +1112 -0
- package/dist/clients/chunk-BUCJRBW7.js +1472 -0
- package/dist/clients/{chunk-2NBYHUIW.js → chunk-ETB2YYFT.js} +1 -1
- package/dist/clients/{chunk-ZAXSDMDU.js → chunk-HD4Y4NKC.js} +2 -2
- package/dist/clients/{chunk-E3USJY7A.js → chunk-JNZY3GAA.js} +1 -1
- package/dist/clients/chunk-ME4OAQIY.js +696 -0
- package/dist/clients/chunk-PEVDOGEA.js +109 -0
- package/dist/clients/chunk-QIWGVVAW.js +1113 -0
- package/dist/clients/chunk-VJZW3MA3.js +94 -0
- package/dist/clients/chunk-WEETVC7U.js +1113 -0
- package/dist/clients/chunk-Y2KXVS36.js +230 -0
- package/dist/clients/fanatics.css +1 -1
- package/dist/clients/fanatics.js +2 -2
- package/dist/clients/lighter.css +11 -11
- package/dist/clients/lighter.d.ts +12 -2
- package/dist/clients/lighter.js +21 -9
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +11 -11
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +3 -3
- package/dist/clients/polymarket/index.css +11 -11
- package/dist/clients/polymarket/index.js +3 -3
- package/dist/clients/polymarket/usePolymarketAccountBalances.d.ts +66 -0
- package/dist/hooks/useIsTokenWhitelisted.d.ts +30 -0
- package/dist/index.css +11 -11
- package/dist/index.d.ts +1 -1
- package/dist/index.js +78 -31
- package/dist/modals/CheckoutModal/buildRelayChains.d.ts +12 -0
- package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +32 -5
- package/dist/modals/WithdrawalModal/useWithdrawal.d.ts +3 -3
- package/dist/providers/FunkitCheckoutContext/types.d.ts +20 -2
- package/dist/providers/FunkitFlagsProvider.d.ts +26 -0
- package/dist/utils/flags/config.d.ts +333 -0
- package/dist/utils/flags/endpoint.d.ts +22 -0
- package/dist/utils/flags/hash.d.ts +13 -0
- package/dist/utils/flags/impl.d.ts +10 -0
- package/dist/utils/flags/types.d.ts +49 -0
- 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/chunk-4NV5BYRP.js +95 -0
- package/dist/wallets/walletConnectors/chunk-AVDUNQUW.js +96 -0
- package/dist/wallets/walletConnectors/chunk-GUQM4QSL.js +66 -0
- package/dist/wallets/walletConnectors/chunk-IULPZP2Q.js +69 -0
- package/dist/wallets/walletConnectors/chunk-JPN6TWIT.js +92 -0
- package/dist/wallets/walletConnectors/chunk-KCRO2AGO.js +106 -0
- package/dist/wallets/walletConnectors/chunk-KI5Y2BBF.js +94 -0
- package/dist/wallets/walletConnectors/chunk-NR2OGDHQ.js +103 -0
- package/dist/wallets/walletConnectors/chunk-OEEGYENV.js +87 -0
- package/dist/wallets/walletConnectors/chunk-OX37G4YT.js +98 -0
- package/dist/wallets/walletConnectors/chunk-SWFF3TWJ.js +100 -0
- package/dist/wallets/walletConnectors/chunk-TKB2OY6G.js +99 -0
- package/dist/wallets/walletConnectors/chunk-W2LCLDPX.js +70 -0
- package/dist/wallets/walletConnectors/chunk-WAHGI5L7.js +96 -0
- package/dist/wallets/walletConnectors/chunk-WKNQMP4A.js +93 -0
- package/dist/wallets/walletConnectors/chunk-XCNHV3HS.js +110 -0
- package/dist/wallets/walletConnectors/chunk-YO2K4MBH.js +218 -0
- package/dist/wallets/walletConnectors/chunk-YQFGVZGR.js +92 -0
- 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 +61 -61
- 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 +1 -1
- /package/dist/clients/{chunk-LUHEVXPD.js → chunk-HMP3LHMW.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -1687,7 +1687,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
1687
1687
|
localStorage.setItem(storageKey, version);
|
|
1688
1688
|
}
|
|
1689
1689
|
function getCurrentSdkVersion() {
|
|
1690
|
-
return "10.0.0";
|
|
1690
|
+
return "10.1.0-next.0";
|
|
1691
1691
|
}
|
|
1692
1692
|
function useFingerprint() {
|
|
1693
1693
|
const fingerprint = useCallback3(() => {
|
|
@@ -19096,6 +19096,17 @@ var getTokenIconUrl = (symbol, tokens) => {
|
|
|
19096
19096
|
|
|
19097
19097
|
// src/modals/WithdrawalModal/LighterWithdrawal.tsx
|
|
19098
19098
|
var LIGHTER_SECURE_METHOD_ID = "lighter-secure";
|
|
19099
|
+
var LIGHTER_USDC_SPOT_SYMBOL = "USDC (Spot)";
|
|
19100
|
+
var LIGHTER_ROUTE_TYPE = {
|
|
19101
|
+
PERPS: 0,
|
|
19102
|
+
SPOT: 1
|
|
19103
|
+
};
|
|
19104
|
+
function getLighterBaseSymbol(symbol) {
|
|
19105
|
+
return symbol.replace(/\s*\((?:spot|perps)\)\s*$/i, "");
|
|
19106
|
+
}
|
|
19107
|
+
function resolveLighterSecureRouteType(selectedSourceToken) {
|
|
19108
|
+
return selectedSourceToken.toUpperCase() === "USDC" ? LIGHTER_ROUTE_TYPE.PERPS : LIGHTER_ROUTE_TYPE.SPOT;
|
|
19109
|
+
}
|
|
19099
19110
|
var LIGHTER_SECURE_MAINNET_ADDRESS = {
|
|
19100
19111
|
ETH: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
|
19101
19112
|
LIT: "0x232CE3bd40fCd6f80f3d55A522d03f25Df784Ee2",
|
|
@@ -19108,7 +19119,7 @@ var LIGHTER_SECURE_MAINNET_ADDRESS = {
|
|
|
19108
19119
|
AZTEC: "0xA27EC0006e59f245217Ff08CD52A7E8b169E62D2"
|
|
19109
19120
|
};
|
|
19110
19121
|
function getLighterSecureMainnetAddress(symbol) {
|
|
19111
|
-
return LIGHTER_SECURE_MAINNET_ADDRESS[symbol.toUpperCase()];
|
|
19122
|
+
return LIGHTER_SECURE_MAINNET_ADDRESS[getLighterBaseSymbol(symbol).toUpperCase()];
|
|
19112
19123
|
}
|
|
19113
19124
|
var LIGHTER_FAST_MAX_WITHDRAWAL_LABEL = "$3M";
|
|
19114
19125
|
function LighterFastMaxExceededMessage({
|
|
@@ -19191,10 +19202,8 @@ function useLighterWithdrawalBalances({
|
|
|
19191
19202
|
const result = {};
|
|
19192
19203
|
for (const asset of account.assets) {
|
|
19193
19204
|
const symbol = asset.symbol.toUpperCase();
|
|
19194
|
-
|
|
19195
|
-
|
|
19196
|
-
}
|
|
19197
|
-
result[symbol] = freeBalance(asset.balance, asset.locked_balance);
|
|
19205
|
+
const key = symbol === "USDC" ? LIGHTER_USDC_SPOT_SYMBOL.toUpperCase() : symbol;
|
|
19206
|
+
result[key] = freeBalance(asset.balance, asset.locked_balance);
|
|
19198
19207
|
}
|
|
19199
19208
|
result.USDC = account.total_asset_value;
|
|
19200
19209
|
logger.info("lighter:withdrawal:balances:resolved", {
|
|
@@ -19214,7 +19223,7 @@ function useLighterWithdrawalBalances({
|
|
|
19214
19223
|
}
|
|
19215
19224
|
var LIGHTER_USDC_ASSET_INDEX = 3;
|
|
19216
19225
|
function resolveLighterAssetIndex(lighterAssets, selectedSourceToken) {
|
|
19217
|
-
const selectedSymbol = selectedSourceToken.toUpperCase();
|
|
19226
|
+
const selectedSymbol = getLighterBaseSymbol(selectedSourceToken).toUpperCase();
|
|
19218
19227
|
const lookupAssetId = lighterAssets.find(
|
|
19219
19228
|
(asset) => asset.symbol.toUpperCase() === selectedSymbol
|
|
19220
19229
|
)?.asset_id;
|
|
@@ -19231,17 +19240,26 @@ function buildLighterSourceTokenOptions(config, lighterAssets) {
|
|
|
19231
19240
|
}
|
|
19232
19241
|
];
|
|
19233
19242
|
}
|
|
19234
|
-
const
|
|
19243
|
+
const usdcPerpsOption = {
|
|
19235
19244
|
symbol: "USDC",
|
|
19236
|
-
label: "USDC",
|
|
19245
|
+
label: "USDC (Perps)",
|
|
19237
19246
|
iconSrc: getTokenIconUrl("USDC")
|
|
19238
19247
|
};
|
|
19239
|
-
const
|
|
19240
|
-
|
|
19241
|
-
|
|
19242
|
-
|
|
19243
|
-
|
|
19244
|
-
|
|
19248
|
+
const spotOptions = lighterAssets.map((asset) => {
|
|
19249
|
+
if (asset.symbol.toUpperCase() === "USDC") {
|
|
19250
|
+
return {
|
|
19251
|
+
symbol: LIGHTER_USDC_SPOT_SYMBOL,
|
|
19252
|
+
label: LIGHTER_USDC_SPOT_SYMBOL,
|
|
19253
|
+
iconSrc: getTokenIconUrl("USDC")
|
|
19254
|
+
};
|
|
19255
|
+
}
|
|
19256
|
+
return {
|
|
19257
|
+
symbol: asset.symbol,
|
|
19258
|
+
label: asset.symbol,
|
|
19259
|
+
iconSrc: getTokenIconUrl(asset.symbol)
|
|
19260
|
+
};
|
|
19261
|
+
});
|
|
19262
|
+
return [usdcPerpsOption, ...spotOptions];
|
|
19245
19263
|
}
|
|
19246
19264
|
function useLighterWithdrawal(config, setRecipientAddress) {
|
|
19247
19265
|
const { apiKey } = useFunkitConfig();
|
|
@@ -19353,9 +19371,10 @@ function LighterSecureAddressDisplay({ address }) {
|
|
|
19353
19371
|
));
|
|
19354
19372
|
}
|
|
19355
19373
|
function LighterSecureReceiveDisplay({
|
|
19356
|
-
sourceTokenSymbol
|
|
19374
|
+
sourceTokenSymbol: rawSourceTokenSymbol
|
|
19357
19375
|
}) {
|
|
19358
19376
|
const { t } = useFunkitTranslation();
|
|
19377
|
+
const sourceTokenSymbol = getLighterBaseSymbol(rawSourceTokenSymbol);
|
|
19359
19378
|
return /* @__PURE__ */ React83.createElement(Box, { width: "full", display: "flex", gap: "12" }, /* @__PURE__ */ React83.createElement(Box, { width: "full", display: "flex", flexDirection: "column", gap: "4" }, /* @__PURE__ */ React83.createElement(Text, { size: "inputLabel", weight: "inputLabel", color: "inputLabel" }, t("withdrawal.receiveToken")), /* @__PURE__ */ React83.createElement(
|
|
19360
19379
|
LighterSecureLockedField,
|
|
19361
19380
|
{
|
|
@@ -19394,8 +19413,9 @@ function LighterSecureReceiveDisplay({
|
|
|
19394
19413
|
}
|
|
19395
19414
|
function LighterSecureReceiveAmountValue({
|
|
19396
19415
|
amount,
|
|
19397
|
-
tokenSymbol
|
|
19416
|
+
tokenSymbol: rawTokenSymbol
|
|
19398
19417
|
}) {
|
|
19418
|
+
const tokenSymbol = getLighterBaseSymbol(rawTokenSymbol);
|
|
19399
19419
|
return /* @__PURE__ */ React83.createElement(
|
|
19400
19420
|
Text,
|
|
19401
19421
|
{
|
|
@@ -19415,10 +19435,11 @@ function LighterSecureWithdrawalSuccess({
|
|
|
19415
19435
|
onClose,
|
|
19416
19436
|
onNewWithdrawal,
|
|
19417
19437
|
amount,
|
|
19418
|
-
tokenSymbol,
|
|
19438
|
+
tokenSymbol: rawTokenSymbol,
|
|
19419
19439
|
txHash
|
|
19420
19440
|
}) {
|
|
19421
19441
|
const { t } = useFunkitTranslation();
|
|
19442
|
+
const tokenSymbol = getLighterBaseSymbol(rawTokenSymbol);
|
|
19422
19443
|
const bottomSectionRef = useBottomSectionRef("withdrawal");
|
|
19423
19444
|
const isSyntheticHash = txHash === "0x0000000000000000000000000000000000000001";
|
|
19424
19445
|
const hasRealTxHash = !!txHash && !isSyntheticHash;
|
|
@@ -25067,7 +25088,12 @@ function WithdrawAmountInput({
|
|
|
25067
25088
|
const isLighter = isLighterxyzCustomer(apiKey);
|
|
25068
25089
|
const isLighterFast = isLighter && config.sourceChainId === RELAY_LIGHTER_CHAIN_ID3;
|
|
25069
25090
|
const activeSymbol = selectedSourceToken ?? config.sourceTokenSymbol;
|
|
25070
|
-
const
|
|
25091
|
+
const selectedOption = sourceTokenOptions?.find(
|
|
25092
|
+
(opt) => opt.symbol === activeSymbol
|
|
25093
|
+
);
|
|
25094
|
+
const chipLabel = selectedOption?.label ?? (isLighterFast ? "USDC (Perps)" : activeSymbol);
|
|
25095
|
+
const chipIconSrc = selectedOption?.iconSrc ?? getTokenIconUrl(getLighterBaseSymbol(activeSymbol));
|
|
25096
|
+
const displaySymbol = getLighterBaseSymbol(activeSymbol);
|
|
25071
25097
|
const chipTooltip = isLighterFast ? t("withdrawal.lighterFastTokenTooltip") : void 0;
|
|
25072
25098
|
const [amountInputTouched, setAmountInputTouched] = useState38(false);
|
|
25073
25099
|
const handleAmountChange = (e) => {
|
|
@@ -25082,15 +25108,16 @@ function WithdrawAmountInput({
|
|
|
25082
25108
|
};
|
|
25083
25109
|
const isSolelyOverCap = isWithdrawAmountTooHigh && !isWithdrawAmountAboveBalance;
|
|
25084
25110
|
const showAmountError = amountInputTouched && withdrawalInputAmount !== "" && !isWithdrawAmountValid && !isSolelyOverCap;
|
|
25085
|
-
const minAmountDisplay = isLighter ? `${minWithdrawalDisplayValue} ${
|
|
25111
|
+
const minAmountDisplay = isLighter ? `${minWithdrawalDisplayValue} ${displaySymbol}` : formatCurrencyAndStringify5(minWithdrawalDisplayValue);
|
|
25086
25112
|
const errorText = showAmountError ? isWithdrawAmountTooLow ? t("withdrawal.minimumWithdrawAmount", { amount: minAmountDisplay }) : t("withdrawal.insufficientBalance") : void 0;
|
|
25087
25113
|
return /* @__PURE__ */ React131.createElement(Box, { display: "flex", flexDirection: "column", gap: "4" }, /* @__PURE__ */ React131.createElement(Text, { size: "inputLabel", weight: "inputLabel", color: "inputLabel" }, t("withdrawal.amount")), /* @__PURE__ */ React131.createElement(Box, { display: "flex", flexDirection: "column", gap: "4" }, isLighter ? /* @__PURE__ */ React131.createElement(
|
|
25088
25114
|
LighterCompoundAmountInput,
|
|
25089
25115
|
{
|
|
25090
25116
|
value: withdrawalInputAmount,
|
|
25091
25117
|
onChange: handleAmountChange,
|
|
25092
|
-
activeSymbol,
|
|
25118
|
+
activeSymbol: displaySymbol,
|
|
25093
25119
|
chipLabel,
|
|
25120
|
+
chipIconSrc,
|
|
25094
25121
|
chipTooltip,
|
|
25095
25122
|
sourceTokenBalance,
|
|
25096
25123
|
onMax: setMaxAmount,
|
|
@@ -25116,7 +25143,7 @@ function WithdrawAmountInput({
|
|
|
25116
25143
|
suffix: /* @__PURE__ */ React131.createElement(
|
|
25117
25144
|
AmountInputSuffix,
|
|
25118
25145
|
{
|
|
25119
|
-
symbol:
|
|
25146
|
+
symbol: displaySymbol,
|
|
25120
25147
|
sourceTokenBalance,
|
|
25121
25148
|
onMax: setMaxAmount
|
|
25122
25149
|
}
|
|
@@ -25127,7 +25154,7 @@ function WithdrawAmountInput({
|
|
|
25127
25154
|
{ minBeforeUseScientific: 0 }
|
|
25128
25155
|
)), Number(sourceTokenBalance) > 0 && /* @__PURE__ */ React131.createElement(Text, { size: "12", color: "secondaryText" }, t("withdrawal.balance", {
|
|
25129
25156
|
amount: formatCryptoAndStringify2(Number(sourceTokenBalance)),
|
|
25130
|
-
symbol:
|
|
25157
|
+
symbol: displaySymbol
|
|
25131
25158
|
})))));
|
|
25132
25159
|
}
|
|
25133
25160
|
function AmountInputSuffix({
|
|
@@ -25151,6 +25178,7 @@ function LighterCompoundAmountInput({
|
|
|
25151
25178
|
onChange,
|
|
25152
25179
|
activeSymbol,
|
|
25153
25180
|
chipLabel,
|
|
25181
|
+
chipIconSrc,
|
|
25154
25182
|
chipTooltip,
|
|
25155
25183
|
sourceTokenBalance,
|
|
25156
25184
|
onMax,
|
|
@@ -25185,8 +25213,8 @@ function LighterCompoundAmountInput({
|
|
|
25185
25213
|
/* @__PURE__ */ React131.createElement(
|
|
25186
25214
|
LighterSourceTokenDropdown,
|
|
25187
25215
|
{
|
|
25188
|
-
activeSymbol,
|
|
25189
25216
|
chipLabel,
|
|
25217
|
+
chipIconSrc,
|
|
25190
25218
|
tooltip: chipTooltip,
|
|
25191
25219
|
options: sourceTokenOptions,
|
|
25192
25220
|
onSelect: onSourceTokenChange
|
|
@@ -25229,8 +25257,8 @@ function LighterAmountInputField({
|
|
|
25229
25257
|
));
|
|
25230
25258
|
}
|
|
25231
25259
|
function LighterSourceTokenDropdown({
|
|
25232
|
-
activeSymbol,
|
|
25233
25260
|
chipLabel,
|
|
25261
|
+
chipIconSrc,
|
|
25234
25262
|
tooltip,
|
|
25235
25263
|
options,
|
|
25236
25264
|
onSelect
|
|
@@ -25260,7 +25288,7 @@ function LighterSourceTokenDropdown({
|
|
|
25260
25288
|
/* @__PURE__ */ React131.createElement(
|
|
25261
25289
|
AsyncImage,
|
|
25262
25290
|
{
|
|
25263
|
-
src:
|
|
25291
|
+
src: chipIconSrc,
|
|
25264
25292
|
alt: chipLabel,
|
|
25265
25293
|
width: 20,
|
|
25266
25294
|
height: 20,
|
|
@@ -25295,7 +25323,11 @@ function LighterSourceTokenDropdown({
|
|
|
25295
25323
|
className: "funkit-dropdown-content",
|
|
25296
25324
|
style: {
|
|
25297
25325
|
zIndex: "calc(var(--rk-modal-z-index, 2147483646) + 1)",
|
|
25298
|
-
width
|
|
25326
|
+
// Track the chip width as a floor only — a short selection (e.g.
|
|
25327
|
+
// "LIT") must not squeeze longer labels ("USDC (Perps)") into
|
|
25328
|
+
// wrapping; the menu grows to its widest item instead.
|
|
25329
|
+
minWidth: "var(--radix-dropdown-menu-trigger-width)",
|
|
25330
|
+
width: "max-content"
|
|
25299
25331
|
},
|
|
25300
25332
|
onCloseAutoFocus: (e) => e.preventDefault()
|
|
25301
25333
|
},
|
|
@@ -25342,7 +25374,16 @@ function LighterSourceTokenDropdown({
|
|
|
25342
25374
|
borderRadius: "full"
|
|
25343
25375
|
}
|
|
25344
25376
|
),
|
|
25345
|
-
/* @__PURE__ */ React131.createElement(
|
|
25377
|
+
/* @__PURE__ */ React131.createElement(
|
|
25378
|
+
Text,
|
|
25379
|
+
{
|
|
25380
|
+
size: "13",
|
|
25381
|
+
weight: "medium",
|
|
25382
|
+
color: "primaryText",
|
|
25383
|
+
style: { whiteSpace: "nowrap" }
|
|
25384
|
+
},
|
|
25385
|
+
opt.label
|
|
25386
|
+
)
|
|
25346
25387
|
)
|
|
25347
25388
|
))
|
|
25348
25389
|
)
|
|
@@ -25628,7 +25669,7 @@ function useWithdrawal({
|
|
|
25628
25669
|
targetAssetAddress: formData.tokenAddress,
|
|
25629
25670
|
targetChainId: formData.chainId,
|
|
25630
25671
|
destinationAddress: formData.destinationAddress,
|
|
25631
|
-
|
|
25672
|
+
customerData: formData.customerData,
|
|
25632
25673
|
userInputAmount: formData.userInputAmount,
|
|
25633
25674
|
withdrawalUSD: formData.withdrawalUSD
|
|
25634
25675
|
});
|
|
@@ -25664,7 +25705,7 @@ function useWithdrawal({
|
|
|
25664
25705
|
targetAssetAddress: formData.tokenAddress,
|
|
25665
25706
|
targetChainId: formData.chainId,
|
|
25666
25707
|
destinationAddress: formData.destinationAddress,
|
|
25667
|
-
|
|
25708
|
+
customerData: formData.customerData,
|
|
25668
25709
|
userInputAmount: formData.userInputAmount,
|
|
25669
25710
|
withdrawalUSD: formData.withdrawalUSD
|
|
25670
25711
|
});
|
|
@@ -26090,7 +26131,13 @@ var WithdrawContent = ({
|
|
|
26090
26131
|
// submit button is gated on `lighterAssetIndex` but not on this asset.
|
|
26091
26132
|
tokenAddress: lighterSecureMainnetAddress ?? "0x",
|
|
26092
26133
|
chainId: mainnet7.id,
|
|
26093
|
-
|
|
26134
|
+
customerData: {
|
|
26135
|
+
customerName: "lighter",
|
|
26136
|
+
assetIndex: lighterAssetIndex,
|
|
26137
|
+
// Perps vs spot route — disambiguates USDC, which shares asset
|
|
26138
|
+
// index 3 across both routes.
|
|
26139
|
+
routeType: resolveLighterSecureRouteType(selectedSourceToken)
|
|
26140
|
+
},
|
|
26094
26141
|
userInputAmount: withdrawalInputAmount
|
|
26095
26142
|
});
|
|
26096
26143
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Chain } from 'viem';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the chain list for the relay client, applying per-chain RPC overrides
|
|
4
|
+
* (keyed by chain id) onto each chain's `rpcUrls.default.http`.
|
|
5
|
+
*
|
|
6
|
+
* The relay-sdk derives the RPC it polls for transaction receipts from each
|
|
7
|
+
* chain's `rpcUrls.default`, so this points that receipt-wait at a reachable
|
|
8
|
+
* endpoint for chains whose default RPC isn't (e.g. an early-access chain like
|
|
9
|
+
* Robinhood). Only chains listed in `rpcOverrides` are changed; everything else
|
|
10
|
+
* is returned unchanged. See {@link FunkitConfig.relayRpcOverrides}.
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildRelayChains(chains: readonly Chain[], rpcOverrides?: Record<number, string>): Chain[];
|
|
@@ -6,12 +6,38 @@
|
|
|
6
6
|
import type { LighterAccountIndex } from '@funkit/api-base';
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import type { Address } from 'viem';
|
|
9
|
-
import type { CustomWithdrawalConfig, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
|
|
9
|
+
import type { CustomWithdrawalConfig, LighterRouteType, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
|
|
10
10
|
import type { LighterShare } from '../../utils/customer';
|
|
11
11
|
import type { SourceTokenOption } from './WithdrawAmountInput';
|
|
12
12
|
/** Stable method ids for the Fast / Secure options (used for tracking + switching). */
|
|
13
13
|
export declare const LIGHTER_FAST_METHOD_ID = "lighter-fast";
|
|
14
14
|
export declare const LIGHTER_SECURE_METHOD_ID = "lighter-secure";
|
|
15
|
+
/**
|
|
16
|
+
* USDC exists twice on a Lighter account: as perps collateral
|
|
17
|
+
* (`total_asset_value`, withdrawn via route 0) and as a spot asset balance
|
|
18
|
+
* (asset entry 3, withdrawn via route 1). The Secure dropdown keys selection
|
|
19
|
+
* by `symbol`, so the spot variant gets a pseudo-symbol to stay selectable
|
|
20
|
+
* alongside the plain `USDC` (perps) entry.
|
|
21
|
+
*/
|
|
22
|
+
export declare const LIGHTER_USDC_SPOT_SYMBOL = "USDC (Spot)";
|
|
23
|
+
/** Lighter L2 route types (`RouteType` in the withdraw/transfer tx payload). */
|
|
24
|
+
export declare const LIGHTER_ROUTE_TYPE: {
|
|
25
|
+
readonly PERPS: 0;
|
|
26
|
+
readonly SPOT: 1;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Strips the ` (Spot)` / ` (Perps)` variant suffix off a Lighter source-token
|
|
30
|
+
* selection, returning the real token symbol (e.g. `USDC (Spot)` → `USDC`).
|
|
31
|
+
* Symbol-keyed lookups (icons, prices, asset indices, min amounts) operate on
|
|
32
|
+
* the base symbol; only selection identity and route resolution keep the suffix.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getLighterBaseSymbol(symbol: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Resolves the Lighter L2 route type for a Secure source-token selection.
|
|
37
|
+
* Plain `USDC` withdraws perps collateral (route 0); everything else —
|
|
38
|
+
* including the `USDC (Spot)` pseudo-symbol — is a spot asset (route 1).
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveLighterSecureRouteType(selectedSourceToken: string): LighterRouteType;
|
|
15
41
|
/**
|
|
16
42
|
* Mainnet ERC-20 address for a Lighter Secure source token symbol, or undefined
|
|
17
43
|
* if the symbol isn't a known Secure asset.
|
|
@@ -91,7 +117,8 @@ export declare function resolveLighterAssetIndex(lighterAssets: {
|
|
|
91
117
|
* Builds the source-token options list for the Lighter compound input dropdown.
|
|
92
118
|
*
|
|
93
119
|
* - Fast path: only USDC (Perps).
|
|
94
|
-
* - Secure path: USDC (from total_asset_value) +
|
|
120
|
+
* - Secure path: USDC (Perps) (from total_asset_value) + USDC (Spot) when the
|
|
121
|
+
* account carries a spot USDC asset + every non-USDC asset on the account.
|
|
95
122
|
*/
|
|
96
123
|
export declare function buildLighterSourceTokenOptions(config: FunkitWithdrawalConfig, lighterAssets: {
|
|
97
124
|
symbol: string;
|
|
@@ -130,17 +157,17 @@ export declare function LighterSecureAddressDisplay({ address }: {
|
|
|
130
157
|
* token always matches the source asset, and the destination chain is always
|
|
131
158
|
* Ethereum mainnet. Each field surfaces a hover tooltip explaining the lock.
|
|
132
159
|
*/
|
|
133
|
-
export declare function LighterSecureReceiveDisplay({ sourceTokenSymbol, }: {
|
|
160
|
+
export declare function LighterSecureReceiveDisplay({ sourceTokenSymbol: rawSourceTokenSymbol, }: {
|
|
134
161
|
sourceTokenSymbol: string;
|
|
135
162
|
}): React.JSX.Element;
|
|
136
163
|
/**
|
|
137
164
|
* Lighter Secure: receive amount value (1:1 — same token, no swap).
|
|
138
165
|
*/
|
|
139
|
-
export declare function LighterSecureReceiveAmountValue({ amount, tokenSymbol, }: {
|
|
166
|
+
export declare function LighterSecureReceiveAmountValue({ amount, tokenSymbol: rawTokenSymbol, }: {
|
|
140
167
|
amount: string;
|
|
141
168
|
tokenSymbol: string;
|
|
142
169
|
}): React.JSX.Element;
|
|
143
|
-
export declare function LighterSecureWithdrawalSuccess({ onClose, onNewWithdrawal, amount, tokenSymbol, txHash, }: {
|
|
170
|
+
export declare function LighterSecureWithdrawalSuccess({ onClose, onNewWithdrawal, amount, tokenSymbol: rawTokenSymbol, txHash, }: {
|
|
144
171
|
onClose: () => void;
|
|
145
172
|
onNewWithdrawal: () => void;
|
|
146
173
|
amount: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Address, Hex } from 'viem';
|
|
2
2
|
import { type CheckoutConfirmationError } from '../../domains/checkoutErrors';
|
|
3
3
|
import type { FunkitCheckoutQuoteResult } from '../../domains/quote';
|
|
4
|
-
import { type FunkitActiveWithdrawalItem, type FunkitWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
|
|
4
|
+
import { type FunkitActiveWithdrawalItem, type FunkitWithdrawalConfig, type WithdrawalCustomerData } from '../../providers/FunkitCheckoutContext';
|
|
5
5
|
interface UseWithdrawalResult {
|
|
6
6
|
handleWithdrawal: (withdrawal: WithdrawalFormData) => Promise<Hex | null>;
|
|
7
7
|
isWithdrawing: boolean;
|
|
@@ -15,8 +15,8 @@ export type WithdrawalFormData = {
|
|
|
15
15
|
tokenAddress: Address;
|
|
16
16
|
chainId: number;
|
|
17
17
|
quote?: FunkitCheckoutQuoteResult;
|
|
18
|
-
/**
|
|
19
|
-
|
|
18
|
+
/** Customer-specific data for quoteless flows (e.g. Lighter Secure). */
|
|
19
|
+
customerData?: WithdrawalCustomerData;
|
|
20
20
|
userInputAmount: string;
|
|
21
21
|
};
|
|
22
22
|
export declare function useWithdrawal({ config, withdrawalItem, onSuccess, }: {
|
|
@@ -281,14 +281,32 @@ export interface CustomWithdrawalConfig extends WithdrawalConfigBase {
|
|
|
281
281
|
*/
|
|
282
282
|
withdrawCallback: (param: WithdrawalParam) => Promise<undefined | string>;
|
|
283
283
|
}
|
|
284
|
+
/** Lighter L2 route type: 0 = perps (USDC collateral), 1 = spot. */
|
|
285
|
+
export type LighterRouteType = 0 | 1;
|
|
286
|
+
/**
|
|
287
|
+
* Lighter-specific data for quoteless Secure withdrawal. `assetIndex` selects
|
|
288
|
+
* the L2 asset (avoids overloading targetChainId); `routeType` disambiguates
|
|
289
|
+
* USDC, whose perps and spot balances share asset index 3.
|
|
290
|
+
*/
|
|
291
|
+
export interface LighterWithdrawalCustomerData {
|
|
292
|
+
customerName: 'lighter';
|
|
293
|
+
assetIndex: number;
|
|
294
|
+
routeType: LighterRouteType;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Customer-specific data threaded through withdrawal callbacks, discriminated
|
|
298
|
+
* by `customerName` so future customers extend the union instead of adding
|
|
299
|
+
* top-level params.
|
|
300
|
+
*/
|
|
301
|
+
export type WithdrawalCustomerData = LighterWithdrawalCustomerData;
|
|
284
302
|
export interface WithdrawalParam {
|
|
285
303
|
quoteId: string;
|
|
286
304
|
funQuote: unknown;
|
|
287
305
|
targetAssetAddress: Address;
|
|
288
306
|
targetChainId: number;
|
|
289
307
|
destinationAddress: Address;
|
|
290
|
-
/**
|
|
291
|
-
|
|
308
|
+
/** Customer-specific data for quoteless flows (e.g. Lighter Secure). */
|
|
309
|
+
customerData?: WithdrawalCustomerData;
|
|
292
310
|
/** User-entered amount in token units for quoteless flows (avoids overloading quoteId). */
|
|
293
311
|
userInputAmount?: string;
|
|
294
312
|
/**
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import type { FlagKey } from '@funkit/utils';
|
|
3
|
+
import { flagConfig as offlineConfig } from '../utils/flags/config';
|
|
4
|
+
import type { InferFlagType } from '../utils/flags/types';
|
|
5
|
+
export type FlagValue<K extends FlagKey> = InferFlagType<(typeof offlineConfig)[K]>;
|
|
6
|
+
export type FlagValues = {
|
|
7
|
+
[K in FlagKey]?: FlagValue<K>;
|
|
8
|
+
};
|
|
9
|
+
export type GetFlagFunction = <K extends FlagKey>(flagKey: K, fallback?: FlagValue<K>) => FlagValue<K>;
|
|
10
|
+
export interface FunkitFlagsContextValue {
|
|
11
|
+
/** Error fetching flag config from server */
|
|
12
|
+
error: Error | null;
|
|
13
|
+
/** Loaded flags - each flag may be undefined if configuration from server was missing or invalid */
|
|
14
|
+
flags: FlagValues;
|
|
15
|
+
/** Synchronously reads a single flag (derived for current user) - returns fallback while loading */
|
|
16
|
+
getFlag: GetFlagFunction;
|
|
17
|
+
/** Whether flags are currently loading */
|
|
18
|
+
isLoading: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const FunkitFlagsContext: React.Context<FunkitFlagsContextValue>;
|
|
21
|
+
export declare function FunkitFlagsProvider({ children }: {
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
}): React.JSX.Element;
|
|
24
|
+
export declare function useFlags(): FunkitFlagsContextValue;
|
|
25
|
+
export type FlagMiddleware<K extends FlagKey> = (flagValue: FlagValue<K>) => FlagValue<K>;
|
|
26
|
+
export declare function useFlag<K extends FlagKey>(flagKey: K, fallback?: FlagValue<K>, middleware?: FlagMiddleware<K>): FlagValue<K>;
|