@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
@@ -1,4 +1,5 @@
1
- import i18n from 'i18next';
1
+ import { type i18n as I18nInstance } from 'i18next';
2
2
  import type { Locale } from './index';
3
3
  export declare const localeMapping: Record<Locale, string>;
4
+ declare const i18n: I18nInstance;
4
5
  export default i18n;
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- import type { PaymentMethodBitcoinLightningInfo } from '../../../domains/paymentMethods';
2
+ import { type PaymentMethodBitcoinLightningInfo, type PaymentMethodCashAppLightningInfo } from '../../../domains/paymentMethods';
3
3
  import { type CheckoutModalCommonState, FunCheckoutStep, type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
4
4
  export type LightningInvoiceState = CheckoutModalCommonState & {
5
- paymentMethodInfo: PaymentMethodBitcoinLightningInfo;
5
+ paymentMethodInfo: PaymentMethodBitcoinLightningInfo | PaymentMethodCashAppLightningInfo;
6
6
  };
7
7
  export type LightningInvoiceNext = Record<string, never>;
8
8
  export declare const LightningInvoiceInfo: ModalStepInfo<FunCheckoutStep.LIGHTNING_INVOICE>;
9
- export declare function LightningInvoice(_props: ModalStepComponentProps<FunCheckoutStep.LIGHTNING_INVOICE>): React.JSX.Element;
9
+ export declare function LightningInvoice(props: ModalStepComponentProps<FunCheckoutStep.LIGHTNING_INVOICE>): React.JSX.Element;
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
2
  import { type BoxProps } from '../../../components/Box/Box';
3
3
  interface LightningInvoiceQrCodeProps {
4
- qrCodeUri: string | undefined;
4
+ isCashApp?: boolean;
5
+ bolt11?: string;
5
6
  marginY?: BoxProps['marginY'];
6
7
  }
7
- export declare function LightningInvoiceQrCode({ qrCodeUri, marginY, }: LightningInvoiceQrCodeProps): React.JSX.Element;
8
+ export declare function LightningInvoiceQrCode({ isCashApp, bolt11, marginY, }: LightningInvoiceQrCodeProps): React.JSX.Element;
8
9
  export {};
@@ -1,10 +1,21 @@
1
- import type { ExchangeRates, GetFopsResponse, SwappedFormOfPayment } from '@funkit/api-base';
1
+ import type { ExchangeRates, GetFopsResponse, SavedFormOfPayment, SwappedFormOfPayment } from '@funkit/api-base';
2
+ import type { ListFormOfPayment, SyntheticFormOfPayment } from '@funkit/connect-core';
2
3
  import React from 'react';
4
+ /** FOP list normalized to hold real (Swapped) and synthetic methods together. */
5
+ interface ListFopsData {
6
+ genericFormsOfPayments: ListFormOfPayment[];
7
+ savedFormsOfPayments: SavedFormOfPayment[];
8
+ }
3
9
  interface FormOfPaymentsListProps {
4
10
  fopsData?: GetFopsResponse;
5
11
  isLoading: boolean;
6
- selectedFop?: SwappedFormOfPayment | null;
7
- onFopSelect: (fop: SwappedFormOfPayment) => void;
12
+ selectedFop?: ListFormOfPayment | null;
13
+ /**
14
+ * Non-Swapped methods (e.g. Cash App Lightning) to interleave into the list.
15
+ * They flow through the same sort/section/slice machinery as real FOPs.
16
+ */
17
+ syntheticFops?: SyntheticFormOfPayment[];
18
+ onSelect: (fop: ListFormOfPayment) => void;
8
19
  exchangeRatesData?: ExchangeRates;
9
20
  enableSourceGroupLabels: boolean;
10
21
  isDisabled?: boolean;
@@ -23,12 +34,12 @@ interface FormOfPaymentsListProps {
23
34
  isBelowMinimumBalance?: boolean;
24
35
  }
25
36
  interface FormOfPaymentSection {
26
- items: SwappedFormOfPayment[];
37
+ items: ListFormOfPayment[];
27
38
  labelKey: 'sourceChange.mostPopular' | 'sourceChange.savedPaymentMethods' | 'sourceChange.moreOptions';
28
39
  }
29
- export declare function getFormOfPaymentSections(fopsData: GetFopsResponse, fopPriority: readonly string[]): {
40
+ export declare function getFormOfPaymentSections(fopsData: ListFopsData, fopPriority: readonly string[]): {
30
41
  primary: FormOfPaymentSection;
31
42
  secondary: FormOfPaymentSection;
32
43
  };
33
- export declare function FormOfPaymentsList({ fopsData, isLoading, selectedFop, onFopSelect, exchangeRatesData, getDisclaimerLimit, enableSourceGroupLabels, isDisabled, isBelowMinimumBalance, }: FormOfPaymentsListProps): React.JSX.Element;
44
+ export declare function FormOfPaymentsList({ fopsData, isLoading, selectedFop, syntheticFops, onSelect, exchangeRatesData, getDisclaimerLimit, enableSourceGroupLabels, isDisabled, isBelowMinimumBalance, }: FormOfPaymentsListProps): React.JSX.Element;
34
45
  export {};
@@ -1,6 +1,6 @@
1
1
  import { type SwappedFormOfPayment } from '@funkit/api-base';
2
2
  import React from 'react';
3
- import { type ConnectablePaymentMethodInfo, PaymentMethod, type PaymentMethodBitcoinLightningInfo, type PaymentMethodCardInfo, type PaymentMethodVirtualBankIncompleteInfo } from '../../../domains/paymentMethods';
3
+ import { type ConnectablePaymentMethodInfo, PaymentMethod, type PaymentMethodBitcoinLightningInfo, type PaymentMethodCardInfo, type PaymentMethodCashAppLightningInfo, type PaymentMethodVirtualBankIncompleteInfo } from '../../../domains/paymentMethods';
4
4
  import { type PaymentMethodType } from '../../../hooks/usePaymentSources';
5
5
  import { type CheckoutModalCommonState, FunCheckoutStep, type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
6
6
  export type SourceChangeState = CheckoutModalCommonState & {
@@ -14,13 +14,18 @@ export type SourceChangeNext = {
14
14
  brokerageFailed: false;
15
15
  } | {
16
16
  connectNew: true;
17
- paymentMethod: Exclude<PaymentMethod, PaymentMethod.CARD | PaymentMethod.VIRTUAL_BANK | PaymentMethod.BITCOIN_LIGHTNING>;
17
+ paymentMethod: Exclude<PaymentMethod, PaymentMethod.CARD | PaymentMethod.VIRTUAL_BANK | PaymentMethod.BITCOIN_LIGHTNING | PaymentMethod.CASH_APP_LIGHTNING>;
18
18
  brokerageFailed: false;
19
19
  } | {
20
20
  connectNew: true;
21
21
  paymentMethod: PaymentMethod.BITCOIN_LIGHTNING;
22
22
  paymentMethodInfo: PaymentMethodBitcoinLightningInfo;
23
23
  brokerageFailed: false;
24
+ } | {
25
+ connectNew: true;
26
+ paymentMethod: PaymentMethod.CASH_APP_LIGHTNING;
27
+ paymentMethodInfo: PaymentMethodCashAppLightningInfo;
28
+ brokerageFailed: false;
24
29
  } | {
25
30
  connectNew: true;
26
31
  paymentMethod: PaymentMethod.VIRTUAL_BANK;
@@ -91,7 +91,7 @@ export type ModalStepInfo<S extends FunCheckoutStep> = {
91
91
  onNext(state: CheckoutModalState<S>, payload: NextPayload<S>): CheckoutModalState;
92
92
  showFullHeight?: boolean;
93
93
  /** Defaults to checkoutItem.initSettings.config.modalTitle (returning undefined uses default) */
94
- title?(textCustomizations: FunkitTextCustomizationsConfig): string | undefined;
94
+ title?(textCustomizations: FunkitTextCustomizationsConfig, state: CheckoutModalState<S>): string | undefined;
95
95
  /** If title is not defined in config nor with the title() function, this is used instead. Defaults to 'Checkout' */
96
96
  fallbackTitle?: string;
97
97
  };
@@ -14,6 +14,7 @@ export interface FunkitTextCustomizationsConfig {
14
14
  tokensListTitle: string;
15
15
  transferTokens: string;
16
16
  bitcoinLightning: string;
17
+ cashAppLightning: string;
17
18
  receiveDropdownTitle: string;
18
19
  receiveDropdownLabel: string;
19
20
  txStatus?: {
@@ -62,6 +63,7 @@ export interface FunkitTextCustomizationsConfig {
62
63
  paypal?: string;
63
64
  transferTokens?: string;
64
65
  bitcoinLightning?: string;
66
+ cashAppLightning?: string;
65
67
  virtualFiat?: string;
66
68
  };
67
69
  }
@@ -1,3 +1,4 @@
1
+ import type { FunAddress } from '@funkit/api-base';
1
2
  export { isCheckoutHistoryDirectExecution, isCheckoutValid, type MergedCheckoutHistoryItem, toMergedCheckoutHistoryItem, } from '@funkit/connect-core';
2
3
  import { type ApiFunkitCheckoutQuoteResult, type CheckoutQuoteResponse } from '@funkit/utils';
3
4
  import type { Dnum } from 'dnum';
@@ -94,7 +95,7 @@ export declare function getQuoteExchangeRate(config: FunkitCheckoutConfig, baseQ
94
95
  * @param quoteResult - Failed quote results
95
96
  */
96
97
  export declare function getMaxTargetAssetAmountEstimate(sourceAssetBalance: number, config: FunkitCheckoutConfig, quoteResult: FunkitCheckoutQuoteResult, targetAssetDecimals: number): Dnum;
97
- export declare function getTokenDecimals(wagmiConfig: Config, chainId: string, tokenAddress: Address): Promise<number>;
98
+ export declare function getTokenDecimals(wagmiConfig: Config, chainId: string, tokenAddress: FunAddress): Promise<number>;
98
99
  export declare function evaluateCheckoutGenerateActionsParams(config: FunkitCheckoutConfig): Promise<FunkitCheckoutActionParams[]>;
99
100
  export declare function isCheckoutCrFlow(config: FunkitCheckoutConfig): boolean;
100
101
  /**
@@ -1,16 +1,13 @@
1
1
  "use client";
2
2
  import {
3
- xdefiWallet
4
- } from "./chunk-JN5I3DNC.js";
3
+ zealWallet
4
+ } from "./chunk-52QXXLDS.js";
5
5
  import {
6
6
  zerionWallet
7
7
  } from "./chunk-RVOY537T.js";
8
8
  import {
9
9
  tahoWallet
10
10
  } from "./chunk-7ZYCBDQ4.js";
11
- import {
12
- talismanWallet
13
- } from "./chunk-4DCO3TGL.js";
14
11
  import {
15
12
  tokenPocketWallet
16
13
  } from "./chunk-HTHAK6XB.js";
@@ -20,6 +17,9 @@ import {
20
17
  import {
21
18
  trustWallet
22
19
  } from "./chunk-ZNX4EMPB.js";
20
+ import {
21
+ talismanWallet
22
+ } from "./chunk-4DCO3TGL.js";
23
23
  import {
24
24
  uniswapWallet
25
25
  } from "./chunk-Z3PPW6NC.js";
@@ -27,8 +27,8 @@ import {
27
27
  walletConnectWallet
28
28
  } from "./chunk-3FCWJRI4.js";
29
29
  import {
30
- zealWallet
31
- } from "./chunk-52QXXLDS.js";
30
+ xdefiWallet
31
+ } from "./chunk-JN5I3DNC.js";
32
32
  import {
33
33
  rabbyWallet
34
34
  } from "./chunk-RB66PKPA.js";
@@ -38,15 +38,15 @@ import {
38
38
  import {
39
39
  ramperWallet
40
40
  } from "./chunk-OQB55QXP.js";
41
- import {
42
- roninWallet
43
- } from "./chunk-VAPGUPHO.js";
44
41
  import {
45
42
  safeWallet
46
43
  } from "./chunk-RCY66YHF.js";
47
44
  import {
48
45
  safeheronWallet
49
46
  } from "./chunk-76S7R2ND.js";
47
+ import {
48
+ roninWallet
49
+ } from "./chunk-VAPGUPHO.js";
50
50
  import {
51
51
  safepalWallet
52
52
  } from "./chunk-VTM6EECM.js";
@@ -56,12 +56,12 @@ import {
56
56
  import {
57
57
  mewWallet
58
58
  } from "./chunk-MQM45ADF.js";
59
- import {
60
- metaMaskWallet
61
- } from "./chunk-CCQV2ZET.js";
62
59
  import {
63
60
  oktoWallet
64
61
  } from "./chunk-YWOVAU6O.js";
62
+ import {
63
+ kresusWallet
64
+ } from "./chunk-RICTB3FA.js";
65
65
  import {
66
66
  okxWallet
67
67
  } from "./chunk-STVVP43G.js";
@@ -77,12 +77,12 @@ import {
77
77
  import {
78
78
  phantomWallet
79
79
  } from "./chunk-QY53O7WG.js";
80
- import {
81
- foxWallet
82
- } from "./chunk-MIQTHJ6X.js";
83
80
  import {
84
81
  frameWallet
85
82
  } from "./chunk-BU3ZAT5X.js";
83
+ import {
84
+ foxWallet
85
+ } from "./chunk-MIQTHJ6X.js";
86
86
  import {
87
87
  frontierWallet
88
88
  } from "./chunk-YEZM4CK4.js";
@@ -96,11 +96,14 @@ import {
96
96
  injectedWallet
97
97
  } from "./chunk-T6LGKC3F.js";
98
98
  import {
99
- kresusWallet
100
- } from "./chunk-RICTB3FA.js";
99
+ metaMaskWallet
100
+ } from "./chunk-CCQV2ZET.js";
101
101
  import {
102
102
  ledgerWallet
103
103
  } from "./chunk-RPV27V2Y.js";
104
+ import {
105
+ bybitWallet
106
+ } from "./chunk-F5XEEVG6.js";
104
107
  import {
105
108
  clvWallet
106
109
  } from "./chunk-UK7C2JXW.js";
@@ -110,18 +113,15 @@ import {
110
113
  import {
111
114
  coinbaseWallet
112
115
  } from "./chunk-2DLDAZRH.js";
113
- import {
114
- braveWallet
115
- } from "./chunk-DS73TZ6O.js";
116
116
  import {
117
117
  coreWallet
118
118
  } from "./chunk-RB3HR4R2.js";
119
- import {
120
- desigWallet
121
- } from "./chunk-FW3WZETT.js";
122
119
  import {
123
120
  dawnWallet
124
121
  } from "./chunk-G2PHTVL6.js";
122
+ import {
123
+ desigWallet
124
+ } from "./chunk-FW3WZETT.js";
125
125
  import {
126
126
  enkryptWallet
127
127
  } from "./chunk-HBQK5RD5.js";
@@ -131,9 +131,6 @@ import {
131
131
  import {
132
132
  bifrostWallet
133
133
  } from "./chunk-4T6ZSRJF.js";
134
- import {
135
- bitgetWallet
136
- } from "./chunk-CPI4TD43.js";
137
134
  import {
138
135
  bitskiWallet
139
136
  } from "./chunk-7HRFUZFX.js";
@@ -141,12 +138,15 @@ import {
141
138
  bitverseWallet
142
139
  } from "./chunk-NSK6A7TI.js";
143
140
  import {
144
- bloomWallet
145
- } from "./chunk-PJ7Y57EH.js";
141
+ bitgetWallet
142
+ } from "./chunk-CPI4TD43.js";
146
143
  import {
147
- bybitWallet
148
- } from "./chunk-F5XEEVG6.js";
144
+ braveWallet
145
+ } from "./chunk-DS73TZ6O.js";
149
146
  import "./chunk-OLZ7626J.js";
147
+ import {
148
+ bloomWallet
149
+ } from "./chunk-PJ7Y57EH.js";
150
150
  import "./chunk-N4IJLYFY.js";
151
151
  import "./chunk-IGKXZBTA.js";
152
152
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect",
3
- "version": "9.28.1",
3
+ "version": "10.0.0",
4
4
  "description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
5
5
  "files": [
6
6
  "dist",
@@ -46,8 +46,6 @@
46
46
  "wagmi": ">=2.0.0 <=3.6.1"
47
47
  },
48
48
  "devDependencies": {
49
- "@aws-sdk/client-cloudfront": "3.1060.0",
50
- "@aws-sdk/client-s3": "3.1057.0",
51
49
  "@chromatic-com/storybook": "^5.1.2",
52
50
  "@statsig/statsig-node-core": "^0.11.1",
53
51
  "@storybook/addon-docs": "^10.3.6",
@@ -111,9 +109,9 @@
111
109
  "ua-parser-js": "^1.0.37",
112
110
  "use-debounce": "^10.0.5",
113
111
  "uuid": "^11.1.1",
114
- "@funkit/api-base": "5.2.0",
115
- "@funkit/chains": "2.1.2",
116
- "@funkit/connect-core": "1.6.0",
112
+ "@funkit/api-base": "6.0.0",
113
+ "@funkit/chains": "2.1.3",
114
+ "@funkit/connect-core": "1.6.1",
117
115
  "@funkit/fun-relay": "2.9.0",
118
116
  "@funkit/utils": "4.0.0"
119
117
  },
@@ -1,30 +0,0 @@
1
- import { type FlagKey } from '@funkit/utils';
2
- export declare const MATCH_ALL = "*";
3
- export type MatchAll = typeof MATCH_ALL;
4
- export interface TokenWhitelist {
5
- [chainId: string | MatchAll]: string[] | [MatchAll] | MatchAll;
6
- }
7
- /**
8
- * Helper to check if a token is whitelisted for a given flag
9
- * Expects a flag value to be a JSON string of the following format (see {@link TokenWhitelist}):
10
- * ```json
11
- * {
12
- * "137": ["0xaf88d065e77c8cC2239327C5EDb3A432268e5831"],
13
- * "8453": ["0xaf88d065e77c8cC2239327C5EDb3A432268e5831"]
14
- * }
15
- * ```
16
- * Does also support wildcard entries, for example:
17
- * ```json
18
- * {
19
- * "137": ["*"],
20
- * "8453": "*",
21
- * }
22
- * ```
23
- * or even:
24
- * ```json
25
- * {
26
- * "*": "*"
27
- * }
28
- * ```
29
- */
30
- export declare const useIsTokenWhitelisted: <T extends FlagKey>(flagKey: T) => (chainId: string, tokenAddress: string) => boolean;
@@ -1,26 +0,0 @@
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>;