@funkit/connect 9.26.1 → 9.27.1
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 +29 -0
- package/dist/clients/{chunk-F4SCUKY6.js → chunk-E36JOYL4.js} +9 -5
- package/dist/clients/{chunk-4IWQ2UT5.js → chunk-UBBBMSKL.js} +5 -2
- package/dist/clients/mallard.js +1 -1
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +2 -2
- package/dist/clients/polymarket/createPolymarketDepositConfig.js +1 -1
- package/dist/clients/polymarket/index.js +2 -2
- package/dist/clients/rolly.js +1 -1
- package/dist/components/FunPayments/FunPaymentMethods.d.ts +3 -1
- package/dist/hooks/queries/useWithdrawFops.d.ts +8 -0
- package/dist/hooks/useInjectedAssetHoldings.d.ts +10 -13
- package/dist/hooks/useXstockAssetHoldings.d.ts +3 -1
- package/dist/index.js +154 -90
- package/dist/modals/CheckoutModal/InputAmount/useNadoDirectTransfer.d.ts +17 -15
- package/dist/modals/CheckoutModal/SourceChange/FormOfPaymentsList.d.ts +8 -1
- package/dist/modals/PolymarketPerpsTransfer/PolymarketPerpsTransferScreen.d.ts +1 -1
- package/dist/modals/WithdrawalModal/WithdrawalMethodSelect.d.ts +7 -1
- package/dist/utils/withdrawal.d.ts +6 -0
- package/dist/wallets/walletConnectors/index.js +53 -53
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @funkit/connect
|
|
2
2
|
|
|
3
|
+
## 9.27.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2277277: Checksum the Polymarket deposit recipient (predictions/perps) so a lowercased integrator-supplied address can't cause a downstream recipient mismatch.
|
|
8
|
+
- d59ac5d: Fix a layout jump on the checkout asset list for xStock (Nado) targets by resolving the wrapper-token address once at the `useWalletAssetHoldings` seam and awaiting it, so the list paints with the wrapper already recognized. Also bumps the wrapper-address query `staleTime` to 1h.
|
|
9
|
+
- 7604174: fix(polymarket): lower Polymarket Perps minimum deposit from $10 to $5 (matches the updated `ExchangeV1.supportedAssets` on-chain minimum)
|
|
10
|
+
- Updated dependencies [7880a7b]
|
|
11
|
+
- @funkit/fun-relay@2.9.0
|
|
12
|
+
|
|
13
|
+
## 9.27.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- 6e4aa57: Disable Swapped withdrawal cash methods with a "Low Balance" badge when the withdrawal balance is below the sell minimum.
|
|
18
|
+
- 394a46c: Cap the Swapped withdrawal iframe input via a FOP `defaultMaxAmount` (EUR) derived from the user's source-token balance
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- df21fd3: chore: update final rolly contract
|
|
23
|
+
- 3e22665: patch(connect): fix ostium source change top spacing
|
|
24
|
+
- cf7af7d: fix(connect): scope Nado direct-transfer fast-path to xStock targets
|
|
25
|
+
- 78a888c: fix(connect): update Mallard deposit contract address
|
|
26
|
+
- Updated dependencies [42aafd9]
|
|
27
|
+
- Updated dependencies [394a46c]
|
|
28
|
+
- @funkit/fun-relay@2.8.7
|
|
29
|
+
- @funkit/api-base@5.1.0
|
|
30
|
+
- @funkit/connect-core@1.4.1
|
|
31
|
+
|
|
3
32
|
## 9.26.1
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./chunk-O5CTDT3L.js";
|
|
12
12
|
|
|
13
13
|
// src/clients/polymarket/createPolymarketDepositConfig.ts
|
|
14
|
-
import { encodeFunctionData, erc20Abi, maxUint256 } from "viem";
|
|
14
|
+
import { encodeFunctionData, erc20Abi, getAddress, maxUint256 } from "viem";
|
|
15
15
|
import { polygon } from "viem/chains";
|
|
16
16
|
var POLYMARKET_PREDICTIONS_ROUTING_ID = "POLYMARKET_PREDICTIONS";
|
|
17
17
|
var POLYMARKET_PERPS_ROUTING_ID = "POLYMARKET_PERPS";
|
|
@@ -47,7 +47,7 @@ function createPredictionsGenerateActionParams(config) {
|
|
|
47
47
|
];
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
var PERPS_MIN_DEPOSIT_USD =
|
|
50
|
+
var PERPS_MIN_DEPOSIT_USD = 5;
|
|
51
51
|
function createPolymarketDepositConfig({
|
|
52
52
|
predictions,
|
|
53
53
|
perps,
|
|
@@ -57,6 +57,8 @@ function createPolymarketDepositConfig({
|
|
|
57
57
|
}) {
|
|
58
58
|
const isPerpsRoute = (routingId) => routingId === POLYMARKET_PERPS_ROUTING_ID;
|
|
59
59
|
const defaultsToPerps = defaultAccount === "perps";
|
|
60
|
+
const predictionsRecipient = getAddress(predictions.address);
|
|
61
|
+
const perpsRecipient = getAddress(perps.address);
|
|
60
62
|
return {
|
|
61
63
|
targetChain: polygon.id.toString(),
|
|
62
64
|
targetAsset: POLYGON_USDCE,
|
|
@@ -68,13 +70,15 @@ function createPolymarketDepositConfig({
|
|
|
68
70
|
// The preselected destination (the "Deposit to" dropdown derives its
|
|
69
71
|
// selection from `dynamicRoutingId`, so both fields must agree).
|
|
70
72
|
dynamicRoutingId: defaultsToPerps ? POLYMARKET_PERPS_ROUTING_ID : POLYMARKET_PREDICTIONS_ROUTING_ID,
|
|
71
|
-
customRecipient: defaultsToPerps ?
|
|
73
|
+
customRecipient: defaultsToPerps ? perpsRecipient : predictionsRecipient,
|
|
72
74
|
modalTitle: ({ dynamicRoutingId }) => isPerpsRoute(dynamicRoutingId) ? modalTitles?.perps ?? "Deposit (Perps)" : modalTitles?.predictions ?? "Deposit (Predictions)",
|
|
73
75
|
getMinDepositUSD: ({ dynamicRoutingId }) => isPerpsRoute(dynamicRoutingId) ? PERPS_MIN_DEPOSIT_USD : 0,
|
|
74
76
|
generateActionsParams: (_targetAssetAmount, outputConfig) => isPerpsRoute(
|
|
75
77
|
outputConfig?.dynamicRoutingId
|
|
76
|
-
) ? createPerpsGenerateActionParams({
|
|
77
|
-
recipientAddress:
|
|
78
|
+
) ? createPerpsGenerateActionParams({
|
|
79
|
+
recipientAddress: perpsRecipient
|
|
80
|
+
})() : createPredictionsGenerateActionParams({
|
|
81
|
+
recipientAddress: predictionsRecipient
|
|
78
82
|
})(),
|
|
79
83
|
// Both transfer directions are integrator-owned; the step picks the source
|
|
80
84
|
// account's transfer. The accounts already have exactly the handle shape
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
POLYMARKET_PERPS_ROUTING_ID,
|
|
20
20
|
POLYMARKET_PREDICTIONS_ROUTING_ID
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-E36JOYL4.js";
|
|
22
22
|
import {
|
|
23
23
|
POLYGON_USDCE,
|
|
24
24
|
PUSD_TOKEN
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
|
|
30
30
|
// src/clients/polymarket/PolymarketDepositAccountDropdown.tsx
|
|
31
31
|
import React12 from "react";
|
|
32
|
+
import { getAddress } from "viem";
|
|
32
33
|
import { polygon } from "viem/chains";
|
|
33
34
|
|
|
34
35
|
// src/components/Dropdown/AccountSelectDropdown.tsx
|
|
@@ -1065,7 +1066,9 @@ function PolymarketDepositAccountDropdown({
|
|
|
1065
1066
|
applyDynamicTargetAssetCandidate?.(
|
|
1066
1067
|
accountCandidate(
|
|
1067
1068
|
isPerps ? POLYMARKET_PERPS_ROUTING_ID : POLYMARKET_PREDICTIONS_ROUTING_ID,
|
|
1068
|
-
|
|
1069
|
+
// Checksum so the recipient agrees with createPolymarketDepositConfig's
|
|
1070
|
+
// initial customRecipient (integrator addresses aren't guaranteed EIP-55).
|
|
1071
|
+
isPerps ? getAddress(perps.address) : getAddress(predictions.address)
|
|
1069
1072
|
)
|
|
1070
1073
|
);
|
|
1071
1074
|
};
|
package/dist/clients/mallard.js
CHANGED
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
|
|
43
43
|
// src/clients/mallard.tsx
|
|
44
44
|
var MALLARD_DEPOSIT_ADDRESS = getAddress(
|
|
45
|
-
"
|
|
45
|
+
"0xD42c46c7BaD6A54b38395F846b09981CE75fb8e2"
|
|
46
46
|
);
|
|
47
47
|
var VAULT_DEPOSITOR_ZORRO = getAddress(
|
|
48
48
|
"0xec70919c52e56a197d2e13b78cb8511db54f3ca2"
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
PolymarketDepositAccountDropdown
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-UBBBMSKL.js";
|
|
5
5
|
import "../chunk-ZEXZQOAO.js";
|
|
6
6
|
import "../chunk-VT3ERWXE.js";
|
|
7
7
|
import "../chunk-LUHEVXPD.js";
|
|
8
8
|
import "../chunk-UPZNKPYU.js";
|
|
9
9
|
import "../chunk-STLOQEN7.js";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-E36JOYL4.js";
|
|
11
11
|
import "../chunk-O5CTDT3L.js";
|
|
12
12
|
import "../chunk-AHYOV7AV.js";
|
|
13
13
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
PolymarketDepositAccountDropdown
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-UBBBMSKL.js";
|
|
5
5
|
import "../chunk-ZEXZQOAO.js";
|
|
6
6
|
import "../chunk-VT3ERWXE.js";
|
|
7
7
|
import "../chunk-LUHEVXPD.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
POLYMARKET_PREDICTIONS_ROUTING_ID,
|
|
13
13
|
createPolymarketDepositConfig,
|
|
14
14
|
createPredictionsGenerateActionParams
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-E36JOYL4.js";
|
|
16
16
|
import {
|
|
17
17
|
AMOUNT_PLACEHOLDER,
|
|
18
18
|
COLLATERAL_ONRAMP_ABI,
|
package/dist/clients/rolly.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
maxUint256
|
|
10
10
|
} from "viem";
|
|
11
11
|
var ROLLY_VAULT_ADDRESS = getAddress(
|
|
12
|
-
"
|
|
12
|
+
"0xd40373CC943f32BAd15bF42d1580363f4D52739D"
|
|
13
13
|
);
|
|
14
14
|
var ARBITRUM_USDT0 = getAddress(
|
|
15
15
|
"0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"
|
|
@@ -86,9 +86,11 @@ export declare function PaymentMethodDisabledBadge(props: {
|
|
|
86
86
|
/**
|
|
87
87
|
* Payment method item for a Form of Payment from the fops API (Swapped providers)
|
|
88
88
|
*/
|
|
89
|
-
export declare function FopPaymentMethodItem({ fop, isActive, onClick, testId, disclaimerLimit, disabled, }: BasePaymentMethodItemProps & {
|
|
89
|
+
export declare function FopPaymentMethodItem({ fop, isActive, onClick, testId, disclaimerLimit, disabled, isBelowMinimum, }: BasePaymentMethodItemProps & {
|
|
90
90
|
fop: SwappedFormOfPayment;
|
|
91
91
|
disclaimerLimit: string;
|
|
92
92
|
disabled?: boolean;
|
|
93
|
+
/** Withdrawal off-ramp only: balance can't meet the cash sell minimum. */
|
|
94
|
+
isBelowMinimum?: boolean;
|
|
93
95
|
}): React.JSX.Element;
|
|
94
96
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type GetFopsResponse } from '@funkit/api-base';
|
|
2
|
+
export declare const SWAPPED_MIN_SELL_EUR = 7;
|
|
2
3
|
/**
|
|
3
4
|
* Hook to fetch available withdrawal (off-ramp) forms of payment from /fops.
|
|
4
5
|
* Sends a CRYPTO_TO_FIAT rail config to get sell/payout methods.
|
|
@@ -6,6 +7,13 @@ import { type GetFopsResponse } from '@funkit/api-base';
|
|
|
6
7
|
export declare const useWithdrawFops: (params: {
|
|
7
8
|
sourceChainId: string;
|
|
8
9
|
sourceTokenAddress: string;
|
|
10
|
+
/** Best-effort max sell amount in EUR; capped to the user's source balance. */
|
|
11
|
+
defaultMaxAmount?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Gate the fetch. Default true. Pass false to hold the request until the cap
|
|
14
|
+
* is resolved, so the first /fops call never goes out uncapped.
|
|
15
|
+
*/
|
|
16
|
+
enabled?: boolean;
|
|
9
17
|
}) => {
|
|
10
18
|
data: GetFopsResponse | undefined;
|
|
11
19
|
isLoading: boolean;
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
+
import type { Address } from 'viem';
|
|
2
|
+
import type { AssetHoldingsMap } from '../domains/wallet';
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
+
* Merges payable sources the wallet-assets API doesn't index — an xStock the
|
|
5
|
+
* user holds + its wrapper — into the holdings map.
|
|
4
6
|
*
|
|
5
|
-
*
|
|
6
|
-
* already holds and can deposit directly (an xStock + its wrapper) — into the
|
|
7
|
-
* holdings map.
|
|
7
|
+
* Note: xStock/Nado-only today; possibly deprecate once backend supports these natively.
|
|
8
8
|
*
|
|
9
|
-
* - Gated by
|
|
10
|
-
*
|
|
11
|
-
* -
|
|
12
|
-
* the same map and keys can't drift across call sites.
|
|
13
|
-
* - Injects only what the API doesn't already list, so we never clobber the API's
|
|
14
|
-
* price/USD with our on-chain read. Customer/asset gating lives upstream.
|
|
9
|
+
* - Gated by `enable-rpc-xstock-assets` (off by default) → no RPC reads, nothing injected.
|
|
10
|
+
* - Single seam in `useWalletAssetHoldings` so keys can't drift across consumers.
|
|
11
|
+
* - Injects only what the API omits (never clobbers its price/USD); gating lives upstream.
|
|
15
12
|
*/
|
|
16
|
-
|
|
17
|
-
export declare function useInjectedAssetHoldings({ targetChainId, existingHoldings, }: {
|
|
13
|
+
export declare function useInjectedAssetHoldings({ targetChainId, existingHoldings, xstockWrappedTokenAddress, }: {
|
|
18
14
|
targetChainId: string;
|
|
19
15
|
existingHoldings: AssetHoldingsMap | undefined;
|
|
16
|
+
xstockWrappedTokenAddress?: Address;
|
|
20
17
|
}): {
|
|
21
18
|
holdings: AssetHoldingsMap;
|
|
22
19
|
isLoading: boolean;
|
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
* - Fetch only. Scoped to xStock targets (`assetClass === 'xstock'`) so we don't
|
|
6
6
|
* fire RPC reads when there's nothing to read.
|
|
7
7
|
*/
|
|
8
|
+
import type { Address } from 'viem';
|
|
8
9
|
import type { AssetHoldingsItem } from '../domains/wallet';
|
|
9
|
-
export declare function useXstockAssetHoldings({ targetChainId, enabled, }: {
|
|
10
|
+
export declare function useXstockAssetHoldings({ targetChainId, wrappedTokenAddress, enabled, }: {
|
|
10
11
|
targetChainId: string;
|
|
12
|
+
wrappedTokenAddress?: Address;
|
|
11
13
|
enabled?: boolean;
|
|
12
14
|
}): {
|
|
13
15
|
data: AssetHoldingsItem[];
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
lightTheme
|
|
4
|
-
} from "./chunk-67BKQQNG.js";
|
|
5
2
|
import {
|
|
6
3
|
darkTheme
|
|
7
4
|
} from "./chunk-36KVHK22.js";
|
|
5
|
+
import {
|
|
6
|
+
lightTheme
|
|
7
|
+
} from "./chunk-67BKQQNG.js";
|
|
8
8
|
import {
|
|
9
9
|
systemFontStack
|
|
10
10
|
} from "./chunk-4YEAUICE.js";
|
|
@@ -1683,7 +1683,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
1683
1683
|
localStorage.setItem(storageKey, version);
|
|
1684
1684
|
}
|
|
1685
1685
|
function getCurrentSdkVersion() {
|
|
1686
|
-
return "9.
|
|
1686
|
+
return "9.27.1";
|
|
1687
1687
|
}
|
|
1688
1688
|
function useFingerprint() {
|
|
1689
1689
|
const fingerprint = useCallback3(() => {
|
|
@@ -3968,51 +3968,10 @@ function useGetAssetHoldingsFromRpc({
|
|
|
3968
3968
|
});
|
|
3969
3969
|
}
|
|
3970
3970
|
|
|
3971
|
-
// src/hooks/useXstocksWrappedTokenAddress.ts
|
|
3972
|
-
import { getXstocksAsset, xstocksNetworkFromChainId } from "@funkit/api-base";
|
|
3973
|
-
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
3974
|
-
function useXstocksWrappedTokenAddress({ enabled = true } = {}) {
|
|
3975
|
-
const { checkoutItem } = useCheckoutContext();
|
|
3976
|
-
const { apiKey } = useFunkitConfig();
|
|
3977
|
-
const config = checkoutItem?.initSettings.config;
|
|
3978
|
-
const targetChain = config?.targetChain;
|
|
3979
|
-
const ticker = config?.targetAssetTicker;
|
|
3980
|
-
const isXstockTarget = isXStockTargetAsset(
|
|
3981
|
-
getActiveDynamicTargetAsset(config)
|
|
3982
|
-
);
|
|
3983
|
-
const network = targetChain ? xstocksNetworkFromChainId(targetChain) : void 0;
|
|
3984
|
-
const isEnabled = enabled && isXstockTarget && !!targetChain && !!ticker && !!network;
|
|
3985
|
-
const { data, isLoading } = useQuery7({
|
|
3986
|
-
queryKey: ["nadoTargetWrappedTokenAddress", targetChain, ticker],
|
|
3987
|
-
enabled: isEnabled,
|
|
3988
|
-
// Wrapped token address is effectively immutable; cache aggressively.
|
|
3989
|
-
staleTime: 5 * 60 * 1e3,
|
|
3990
|
-
retry: false,
|
|
3991
|
-
queryFn: async () => {
|
|
3992
|
-
if (!ticker || !network) {
|
|
3993
|
-
return null;
|
|
3994
|
-
}
|
|
3995
|
-
const symbol = parseXstocksSymbolFromTicker(ticker);
|
|
3996
|
-
const asset = await getXstocksAsset({ symbol, network, logger, apiKey });
|
|
3997
|
-
const deployment = asset.deployments?.find(
|
|
3998
|
-
(d) => d.network?.toLowerCase() === network.toLowerCase()
|
|
3999
|
-
);
|
|
4000
|
-
const wrappedTokenAddress = deployment?.wrapperAddressV2;
|
|
4001
|
-
logger.info("nadoTargetWrappedToken:resolved", {
|
|
4002
|
-
ticker,
|
|
4003
|
-
targetChain,
|
|
4004
|
-
network,
|
|
4005
|
-
hasWrappedToken: !!wrappedTokenAddress
|
|
4006
|
-
});
|
|
4007
|
-
return wrappedTokenAddress ? wrappedTokenAddress : null;
|
|
4008
|
-
}
|
|
4009
|
-
});
|
|
4010
|
-
return { data: data ?? void 0, isLoading };
|
|
4011
|
-
}
|
|
4012
|
-
|
|
4013
3971
|
// src/hooks/useXstockAssetHoldings.ts
|
|
4014
3972
|
function useXstockAssetHoldings({
|
|
4015
3973
|
targetChainId,
|
|
3974
|
+
wrappedTokenAddress,
|
|
4016
3975
|
enabled = true
|
|
4017
3976
|
}) {
|
|
4018
3977
|
const { checkoutItem } = useCheckoutContext();
|
|
@@ -4023,7 +3982,6 @@ function useXstockAssetHoldings({
|
|
|
4023
3982
|
const ticker = parseXstocksSymbolFromTicker(config?.targetAssetTicker ?? "");
|
|
4024
3983
|
const dynamicTargetAsset = getActiveDynamicTargetAsset(config);
|
|
4025
3984
|
const isEnabled = enabled && !!walletAddress && !!targetAsset && !!targetChain && targetChain === targetChainId && !!isXStockTargetAsset(dynamicTargetAsset);
|
|
4026
|
-
const { data: wrappedTokenAddress, isLoading: isWrappedTokenAddressLoading } = useXstocksWrappedTokenAddress({ enabled: isEnabled });
|
|
4027
3985
|
const targetTokenQuery = useGetAssetHoldingsFromRpc({
|
|
4028
3986
|
chainId: targetChain,
|
|
4029
3987
|
tokenAddress: targetAsset,
|
|
@@ -4049,7 +4007,7 @@ function useXstockAssetHoldings({
|
|
|
4049
4007
|
);
|
|
4050
4008
|
return {
|
|
4051
4009
|
data,
|
|
4052
|
-
isLoading: targetTokenQuery.isLoading || wrappedTokenQuery.isLoading
|
|
4010
|
+
isLoading: targetTokenQuery.isLoading || wrappedTokenQuery.isLoading
|
|
4053
4011
|
};
|
|
4054
4012
|
}
|
|
4055
4013
|
|
|
@@ -4057,11 +4015,13 @@ function useXstockAssetHoldings({
|
|
|
4057
4015
|
var EMPTY_HOLDINGS = {};
|
|
4058
4016
|
function useInjectedAssetHoldings({
|
|
4059
4017
|
targetChainId,
|
|
4060
|
-
existingHoldings
|
|
4018
|
+
existingHoldings,
|
|
4019
|
+
xstockWrappedTokenAddress
|
|
4061
4020
|
}) {
|
|
4062
4021
|
const isEnabled = useFeatureGate("enable-rpc-xstock-assets");
|
|
4063
4022
|
const { data: injectableHoldings, isLoading } = useXstockAssetHoldings({
|
|
4064
4023
|
targetChainId,
|
|
4024
|
+
wrappedTokenAddress: xstockWrappedTokenAddress,
|
|
4065
4025
|
enabled: isEnabled
|
|
4066
4026
|
});
|
|
4067
4027
|
const holdings = useMemo13(() => {
|
|
@@ -4084,7 +4044,49 @@ function useInjectedAssetHoldings({
|
|
|
4084
4044
|
}
|
|
4085
4045
|
return injected2;
|
|
4086
4046
|
}, [isEnabled, injectableHoldings, existingHoldings]);
|
|
4087
|
-
return { holdings, isLoading
|
|
4047
|
+
return { holdings, isLoading };
|
|
4048
|
+
}
|
|
4049
|
+
|
|
4050
|
+
// src/hooks/useXstocksWrappedTokenAddress.ts
|
|
4051
|
+
import { getXstocksAsset, xstocksNetworkFromChainId } from "@funkit/api-base";
|
|
4052
|
+
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
4053
|
+
function useXstocksWrappedTokenAddress({ enabled = true } = {}) {
|
|
4054
|
+
const { checkoutItem } = useCheckoutContext();
|
|
4055
|
+
const { apiKey } = useFunkitConfig();
|
|
4056
|
+
const config = checkoutItem?.initSettings.config;
|
|
4057
|
+
const targetChain = config?.targetChain;
|
|
4058
|
+
const ticker = config?.targetAssetTicker;
|
|
4059
|
+
const isXstockTarget = isXStockTargetAsset(
|
|
4060
|
+
getActiveDynamicTargetAsset(config)
|
|
4061
|
+
);
|
|
4062
|
+
const network = targetChain ? xstocksNetworkFromChainId(targetChain) : void 0;
|
|
4063
|
+
const isEnabled = enabled && isXstockTarget && !!targetChain && !!ticker && !!network;
|
|
4064
|
+
const { data, isLoading } = useQuery7({
|
|
4065
|
+
queryKey: ["nadoTargetWrappedTokenAddress", targetChain, ticker],
|
|
4066
|
+
enabled: isEnabled,
|
|
4067
|
+
// Wrapped token address is effectively immutable
|
|
4068
|
+
staleTime: 60 * 60 * 1e3,
|
|
4069
|
+
retry: false,
|
|
4070
|
+
queryFn: async () => {
|
|
4071
|
+
if (!ticker || !network) {
|
|
4072
|
+
return null;
|
|
4073
|
+
}
|
|
4074
|
+
const symbol = parseXstocksSymbolFromTicker(ticker);
|
|
4075
|
+
const asset = await getXstocksAsset({ symbol, network, logger, apiKey });
|
|
4076
|
+
const deployment = asset.deployments?.find(
|
|
4077
|
+
(d) => d.network?.toLowerCase() === network.toLowerCase()
|
|
4078
|
+
);
|
|
4079
|
+
const wrappedTokenAddress = deployment?.wrapperAddressV2;
|
|
4080
|
+
logger.info("nadoTargetWrappedToken:resolved", {
|
|
4081
|
+
ticker,
|
|
4082
|
+
targetChain,
|
|
4083
|
+
network,
|
|
4084
|
+
hasWrappedToken: !!wrappedTokenAddress
|
|
4085
|
+
});
|
|
4086
|
+
return wrappedTokenAddress ? wrappedTokenAddress : null;
|
|
4087
|
+
}
|
|
4088
|
+
});
|
|
4089
|
+
return { data: data ?? void 0, isLoading };
|
|
4088
4090
|
}
|
|
4089
4091
|
|
|
4090
4092
|
// src/hooks/useWalletAssetHoldings.ts
|
|
@@ -4160,9 +4162,14 @@ function useWalletAssetHoldings(targetChain) {
|
|
|
4160
4162
|
() => processWalletAssets(walletAssets, targetChain, isStablecoin),
|
|
4161
4163
|
[targetChain, walletAssets, isStablecoin]
|
|
4162
4164
|
);
|
|
4163
|
-
const {
|
|
4165
|
+
const {
|
|
4166
|
+
data: xstockWrappedTokenAddress,
|
|
4167
|
+
isLoading: isLoadingXstockWrappedTokenAddress
|
|
4168
|
+
} = useXstocksWrappedTokenAddress();
|
|
4169
|
+
const { holdings: injectedHoldings, isLoading: isLoadingInjectedAssets } = useInjectedAssetHoldings({
|
|
4164
4170
|
targetChainId: targetChain,
|
|
4165
|
-
existingHoldings: processedAssets
|
|
4171
|
+
existingHoldings: processedAssets,
|
|
4172
|
+
xstockWrappedTokenAddress
|
|
4166
4173
|
});
|
|
4167
4174
|
const holdings = useMemo14(() => {
|
|
4168
4175
|
const hasInjected = Object.keys(injectedHoldings).length > 0;
|
|
@@ -4213,7 +4220,7 @@ function useWalletAssetHoldings(targetChain) {
|
|
|
4213
4220
|
]);
|
|
4214
4221
|
return {
|
|
4215
4222
|
data: holdings,
|
|
4216
|
-
isLoading: isLoading || isAllowedAssetsLoading ||
|
|
4223
|
+
isLoading: isLoading || isAllowedAssetsLoading || isLoadingInjectedAssets || isLoadingXstockWrappedTokenAddress,
|
|
4217
4224
|
totalBalance: totalWalletAssetsUsd,
|
|
4218
4225
|
hasUsableBalance,
|
|
4219
4226
|
minValueThreshold
|
|
@@ -5177,6 +5184,18 @@ import {
|
|
|
5177
5184
|
|
|
5178
5185
|
// src/utils/withdrawal.ts
|
|
5179
5186
|
import { parseUnits } from "viem";
|
|
5187
|
+
function safeEvaluateWithdrawalSourceTokenBalance(fn) {
|
|
5188
|
+
const raw = fn?.();
|
|
5189
|
+
if (raw == null) {
|
|
5190
|
+
return "0";
|
|
5191
|
+
}
|
|
5192
|
+
const str = String(raw);
|
|
5193
|
+
if (str === "" || Number.isNaN(Number(str)) || Number(str) < 0) {
|
|
5194
|
+
logger.warn("withdrawal:invalidSourceTokenBalance", { raw });
|
|
5195
|
+
return "0";
|
|
5196
|
+
}
|
|
5197
|
+
return str;
|
|
5198
|
+
}
|
|
5180
5199
|
function isWalletWithdrawalConfig(config) {
|
|
5181
5200
|
return "wallet" in config;
|
|
5182
5201
|
}
|
|
@@ -22087,18 +22106,40 @@ function PaymentMethodDisabledBadge(props) {
|
|
|
22087
22106
|
return null;
|
|
22088
22107
|
}
|
|
22089
22108
|
}
|
|
22109
|
+
function getFopDisabledBadgeReason({
|
|
22110
|
+
isDisabled,
|
|
22111
|
+
isGeoblocked,
|
|
22112
|
+
isBelowMinimum
|
|
22113
|
+
}) {
|
|
22114
|
+
if (!isDisabled) {
|
|
22115
|
+
return null;
|
|
22116
|
+
}
|
|
22117
|
+
if (isGeoblocked) {
|
|
22118
|
+
return "geoblocked";
|
|
22119
|
+
}
|
|
22120
|
+
if (isBelowMinimum) {
|
|
22121
|
+
return "lowBalance";
|
|
22122
|
+
}
|
|
22123
|
+
return "comingSoon";
|
|
22124
|
+
}
|
|
22090
22125
|
function FopPaymentMethodItem({
|
|
22091
22126
|
fop,
|
|
22092
22127
|
isActive,
|
|
22093
22128
|
onClick,
|
|
22094
22129
|
testId,
|
|
22095
22130
|
disclaimerLimit,
|
|
22096
|
-
disabled
|
|
22131
|
+
disabled,
|
|
22132
|
+
isBelowMinimum
|
|
22097
22133
|
}) {
|
|
22098
22134
|
const { isUserGeoblocked } = useFunkitUserIp();
|
|
22099
22135
|
const { geoblocked: isQrCodeGeoblocked } = useIsQRCodeTransferEnabled();
|
|
22100
22136
|
const isGeoblocked = isQrCodeGeoblocked || isUserGeoblocked;
|
|
22101
|
-
const isDisabled = disabled || isGeoblocked || !fop.embeddedFlowUrl;
|
|
22137
|
+
const isDisabled = disabled || isGeoblocked || isBelowMinimum || !fop.embeddedFlowUrl;
|
|
22138
|
+
const disabledBadgeReason = getFopDisabledBadgeReason({
|
|
22139
|
+
isDisabled,
|
|
22140
|
+
isGeoblocked,
|
|
22141
|
+
isBelowMinimum
|
|
22142
|
+
});
|
|
22102
22143
|
const { activeTheme, darkTheme: darkTheme2 } = useActiveTheme();
|
|
22103
22144
|
const { t } = useFunkitTranslation();
|
|
22104
22145
|
const isDarkMode = activeTheme === darkTheme2;
|
|
@@ -22127,12 +22168,7 @@ function FopPaymentMethodItem({
|
|
|
22127
22168
|
time: isBankTransfer ? FIAT_PROCESSING_TIME : t("payment.instant")
|
|
22128
22169
|
}),
|
|
22129
22170
|
testId: testId || `fop-${labelText.toLowerCase().replace(/\s+/g, "-")}`,
|
|
22130
|
-
valueIcon:
|
|
22131
|
-
PaymentMethodDisabledBadge,
|
|
22132
|
-
{
|
|
22133
|
-
reason: isGeoblocked ? "geoblocked" : "comingSoon"
|
|
22134
|
-
}
|
|
22135
|
-
) : void 0
|
|
22171
|
+
valueIcon: disabledBadgeReason ? /* @__PURE__ */ React92.createElement(PaymentMethodDisabledBadge, { reason: disabledBadgeReason }) : void 0
|
|
22136
22172
|
}
|
|
22137
22173
|
);
|
|
22138
22174
|
}
|
|
@@ -26661,18 +26697,6 @@ var FALLBACK_FEES = {
|
|
|
26661
26697
|
totalFeesUsd: 0,
|
|
26662
26698
|
totalFeesTokenWithoutGas: 0
|
|
26663
26699
|
};
|
|
26664
|
-
function safeEvaluateWithdrawalSourceTokenBalance(fn) {
|
|
26665
|
-
const raw = fn?.();
|
|
26666
|
-
if (raw == null) {
|
|
26667
|
-
return "0";
|
|
26668
|
-
}
|
|
26669
|
-
const str = String(raw);
|
|
26670
|
-
if (str === "" || Number.isNaN(Number(str)) || Number(str) < 0) {
|
|
26671
|
-
logger.warn("withdrawal:invalidSourceTokenBalance", { raw });
|
|
26672
|
-
return "0";
|
|
26673
|
-
}
|
|
26674
|
-
return str;
|
|
26675
|
-
}
|
|
26676
26700
|
function useWithdrawalAssets(config) {
|
|
26677
26701
|
const enableEmptyWithdrawalSelection = useFeatureGate(
|
|
26678
26702
|
"enable-empty-withdrawal-selection"
|
|
@@ -27401,6 +27425,7 @@ function findSwappedSourceOverride(overrides, source) {
|
|
|
27401
27425
|
}
|
|
27402
27426
|
|
|
27403
27427
|
// src/hooks/queries/useWithdrawFops.ts
|
|
27428
|
+
var SWAPPED_MIN_SELL_EUR = 7;
|
|
27404
27429
|
var useWithdrawFops = (params) => {
|
|
27405
27430
|
const { apiKey } = useFunkitConfig();
|
|
27406
27431
|
const { userInfo } = useGeneralWallet();
|
|
@@ -27430,7 +27455,7 @@ var useWithdrawFops = (params) => {
|
|
|
27430
27455
|
);
|
|
27431
27456
|
const userId = userInfo.id;
|
|
27432
27457
|
const countryCode = userIpInfo?.alpha2;
|
|
27433
|
-
const isEnabled = !!apiKey && !!userId && !!userInfo.address && !!countryCode && !!params.sourceChainId && !!params.sourceTokenAddress && !isSwappedCurrencyCodeLoading;
|
|
27458
|
+
const isEnabled = (params.enabled ?? true) && !!apiKey && !!userId && !!userInfo.address && !!countryCode && !!params.sourceChainId && !!params.sourceTokenAddress && !isSwappedCurrencyCodeLoading;
|
|
27434
27459
|
const query = useQuery21({
|
|
27435
27460
|
// `prefillFiatEmail` is intentionally NOT in the queryKey: it's read inside
|
|
27436
27461
|
// `queryFn` and captured at fetch time, so post-mount changes don't trigger a refetch
|
|
@@ -27445,7 +27470,8 @@ var useWithdrawFops = (params) => {
|
|
|
27445
27470
|
params.sourceChainId,
|
|
27446
27471
|
params.sourceTokenAddress,
|
|
27447
27472
|
acceptedToken.chainId,
|
|
27448
|
-
acceptedToken.address
|
|
27473
|
+
acceptedToken.address,
|
|
27474
|
+
params.defaultMaxAmount
|
|
27449
27475
|
],
|
|
27450
27476
|
queryFn: async () => {
|
|
27451
27477
|
if (!isEnabled) {
|
|
@@ -27464,6 +27490,14 @@ var useWithdrawFops = (params) => {
|
|
|
27464
27490
|
themeConfig,
|
|
27465
27491
|
"useWithdrawFops"
|
|
27466
27492
|
);
|
|
27493
|
+
logger.info("withdrawFops:sellLimits", {
|
|
27494
|
+
sourceChainId: params.sourceChainId,
|
|
27495
|
+
sourceTokenAddress: params.sourceTokenAddress,
|
|
27496
|
+
swappedCurrencyCode,
|
|
27497
|
+
defaultMinAmountEur: SWAPPED_MIN_SELL_EUR,
|
|
27498
|
+
defaultMaxAmountEur: params.defaultMaxAmount,
|
|
27499
|
+
capApplied: params.defaultMaxAmount != null && params.defaultMaxAmount > SWAPPED_MIN_SELL_EUR
|
|
27500
|
+
});
|
|
27467
27501
|
const response = await getFops3({
|
|
27468
27502
|
apiKey,
|
|
27469
27503
|
logger,
|
|
@@ -27484,8 +27518,14 @@ var useWithdrawFops = (params) => {
|
|
|
27484
27518
|
fiatCurrencyCode: swappedCurrencyCode,
|
|
27485
27519
|
sourceToken: acceptedToken,
|
|
27486
27520
|
thirdPartyPaymentConfigs,
|
|
27487
|
-
checkoutLimitsCriteria: {
|
|
27488
|
-
|
|
27521
|
+
checkoutLimitsCriteria: {
|
|
27522
|
+
defaultMinAmount: SWAPPED_MIN_SELL_EUR,
|
|
27523
|
+
// Only cap when the balance clears the minimum — a max at/below
|
|
27524
|
+
// the min is a contradictory range for Swapped's iframe.
|
|
27525
|
+
...params.defaultMaxAmount != null && params.defaultMaxAmount > SWAPPED_MIN_SELL_EUR && {
|
|
27526
|
+
defaultMaxAmount: params.defaultMaxAmount
|
|
27527
|
+
}
|
|
27528
|
+
}
|
|
27489
27529
|
}
|
|
27490
27530
|
]
|
|
27491
27531
|
}
|
|
@@ -27710,7 +27750,8 @@ function FormOfPaymentsContent({
|
|
|
27710
27750
|
exchangeRatesData,
|
|
27711
27751
|
defaultMaxItems,
|
|
27712
27752
|
enableSourceGroupLabels,
|
|
27713
|
-
isDisabled
|
|
27753
|
+
isDisabled,
|
|
27754
|
+
isBelowMinimumBalance
|
|
27714
27755
|
}) {
|
|
27715
27756
|
const { t } = useFunkitTranslation();
|
|
27716
27757
|
const [isExpanded, setIsExpanded] = useState42(false);
|
|
@@ -27760,7 +27801,8 @@ function FormOfPaymentsContent({
|
|
|
27760
27801
|
disclaimerLimit: getFopsLimit(fop, exchangeRatesData),
|
|
27761
27802
|
isActive: selectedFop?.embeddedFlowUrl === fop.embeddedFlowUrl,
|
|
27762
27803
|
onClick: () => onFopSelect(fop),
|
|
27763
|
-
disabled: isDisabled
|
|
27804
|
+
disabled: isDisabled,
|
|
27805
|
+
isBelowMinimum: isBelowMinimumBalance
|
|
27764
27806
|
}
|
|
27765
27807
|
);
|
|
27766
27808
|
if (!enableSourceGroupLabels) {
|
|
@@ -27792,7 +27834,8 @@ function FormOfPaymentsList({
|
|
|
27792
27834
|
onFopSelect,
|
|
27793
27835
|
exchangeRatesData,
|
|
27794
27836
|
enableSourceGroupLabels,
|
|
27795
|
-
isDisabled
|
|
27837
|
+
isDisabled,
|
|
27838
|
+
isBelowMinimumBalance
|
|
27796
27839
|
}) {
|
|
27797
27840
|
const { uiCustomizations } = useFunkitConfig();
|
|
27798
27841
|
const boxClassName = uiCustomizations.enableCompactList ? sourceListCompactBoxStyles : sourceListBoxStyles;
|
|
@@ -27823,7 +27866,8 @@ function FormOfPaymentsList({
|
|
|
27823
27866
|
exchangeRatesData,
|
|
27824
27867
|
defaultMaxItems,
|
|
27825
27868
|
enableSourceGroupLabels,
|
|
27826
|
-
isDisabled
|
|
27869
|
+
isDisabled,
|
|
27870
|
+
isBelowMinimumBalance
|
|
27827
27871
|
}
|
|
27828
27872
|
);
|
|
27829
27873
|
}
|
|
@@ -27874,11 +27918,22 @@ function WithdrawalMethodSelect({
|
|
|
27874
27918
|
onCryptoSelect,
|
|
27875
27919
|
onCashFopSelect,
|
|
27876
27920
|
sourceChainId,
|
|
27877
|
-
sourceTokenAddress
|
|
27921
|
+
sourceTokenAddress,
|
|
27922
|
+
usdBalance = 0
|
|
27878
27923
|
}) {
|
|
27879
27924
|
const { t } = useFunkitTranslation();
|
|
27880
|
-
const withdrawFops = useWithdrawFops({ sourceChainId, sourceTokenAddress });
|
|
27881
27925
|
const exchangeRates = useFiatExchangeRates();
|
|
27926
|
+
const eurRate = getExchangeRate("EUR", exchangeRates.data, 0);
|
|
27927
|
+
const eurMax = eurRate && usdBalance > 0 ? Math.floor(usdBalance * eurRate) : void 0;
|
|
27928
|
+
const cashMinUsd = eurRate ? SWAPPED_MIN_SELL_EUR / eurRate : void 0;
|
|
27929
|
+
const isBelowMinimumBalance = cashMinUsd != null && usdBalance < cashMinUsd;
|
|
27930
|
+
const isAwaitingCap = usdBalance > 0 && exchangeRates.isLoading;
|
|
27931
|
+
const withdrawFops = useWithdrawFops({
|
|
27932
|
+
sourceChainId,
|
|
27933
|
+
sourceTokenAddress,
|
|
27934
|
+
defaultMaxAmount: eurMax,
|
|
27935
|
+
enabled: !isAwaitingCap
|
|
27936
|
+
});
|
|
27882
27937
|
useSwappedPreload(withdrawFops.data);
|
|
27883
27938
|
return /* @__PURE__ */ React139.createElement(Box, { display: "flex", flexDirection: "column", gap: "8" }, /* @__PURE__ */ React139.createElement(
|
|
27884
27939
|
Text,
|
|
@@ -27915,7 +27970,8 @@ function WithdrawalMethodSelect({
|
|
|
27915
27970
|
isLoading: withdrawFops.isLoading || exchangeRates.isLoading,
|
|
27916
27971
|
onFopSelect: onCashFopSelect,
|
|
27917
27972
|
exchangeRatesData: exchangeRates.data,
|
|
27918
|
-
enableSourceGroupLabels: false
|
|
27973
|
+
enableSourceGroupLabels: false,
|
|
27974
|
+
isBelowMinimumBalance
|
|
27919
27975
|
}
|
|
27920
27976
|
));
|
|
27921
27977
|
}
|
|
@@ -28893,6 +28949,11 @@ function WithdrawalModal({
|
|
|
28893
28949
|
{
|
|
28894
28950
|
sourceChainId: activeConfig.sourceChainId,
|
|
28895
28951
|
sourceTokenAddress: activeConfig.sourceTokenAddress,
|
|
28952
|
+
usdBalance: Number(
|
|
28953
|
+
safeEvaluateWithdrawalSourceTokenBalance(
|
|
28954
|
+
withdrawalItem?.withdrawalSourceTokenBalance
|
|
28955
|
+
)
|
|
28956
|
+
),
|
|
28896
28957
|
onCryptoSelect: () => {
|
|
28897
28958
|
logEvent({
|
|
28898
28959
|
eventName: "fw::crypto_address_selected" /* CRYPTO_ADDRESS_SELECTED */,
|
|
@@ -33486,12 +33547,10 @@ function isNadoDirectTransferContext({
|
|
|
33486
33547
|
apiKey,
|
|
33487
33548
|
sourceAsset,
|
|
33488
33549
|
checkoutConfig,
|
|
33550
|
+
isXstockTarget,
|
|
33489
33551
|
wrappedTokenAddress
|
|
33490
33552
|
}) {
|
|
33491
|
-
if (!isNadoCustomer(apiKey)) {
|
|
33492
|
-
return false;
|
|
33493
|
-
}
|
|
33494
|
-
if (!checkoutConfig.customRecipient) {
|
|
33553
|
+
if (!isNadoCustomer(apiKey) || !checkoutConfig.customRecipient || !isXstockTarget) {
|
|
33495
33554
|
return false;
|
|
33496
33555
|
}
|
|
33497
33556
|
const matchesTarget = isTokenEquivalent9({
|
|
@@ -33518,14 +33577,18 @@ function useIsNadoDirectTransferSource() {
|
|
|
33518
33577
|
const { checkoutItem } = useCheckoutContext();
|
|
33519
33578
|
const { data: wrappedTokenAddress } = useXstocksWrappedTokenAddress();
|
|
33520
33579
|
const config = checkoutItem?.initSettings.config;
|
|
33580
|
+
const isXstockTarget = isXStockTargetAsset(
|
|
33581
|
+
getActiveDynamicTargetAsset(config)
|
|
33582
|
+
);
|
|
33521
33583
|
return useCallback37(
|
|
33522
33584
|
(source) => config != null && isNadoDirectTransferContext({
|
|
33523
33585
|
apiKey,
|
|
33524
33586
|
sourceAsset: source,
|
|
33525
33587
|
checkoutConfig: config,
|
|
33588
|
+
isXstockTarget,
|
|
33526
33589
|
wrappedTokenAddress
|
|
33527
33590
|
}),
|
|
33528
|
-
[apiKey, config, wrappedTokenAddress]
|
|
33591
|
+
[apiKey, config, isXstockTarget, wrappedTokenAddress]
|
|
33529
33592
|
);
|
|
33530
33593
|
}
|
|
33531
33594
|
function useNadoDirectTransfer() {
|
|
@@ -40107,10 +40170,11 @@ function useSourceChangeLayout() {
|
|
|
40107
40170
|
customTopComponent,
|
|
40108
40171
|
showCustomTopComponentDivider
|
|
40109
40172
|
} = uiCustomizations.sourceChangeScreen;
|
|
40173
|
+
const { alwaysShowTopDivider } = uiCustomizations;
|
|
40110
40174
|
const dynamicTargetAssets = checkoutItem?.initSettings.config?.dynamicTargetAssetCandidates;
|
|
40111
40175
|
const isTargetAssetSelectable = !!(showTargetAssetSelection && dynamicTargetAssets && dynamicTargetAssets.length > 1);
|
|
40112
40176
|
const showContentDivider = !!customTopComponent && !!showCustomTopComponentDivider || isTargetAssetSelectable && isSwappedEnabled;
|
|
40113
|
-
const cryptoCashToggleMarginTop = customTopComponent && !showContentDivider ? "24" : "0";
|
|
40177
|
+
const cryptoCashToggleMarginTop = customTopComponent && !showContentDivider ? "24" : !customTopComponent && !isTargetAssetSelectable && alwaysShowTopDivider ? "16" : "0";
|
|
40114
40178
|
return {
|
|
40115
40179
|
isTargetAssetSelectable,
|
|
40116
40180
|
showContentDivider,
|
|
@@ -21,11 +21,9 @@ interface UseNadoDirectTransferResult {
|
|
|
21
21
|
isPending: boolean;
|
|
22
22
|
error: CheckoutConfirmationError | null;
|
|
23
23
|
/**
|
|
24
|
-
* Whether this checkout takes the direct-transfer fast-path
|
|
25
|
-
*
|
|
26
|
-
* source
|
|
27
|
-
* or its wrapper on the same chain. False until a source is selected and,
|
|
28
|
-
* for a wrapper source, until the wrapper address resolves.
|
|
24
|
+
* Whether this checkout takes the direct-transfer fast-path — see
|
|
25
|
+
* `isNadoDirectTransferContext`. False until a source is selected and, for a
|
|
26
|
+
* wrapper source, until the wrapper address resolves.
|
|
29
27
|
*/
|
|
30
28
|
isApplicable: boolean;
|
|
31
29
|
}
|
|
@@ -37,22 +35,26 @@ interface NadoDirectTransferContextArgs {
|
|
|
37
35
|
};
|
|
38
36
|
checkoutConfig: Pick<FunkitCheckoutConfig, 'targetChain' | 'targetAsset' | 'customRecipient'>;
|
|
39
37
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
* Whether the target is an xStock asset (`assetClass === 'xstock'`). Gates the
|
|
39
|
+
* fast-path to xStocks so a same-token route like USDT → USDT keeps using Relay.
|
|
40
|
+
*/
|
|
41
|
+
isXstockTarget: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Target token's wrapped version (xStocks `wrapperAddressV2`) on the target
|
|
44
|
+
* chain — a held balance (e.g. wSPYx for SPYx) is an equivalent source. From
|
|
45
|
+
* `useXstocksWrappedTokenAddress`; omit when there's none.
|
|
44
46
|
*/
|
|
45
47
|
wrappedTokenAddress?: string;
|
|
46
48
|
}
|
|
47
49
|
/**
|
|
48
|
-
* True when
|
|
49
|
-
* subaccount DDA), and the source matches the target
|
|
50
|
-
*
|
|
50
|
+
* True when the customer is Nado, the target is an xStock, the checkout has an
|
|
51
|
+
* explicit recipient (the subaccount DDA), and the source matches the target
|
|
52
|
+
* token or its wrapper (same chain) — a direct ERC-20 transfer, not a Relay swap.
|
|
51
53
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
+
* - Customer-gated (not config-driven) to bound blast radius to Nado.
|
|
55
|
+
* - xStocks-gated so a same-token route (USDT → USDT) keeps using Relay.
|
|
54
56
|
*/
|
|
55
|
-
export declare function isNadoDirectTransferContext({ apiKey, sourceAsset, checkoutConfig, wrappedTokenAddress, }: NadoDirectTransferContextArgs): boolean;
|
|
57
|
+
export declare function isNadoDirectTransferContext({ apiKey, sourceAsset, checkoutConfig, isXstockTarget, wrappedTokenAddress, }: NadoDirectTransferContextArgs): boolean;
|
|
56
58
|
/**
|
|
57
59
|
* Predicate over a source asset: does it qualify for the Nado direct-transfer fast-path?
|
|
58
60
|
*/
|
|
@@ -8,6 +8,13 @@ interface FormOfPaymentsListProps {
|
|
|
8
8
|
exchangeRatesData?: ExchangeRates;
|
|
9
9
|
enableSourceGroupLabels: boolean;
|
|
10
10
|
isDisabled?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Withdrawal off-ramp only: balance is below the cash sell minimum, so every
|
|
13
|
+
* cash method is disabled with a "Low Balance" badge. A single flag is enough
|
|
14
|
+
* while all providers share one minimum — switch to a `(fop) => boolean`
|
|
15
|
+
* predicate if per-provider minimums ever diverge.
|
|
16
|
+
*/
|
|
17
|
+
isBelowMinimumBalance?: boolean;
|
|
11
18
|
}
|
|
12
19
|
interface FormOfPaymentSection {
|
|
13
20
|
items: SwappedFormOfPayment[];
|
|
@@ -17,5 +24,5 @@ export declare function getFormOfPaymentSections(fopsData: GetFopsResponse, fopP
|
|
|
17
24
|
primary: FormOfPaymentSection;
|
|
18
25
|
secondary: FormOfPaymentSection;
|
|
19
26
|
};
|
|
20
|
-
export declare function FormOfPaymentsList({ fopsData, isLoading, selectedFop, onFopSelect, exchangeRatesData, enableSourceGroupLabels, isDisabled, }: FormOfPaymentsListProps): React.JSX.Element;
|
|
27
|
+
export declare function FormOfPaymentsList({ fopsData, isLoading, selectedFop, onFopSelect, exchangeRatesData, enableSourceGroupLabels, isDisabled, isBelowMinimumBalance, }: FormOfPaymentsListProps): React.JSX.Element;
|
|
21
28
|
export {};
|
|
@@ -14,7 +14,7 @@ export interface PolymarketPerpsTransferScreenProps {
|
|
|
14
14
|
* below-minimum notice when the destination is Predictions. */
|
|
15
15
|
predictionsMinTransferUsd?: number;
|
|
16
16
|
/** Minimum pUSD to transfer *into* perps (USD). Drives the below-minimum
|
|
17
|
-
* notice when the destination is Perps (e.g. perps'
|
|
17
|
+
* notice when the destination is Perps (e.g. perps' 5 pUSD minimum). */
|
|
18
18
|
perpsMinTransferUsd?: number;
|
|
19
19
|
/** Initial transfer direction. Defaults to Predictions → Perps. */
|
|
20
20
|
initialDirection?: PerpsTransferDirection;
|
|
@@ -5,6 +5,12 @@ interface WithdrawalMethodSelectProps {
|
|
|
5
5
|
onCashFopSelect: (fop: SwappedFormOfPayment) => void;
|
|
6
6
|
sourceChainId: string;
|
|
7
7
|
sourceTokenAddress: string;
|
|
8
|
+
/**
|
|
9
|
+
* Source-token balance in USD. MVP source is USDG (≈ $1) so the token balance
|
|
10
|
+
* ≈ USD; non-stable sources (e.g. ETH) would need `balance × USD price`.
|
|
11
|
+
* Omit/0 when unknown — no cap is sent and the iframe stays uncapped.
|
|
12
|
+
*/
|
|
13
|
+
usdBalance?: number;
|
|
8
14
|
}
|
|
9
|
-
export declare function WithdrawalMethodSelect({ onCryptoSelect, onCashFopSelect, sourceChainId, sourceTokenAddress, }: WithdrawalMethodSelectProps): React.JSX.Element;
|
|
15
|
+
export declare function WithdrawalMethodSelect({ onCryptoSelect, onCashFopSelect, sourceChainId, sourceTokenAddress, usdBalance, }: WithdrawalMethodSelectProps): React.JSX.Element;
|
|
10
16
|
export {};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { CustomWithdrawalConfig, FunkitWithdrawalConfig, MultiMethodWithdrawalConfig, WalletWithdrawalConfig } from '../providers/FunkitCheckoutContext';
|
|
2
|
+
/**
|
|
3
|
+
* Evaluates the integrator's `withdrawalSourceTokenBalance` callback to a safe
|
|
4
|
+
* numeric string. Returns `'0'` (with a warn) for missing/empty/NaN/negative
|
|
5
|
+
* values. Shared by the withdrawal amount screen and the Swapped cash cap.
|
|
6
|
+
*/
|
|
7
|
+
export declare function safeEvaluateWithdrawalSourceTokenBalance(fn: (() => string | number) | undefined): string;
|
|
2
8
|
/**
|
|
3
9
|
* Type guard to check if withdrawal config uses wallet-based flow
|
|
4
10
|
*/
|
|
@@ -1,25 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import {
|
|
6
|
-
zerionWallet
|
|
7
|
-
} from "./chunk-SWFF3TWJ.js";
|
|
8
|
-
import {
|
|
9
|
-
tahoWallet
|
|
10
|
-
} from "./chunk-7ZYCBDQ4.js";
|
|
3
|
+
imTokenWallet
|
|
4
|
+
} from "./chunk-WNAGGFMG.js";
|
|
11
5
|
import {
|
|
12
|
-
|
|
13
|
-
} from "./chunk-
|
|
6
|
+
injectedWallet
|
|
7
|
+
} from "./chunk-T6LGKC3F.js";
|
|
14
8
|
import {
|
|
15
9
|
tokenPocketWallet
|
|
16
10
|
} from "./chunk-WKNQMP4A.js";
|
|
17
|
-
import {
|
|
18
|
-
tokenaryWallet
|
|
19
|
-
} from "./chunk-VH3THHJY.js";
|
|
20
11
|
import {
|
|
21
12
|
trustWallet
|
|
22
13
|
} from "./chunk-KCRO2AGO.js";
|
|
14
|
+
import {
|
|
15
|
+
tokenaryWallet
|
|
16
|
+
} from "./chunk-VH3THHJY.js";
|
|
23
17
|
import {
|
|
24
18
|
uniswapWallet
|
|
25
19
|
} from "./chunk-Z3PPW6NC.js";
|
|
@@ -30,17 +24,11 @@ import {
|
|
|
30
24
|
xdefiWallet
|
|
31
25
|
} from "./chunk-JN5I3DNC.js";
|
|
32
26
|
import {
|
|
33
|
-
|
|
34
|
-
} from "./chunk-
|
|
35
|
-
import {
|
|
36
|
-
rainbowWallet
|
|
37
|
-
} from "./chunk-W2LCLDPX.js";
|
|
38
|
-
import {
|
|
39
|
-
ramperWallet
|
|
40
|
-
} from "./chunk-OQB55QXP.js";
|
|
27
|
+
zealWallet
|
|
28
|
+
} from "./chunk-52QXXLDS.js";
|
|
41
29
|
import {
|
|
42
|
-
|
|
43
|
-
} from "./chunk-
|
|
30
|
+
zerionWallet
|
|
31
|
+
} from "./chunk-SWFF3TWJ.js";
|
|
44
32
|
import {
|
|
45
33
|
safeWallet
|
|
46
34
|
} from "./chunk-RCY66YHF.js";
|
|
@@ -50,36 +38,45 @@ import {
|
|
|
50
38
|
import {
|
|
51
39
|
safepalWallet
|
|
52
40
|
} from "./chunk-XCNHV3HS.js";
|
|
41
|
+
import {
|
|
42
|
+
rainbowWallet
|
|
43
|
+
} from "./chunk-W2LCLDPX.js";
|
|
44
|
+
import {
|
|
45
|
+
ramperWallet
|
|
46
|
+
} from "./chunk-OQB55QXP.js";
|
|
53
47
|
import {
|
|
54
48
|
subWallet
|
|
55
49
|
} from "./chunk-NR2OGDHQ.js";
|
|
56
50
|
import {
|
|
57
|
-
|
|
58
|
-
} from "./chunk-
|
|
59
|
-
import {
|
|
60
|
-
mewWallet
|
|
61
|
-
} from "./chunk-MQM45ADF.js";
|
|
51
|
+
tahoWallet
|
|
52
|
+
} from "./chunk-7ZYCBDQ4.js";
|
|
62
53
|
import {
|
|
63
|
-
|
|
64
|
-
} from "./chunk-
|
|
54
|
+
talismanWallet
|
|
55
|
+
} from "./chunk-4DCO3TGL.js";
|
|
65
56
|
import {
|
|
66
57
|
oktoWallet
|
|
67
58
|
} from "./chunk-YWOVAU6O.js";
|
|
59
|
+
import {
|
|
60
|
+
okxWallet
|
|
61
|
+
} from "./chunk-KI5Y2BBF.js";
|
|
68
62
|
import {
|
|
69
63
|
omniWallet
|
|
70
64
|
} from "./chunk-2CX7LX4J.js";
|
|
71
|
-
import {
|
|
72
|
-
oneKeyWallet
|
|
73
|
-
} from "./chunk-WVT6BBJH.js";
|
|
74
65
|
import {
|
|
75
66
|
oneInchWallet
|
|
76
67
|
} from "./chunk-QG6ZHI7B.js";
|
|
68
|
+
import {
|
|
69
|
+
oneKeyWallet
|
|
70
|
+
} from "./chunk-WVT6BBJH.js";
|
|
77
71
|
import {
|
|
78
72
|
phantomWallet
|
|
79
73
|
} from "./chunk-QY53O7WG.js";
|
|
80
74
|
import {
|
|
81
|
-
|
|
82
|
-
} from "./chunk-
|
|
75
|
+
rabbyWallet
|
|
76
|
+
} from "./chunk-RB66PKPA.js";
|
|
77
|
+
import {
|
|
78
|
+
roninWallet
|
|
79
|
+
} from "./chunk-YQFGVZGR.js";
|
|
83
80
|
import {
|
|
84
81
|
frameWallet
|
|
85
82
|
} from "./chunk-BU3ZAT5X.js";
|
|
@@ -90,41 +87,44 @@ import {
|
|
|
90
87
|
gateWallet
|
|
91
88
|
} from "./chunk-JPN6TWIT.js";
|
|
92
89
|
import {
|
|
93
|
-
|
|
94
|
-
} from "./chunk-
|
|
95
|
-
import {
|
|
96
|
-
injectedWallet
|
|
97
|
-
} from "./chunk-T6LGKC3F.js";
|
|
90
|
+
enkryptWallet
|
|
91
|
+
} from "./chunk-HBQK5RD5.js";
|
|
98
92
|
import {
|
|
99
93
|
kresusWallet
|
|
100
94
|
} from "./chunk-RICTB3FA.js";
|
|
95
|
+
import {
|
|
96
|
+
metaMaskWallet
|
|
97
|
+
} from "./chunk-YO2K4MBH.js";
|
|
101
98
|
import {
|
|
102
99
|
ledgerWallet
|
|
103
100
|
} from "./chunk-RPV27V2Y.js";
|
|
101
|
+
import {
|
|
102
|
+
mewWallet
|
|
103
|
+
} from "./chunk-MQM45ADF.js";
|
|
104
104
|
import {
|
|
105
105
|
clvWallet
|
|
106
106
|
} from "./chunk-OEEGYENV.js";
|
|
107
107
|
import {
|
|
108
|
-
|
|
109
|
-
} from "./chunk-
|
|
110
|
-
import {
|
|
111
|
-
bybitWallet
|
|
112
|
-
} from "./chunk-OX37G4YT.js";
|
|
108
|
+
bitskiWallet
|
|
109
|
+
} from "./chunk-7HRFUZFX.js";
|
|
113
110
|
import {
|
|
114
111
|
coinbaseWallet
|
|
115
112
|
} from "./chunk-2DLDAZRH.js";
|
|
113
|
+
import {
|
|
114
|
+
coin98Wallet
|
|
115
|
+
} from "./chunk-WAHGI5L7.js";
|
|
116
116
|
import {
|
|
117
117
|
coreWallet
|
|
118
118
|
} from "./chunk-4NV5BYRP.js";
|
|
119
|
-
import {
|
|
120
|
-
dawnWallet
|
|
121
|
-
} from "./chunk-G2PHTVL6.js";
|
|
122
119
|
import {
|
|
123
120
|
desigWallet
|
|
124
121
|
} from "./chunk-FW3WZETT.js";
|
|
125
122
|
import {
|
|
126
|
-
|
|
127
|
-
} from "./chunk-
|
|
123
|
+
dawnWallet
|
|
124
|
+
} from "./chunk-G2PHTVL6.js";
|
|
125
|
+
import {
|
|
126
|
+
foxWallet
|
|
127
|
+
} from "./chunk-GUQM4QSL.js";
|
|
128
128
|
import {
|
|
129
129
|
argentWallet
|
|
130
130
|
} from "./chunk-NTMBEOR2.js";
|
|
@@ -134,15 +134,15 @@ import {
|
|
|
134
134
|
import {
|
|
135
135
|
bitgetWallet
|
|
136
136
|
} from "./chunk-TKB2OY6G.js";
|
|
137
|
-
import {
|
|
138
|
-
bitskiWallet
|
|
139
|
-
} from "./chunk-7HRFUZFX.js";
|
|
140
137
|
import {
|
|
141
138
|
bitverseWallet
|
|
142
139
|
} from "./chunk-NSK6A7TI.js";
|
|
143
140
|
import {
|
|
144
141
|
bloomWallet
|
|
145
142
|
} from "./chunk-PJ7Y57EH.js";
|
|
143
|
+
import {
|
|
144
|
+
bybitWallet
|
|
145
|
+
} from "./chunk-OX37G4YT.js";
|
|
146
146
|
import "./chunk-N4IJLYFY.js";
|
|
147
147
|
import {
|
|
148
148
|
braveWallet
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funkit/connect",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.27.1",
|
|
4
4
|
"description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -111,10 +111,10 @@
|
|
|
111
111
|
"ua-parser-js": "^1.0.37",
|
|
112
112
|
"use-debounce": "^10.0.5",
|
|
113
113
|
"uuid": "^11.1.1",
|
|
114
|
-
"@funkit/api-base": "5.
|
|
114
|
+
"@funkit/api-base": "5.1.0",
|
|
115
115
|
"@funkit/chains": "2.1.1",
|
|
116
|
-
"@funkit/connect-core": "1.4.
|
|
117
|
-
"@funkit/fun-relay": "2.
|
|
116
|
+
"@funkit/connect-core": "1.4.1",
|
|
117
|
+
"@funkit/fun-relay": "2.9.0",
|
|
118
118
|
"@funkit/utils": "3.1.0"
|
|
119
119
|
},
|
|
120
120
|
"repository": {
|