@funkit/connect 3.4.4 → 3.4.8
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 +44 -0
- package/dist/components/FunAssetAvatar/FunAssetAvatar.css.d.ts +0 -1
- package/dist/components/FunCountdown/FunCountdown.d.ts +2 -1
- package/dist/components/FunDivider/FunDivider.d.ts +1 -2
- package/dist/components/FunInput/FunInput.d.ts +1 -2
- package/dist/components/FunInput/FunTextAreaInput.d.ts +1 -5
- package/dist/components/FunNotification/FunNotification.d.ts +4 -0
- package/dist/components/FunPayments/FunPaymentMethods.d.ts +22 -37
- package/dist/components/FunSelect/FunSelect.d.ts +3 -4
- package/dist/components/FunSelectBrokerage/FunSelectBrokerage.d.ts +4 -3
- package/dist/components/FunSkeletonLoader/FunSkeletonBlock.d.ts +7 -2
- package/dist/components/FunTransactionSummary/FunTxSummaryComponents.d.ts +2 -2
- package/dist/components/FunTransactionSummary/PaymentMethodSummary.d.ts +21 -0
- package/dist/consts/customers.d.ts +2 -0
- package/dist/consts/funkit.d.ts +1 -0
- package/dist/domains/asset.d.ts +4 -0
- package/dist/domains/checkoutFees.d.ts +2 -1
- package/dist/{hooks/useCheckoutStateBooleans.d.ts → domains/checkoutState.d.ts} +1 -1
- package/dist/domains/clientMetadata.d.ts +0 -1
- package/dist/domains/quote.d.ts +6 -4
- package/dist/domains/wallet.d.ts +18 -0
- package/dist/hooks/useAutoClearState.d.ts +4 -0
- package/dist/hooks/useCountdown.d.ts +8 -0
- package/dist/hooks/useMesh.d.ts +2 -3
- package/dist/index.css +66 -52
- package/dist/index.js +5678 -5882
- package/dist/modals/CheckoutModal/ConfirmationStep/useCheckoutConfirmation.d.ts +17 -0
- package/dist/modals/CheckoutModal/ConfirmationStep/usePostCheckout.d.ts +28 -0
- package/dist/modals/CheckoutModal/ConfirmationStep/useQuoteRefresh.d.ts +22 -0
- package/dist/modals/CheckoutModal/InputAmount/AvailableBalance.d.ts +8 -0
- package/dist/modals/CheckoutModal/InputAmount/InputAmountLayout.d.ts +5 -3
- package/dist/modals/CheckoutModal/InputAmount/InputAmountLoaded.d.ts +5 -2
- package/dist/modals/CheckoutModal/InputAmount/InputAmountLoading.d.ts +5 -2
- package/dist/modals/CheckoutModal/InputAmount/QuickOptions.d.ts +7 -0
- package/dist/modals/CheckoutModal/InputAmount/state.d.ts +2 -1
- package/dist/modals/CheckoutModal/InputAmount/useCheckoutQuote.d.ts +0 -1
- package/dist/modals/CheckoutModal/InputAmount/utils.d.ts +1 -7
- package/dist/modals/CheckoutModal/LoadingAccount.d.ts +1 -1
- package/dist/modals/CheckoutModal/SourceChange.d.ts +1 -1
- package/dist/modals/CheckoutModal/TransferToken.d.ts +2 -4
- package/dist/modals/CheckoutModal/stepTransition.d.ts +6 -8
- package/dist/modals/CheckoutModal/useCheckoutQuote.d.ts +7 -0
- package/dist/modals/CheckoutModal/useSourceAssetConfirm.d.ts +9 -0
- package/dist/modals/FunCheckoutHistoryModal/FunCheckoutHistoryDetail.d.ts +1 -1
- package/dist/modals/FunCheckoutHistoryModal/FunCheckoutHistoryHelp.d.ts +1 -1
- package/dist/modals/FunCheckoutHistoryModal/FunCheckoutHistoryTransaction.css.d.ts +0 -2
- package/dist/modals/FunCheckoutHistoryModal/FunCheckoutHistoryTransaction.d.ts +7 -2
- package/dist/modals/FunCheckoutHistoryModal/FunCheckoutStatus.css.d.ts +1 -0
- package/dist/modals/FunCheckoutHistoryModal/FunCheckoutStatus.d.ts +1 -1
- package/dist/modals/ProfileDetails/FunProfileViews/Home/HomeCheckoutDisplayRow.d.ts +5 -2
- package/dist/providers/FunkitCheckoutContext.d.ts +1 -5
- package/dist/providers/GeneralWalletProvider.d.ts +10 -10
- package/dist/utils/aborts.d.ts +1 -0
- package/dist/utils/assets.d.ts +7 -24
- package/dist/utils/combineChainSymbolOrAddress.d.ts +1 -1
- package/dist/utils/deepMerge.d.ts +5 -0
- package/dist/utils/flags/config.d.ts +7 -1
- package/dist/utils/payment.d.ts +3 -3
- package/dist/wallets/walletConnectors/chunk-25VW5TZP.js +92 -0
- package/dist/wallets/walletConnectors/chunk-2EMZOYQI.js +101 -0
- package/dist/wallets/walletConnectors/chunk-57UUMOOZ.js +95 -0
- package/dist/wallets/walletConnectors/chunk-5K4DIMYR.js +95 -0
- package/dist/wallets/walletConnectors/chunk-AUVBWDIK.js +102 -0
- package/dist/wallets/walletConnectors/chunk-AXPQHNUI.js +71 -0
- package/dist/wallets/walletConnectors/chunk-B7FHT3CB.js +94 -0
- package/dist/wallets/walletConnectors/chunk-EFIENLEE.js +98 -0
- package/dist/wallets/walletConnectors/chunk-FLTQRYFS.js +27 -0
- package/dist/wallets/walletConnectors/chunk-HCKLWBE5.js +98 -0
- package/dist/wallets/walletConnectors/chunk-IR3YKU2N.js +103 -0
- package/dist/wallets/walletConnectors/chunk-J2BF4L2V.js +87 -0
- package/dist/wallets/walletConnectors/chunk-L7QI6PBN.js +108 -0
- package/dist/wallets/walletConnectors/chunk-OKUX4BC4.js +66 -0
- package/dist/wallets/walletConnectors/chunk-QP2BIVXD.js +73 -0
- package/dist/wallets/walletConnectors/chunk-UWZQZY4S.js +149 -0
- package/dist/wallets/walletConnectors/chunk-UZEMNN3Q.js +96 -0
- package/dist/wallets/walletConnectors/chunk-WAMHUVNP.js +96 -0
- package/dist/wallets/walletConnectors/chunk-ZCKNEKQQ.js +110 -0
- package/dist/wallets/walletConnectors/index.js +57 -57
- package/package.json +1 -1
- package/dist/components/FunPayments/FunPaymentMeshType.d.ts +0 -10
- package/dist/modals/CheckoutModal/SelectPaymentMethod.d.ts +0 -24
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
import { ErrorNotification } from '~/components/FunNotification/FunNotification';
|
|
3
|
+
export interface CheckoutConfirmationError extends ErrorNotification {
|
|
4
|
+
durationMs?: number;
|
|
5
|
+
}
|
|
6
|
+
interface UseCheckoutConfirmationOptions {
|
|
7
|
+
onError(error: CheckoutConfirmationError): void;
|
|
8
|
+
onSuccess(depositAddress: Address): void;
|
|
9
|
+
}
|
|
10
|
+
interface UseCheckoutConfirmationResult {
|
|
11
|
+
confirmationError: CheckoutConfirmationError | null;
|
|
12
|
+
confirmationStepMessage: string | null;
|
|
13
|
+
handleCheckoutConfirmation(): Promise<void>;
|
|
14
|
+
isConfirming: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function useCheckoutConfirmation({ onError, onSuccess, }: UseCheckoutConfirmationOptions): UseCheckoutConfirmationResult;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
import { ErrorNotification } from '~/components/FunNotification/FunNotification';
|
|
3
|
+
import { PaymentMethodInfo } from '~/domains/paymentMethods';
|
|
4
|
+
export interface MoonpayDepositData {
|
|
5
|
+
depositToken: string;
|
|
6
|
+
depositTokenAmount: number;
|
|
7
|
+
depositTokenChainId: string;
|
|
8
|
+
}
|
|
9
|
+
export interface PostCheckoutError extends ErrorNotification {
|
|
10
|
+
disableContinue: boolean;
|
|
11
|
+
durationMs?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface PostCheckoutSuccessData {
|
|
14
|
+
depositAddress: Address;
|
|
15
|
+
moonpayData: MoonpayDepositData;
|
|
16
|
+
paymentMethodInfo: PaymentMethodInfo;
|
|
17
|
+
}
|
|
18
|
+
interface UsePostCheckoutOptions {
|
|
19
|
+
onSuccess(data: PostCheckoutSuccessData): void;
|
|
20
|
+
}
|
|
21
|
+
interface UsePostCheckoutResult {
|
|
22
|
+
handlePostCheckout(depositAddress: Address): Promise<void>;
|
|
23
|
+
isPostCheckoutLoading: boolean;
|
|
24
|
+
postCheckoutError: PostCheckoutError | null;
|
|
25
|
+
postCheckoutStepMessage: string | null;
|
|
26
|
+
}
|
|
27
|
+
export declare function usePostCheckout({ onSuccess, }: UsePostCheckoutOptions): UsePostCheckoutResult;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ErrorNotification } from '~/components/FunNotification/FunNotification';
|
|
2
|
+
interface UseQuoteRefreshOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Freeze the latest quote state, e.g. so we do not change the quote mid-confirmation
|
|
5
|
+
*/
|
|
6
|
+
disableStateUpdates: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Called when the quote is refreshed
|
|
9
|
+
*/
|
|
10
|
+
onRefreshed(): void;
|
|
11
|
+
}
|
|
12
|
+
interface UseQuoteRefreshResult {
|
|
13
|
+
isQuoting: boolean;
|
|
14
|
+
/** This uses onSourceAssetConfirmed - do not call asynchronously! */
|
|
15
|
+
preloadQuote(): void;
|
|
16
|
+
quoteError: ErrorNotification | null;
|
|
17
|
+
quoteStepMessage: string | null;
|
|
18
|
+
/** Safe to call asynchronously */
|
|
19
|
+
refreshQuote(ignorePreloaded?: boolean): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export declare function useQuoteRefresh({ disableStateUpdates, onRefreshed, }: UseQuoteRefreshOptions): UseQuoteRefreshResult;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AssetHoldingsItem } from '~/utils/assets';
|
|
3
|
+
interface AvailableBalanceProps {
|
|
4
|
+
sourceHolding?: AssetHoldingsItem;
|
|
5
|
+
usdAvailableAmount?: number | null;
|
|
6
|
+
}
|
|
7
|
+
export declare const AvailableBalance: (props: AvailableBalanceProps) => React.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { FunButtonProps } from '../../../components/FunButton/FunButton';
|
|
3
|
-
import { ErrorNotification } from '
|
|
4
|
-
|
|
3
|
+
import { ErrorNotification } from '../../../components/FunNotification/FunNotification';
|
|
4
|
+
interface InputAmountLayoutProps {
|
|
5
5
|
actionButtonProps: FunButtonProps;
|
|
6
6
|
availableBalance?: ReactNode;
|
|
7
7
|
amountOptions?: ReactNode;
|
|
8
8
|
amountInput: ReactNode;
|
|
9
9
|
amountInputSwitch: ReactNode;
|
|
10
10
|
error?: ErrorNotification;
|
|
11
|
-
}
|
|
11
|
+
}
|
|
12
|
+
export declare function InputAmountLayout({ actionButtonProps, amountOptions, amountInput, amountInputSwitch, availableBalance, error, }: InputAmountLayoutProps): React.JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -3,8 +3,11 @@ import { FunkitActiveCheckoutItem } from '../../../providers/FunkitCheckoutConte
|
|
|
3
3
|
import { AssetHoldingsItem } from '../../../utils/assets';
|
|
4
4
|
import { InputAmountNext, InputAmountState } from '../InputAmount';
|
|
5
5
|
import { StateTransitionProps } from '../stepTransition';
|
|
6
|
-
|
|
6
|
+
interface InputAmountLoadedProps {
|
|
7
7
|
sourceHolding: AssetHoldingsItem | null;
|
|
8
8
|
checkoutItem: FunkitActiveCheckoutItem;
|
|
9
9
|
unitPrice: number;
|
|
10
|
-
|
|
10
|
+
isCardCheckout: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function InputAmountLoaded({ checkoutItem, modalState, onNext, sourceHolding, unitPrice, isCardCheckout, }: StateTransitionProps<InputAmountState, InputAmountNext> & InputAmountLoadedProps): React.JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { InputAmountNext, InputAmountState } from '../InputAmount';
|
|
3
3
|
import { StateTransitionProps } from '../stepTransition';
|
|
4
|
-
|
|
4
|
+
interface InputAmountLoadingProps {
|
|
5
5
|
sourceHoldingError: Error | null;
|
|
6
6
|
unitPriceError: Error | null;
|
|
7
|
-
|
|
7
|
+
isCardCheckout: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function InputAmountLoading({ modalState, onBack, sourceHoldingError, unitPriceError, isCardCheckout, }: StateTransitionProps<InputAmountState, InputAmountNext> & InputAmountLoadingProps): React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -2,12 +2,13 @@ import { PaymentMethod } from '~/domains/paymentMethods';
|
|
|
2
2
|
import { FunkitActiveCheckoutItem } from '../../../providers/FunkitCheckoutContext';
|
|
3
3
|
import { AssetHoldingsItem } from '../../../utils/assets';
|
|
4
4
|
export interface AmountInputInitOptions {
|
|
5
|
-
apiKey: string;
|
|
6
5
|
checkoutItem: FunkitActiveCheckoutItem;
|
|
7
6
|
paymentMethod: PaymentMethod;
|
|
8
7
|
sourceHolding: AssetHoldingsItem | null;
|
|
9
8
|
/** Target asset unit price, in USD */
|
|
10
9
|
unitPrice: number;
|
|
10
|
+
/** Maximum checkout amount, in USD */
|
|
11
|
+
maxUsd: number;
|
|
11
12
|
}
|
|
12
13
|
export interface AmountInputState {
|
|
13
14
|
/** Current amount, in target asset */
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
1
|
import { PaymentMethod } from '~/domains/paymentMethods';
|
|
3
2
|
import { FunkitActiveCheckoutItem } from '../../../providers/FunkitCheckoutContext';
|
|
4
3
|
import { AssetHoldingsItem } from '../../../utils/assets';
|
|
@@ -6,11 +5,6 @@ export declare const ASSET_DECIMALS = 5;
|
|
|
6
5
|
export declare const USD_DECIMALS = 2;
|
|
7
6
|
export declare const USD_INITIAL_AMOUNT = 100;
|
|
8
7
|
export declare const USD_PREFIX = "$";
|
|
9
|
-
export interface ErrorNotification {
|
|
10
|
-
message: ReactNode;
|
|
11
|
-
/** FunNotificationType */
|
|
12
|
-
type: 'error' | 'warning' | 'hint';
|
|
13
|
-
}
|
|
14
8
|
export declare function round(value: number, decimals: number,
|
|
15
9
|
/**
|
|
16
10
|
* Whether to round up ('ceil'), down ('floor'), or nearest ('round')
|
|
@@ -19,5 +13,5 @@ export declare function round(value: number, decimals: number,
|
|
|
19
13
|
**/
|
|
20
14
|
method?: 'ceil' | 'floor' | 'round'): number;
|
|
21
15
|
export declare function getUsdAvailableAmount(checkoutItem: FunkitActiveCheckoutItem, sourceBalance: AssetHoldingsItem | null): number | null;
|
|
22
|
-
export declare function getUsdMaxAmount(paymentMethod: PaymentMethod,
|
|
16
|
+
export declare function getUsdMaxAmount(paymentMethod: PaymentMethod, maxUsd: number): number | null;
|
|
23
17
|
export declare function getUsdMinAmount(paymentMethod: PaymentMethod): number;
|
|
@@ -11,7 +11,7 @@ export type LoadingAccountNext = ({
|
|
|
11
11
|
usablePaymentMethod: PaymentMethod.BROKERAGE;
|
|
12
12
|
paymentMethodInfo: PaymentMethodBrokerageInfo;
|
|
13
13
|
} | {
|
|
14
|
-
usablePaymentMethod: null;
|
|
14
|
+
usablePaymentMethod: null | PaymentMethod.TOKEN_TRANSFER;
|
|
15
15
|
}) & {
|
|
16
16
|
step: FunCheckoutStep.LOADING_ACCOUNT;
|
|
17
17
|
};
|
|
@@ -4,7 +4,7 @@ import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTr
|
|
|
4
4
|
type ConnectablePaymentMethodInfo = PaymentMethodAccountInfo | PaymentMethodBrokerageInfo;
|
|
5
5
|
export interface SourceChangeState extends CheckoutModalCommonState {
|
|
6
6
|
step: FunCheckoutStep.SOURCE_CHANGE;
|
|
7
|
-
paymentMethodInfo: ConnectablePaymentMethodInfo;
|
|
7
|
+
paymentMethodInfo: ConnectablePaymentMethodInfo | null;
|
|
8
8
|
}
|
|
9
9
|
export type SourceChangeNext = {
|
|
10
10
|
step: FunCheckoutStep.SOURCE_CHANGE;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { PaymentMethodAccountInfo, PaymentMethodBrokerageInfo } from '../../domains/paymentMethods';
|
|
3
2
|
import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition } from './stepTransition';
|
|
4
3
|
export interface TransferTokenState extends CheckoutModalCommonState {
|
|
5
4
|
step: FunCheckoutStep.TRANSFER_TOKEN;
|
|
6
|
-
prevPaymentMethodInfo?: PaymentMethodAccountInfo | PaymentMethodBrokerageInfo;
|
|
7
5
|
}
|
|
8
6
|
export type TransferTokenNext = {
|
|
9
7
|
step: FunCheckoutStep.TRANSFER_TOKEN;
|
|
@@ -11,7 +9,7 @@ export type TransferTokenNext = {
|
|
|
11
9
|
export interface TokenTransferSourceChainsAndAssets {
|
|
12
10
|
[chainId: number]: string[];
|
|
13
11
|
}
|
|
14
|
-
export declare function transferTokenNext(state: TransferTokenState,
|
|
12
|
+
export declare function transferTokenNext(state: TransferTokenState, _payload: TransferTokenNext): StepTransition[FunCheckoutStep.TRANSFER_TOKEN];
|
|
15
13
|
type Props = StateTransitionProps<TransferTokenState, TransferTokenNext>;
|
|
16
|
-
export declare function TransferToken({
|
|
14
|
+
export declare function TransferToken({ onNext }: Props): React.JSX.Element;
|
|
17
15
|
export {};
|
|
@@ -9,7 +9,6 @@ import { MeshVerificationNext, MeshVerificationState } from './MeshVerification'
|
|
|
9
9
|
import { MoonpaySetupNext, MoonpaySetupState } from './MoonpaySetup';
|
|
10
10
|
import { SelectAssetNext, SelectAssetState } from './SelectAsset';
|
|
11
11
|
import { SelectBrokerageNext, SelectBrokerageState } from './SelectBrokerage';
|
|
12
|
-
import { SelectPaymentMethodNext, SelectPaymentMethodState } from './SelectPaymentMethod';
|
|
13
12
|
import { SourceChangeNext, SourceChangeState } from './SourceChange';
|
|
14
13
|
import { TransferTokenNext, TransferTokenState } from './TransferToken';
|
|
15
14
|
export interface CheckoutModalCommonState {
|
|
@@ -26,11 +25,10 @@ export interface StateTransitionProps<T, N> {
|
|
|
26
25
|
onClose: () => void;
|
|
27
26
|
}
|
|
28
27
|
export declare function extractCommonState(state: CheckoutModalState): CheckoutModalCommonState;
|
|
29
|
-
type CheckoutModalState = LoadingAccountState | ConfirmationStepState | ConnectExchangeState | InputAmountState | SelectAssetState |
|
|
28
|
+
type CheckoutModalState = LoadingAccountState | ConfirmationStepState | ConnectExchangeState | InputAmountState | SelectAssetState | SelectBrokerageState | SourceChangeState | MoonpaySetupState | MeshVerificationState | CheckoutCompleteState | TransferTokenState;
|
|
30
29
|
export declare enum FunCheckoutStep {
|
|
31
30
|
LOADING_ACCOUNT = "loading_account",
|
|
32
31
|
INPUT_AMOUNT = "input_amount",
|
|
33
|
-
SELECT_PAYMENT_METHOD = "select_payment",
|
|
34
32
|
SOURCE_CHANGE = "source_change",
|
|
35
33
|
CONFIRMATION = "confirmation",
|
|
36
34
|
MOONPAY_SETUP = "payment_setup",
|
|
@@ -42,9 +40,8 @@ export declare enum FunCheckoutStep {
|
|
|
42
40
|
TRANSFER_TOKEN = "transfer_token"
|
|
43
41
|
}
|
|
44
42
|
export interface StepTransition {
|
|
45
|
-
[FunCheckoutStep.LOADING_ACCOUNT]:
|
|
43
|
+
[FunCheckoutStep.LOADING_ACCOUNT]: SelectAssetState | TransferTokenState | SourceChangeState;
|
|
46
44
|
[FunCheckoutStep.INPUT_AMOUNT]: ConfirmationStepState;
|
|
47
|
-
[FunCheckoutStep.SELECT_PAYMENT_METHOD]: SelectBrokerageState | InputAmountState | SelectAssetState | TransferTokenState;
|
|
48
45
|
[FunCheckoutStep.CONFIRMATION]: MeshVerificationState | MoonpaySetupState | CheckoutCompleteState;
|
|
49
46
|
[FunCheckoutStep.MOONPAY_SETUP]: CheckoutCompleteState;
|
|
50
47
|
[FunCheckoutStep.SELECT_BROKERAGE]: ConnectExchangeState | SelectAssetState;
|
|
@@ -52,9 +49,9 @@ export interface StepTransition {
|
|
|
52
49
|
[FunCheckoutStep.SELECT_ASSET]: InputAmountState | SourceChangeState | LoadingAccountState;
|
|
53
50
|
[FunCheckoutStep.MESH_VERIFICATION]: CheckoutCompleteState;
|
|
54
51
|
[FunCheckoutStep.SOURCE_CHANGE]: SelectAssetState | SelectBrokerageState | InputAmountState | TransferTokenState;
|
|
55
|
-
[FunCheckoutStep.TRANSFER_TOKEN]:
|
|
52
|
+
[FunCheckoutStep.TRANSFER_TOKEN]: SourceChangeState;
|
|
56
53
|
}
|
|
57
|
-
type NextPayload = LoadingAccountNext | ConfirmationStepNext | ConnectExchangeNext | InputAmountNext | MeshVerificationNext | MoonpaySetupNext | SelectAssetNext |
|
|
54
|
+
type NextPayload = LoadingAccountNext | ConfirmationStepNext | ConnectExchangeNext | InputAmountNext | MeshVerificationNext | MoonpaySetupNext | SelectAssetNext | SelectBrokerageNext | SourceChangeNext | TransferTokenNext | {
|
|
58
55
|
step: FunCheckoutStep.CHECKOUT_COMPLETE;
|
|
59
56
|
};
|
|
60
57
|
export declare function useCheckoutModalTransition(checkoutItem: FunkitActiveCheckoutItem, onClose: () => void): {
|
|
@@ -64,11 +61,12 @@ export declare function useCheckoutModalTransition(checkoutItem: FunkitActiveChe
|
|
|
64
61
|
onCloseWrapper: () => void;
|
|
65
62
|
onNext: (payload: NextPayload) => void;
|
|
66
63
|
setModalState: Dispatch<SetStateAction<CheckoutModalState>>;
|
|
64
|
+
hasHistoryEntry: boolean;
|
|
67
65
|
};
|
|
68
66
|
interface TitleConfig {
|
|
69
|
-
hasBack: boolean;
|
|
70
67
|
title: string;
|
|
71
68
|
showFullHeight: boolean;
|
|
69
|
+
overrideBack?: boolean;
|
|
72
70
|
}
|
|
73
71
|
export declare function useTitleConfig(checkoutItem: FunkitActiveCheckoutItem, state: CheckoutModalState): TitleConfig;
|
|
74
72
|
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FunkitActiveCheckoutItem } from '~/providers/FunkitCheckoutContext';
|
|
2
|
+
import { DeepPartial } from '~/utils/deepMerge';
|
|
3
|
+
export declare function useCheckoutQuote(): (overridingCheckoutItem?: DeepPartial<FunkitActiveCheckoutItem>) => Promise<{
|
|
4
|
+
baseQuote: import("@funkit/api-base").CheckoutQuoteResponse;
|
|
5
|
+
finalEstimation: import("~/domains/quote").FunkitCheckoutQuoteResult;
|
|
6
|
+
availableAssetAmount: number | undefined;
|
|
7
|
+
}>;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
import { Operation } from '@funkit/core';
|
|
2
|
+
import { PaymentMethodInfo } from '../../domains/paymentMethods';
|
|
1
3
|
import { FunkitActiveCheckoutItem } from '../../providers/FunkitCheckoutContext';
|
|
4
|
+
import { LoginType } from '../../providers/GeneralWalletProvider';
|
|
2
5
|
export interface SourceAssetConfirmed {
|
|
3
6
|
isQuoteSuccess: boolean;
|
|
4
7
|
maxTargetAssetAmount: number | undefined;
|
|
5
8
|
}
|
|
9
|
+
export declare function preparePaymentMethodInfo(selectedPaymentMethodInfo: PaymentMethodInfo | null, meshNetworkInfo: {
|
|
10
|
+
meshNetworkId: string | undefined;
|
|
11
|
+
} | null): Promise<import("../../domains/paymentMethods").PaymentMethodCardInfo | import("../../domains/paymentMethods").PaymentMethodBrokerageInfo | import("../../domains/paymentMethods").PaymentMethodAccountInfo>;
|
|
12
|
+
export declare function fetchSponsorInitialTransferGasLimit(checkoutItem: FunkitActiveCheckoutItem, loginType: LoginType, generateCheckoutTransferOpItems: (toAddress: string, tokenAmount: number | string) => Promise<{
|
|
13
|
+
transferOp: Operation | null;
|
|
14
|
+
}>): Promise<number>;
|
|
6
15
|
/**
|
|
7
16
|
*
|
|
8
17
|
* Note: this hook is EXTREMELY confusing in what is doing
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CheckoutHistoryItem } from '@funkit/api-base';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
interface FunCheckoutHistoryDetailProps {
|
|
4
|
-
checkoutHistoryInfo: CheckoutHistoryItem;
|
|
4
|
+
checkoutHistoryInfo: CheckoutHistoryItem | undefined;
|
|
5
5
|
onHelp: () => void;
|
|
6
6
|
onClose: () => void;
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CheckoutHistoryItem } from '@funkit/api-base';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export declare function FunCheckoutHistoryHelp({ checkoutHistoryInfo, onBackFromHelpPage, }: {
|
|
4
|
-
checkoutHistoryInfo: CheckoutHistoryItem;
|
|
4
|
+
checkoutHistoryInfo: CheckoutHistoryItem | undefined;
|
|
5
5
|
onBackFromHelpPage: () => void;
|
|
6
6
|
}): React.JSX.Element;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { CheckoutHistoryItem } from '@funkit/api-base';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { HistoricalCheckoutItem } from '../../providers/FunkitCheckoutContext';
|
|
3
4
|
interface FunTxSummaryHistoryProps {
|
|
4
|
-
checkoutHistoryItem: CheckoutHistoryItem;
|
|
5
|
+
checkoutHistoryItem: CheckoutHistoryItem | undefined;
|
|
5
6
|
isDelayed?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare function FunTxSummaryHistory({ checkoutHistoryItem, isDelayed, }: FunTxSummaryHistoryProps): React.JSX.Element;
|
|
9
|
+
type FunTxSummaryAdditionalInfoProps = {
|
|
10
|
+
checkoutItem: HistoricalCheckoutItem;
|
|
11
|
+
};
|
|
12
|
+
export declare const SourceDestinationSummary: ({ checkoutItem, }: FunTxSummaryAdditionalInfoProps) => React.JSX.Element;
|
|
8
13
|
export declare function OrderDetail({ checkoutHistoryItem, }: {
|
|
9
|
-
checkoutHistoryItem: CheckoutHistoryItem;
|
|
14
|
+
checkoutHistoryItem: CheckoutHistoryItem | undefined;
|
|
10
15
|
}): React.JSX.Element;
|
|
11
16
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CheckoutHistoryItem } from '@funkit/api-base';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
interface FunCheckoutStatusProps {
|
|
4
|
-
checkoutHistoryItem: CheckoutHistoryItem;
|
|
4
|
+
checkoutHistoryItem: CheckoutHistoryItem | undefined;
|
|
5
5
|
onOrderDelayed?: () => void;
|
|
6
6
|
}
|
|
7
7
|
export declare function FunCheckoutStatus({ checkoutHistoryItem, onOrderDelayed, }: FunCheckoutStatusProps): React.JSX.Element | null;
|
|
@@ -2,8 +2,11 @@ import { CheckoutHistoryItem } from '@funkit/api-base';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { HistoryContentPages } from '../../../../utils/checkoutHistory';
|
|
4
4
|
export declare const HOME_CHECKOUT_DISPLAY_ROW_HEIGHT = 52;
|
|
5
|
-
export declare const HomeCheckoutDisplayRow: ({ checkoutHistoryItem, onSelect, }: {
|
|
5
|
+
export declare const HomeCheckoutDisplayRow: ({ checkoutHistoryItem, disableSidePadding, onSelect, }: {
|
|
6
6
|
checkoutHistoryItem: CheckoutHistoryItem;
|
|
7
|
+
disableSidePadding?: boolean;
|
|
7
8
|
onSelect: (depositAddress: `0x${string}`, initialPage: HistoryContentPages) => void;
|
|
8
9
|
}) => React.JSX.Element;
|
|
9
|
-
export declare const HomeCheckoutDisplayRowSkeleton: (
|
|
10
|
+
export declare const HomeCheckoutDisplayRowSkeleton: ({ disableSidePadding, }: {
|
|
11
|
+
disableSidePadding?: boolean;
|
|
12
|
+
}) => React.JSX.Element;
|
|
@@ -98,8 +98,6 @@ export interface FunkitActiveCheckoutItem {
|
|
|
98
98
|
startTimestampMs: number;
|
|
99
99
|
/** Whether the checkout draft dollar value is being fetched **/
|
|
100
100
|
isDrafting: boolean;
|
|
101
|
-
/** The draft dollar value estimate of the checkout. Not the actual quote. **/
|
|
102
|
-
draftDollarValue: null | number;
|
|
103
101
|
/** The final dollar value of the checkout. Derived from latestQuote. **/
|
|
104
102
|
finalDollarValue: null | number;
|
|
105
103
|
/** Whether the checkout quote is being fetched **/
|
|
@@ -134,11 +132,10 @@ interface FunkitCheckoutContextInterface {
|
|
|
134
132
|
checkoutHistoryCurrentDepositAddrMap: CheckoutHistoryDepositAddrMap;
|
|
135
133
|
isCheckoutHistoryInited: boolean;
|
|
136
134
|
isRefreshingCheckoutHistory: boolean;
|
|
137
|
-
reDraftSymbol: symbol;
|
|
138
135
|
startCheckoutHistoryListener(recipientAddr?: Address | undefined): NodeJS.Timeout;
|
|
139
136
|
stopCheckoutHistoryListener(cancelIntervalId?: NodeJS.Timeout): void;
|
|
140
137
|
initNewCheckout(initSettings: useFunkitCheckoutPropsFinal): string;
|
|
141
|
-
updateSourceAsset(selectedSource: Omit<AssetHoldingsItem, 'amount' | 'usdAmount'>): void;
|
|
138
|
+
updateSourceAsset(selectedSource: Omit<AssetHoldingsItem, 'amount' | 'usdAmount' | 'chainSymbolKey'>): void;
|
|
142
139
|
updateTargetAssetAmount(newTargetAssetAmount: number): void;
|
|
143
140
|
updateSelectedPaymentMethodInfo(newPaymentMethodInfo: PaymentMethodInfo): void;
|
|
144
141
|
confirmCheckout(shouldBatchOpBypassInit: boolean, stepMessageSetter: (m: string) => void): Promise<Address>;
|
|
@@ -150,7 +147,6 @@ interface FunkitCheckoutContextInterface {
|
|
|
150
147
|
maxTargetAssetAmount: number | undefined;
|
|
151
148
|
errorObject?: any;
|
|
152
149
|
}>;
|
|
153
|
-
getCheckoutDraftDollarValue(): Promise<number>;
|
|
154
150
|
generateSignedBatchOperation(actionsParams: FunkitCheckoutActionParams[], assetChainId: string, bypassWalletInit: boolean, stepMessageSetter: (m: string) => void): Promise<null | Operation>;
|
|
155
151
|
setCheckoutQuote(quote: FunkitActiveCheckoutItem): void;
|
|
156
152
|
setCompletedTimestamp(timestampMs: number): void;
|
|
@@ -7,11 +7,15 @@ export interface KnownAssetBalanceInfo extends AssetBalanceInfo {
|
|
|
7
7
|
price: number;
|
|
8
8
|
totalUsdValue: number;
|
|
9
9
|
}
|
|
10
|
+
export declare enum LoginType {
|
|
11
|
+
Web2 = "web2",
|
|
12
|
+
Web3 = "web3",
|
|
13
|
+
Guest = "guest"
|
|
14
|
+
}
|
|
10
15
|
interface GeneralWalletContextProps {
|
|
11
16
|
walletAddress: Address | '';
|
|
12
17
|
isUserLoggedIn: boolean;
|
|
13
|
-
|
|
14
|
-
isWeb3Login: boolean;
|
|
18
|
+
loginType: LoginType;
|
|
15
19
|
userInfo: FunkitUserInfo;
|
|
16
20
|
funWallet: FunWallet | null;
|
|
17
21
|
funWalletAuth: Auth | null;
|
|
@@ -26,8 +30,7 @@ export declare const useGeneralWallet: () => GeneralWalletContextProps;
|
|
|
26
30
|
export declare const useFunkitAccount: () => {
|
|
27
31
|
account: "" | `0x${string}`;
|
|
28
32
|
isConnected: boolean;
|
|
29
|
-
|
|
30
|
-
isWeb3Login: boolean;
|
|
33
|
+
loginType: LoginType;
|
|
31
34
|
address: undefined;
|
|
32
35
|
addresses: undefined;
|
|
33
36
|
chain: undefined;
|
|
@@ -40,8 +43,7 @@ export declare const useFunkitAccount: () => {
|
|
|
40
43
|
} | {
|
|
41
44
|
account: "" | `0x${string}`;
|
|
42
45
|
isConnected: boolean;
|
|
43
|
-
|
|
44
|
-
isWeb3Login: boolean;
|
|
46
|
+
loginType: LoginType;
|
|
45
47
|
address: Address;
|
|
46
48
|
addresses: readonly [Address, ...Address[]];
|
|
47
49
|
chain: import("viem").Chain | undefined;
|
|
@@ -54,8 +56,7 @@ export declare const useFunkitAccount: () => {
|
|
|
54
56
|
} | {
|
|
55
57
|
account: "" | `0x${string}`;
|
|
56
58
|
isConnected: boolean;
|
|
57
|
-
|
|
58
|
-
isWeb3Login: boolean;
|
|
59
|
+
loginType: LoginType;
|
|
59
60
|
address: Address | undefined;
|
|
60
61
|
addresses: readonly Address[] | undefined;
|
|
61
62
|
chain: import("viem").Chain | undefined;
|
|
@@ -68,8 +69,7 @@ export declare const useFunkitAccount: () => {
|
|
|
68
69
|
} | {
|
|
69
70
|
account: "" | `0x${string}`;
|
|
70
71
|
isConnected: boolean;
|
|
71
|
-
|
|
72
|
-
isWeb3Login: boolean;
|
|
72
|
+
loginType: LoginType;
|
|
73
73
|
address: Address | undefined;
|
|
74
74
|
addresses: readonly Address[] | undefined;
|
|
75
75
|
chain: import("viem").Chain | undefined;
|
package/dist/utils/aborts.d.ts
CHANGED
package/dist/utils/assets.d.ts
CHANGED
|
@@ -1,33 +1,21 @@
|
|
|
1
|
+
import { AssetHoldingsItem, KnownAssetHoldingsItem } from '~/domains/wallet';
|
|
2
|
+
import { LoginType } from '~/providers/GeneralWalletProvider';
|
|
1
3
|
import { PaymentMethod } from '../domains/paymentMethods';
|
|
2
4
|
import { FunkitActiveCheckoutItem, FunkitCheckoutConfig } from '../providers/FunkitCheckoutContext';
|
|
3
5
|
import { FlagValues } from '../providers/FunkitFlagsProvider';
|
|
6
|
+
export type { AssetHoldingsItem, AssetHoldingsMap, KnownAssetHoldingsItem, } from '~/domains/wallet';
|
|
4
7
|
export declare const ASSETS_LOW_VALUE_THRESHOLD = 0.1;
|
|
5
8
|
export declare const getNormalizedTokenBalance: (tokenBalance: bigint | number, decimals: number) => number;
|
|
6
|
-
export declare const isAssetUsableToPayForCheckout: (flags: FlagValues, checkoutItem: FunkitActiveCheckoutItem, paymentMethod: PaymentMethod, assetChainId: string, assetTokenAddress: string,
|
|
9
|
+
export declare const isAssetUsableToPayForCheckout: (flags: FlagValues, checkoutItem: FunkitActiveCheckoutItem, paymentMethod: PaymentMethod, assetChainId: string, assetTokenAddress: string, loginType: LoginType) => {
|
|
7
10
|
isUsable: boolean;
|
|
8
11
|
reason: string;
|
|
9
12
|
};
|
|
10
|
-
export declare const getAssetSymbolWithMaxUsdValue: ({ accountHoldingsMap, filterSymbols, }: {
|
|
11
|
-
accountHoldingsMap: AssetHoldingsMap;
|
|
12
|
-
filterSymbols?: Array<string>;
|
|
13
|
-
}) => string | null;
|
|
14
13
|
export declare const L1_FEES_ESTIMATE = 20;
|
|
15
14
|
export declare const L2_FEES_ESTIMATE = 1;
|
|
16
15
|
export declare const L2_COST_MARGIN_MULTIPLIER = 1.2;
|
|
17
16
|
export declare const MESH_L1_FEES_ESTIMATE = 8;
|
|
18
17
|
export declare const MESH_L2_FEES_ESTIMATE = 2;
|
|
19
18
|
export declare const MESH_CUSTOM_CLIENT_FEE_PERCENT = 0.055;
|
|
20
|
-
export interface AssetHoldingsItem {
|
|
21
|
-
iconSrc: string | undefined;
|
|
22
|
-
symbol: string;
|
|
23
|
-
amount: number;
|
|
24
|
-
tokenAddress: `0x${string}`;
|
|
25
|
-
usdAmount: null | number;
|
|
26
|
-
pickedChainId: string;
|
|
27
|
-
}
|
|
28
|
-
export interface AssetHoldingsMap {
|
|
29
|
-
[symbol: string]: AssetHoldingsItem;
|
|
30
|
-
}
|
|
31
19
|
/**
|
|
32
20
|
* Estimating mesh fees
|
|
33
21
|
*/
|
|
@@ -40,15 +28,11 @@ export declare const getBaseFeeUsdEstimate: (checkoutItem: FunkitActiveCheckoutI
|
|
|
40
28
|
* Estimating overall fees
|
|
41
29
|
*/
|
|
42
30
|
export declare const getFeesUsdEstimate: (checkoutItem: FunkitActiveCheckoutItem, asset: AssetHoldingsItem) => number;
|
|
43
|
-
export declare const isAssetUsdAmountSufficient: (checkoutItem: FunkitActiveCheckoutItem, asset: AssetHoldingsItem | null) => boolean;
|
|
44
31
|
type RecommendedAsset = {
|
|
45
|
-
|
|
32
|
+
chainSymbolKey: string;
|
|
46
33
|
label: string | null;
|
|
47
|
-
}
|
|
48
|
-
export declare const getRecommendedAsset: (
|
|
49
|
-
/**
|
|
50
|
-
* @returns formatted max usable USD balance from a given assets map */
|
|
51
|
-
export declare const getTotalAssetBalance: (assets: AssetHoldingsMap) => string;
|
|
34
|
+
};
|
|
35
|
+
export declare const getRecommendedAsset: (checkoutItem: FunkitActiveCheckoutItem, accountHoldings: KnownAssetHoldingsItem[]) => RecommendedAsset | null;
|
|
52
36
|
/**
|
|
53
37
|
*
|
|
54
38
|
* @param {FunkitCheckoutConfig} checkoutConfig
|
|
@@ -56,4 +40,3 @@ export declare const getTotalAssetBalance: (assets: AssetHoldingsMap) => string;
|
|
|
56
40
|
* @returns targetChain either from the provided config or arbitrum chainId for dydxChain since that's a non evm chain processed with evm tech
|
|
57
41
|
*/
|
|
58
42
|
export declare const getMockedTargetChainId: ({ targetChain }: FunkitCheckoutConfig, mockedChains?: string[]) => string;
|
|
59
|
-
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type DeepPartial<T> = T extends number | string | boolean | null | undefined ? T : {
|
|
2
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
3
|
+
};
|
|
4
|
+
/** NOTE: merging arrays is undefined behavior */
|
|
5
|
+
export declare function deepMerge<T extends object>(origin: T, ...objects: DeepPartial<T>[]): T;
|
|
@@ -18,7 +18,11 @@ export declare enum FlagKey {
|
|
|
18
18
|
/** Whether to enable Token Transfer as a payment method. */
|
|
19
19
|
EnableTokenTransfer = "enable_token_transfer",
|
|
20
20
|
/** Token Transfer payment method accepted source chain and assets */
|
|
21
|
-
TokenTransferSourceChainsAndAssets = "token_transfer_source_chains_and_assets"
|
|
21
|
+
TokenTransferSourceChainsAndAssets = "token_transfer_source_chains_and_assets",
|
|
22
|
+
/** Token Transfer additional disclaimer text. */
|
|
23
|
+
TokenTransferAdditionalDisclaimer = "token_transfer_additional_disclaimer",
|
|
24
|
+
/** Maximum usd amount that can be checked out. */
|
|
25
|
+
MaxCheckoutUsd = "max_checkout_usd"
|
|
22
26
|
}
|
|
23
27
|
export declare const flagConfig: {
|
|
24
28
|
[FlagKey.DisableMantleSourceAssets]: BooleanFlagConfig;
|
|
@@ -28,4 +32,6 @@ export declare const flagConfig: {
|
|
|
28
32
|
[FlagKey.ShowPoweredTagline]: BooleanFlagConfig;
|
|
29
33
|
[FlagKey.EnableTokenTransfer]: BooleanFlagConfig;
|
|
30
34
|
[FlagKey.TokenTransferSourceChainsAndAssets]: StringFlagConfig;
|
|
35
|
+
[FlagKey.TokenTransferAdditionalDisclaimer]: StringFlagConfig;
|
|
36
|
+
[FlagKey.MaxCheckoutUsd]: StringFlagConfig;
|
|
31
37
|
};
|
package/dist/utils/payment.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { LoginType } from '~/providers/GeneralWalletProvider';
|
|
1
2
|
import { PaymentMethodInfo } from '../domains/paymentMethods';
|
|
2
3
|
/**
|
|
3
4
|
* Generate a string for backend to indicate the source of a checkout funds
|
|
4
5
|
*/
|
|
5
|
-
export declare function generateSourceOfFundString({ paymentMethodInfo,
|
|
6
|
+
export declare function generateSourceOfFundString({ paymentMethodInfo, loginType, walletAddress, }: {
|
|
6
7
|
paymentMethodInfo: PaymentMethodInfo;
|
|
7
|
-
|
|
8
|
-
isWeb3Login: boolean;
|
|
8
|
+
loginType: LoginType;
|
|
9
9
|
walletAddress: string | undefined;
|
|
10
10
|
}): string;
|