@funkit/connect 9.15.1 → 9.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +63 -0
- package/dist/__generated__/default_feature_gates.d.ts +1 -0
- package/dist/{chunk-76E6MOLR.js → chunk-C2DLTEP2.js} +1 -0
- package/dist/{chunk-AVVB5AIE.js → chunk-PPNE44RL.js} +1 -0
- package/dist/clients/aave.d.ts +15 -0
- package/dist/clients/aave.js +29 -4
- package/dist/clients/{chunk-H6F75ULR.js → chunk-3QHYYLVM.js} +59 -39
- package/dist/clients/chunk-JOBMGIG4.js +290 -0
- package/dist/clients/fanatics.css +3458 -3395
- package/dist/clients/fanatics.js +3 -3
- package/dist/clients/lighter.css +3458 -3395
- package/dist/clients/lighter.js +10 -4
- package/dist/clients/polymarket.js +2 -1
- package/dist/components/ApprovalMethodToggle/ApprovalMethodToggle.d.ts +3 -6
- package/dist/components/Box/Box.d.ts +21 -21
- package/dist/components/CopyAddress/CopyAddressButton.d.ts +1 -1
- package/dist/components/CopyAddress/OldCopyAddressButton.d.ts +1 -1
- package/dist/components/Dialog/Dialog.d.ts +11 -1
- package/dist/components/Dropdown/BaseActiveDropdownItem.d.ts +7 -1
- package/dist/components/Dropdown/BaseDropdown.d.ts +1 -1
- package/dist/components/FunCheckoutHistory/AddTokenToWalletButton.css.d.ts +1 -0
- package/dist/components/FunCheckoutHistory/AddTokenToWalletButton.d.ts +47 -0
- package/dist/components/FunCheckoutHistory/FunDirectExecutionHistoryDetail.d.ts +1 -1
- package/dist/components/FunInfoBanner/ChainInfoBanners.d.ts +1 -1
- package/dist/components/FunOptionBox/FunOptionBox.css.d.ts +1 -1
- package/dist/components/FunTransactionSummary/DestinationYieldRows.d.ts +16 -0
- package/dist/components/FunTransactionSummary/PaymentMethodSummary.d.ts +7 -1
- package/dist/components/Icons/CaretDownIcon.d.ts +6 -1
- package/dist/components/ModalErrorState/ModalErrorState.d.ts +24 -0
- package/dist/consts/funkit.d.ts +0 -4
- package/dist/css/sprinkles.css.d.ts +32 -21
- package/dist/domains/checkoutNotifications.d.ts +46 -0
- package/dist/domains/meld.d.ts +0 -2
- package/dist/hooks/queries/useLightningQuote.d.ts +21 -0
- package/dist/hooks/queries/useRecentCheckouts.d.ts +0 -1
- package/dist/hooks/queries/useRecentDeposits.d.ts +0 -21
- package/dist/hooks/track/CheckoutModalEvent.d.ts +5 -1
- package/dist/hooks/useAssetPrice.d.ts +9 -3
- package/dist/hooks/useCheckoutDirectExecutionHistory.d.ts +1 -1
- package/dist/hooks/useIsCheckoutComplete.d.ts +13 -0
- package/dist/index.css +3547 -3466
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4304 -3398
- package/dist/interfaces/identity.d.ts +41 -0
- package/dist/interfaces/logTransport.d.ts +51 -0
- package/dist/interfaces/swapped-transport.d.ts +78 -0
- package/dist/modals/CheckoutModal/CheckoutModalPrefetchedHooks.d.ts +7 -0
- package/dist/modals/CheckoutModal/FunCheckoutStep.d.ts +1 -0
- package/dist/modals/CheckoutModal/InputAmount/InputAmountLoaded.d.ts +1 -1
- package/dist/modals/CheckoutModal/InputAmount/useAaveNativeSupply.d.ts +77 -9
- package/dist/modals/CheckoutModal/InputAmount/useMeld.d.ts +3 -5
- package/dist/modals/CheckoutModal/LightningInvoice/LightningInvoice.d.ts +9 -0
- package/dist/modals/CheckoutModal/LightningInvoice/LightningInvoiceQrCode.d.ts +8 -0
- package/dist/modals/CheckoutModal/SelectAsset/SelectAsset.d.ts +4 -0
- package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +7 -2
- package/dist/modals/CheckoutModal/SourceChange/SourceChangeLoading.d.ts +1 -1
- package/dist/modals/CheckoutModal/TransferToken/CheckoutNotifications.d.ts +0 -6
- package/dist/modals/CheckoutModal/TransferToken/DirectExecutionNotification.d.ts +1 -1
- package/dist/modals/CheckoutModal/TransferToken/types.d.ts +2 -2
- package/dist/modals/CheckoutModal/selectSuccessScreenBackground.d.ts +29 -0
- package/dist/modals/CheckoutModal/stepTransition.d.ts +3 -0
- package/dist/modals/ProfileDetails/FunProfileViews/Home/HomeCheckoutDisplayRow.css.d.ts +1 -1
- package/dist/providers/FunkitCheckoutContext/types.d.ts +41 -0
- package/dist/providers/FunkitConfigContext.d.ts +9 -2
- package/dist/providers/FunkitHistoryContext.d.ts +1 -1
- package/dist/providers/FunkitQuoteContext.d.ts +17 -1
- package/dist/providers/FunkitThemeProvider.d.ts +3 -0
- package/dist/providers/GeneralWalletProvider.d.ts +18 -0
- package/dist/providers/SwappedProvider.d.ts +2 -0
- package/dist/themes/darkTheme.js +1 -1
- package/dist/themes/lightTheme.js +1 -1
- package/dist/transports/iframeSwappedTransport.d.ts +16 -0
- package/dist/utils/address.d.ts +5 -0
- package/dist/utils/assets.d.ts +0 -7
- package/dist/utils/datadogBrowserLogsTransport.d.ts +17 -0
- package/dist/utils/directExecution.d.ts +1 -2
- package/dist/utils/funLogger.d.ts +8 -2
- package/dist/utils/purifyCheckoutHistoryItem.d.ts +15 -1
- package/dist/utils/swapped.d.ts +14 -1
- package/dist/wagmi/chains.d.ts +1 -1
- package/dist/wagmi/hooks.d.ts +1 -1
- package/dist/wallets/walletConnectors/argentWallet/argentWallet.js +3 -3
- package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +4 -4
- package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +4 -4
- package/dist/wallets/walletConnectors/bitskiWallet/bitskiWallet.js +3 -3
- package/dist/wallets/walletConnectors/bitverseWallet/bitverseWallet.js +3 -3
- package/dist/wallets/walletConnectors/bloomWallet/bloomWallet.js +3 -3
- package/dist/wallets/walletConnectors/braveWallet/braveWallet.js +3 -3
- package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +4 -4
- package/dist/wallets/walletConnectors/{chunk-G3RQSCYR.js → chunk-2CX7LX4J.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-OUM6H3WU.js → chunk-2DLDAZRH.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-AZYMJ4C6.js → chunk-2VP2F6EK.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-O7ZCUI2Y.js → chunk-3FCWJRI4.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-T3VMQBBI.js → chunk-4DCO3TGL.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-OD6B2ISG.js → chunk-4T6ZSRJF.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-A5EZBNME.js → chunk-52QXXLDS.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-RZQ4B4Z7.js → chunk-6BW3HLBG.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-AM5MSNVQ.js → chunk-76S7R2ND.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-Y36HPFB3.js → chunk-7HRFUZFX.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-KS5MJNGD.js → chunk-7ZYCBDQ4.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-MTJIPVYB.js → chunk-BU3ZAT5X.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-IRHK6SOW.js → chunk-CCQV2ZET.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-IMNI4AGV.js → chunk-CPI4TD43.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-XVH4JIXB.js → chunk-DS73TZ6O.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-7IEUTLHY.js → chunk-F5XEEVG6.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-TNVLCMJD.js → chunk-FW3WZETT.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-PARFRRNI.js → chunk-G2PHTVL6.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-2DKNXOPL.js → chunk-HBQK5RD5.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-LEAZMT5Y.js → chunk-HNRB7KJU.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-UYW6MV74.js → chunk-HTHAK6XB.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-3K2MFXCO.js → chunk-IGKXZBTA.js} +1 -0
- package/dist/wallets/walletConnectors/{chunk-KSNA53EX.js → chunk-JN5I3DNC.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-YGMU5VWD.js → chunk-MIQTHJ6X.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-DP5ICBEB.js → chunk-MQM45ADF.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-FMVNQKZL.js → chunk-N4IJLYFY.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-RZH4FSX7.js → chunk-NSK6A7TI.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-XTD6OMZP.js → chunk-NTMBEOR2.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-YYYRPQHB.js → chunk-OLZ7626J.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-P4E2ZFQB.js → chunk-OQB55QXP.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-S6R4B763.js → chunk-PJ7Y57EH.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-EUMOVTRQ.js → chunk-QG6ZHI7B.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-57GN4W23.js → chunk-QY53O7WG.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-55VS2NKG.js → chunk-RB3HR4R2.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-7PVUEV4M.js → chunk-RB66PKPA.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-BHAPTB57.js → chunk-RCY66YHF.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-O4IDLNBH.js → chunk-RICTB3FA.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-V4EXM3KB.js → chunk-RPV27V2Y.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-UFYNHHDU.js → chunk-RVOY537T.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-ZL6XCMV5.js → chunk-STVVP43G.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-HPUEYLLS.js → chunk-T6LGKC3F.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-3ZJN3PXP.js → chunk-UK7C2JXW.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-OSOB6QYX.js → chunk-VAPGUPHO.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-R7X5RIO7.js → chunk-VH3THHJY.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-VMMROPXK.js → chunk-VTM6EECM.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-BWLMNATA.js → chunk-WNAGGFMG.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-E3NZE4UP.js → chunk-WVT6BBJH.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-ZJJWGKB6.js → chunk-X6CGV36L.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-J3PJOMO7.js → chunk-YEZM4CK4.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-BBPTPMH7.js → chunk-YWOVAU6O.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-UKSIXGWC.js → chunk-Z3PPW6NC.js} +1 -1
- package/dist/wallets/walletConnectors/{chunk-FWM4KTOV.js → chunk-ZNX4EMPB.js} +4 -4
- package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +4 -4
- package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +4 -4
- package/dist/wallets/walletConnectors/coinbaseWallet/coinbaseWallet.js +2 -2
- package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +4 -4
- package/dist/wallets/walletConnectors/dawnWallet/dawnWallet.js +3 -3
- package/dist/wallets/walletConnectors/desigWallet/desigWallet.js +3 -3
- package/dist/wallets/walletConnectors/enkryptWallet/enkryptWallet.js +3 -3
- package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +4 -4
- package/dist/wallets/walletConnectors/frameWallet/frameWallet.js +3 -3
- package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +4 -4
- package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +4 -4
- package/dist/wallets/walletConnectors/imTokenWallet/imTokenWallet.js +3 -3
- package/dist/wallets/walletConnectors/index.js +77 -77
- package/dist/wallets/walletConnectors/injectedWallet/injectedWallet.js +3 -3
- package/dist/wallets/walletConnectors/kresusWallet/kresusWallet.js +3 -3
- package/dist/wallets/walletConnectors/ledgerWallet/ledgerWallet.js +3 -3
- package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +4 -4
- package/dist/wallets/walletConnectors/mewWallet/mewWallet.js +3 -3
- package/dist/wallets/walletConnectors/oktoWallet/oktoWallet.js +3 -3
- package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +4 -4
- package/dist/wallets/walletConnectors/omniWallet/omniWallet.js +3 -3
- package/dist/wallets/walletConnectors/oneInchWallet/oneInchWallet.js +3 -3
- package/dist/wallets/walletConnectors/oneKeyWallet/oneKeyWallet.js +3 -3
- package/dist/wallets/walletConnectors/phantomWallet/phantomWallet.js +3 -3
- package/dist/wallets/walletConnectors/rabbyWallet/rabbyWallet.js +3 -3
- package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +4 -4
- package/dist/wallets/walletConnectors/ramperWallet/ramperWallet.js +3 -3
- package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +4 -4
- package/dist/wallets/walletConnectors/safeWallet/safeWallet.js +2 -2
- package/dist/wallets/walletConnectors/safeheronWallet/safeheronWallet.js +3 -3
- package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +4 -4
- package/dist/wallets/walletConnectors/subWallet/subWallet.js +4 -4
- package/dist/wallets/walletConnectors/tahoWallet/tahoWallet.js +3 -3
- package/dist/wallets/walletConnectors/talismanWallet/talismanWallet.js +3 -3
- package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +4 -4
- package/dist/wallets/walletConnectors/tokenaryWallet/tokenaryWallet.js +3 -3
- package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +4 -4
- package/dist/wallets/walletConnectors/uniswapWallet/uniswapWallet.js +3 -3
- package/dist/wallets/walletConnectors/walletConnectWallet/walletConnectWallet.js +3 -3
- package/dist/wallets/walletConnectors/xdefiWallet/xdefiWallet.js +3 -3
- package/dist/wallets/walletConnectors/zealWallet/zealWallet.js +3 -3
- package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +4 -4
- package/package.json +5 -6
- package/dist/clients/chunk-PLDXBAAH.js +0 -290
- package/dist/modals/CheckoutModal/SourceChange/EmptyFormOfPaymentsMessage.d.ts +0 -4
- package/dist/modals/CheckoutModal/SourceChange/useUpdateSourceAssetForCard.d.ts +0 -4
- package/dist/modals/CheckoutModal/SwappedIframe/SwappedErrorMessage.d.ts +0 -6
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Address } from 'viem';
|
|
2
|
+
import type { LoginType } from '../utils/userInfo';
|
|
3
|
+
/**
|
|
4
|
+
* Platform-agnostic **user** identity surface consumed by core hooks.
|
|
5
|
+
*
|
|
6
|
+
* Deliberately scoped to who the *end user* is — `apiKey` (the *customer*
|
|
7
|
+
* identity, set by the integrator) is kept on `useFunkitConfig` so the two
|
|
8
|
+
* concerns don't get conflated. Core hooks that need both read each from its
|
|
9
|
+
* own seam.
|
|
10
|
+
*
|
|
11
|
+
* On web this is derived from wagmi + `GeneralWalletProvider`; on React Native
|
|
12
|
+
* it will be derived from host-app props. Widen this surface only when a core
|
|
13
|
+
* hook genuinely needs more — keep it free of DOM- and wagmi-bound types so it
|
|
14
|
+
* can move to `@funkit/connect-core` untouched.
|
|
15
|
+
*/
|
|
16
|
+
export interface FunkitIdentity {
|
|
17
|
+
/**
|
|
18
|
+
* Stable user id used to key user-scoped API calls. Equals the configured
|
|
19
|
+
* `externalUserId` (or a synthetic namespaced id derived from it) when one is
|
|
20
|
+
* present, otherwise the connected wallet address, or the `'0x'` placeholder
|
|
21
|
+
* when neither is present. Mirrors `userInfo.id`.
|
|
22
|
+
*/
|
|
23
|
+
userId: string;
|
|
24
|
+
/**
|
|
25
|
+
* Effective wallet address user-scoped flows transact against, or `''` when
|
|
26
|
+
* there is no connected/trusted address. Distinct from a display address:
|
|
27
|
+
* this is the resolved address (`effectiveAddress`), not `userInfo.address`,
|
|
28
|
+
* which carries the `'0x'` placeholder for guests.
|
|
29
|
+
*/
|
|
30
|
+
walletAddress: Address | '';
|
|
31
|
+
/** How the user authenticated (guest vs web3). */
|
|
32
|
+
loginType: LoginType;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Contract a platform implements to feed identity into core. Each platform
|
|
36
|
+
* supplies a `useIdentity` hook: web wraps wagmi + `GeneralWalletProvider`
|
|
37
|
+
* (see `useIdentity` there); React Native will wrap host-app-provided props.
|
|
38
|
+
*/
|
|
39
|
+
export interface IdentityProvider {
|
|
40
|
+
useIdentity(): FunkitIdentity;
|
|
41
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** Severity levels emitted by `FunLogger`. */
|
|
2
|
+
export type LogLevel = 'info' | 'debug' | 'warn' | 'error';
|
|
3
|
+
/** User tracking consent, mirroring the Datadog browser SDK's values. */
|
|
4
|
+
export type TrackingConsent = 'granted' | 'not-granted';
|
|
5
|
+
/**
|
|
6
|
+
* The structured context `FunLogger` assembles for every record: the caller's
|
|
7
|
+
* data plus the logger's resolved user/session fields. Concrete (rather than
|
|
8
|
+
* `object`) so transport implementors get property access and autocomplete.
|
|
9
|
+
*/
|
|
10
|
+
export interface LogContext {
|
|
11
|
+
/** Caller-supplied structured data for this log line, if any. */
|
|
12
|
+
data?: object;
|
|
13
|
+
apiKey: string | null;
|
|
14
|
+
userId: string | null;
|
|
15
|
+
userName: string | null;
|
|
16
|
+
userAddress: string | null;
|
|
17
|
+
userLoginType: string | null;
|
|
18
|
+
typeLabel: string | null;
|
|
19
|
+
sdkVersion: string | null;
|
|
20
|
+
}
|
|
21
|
+
/** A single fully-assembled log record handed to a transport. */
|
|
22
|
+
export interface LogRecord {
|
|
23
|
+
level: LogLevel;
|
|
24
|
+
title: string;
|
|
25
|
+
/** Assembled by `FunLogger` so transports stay dumb sinks. */
|
|
26
|
+
context: LogContext;
|
|
27
|
+
/** Present only for `error`-level records. */
|
|
28
|
+
error?: Error;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Platform sink for `FunLogger`. The logger (queueing, env detection, level
|
|
32
|
+
* routing, console fallback, context tracking) is platform-agnostic; everything
|
|
33
|
+
* platform-specific about *emitting* lives behind this interface.
|
|
34
|
+
*
|
|
35
|
+
* Part of the React Native split (see docs/connect-rn-architecture.md): web
|
|
36
|
+
* implements it with `DatadogBrowserLogsTransport`, React Native will implement
|
|
37
|
+
* it with a Datadog React Native transport (`@datadog/mobile-react-native`).
|
|
38
|
+
* Kept free of DOM/`@datadog/browser-logs` types so it can move to
|
|
39
|
+
* `@funkit/connect-core` untouched.
|
|
40
|
+
*/
|
|
41
|
+
export interface LogTransport {
|
|
42
|
+
/** Emit one record to the platform sink. */
|
|
43
|
+
log(record: LogRecord): void;
|
|
44
|
+
/**
|
|
45
|
+
* Reflect the resolved environment (e.g. `'development'` | `'production'`).
|
|
46
|
+
* Optional — sinks that don't segment by environment can omit it.
|
|
47
|
+
*/
|
|
48
|
+
setEnv?(environment: string): void;
|
|
49
|
+
/** Reflect user tracking consent. Optional. */
|
|
50
|
+
setTrackingConsent?(consent: TrackingConsent): void;
|
|
51
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { PaymentGroupType } from '@funkit/api-base';
|
|
2
|
+
import type { SwappedTheme } from '../utils/swapped';
|
|
3
|
+
/**
|
|
4
|
+
* Typed contract for the message bridge between the SDK and the embedded
|
|
5
|
+
* Swapped flow. On web this is bridged over an `<iframe>` + `window.postMessage`
|
|
6
|
+
* (see {@link createIframeSwappedTransport}); React Native will bridge the same
|
|
7
|
+
* messages over a `WebView`. Freezing the event catalog here lets both
|
|
8
|
+
* platforms share the `SwappedProvider` state machine and turns any drift in
|
|
9
|
+
* the message shapes into a compile-time error.
|
|
10
|
+
*
|
|
11
|
+
* Reference: the inbound switch in `SwappedIframeController` and the sends in
|
|
12
|
+
* `SwappedProvider`.
|
|
13
|
+
*
|
|
14
|
+
* This module is platform-agnostic and is slated to move to
|
|
15
|
+
* `@funkit/connect-core/interfaces/` during the RN extraction.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Navigation steps reported by the Swapped embed. Open-ended — the embed may
|
|
19
|
+
* emit steps we don't enumerate, which fall through to the default handler.
|
|
20
|
+
*/
|
|
21
|
+
export type SwappedStep = 'EMPTY' | 'KYC_ADDRESS' | 'KYC_AWAITING_IDENTITY' | 'KYC_IDENTITY' | 'KYC_PERSONAL' | 'KYC_SUMSUB' | 'LOGIN_EMAIL' | 'LOGIN_EMAIL_VERIFICATION' | 'PAYMENT' | 'ORDER_CONFIRMATION' | (string & {});
|
|
22
|
+
/**
|
|
23
|
+
* Opaque payloads — the SDK never introspects these, it only forwards them to
|
|
24
|
+
* analytics via `JSON.stringify`. Typed as `unknown` so callers must stringify
|
|
25
|
+
* rather than read fields.
|
|
26
|
+
*/
|
|
27
|
+
export type SwappedErrorPayload = unknown;
|
|
28
|
+
export type SwappedTxPayload = unknown;
|
|
29
|
+
/** embed → parent */
|
|
30
|
+
export type SwappedInboundMessage = {
|
|
31
|
+
type: 'SWAPPED_READY';
|
|
32
|
+
} | {
|
|
33
|
+
type: 'SWAPPED_GO_BACK';
|
|
34
|
+
} | {
|
|
35
|
+
type: 'SWAPPED_CLOSE';
|
|
36
|
+
} | {
|
|
37
|
+
type: 'SWAPPED_NEW_DEPOSIT';
|
|
38
|
+
} | {
|
|
39
|
+
type: 'SWAPPED_ERROR';
|
|
40
|
+
data?: SwappedErrorPayload;
|
|
41
|
+
} | {
|
|
42
|
+
type: 'SWAPPED_NAVIGATION';
|
|
43
|
+
data?: {
|
|
44
|
+
step?: SwappedStep;
|
|
45
|
+
};
|
|
46
|
+
} | {
|
|
47
|
+
type: 'SWAPPED_ORDER_DATA';
|
|
48
|
+
data?: unknown;
|
|
49
|
+
} | {
|
|
50
|
+
type: 'SWAPPED_TRANSACTION_SUCCESSFUL';
|
|
51
|
+
data?: SwappedTxPayload;
|
|
52
|
+
} | {
|
|
53
|
+
type: 'SWAPPED_LOGOUT';
|
|
54
|
+
};
|
|
55
|
+
/** parent → embed */
|
|
56
|
+
export type SwappedOutboundMessage = {
|
|
57
|
+
type: 'SWAPPED_METHOD';
|
|
58
|
+
method: PaymentGroupType;
|
|
59
|
+
} | {
|
|
60
|
+
type: 'SWAPPED_THEME';
|
|
61
|
+
data: SwappedTheme;
|
|
62
|
+
} | {
|
|
63
|
+
type: 'SWAPPED_FOCUS';
|
|
64
|
+
};
|
|
65
|
+
export interface SwappedTransport {
|
|
66
|
+
/**
|
|
67
|
+
* Send a message to the embed. Returns `true` if the message was dispatched,
|
|
68
|
+
* `false` if the embed isn't reachable yet (so callers can mirror today's
|
|
69
|
+
* behavior of logging only on a successful send).
|
|
70
|
+
*/
|
|
71
|
+
send(msg: SwappedOutboundMessage): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Subscribe to messages from the embed. The handler is only invoked for
|
|
74
|
+
* messages whose origin has already been validated by the transport. Returns
|
|
75
|
+
* an unsubscribe function.
|
|
76
|
+
*/
|
|
77
|
+
onMessage(handler: (msg: SwappedInboundMessage) => void): () => void;
|
|
78
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized "fire-and-forget" prefetches that run at modal open so
|
|
3
|
+
* downstream screens read from warm React Query cache. Hooks added here
|
|
4
|
+
* must set a `staleTime` long enough to survive modal close/reopen, or
|
|
5
|
+
* the prefetch is wasted on the next session.
|
|
6
|
+
*/
|
|
7
|
+
export declare function CheckoutModalPrefetchedHooks(): null;
|
|
@@ -7,6 +7,7 @@ export declare enum FunCheckoutStep {
|
|
|
7
7
|
CHECKOUT_COMPLETE = "checkout_complete",
|
|
8
8
|
CHECKOUT_HELP = "checkout_help",
|
|
9
9
|
TRANSFER_TOKEN = "transfer_token",
|
|
10
|
+
LIGHTNING_INVOICE = "lightning_invoice",
|
|
10
11
|
CREATE_FIAT_ACCOUNT = "create_fiat_account",
|
|
11
12
|
BRIDGE_CUSTOMER = "bridge_customer",
|
|
12
13
|
BRIDGE_KYC = "bridge_kyc",
|
|
@@ -14,5 +14,5 @@ interface InputAmountLoadedProps extends ModalStepComponentProps<FunCheckoutStep
|
|
|
14
14
|
/** Live gas price in wei for native token gas buffer, null for ERC-20s */
|
|
15
15
|
gasPriceWei: bigint | null;
|
|
16
16
|
}
|
|
17
|
-
export declare function InputAmountLoaded({ checkoutConfig, modalState, onNext,
|
|
17
|
+
export declare function InputAmountLoaded({ checkoutConfig, modalState, onNext, setModalState, sourceHolding, unitPrice, defaultFiatCurrency, textCustomizations, gasPriceWei, }: InputAmountLoadedProps): React.JSX.Element;
|
|
18
18
|
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Native-supply fast-path: same-token same-chain deposits go straight to the
|
|
3
|
+
* Aave Pool, bypassing Relay. `permitSupported` is exposed because the toggle
|
|
4
|
+
* visibility gate is in `InputAmountLoaded`, not here.
|
|
4
5
|
*/
|
|
6
|
+
import { type ERC712Signature, type SupplyRequest } from '@aave/client';
|
|
7
|
+
import type { ApiFunkitCheckoutConfig } from '@funkit/utils';
|
|
5
8
|
import type { Dnum } from 'dnum';
|
|
6
|
-
import type
|
|
7
|
-
import type { FunkitActiveCheckoutItem } from '../../../providers/FunkitCheckoutContext';
|
|
8
|
-
import type { FunkitCheckoutConfig } from '../../../providers/FunkitCheckoutContext';
|
|
9
|
+
import { type Address, type Hex, type WalletClient } from 'viem';
|
|
10
|
+
import type { FunkitActiveCheckoutItem, FunkitCheckoutConfig } from '../../../providers/FunkitCheckoutContext';
|
|
9
11
|
interface AaveNativeSupplyContextArgs {
|
|
10
12
|
apiKey: string;
|
|
11
13
|
sourceAsset: {
|
|
@@ -30,15 +32,81 @@ export declare function isAaveNativeSupplyContext({ apiKey, sourceAsset, checkou
|
|
|
30
32
|
* raw JS-number string when the Dnum isn't populated (EXACT_OUT path).
|
|
31
33
|
*/
|
|
32
34
|
export declare function formatSupplyAmount(tokenAmountBaseUnit: Dnum | null, fallbackAssetAmount: number | undefined): string;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Base-unit string for the DE record's `fromAmountBaseUnit` /
|
|
37
|
+
* `toAmountBaseUnit`. Dnum present → `[0]` exact. Dnum null
|
|
38
|
+
* (EXACT_OUT) → derive from `assetAmount` + `decimals`. Neither →
|
|
39
|
+
* `'0'` + warn (would corrupt volume metrics).
|
|
40
|
+
*/
|
|
41
|
+
export declare function getSupplyAmountBaseUnit(tokenAmountBaseUnit: Dnum | null, fallbackAssetAmount: number | undefined, decimals: number | null): string;
|
|
42
|
+
/**
|
|
43
|
+
* Serializable checkout config persisted on the Aave native DE record.
|
|
44
|
+
* Overrides the init-time `targetAssetAmount` (undefined on this path —
|
|
45
|
+
* no Relay quote populates it) with the fresh input amount so the success
|
|
46
|
+
* screen's "You receive" doesn't read 0, and drops the non-serializable
|
|
47
|
+
* `generateActionsParams`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function buildAaveNativeSupplyConfig(config: FunkitCheckoutConfig, assetAmount: number): ApiFunkitCheckoutConfig;
|
|
50
|
+
/**
|
|
51
|
+
* USDT's `approve` reverts on a non-zero → non-zero change — zeroing first
|
|
52
|
+
* lets the SDK's approve(amount) succeed. Same quirk handled by the
|
|
53
|
+
* VaultDepositor path (`createAaveSupplyActions`).
|
|
54
|
+
*/
|
|
55
|
+
export declare function resetUsdtAllowanceIfNeeded(walletClient: WalletClient, { owner, market, currency, targetChainNum, }: {
|
|
56
|
+
owner: Address;
|
|
57
|
+
market: Address;
|
|
58
|
+
currency: Address;
|
|
59
|
+
targetChainNum: number;
|
|
60
|
+
}): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* `undefined` user preference (toggle not surfaced) defaults to
|
|
63
|
+
* permit-when-capable — preserves the auto behavior that pre-dated the toggle.
|
|
64
|
+
* An explicit `false` always wins. When `allowanceCoversAmount`, no permit is
|
|
65
|
+
* needed at all (the SDK will return a plain TransactionRequest) — skipping
|
|
66
|
+
* the signature saves the user one popup, matching aave/interface.
|
|
67
|
+
*/
|
|
68
|
+
export declare function shouldUsePermitForSupply(userPreference: boolean | undefined, reservePermitSupported: boolean | undefined, allowanceCoversAmount: boolean): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* `permitSig` presence is what drives the SDK to build a single
|
|
71
|
+
* `supplyWithPermit` tx vs an `ApprovalRequired` plan (approve + supply).
|
|
72
|
+
*/
|
|
73
|
+
export declare function buildAaveSupplyRequest({ targetChainNum, market, currency, humanAmount, walletAddress, permitSig, }: {
|
|
74
|
+
targetChainNum: number;
|
|
75
|
+
market: Address;
|
|
76
|
+
currency: Address;
|
|
77
|
+
humanAmount: string;
|
|
78
|
+
walletAddress: Address;
|
|
79
|
+
permitSig?: ERC712Signature;
|
|
80
|
+
}): SupplyRequest;
|
|
81
|
+
/** Amount inputs passed from the call site (not read from
|
|
82
|
+
* `checkoutItem`, to avoid closure staleness after `flushSync`). */
|
|
83
|
+
export interface AaveNativeSupplyAmount {
|
|
84
|
+
/** `null` in EXACT_OUT mode; see `state.ts:373`. */
|
|
85
|
+
tokenAmountBaseUnit: Dnum | null;
|
|
86
|
+
/** Call site guards `assetAmount === undefined` upstream. */
|
|
87
|
+
assetAmount: number;
|
|
88
|
+
decimals: number | null;
|
|
89
|
+
/** USD the user saw at input. `null` → `0` at the API boundary. */
|
|
90
|
+
usdAmount: number | null;
|
|
35
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Pre-fetches the on-chain ERC-20 allowance from the user to the Aave Pool, so
|
|
94
|
+
* `showApprovalMethodToggle` can hide the toggle when an existing approval
|
|
95
|
+
* already covers the supply amount (matches aave/interface's behavior — a
|
|
96
|
+
* supply that needs no approval/permit is a single tx, no toggle).
|
|
97
|
+
*/
|
|
98
|
+
export declare function useAaveTargetPoolAllowance(checkoutItem: FunkitActiveCheckoutItem | null, owner: Address | undefined): bigint | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* Pre-fetches reserve permit capability so the InputAmount toggle's
|
|
101
|
+
* visibility is decidable synchronously when the user lands there.
|
|
102
|
+
*/
|
|
103
|
+
export declare function useAaveTargetReservePermit(checkoutItem: FunkitActiveCheckoutItem | null): boolean | undefined;
|
|
36
104
|
interface UseAaveNativeSupplyResult {
|
|
37
|
-
submit: (
|
|
105
|
+
submit: (amount: AaveNativeSupplyAmount) => Promise<{
|
|
38
106
|
txHash: Hex;
|
|
39
107
|
} | null>;
|
|
40
108
|
isPending: boolean;
|
|
41
109
|
error: Error | null;
|
|
42
110
|
}
|
|
43
|
-
export declare function useAaveNativeSupply(
|
|
111
|
+
export declare function useAaveNativeSupply(): UseAaveNativeSupplyResult;
|
|
44
112
|
export {};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { MeldQuote } from '@funkit/api-base';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { ErrorNotification } from '../../../components/FunNotification/FunNotification';
|
|
4
4
|
import { FunCheckoutStep, type NextPayload } from '../stepTransition';
|
|
5
|
-
export declare function useMeldUI({ meldEnabled, manuallySelectedQuote, fiatAmount, fiatCurrency, onNext,
|
|
5
|
+
export declare function useMeldUI({ meldEnabled, manuallySelectedQuote, fiatAmount, fiatCurrency, onNext, }: {
|
|
6
6
|
meldEnabled: boolean;
|
|
7
7
|
manuallySelectedQuote: MeldQuote | undefined;
|
|
8
8
|
fiatAmount: number | undefined;
|
|
9
9
|
fiatCurrency: string | undefined;
|
|
10
10
|
onNext: (data: NextPayload<FunCheckoutStep.INPUT_AMOUNT>) => void;
|
|
11
|
-
onClose: () => void;
|
|
12
11
|
}): {
|
|
13
12
|
getMeldFooter: () => React.JSX.Element;
|
|
14
13
|
handleMeldContinue: () => Promise<void>;
|
|
@@ -20,7 +19,7 @@ export declare function useMeld(meldEnabled: boolean, manuallySelectedQuote: Mel
|
|
|
20
19
|
meldQuotesQuery: import("@tanstack/react-query").UseQueryResult<MeldQuote[]> & {
|
|
21
20
|
isOutdated: boolean;
|
|
22
21
|
};
|
|
23
|
-
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("@funkit/api-base").MeldCreateCryptoWidgetResponse, Error, MeldServiceProvider, unknown>;
|
|
22
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("@funkit/api-base").MeldCreateCryptoWidgetResponse, Error, import("@funkit/api-base").MeldServiceProvider, unknown>;
|
|
24
23
|
isMeldLinkPending: boolean;
|
|
25
24
|
meldLimitError: {
|
|
26
25
|
issue: string;
|
|
@@ -29,7 +28,6 @@ export declare function useMeld(meldEnabled: boolean, manuallySelectedQuote: Mel
|
|
|
29
28
|
bestRateQuote: MeldQuote | undefined;
|
|
30
29
|
selectedQuote: MeldQuote | undefined;
|
|
31
30
|
isSelectedQuoteUnavailable: boolean | undefined;
|
|
32
|
-
isMeldMoonpaySelected: boolean;
|
|
33
31
|
isMeldContinueDisabled: boolean | undefined;
|
|
34
32
|
getMeldError: () => ErrorNotification | undefined;
|
|
35
33
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PaymentMethodBitcoinLightningInfo } from '../../../domains/paymentMethods';
|
|
3
|
+
import { type CheckoutModalCommonState, FunCheckoutStep, type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
|
|
4
|
+
export type LightningInvoiceState = CheckoutModalCommonState & {
|
|
5
|
+
paymentMethodInfo: PaymentMethodBitcoinLightningInfo;
|
|
6
|
+
};
|
|
7
|
+
export type LightningInvoiceNext = Record<string, never>;
|
|
8
|
+
export declare const LightningInvoiceInfo: ModalStepInfo<FunCheckoutStep.LIGHTNING_INVOICE>;
|
|
9
|
+
export declare function LightningInvoice(_props: ModalStepComponentProps<FunCheckoutStep.LIGHTNING_INVOICE>): React.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type BoxProps } from '../../../components/Box/Box';
|
|
3
|
+
interface LightningInvoiceQrCodeProps {
|
|
4
|
+
qrCodeUri: string | undefined;
|
|
5
|
+
marginY?: BoxProps['marginY'];
|
|
6
|
+
}
|
|
7
|
+
export declare function LightningInvoiceQrCode({ qrCodeUri, marginY, }: LightningInvoiceQrCodeProps): React.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import type { IndexedDynamicRoutingConfig } from '@funkit/fun-relay';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { type PaymentMethodAccountInfo, type PaymentMethodBrokerageInfo } from '../../../domains/paymentMethods';
|
|
4
|
+
import type { AssetHoldingsItem } from '../../../domains/wallet';
|
|
3
5
|
import type { TransferTokenDefault } from '../../../hooks/useTokenAndChainDropdown';
|
|
6
|
+
import { type DynamicTargetAssetCandidate } from '../../../providers/FunkitCheckoutContext';
|
|
4
7
|
import { type CheckoutModalCommonState, FunCheckoutStep, type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
|
|
5
8
|
export type SelectAssetState = CheckoutModalCommonState & {
|
|
6
9
|
paymentMethodInfo: PaymentMethodBrokerageInfo | PaymentMethodAccountInfo;
|
|
@@ -12,3 +15,4 @@ export type SelectAssetNext = {
|
|
|
12
15
|
};
|
|
13
16
|
export declare const SelectAssetInfo: ModalStepInfo<FunCheckoutStep.SELECT_ASSET>;
|
|
14
17
|
export declare function SelectAsset({ modalState, onNext, onClose, }: ModalStepComponentProps<FunCheckoutStep.SELECT_ASSET>): React.JSX.Element;
|
|
18
|
+
export declare function isTreatedAsNativeToken(apiKey: string, asset: AssetHoldingsItem, dynamicTargetAssetCandidates: DynamicTargetAssetCandidate[], findDynamicPath: IndexedDynamicRoutingConfig[string]['findPath']): boolean;
|
|
@@ -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 PaymentMethodCardInfo, type PaymentMethodVirtualBankIncompleteInfo } from '../../../domains/paymentMethods';
|
|
3
|
+
import { type ConnectablePaymentMethodInfo, PaymentMethod, type PaymentMethodBitcoinLightningInfo, type PaymentMethodCardInfo, 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,7 +14,12 @@ export type SourceChangeNext = {
|
|
|
14
14
|
brokerageFailed: false;
|
|
15
15
|
} | {
|
|
16
16
|
connectNew: true;
|
|
17
|
-
paymentMethod: Exclude<PaymentMethod, PaymentMethod.CARD | PaymentMethod.VIRTUAL_BANK>;
|
|
17
|
+
paymentMethod: Exclude<PaymentMethod, PaymentMethod.CARD | PaymentMethod.VIRTUAL_BANK | PaymentMethod.BITCOIN_LIGHTNING>;
|
|
18
|
+
brokerageFailed: false;
|
|
19
|
+
} | {
|
|
20
|
+
connectNew: true;
|
|
21
|
+
paymentMethod: PaymentMethod.BITCOIN_LIGHTNING;
|
|
22
|
+
paymentMethodInfo: PaymentMethodBitcoinLightningInfo;
|
|
18
23
|
brokerageFailed: false;
|
|
19
24
|
} | {
|
|
20
25
|
connectNew: true;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import type { DirectExecution } from '@funkit/api-base';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import { type MergedMultiStepDirectExecution } from '../../../hooks/queries/useRecentDeposits';
|
|
4
2
|
import type { CheckoutNotificationsProps } from './types';
|
|
5
3
|
export declare const CheckoutNotifications: ({ onHelp, isVisible, variant, }: CheckoutNotificationsProps) => React.JSX.Element | null;
|
|
6
|
-
/**
|
|
7
|
-
* @returns checkouts that are either not present in the initial checkouts or the data changed somehow
|
|
8
|
-
*/
|
|
9
|
-
export declare const getUpdatedDirectExecutions: (directExecutions: MergedMultiStepDirectExecution[], initialDirectExecutions?: DirectExecution[]) => MergedMultiStepDirectExecution[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TFunction } from 'i18next';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { Address } from 'viem';
|
|
4
|
-
import type { MergedMultiStepDirectExecution } from '../../../
|
|
4
|
+
import type { MergedMultiStepDirectExecution } from '../../../domains/checkoutNotifications';
|
|
5
5
|
interface DirectExecutionNotificationProps {
|
|
6
6
|
directExecution: MergedMultiStepDirectExecution;
|
|
7
7
|
onClose: (id: string) => void;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { CheckoutHistoryItem } from '@funkit/api-base';
|
|
2
2
|
import type { Address } from 'viem';
|
|
3
|
-
import type { MergedMultiStepDirectExecution } from '../../../
|
|
3
|
+
import type { MergedMultiStepDirectExecution, NotificationVariant } from '../../../domains/checkoutNotifications';
|
|
4
|
+
export type { NotificationVariant };
|
|
4
5
|
export type NotificationItem = (MergedMultiStepDirectExecution & {
|
|
5
6
|
isDirectExecution: true;
|
|
6
7
|
}) | (CheckoutHistoryItem & {
|
|
7
8
|
isDirectExecution: false;
|
|
8
9
|
});
|
|
9
|
-
export type NotificationVariant = 'deposit' | 'withdrawal' | 'token_transfer';
|
|
10
10
|
export interface CheckoutNotificationsProps {
|
|
11
11
|
onHelp: (depositAddress: Address) => void;
|
|
12
12
|
/** To control notifications visibility on specific pages, without changing internal dismissal state */
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FunCheckoutStep } from './FunCheckoutStep';
|
|
2
|
+
/**
|
|
3
|
+
* Decide whether the checkout-complete success background should paint.
|
|
4
|
+
*
|
|
5
|
+
* The post-checkout `CHECKOUT_COMPLETE` step is the *page*, which also covers
|
|
6
|
+
* pending and failed states — so step alone is not enough. We additionally
|
|
7
|
+
* require:
|
|
8
|
+
* - the Statsig feature gate to be ON (kill-switch / per-customer rollout),
|
|
9
|
+
* - and the underlying checkout/direct-execution to have actually settled.
|
|
10
|
+
*
|
|
11
|
+
* Pure function (no hooks) so the gating contract is easy to unit-test.
|
|
12
|
+
* The caller is responsible for deriving `isCompleted` from whichever hook
|
|
13
|
+
* is appropriate for the path (deposit-address checkout vs direct execution).
|
|
14
|
+
*/
|
|
15
|
+
export declare function selectSuccessScreenBackground({ step, isCompleted, isFeatureGateEnabled, themeBackgroundOverlay, }: {
|
|
16
|
+
step: FunCheckoutStep;
|
|
17
|
+
/** Whether the underlying checkout/direct-execution has reached COMPLETED. */
|
|
18
|
+
isCompleted: boolean;
|
|
19
|
+
/** Statsig gate (`enable-checkout-success-screen-background`). */
|
|
20
|
+
isFeatureGateEnabled: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The theme variable reference for the success-screen overlay
|
|
23
|
+
* (`themeVars.colors.modalBackgroundCheckoutComplete`). Resolves at runtime
|
|
24
|
+
* to whatever the active theme defines — Aave's translucent gradient
|
|
25
|
+
* stack, or by default the regular modal background (which renders as a
|
|
26
|
+
* no-op overlay).
|
|
27
|
+
*/
|
|
28
|
+
themeBackgroundOverlay: string;
|
|
29
|
+
}): string | undefined;
|
|
@@ -14,6 +14,7 @@ import { type CheckoutHelpState } from './CheckoutHelp/CheckoutHelp';
|
|
|
14
14
|
import { type ConfirmationStepNext, type ConfirmationStepState } from './ConfirmationStep/ConfirmationStep';
|
|
15
15
|
import { FunCheckoutStep } from './FunCheckoutStep';
|
|
16
16
|
import { type InputAmountNext, type InputAmountState } from './InputAmount/InputAmount';
|
|
17
|
+
import { type LightningInvoiceNext, type LightningInvoiceState } from './LightningInvoice/LightningInvoice';
|
|
17
18
|
import { type LoadingAccountNext, type LoadingAccountState } from './LoadingAccount';
|
|
18
19
|
import { type MeldCurrencySelectNext, type MeldCurrencySelectState } from './MeldCurrencySelect/MeldCurrencySelect';
|
|
19
20
|
import { type MeldQuotesNext, type MeldQuotesState } from './MeldQuotes/MeldQuotes';
|
|
@@ -82,6 +83,7 @@ export type CheckoutModalState<S extends FunCheckoutStep = FunCheckoutStep> = {
|
|
|
82
83
|
[FunCheckoutStep.SELECT_ASSET]: SelectAssetState;
|
|
83
84
|
[FunCheckoutStep.SOURCE_CHANGE]: SourceChangeState;
|
|
84
85
|
[FunCheckoutStep.TRANSFER_TOKEN]: TransferTokenState;
|
|
86
|
+
[FunCheckoutStep.LIGHTNING_INVOICE]: LightningInvoiceState;
|
|
85
87
|
[FunCheckoutStep.CREATE_FIAT_ACCOUNT]: VirtualFiatAccountState;
|
|
86
88
|
[FunCheckoutStep.BRIDGE_KYC]: BridgeKycState;
|
|
87
89
|
[FunCheckoutStep.KYC_IFRAME]: KycIframeState;
|
|
@@ -110,6 +112,7 @@ export type NextPayload<S extends FunCheckoutStep = FunCheckoutStep> = {
|
|
|
110
112
|
[FunCheckoutStep.SELECT_ASSET]: SelectAssetNext;
|
|
111
113
|
[FunCheckoutStep.SOURCE_CHANGE]: SourceChangeNext;
|
|
112
114
|
[FunCheckoutStep.TRANSFER_TOKEN]: TransferTokenNext;
|
|
115
|
+
[FunCheckoutStep.LIGHTNING_INVOICE]: LightningInvoiceNext;
|
|
113
116
|
[FunCheckoutStep.CREATE_FIAT_ACCOUNT]: VirtualFiatAccountNext;
|
|
114
117
|
[FunCheckoutStep.BRIDGE_KYC]: BridgeKycNext;
|
|
115
118
|
[FunCheckoutStep.KYC_IFRAME]: KycIframeNext;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const baseStyles: string;
|
|
2
|
-
export declare const homeCheckoutDisplayRowStyle: Record<"
|
|
2
|
+
export declare const homeCheckoutDisplayRowStyle: Record<"hoverBackground" | "defaultBorder" | "defaultBackground", string>;
|
|
@@ -27,6 +27,26 @@ export interface DynamicTargetAssetCandidate extends TokenInfo {
|
|
|
27
27
|
finalizedTokenRate?: number;
|
|
28
28
|
dynamicRoutingId?: string;
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* A token to offer adding to the user's wallet (EIP-747 `wallet_watchAsset`) on
|
|
32
|
+
* the post-checkout success screen.
|
|
33
|
+
*
|
|
34
|
+
* Set this when the token the user ends up holding differs from the checkout's
|
|
35
|
+
* destination token — e.g. a vault receipt token (Aave's aUSDT) minted by a
|
|
36
|
+
* post-swap supply action, where the checkout's `toTokenAddress` is the
|
|
37
|
+
* intermediate underlying (USDT), not the token the wallet should track.
|
|
38
|
+
*
|
|
39
|
+
* Purely a post-checkout UX affordance: nothing in quoting, routing, or amount
|
|
40
|
+
* display reads this field, so setting it cannot perturb a checkout's quote.
|
|
41
|
+
*/
|
|
42
|
+
export interface AddToWalletToken extends TokenInfo {
|
|
43
|
+
/** Symbol shown in the wallet prompt (e.g. "aUSDT"). */
|
|
44
|
+
tokenSymbol: string;
|
|
45
|
+
/** Token decimals. If omitted, the button reads `decimals()` on-chain. */
|
|
46
|
+
decimals?: number;
|
|
47
|
+
/** Optional token icon, passed to the wallet as `image`. */
|
|
48
|
+
iconSrc?: string;
|
|
49
|
+
}
|
|
30
50
|
export declare enum FunCheckoutStartingStep {
|
|
31
51
|
SOURCE_CHANGE = "source_change",
|
|
32
52
|
CONFIRMATION = "confirmation",
|
|
@@ -47,6 +67,20 @@ export interface FunkitCheckoutConfig extends Omit<ApiFunkitCheckoutConfig, 'gen
|
|
|
47
67
|
modalTitle?: string | ((asset: TokenInfo) => string);
|
|
48
68
|
/** Additional information to show in the title of the checkout modal. Blank by default **/
|
|
49
69
|
modalTitleMeta?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Integrator-provided, display-only yield metadata for the destination
|
|
72
|
+
* (e.g. an Aave/Felix/Benqi supply). The SDK never computes these — the
|
|
73
|
+
* integrator resolves them from their own data source and passes a snapshot
|
|
74
|
+
* at checkout-init time. When present, the confirmation screen renders it as
|
|
75
|
+
* Supply APY / Collateralization rows (`DestinationYieldRows`). Omitted
|
|
76
|
+
* segments are simply not rendered.
|
|
77
|
+
*/
|
|
78
|
+
destinationYieldInfo?: {
|
|
79
|
+
/** Supply APY as a display string without the % sign (e.g. "2.79"). */
|
|
80
|
+
supplyApy?: string;
|
|
81
|
+
/** Whether the supply is/will be enabled as collateral for the user. */
|
|
82
|
+
collateralizationEnabled?: boolean;
|
|
83
|
+
};
|
|
50
84
|
/** Icon to show in the checkout modal (50px x 50px). If not specified, no icon will be shown. **/
|
|
51
85
|
iconSrc?: null | string;
|
|
52
86
|
/** Title of the item being checked out. e.g. Staked Ether, XYZ Option, Solar Bond ABC **/
|
|
@@ -86,6 +120,13 @@ export interface FunkitCheckoutConfig extends Omit<ApiFunkitCheckoutConfig, 'gen
|
|
|
86
120
|
* Set via dynamic routing rules.
|
|
87
121
|
*/
|
|
88
122
|
bridgeOverride?: 'across' | 'relay';
|
|
123
|
+
/**
|
|
124
|
+
* Token to offer adding to the user's wallet on the post-checkout success
|
|
125
|
+
* screen via EIP-747 `wallet_watchAsset`. Set when the held token differs
|
|
126
|
+
* from the checkout's destination token (e.g. an Aave aUSDT receipt). See
|
|
127
|
+
* {@link AddToWalletToken}.
|
|
128
|
+
*/
|
|
129
|
+
addToWalletToken?: AddToWalletToken;
|
|
89
130
|
}
|
|
90
131
|
export interface WithdrawalConfigBase {
|
|
91
132
|
/** Title to show in the checkout modal. Defaults to "Checkout" **/
|
|
@@ -127,8 +127,15 @@ export interface FunkitUiCustomizationsConfig {
|
|
|
127
127
|
/** Whether to show "Instant" instead of "< 1 min" for time estimates under 1 minute - defaults to false */
|
|
128
128
|
showInstantTimeEstimate?: boolean;
|
|
129
129
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
130
|
+
* Whether to show the "Selected Route" row (Relay / Across / passthrough).
|
|
131
|
+
* Defaults to false. Providing {@link selectedRouteConfig} also shows the
|
|
132
|
+
* row, for passthrough-branding back-compat.
|
|
133
|
+
*/
|
|
134
|
+
showSelectedRoute?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Passthrough-route branding (image + label) for the "Selected Route" row.
|
|
137
|
+
* Defining it also shows the row; to show the row without passthrough
|
|
138
|
+
* branding, use {@link showSelectedRoute} instead.
|
|
132
139
|
*/
|
|
133
140
|
selectedRouteConfig?: FunkitUiSelectedRouteConfig;
|
|
134
141
|
/**
|
|
@@ -38,7 +38,7 @@ export declare function useCheckoutListenerByCheckoutId(checkoutId: Hex | undefi
|
|
|
38
38
|
/**
|
|
39
39
|
* Internal hook to handle post-checkout, PER-BACKEND-CHECKOUT ITEM.
|
|
40
40
|
*/
|
|
41
|
-
export declare const useFunkitPostCheckoutInternal: (checkoutId: string) => {
|
|
41
|
+
export declare const useFunkitPostCheckoutInternal: (checkoutId: string | undefined) => {
|
|
42
42
|
isLoading: boolean;
|
|
43
43
|
checkoutHistoryInfo: CheckoutHistoryItem | undefined;
|
|
44
44
|
directExecutionInfo: DirectExecution | undefined;
|
|
@@ -45,7 +45,23 @@ interface FunkitQuoteContextInterface extends CheckoutQuoteState {
|
|
|
45
45
|
usePermit: boolean | undefined;
|
|
46
46
|
preferredApprovalMethod: ApprovalMethod;
|
|
47
47
|
setPreferredApprovalMethod: (next: ApprovalMethod) => void;
|
|
48
|
-
|
|
48
|
+
showApprovalMethodToggle: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Per-checkout EIP-2612 permit capability of the target asset. `undefined` =
|
|
51
|
+
* unknown (loading or feature-agnostic — Relay falls back server-side), set
|
|
52
|
+
* by prefetch hooks (e.g., Aave's `useAaveTargetReservePermit`). Folded into
|
|
53
|
+
* `showApprovalMethodToggle` so consumers don't need their own asset gate.
|
|
54
|
+
*/
|
|
55
|
+
targetAssetSupportsPermit: boolean | undefined;
|
|
56
|
+
setTargetAssetSupportsPermit: (value: boolean | undefined) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Current on-chain ERC-20 allowance from the user to the destination spender
|
|
59
|
+
* (e.g. the Aave Pool). When ≥ the supply amount, no approve / permit is
|
|
60
|
+
* needed and the toggle is hidden via `showApprovalMethodToggle`. `undefined`
|
|
61
|
+
* = unknown (loading or not applicable to this flow).
|
|
62
|
+
*/
|
|
63
|
+
targetAssetPoolAllowance: bigint | undefined;
|
|
64
|
+
setTargetAssetPoolAllowance: (value: bigint | undefined) => void;
|
|
49
65
|
}
|
|
50
66
|
export declare function FunkitQuoteProvider({ children }: {
|
|
51
67
|
children: ReactNode;
|
|
@@ -38,6 +38,7 @@ export declare const useActiveTheme: () => {
|
|
|
38
38
|
chainIconBorder: string;
|
|
39
39
|
modalBackdrop: string;
|
|
40
40
|
modalBackground: string;
|
|
41
|
+
modalBackgroundCheckoutComplete: string;
|
|
41
42
|
modalBorder: string;
|
|
42
43
|
offBackground: string;
|
|
43
44
|
offBackgroundInverse: string;
|
|
@@ -563,6 +564,7 @@ export declare const useActiveTheme: () => {
|
|
|
563
564
|
chainIconBorder: string;
|
|
564
565
|
modalBackdrop: string;
|
|
565
566
|
modalBackground: string;
|
|
567
|
+
modalBackgroundCheckoutComplete: string;
|
|
566
568
|
modalBorder: string;
|
|
567
569
|
offBackground: string;
|
|
568
570
|
offBackgroundInverse: string;
|
|
@@ -1086,6 +1088,7 @@ export declare const useActiveTheme: () => {
|
|
|
1086
1088
|
chainIconBorder: string;
|
|
1087
1089
|
modalBackdrop: string;
|
|
1088
1090
|
modalBackground: string;
|
|
1091
|
+
modalBackgroundCheckoutComplete: string;
|
|
1089
1092
|
modalBorder: string;
|
|
1090
1093
|
offBackground: string;
|
|
1091
1094
|
offBackgroundInverse: string;
|