@funkit/connect 9.28.0 → 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 +64 -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 +2 -2
  7. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +5 -5
  8. package/dist/clients/polymarket/createPolymarketDepositConfig.js +2 -2
  9. package/dist/clients/polymarket/index.js +5 -5
  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 +1282 -2020
  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 +23 -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 +36 -36
  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,13 +1,30 @@
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;
22
+ /**
23
+ * Maps a FOP to its disclaimer-limit string. Defaults to the rounded deposit
24
+ * limit (getFopsLimit); the withdrawal off-ramp passes getWithdrawalFopsLimit
25
+ * so the user's exact withdrawable balance isn't rounded down.
26
+ */
27
+ getDisclaimerLimit?: (fop: SwappedFormOfPayment, exchangeRates: ExchangeRates | undefined) => string;
11
28
  /**
12
29
  * Withdrawal off-ramp only: balance is below the cash sell minimum, so every
13
30
  * cash method is disabled with a "Low Balance" badge. A single flag is enough
@@ -17,12 +34,12 @@ interface FormOfPaymentsListProps {
17
34
  isBelowMinimumBalance?: boolean;
18
35
  }
19
36
  interface FormOfPaymentSection {
20
- items: SwappedFormOfPayment[];
37
+ items: ListFormOfPayment[];
21
38
  labelKey: 'sourceChange.mostPopular' | 'sourceChange.savedPaymentMethods' | 'sourceChange.moreOptions';
22
39
  }
23
- export declare function getFormOfPaymentSections(fopsData: GetFopsResponse, fopPriority: readonly string[]): {
40
+ export declare function getFormOfPaymentSections(fopsData: ListFopsData, fopPriority: readonly string[]): {
24
41
  primary: FormOfPaymentSection;
25
42
  secondary: FormOfPaymentSection;
26
43
  };
27
- export declare function FormOfPaymentsList({ fopsData, isLoading, selectedFop, onFopSelect, exchangeRatesData, 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;
28
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
  /**
@@ -8,9 +8,6 @@ import {
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";
@@ -38,36 +38,36 @@ 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";
53
53
  import {
54
54
  subWallet
55
55
  } from "./chunk-X6CGV36L.js";
56
- import {
57
- ledgerWallet
58
- } from "./chunk-RPV27V2Y.js";
59
56
  import {
60
57
  mewWallet
61
58
  } from "./chunk-MQM45ADF.js";
59
+ import {
60
+ oktoWallet
61
+ } from "./chunk-YWOVAU6O.js";
62
+ import {
63
+ kresusWallet
64
+ } from "./chunk-RICTB3FA.js";
62
65
  import {
63
66
  okxWallet
64
67
  } from "./chunk-STVVP43G.js";
65
68
  import {
66
69
  omniWallet
67
70
  } from "./chunk-2CX7LX4J.js";
68
- import {
69
- oktoWallet
70
- } from "./chunk-YWOVAU6O.js";
71
71
  import {
72
72
  oneInchWallet
73
73
  } from "./chunk-QG6ZHI7B.js";
@@ -78,11 +78,14 @@ import {
78
78
  phantomWallet
79
79
  } from "./chunk-QY53O7WG.js";
80
80
  import {
81
- frontierWallet
82
- } from "./chunk-YEZM4CK4.js";
81
+ frameWallet
82
+ } from "./chunk-BU3ZAT5X.js";
83
83
  import {
84
84
  foxWallet
85
85
  } from "./chunk-MIQTHJ6X.js";
86
+ import {
87
+ frontierWallet
88
+ } from "./chunk-YEZM4CK4.js";
86
89
  import {
87
90
  gateWallet
88
91
  } from "./chunk-HNRB7KJU.js";
@@ -92,21 +95,18 @@ import {
92
95
  import {
93
96
  injectedWallet
94
97
  } from "./chunk-T6LGKC3F.js";
95
- import {
96
- kresusWallet
97
- } from "./chunk-RICTB3FA.js";
98
98
  import {
99
99
  metaMaskWallet
100
100
  } from "./chunk-CCQV2ZET.js";
101
101
  import {
102
- frameWallet
103
- } from "./chunk-BU3ZAT5X.js";
102
+ ledgerWallet
103
+ } from "./chunk-RPV27V2Y.js";
104
104
  import {
105
- argentWallet
106
- } from "./chunk-NTMBEOR2.js";
105
+ bybitWallet
106
+ } from "./chunk-F5XEEVG6.js";
107
107
  import {
108
- braveWallet
109
- } from "./chunk-DS73TZ6O.js";
108
+ clvWallet
109
+ } from "./chunk-UK7C2JXW.js";
110
110
  import {
111
111
  coin98Wallet
112
112
  } from "./chunk-6BW3HLBG.js";
@@ -116,21 +116,21 @@ import {
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";
128
+ import {
129
+ argentWallet
130
+ } from "./chunk-NTMBEOR2.js";
128
131
  import {
129
132
  bifrostWallet
130
133
  } from "./chunk-4T6ZSRJF.js";
131
- import {
132
- bitgetWallet
133
- } from "./chunk-CPI4TD43.js";
134
134
  import {
135
135
  bitskiWallet
136
136
  } from "./chunk-7HRFUZFX.js";
@@ -138,15 +138,15 @@ import {
138
138
  bitverseWallet
139
139
  } from "./chunk-NSK6A7TI.js";
140
140
  import {
141
- bloomWallet
142
- } from "./chunk-PJ7Y57EH.js";
143
- import {
144
- bybitWallet
145
- } from "./chunk-F5XEEVG6.js";
141
+ bitgetWallet
142
+ } from "./chunk-CPI4TD43.js";
146
143
  import {
147
- clvWallet
148
- } from "./chunk-UK7C2JXW.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.0",
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.1",
116
- "@funkit/connect-core": "1.5.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>;