@funkit/connect 5.5.12 → 5.5.13-next.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 +38 -0
- package/dist/components/AnimatedDollarValue/AnimatedDollarValue.d.ts +1 -0
- package/dist/components/Dialog/Dialog.d.ts +1 -1
- package/dist/components/Dialog/hooks.d.ts +7 -2
- package/dist/components/Dropdown/BaseDropdown.css.d.ts +1 -0
- package/dist/components/Dropdown/BaseDropdown.d.ts +7 -1
- package/dist/components/Dropdown/ChainDropdown.d.ts +5 -1
- package/dist/components/Dropdown/TokenAndChainDropdown.d.ts +28 -0
- package/dist/components/Dropdown/TokenDropdown.d.ts +3 -1
- package/dist/components/FunButton/FunButton.d.ts +1 -1
- package/dist/components/FunInput/FunInput.d.ts +9 -4
- package/dist/components/FunTransactionSummary/PaymentFeesSummary.d.ts +4 -1
- package/dist/components/Icons/New/BlueCircularWalletIcon.d.ts +4 -0
- package/dist/components/NewTokenDepositAlert/NewTokenDepositAlert.d.ts +1 -1
- package/dist/components/TransferTokenDetails/TransferTokenDetails.d.ts +1 -2
- package/dist/components/Withdraw/WithdrawContent.d.ts +19 -0
- package/dist/components/Withdraw/WithdrawSuccess.d.ts +13 -0
- package/dist/domains/quote.d.ts +6 -2
- package/dist/hooks/queries/useErc20Asset.d.ts +4 -0
- package/dist/hooks/queries/useWithdrawalQuote.d.ts +20 -0
- package/dist/hooks/queries/useWithdrawalRisk.d.ts +1 -0
- package/dist/hooks/useCheckoutDirectExecution.d.ts +2 -0
- package/dist/hooks/useCheckoutDirectExecutionHistory.d.ts +1 -0
- package/dist/hooks/useCheckoutTransferInit.d.ts +4 -2
- package/dist/hooks/useTokenChain.d.ts +20 -0
- package/dist/hooks/useTokenTransfer.d.ts +4 -1
- package/dist/hooks/useWithdrawal.d.ts +15 -0
- package/dist/index.css +175 -165
- package/dist/index.d.ts +2 -2
- package/dist/index.js +20193 -19132
- package/dist/modals/CheckoutModal/ConfirmationStep/usePostCheckout.d.ts +1 -0
- package/dist/modals/CheckoutModal/InputAmount/InputAmount.d.ts +1 -0
- package/dist/modals/CheckoutModal/InputAmount/useAmountInput.d.ts +2 -1
- package/dist/modals/CheckoutModal/InputAmount/useAssetPrice.d.ts +16 -4
- package/dist/modals/CheckoutModal/LoadingAccount.d.ts +6 -2
- package/dist/modals/CheckoutModal/SelectAsset.d.ts +2 -1
- package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +7 -2
- package/dist/modals/CheckoutModal/TransferToken/TransferToken.d.ts +2 -4
- package/dist/modals/CheckoutModal/VirtualFiatAccount/FiatAccountDetail.d.ts +1 -0
- package/dist/modals/WithdrwalModal/WithdrawalModal.d.ts +13 -0
- package/dist/providers/FunkitCheckoutContext.d.ts +36 -2
- package/dist/providers/ModalContext.d.ts +6 -0
- package/dist/utils/directExecution.d.ts +2 -4
- package/dist/utils/flags/config.d.ts +8 -12
- package/dist/wallets/Wallet.d.ts +13 -0
- package/dist/wallets/walletConnectors/index.js +45 -45
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @funkit/connect
|
|
2
2
|
|
|
3
|
+
## 5.5.13-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e88a3d2: feat(connect): adjust auto-picking of provider quotes for Meld
|
|
8
|
+
- 0bf9fe3: feat(connect): update colors of tooltip texts for Withdrawal
|
|
9
|
+
- bd7721e: feat(connect): withdrawal handle wallet signature rejection
|
|
10
|
+
- 3d7fc1d: fix bridge fee in ui
|
|
11
|
+
- 85809cb: feat(connect): add risk assessment check for withdrawal address
|
|
12
|
+
- 5217122: feat: omit eoa calls in withdrawal flow
|
|
13
|
+
- cdf268c: refactor: rename fill gas to fill cost
|
|
14
|
+
- 3c8d98d: feat(connect): if the user is new, default to the Payment Methods screen, hide the SourcePaymentMethodItem, and enable the back button
|
|
15
|
+
- b095215: feat(connect): unify rendering of fees for withdrawal with relay
|
|
16
|
+
- 66b28fe: fix: update asset price refresh interval in withdrawal
|
|
17
|
+
- 6db3c9c: add loading state to withdrawal in progress
|
|
18
|
+
- e389c2b: wider price impact tooltip
|
|
19
|
+
- e3bba71: feat(connect): transfer crypto - minimum amount info"
|
|
20
|
+
- Updated dependencies [f49824b]
|
|
21
|
+
- Updated dependencies [57f6bd8]
|
|
22
|
+
- Updated dependencies [b223027]
|
|
23
|
+
- @funkit/fun-relay@0.1.9-next.1
|
|
24
|
+
- @funkit/api-base@1.9.5-next.1
|
|
25
|
+
- @funkit/core@2.3.27-next.1
|
|
26
|
+
- @funkit/wagmi-tools@3.0.49-next.1
|
|
27
|
+
|
|
28
|
+
## 5.5.13-next.0
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- d1133df: support withdrawal
|
|
33
|
+
- Updated dependencies [d1133df]
|
|
34
|
+
- @funkit/api-base@1.9.5-next.0
|
|
35
|
+
- @funkit/chains@0.3.2-next.0
|
|
36
|
+
- @funkit/core@2.3.27-next.0
|
|
37
|
+
- @funkit/fun-relay@0.1.9-next.0
|
|
38
|
+
- @funkit/utils@1.1.4-next.0
|
|
39
|
+
- @funkit/wagmi-tools@3.0.49-next.0
|
|
40
|
+
|
|
3
41
|
## 5.5.12
|
|
4
42
|
|
|
5
43
|
### Patch Changes
|
|
@@ -2,6 +2,7 @@ import { type NumberFlowProps, type NumberFlowElement } from '@number-flow/react
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
type AnimatedDollarValueProps = Omit<NumberFlowProps, 'format'> & {
|
|
4
4
|
ref?: React.Ref<NumberFlowElement>;
|
|
5
|
+
dynamicMinFractionDigits?: boolean;
|
|
5
6
|
};
|
|
6
7
|
export declare const AnimatedDollarValue: React.ForwardRefExoticComponent<Omit<AnimatedDollarValueProps, "ref"> & React.RefAttributes<NumberFlowElement>>;
|
|
7
8
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { type ReactNode } from 'react';
|
|
2
2
|
import { type BoxProps } from '../Box/Box';
|
|
3
|
-
export {
|
|
3
|
+
export { CHECKOUT_MODAL_TITLE_COUNTDOWN_ID, MODAL_BOTTOM_BAR_IDS, useBottomSectionRef, useTitleCountdownRef, } from './hooks';
|
|
4
4
|
interface DialogProps {
|
|
5
5
|
open: boolean;
|
|
6
6
|
onClose: () => void;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
1
|
+
export declare const MODAL_BOTTOM_BAR_IDS: {
|
|
2
|
+
readonly checkout: "checkout-modal-bottom-bar";
|
|
3
|
+
readonly withdrawal: "withdrawal-modal-bottom-bar";
|
|
4
|
+
};
|
|
5
|
+
type ModalBottomBarIdType = keyof typeof MODAL_BOTTOM_BAR_IDS;
|
|
6
|
+
export declare function useBottomSectionRef(modalBottomBarIdType?: ModalBottomBarIdType): HTMLElement | null;
|
|
3
7
|
export declare const CHECKOUT_MODAL_TITLE_COUNTDOWN_ID = "checkout-modal-title-countdown";
|
|
4
8
|
export declare function useTitleCountdownRef(): HTMLElement | null;
|
|
9
|
+
export {};
|
|
@@ -29,6 +29,12 @@ export interface BaseDropdownProps {
|
|
|
29
29
|
size?: BaseActiveDropdownItemProps['size'];
|
|
30
30
|
isLoading?: boolean;
|
|
31
31
|
label?: string;
|
|
32
|
+
/**
|
|
33
|
+
* If provided, the dropdown will be scrollable and the max height will be set to the provided value.
|
|
34
|
+
* This is useful for dropdowns that have a lot of options and normally would be too tall to fit in the modal and overflow beyond the modal is not supported right now.
|
|
35
|
+
* This values should be set so that the last dropdown item is partially visible to indicate that there are more options.
|
|
36
|
+
*/
|
|
37
|
+
maxDropdownHeight?: number;
|
|
32
38
|
}
|
|
33
|
-
declare function BaseDropdown({ activeItemProps, value, options, onOptionSelected, onOpen, renderDropdownOption, searchableOptions, searchPlaceholder, placeholder, resetSearchOnClose, openToTopOnMobile, alwaysOpenToTop, openDropdownFullWidth, isLoading, preloadIconUrls, horizontalIconGap, openDropdownBackgroundColor, size, label, }: BaseDropdownProps): React.JSX.Element;
|
|
39
|
+
declare function BaseDropdown({ activeItemProps, value, options, onOptionSelected, onOpen, renderDropdownOption, searchableOptions, searchPlaceholder, placeholder, resetSearchOnClose, openToTopOnMobile, alwaysOpenToTop, openDropdownFullWidth, isLoading, preloadIconUrls, horizontalIconGap, openDropdownBackgroundColor, size, label, maxDropdownHeight, }: BaseDropdownProps): React.JSX.Element;
|
|
34
40
|
export default BaseDropdown;
|
|
@@ -15,8 +15,12 @@ interface ChainDropdownProps {
|
|
|
15
15
|
allowUnselect?: boolean;
|
|
16
16
|
activeItemProps?: BaseDropdownProps['activeItemProps'];
|
|
17
17
|
openDropdownBackgroundColor?: BaseDropdownProps['openDropdownBackgroundColor'];
|
|
18
|
+
openDropdownFullWidth?: BaseDropdownProps['openDropdownFullWidth'];
|
|
18
19
|
size?: BaseActiveDropdownItemProps['size'];
|
|
19
20
|
isLoading?: BaseDropdownProps['isLoading'];
|
|
21
|
+
alwaysOpenToTop?: BaseDropdownProps['alwaysOpenToTop'];
|
|
22
|
+
maxDropdownHeight?: BaseDropdownProps['maxDropdownHeight'];
|
|
23
|
+
tagComponent?: (value: string) => React.ReactNode;
|
|
20
24
|
}
|
|
21
|
-
export declare const ChainDropdown: ({ assets, chainIds: chains, selectedChainId: propSelectedChainId, allowUnselect, onChainSelected, activeItemProps, size, openDropdownBackgroundColor, isLoading, }: ChainDropdownProps) => React.JSX.Element;
|
|
25
|
+
export declare const ChainDropdown: ({ assets, chainIds: chains, selectedChainId: propSelectedChainId, allowUnselect, onChainSelected, activeItemProps, size, openDropdownBackgroundColor, openDropdownFullWidth, isLoading, alwaysOpenToTop, maxDropdownHeight, tagComponent, }: ChainDropdownProps) => React.JSX.Element;
|
|
22
26
|
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import type { TokenTransferSourceChainsAndAssets } from '~/modals/CheckoutModal/TransferToken/TransferToken';
|
|
3
|
+
import type { BaseDropdownProps } from './BaseDropdown';
|
|
4
|
+
interface TokenAndChainDropdownProps {
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
selectedToken: string;
|
|
7
|
+
selectedChainId: number;
|
|
8
|
+
assets: TokenTransferSourceChainsAndAssets;
|
|
9
|
+
/**
|
|
10
|
+
* Callback fired after token selection
|
|
11
|
+
*/
|
|
12
|
+
onTokenSelected: (token: string, chainId?: number, autoUpdate?: boolean) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Callback fired after chain selection
|
|
15
|
+
*/
|
|
16
|
+
onChainSelected: (chainId?: number, autoUpdate?: boolean) => void;
|
|
17
|
+
tokenLabel?: string;
|
|
18
|
+
chainLabel?: string;
|
|
19
|
+
chainLabelAddon?: ReactNode;
|
|
20
|
+
alwaysOpenToTop?: boolean;
|
|
21
|
+
maxTokenDropdownHeight?: BaseDropdownProps['maxDropdownHeight'];
|
|
22
|
+
maxChainDropdownHeight?: BaseDropdownProps['maxDropdownHeight'];
|
|
23
|
+
openChainDropdownFullWidth?: BaseDropdownProps['openDropdownFullWidth'];
|
|
24
|
+
chainTagComponent?: (value: string) => ReactNode;
|
|
25
|
+
}
|
|
26
|
+
/** Combines together chain and token dropdowns */
|
|
27
|
+
export declare const TokenAndChainDropdown: ({ isLoading, selectedToken, selectedChainId, assets, onTokenSelected, onChainSelected, tokenLabel, chainLabel, chainLabelAddon, alwaysOpenToTop, maxTokenDropdownHeight, maxChainDropdownHeight, openChainDropdownFullWidth, chainTagComponent, }: TokenAndChainDropdownProps) => React.JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -11,6 +11,8 @@ interface TokenDropdownProps {
|
|
|
11
11
|
autoUpdate?: boolean) => void;
|
|
12
12
|
selectedToken?: string;
|
|
13
13
|
isLoading?: BaseDropdownProps['isLoading'];
|
|
14
|
+
alwaysOpenToTop?: BaseDropdownProps['alwaysOpenToTop'];
|
|
15
|
+
maxDropdownHeight?: BaseDropdownProps['maxDropdownHeight'];
|
|
14
16
|
}
|
|
15
|
-
export declare const TokenDropdown: ({ assets, selectedChainId, selectedToken, onTokenSelected, isLoading, }: TokenDropdownProps) => React.JSX.Element;
|
|
17
|
+
export declare const TokenDropdown: ({ assets, selectedChainId, selectedToken, onTokenSelected, isLoading, alwaysOpenToTop, maxDropdownHeight, }: TokenDropdownProps) => React.JSX.Element;
|
|
16
18
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { type MouseEventHandler } from 'react';
|
|
2
2
|
import { type BoxProps } from '../Box/Box';
|
|
3
|
-
export type FunButtonTypes = 'primary' | 'secondary' | 'tertiary';
|
|
3
|
+
export type FunButtonTypes = 'primary' | 'secondary' | 'tertiary' | 'tertiary-small';
|
|
4
4
|
export interface FunButtonProps {
|
|
5
5
|
id?: string;
|
|
6
6
|
title: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { type HTMLInputTypeAttribute, type ReactNode } from 'react';
|
|
1
|
+
import React, { type ChangeEvent, type HTMLInputTypeAttribute, type ReactNode } from 'react';
|
|
2
2
|
import { type BoxProps } from '../Box/Box';
|
|
3
|
-
export interface FunInputProps<T = HTMLInputElement> {
|
|
3
|
+
export interface FunInputProps<T = HTMLInputElement | HTMLTextAreaElement> {
|
|
4
4
|
prefix?: ReactNode;
|
|
5
5
|
suffix?: ReactNode;
|
|
6
6
|
prefixIcon?: 'SearchIcon' | '$';
|
|
@@ -8,10 +8,12 @@ export interface FunInputProps<T = HTMLInputElement> {
|
|
|
8
8
|
value: string | number | readonly string[] | undefined;
|
|
9
9
|
label?: string;
|
|
10
10
|
onChange: (value: React.ChangeEvent<T>) => void;
|
|
11
|
-
onKeyDown?: (e: React.KeyboardEvent<
|
|
11
|
+
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement> | React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
12
12
|
onKeySubmit?: () => void;
|
|
13
13
|
onPaste?: (e: React.ClipboardEvent<T>) => void;
|
|
14
14
|
onMouseDown?: (e: React.MouseEvent<T>) => void;
|
|
15
|
+
onFocus?: () => void;
|
|
16
|
+
onBlur?: () => void;
|
|
15
17
|
inputStyle?: React.CSSProperties;
|
|
16
18
|
inputProps?: React.HTMLProps<T> & {
|
|
17
19
|
type?: HTMLInputTypeAttribute;
|
|
@@ -25,5 +27,8 @@ export interface FunInputProps<T = HTMLInputElement> {
|
|
|
25
27
|
overrideBackground?: BoxProps['background'];
|
|
26
28
|
borderRadius?: BoxProps['borderRadius'];
|
|
27
29
|
isLoading?: boolean;
|
|
30
|
+
/** Allow multiline input. Defaults to false. This option replaces the internal `input` element with a `textarea` element. */
|
|
31
|
+
allowMultiline?: boolean;
|
|
28
32
|
}
|
|
29
|
-
export
|
|
33
|
+
export type FunInputChangeEvent = ChangeEvent<HTMLInputElement | HTMLTextAreaElement>;
|
|
34
|
+
export declare const FunInput: React.ForwardRefExoticComponent<FunInputProps<HTMLTextAreaElement | HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { CheckoutFees } from '~/domains/fees';
|
|
2
3
|
import type { FunkitCheckoutQuoteResult } from '~/domains/quote';
|
|
3
4
|
interface PaymentFeesSummaryProps {
|
|
4
5
|
isLoading: boolean;
|
|
5
6
|
quote: FunkitCheckoutQuoteResult | null | undefined;
|
|
7
|
+
/** If set and quote is missing, display fees based on this data */
|
|
8
|
+
fallbackFees?: CheckoutFees;
|
|
6
9
|
}
|
|
7
|
-
export declare function PaymentFeesSummary({ isLoading, quote, }: PaymentFeesSummaryProps): React.JSX.Element;
|
|
10
|
+
export declare function PaymentFeesSummary({ isLoading, quote, fallbackFees, }: PaymentFeesSummaryProps): React.JSX.Element;
|
|
8
11
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { TransferTokenDefault } from '~/
|
|
2
|
+
import type { TransferTokenDefault } from '~/hooks/useTokenChain';
|
|
3
3
|
interface NewTokenDepositAlertProps {
|
|
4
4
|
onClick: (value: TransferTokenDefault) => void;
|
|
5
5
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { FeeValue } from '~/hooks/useTokenTransfer';
|
|
3
3
|
interface TransferTokenDetailsProps {
|
|
4
|
-
minAmount?: number;
|
|
5
4
|
disabled?: boolean;
|
|
6
5
|
estPriceImpact: FeeValue | undefined;
|
|
7
6
|
maxSlippage: FeeValue | undefined;
|
|
8
7
|
}
|
|
9
|
-
export declare const TransferTokenDetails: ({
|
|
8
|
+
export declare const TransferTokenDetails: ({ disabled, estPriceImpact, maxSlippage, }: TransferTokenDetailsProps) => React.JSX.Element;
|
|
10
9
|
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type CheckoutQuoteResponse } from '@funkit/utils';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { type Hex } from 'viem';
|
|
4
|
+
import type { Address } from 'viem';
|
|
5
|
+
import type { FunkitActiveWithdrawalItem, FunkitWithdrawalConfig } from '~/providers/FunkitCheckoutContext';
|
|
6
|
+
export type WithdrawalFormData = {
|
|
7
|
+
destinationAddress: Address;
|
|
8
|
+
amount: string;
|
|
9
|
+
token: string;
|
|
10
|
+
chainId: number;
|
|
11
|
+
quote: CheckoutQuoteResponse;
|
|
12
|
+
};
|
|
13
|
+
interface WithdrawContentProps {
|
|
14
|
+
onContinue: (withdrawal: WithdrawalFormData, txHash: Hex) => void;
|
|
15
|
+
config: FunkitWithdrawalConfig;
|
|
16
|
+
withdrawalItem: FunkitActiveWithdrawalItem | null;
|
|
17
|
+
}
|
|
18
|
+
export declare const WithdrawContent: ({ onContinue, config, withdrawalItem, }: WithdrawContentProps) => React.JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface WithdrawSuccessProps {
|
|
3
|
+
amount: number;
|
|
4
|
+
token: string;
|
|
5
|
+
tokenIconSrc: string;
|
|
6
|
+
chainId: string;
|
|
7
|
+
txHash: string;
|
|
8
|
+
bottomBarId: string;
|
|
9
|
+
onNewWithdrawal: () => void;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const WithdrawSuccess: ({ amount, token, tokenIconSrc, chainId, txHash, bottomBarId, onNewWithdrawal, onClose, }: WithdrawSuccessProps) => React.JSX.Element;
|
|
13
|
+
export {};
|
package/dist/domains/quote.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface FunkitCheckoutQuoteResult extends Omit<ApiFunkitCheckoutQuoteRe
|
|
|
10
10
|
finalSpreadUsd: string;
|
|
11
11
|
finalFeesBreakdown: CheckoutFees;
|
|
12
12
|
}
|
|
13
|
-
export declare function getCheckoutBaseQuote(checkoutItem: FunkitActiveCheckoutItem, userId: string, walletAddress: Address, apiKey: string, sponsorInitialTransferGasLimit: number, wagmiConfig: Config, directExecutionInfo: FunkitDirectExecutionInfo): Promise<CheckoutQuoteResponse>;
|
|
13
|
+
export declare function getCheckoutBaseQuote(checkoutItem: FunkitActiveCheckoutItem, userId: string, walletAddress: Address, apiKey: string, sponsorInitialTransferGasLimit: number, wagmiConfig: Config, directExecutionInfo: FunkitDirectExecutionInfo, senderAddress?: Address): Promise<CheckoutQuoteResponse>;
|
|
14
14
|
export declare function getQuoteFinalEstimation(baseQuote: CheckoutQuoteResponse, checkoutItem: FunkitActiveCheckoutItem, newPaymentMethodInfo: PaymentMethodInfo, wagmiConfig: Config, apiKey: string, loginType: LoginType, enableFrogProxyServer?: boolean): Promise<{
|
|
15
15
|
finalEstimation: FunkitCheckoutQuoteResult;
|
|
16
16
|
brokerage?: BrokerageDetails;
|
|
@@ -33,8 +33,12 @@ export interface CheckoutQuoteParams {
|
|
|
33
33
|
loginType: LoginType;
|
|
34
34
|
enableFrogProxyServer?: boolean;
|
|
35
35
|
directExecutionInfo: FunkitDirectExecutionInfo;
|
|
36
|
+
/** when sender address is different from wallet address
|
|
37
|
+
* this happens when withdrawing from a different wallet
|
|
38
|
+
**/
|
|
39
|
+
senderAddress?: Address;
|
|
36
40
|
}
|
|
37
|
-
export declare function getQuoteAndEstimation({ checkoutItem, userId, walletAddress, apiKey, sponsorInitialTransferGasLimit, newPaymentMethodInfo, wagmiConfig, loginType, enableFrogProxyServer, directExecutionInfo, }: CheckoutQuoteParams): Promise<{
|
|
41
|
+
export declare function getQuoteAndEstimation({ checkoutItem, userId, walletAddress, apiKey, sponsorInitialTransferGasLimit, newPaymentMethodInfo, wagmiConfig, loginType, enableFrogProxyServer, directExecutionInfo, senderAddress, }: CheckoutQuoteParams): Promise<{
|
|
38
42
|
baseQuote: CheckoutQuoteResponse;
|
|
39
43
|
checkedAssetAmount: CheckedAssetAmount;
|
|
40
44
|
finalEstimation: FunkitCheckoutQuoteResult;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Address } from 'viem';
|
|
2
|
+
import type { WithdrawalClient } from '~/wallets/Wallet';
|
|
3
|
+
interface CheckoutQuoteParams {
|
|
4
|
+
recipientAddress: Address;
|
|
5
|
+
sourceAmount: number;
|
|
6
|
+
chainId: string;
|
|
7
|
+
symbol: string;
|
|
8
|
+
targetAsset: Address | undefined;
|
|
9
|
+
targetAssetAmount: number | undefined;
|
|
10
|
+
withdrawalClient: WithdrawalClient;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Simplified quoting logic used for withdrawal UI only.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useWithdrawalQuote({ recipientAddress, sourceAmount, chainId, symbol, targetAsset, targetAssetAmount, withdrawalClient, }: CheckoutQuoteParams): import("@tanstack/react-query").UseQueryResult<{
|
|
16
|
+
baseQuote: import("@funkit/utils").CheckoutQuoteResponse;
|
|
17
|
+
checkedAssetAmount: import("~/domains/quote").CheckedAssetAmount;
|
|
18
|
+
finalEstimation: import("~/domains/quote").FunkitCheckoutQuoteResult;
|
|
19
|
+
} | null, Error>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useWithdrawalRisk: (apiKey: string, receiveAddress: string) => import("@tanstack/react-query").UseQueryResult<boolean, Error>;
|
|
@@ -13,6 +13,7 @@ interface DirectExecutionQuoteRequestParams {
|
|
|
13
13
|
fromChainId: string;
|
|
14
14
|
fromTokenAddress: Address;
|
|
15
15
|
recipientAddress: Address;
|
|
16
|
+
senderAddress?: Address;
|
|
16
17
|
}
|
|
17
18
|
interface DirectExecutionStartParams {
|
|
18
19
|
checkoutItem: FunkitActiveCheckoutItem;
|
|
@@ -28,6 +29,7 @@ export interface FunkitDirectExecutionInfo {
|
|
|
28
29
|
}
|
|
29
30
|
interface UseCheckoutDirectExecutionReturn {
|
|
30
31
|
getDirectExecutionInfo: (checkoutItem: FunkitActiveCheckoutItem | null) => FunkitDirectExecutionInfo;
|
|
32
|
+
getWithdrawalDirectExecution: () => FunkitDirectExecutionInfo;
|
|
31
33
|
}
|
|
32
34
|
export declare function isVertexDirectExecution({ apiKey, config, paymentMethod, sourceAsset, sourceChain, targetAsset, targetChain, }: {
|
|
33
35
|
apiKey: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CheckoutRefundState, CheckoutState, type DirectExecution, RelayExecutionStatus } from '@funkit/api-base';
|
|
2
2
|
export declare function mapRelayExecutionStatusToCheckoutState(status: RelayExecutionStatus): CheckoutState;
|
|
3
|
+
export declare function mapRelayExecutionStatusToRefundState(status: RelayExecutionStatus): CheckoutRefundState | undefined;
|
|
3
4
|
export declare function useCheckoutDirectExecutionHistory({ initDirectExecution, }: {
|
|
4
5
|
initDirectExecution?: DirectExecution;
|
|
5
6
|
}): {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type CheckoutInitTokenTransferResponse, type FunAddress } from '@funkit/api-base';
|
|
2
|
-
import type { FunkitCheckoutConfig } from '~/providers/FunkitCheckoutContext';
|
|
3
2
|
interface UseCheckoutTransferInitResponse {
|
|
4
3
|
transferInit: CheckoutInitTokenTransferResponse | undefined;
|
|
5
4
|
recipientAddr: FunAddress;
|
|
6
5
|
}
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* creates QR code transfer EOA
|
|
8
|
+
*/
|
|
9
|
+
export declare const useCheckoutTransferInit: () => UseCheckoutTransferInitResponse;
|
|
8
10
|
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CheckoutInitTokenTransferResponse } from '@funkit/api-base';
|
|
2
|
+
import type { TokenTransferSourceChainsAndAssets } from '~/modals/CheckoutModal/TransferToken/TransferToken';
|
|
3
|
+
export type TransferTokenDefault = {
|
|
4
|
+
token: string;
|
|
5
|
+
chainId: number;
|
|
6
|
+
};
|
|
7
|
+
interface UseTokenChainResult {
|
|
8
|
+
assets: TokenTransferSourceChainsAndAssets;
|
|
9
|
+
selectedChainId: number;
|
|
10
|
+
handleChainChange: (chainId?: number, autoUpdate?: boolean) => void;
|
|
11
|
+
selectedToken: string;
|
|
12
|
+
handleTokenChange: (token: string, chainId?: number, autoUpdate?: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Semi reusable hook (tied into token transfer configuration)
|
|
16
|
+
* ensures token&chain dropdown preselection logic is reusable
|
|
17
|
+
* @param transferInit - used for chain&token solana filtering, can be omitted if not needed
|
|
18
|
+
*/
|
|
19
|
+
export declare const useTokenAndChainSelection: (transferInit: CheckoutInitTokenTransferResponse | undefined, defaultValues?: TransferTokenDefault) => UseTokenChainResult;
|
|
20
|
+
export {};
|
|
@@ -10,9 +10,12 @@ interface UseTokenTransferResult {
|
|
|
10
10
|
/** the final destination of the money */
|
|
11
11
|
recipientAddr: string;
|
|
12
12
|
minTransferUsd: number;
|
|
13
|
+
minTransferUsdPerChain: {
|
|
14
|
+
[chainId: string]: number;
|
|
15
|
+
};
|
|
13
16
|
showOriginalRecipient: boolean;
|
|
14
17
|
estPriceImpact: FeeValue | undefined;
|
|
15
18
|
maxSlippage: FeeValue | undefined;
|
|
16
19
|
}
|
|
17
|
-
export declare const useTokenTransfer: (selectedChainId: number, selectedToken: string) => UseTokenTransferResult;
|
|
20
|
+
export declare const useTokenTransfer: (selectedChainId: number, selectedToken: string, chainIds?: number[]) => UseTokenTransferResult;
|
|
18
21
|
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Hex } from 'viem';
|
|
2
|
+
import type { WithdrawalFormData } from '~/components/Withdraw/WithdrawContent';
|
|
3
|
+
import type { FunkitActiveWithdrawalItem } from '~/providers/FunkitCheckoutContext';
|
|
4
|
+
import type { WithdrawalClient } from '~/wallets/Wallet';
|
|
5
|
+
interface UseWithdrawalResult {
|
|
6
|
+
handleWithdrawal: (withdrawal: WithdrawalFormData) => Promise<void>;
|
|
7
|
+
isWithdrawing: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function useWithdrawal({ withdrawalWallet, withdrawalItem, onSuccess, onError, }: {
|
|
10
|
+
withdrawalWallet: WithdrawalClient;
|
|
11
|
+
withdrawalItem: FunkitActiveWithdrawalItem | null;
|
|
12
|
+
onSuccess: (withdrawal: WithdrawalFormData, txHash: Hex) => void;
|
|
13
|
+
onError: (error: Error) => void;
|
|
14
|
+
}): UseWithdrawalResult;
|
|
15
|
+
export {};
|