@funkit/connect 9.28.1 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/clients/{chunk-7LKK5QMZ.js → chunk-6PIIYPQK.js} +6 -0
  3. package/dist/clients/{chunk-CGHPNWIF.js → chunk-E3USJY7A.js} +2 -0
  4. package/dist/clients/{chunk-TQVRP3Z2.js → chunk-YFHTV7DT.js} +1 -1
  5. package/dist/clients/{chunk-4O4YAFYK.js → chunk-ZAXSDMDU.js} +3 -3
  6. package/dist/clients/lighter.js +1 -1
  7. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +4 -4
  8. package/dist/clients/polymarket/createPolymarketDepositConfig.js +2 -2
  9. package/dist/clients/polymarket/index.js +4 -4
  10. package/dist/clients/polymarket/polymarket.js +1 -1
  11. package/dist/components/FunPayments/FunPaymentMethods.d.ts +3 -1
  12. package/dist/domains/paymentMethods.d.ts +8 -1
  13. package/dist/domains/relay.d.ts +40 -0
  14. package/dist/hooks/queries/useWithdrawFops.d.ts +1 -0
  15. package/dist/hooks/useNewTokenBanner.d.ts +6 -1
  16. package/dist/hooks/usePaymentSources.d.ts +1 -0
  17. package/dist/index.js +1274 -2017
  18. package/dist/locales/i18n.d.ts +2 -1
  19. package/dist/modals/CheckoutModal/LightningInvoice/LightningInvoice.d.ts +3 -3
  20. package/dist/modals/CheckoutModal/LightningInvoice/LightningInvoiceQrCode.d.ts +3 -2
  21. package/dist/modals/CheckoutModal/SourceChange/FormOfPaymentsList.d.ts +17 -6
  22. package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +7 -2
  23. package/dist/modals/CheckoutModal/stepTransition.d.ts +1 -1
  24. package/dist/providers/FunkitConfigContext.d.ts +2 -0
  25. package/dist/utils/checkout.d.ts +2 -1
  26. package/dist/wallets/walletConnectors/index.js +31 -31
  27. package/package.json +4 -6
  28. package/dist/hooks/useIsTokenWhitelisted.d.ts +0 -30
  29. package/dist/providers/FunkitFlagsProvider.d.ts +0 -26
  30. package/dist/utils/flags/config.d.ts +0 -333
  31. package/dist/utils/flags/endpoint.d.ts +0 -22
  32. package/dist/utils/flags/hash.d.ts +0 -13
  33. package/dist/utils/flags/impl.d.ts +0 -10
  34. package/dist/utils/flags/types.d.ts +0 -49
package/CHANGELOG.md CHANGED
@@ -1,5 +1,58 @@
1
1
  # @funkit/connect
2
2
 
3
+ ## 10.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 6eb4e0d: fix(connect): isolate i18next in a private instance so the SDK no longer initializes or mutates the host app's global i18next singleton
8
+
9
+ Previously `@funkit/connect` called `i18n.use(initReactI18next).init()` on the shared i18next **default singleton** at import time (and `changeLanguage()` on it at runtime via `FunkitI18nProvider`). Because bundlers dedupe i18next to a single instance, this let the SDK "take over" a host app's own i18next — surfacing as an intermittent, build-order-dependent i18next takeover under webpack.
10
+
11
+ The SDK now creates its own instance via `i18next.createInstance()` and no longer registers `initReactI18next`, so importing or rendering funkit never touches your app's i18next or react-i18next's module-global defaults.
12
+
13
+ Migration: if you imported the `i18n` export from `@funkit/connect` expecting it to be your app's shared i18next singleton, it is now a private, funkit-scoped instance — configure your own i18next for your app. Set the SDK's language via the `locale` prop on `FunkitProvider` as documented.
14
+
15
+ ### Patch Changes
16
+
17
+ - a806298: Show a subtle note under the Cash header instead of a large error state when no cash-out methods are available for withdrawal.
18
+ - cac2d42: feat(connect): add cash app payment method
19
+ - e81d5c2: chore: migrate connect consumers off the legacy CDN feature-flag runtime (Statsig is now the flag source)
20
+
21
+ - remove the unused `useIsTokenWhitelisted` hook (no remaining consumers)
22
+ - drop the `useFlags()` loading gate from `LoadingAccount` — checkout no longer blocks on legacy flag fetch
23
+ - inline `AssetSelectionBannerConfig` into `useNewTokenBanner` (already Statsig-backed) so it no longer depends on `~/utils/flags/types`
24
+
25
+ Internal-only — none of these symbols are public exports.
26
+
27
+ - 9e0e045: chore: remove the legacy CDN feature-flag runtime now that Statsig is the flag source
28
+
29
+ The `FunkitFlagsProvider` (CDN-fetched flags with an offline fallback config) is no longer read by any consumer after the [3/n] migration. This removes it entirely:
30
+
31
+ - unmount `FunkitFlagsProvider` from `FunkitProvider`
32
+ - delete `FunkitFlagsProvider.tsx` and the `~/utils/flags/` module (`config`, `endpoint`, `impl`, `hash`, `types`)
33
+
34
+ Internal-only — none of these symbols were public exports. The old SDK flag config remains hosted on S3 for existing (pre-migration) consumers.
35
+
36
+ - 4b8c04b: refactor(connect): consolidate Cash App into synthetic FOP, and warn on unexpected withdrawal synthetic FOP
37
+ - 109a92c: fix(connect): use correct per-token decimals for Solana SPL tokens (USDC/USDT are 6, not 9)
38
+ - 92fad39: refactor(connect): cleanup sourcechange handler logic
39
+ - a78a301: feat(connect): finish Cash App flow
40
+ - 4c446f9: Surface specific error messages for checkout quote failures
41
+ - 5c1dd2b: feat(connect): add Cash App payment method flow
42
+ - d6e6900: refactor: narrow ts types and clean up ternary checks on lightning invoice qrcode
43
+ - c20374e: Broaden WithdrawAmountInput snapshot coverage (insufficient-balance error, USD equivalent). Test-only; no runtime change.
44
+ - 42461ff: Broaden WithdrawContent snapshot coverage (quote loading/error, risk, blacklist, Lighter Fast). Test-only; no runtime change.
45
+ - d1223b9: Add unit test coverage for getErrorNotification mapping and error-source precedence. Test-only; no runtime change.
46
+ - Updated dependencies [cac2d42]
47
+ - Updated dependencies [4b8c04b]
48
+ - Updated dependencies [79c92ec]
49
+ - Updated dependencies [16cc96f]
50
+ - Updated dependencies [4c446f9]
51
+ - Updated dependencies [d27111c]
52
+ - @funkit/connect-core@1.6.1
53
+ - @funkit/chains@2.1.3
54
+ - @funkit/api-base@6.0.0
55
+
3
56
  ## 9.28.1
4
57
 
5
58
  ### Patch Changes
@@ -299,6 +299,12 @@ function createPaymentMethodInfo(params) {
299
299
  title: "Bitcoin Lightning",
300
300
  description: ""
301
301
  };
302
+ case PaymentMethod.CASH_APP_LIGHTNING:
303
+ return {
304
+ paymentMethod: PaymentMethod.CASH_APP_LIGHTNING,
305
+ title: "Cash App",
306
+ description: ""
307
+ };
302
308
  case PaymentMethod.VIRTUAL_BANK:
303
309
  return {
304
310
  paymentMethod: PaymentMethod.VIRTUAL_BANK,
@@ -25,6 +25,7 @@ var DEFAULT_TEXT_CUSTOMIZATIONS = {
25
25
  tokensListTitle: "Your tokens",
26
26
  transferTokens: "Transfer Crypto",
27
27
  bitcoinLightning: "Bitcoin Lightning",
28
+ cashAppLightning: "Cash App",
28
29
  receiveDropdownTitle: "",
29
30
  // Default to empty
30
31
  receiveDropdownLabel: "Asset to Receive",
@@ -112,6 +113,7 @@ function useFunkitConfig() {
112
113
  tokensListTitle: t("textCustomizations.tokensListTitle"),
113
114
  transferTokens: t("textCustomizations.transferTokens"),
114
115
  bitcoinLightning: t("textCustomizations.bitcoinLightning"),
116
+ cashAppLightning: t("textCustomizations.cashAppLightning"),
115
117
  receiveDropdownTitle: t("textCustomizations.receiveDropdownTitle"),
116
118
  receiveDropdownLabel: t("textCustomizations.receiveDropdownLabel"),
117
119
  confirmationScreen: {
@@ -8,7 +8,7 @@ import {
8
8
  VAULT_DEPOSITOR_ABI,
9
9
  VAULT_DEPOSITOR_POLYGON,
10
10
  createPerpsGenerateActionParams
11
- } from "./chunk-7LKK5QMZ.js";
11
+ } from "./chunk-6PIIYPQK.js";
12
12
 
13
13
  // src/clients/polymarket/createPolymarketDepositConfig.ts
14
14
  import { encodeFunctionData, erc20Abi, getAddress, maxUint256 } from "viem";
@@ -3,7 +3,7 @@ import {
3
3
  FunInput,
4
4
  FunSkeletonBlock,
5
5
  TooltipAnchorRefContext
6
- } from "./chunk-CGHPNWIF.js";
6
+ } from "./chunk-E3USJY7A.js";
7
7
  import {
8
8
  Box,
9
9
  Text,
@@ -15,11 +15,11 @@ import {
15
15
  import {
16
16
  POLYMARKET_PERPS_ROUTING_ID,
17
17
  POLYMARKET_PREDICTIONS_ROUTING_ID
18
- } from "./chunk-TQVRP3Z2.js";
18
+ } from "./chunk-YFHTV7DT.js";
19
19
  import {
20
20
  POLYGON_USDCE,
21
21
  PUSD_TOKEN
22
- } from "./chunk-7LKK5QMZ.js";
22
+ } from "./chunk-6PIIYPQK.js";
23
23
  import {
24
24
  logger
25
25
  } from "./chunk-AHYOV7AV.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-2NBYHUIW.js";
5
5
  import {
6
6
  useFunkitConfig
7
- } from "./chunk-CGHPNWIF.js";
7
+ } from "./chunk-E3USJY7A.js";
8
8
  import {
9
9
  Box
10
10
  } from "./chunk-LUHEVXPD.js";
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import {
3
3
  PolymarketDepositAccountDropdown
4
- } from "../chunk-4O4YAFYK.js";
5
- import "../chunk-CGHPNWIF.js";
4
+ } from "../chunk-ZAXSDMDU.js";
5
+ import "../chunk-E3USJY7A.js";
6
6
  import "../chunk-LUHEVXPD.js";
7
7
  import "../chunk-UPZNKPYU.js";
8
8
  import "../chunk-STLOQEN7.js";
9
- import "../chunk-TQVRP3Z2.js";
10
- import "../chunk-7LKK5QMZ.js";
9
+ import "../chunk-YFHTV7DT.js";
10
+ import "../chunk-6PIIYPQK.js";
11
11
  import "../chunk-AHYOV7AV.js";
12
12
  export {
13
13
  PolymarketDepositAccountDropdown
@@ -4,8 +4,8 @@ import {
4
4
  POLYMARKET_PREDICTIONS_ROUTING_ID,
5
5
  createPolymarketDepositConfig,
6
6
  createPredictionsGenerateActionParams
7
- } from "../chunk-TQVRP3Z2.js";
8
- import "../chunk-7LKK5QMZ.js";
7
+ } from "../chunk-YFHTV7DT.js";
8
+ import "../chunk-6PIIYPQK.js";
9
9
  import "../chunk-AHYOV7AV.js";
10
10
  export {
11
11
  POLYMARKET_PERPS_ROUTING_ID,
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  PolymarketDepositAccountDropdown
4
- } from "../chunk-4O4YAFYK.js";
5
- import "../chunk-CGHPNWIF.js";
4
+ } from "../chunk-ZAXSDMDU.js";
5
+ import "../chunk-E3USJY7A.js";
6
6
  import "../chunk-LUHEVXPD.js";
7
7
  import "../chunk-UPZNKPYU.js";
8
8
  import "../chunk-STLOQEN7.js";
@@ -11,7 +11,7 @@ import {
11
11
  POLYMARKET_PREDICTIONS_ROUTING_ID,
12
12
  createPolymarketDepositConfig,
13
13
  createPredictionsGenerateActionParams
14
- } from "../chunk-TQVRP3Z2.js";
14
+ } from "../chunk-YFHTV7DT.js";
15
15
  import {
16
16
  AMOUNT_PLACEHOLDER,
17
17
  COLLATERAL_ONRAMP_ABI,
@@ -22,7 +22,7 @@ import {
22
22
  VAULT_DEPOSITOR_POLYGON,
23
23
  createPerpsGenerateActionParams,
24
24
  createPolymarketWithdrawalConfig
25
- } from "../chunk-7LKK5QMZ.js";
25
+ } from "../chunk-6PIIYPQK.js";
26
26
  import "../chunk-AHYOV7AV.js";
27
27
  export {
28
28
  AMOUNT_PLACEHOLDER,
@@ -9,7 +9,7 @@ import {
9
9
  VAULT_DEPOSITOR_POLYGON,
10
10
  createPerpsGenerateActionParams,
11
11
  createPolymarketWithdrawalConfig
12
- } from "../chunk-7LKK5QMZ.js";
12
+ } from "../chunk-6PIIYPQK.js";
13
13
  import "../chunk-AHYOV7AV.js";
14
14
  export {
15
15
  AMOUNT_PLACEHOLDER,
@@ -39,7 +39,9 @@ interface ConnectedPaymentMethodItemProps {
39
39
  disabled?: boolean;
40
40
  }
41
41
  export declare const AccountBalancePaymentMethodItem: ({ isSelected, showSelectedCheckmark, onSelect, targetChainId, testId, disabled, }: ConnectedPaymentMethodItemProps) => React.JSX.Element;
42
- export declare const BitcoinLightningPaymentMethodItem: ({ isActive, onClick, isClickable, customValueIcon, paymentIcon, }: PaymentMethodItemProps) => React.JSX.Element;
42
+ export declare const BitcoinLightningPaymentMethodItem: ({ isActive, onClick, isClickable, customValueIcon, paymentIcon, isCashApp, }: PaymentMethodItemProps & {
43
+ isCashApp?: boolean;
44
+ }) => React.JSX.Element;
43
45
  export declare const ActiveFiatAccountPaymentMethodItem: ({ isActive, onClick, paymentMethodInfo, customValueIcon, testId, disabled, }: BasePaymentMethodItemProps & {
44
46
  paymentMethodInfo: PaymentMethodVirtualBankInfo;
45
47
  testId?: string;
@@ -25,6 +25,9 @@ export interface PaymentMethodTokenTransferInfo extends PaymentMethodInfoBase {
25
25
  export interface PaymentMethodBitcoinLightningInfo extends PaymentMethodInfoBase {
26
26
  paymentMethod: PaymentMethod.BITCOIN_LIGHTNING;
27
27
  }
28
+ export interface PaymentMethodCashAppLightningInfo extends PaymentMethodInfoBase {
29
+ paymentMethod: PaymentMethod.CASH_APP_LIGHTNING;
30
+ }
28
31
  export interface PaymentMethodVirtualBankIncompleteInfo extends PaymentMethodInfoBase {
29
32
  paymentMethod: PaymentMethod.VIRTUAL_BANK;
30
33
  matchingFiatAccount: BridgeVirtualBankAccount | undefined;
@@ -43,7 +46,7 @@ export declare function isConnectablePaymentMethodInfo(value: unknown): value is
43
46
  * PaymentMethod enum (which also carries Swapped's iframe-only rails).
44
47
  */
45
48
  export declare function isBalanceLessPaymentMethod(paymentMethod: PaymentMethodInfo['paymentMethod']): boolean;
46
- export type PaymentMethodInfo = PaymentMethodCardInfo | PaymentMethodBrokerageInfo | PaymentMethodAccountInfo | PaymentMethodTokenTransferInfo | PaymentMethodBitcoinLightningInfo | PaymentMethodVirtualBankIncompleteInfo;
49
+ export type PaymentMethodInfo = PaymentMethodCardInfo | PaymentMethodBrokerageInfo | PaymentMethodAccountInfo | PaymentMethodTokenTransferInfo | PaymentMethodBitcoinLightningInfo | PaymentMethodCashAppLightningInfo | PaymentMethodVirtualBankIncompleteInfo;
47
50
  interface CardPaymentMethodParams {
48
51
  paymentMethod: PaymentMethod.CARD;
49
52
  /** We also store client's customization in our database :( */
@@ -64,6 +67,9 @@ interface TokenTransferPaymentMethodParams {
64
67
  interface BitcoinLightningPaymentMethodParams {
65
68
  paymentMethod: PaymentMethod.BITCOIN_LIGHTNING;
66
69
  }
70
+ interface CashAppLightningPaymentMethodParams {
71
+ paymentMethod: PaymentMethod.CASH_APP_LIGHTNING;
72
+ }
67
73
  interface VirtualBankPaymentMethodIncompleteParams {
68
74
  paymentMethod: PaymentMethod.VIRTUAL_BANK;
69
75
  matchingFiatAccount: undefined;
@@ -78,6 +84,7 @@ export declare function createPaymentMethodInfo(params: CardPaymentMethodParams)
78
84
  export declare function createPaymentMethodInfo(params: AccountPaymentMethodParams): PaymentMethodAccountInfo;
79
85
  export declare function createPaymentMethodInfo(params: TokenTransferPaymentMethodParams): PaymentMethodTokenTransferInfo;
80
86
  export declare function createPaymentMethodInfo(params: BitcoinLightningPaymentMethodParams): PaymentMethodBitcoinLightningInfo;
87
+ export declare function createPaymentMethodInfo(params: CashAppLightningPaymentMethodParams): PaymentMethodCashAppLightningInfo;
81
88
  export declare function createPaymentMethodInfo(params: VirtualBankPaymentMethodIncompleteParams): PaymentMethodVirtualBankIncompleteInfo;
82
89
  export declare function createPaymentMethodInfo(params: VirtualBankPaymentMethodParams): PaymentMethodVirtualBankInfo;
83
90
  export declare function createPaymentMethodInfo(params: BrokeragePaymentMethodParams): PaymentMethodBrokerageInfo;
@@ -1,5 +1,8 @@
1
1
  import type { FeeBreakdownV2 } from '@funkit/api-base';
2
+ import { RelayQuoteError } from '@funkit/api-base';
2
3
  import type { RelayExecute, RelayQuote } from '@funkit/fun-relay';
4
+ import type { TFunction } from 'i18next';
5
+ import type { ReactNode } from 'react';
3
6
  export type RelayQuoteMetadata = {
4
7
  relayQuote: RelayQuote['metadata']['relayQuote'];
5
8
  feeBreakdown?: FeeBreakdownV2;
@@ -20,4 +23,41 @@ export declare function hasRelayQuoteUnitRate(details: RelayQuoteDetails): boole
20
23
  * transfer or a native token wrap operation.
21
24
  */
22
25
  export declare function isRelayPassthrough(details: RelayQuoteDetails): boolean;
26
+ export declare enum RelayExpectedErrorCodes {
27
+ AMOUNT_TOO_LOW = "AMOUNT_TOO_LOW",
28
+ CHAIN_DISABLED = "CHAIN_DISABLED",
29
+ EXTRA_TXS_NOT_SUPPORTED = "EXTRA_TXS_NOT_SUPPORTED",
30
+ FORBIDDEN = "FORBIDDEN",
31
+ INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
32
+ INSUFFICIENT_LIQUIDITY = "INSUFFICIENT_LIQUIDITY",
33
+ INVALID_ADDRESS = "INVALID_ADDRESS",
34
+ INVALID_EXTRA_TXS = "INVALID_EXTRA_TXS",
35
+ INVALID_GAS_LIMIT_FOR_DEPOSIT_SPECIFIED_TXS = "INVALID_GAS_LIMIT_FOR_DEPOSIT_SPECIFIED_TXS",
36
+ INVALID_INPUT_CURRENCY = "INVALID_INPUT_CURRENCY",
37
+ INVALID_OUTPUT_CURRENCY = "INVALID_OUTPUT_CURRENCY",
38
+ INVALID_SLIPPAGE_TOLERANCE = "INVALID_SLIPPAGE_TOLERANCE",
39
+ NO_INTERNAL_SWAP_ROUTES_FOUND = "NO_INTERNAL_SWAP_ROUTES_FOUND",
40
+ NO_QUOTES = "NO_QUOTES",
41
+ NO_SWAP_ROUTES_FOUND = "NO_SWAP_ROUTES_FOUND",
42
+ ROUTE_TEMPORARILY_RESTRICTED = "ROUTE_TEMPORARILY_RESTRICTED",
43
+ SANCTIONED_CURRENCY = "SANCTIONED_CURRENCY",
44
+ SANCTIONED_WALLET_ADDRESS = "SANCTIONED_WALLET_ADDRESS",
45
+ SWAP_IMPACT_TOO_HIGH = "SWAP_IMPACT_TOO_HIGH",
46
+ UNAUTHORIZED = "UNAUTHORIZED",
47
+ UNSUPPORTED_CHAIN = "UNSUPPORTED_CHAIN",
48
+ UNSUPPORTED_CURRENCY = "UNSUPPORTED_CURRENCY",
49
+ UNSUPPORTED_EXECUTION_TYPE = "UNSUPPORTED_EXECUTION_TYPE",
50
+ UNSUPPORTED_ROUTE = "UNSUPPORTED_ROUTE",
51
+ USER_RECIPIENT_MISMATCH = "USER_RECIPIENT_MISMATCH"
52
+ }
53
+ export declare enum RelayUnexpectedErrorCodes {
54
+ DESTINATION_TX_FAILED = "DESTINATION_TX_FAILED",
55
+ ERC20_ROUTER_ADDRESS_NOT_FOUND = "ERC20_ROUTER_ADDRESS_NOT_FOUND",
56
+ UNKNOWN_ERROR = "UNKNOWN_ERROR",
57
+ SWAP_QUOTE_FAILED = "SWAP_QUOTE_FAILED",
58
+ PERMIT_FAILED = "PERMIT_FAILED"
59
+ }
60
+ export type RelayErrorCodes = RelayExpectedErrorCodes | RelayUnexpectedErrorCodes;
61
+ export declare function getRelayErrorMessages(t: TFunction): Partial<Record<RelayErrorCodes, ReactNode>>;
62
+ export declare function getRelayQuoteErrorDisplayMessage(error: RelayQuoteError, t: TFunction, fallback: ReactNode): ReactNode;
23
63
  export {};
@@ -17,4 +17,5 @@ export declare const useWithdrawFops: (params: {
17
17
  }) => {
18
18
  data: GetFopsResponse | undefined;
19
19
  isLoading: boolean;
20
+ isError: boolean;
20
21
  };
@@ -1,2 +1,7 @@
1
- import type { AssetSelectionBannerConfig } from '../utils/flags/types';
1
+ export type AssetSelectionBannerConfig = {
2
+ chainId: number;
3
+ symbol: string;
4
+ name: string;
5
+ isChainNew?: boolean;
6
+ };
2
7
  export declare function useNewTokenBanner(): AssetSelectionBannerConfig | undefined;
@@ -6,6 +6,7 @@ export declare function usePaymentMethodEnablement(): {
6
6
  isMeldEnabled: boolean;
7
7
  isBrokerageEnabled: boolean;
8
8
  isLightningEnabled: boolean;
9
+ isCashAppLightningEnabled: boolean;
9
10
  };
10
11
  export type PaymentMethodType = 'crypto' | 'fiat' | 'withdraw';
11
12
  export type UnavailablePaymentSource = {