@funkit/connect 3.0.3 → 3.1.1
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 +50 -0
- package/dist/components/Dialog/Dialog.d.ts +10 -3
- package/dist/components/Dialog/DialogContent.css.d.ts +1 -0
- package/dist/components/DydxSwitchModalTab/DydxSwitchModalTab.d.ts +3 -4
- package/dist/components/ErrorBoundary/ErrorBoundary.d.ts +16 -0
- package/dist/components/ErrorBoundary/ErrorFallback.d.ts +2 -0
- package/dist/components/FunBottomBar/FunBottomBar.css.d.ts +1 -0
- package/dist/components/FunButton/FunButton.d.ts +3 -1
- package/dist/components/FunCountdown/FunCountdown.d.ts +5 -3
- package/dist/components/FunNotification/FunNotification.d.ts +1 -1
- package/dist/components/FunPayments/FunPaymentMeshType.d.ts +2 -2
- package/dist/components/FunPayments/FunPaymentMethods.d.ts +2 -1
- package/dist/components/FunPayments/FunPaymentMoonpayType.d.ts +4 -4
- package/dist/components/FunTransactionSummary/FunTransactionSummary.d.ts +1 -1
- package/dist/consts/customers.d.ts +1 -0
- package/dist/consts/payment.d.ts +1 -1
- package/dist/consts/quote.d.ts +1 -1
- package/dist/hooks/useAnimatedNavigation.d.ts +1 -0
- package/dist/hooks/useCheckoutAccountBalanceTransfer.d.ts +1 -1
- package/dist/hooks/useCheckoutType.d.ts +5 -11
- package/dist/hooks/useMesh.d.ts +1 -0
- package/dist/index.css +15 -15
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4776 -4141
- package/dist/modals/CheckoutModal/CheckoutComplete.d.ts +13 -0
- package/dist/modals/{FunCheckoutModal/FunCheckoutPrimaryInfo.d.ts → CheckoutModal/CheckoutPrimaryInfo.d.ts} +1 -1
- package/dist/modals/CheckoutModal/ConfirmationStep.d.ts +36 -0
- package/dist/modals/CheckoutModal/ConnectExchange.d.ts +16 -0
- package/dist/modals/CheckoutModal/FunCheckoutModal.d.ts +8 -0
- package/dist/modals/CheckoutModal/InputAmount.d.ts +10 -0
- package/dist/modals/CheckoutModal/MeshVerification.d.ts +14 -0
- package/dist/modals/CheckoutModal/PaymentSetup.d.ts +38 -0
- package/dist/modals/CheckoutModal/SelectAsset.d.ts +15 -0
- package/dist/modals/CheckoutModal/SelectPaymentMethod.d.ts +18 -0
- package/dist/modals/CheckoutModal/stepTransition.d.ts +74 -0
- package/dist/modals/CheckoutModal/useAccountBalancePostCheckout.d.ts +3 -0
- package/dist/modals/CheckoutModal/useAssetPrice.d.ts +9 -0
- package/dist/modals/CheckoutModal/useBottomSection.d.ts +2 -0
- package/dist/modals/CheckoutModal/useRedirectToCheckoutHistory.d.ts +3 -0
- package/dist/modals/CheckoutModal/useSourceAssetConfirm.d.ts +25 -0
- package/dist/modals/CheckoutModal/useUpdateSourceAssetForCard.d.ts +2 -0
- package/dist/providers/FunkitCheckoutContext.d.ts +24 -6
- package/dist/providers/FunkitMeshProvider.d.ts +12 -6
- package/dist/providers/FunkitMoonpayProvider.d.ts +3 -1
- package/dist/providers/ModalContext.d.ts +1 -1
- package/dist/utils/{assetAbort.d.ts → aborts.d.ts} +1 -0
- package/dist/utils/assets.d.ts +8 -1
- package/dist/utils/checkout.d.ts +2 -2
- package/dist/utils/exhaustiveCheck.d.ts +1 -0
- package/dist/utils/flags/config.d.ts +0 -10
- package/dist/utils/flags/index.d.ts +0 -1
- package/dist/utils/funLogger.d.ts +1 -1
- package/dist/utils/mesh.d.ts +1 -1
- package/dist/utils/purifyCheckoutHistoryItem.d.ts +3 -0
- package/dist/wallets/walletConnectors/chunk-FLTQRYFS.js +27 -0
- package/dist/wallets/walletConnectors/index.js +40 -40
- package/package.json +20 -6
- package/dist/components/FunMeshVerificationStep/FunMeshVerificationStep.d.ts +0 -12
- package/dist/modals/FunCheckoutModal/FunCheckoutConfirmationStep.d.ts +0 -8
- package/dist/modals/FunCheckoutModal/FunCheckoutConnectExchangeStep.d.ts +0 -10
- package/dist/modals/FunCheckoutModal/FunCheckoutInputAmountStep.d.ts +0 -9
- package/dist/modals/FunCheckoutModal/FunCheckoutModal.d.ts +0 -22
- package/dist/modals/FunCheckoutModal/FunCheckoutSelectAssetStep.d.ts +0 -10
- package/dist/modals/FunCheckoutModal/FunCheckoutVerifyDetailsStep.d.ts +0 -9
- package/dist/wallets/walletConnectors/{chunk-B5D7DYVV.js → chunk-2EMZOYQI.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-4HKPVECK.js → chunk-5K4DIMYR.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-KDGMYRMC.js → chunk-AUVBWDIK.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-4K3EKHXR.js → chunk-AXPQHNUI.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-5MVCKMZT.js → chunk-B7FHT3CB.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-HMDUVRZP.js → chunk-EFIENLEE.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-HLH777AC.js → chunk-L7QI6PBN.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-5NZLWT3Y.js → chunk-QP2BIVXD.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-YRK6XWL6.js → chunk-UWZQZY4S.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-VU6B3HMD.js → chunk-UZEMNN3Q.js} +3 -3
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
import { CheckoutModalCommonState, FunCheckoutStep } from './stepTransition';
|
|
3
|
+
export interface CheckoutCompleteState extends CheckoutModalCommonState {
|
|
4
|
+
step: FunCheckoutStep.CHECKOUT_COMPLETE;
|
|
5
|
+
depositAddress: Address;
|
|
6
|
+
}
|
|
7
|
+
type Props = {
|
|
8
|
+
modalState: CheckoutCompleteState;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
};
|
|
11
|
+
/** A placeholder component to handle redirecting to the checkout history page */
|
|
12
|
+
export declare function CheckoutComplete({ modalState, onClose }: Props): null;
|
|
13
|
+
export {};
|
|
@@ -7,7 +7,7 @@ export declare function CheckoutPrimaryInfoSnapshot({ checkoutItem, isLoading, p
|
|
|
7
7
|
preserveMinHeight?: boolean;
|
|
8
8
|
}): React.JSX.Element;
|
|
9
9
|
export declare function CheckoutPrimaryInfo({ checkoutId, prioritizeDraftValue, preserveMinHeight, }: {
|
|
10
|
-
checkoutId: string
|
|
10
|
+
checkoutId: string;
|
|
11
11
|
prioritizeDraftValue: boolean;
|
|
12
12
|
preserveMinHeight?: boolean;
|
|
13
13
|
}): React.JSX.Element | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Address } from 'viem';
|
|
3
|
+
import { PaymentMethodInfo } from '../../consts/payment';
|
|
4
|
+
import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition, TransitionPayload } from './stepTransition';
|
|
5
|
+
interface MoonpayDepositData {
|
|
6
|
+
depositToken: string;
|
|
7
|
+
depositTokenAmount: number;
|
|
8
|
+
depositTokenChainId: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* controls in what interval to refresh the quote data in case of a hard refresh, in case of pre-loading it controls when to set the data, should be more than `BEFORE_COUNTDOWN_ENDS_SEC` by at least 10 seconds to provide the API the time needed to complete the call
|
|
12
|
+
*/
|
|
13
|
+
export declare const ESTIMATE_REFRESH_INTERVAL_SEC = 60;
|
|
14
|
+
/**
|
|
15
|
+
* controls how soon before the end of `ESTIMATE_REFRESH_INTERVAL_SEC` to pre-load the quote data
|
|
16
|
+
*/
|
|
17
|
+
export declare const BEFORE_COUNTDOWN_ENDS_SEC = 10;
|
|
18
|
+
export interface ConfirmationStepState extends CheckoutModalCommonState {
|
|
19
|
+
step: FunCheckoutStep.CONFIRMATION;
|
|
20
|
+
paymentMethodInfo: PaymentMethodInfo;
|
|
21
|
+
countdown: number;
|
|
22
|
+
countdownKey: number;
|
|
23
|
+
beforeCountdownEndsSeconds: number;
|
|
24
|
+
onBeforeCountdownEnds?: () => void;
|
|
25
|
+
onCountdownLastSecond?: () => void;
|
|
26
|
+
onCountdownEnded?: () => void;
|
|
27
|
+
}
|
|
28
|
+
export type ConfirmationStepNext = TransitionPayload<{
|
|
29
|
+
depositAddress: Address;
|
|
30
|
+
step: FunCheckoutStep.CONFIRMATION;
|
|
31
|
+
moonpayData?: MoonpayDepositData;
|
|
32
|
+
paymentMethodInfo: PaymentMethodInfo;
|
|
33
|
+
}>;
|
|
34
|
+
export declare function confirmationStepNext(state: ConfirmationStepState, payload: ConfirmationStepNext): StepTransition[FunCheckoutStep.CONFIRMATION];
|
|
35
|
+
export declare function ConfirmationStep({ modalState, onNext, setModalState, }: StateTransitionProps<ConfirmationStepState, ConfirmationStepNext>): React.JSX.Element;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PaymentMethodInfo } from '../../consts/payment';
|
|
3
|
+
import { MeshExchanges } from '../../utils/mesh';
|
|
4
|
+
import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition, TransitionPayload } from './stepTransition';
|
|
5
|
+
export interface ConnectExchangeState extends CheckoutModalCommonState {
|
|
6
|
+
step: FunCheckoutStep.CONNECT_EXCHANGE;
|
|
7
|
+
exchange: MeshExchanges;
|
|
8
|
+
}
|
|
9
|
+
export type ConnectExchangeNext = TransitionPayload<{
|
|
10
|
+
step: FunCheckoutStep.CONNECT_EXCHANGE;
|
|
11
|
+
paymentMethodInfo: PaymentMethodInfo;
|
|
12
|
+
}>;
|
|
13
|
+
export declare function connectExchangeNext(state: ConnectExchangeState, payload: ConnectExchangeNext): StepTransition[FunCheckoutStep.CONNECT_EXCHANGE];
|
|
14
|
+
type Props = StateTransitionProps<ConnectExchangeState, ConnectExchangeNext>;
|
|
15
|
+
export declare function ConnectExchange({ modalState, onNext, setModalState }: Props): React.JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface FunCheckoutModalProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
checkoutId: string | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function FunCheckoutModal({ onClose, open, checkoutId, }: FunCheckoutModalProps): React.JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition, TransitionPayload } from './stepTransition';
|
|
3
|
+
export interface InputAmountState extends CheckoutModalCommonState {
|
|
4
|
+
step: FunCheckoutStep.INPUT_AMOUNT;
|
|
5
|
+
}
|
|
6
|
+
export type InputAmountNext = TransitionPayload<{
|
|
7
|
+
step: FunCheckoutStep.INPUT_AMOUNT;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function inputAmountNext(state: InputAmountState, payload: InputAmountNext): StepTransition[FunCheckoutStep.INPUT_AMOUNT];
|
|
10
|
+
export declare function InputAmount({ modalState, onNext, }: StateTransitionProps<InputAmountState, InputAmountNext>): React.JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Address } from 'viem';
|
|
3
|
+
import { PaymentMethodInfo } from '../../consts/payment';
|
|
4
|
+
import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition, TransitionPayload } from './stepTransition';
|
|
5
|
+
export interface MeshVerificationState extends CheckoutModalCommonState {
|
|
6
|
+
step: FunCheckoutStep.MESH_VERIFICATION;
|
|
7
|
+
paymentMethodInfo: PaymentMethodInfo;
|
|
8
|
+
}
|
|
9
|
+
export type MeshVerificationNext = TransitionPayload<{
|
|
10
|
+
depositAddress: Address;
|
|
11
|
+
step: FunCheckoutStep.MESH_VERIFICATION;
|
|
12
|
+
}>;
|
|
13
|
+
export declare function meshVerificationNext(state: MeshVerificationState, payload: MeshVerificationNext): StepTransition[FunCheckoutStep.MESH_VERIFICATION];
|
|
14
|
+
export declare function MeshVerification({ modalState, onNext, }: StateTransitionProps<MeshVerificationState, MeshVerificationNext>): React.JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Address } from 'viem';
|
|
3
|
+
import { PaymentMethod, PaymentMethodInfo } from '../../consts/payment';
|
|
4
|
+
import { MeshExchanges } from '../../utils/mesh';
|
|
5
|
+
import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition, TransitionPayload } from './stepTransition';
|
|
6
|
+
export type PaymentSetupState = CheckoutModalCommonState & {
|
|
7
|
+
step: FunCheckoutStep.PAYMENT_SETUP;
|
|
8
|
+
} & ({
|
|
9
|
+
paymentMethod: PaymentMethod.BROKERAGE;
|
|
10
|
+
} | {
|
|
11
|
+
paymentMethod: PaymentMethod.CARD;
|
|
12
|
+
paymentAddress: Address;
|
|
13
|
+
token: string;
|
|
14
|
+
tokenChainId: string;
|
|
15
|
+
depositAmount: number;
|
|
16
|
+
} | {
|
|
17
|
+
paymentMethod: PaymentMethod.TRANSFER;
|
|
18
|
+
address: Address;
|
|
19
|
+
});
|
|
20
|
+
export type PaymentSetupNext = TransitionPayload<{
|
|
21
|
+
step: FunCheckoutStep.PAYMENT_SETUP;
|
|
22
|
+
hasActiveConnection: true;
|
|
23
|
+
paymentMethod: PaymentMethod.BROKERAGE;
|
|
24
|
+
paymentInfo: PaymentMethodInfo;
|
|
25
|
+
} | {
|
|
26
|
+
step: FunCheckoutStep.PAYMENT_SETUP;
|
|
27
|
+
hasActiveConnection: false;
|
|
28
|
+
paymentMethod: PaymentMethod.BROKERAGE;
|
|
29
|
+
exchange: MeshExchanges;
|
|
30
|
+
} | {
|
|
31
|
+
step: FunCheckoutStep.PAYMENT_SETUP;
|
|
32
|
+
paymentMethod: PaymentMethod.CARD;
|
|
33
|
+
depositAddress: Address;
|
|
34
|
+
}>;
|
|
35
|
+
export declare function paymentSetupNext(state: PaymentSetupState, payload: PaymentSetupNext): StepTransition[FunCheckoutStep.PAYMENT_SETUP];
|
|
36
|
+
type Props = StateTransitionProps<PaymentSetupState, PaymentSetupNext>;
|
|
37
|
+
export declare function PaymentSetup({ modalState, onNext }: Props): React.JSX.Element | null;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PaymentMethodInfo } from '../../consts/payment';
|
|
3
|
+
import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition, TransitionPayload } from './stepTransition';
|
|
4
|
+
export interface SelectAssetState extends CheckoutModalCommonState {
|
|
5
|
+
step: FunCheckoutStep.SELECT_ASSET;
|
|
6
|
+
paymentMethodInfo: PaymentMethodInfo;
|
|
7
|
+
}
|
|
8
|
+
export type SelectAssetNext = TransitionPayload<{
|
|
9
|
+
step: FunCheckoutStep.SELECT_ASSET;
|
|
10
|
+
isQuoteSuccess: true;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function selectAssetNext(state: SelectAssetState, payload: SelectAssetNext): StepTransition[FunCheckoutStep.SELECT_ASSET];
|
|
13
|
+
type Props = StateTransitionProps<SelectAssetState, SelectAssetNext>;
|
|
14
|
+
export declare function SelectAsset({ modalState, onBack, onNext }: Props): React.JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PaymentMethod, PaymentMethodInfo } from '../../consts/payment';
|
|
3
|
+
import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition, TransitionPayload } from './stepTransition';
|
|
4
|
+
export interface SelectPaymentMethodState extends CheckoutModalCommonState {
|
|
5
|
+
step: FunCheckoutStep.SELECT_PAYMENT_METHOD;
|
|
6
|
+
}
|
|
7
|
+
export type SelectPaymentMethodNext = TransitionPayload<{
|
|
8
|
+
step: FunCheckoutStep.SELECT_PAYMENT_METHOD;
|
|
9
|
+
paymentMethod: PaymentMethod.TRANSFER | PaymentMethod.BROKERAGE;
|
|
10
|
+
} | {
|
|
11
|
+
step: FunCheckoutStep.SELECT_PAYMENT_METHOD;
|
|
12
|
+
paymentMethod: PaymentMethod.CARD | PaymentMethod.ACCOUNT_BALANCE;
|
|
13
|
+
paymentMethodInfo: PaymentMethodInfo;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function selectPaymentMethodNext(state: SelectPaymentMethodState, payload: SelectPaymentMethodNext): StepTransition[FunCheckoutStep.SELECT_PAYMENT_METHOD];
|
|
16
|
+
type Props = StateTransitionProps<SelectPaymentMethodState, SelectPaymentMethodNext>;
|
|
17
|
+
export declare function SelectPaymentMethod({ modalState, onNext, onClose }: Props): React.JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { FunkitActiveCheckoutItem } from '../../providers/FunkitCheckoutContext';
|
|
3
|
+
import { CheckoutCompleteState } from './CheckoutComplete';
|
|
4
|
+
import { ConfirmationStepNext, ConfirmationStepState } from './ConfirmationStep';
|
|
5
|
+
import { ConnectExchangeNext, ConnectExchangeState } from './ConnectExchange';
|
|
6
|
+
import { InputAmountNext, InputAmountState } from './InputAmount';
|
|
7
|
+
import { MeshVerificationNext, MeshVerificationState } from './MeshVerification';
|
|
8
|
+
import { PaymentSetupNext, PaymentSetupState } from './PaymentSetup';
|
|
9
|
+
import { SelectAssetNext, SelectAssetState } from './SelectAsset';
|
|
10
|
+
import { SelectPaymentMethodNext, SelectPaymentMethodState } from './SelectPaymentMethod';
|
|
11
|
+
export interface CheckoutModalCommonState {
|
|
12
|
+
checkoutId: string;
|
|
13
|
+
isSoftHidden: boolean;
|
|
14
|
+
countdown?: number;
|
|
15
|
+
countdownKey?: number;
|
|
16
|
+
beforeCountdownEndsSeconds?: number;
|
|
17
|
+
onBeforeCountdownEnds?: () => void;
|
|
18
|
+
onCountdownLastSecond?: () => void;
|
|
19
|
+
onCountdownEnded?: () => void;
|
|
20
|
+
}
|
|
21
|
+
export interface StateTransitionProps<T, N> {
|
|
22
|
+
modalState: T;
|
|
23
|
+
setModalState: Dispatch<SetStateAction<CheckoutModalState>>;
|
|
24
|
+
onNext: (payload: N) => void;
|
|
25
|
+
onBack: () => void;
|
|
26
|
+
onClose: () => void;
|
|
27
|
+
}
|
|
28
|
+
export declare function extractCommonState(state: CheckoutModalState): CheckoutModalCommonState;
|
|
29
|
+
type CheckoutModalState = ConfirmationStepState | ConnectExchangeState | InputAmountState | SelectAssetState | SelectPaymentMethodState | PaymentSetupState | MeshVerificationState | CheckoutCompleteState;
|
|
30
|
+
export declare enum FunCheckoutStep {
|
|
31
|
+
INPUT_AMOUNT = "input_amount",
|
|
32
|
+
SELECT_PAYMENT_METHOD = "select_payment",
|
|
33
|
+
CONFIRMATION = "confirmation",
|
|
34
|
+
PAYMENT_SETUP = "payment_setup",
|
|
35
|
+
CONNECT_EXCHANGE = "connect_exchange",
|
|
36
|
+
SELECT_ASSET = "select_asset",
|
|
37
|
+
MESH_VERIFICATION = "mesh_verification",
|
|
38
|
+
CHECKOUT_COMPLETE = "checkout_complete"
|
|
39
|
+
}
|
|
40
|
+
export interface StepTransition {
|
|
41
|
+
[FunCheckoutStep.INPUT_AMOUNT]: SelectPaymentMethodState | InputAmountState;
|
|
42
|
+
[FunCheckoutStep.SELECT_PAYMENT_METHOD]: SelectAssetState | PaymentSetupState | ConfirmationStepState | InputAmountState;
|
|
43
|
+
[FunCheckoutStep.CONFIRMATION]: MeshVerificationState | PaymentSetupState | SelectPaymentMethodState | SelectAssetState | ConfirmationStepState | CheckoutCompleteState;
|
|
44
|
+
[FunCheckoutStep.PAYMENT_SETUP]: SelectAssetState | ConnectExchangeState | SelectPaymentMethodState | CheckoutCompleteState;
|
|
45
|
+
[FunCheckoutStep.CONNECT_EXCHANGE]: SelectAssetState | PaymentSetupState;
|
|
46
|
+
[FunCheckoutStep.SELECT_ASSET]: SelectPaymentMethodState | PaymentSetupState | ConfirmationStepState;
|
|
47
|
+
[FunCheckoutStep.MESH_VERIFICATION]: ConfirmationStepState | MeshVerificationState | CheckoutCompleteState;
|
|
48
|
+
}
|
|
49
|
+
export type TransitionPayload<T extends {
|
|
50
|
+
step: FunCheckoutStep;
|
|
51
|
+
}> = (T & {
|
|
52
|
+
isBack?: false;
|
|
53
|
+
}) | {
|
|
54
|
+
step: T['step'];
|
|
55
|
+
isBack: true;
|
|
56
|
+
};
|
|
57
|
+
type NextPayload = ConfirmationStepNext | ConnectExchangeNext | InputAmountNext | MeshVerificationNext | PaymentSetupNext | SelectAssetNext | SelectPaymentMethodNext | TransitionPayload<{
|
|
58
|
+
step: FunCheckoutStep.CHECKOUT_COMPLETE;
|
|
59
|
+
}>;
|
|
60
|
+
export declare function useCheckoutModalTransition(checkoutItem: FunkitActiveCheckoutItem, onClose: () => void): {
|
|
61
|
+
animateOut: boolean;
|
|
62
|
+
modalState: CheckoutModalState;
|
|
63
|
+
onBack: () => void;
|
|
64
|
+
onCloseWrapper: () => void;
|
|
65
|
+
onNext: (payload: NextPayload) => void;
|
|
66
|
+
setModalState: Dispatch<SetStateAction<CheckoutModalState>>;
|
|
67
|
+
};
|
|
68
|
+
interface TitleConfig {
|
|
69
|
+
hasBack: boolean;
|
|
70
|
+
title: string;
|
|
71
|
+
showFullHeight: boolean;
|
|
72
|
+
}
|
|
73
|
+
export declare function useTitleConfig(checkoutItem: FunkitActiveCheckoutItem, state: CheckoutModalState): TitleConfig;
|
|
74
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
import { useFunkitConfig } from '../../providers/FunkitConfigContext';
|
|
3
|
+
export declare function useAccountBalancePostCheckout(checkoutId: string, setPostCheckoutStepMessage: (s: string) => void, funkitConfig: ReturnType<typeof useFunkitConfig>): (depositAddress: Address) => Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
export declare function useAssetPrice({ chainId, assetTokenAddress, }: {
|
|
3
|
+
chainId: string | undefined;
|
|
4
|
+
assetTokenAddress: Address | undefined;
|
|
5
|
+
}): {
|
|
6
|
+
error: Error | null;
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
unitPrice: number | undefined;
|
|
9
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PaymentMethodInfo } from '../../consts/payment';
|
|
2
|
+
import { FunkitActiveCheckoutItem } from '../../providers/FunkitCheckoutContext';
|
|
3
|
+
export interface SourceAssetConfirmed {
|
|
4
|
+
isQuoteSuccess: boolean;
|
|
5
|
+
newPaymentMethodInfo: PaymentMethodInfo;
|
|
6
|
+
quoteObject?: FunkitActiveCheckoutItem;
|
|
7
|
+
}
|
|
8
|
+
export type OnSourceAssetConfirmed = (confirmed: SourceAssetConfirmed | undefined) => void;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* Note: this hook is EXTREMELY confusing in what is doing
|
|
12
|
+
* first, it useHackyTriggerWorkaroundReactDevBrainExplode to wait React's setState
|
|
13
|
+
* and read the latest update of the checkoutItem
|
|
14
|
+
* second, it will trigger a quote request to the backend
|
|
15
|
+
* and write the value back to the checkoutItem
|
|
16
|
+
* finally, it will also set the newPaymentMethodInfo to
|
|
17
|
+
* the checkoutItem
|
|
18
|
+
*
|
|
19
|
+
* USE THIS WITH CAUTION
|
|
20
|
+
**/
|
|
21
|
+
export declare function useTriggerQuoteAndOtherStuffsWithExtremeCaution(checkoutId: string, onSuccess: (confirmed: SourceAssetConfirmed | undefined) => void, setPreloadedQuoteData?: (quoteData: FunkitActiveCheckoutItem) => void): {
|
|
22
|
+
isSourceAssetConfirming: boolean;
|
|
23
|
+
triggerAssetConfirm: () => void;
|
|
24
|
+
onSourceAssetConfirmed: (preloadQuoteData?: boolean) => Promise<SourceAssetConfirmed | undefined>;
|
|
25
|
+
};
|
|
@@ -4,6 +4,7 @@ import { Abi, Address } from 'viem';
|
|
|
4
4
|
import { CheckoutFeesBreakdownItem } from '../consts/checkoutFees';
|
|
5
5
|
import { PaymentMethod, PaymentMethodInfo } from '../consts/payment';
|
|
6
6
|
import { CheckoutHistoryStateMap } from '../utils/checkout';
|
|
7
|
+
import { PurifiedCheckoutHistoryItem } from '../utils/purifyCheckoutHistoryItem';
|
|
7
8
|
export interface FunkitCheckoutActionParams {
|
|
8
9
|
contractAbi: Abi;
|
|
9
10
|
contractAddress: Address;
|
|
@@ -16,8 +17,6 @@ export interface FunkitCheckoutConfig {
|
|
|
16
17
|
/** ****************************
|
|
17
18
|
* Api-related configurations *
|
|
18
19
|
******************************/
|
|
19
|
-
/** List of contract action params **/
|
|
20
|
-
actionsParams: FunkitCheckoutActionParams[];
|
|
21
20
|
/** The ID of the chain where the checkout operation is to be performed. **/
|
|
22
21
|
targetChain: string;
|
|
23
22
|
/** The wanted asset for the checkout operation. This can be either a chain native token (by specifying NATIVE_TOKEN) or an ERC-20 token (by specifying actual token address) on the target chain. **/
|
|
@@ -32,6 +31,8 @@ export interface FunkitCheckoutConfig {
|
|
|
32
31
|
customRecipient?: Address | DydxAddress;
|
|
33
32
|
/** If available, the specified payment method will be selected by default during checkout or deposits **/
|
|
34
33
|
defaultPaymentMethod?: PaymentMethod | undefined;
|
|
34
|
+
/** List of contract action params **/
|
|
35
|
+
generateActionsParams?: (targetAssetAmount: number) => FunkitCheckoutActionParams[];
|
|
35
36
|
/** ****************************************
|
|
36
37
|
* Checkout ModalUI-related configurations *
|
|
37
38
|
*******************************************/
|
|
@@ -126,8 +127,6 @@ export interface FunkitActiveCheckoutItem {
|
|
|
126
127
|
symbol: string | null;
|
|
127
128
|
chainId: string;
|
|
128
129
|
};
|
|
129
|
-
/** Whether the checkout is fastforwarded to confirmation page because the user's funwallet already has sufficient target asset */
|
|
130
|
-
isFastForwarded: boolean;
|
|
131
130
|
}
|
|
132
131
|
export declare function FunkitCheckoutProvider({ children }: {
|
|
133
132
|
children: ReactNode;
|
|
@@ -142,12 +141,17 @@ interface useFunkitPreCheckoutInternalReturn {
|
|
|
142
141
|
cancelCheckout: (depositAddress: Address) => Promise<boolean>;
|
|
143
142
|
getCheckoutDraftDollarValue: () => Promise<void>;
|
|
144
143
|
clearCheckoutQuoteMessages: () => void;
|
|
145
|
-
getCheckoutQuote: (sponsorInitialTransferGasLimit: number, newPaymentMethodInfo: PaymentMethodInfo) => Promise<
|
|
144
|
+
getCheckoutQuote: (sponsorInitialTransferGasLimit: number, newPaymentMethodInfo: PaymentMethodInfo, disableInformationStreaming?: boolean) => Promise<{
|
|
145
|
+
success: boolean;
|
|
146
|
+
shellCheckoutItemWithNextQuote: FunkitActiveCheckoutItem | undefined;
|
|
147
|
+
errorObject?: any;
|
|
148
|
+
}>;
|
|
149
|
+
setCheckoutQuote: (quote: FunkitActiveCheckoutItem) => void;
|
|
146
150
|
}
|
|
147
151
|
/**
|
|
148
152
|
* Internal hook to handle frontend pre-checkout operations, PER-CHECKOUT ITEM.
|
|
149
153
|
*/
|
|
150
|
-
export declare const useFunkitPreCheckoutInternal: (checkoutId: string
|
|
154
|
+
export declare const useFunkitPreCheckoutInternal: (checkoutId: string) => useFunkitPreCheckoutInternalReturn;
|
|
151
155
|
/**
|
|
152
156
|
* Internal hook to handle post-checkout, PER-BACKEND-CHECKOUT ITEM.
|
|
153
157
|
*/
|
|
@@ -172,4 +176,18 @@ export declare const useFunkitAllPostCheckoutsInternal: () => {
|
|
|
172
176
|
export declare const useFunkitCheckout: (props: useFunkitCheckoutProps) => {
|
|
173
177
|
beginCheckout: (inputConfig?: FunkitCheckoutConfig) => Promise<void>;
|
|
174
178
|
};
|
|
179
|
+
/**
|
|
180
|
+
* External hook to listen for checkout history every 5000ms
|
|
181
|
+
*
|
|
182
|
+
* @param userId ID of the user (wallet address)
|
|
183
|
+
* @returns PurifiedCheckoutHistoryItem[]
|
|
184
|
+
*/
|
|
185
|
+
export declare function useCheckoutsListenerByUserId(userId: string): PurifiedCheckoutHistoryItem[];
|
|
186
|
+
/**
|
|
187
|
+
* External hook to listen for checkout history every 5000ms
|
|
188
|
+
*
|
|
189
|
+
* @param checkoutId ID of the checkout
|
|
190
|
+
* @returns PurifiedCheckoutHistoryItem | undefined
|
|
191
|
+
*/
|
|
192
|
+
export declare function useCheckoutListenerByCheckoutId(checkoutId: string): PurifiedCheckoutHistoryItem | undefined;
|
|
175
193
|
export {};
|
|
@@ -7,14 +7,20 @@ interface MeshBrokerDataMap {
|
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
export declare function FunkitMeshProvider({ children }: any): React.JSX.Element;
|
|
10
|
-
export declare function useFunkitMesh(
|
|
11
|
-
onBeforeConnect?: () => void;
|
|
12
|
-
onConnected?: (brokerData: LinkPayload | null) => void;
|
|
13
|
-
onMeshModalClose?: () => void;
|
|
14
|
-
}): {
|
|
10
|
+
export declare function useFunkitMesh(_notUsedToDelete?: unknown): {
|
|
15
11
|
meshBrokerDataMap: MeshBrokerDataMap;
|
|
16
|
-
connectToBrokerage: (brokerage: MeshExchanges) => Promise<void>;
|
|
17
12
|
unlinkBrokerage: (exchange: MeshExchanges) => void;
|
|
18
13
|
hasActiveConnectionCheck: (brokerage: MeshExchanges) => boolean;
|
|
19
14
|
};
|
|
15
|
+
interface FunkitMeshHook {
|
|
16
|
+
onBeforeConnect(): void;
|
|
17
|
+
onConnected(brokerData: LinkPayload | null): void;
|
|
18
|
+
onMeshModalClose(): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* all hooks SHOULD be in object method style
|
|
22
|
+
* capturing the latest value in render.
|
|
23
|
+
* useMeshConnect will return a stable function.
|
|
24
|
+
* */
|
|
25
|
+
export declare function useMeshConnect(hooks: FunkitMeshHook): (brokerage: MeshExchanges) => Promise<void>;
|
|
20
26
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { FunButtonProps } from '../components/FunButton/FunButton';
|
|
2
3
|
export declare function FunkitMoonpayProvider({ children, debug, }: {
|
|
3
4
|
children: any;
|
|
4
5
|
debug: boolean;
|
|
@@ -16,9 +17,10 @@ interface UserIpInfoFromMoonpay {
|
|
|
16
17
|
isLowLimitEnabled: boolean;
|
|
17
18
|
state: string;
|
|
18
19
|
}
|
|
20
|
+
export declare const geoCheckInProgressProps: FunButtonProps;
|
|
19
21
|
export declare function useFunkitUserIp(): {
|
|
20
|
-
userIpInfo: UserIpInfoFromMoonpay | null;
|
|
21
22
|
isLoadingGeoCheck: boolean;
|
|
22
23
|
isUserBlockedForCheckout: boolean;
|
|
24
|
+
userIpInfo: UserIpInfoFromMoonpay | undefined;
|
|
23
25
|
};
|
|
24
26
|
export {};
|
|
@@ -11,7 +11,7 @@ export declare function useModalState(): {
|
|
|
11
11
|
};
|
|
12
12
|
export declare function useAccountModal(): {
|
|
13
13
|
accountModalOpen: boolean;
|
|
14
|
-
openAccountModal: ((tab
|
|
14
|
+
openAccountModal: ((tab?: SelectedHomeTab | null) => void) | undefined;
|
|
15
15
|
};
|
|
16
16
|
export declare function useChainModal(): {
|
|
17
17
|
chainModalOpen: boolean;
|
package/dist/utils/assets.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PaymentMethod } from '../consts/payment';
|
|
2
|
-
import { FunkitActiveCheckoutItem } from '../providers/FunkitCheckoutContext';
|
|
2
|
+
import { FunkitActiveCheckoutItem, FunkitCheckoutConfig } from '../providers/FunkitCheckoutContext';
|
|
3
3
|
export declare const getNormalizedTokenBalance: (tokenBalance: number, decimals: number) => number;
|
|
4
4
|
export declare const isAssetUsableToPayForCheckout: (checkoutItem: FunkitActiveCheckoutItem, paymentMethod: PaymentMethod, assetChainId: string, assetTokenAddress: string, isWeb2Login: boolean, isWeb3Login: boolean) => {
|
|
5
5
|
isUsable: boolean;
|
|
@@ -30,3 +30,10 @@ export type RecommendedAsset = {
|
|
|
30
30
|
label: string | null;
|
|
31
31
|
} | null;
|
|
32
32
|
export declare const getRecommendedAsset: (checkoutItem: FunkitActiveCheckoutItem, accountHoldingsMap: AssetHoldingsMap, isWeb3Login: boolean, isWeb2Login: boolean) => RecommendedAsset;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @param {FunkitCheckoutConfig} checkoutConfig
|
|
36
|
+
* @param mockedChains optional array of additional chains we want to replace with FALLBACK_CHAIN_ID
|
|
37
|
+
* @returns targetChain either from the provided config or arbitrum chainId for dydxChain since that's a non evm chain processed with evm tech
|
|
38
|
+
*/
|
|
39
|
+
export declare const getMockedTargetChainId: ({ targetChain }: FunkitCheckoutConfig, mockedChains?: string[]) => string;
|
package/dist/utils/checkout.d.ts
CHANGED
|
@@ -117,10 +117,10 @@ export declare function getEstimateEndTimeInfo(createdTimeMs: number, checkoutIt
|
|
|
117
117
|
isExceededEstimation: boolean;
|
|
118
118
|
};
|
|
119
119
|
/**
|
|
120
|
-
* Given a checkout config
|
|
120
|
+
* Given a checkout config, returns the display string for the checkout item.
|
|
121
121
|
* Arbitary action checkouts: Display the checkoutItemAmount if it is greater than 0, otherwise display the checkoutItemTitle.
|
|
122
122
|
* - e.g. "2.1234 aArbUSDCn" or "Staked VRTX"
|
|
123
123
|
* Basic buy checkouts: Display the targetAssetAmount with the targetAssetTicker.
|
|
124
124
|
* - e.g. "0.12345 ETH"
|
|
125
125
|
*/
|
|
126
|
-
export declare function getCheckoutItemDisplay(checkoutConfig: FunkitCheckoutConfig,
|
|
126
|
+
export declare function getCheckoutItemDisplay(checkoutConfig: FunkitCheckoutConfig, hideAmount?: boolean): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function exhaustiveCheck(_value: never): any;
|
|
@@ -5,15 +5,6 @@ import type { BooleanFlagConfig, StringFlagConfig } from './types';
|
|
|
5
5
|
* Once we ship a feature flag, we can't change the key.
|
|
6
6
|
*/
|
|
7
7
|
export declare enum FlagKey {
|
|
8
|
-
/** Custom text for the select payment method button */
|
|
9
|
-
SelectPaymentMethodText = "select_payment_method_text",
|
|
10
|
-
/**
|
|
11
|
-
* Changing the copy for each of three payment methods:
|
|
12
|
-
* - “Cross-Chain Swap” → Wallet
|
|
13
|
-
* - “Debit or Credit” → Card
|
|
14
|
-
* - “Brokerage or Exchange” → Exchange
|
|
15
|
-
*/
|
|
16
|
-
PaymentMethodCopyV1 = "payment_method_copy_v1",
|
|
17
8
|
/** Whether mantle assets can be used as source asset for payment for any checkout */
|
|
18
9
|
DisableMantleSourceAssets = "disable_mantle_source_assets",
|
|
19
10
|
/** Whether zksync assets can be used as source asset for payment in a mantle checkout */
|
|
@@ -28,7 +19,6 @@ export declare enum FlagKey {
|
|
|
28
19
|
ShowPoweredTagline = "show_powered_tagline"
|
|
29
20
|
}
|
|
30
21
|
export declare const flagConfig: {
|
|
31
|
-
[FlagKey.PaymentMethodCopyV1]: BooleanFlagConfig;
|
|
32
22
|
[FlagKey.DisableMantleSourceAssets]: BooleanFlagConfig;
|
|
33
23
|
[FlagKey.DisableZkSyncSourceAssetsForMantleCheckouts]: BooleanFlagConfig;
|
|
34
24
|
[FlagKey.DisableZkSyncSourceAssetsForDydxCheckouts]: BooleanFlagConfig;
|
|
@@ -2,7 +2,6 @@ import { FlagKey } from './config';
|
|
|
2
2
|
import { FeatureFlag } from './impl';
|
|
3
3
|
export { FlagKey };
|
|
4
4
|
declare const singleton: FeatureFlag<{
|
|
5
|
-
payment_method_copy_v1: import("./types").BooleanFlagConfig;
|
|
6
5
|
disable_mantle_source_assets: import("./types").BooleanFlagConfig;
|
|
7
6
|
disable_zksync_source_assets_for_mantle_checkouts: import("./types").BooleanFlagConfig;
|
|
8
7
|
disable_zksync_source_assets_for_dydx_checkouts: import("./types").BooleanFlagConfig;
|
package/dist/utils/mesh.d.ts
CHANGED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CheckoutHistoryItem } from '@funkit/api-base';
|
|
2
|
+
export type PurifiedCheckoutHistoryItem = Pick<CheckoutHistoryItem, 'depositAddr' | 'state' | 'fromChainId' | 'fromTokenAddress' | 'toChainId' | 'toTokenAddress' | 'toAmountBaseUnit'>;
|
|
3
|
+
export declare const purifyCheckoutHistoryItem: (item: CheckoutHistoryItem) => PurifiedCheckoutHistoryItem;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
getInjectedConnector,
|
|
4
|
+
hasInjectedProvider
|
|
5
|
+
} from "./chunk-WRA2DVJ7.js";
|
|
6
|
+
import {
|
|
7
|
+
isIOS
|
|
8
|
+
} from "./chunk-RETKWSKD.js";
|
|
9
|
+
|
|
10
|
+
// src/wallets/walletConnectors/dawnWallet/dawnWallet.ts
|
|
11
|
+
var dawnWallet = () => ({
|
|
12
|
+
id: "dawn",
|
|
13
|
+
name: "Dawn",
|
|
14
|
+
iconUrl: async () => (await import("./dawnWallet-ONVAA3S4.js")).default,
|
|
15
|
+
iconBackground: "#000000",
|
|
16
|
+
installed: hasInjectedProvider({ flag: "isDawn" }),
|
|
17
|
+
hidden: () => !isIOS(),
|
|
18
|
+
downloadUrls: {
|
|
19
|
+
ios: "https://apps.apple.com/us/app/dawn-ethereum-wallet/id1673143782",
|
|
20
|
+
mobile: "https://dawnwallet.xyz"
|
|
21
|
+
},
|
|
22
|
+
createConnector: getInjectedConnector({ flag: "isDawn" })
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
dawnWallet
|
|
27
|
+
};
|