@funkit/connect 4.1.0 → 4.1.2
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 +39 -0
- package/dist/{chunk-TO3BYKDH.js → chunk-C7BDNBKV.js} +2 -1
- package/dist/{chunk-5BMBHTAR.js → chunk-QCYFMAKN.js} +2 -1
- package/dist/{chunk-REN4AGZZ.js → chunk-TKJVOYWW.js} +5 -1
- package/dist/components/Avatar/Avatar.d.ts +2 -1
- package/dist/components/Box/Box.d.ts +7 -7
- package/dist/components/CopyAddress/CopyAddressButton.d.ts +5 -0
- package/dist/components/CopyAddress/CopyDisplayedAddress.d.ts +5 -0
- package/dist/components/CopyAddress/CopyInputDisplayedAddress.d.ts +5 -0
- package/dist/components/CopyAddress/LabelledCopyAddressButton.d.ts +6 -0
- package/dist/components/Dropdown/BaseDropdown.css.d.ts +5 -0
- package/dist/components/Dropdown/BaseDropdown.d.ts +7 -1
- package/dist/components/FunButton/FunButton.css.d.ts +3 -3
- package/dist/components/FunButton/FunLinkButton.d.ts +9 -4
- package/dist/components/FunInput/FunInput.css.d.ts +1 -0
- package/dist/components/FunInput/FunInput.d.ts +0 -1
- package/dist/components/FunNotification/FunNotification.css.d.ts +2 -0
- package/dist/components/FunNotification/FunNotification.d.ts +0 -1
- package/dist/components/FunPaymentMethodItem/FunPaymentMethodItem.css.d.ts +1 -0
- package/dist/components/FunPaymentMethodItem/FunPaymentMethodItem.d.ts +6 -2
- package/dist/components/FunPayments/FunPaymentMethods.d.ts +2 -3
- package/dist/components/FunTooltip/FunTooltip.css.d.ts +4 -0
- package/dist/components/FunTooltip/FunTooltip.d.ts +4 -1
- package/dist/components/FunTransactionSummary/FunTxSummaryComponents.css.d.ts +2 -0
- package/dist/components/FunTransactionSummary/FunTxSummaryComponents.d.ts +0 -1
- package/dist/components/FunTransactionSummary/PaymentFeesSummary.css.d.ts +2 -0
- package/dist/components/FunTransactionSummary/PaymentFeesSummary.d.ts +1 -1
- package/dist/components/FunTransactionSummary/PaymentMethodSummary.d.ts +3 -1
- package/dist/consts/customers.d.ts +0 -4
- package/dist/consts/layout.d.ts +5 -0
- package/dist/css/sprinkles.css.d.ts +9 -7
- package/dist/domains/clientMetadata.d.ts +5 -3
- package/dist/domains/feeEstimate.d.ts +10 -0
- package/dist/domains/paymentMethods.d.ts +1 -0
- package/dist/domains/quote.d.ts +5 -0
- package/dist/hooks/useCheckoutQuoteNotification.d.ts +2 -2
- package/dist/hooks/useCheckoutTimeEstimate.d.ts +7 -0
- package/dist/hooks/useCopyToClipboard.d.ts +4 -0
- package/dist/hooks/usePaymentSources.d.ts +6 -0
- package/dist/index.css +524 -459
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6722 -6902
- package/dist/locales/index.d.ts +0 -3
- package/dist/modals/CheckoutModal/ConfirmationStep/CheckoutPrimaryInfo.d.ts +5 -3
- package/dist/modals/CheckoutModal/ConfirmationStep/useCheckoutQuote.d.ts +1 -1
- package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +1 -3
- package/dist/modals/CheckoutModal/useNewCheckoutQuote.d.ts +7 -0
- package/dist/modals/CheckoutModal/useSourceAssetConfirm.d.ts +4 -2
- package/dist/modals/ProfileDetails/FunProfileViews/Home/HomeCheckoutDisplayRow.d.ts +0 -1
- package/dist/modals/ProfileDetails/FunProfileViews/Home/HomeTokenDisplayRow.d.ts +0 -1
- package/dist/modals/ProfileDetails/FunProfileViews/Home/ProfileTitleSection.d.ts +2 -1
- package/dist/modals/ProfileDetails/FunProfileViews/Home/index.d.ts +1 -1
- package/dist/modals/ProfileDetails/ProfileDetails.d.ts +0 -1
- package/dist/providers/FunkitCheckoutContext.d.ts +7 -34
- package/dist/providers/FunkitFlagsProvider.d.ts +2 -2
- package/dist/providers/FunkitProvider.d.ts +2 -1
- package/dist/providers/FunkitQuoteContext.d.ts +45 -0
- package/dist/providers/FunkitThemeProvider.d.ts +3 -0
- package/dist/providers/GeneralWalletProvider.d.ts +8 -8
- package/dist/providers/provideFunkitConnectChains.d.ts +1 -1
- package/dist/themes/baseTheme.d.ts +2 -1
- package/dist/themes/baseTheme.js +1 -1
- package/dist/themes/darkTheme.js +2 -2
- package/dist/themes/lightTheme.js +2 -2
- package/dist/utils/address.d.ts +6 -0
- package/dist/utils/assets.d.ts +1 -10
- package/dist/utils/checkout.d.ts +4 -13
- package/dist/utils/checkoutHistory.d.ts +1 -1
- package/dist/utils/flags/config.d.ts +19 -46
- package/dist/utils/funLogger.d.ts +3 -1
- package/dist/utils/moonpay.d.ts +12 -0
- package/dist/wallets/walletConnectors/index.js +55 -55
- package/package.json +6 -8
- package/dist/ar_AR-26YWBMAY.js +0 -7
- package/dist/arbitrum-EUTVMZS6.js +0 -7
- package/dist/avalanche-6CKETBV4.js +0 -7
- package/dist/base-FG2B7H5W.js +0 -7
- package/dist/blast-VGAGZQAP.js +0 -7
- package/dist/bsc-BUTATTVT.js +0 -7
- package/dist/chunk-FRCBBARC.js +0 -1184
- package/dist/components/CopyAddress/CopyAddress.d.ts +0 -12
- package/dist/cronos-DEE5V35Y.js +0 -7
- package/dist/dydx-CLPISBCB.js +0 -7
- package/dist/en_US-45SPICME.js +0 -7
- package/dist/es_419-ZOOWMI2O.js +0 -7
- package/dist/ethereum-4YOWVRNC.js +0 -7
- package/dist/fr_FR-FC4AERJX.js +0 -1057
- package/dist/hardhat-WRPL5WKN.js +0 -7
- package/dist/hi_IN-VKOWQKED.js +0 -7
- package/dist/id_ID-JEPISG6J.js +0 -7
- package/dist/ja_JP-GJBWIN4W.js +0 -7
- package/dist/klaytn-NEGYZJPB.js +0 -7
- package/dist/ko_KR-G6COLOAZ.js +0 -7
- package/dist/locales/I18n.d.ts +0 -25
- package/dist/manta-G75LJIRI.js +0 -7
- package/dist/mantle-LQ3XH3KY.js +0 -7
- package/dist/optimism-TIC2YA7E.js +0 -7
- package/dist/polygon-NDHYUKMH.js +0 -7
- package/dist/providers/I18nContext.d.ts +0 -11
- package/dist/pt_BR-52CJXY6T.js +0 -7
- package/dist/ronin-O6KMJHPZ.js +0 -7
- package/dist/ru_RU-AEJUH3PG.js +0 -1057
- package/dist/scroll-G3S4ZVYZ.js +0 -7
- package/dist/th_TH-4TFH5TB7.js +0 -1057
- package/dist/tr_TR-WG4WEQOS.js +0 -1057
- package/dist/uk_UA-2JYNNASB.js +0 -1057
- package/dist/utils/deposit.d.ts +0 -12
- package/dist/utils/isDydxAddress.d.ts +0 -6
- package/dist/xdc-E3X4E3NM.js +0 -7
- package/dist/zetachain-2J22B4NG.js +0 -7
- package/dist/zh_CN-HFGZOTOB.js +0 -7
- package/dist/zkSync-76EOKZ5Y.js +0 -7
- package/dist/zora-73DYEWFN.js +0 -7
package/dist/locales/index.d.ts
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import { I18n } from './I18n';
|
|
2
1
|
export type Locale = 'ar' | 'ar-AR' | 'en' | 'en-US' | 'es' | 'es-419' | 'fr' | 'fr-FR' | 'hi' | 'hi-IN' | 'id' | 'id-ID' | 'ja' | 'ja-JP' | 'ko' | 'ko-KR' | 'pt' | 'pt-BR' | 'ru' | 'ru-RU' | 'th' | 'th-TH' | 'tr' | 'tr-TR' | 'ua' | 'uk-UA' | 'zh' | 'zh-CN';
|
|
3
|
-
export declare const i18n: I18n;
|
|
4
|
-
export declare function setLocale(locale: Locale): Promise<void>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FunkitCheckoutQuoteResult } from '~/domains/quote';
|
|
3
|
+
import type { FunkitCheckoutConfig } from '~/providers/FunkitCheckoutContext';
|
|
3
4
|
interface CheckoutPrimaryInfoProps {
|
|
4
5
|
showTokenAmount?: boolean;
|
|
5
|
-
|
|
6
|
+
config: FunkitCheckoutConfig;
|
|
7
|
+
quote: FunkitCheckoutQuoteResult | null;
|
|
6
8
|
isLoading?: boolean;
|
|
7
9
|
}
|
|
8
|
-
export declare function CheckoutPrimaryInfo({ showTokenAmount,
|
|
10
|
+
export declare function CheckoutPrimaryInfo({ showTokenAmount, quote, config, isLoading, }: CheckoutPrimaryInfoProps): React.JSX.Element;
|
|
9
11
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { type ConnectablePaymentMethodInfo, PaymentMethod, type PaymentMethodCardInfo } from '~/domains/paymentMethods';
|
|
3
3
|
import { type CheckoutModalCommonState, FunCheckoutStep, type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
|
|
4
|
-
type ConnectablePaymentMethodInfo = PaymentMethodAccountInfo | PaymentMethodBrokerageInfo;
|
|
5
4
|
export type SourceChangeState = CheckoutModalCommonState & {
|
|
6
5
|
paymentMethodInfo: ConnectablePaymentMethodInfo | null;
|
|
7
6
|
};
|
|
@@ -24,4 +23,3 @@ export type SourceChangeNext = {
|
|
|
24
23
|
};
|
|
25
24
|
export declare const SourceChangeInfo: ModalStepInfo<FunCheckoutStep.SOURCE_CHANGE>;
|
|
26
25
|
export declare function SourceChange({ modalState, onNext, onClose, }: ModalStepComponentProps<FunCheckoutStep.SOURCE_CHANGE>): React.JSX.Element;
|
|
27
|
-
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type DeepPartial } from '@funkit/utils';
|
|
2
|
+
import { type FunkitActiveCheckoutItem } from '~/providers/FunkitCheckoutContext';
|
|
3
|
+
export declare function useNewCheckoutQuote(): (overridingCheckoutItem?: DeepPartial<FunkitActiveCheckoutItem>) => Promise<{
|
|
4
|
+
baseQuote: import("@funkit/api-base").CheckoutQuoteResponse;
|
|
5
|
+
finalEstimation: import("~/domains/quote").FunkitCheckoutQuoteResult;
|
|
6
|
+
availableAssetAmount: number | undefined;
|
|
7
|
+
}>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Operation } from '@funkit/core';
|
|
2
|
+
import type { FunkitCheckoutQuoteResult } from '~/domains/quote';
|
|
3
|
+
import { type CheckoutQuoteResult } from '~/providers/FunkitQuoteContext';
|
|
2
4
|
import { type PaymentMethodInfo } from '../../domains/paymentMethods';
|
|
3
|
-
import { type
|
|
5
|
+
import { type FunkitActiveCheckoutItem } from '../../providers/FunkitCheckoutContext';
|
|
4
6
|
import { LoginType } from '../../providers/GeneralWalletProvider';
|
|
5
7
|
export interface SourceAssetConfirmed {
|
|
6
8
|
isQuoteSuccess: boolean;
|
|
@@ -24,7 +26,7 @@ export declare function fetchSponsorInitialTransferGasLimit(checkoutItem: Funkit
|
|
|
24
26
|
*
|
|
25
27
|
* USE THIS WITH CAUTION
|
|
26
28
|
**/
|
|
27
|
-
export declare function useTriggerQuoteAndOtherStuffsWithExtremeCaution(onResult: (result: CheckoutQuoteResult) => void, setPreloadedQuoteData?: (quoteData:
|
|
29
|
+
export declare function useTriggerQuoteAndOtherStuffsWithExtremeCaution(onResult: (result: CheckoutQuoteResult) => void, setPreloadedQuoteData?: (quoteData: FunkitCheckoutQuoteResult) => void): {
|
|
28
30
|
isSourceAssetConfirming: boolean;
|
|
29
31
|
triggerAssetConfirm: () => void;
|
|
30
32
|
onSourceAssetConfirmed: (preloadQuoteData?: boolean) => Promise<CheckoutQuoteResult>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { CheckoutHistoryItem } from '@funkit/api-base';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { HistoryContentPages } from '../../../../utils/checkoutHistory';
|
|
4
|
-
export declare const HOME_CHECKOUT_DISPLAY_ROW_HEIGHT = 52;
|
|
5
4
|
export declare const HomeCheckoutDisplayRow: ({ checkoutHistoryItem, onSelect, }: {
|
|
6
5
|
checkoutHistoryItem: CheckoutHistoryItem;
|
|
7
6
|
onSelect: (depositAddress: `0x${string}`, initialPage: HistoryContentPages) => void;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { KnownAssetBalanceInfo } from '~/providers/GeneralWalletProvider';
|
|
3
|
-
export declare const HOME_TOKEN_BALANCE_DISPLAY_ROW_HEIGHT = 52;
|
|
4
3
|
export declare const HomeTokenBalanceDisplayRow: ({ asset, }: {
|
|
5
4
|
asset: KnownAssetBalanceInfo;
|
|
6
5
|
}) => React.JSX.Element;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { Config, UseAccountReturnType } from 'wagmi';
|
|
2
3
|
import type { FunkitUserInfo } from '~/consts/funkit';
|
|
3
4
|
import { FunProfileView } from '../../ProfileDetails';
|
|
4
5
|
export declare const ProfileTitleSection: ({ animateOut, account, userInfo, onChangeView, onLogout, onClose, }: {
|
|
5
6
|
animateOut?: boolean;
|
|
6
|
-
account:
|
|
7
|
+
account: UseAccountReturnType<Config>;
|
|
7
8
|
userInfo: FunkitUserInfo;
|
|
8
9
|
onChangeView: (newView: FunProfileView) => void;
|
|
9
10
|
onLogout: () => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type AnimationState } from '~/hooks/useAnimatedNavigation';
|
|
3
3
|
import { type BaseActivitySelection } from '../../ActivityTraversalContext';
|
|
4
|
-
import {
|
|
4
|
+
import type { FunProfileView } from '../../ProfileDetails';
|
|
5
5
|
export declare enum SelectedHomeTab {
|
|
6
6
|
ASSETS = "assets",
|
|
7
7
|
CHECKOUTS = "checkouts"
|
|
@@ -2,26 +2,8 @@ import { type ApiCheckoutClientMetadata, type ApiFunkitCheckoutConfig, type FunA
|
|
|
2
2
|
import React, { type ReactNode } from 'react';
|
|
3
3
|
import { type Abi, type Address } from 'viem';
|
|
4
4
|
import type { AssetHoldingsItem } from '~/utils/assets';
|
|
5
|
-
import {
|
|
6
|
-
import type
|
|
7
|
-
export type { HistoricalCheckoutItem, ServerCheckoutConfig, } from '~/domains/clientMetadata';
|
|
8
|
-
export type { FunkitCheckoutQuoteResult } from '~/domains/quote';
|
|
9
|
-
export type CheckoutQuoteError = {
|
|
10
|
-
maxTargetAssetAmount: number;
|
|
11
|
-
reason: 'insufficientBalance';
|
|
12
|
-
} | {
|
|
13
|
-
minTargetUsdAmount?: number;
|
|
14
|
-
reason: 'insufficientAmount';
|
|
15
|
-
} | {
|
|
16
|
-
originalError: Error;
|
|
17
|
-
reason: 'internal';
|
|
18
|
-
};
|
|
19
|
-
export type CheckoutQuoteResult = {
|
|
20
|
-
success: true;
|
|
21
|
-
} | {
|
|
22
|
-
error: CheckoutQuoteError;
|
|
23
|
-
success: false;
|
|
24
|
-
};
|
|
5
|
+
import type { PaymentMethodInfo } from '../domains/paymentMethods';
|
|
6
|
+
import { type FunkitCheckoutQuoteResult } from './FunkitHistoryContext';
|
|
25
7
|
export interface FunkitCheckoutActionParams {
|
|
26
8
|
contractAbi: Abi;
|
|
27
9
|
contractAddress: Address;
|
|
@@ -82,6 +64,7 @@ interface UseFunkitCheckoutProps {
|
|
|
82
64
|
/** @optional fires if the checkout requires an active wallet connection. If not specified, defaults to funkit wallet connection. */
|
|
83
65
|
onLoginRequired?: () => void;
|
|
84
66
|
}
|
|
67
|
+
/** Ensures that config is defined */
|
|
85
68
|
interface UseFunkitCheckoutPropsWithFullConfig extends UseFunkitCheckoutProps {
|
|
86
69
|
config: FunkitCheckoutConfig;
|
|
87
70
|
}
|
|
@@ -89,14 +72,6 @@ interface UseFunkitCheckoutPropsWithFullConfig extends UseFunkitCheckoutProps {
|
|
|
89
72
|
* Checkout Item for frontend use
|
|
90
73
|
*/
|
|
91
74
|
export interface FunkitActiveCheckoutItem extends Omit<ApiCheckoutClientMetadata, 'selectedPaymentMethodInfo' | 'initSettings'> {
|
|
92
|
-
/** Whether the checkout quote is being fetched **/
|
|
93
|
-
isQuoting: boolean;
|
|
94
|
-
/** Latest checkout estimated fees and time **/
|
|
95
|
-
latestQuote: null | FunkitCheckoutQuoteResult;
|
|
96
|
-
/** The quotation step message **/
|
|
97
|
-
quoteStepMessage: string;
|
|
98
|
-
/** Error messages associated with checkout quote **/
|
|
99
|
-
quoteErrorMessage: string;
|
|
100
75
|
/** The deposit address provided by server after the checkout is confirmed. If `null`, it is not confirmed yet. **/
|
|
101
76
|
depositAddress: null | Address;
|
|
102
77
|
/** Final settings the checkout was init-ed with **/
|
|
@@ -119,13 +94,10 @@ interface FunkitCheckoutContextInterface {
|
|
|
119
94
|
updateSourceAsset(selectedSource: Omit<AssetHoldingsItem, 'amount' | 'usdAmount' | 'chainSymbolKey'>): void;
|
|
120
95
|
updateTargetAssetAmount(newTargetAssetAmount: number): void;
|
|
121
96
|
updateSelectedPaymentMethodInfo(newPaymentMethodInfo: PaymentMethodInfo): void;
|
|
122
|
-
confirmCheckout(shouldBatchOpBypassInit: boolean, stepMessageSetter: (m: string) => void): Promise<Address>;
|
|
97
|
+
confirmCheckout(shouldBatchOpBypassInit: boolean, quote: FunkitCheckoutQuoteResult, stepMessageSetter: (m: string) => void): Promise<Address>;
|
|
123
98
|
cancelCheckout(depositAddress: Address): Promise<boolean>;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
shellCheckoutItemWithNextQuote: FunkitActiveCheckoutItem;
|
|
127
|
-
}>;
|
|
128
|
-
setCheckoutQuote(quote: FunkitActiveCheckoutItem): void;
|
|
99
|
+
/** @deprecated to be removed after quote migration is finished (historically named setCheckoutQuote) */
|
|
100
|
+
setCheckout: (checkout: FunkitActiveCheckoutItem) => void;
|
|
129
101
|
setCompletedTimestamp(timestampMs: number): void;
|
|
130
102
|
}
|
|
131
103
|
export declare function FunkitCheckoutProvider({ children }: {
|
|
@@ -141,3 +113,4 @@ export declare function useFunkitCheckout(props: UseFunkitCheckoutPropsWithFullC
|
|
|
141
113
|
export declare function useFunkitCheckout(props: UseFunkitCheckoutProps): {
|
|
142
114
|
beginCheckout: (config: FunkitCheckoutConfig) => Promise<void>;
|
|
143
115
|
};
|
|
116
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { type ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { FlagKey } from '@funkit/utils';
|
|
3
|
+
import { flagConfig as offlineConfig } from '../utils/flags/config';
|
|
3
4
|
import type { InferFlagType } from '../utils/flags/types';
|
|
4
|
-
export { FlagKey } from '../utils/flags/config';
|
|
5
5
|
export type FlagValue<K extends FlagKey> = InferFlagType<(typeof offlineConfig)[K]>;
|
|
6
6
|
export type FlagValues = {
|
|
7
7
|
[K in FlagKey]?: FlagValue<K>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type QueryClient } from '@tanstack/react-query';
|
|
2
2
|
import React, { type ReactNode } from 'react';
|
|
3
3
|
import type { Chain } from 'wagmi/chains';
|
|
4
|
+
import type { Locale } from '~/locales';
|
|
4
5
|
import { type CreateFunkitWagmiConfigParameters } from '../config/getDefaultConfig';
|
|
5
|
-
import type { Locale } from '../locales';
|
|
6
6
|
import { type DisclaimerComponent } from './AppContext';
|
|
7
7
|
import { type AvatarComponent } from './AvatarContext';
|
|
8
8
|
import { type FunkitConfig } from './FunkitConfigContext';
|
|
@@ -22,6 +22,7 @@ interface FunkitProviderInnerProps {
|
|
|
22
22
|
disclaimer?: DisclaimerComponent;
|
|
23
23
|
};
|
|
24
24
|
avatar?: AvatarComponent;
|
|
25
|
+
/** @deprecated This currently has no effect, localization is not yet supported */
|
|
25
26
|
locale?: Locale;
|
|
26
27
|
funkitConfig: FunkitConfig;
|
|
27
28
|
debug?: boolean | undefined;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { type Dispatch, type ReactNode } from 'react';
|
|
2
|
+
import { type PaymentMethodInfo } from '../domains/paymentMethods';
|
|
3
|
+
import type { FunkitCheckoutQuoteResult } from '../domains/quote';
|
|
4
|
+
import { type FunkitActiveCheckoutItem } from './FunkitCheckoutContext';
|
|
5
|
+
export type CheckoutQuoteError = {
|
|
6
|
+
maxTargetAssetAmount: number;
|
|
7
|
+
reason: 'insufficientBalance';
|
|
8
|
+
} | {
|
|
9
|
+
minTargetUsdAmount?: number;
|
|
10
|
+
reason: 'insufficientAmount';
|
|
11
|
+
} | {
|
|
12
|
+
originalError: Error;
|
|
13
|
+
reason: 'internal';
|
|
14
|
+
};
|
|
15
|
+
export type CheckoutQuoteResult = {
|
|
16
|
+
success: true;
|
|
17
|
+
} | {
|
|
18
|
+
error: CheckoutQuoteError;
|
|
19
|
+
success: false;
|
|
20
|
+
};
|
|
21
|
+
type GetCheckoutQuoteResponse = CheckoutQuoteResult & {
|
|
22
|
+
shellCheckoutItemWithNextQuote: FunkitActiveCheckoutItem;
|
|
23
|
+
quoteState: CheckoutQuoteState;
|
|
24
|
+
};
|
|
25
|
+
interface CheckoutQuoteState {
|
|
26
|
+
/** Whether the checkout quote is being fetched **/
|
|
27
|
+
isQuoting: boolean;
|
|
28
|
+
/** Latest checkout estimated fees and time **/
|
|
29
|
+
latestQuote: null | FunkitCheckoutQuoteResult;
|
|
30
|
+
/** The quotation step message **/
|
|
31
|
+
quoteStepMessage: string;
|
|
32
|
+
/** Error messages associated with checkout quote **/
|
|
33
|
+
quoteErrorMessage: string;
|
|
34
|
+
}
|
|
35
|
+
interface FunkitQuoteContextInterface extends CheckoutQuoteState {
|
|
36
|
+
clearCheckoutQuoteMessages: () => void;
|
|
37
|
+
getCheckoutQuote: (sponsorInitialTransferGasLimit: number, newPaymentMethodInfo: PaymentMethodInfo, disableInformationStreaming?: boolean) => Promise<GetCheckoutQuoteResponse>;
|
|
38
|
+
setCheckoutQuote: Dispatch<React.SetStateAction<FunkitCheckoutQuoteResult | null>>;
|
|
39
|
+
setQuoteProgress: (state: Omit<CheckoutQuoteState, 'latestQuote'>) => void;
|
|
40
|
+
}
|
|
41
|
+
export declare function FunkitQuoteProvider({ children }: {
|
|
42
|
+
children: ReactNode;
|
|
43
|
+
}): React.JSX.Element;
|
|
44
|
+
export declare function useQuoteContext(): FunkitQuoteContextInterface;
|
|
45
|
+
export {};
|
|
@@ -144,6 +144,7 @@ export declare const useActiveTheme: () => {
|
|
|
144
144
|
dialog: string;
|
|
145
145
|
selectedOption: string;
|
|
146
146
|
selectedWallet: string;
|
|
147
|
+
dropdown: string;
|
|
147
148
|
};
|
|
148
149
|
blurs: {
|
|
149
150
|
modalOverlay: string;
|
|
@@ -276,6 +277,7 @@ export declare const useActiveTheme: () => {
|
|
|
276
277
|
dialog: string;
|
|
277
278
|
selectedOption: string;
|
|
278
279
|
selectedWallet: string;
|
|
280
|
+
dropdown: string;
|
|
279
281
|
};
|
|
280
282
|
blurs: {
|
|
281
283
|
modalOverlay: string;
|
|
@@ -406,6 +408,7 @@ export declare const useActiveTheme: () => {
|
|
|
406
408
|
dialog: string;
|
|
407
409
|
selectedOption: string;
|
|
408
410
|
selectedWallet: string;
|
|
411
|
+
dropdown: string;
|
|
409
412
|
};
|
|
410
413
|
blurs: {
|
|
411
414
|
modalOverlay: string;
|
|
@@ -96,15 +96,15 @@ export declare const useFunkitDisconnect: () => {
|
|
|
96
96
|
error: null;
|
|
97
97
|
data: undefined;
|
|
98
98
|
status: "idle";
|
|
99
|
-
isPaused: boolean;
|
|
100
|
-
context: unknown;
|
|
101
99
|
isError: false;
|
|
102
100
|
isPending: false;
|
|
103
101
|
isSuccess: false;
|
|
104
102
|
failureCount: number;
|
|
105
103
|
failureReason: import("@wagmi/core").DisconnectErrorType | null;
|
|
104
|
+
isPaused: boolean;
|
|
106
105
|
variables: undefined;
|
|
107
106
|
isIdle: true;
|
|
107
|
+
context: unknown;
|
|
108
108
|
submittedAt: number;
|
|
109
109
|
connectors: readonly import("wagmi").Connector[];
|
|
110
110
|
} | {
|
|
@@ -114,15 +114,15 @@ export declare const useFunkitDisconnect: () => {
|
|
|
114
114
|
error: null;
|
|
115
115
|
data: undefined;
|
|
116
116
|
status: "pending";
|
|
117
|
-
isPaused: boolean;
|
|
118
|
-
context: unknown;
|
|
119
117
|
isError: false;
|
|
120
118
|
isPending: true;
|
|
121
119
|
isSuccess: false;
|
|
122
120
|
failureCount: number;
|
|
123
121
|
failureReason: import("@wagmi/core").DisconnectErrorType | null;
|
|
122
|
+
isPaused: boolean;
|
|
124
123
|
variables: import("wagmi/query").DisconnectVariables;
|
|
125
124
|
isIdle: false;
|
|
125
|
+
context: unknown;
|
|
126
126
|
submittedAt: number;
|
|
127
127
|
connectors: readonly import("wagmi").Connector[];
|
|
128
128
|
} | {
|
|
@@ -132,15 +132,15 @@ export declare const useFunkitDisconnect: () => {
|
|
|
132
132
|
error: import("@wagmi/core").DisconnectErrorType;
|
|
133
133
|
data: undefined;
|
|
134
134
|
status: "error";
|
|
135
|
-
isPaused: boolean;
|
|
136
|
-
context: unknown;
|
|
137
135
|
isError: true;
|
|
138
136
|
isPending: false;
|
|
139
137
|
isSuccess: false;
|
|
140
138
|
failureCount: number;
|
|
141
139
|
failureReason: import("@wagmi/core").DisconnectErrorType | null;
|
|
140
|
+
isPaused: boolean;
|
|
142
141
|
variables: import("wagmi/query").DisconnectVariables;
|
|
143
142
|
isIdle: false;
|
|
143
|
+
context: unknown;
|
|
144
144
|
submittedAt: number;
|
|
145
145
|
connectors: readonly import("wagmi").Connector[];
|
|
146
146
|
} | {
|
|
@@ -150,15 +150,15 @@ export declare const useFunkitDisconnect: () => {
|
|
|
150
150
|
error: null;
|
|
151
151
|
data: void;
|
|
152
152
|
status: "success";
|
|
153
|
-
isPaused: boolean;
|
|
154
|
-
context: unknown;
|
|
155
153
|
isError: false;
|
|
156
154
|
isPending: false;
|
|
157
155
|
isSuccess: true;
|
|
158
156
|
failureCount: number;
|
|
159
157
|
failureReason: import("@wagmi/core").DisconnectErrorType | null;
|
|
158
|
+
isPaused: boolean;
|
|
160
159
|
variables: import("wagmi/query").DisconnectVariables;
|
|
161
160
|
isIdle: false;
|
|
161
|
+
context: unknown;
|
|
162
162
|
submittedAt: number;
|
|
163
163
|
connectors: readonly import("wagmi").Connector[];
|
|
164
164
|
};
|
|
@@ -13,12 +13,13 @@ type FontSizeType = 'regular' | 'small';
|
|
|
13
13
|
interface BaseThemeOptions {
|
|
14
14
|
customFontWeights?: Partial<ThemeVars['fontWeight']>;
|
|
15
15
|
customFontFamily?: string;
|
|
16
|
+
customFontSizings?: Partial<ThemeVars['fontSize']>;
|
|
16
17
|
fontSizing?: FontSizeType;
|
|
17
18
|
borderRadius?: RadiusScale;
|
|
18
19
|
fontStack?: FontStack;
|
|
19
20
|
overlayBlur?: Blurs;
|
|
20
21
|
}
|
|
21
|
-
export declare const baseTheme: ({ borderRadius, fontStack, fontSizing, customFontFamily, customFontWeights, overlayBlur, }: BaseThemeOptions) => Pick<ThemeVars, "radii" | "fonts" | "fontWeight" | "fontSize" | "blurs">;
|
|
22
|
+
export declare const baseTheme: ({ borderRadius, fontStack, fontSizing, customFontFamily, customFontWeights, customFontSizings, overlayBlur, }: BaseThemeOptions) => Pick<ThemeVars, "radii" | "fonts" | "fontWeight" | "fontSize" | "blurs">;
|
|
22
23
|
export interface AccentColor {
|
|
23
24
|
accentColor: string;
|
|
24
25
|
accentColorForeground: string;
|
package/dist/themes/baseTheme.js
CHANGED
package/dist/themes/darkTheme.js
CHANGED
package/dist/utils/address.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import type { FunkitTextCustomizationsConfig } from '../providers/FunkitConfigContext';
|
|
2
2
|
export declare const getWalletLabel: (textCustomizations: FunkitTextCustomizationsConfig, walletAddress?: string) => string;
|
|
3
|
+
/**
|
|
4
|
+
* Replicated from @dydxprotocol/v4-client-js https://github.com/dydxprotocol/v4-clients/blob/main/v4-client-js/src/lib/validation.ts#L145C1-L158
|
|
5
|
+
* Not importing the sdk in the interest of space.
|
|
6
|
+
*/
|
|
7
|
+
export declare function verifyIsBech32(address: string): Error | undefined;
|
|
8
|
+
export declare function isDydxAddress(address: string): boolean;
|
package/dist/utils/assets.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { KnownAssetHoldingsItem } from '~/domains/wallet';
|
|
|
2
2
|
import { LoginType } from '~/providers/GeneralWalletProvider';
|
|
3
3
|
import { PaymentMethod } from '../domains/paymentMethods';
|
|
4
4
|
import type { FunkitActiveCheckoutItem, FunkitCheckoutConfig } from '../providers/FunkitCheckoutContext';
|
|
5
|
-
import {
|
|
5
|
+
import type { FlagValues } from '../providers/FunkitFlagsProvider';
|
|
6
6
|
export type { AssetHoldingsItem, AssetHoldingsMap, KnownAssetHoldingsItem, } from '~/domains/wallet';
|
|
7
7
|
export declare const ASSETS_LOW_VALUE_THRESHOLD = 0.1;
|
|
8
8
|
export declare const getNormalizedTokenBalance: (tokenBalance: bigint | number | string, decimals: number) => number;
|
|
@@ -11,16 +11,7 @@ export declare const isAssetUsableToPayForCheckout: (flags: FlagValues, checkout
|
|
|
11
11
|
isUsable: boolean;
|
|
12
12
|
reason: string;
|
|
13
13
|
};
|
|
14
|
-
export declare const L1_FEES_ESTIMATE = 20;
|
|
15
|
-
export declare const L2_FEES_ESTIMATE = 1;
|
|
16
14
|
export declare const L2_COST_MARGIN_MULTIPLIER = 1.2;
|
|
17
|
-
export declare const MESH_L1_FEES_ESTIMATE = 8;
|
|
18
|
-
export declare const MESH_L2_FEES_ESTIMATE = 2;
|
|
19
|
-
export declare const MESH_CUSTOM_CLIENT_FEE_PERCENT = 0.055;
|
|
20
|
-
/**
|
|
21
|
-
* Estimating overall fees
|
|
22
|
-
*/
|
|
23
|
-
export declare const getFeesUsdEstimate: (targetChainId: string, assetChainId: string, assetUsdAmount: number | null, paymentMethod: PaymentMethod | undefined) => number;
|
|
24
15
|
type RecommendedAsset = {
|
|
25
16
|
chainSymbolKey: string;
|
|
26
17
|
label: string | null;
|
package/dist/utils/checkout.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ import { type CheckoutHistoryItem } from '@funkit/api-base';
|
|
|
2
2
|
import { type Config } from '@wagmi/core';
|
|
3
3
|
import { type Address } from 'viem';
|
|
4
4
|
import type { UseConfigReturnType } from 'wagmi';
|
|
5
|
-
import {
|
|
6
|
-
import type {
|
|
5
|
+
import type { ServerCheckoutConfig } from '~/domains/clientMetadata';
|
|
6
|
+
import type { FunkitCheckoutQuoteResult } from '~/domains/quote';
|
|
7
|
+
import type { FunkitActiveCheckoutItem, FunkitCheckoutActionParams, FunkitCheckoutConfig } from '../providers/FunkitCheckoutContext';
|
|
7
8
|
export declare const MOONPAY_TIME_ESTIMATE_MS = 120000;
|
|
8
9
|
export declare const MESH_TIME_ESTIMATE_MS = 300000;
|
|
9
10
|
export declare const DUMMY_TRANSFER_PARAMS: {
|
|
@@ -32,7 +33,6 @@ export declare const hasSufficientBalance: (wagmiConfig: UseConfigReturnType, wa
|
|
|
32
33
|
result: boolean;
|
|
33
34
|
tokenTicker: null;
|
|
34
35
|
}>;
|
|
35
|
-
export declare function getTokenAddress(tokenTicker: string, chainId: string): Promise<`0x${string}`>;
|
|
36
36
|
/**
|
|
37
37
|
* Generates an env config for checkout estimation
|
|
38
38
|
* So that batch operation creation will not fail even if FW has insufficient funds to pass the estimation.
|
|
@@ -84,16 +84,7 @@ export declare function categorizeCheckoutHistories(checkoutHistoryList: Checkou
|
|
|
84
84
|
currentDepositAddrMap: CheckoutHistoryDepositAddrMap;
|
|
85
85
|
};
|
|
86
86
|
export declare function formatTokenAmountForMoonpay(amount: number, mpCurrencyCode: string): string;
|
|
87
|
-
|
|
88
|
-
* https://linear.app/funxyz/issue/ENG-1154/update-dydx-and-polymarkets-time-estimate
|
|
89
|
-
* @returns time estimation in seconds
|
|
90
|
-
*/
|
|
91
|
-
export declare function hackTimeEstimationForImportantCustomer(originalTimeEstimationMs: number | undefined, paymentMethod: PaymentMethod, apiKey: string): number;
|
|
92
|
-
export declare function getEstimateEndTimeInfo(createdTimeMs: number, checkoutItem: FunkitActiveCheckoutItem | HistoricalCheckoutItem, apiKey: string): {
|
|
93
|
-
estimatedEndTimeMs: number;
|
|
94
|
-
estimatedEndTimeFromNowMs: number;
|
|
95
|
-
isExceededEstimation: boolean;
|
|
96
|
-
};
|
|
87
|
+
export declare function getTimeFromNowSeconds(startTimeMs: number, durationMs: number): number;
|
|
97
88
|
/**
|
|
98
89
|
* Given a checkout config, returns the display string for the checkout item.
|
|
99
90
|
* Arbitary action checkouts: Display the checkoutItemAmount if it is greater than 0, otherwise display the checkoutItemTitle.
|
|
@@ -19,4 +19,4 @@ export declare function clearLatestWalletId(): void;
|
|
|
19
19
|
* @param checkout
|
|
20
20
|
* @returns
|
|
21
21
|
*/
|
|
22
|
-
export declare function getCheckoutCompletionTime(checkout: CheckoutHistoryItem): number;
|
|
22
|
+
export declare function getCheckoutCompletionTime(checkout: Pick<CheckoutHistoryItem, 'stateTimestampMs' | 'createdTimeMs' | 'lastUpdatedTimeMs'>): number;
|
|
@@ -1,36 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Remember that these values show up in our logs
|
|
3
|
-
* Make sure the enum values are unique
|
|
4
|
-
* Once we ship a feature flag, we can't change the key.
|
|
5
|
-
*/
|
|
6
|
-
export declare enum FlagKey {
|
|
7
|
-
/** Whether mantle assets can be used as source asset for payment for any checkout */
|
|
8
|
-
DisableMantleSourceAssets = "disable_mantle_source_assets",
|
|
9
|
-
/** Whether zksync assets can be used as source asset for payment for any checkout */
|
|
10
|
-
DisableZkSyncSourceAssets = "disable_zksync_source_assets",
|
|
11
|
-
/** @deprecated Which exchanges to show in the exchange selection screen */
|
|
12
|
-
SupportedExchanges = "supported_exchanges",
|
|
13
|
-
/** Which exchanges to show in the exchange selection screen */
|
|
14
|
-
SupportedExchangesV2 = "supported_exchanges_v2",
|
|
15
|
-
/** Which countries should be blocked for Funkit Checkout. Reference Alpha-2 Code format https://www.iban.com/country-codes. */
|
|
16
|
-
BlockedCountries = "blocked_countries",
|
|
17
|
-
/** Which users/addresses should be blocked for Funkit Checkout */
|
|
18
|
-
AddressBlacklist = "address_blacklist",
|
|
19
|
-
/** List of asset keys that should be displayed as `Unsupported`. Format is `${chainId}|${address}` */
|
|
20
|
-
AssetBlacklist = "asset_blacklist",
|
|
21
|
-
/** Whether to show the [Powered by Fun.xyz] tagline at the bottom of the checkout modal. */
|
|
22
|
-
ShowPoweredTagline = "show_powered_tagline",
|
|
23
|
-
/** Whether to enable Token Transfer as a payment method. */
|
|
24
|
-
EnableTokenTransfer = "enable_token_transfer",
|
|
25
|
-
/** Token Transfer payment method accepted source chain and assets */
|
|
26
|
-
TokenTransferSourceChainsAndAssets = "token_transfer_source_chains_and_assets",
|
|
27
|
-
/** Token Transfer additional disclaimer text. */
|
|
28
|
-
TokenTransferAdditionalDisclaimer = "token_transfer_additional_disclaimer",
|
|
29
|
-
/** Maximum usd amount that can be checked out. */
|
|
30
|
-
MaxCheckoutUsd = "max_checkout_usd",
|
|
31
|
-
/** Payment proxy server - whether we're using FROG for proxying payment (mesh) requests */
|
|
32
|
-
EnableFrogProxyServer = "enable_frog_proxy_server"
|
|
33
|
-
}
|
|
34
1
|
export declare const flagConfig: {
|
|
35
2
|
disable_mantle_source_assets: {
|
|
36
3
|
type: "boolean";
|
|
@@ -64,10 +31,6 @@ export declare const flagConfig: {
|
|
|
64
31
|
type: "string";
|
|
65
32
|
default_value: string;
|
|
66
33
|
};
|
|
67
|
-
asset_blacklist: {
|
|
68
|
-
type: "string";
|
|
69
|
-
default_value: string;
|
|
70
|
-
};
|
|
71
34
|
show_powered_tagline: {
|
|
72
35
|
type: "boolean";
|
|
73
36
|
default_value: false;
|
|
@@ -96,16 +59,22 @@ export declare const flagConfig: {
|
|
|
96
59
|
type: "string";
|
|
97
60
|
default_value: string;
|
|
98
61
|
};
|
|
99
|
-
|
|
100
|
-
type: "
|
|
101
|
-
default_value:
|
|
62
|
+
enable_token_transfer_universal_deposit_address: {
|
|
63
|
+
type: "boolean";
|
|
64
|
+
default_value: false;
|
|
102
65
|
overrides: {
|
|
103
|
-
if_any: {
|
|
104
|
-
key: "
|
|
66
|
+
if_any: ({
|
|
67
|
+
key: "userId";
|
|
68
|
+
pct: number;
|
|
69
|
+
type: "pctRollout";
|
|
70
|
+
values?: undefined;
|
|
71
|
+
} | {
|
|
72
|
+
key: "userId";
|
|
105
73
|
type: "isAnyOf";
|
|
106
74
|
values: string[];
|
|
107
|
-
|
|
108
|
-
|
|
75
|
+
pct?: undefined;
|
|
76
|
+
})[];
|
|
77
|
+
value: true;
|
|
109
78
|
}[];
|
|
110
79
|
};
|
|
111
80
|
max_checkout_usd: {
|
|
@@ -129,14 +98,18 @@ export declare const flagConfig: {
|
|
|
129
98
|
};
|
|
130
99
|
enable_frog_proxy_server: {
|
|
131
100
|
type: "boolean";
|
|
132
|
-
default_value:
|
|
101
|
+
default_value: true;
|
|
102
|
+
};
|
|
103
|
+
checkout_time_estimate_overrides: {
|
|
104
|
+
type: "string";
|
|
105
|
+
default_value: string;
|
|
133
106
|
overrides: {
|
|
134
107
|
if_any: {
|
|
135
108
|
key: "apiKey";
|
|
136
109
|
type: "isAnyOf";
|
|
137
110
|
values: string[];
|
|
138
111
|
}[];
|
|
139
|
-
value:
|
|
112
|
+
value: string;
|
|
140
113
|
}[];
|
|
141
114
|
};
|
|
142
115
|
};
|
|
@@ -6,6 +6,7 @@ declare class FunLogger {
|
|
|
6
6
|
protected userName: string | null;
|
|
7
7
|
protected userLoginType: string | null;
|
|
8
8
|
protected sdkVersion: string | null;
|
|
9
|
+
protected deviceId: string | null;
|
|
9
10
|
constructor();
|
|
10
11
|
private getFunLogEnv;
|
|
11
12
|
private logDataDog;
|
|
@@ -26,7 +27,8 @@ declare class FunLogger {
|
|
|
26
27
|
getUserAddress(): string | null;
|
|
27
28
|
getUserName(): string | null;
|
|
28
29
|
getUserLoginType(): string | null;
|
|
29
|
-
setUserInfo(userId: string, userAddress: string, userName: string, userLoginType: string): void;
|
|
30
|
+
setUserInfo(userId: string, userAddress: string, userName: string, userLoginType: string, deviceId: string): void;
|
|
31
|
+
setDeviceId(deviceId: string): void;
|
|
30
32
|
}
|
|
31
33
|
declare const logger: FunLogger;
|
|
32
34
|
export { logger };
|
package/dist/utils/moonpay.d.ts
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
+
export declare const MINIMUM_MOONPAY_DEPOSIT_AMOUNT_USD = 35;
|
|
2
|
+
export declare const MAXIMUM_MOONPAY_DEPOSIT_AMOUNT_USD = 10000;
|
|
1
3
|
export declare const generateMoonpayCurrencyCode: (tokenSymbol: string, chainId: string) => string;
|
|
4
|
+
export declare function checkAmountForMoonpay(amountUsd: number): {
|
|
5
|
+
readonly isInvalid: true;
|
|
6
|
+
readonly message: "$35 minimum required for the selected payment method.";
|
|
7
|
+
} | {
|
|
8
|
+
readonly isInvalid: true;
|
|
9
|
+
readonly message: "$10000 maximum exceeded for the selected payment method.";
|
|
10
|
+
} | {
|
|
11
|
+
readonly isInvalid: false;
|
|
12
|
+
readonly message?: undefined;
|
|
13
|
+
};
|