@funkit/connect 9.11.0 → 9.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/README.md +21 -0
- package/dist/__generated__/default_feature_gates.d.ts +1 -0
- package/dist/clients/lighter.d.ts +0 -18
- package/dist/clients/lighter.js +5 -99
- package/dist/clients/polymarket.d.ts +97 -9
- package/dist/clients/polymarket.js +181 -10
- package/dist/components/Dialog/DialogContent.css.d.ts +1 -1
- package/dist/components/FunNotificationBanner/FunNotificationBanner.d.ts +1 -1
- package/dist/components/FunOptionBox/FunOptionBox.css.d.ts +1 -1
- package/dist/components/TransactionStatus/AnimatedText.d.ts +4 -0
- package/dist/hooks/queries/useErc20Asset.d.ts +2 -1
- package/dist/hooks/queries/useRecentDeposits.d.ts +39 -49
- package/dist/hooks/useAssetPrice.d.ts +6 -2
- package/dist/hooks/useCheckoutDirectExecution.d.ts +7 -1
- package/dist/index.css +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3140 -2844
- package/dist/modals/CheckoutModal/SourceChange/FlatList.d.ts +31 -0
- package/dist/modals/CheckoutModal/SourceChange/GroupedList.d.ts +25 -0
- package/dist/modals/CheckoutModal/SourceChange/SourceList.d.ts +17 -9
- package/dist/modals/CheckoutModal/SourceChange/buildSourceGroups.d.ts +47 -0
- package/dist/modals/CheckoutModal/TransferToken/types.d.ts +1 -2
- package/dist/modals/ProfileDetails/FunProfileViews/Home/HomeCheckoutDisplayRow.css.d.ts +1 -1
- package/dist/modals/WithdrawalModal/ErrorMessage.d.ts +4 -0
- package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +16 -0
- package/dist/modals/WithdrawalModal/RecipientAddress.d.ts +11 -0
- package/dist/providers/FunkitCheckoutContext/index.d.ts +2 -2
- package/dist/providers/FunkitCheckoutContext/types.d.ts +22 -1
- package/dist/providers/FunkitConfigContext.d.ts +2 -0
- package/dist/providers/FunkitStatsigProvider.d.ts +1 -0
- package/dist/providers/GeneralWalletProvider.d.ts +2 -4
- package/dist/utils/statsig/checkFeatureGate.d.ts +19 -0
- package/dist/utils/userInfo.d.ts +36 -0
- package/dist/wallets/Wallet.d.ts +11 -0
- package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
- package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
- package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
- package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
- package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
- package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
- package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
- package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
- package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
- package/dist/wallets/walletConnectors/index.js +30 -30
- package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
- package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
- package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
- package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
- package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
- package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
- package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
- package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
- package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
- package/package.json +20 -16
- package/dist/wallets/walletConnectors/{chunk-5TN5Z2WY.js → chunk-3ZJN3PXP.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-V6UOWTEZ.js → chunk-55VS2NKG.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-DEFRRPXB.js → chunk-7IEUTLHY.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-LCIPVVH5.js → chunk-AZYMJ4C6.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-T4ROGPMF.js → chunk-FWM4KTOV.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-YIEASHLS.js → chunk-IMNI4AGV.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-7V33VJAL.js → chunk-IRHK6SOW.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-UDTBQV4Q.js → chunk-J3PJOMO7.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-VJZWNQOF.js → chunk-LEAZMT5Y.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-6DRCY52E.js → chunk-OD6B2ISG.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-FG2LDVXL.js → chunk-OSOB6QYX.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-XVBSJCW5.js → chunk-RZQ4B4Z7.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-KWX2SYU2.js → chunk-UFYNHHDU.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-HXWUH73P.js → chunk-UYW6MV74.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-34HACM5U.js → chunk-VMMROPXK.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-ZPSPK6LH.js → chunk-YGMU5VWD.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-APHCF4DT.js → chunk-ZJJWGKB6.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-HRDPUW3V.js → chunk-ZL6XCMV5.js} +3 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import type { SourceGroup } from './buildSourceGroups';
|
|
3
|
+
interface FlatListProps {
|
|
4
|
+
groups: SourceGroup[];
|
|
5
|
+
/**
|
|
6
|
+
* Class name applied to the outer Box that holds the groups.
|
|
7
|
+
* Caller decides between standard / compact styling so the renderer
|
|
8
|
+
* doesn't reach into FunkitConfig.
|
|
9
|
+
*/
|
|
10
|
+
boxClassName: string;
|
|
11
|
+
/**
|
|
12
|
+
* Label rendered on the `FunDivider` between adjacent groups.
|
|
13
|
+
* Omit to render the divider without a label.
|
|
14
|
+
*/
|
|
15
|
+
dividerLabel?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Trailing content rendered after the groups, inside the outer Box.
|
|
18
|
+
* Used by the source-list flat layout to place PayPal at the
|
|
19
|
+
* bottom of the box.
|
|
20
|
+
*/
|
|
21
|
+
footer?: ReactNode;
|
|
22
|
+
/** Applied as `data-testid` on the outer Box for snapshot scoping. */
|
|
23
|
+
testId?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Pure presentational primitive: a single column of group bodies with
|
|
27
|
+
* a divider between adjacent groups and an optional footer. No
|
|
28
|
+
* provider/context dependencies — composition lives in the caller.
|
|
29
|
+
*/
|
|
30
|
+
export declare function FlatList({ groups, boxClassName, dividerLabel, footer, testId, }: FlatListProps): React.JSX.Element;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SourceGroup } from './buildSourceGroups';
|
|
3
|
+
interface GroupedListProps {
|
|
4
|
+
groups: SourceGroup[];
|
|
5
|
+
/**
|
|
6
|
+
* Render each group's `label` as a section header when true. False
|
|
7
|
+
* skips the headers but keeps the grouped container styling.
|
|
8
|
+
*/
|
|
9
|
+
showLabels: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Class name applied to the inner box that holds each group's
|
|
12
|
+
* children. Caller decides between standard / compact styling so the
|
|
13
|
+
* renderer doesn't reach into FunkitConfig.
|
|
14
|
+
*/
|
|
15
|
+
boxClassName: string;
|
|
16
|
+
/** Applied as `data-testid` on the outer Box for snapshot scoping. */
|
|
17
|
+
testId?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Pure presentational primitive: groups rendered as separate boxes
|
|
21
|
+
* inside a grouped container, with optional section labels. No
|
|
22
|
+
* provider/context dependencies — composition lives in the caller.
|
|
23
|
+
*/
|
|
24
|
+
export declare function GroupedList({ groups, showLabels, boxClassName, testId, }: GroupedListProps): React.JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ConnectablePaymentMethodInfo, PaymentMethod } from '../../../domains/paymentMethods';
|
|
3
|
-
import { type UnavailablePaymentSource } from '../../../hooks/usePaymentSources';
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
4
2
|
interface SourceListProps {
|
|
5
|
-
preferred:
|
|
6
|
-
moreSources:
|
|
7
|
-
unavailable:
|
|
3
|
+
preferred: ReactNode[];
|
|
4
|
+
moreSources: ReactNode[];
|
|
5
|
+
unavailable: ReactNode[];
|
|
8
6
|
isFallback: boolean;
|
|
9
|
-
|
|
10
|
-
renderUnavailable: (source: UnavailablePaymentSource) => React.ReactNode;
|
|
7
|
+
testId?: string;
|
|
11
8
|
}
|
|
12
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Contextual composer for the source-change payment-method list.
|
|
11
|
+
* Reads translation, funkit config, and the source-list-relevant
|
|
12
|
+
* Statsig flags directly; runs `buildSourceGroups`; dispatches to the
|
|
13
|
+
* matching layout primitive — `FlatList` for the non-Swapped path
|
|
14
|
+
* (with a PayPal footer + "more" divider label) or `GroupedList` for
|
|
15
|
+
* the Swapped path (with optional section labels).
|
|
16
|
+
*
|
|
17
|
+
* `SourceList` has no DOM of its own; the primitive it returns owns
|
|
18
|
+
* the outer `data-testid` element.
|
|
19
|
+
*/
|
|
20
|
+
export declare function SourceList({ preferred, moreSources, unavailable, isFallback, testId, }: SourceListProps): React.JSX.Element;
|
|
13
21
|
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { TFunction } from 'i18next';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
export interface SourceGroup {
|
|
4
|
+
/** Section header. Omit to render the group's body without a header. */
|
|
5
|
+
label?: string;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
interface BuildSourceGroupsArgs {
|
|
9
|
+
preferred: ReactNode[];
|
|
10
|
+
moreSources: ReactNode[];
|
|
11
|
+
unavailable: ReactNode[];
|
|
12
|
+
isFallback: boolean;
|
|
13
|
+
isSwappedEnabled: boolean;
|
|
14
|
+
enableSourceGroupLabels: boolean;
|
|
15
|
+
t: TFunction;
|
|
16
|
+
}
|
|
17
|
+
export type BuildSourceGroupsResult = {
|
|
18
|
+
layout: 'flat';
|
|
19
|
+
groups: SourceGroup[];
|
|
20
|
+
} | {
|
|
21
|
+
layout: 'grouped';
|
|
22
|
+
groups: SourceGroup[];
|
|
23
|
+
showLabels: boolean;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Composes source-list sections from `usePaymentSources` buckets +
|
|
27
|
+
* the relevant Statsig flags. Returns a discriminated layout shape;
|
|
28
|
+
* the composer (`SourceList`) dispatches to the matching layout
|
|
29
|
+
* primitive.
|
|
30
|
+
*
|
|
31
|
+
* Default behaviour mirrors SourceList's prior output:
|
|
32
|
+
* - `isSwappedEnabled=false` → flat layout. One group for `preferred`
|
|
33
|
+
* (if any), one combined group for `moreSources + unavailable` (if
|
|
34
|
+
* any), with a single divider between them. (`SourceList` places
|
|
35
|
+
* `<PayPal />` as the flat footer.)
|
|
36
|
+
* - `isSwappedEnabled=true` → grouped layout. Same two groups, but
|
|
37
|
+
* rendered in separate boxes with `showLabels` toggling the section
|
|
38
|
+
* headers ("Connected" / "Most popular" / "Other options"). The
|
|
39
|
+
* "Other options" header is suppressed when no preferred group
|
|
40
|
+
* precedes it.
|
|
41
|
+
*
|
|
42
|
+
* Future customer-aware section structures (e.g. Aave's
|
|
43
|
+
* "Native" + "Use other assets") branch inside this helper without
|
|
44
|
+
* touching either layout primitive.
|
|
45
|
+
*/
|
|
46
|
+
export declare function buildSourceGroups({ preferred, moreSources, unavailable, isFallback, isSwappedEnabled, enableSourceGroupLabels, t, }: BuildSourceGroupsArgs): BuildSourceGroupsResult;
|
|
47
|
+
export {};
|
|
@@ -6,11 +6,10 @@ export type NotificationItem = (MergedMultiStepDirectExecution & {
|
|
|
6
6
|
}) | (CheckoutHistoryItem & {
|
|
7
7
|
isDirectExecution: false;
|
|
8
8
|
});
|
|
9
|
-
type NotificationVariant = 'withdrawal' | 'token_transfer';
|
|
9
|
+
export type NotificationVariant = 'deposit' | 'withdrawal' | 'token_transfer';
|
|
10
10
|
export interface CheckoutNotificationsProps {
|
|
11
11
|
onHelp: (depositAddress: Address) => void;
|
|
12
12
|
/** To control notifications visibility on specific pages, without changing internal dismissal state */
|
|
13
13
|
isVisible: boolean;
|
|
14
14
|
variant: NotificationVariant | undefined;
|
|
15
15
|
}
|
|
16
|
-
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const baseStyles: string;
|
|
2
|
-
export declare const homeCheckoutDisplayRowStyle: Record<"
|
|
2
|
+
export declare const homeCheckoutDisplayRowStyle: Record<"defaultBorder" | "defaultBackground" | "hoverBackground", string>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TFunction } from 'i18next';
|
|
2
|
+
import type { ErrorNotification } from '../../components/FunNotification/FunNotification';
|
|
3
|
+
import type { CheckoutConfirmationError } from '../CheckoutModal/ConfirmationStep/useCheckoutConfirmation';
|
|
4
|
+
export declare function getErrorNotification(quoteErrorObject: Error | null, withdrawalError: CheckoutConfirmationError | null, targetAssetFetchError: Error | null, t: TFunction): ErrorNotification | null;
|
|
@@ -3,9 +3,25 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Extracted from WithdrawalContent.tsx to keep Lighter-specific logic isolated.
|
|
5
5
|
*/
|
|
6
|
+
import type { LighterAccountIndex } from '@funkit/api-base';
|
|
6
7
|
import React from 'react';
|
|
7
8
|
import type { CustomWithdrawalConfig, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
|
|
8
9
|
import type { SourceTokenOption } from './WithdrawAmountInput';
|
|
10
|
+
/** Free (withdrawable) balance for a single Lighter asset: balance - locked. */
|
|
11
|
+
export declare function freeBalance(balance: string, lockedBalance: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Fetches all asset balances for a Lighter account. Returns:
|
|
14
|
+
*
|
|
15
|
+
* - `balances` — `Record<SYMBOL, freeBalance>` (uppercased symbol keys)
|
|
16
|
+
* - `assets` — raw asset list from the API (for building source-token options)
|
|
17
|
+
*/
|
|
18
|
+
export declare function useLighterWithdrawalBalances({ accountIndex, }: {
|
|
19
|
+
accountIndex: LighterAccountIndex | undefined;
|
|
20
|
+
}): {
|
|
21
|
+
balances: Record<string, string>;
|
|
22
|
+
assets: import("../../utils/customer").LighterAsset[];
|
|
23
|
+
isLoading: boolean;
|
|
24
|
+
};
|
|
9
25
|
type FunkitWithdrawalConfig = WalletWithdrawalConfig | CustomWithdrawalConfig;
|
|
10
26
|
/**
|
|
11
27
|
* Resolves the Lighter `asset_id` for a selected source token symbol. Returns
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FunkitWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
|
|
3
|
+
export declare function WithdrawRecipientAddress({ config, recipientAddress, setRecipientAddress, selectedChainId, selectedToken, isValidAddress, isRiskyAddress, }: {
|
|
4
|
+
config: FunkitWithdrawalConfig;
|
|
5
|
+
recipientAddress: string;
|
|
6
|
+
setRecipientAddress: (s: string) => void;
|
|
7
|
+
selectedChainId: number | undefined;
|
|
8
|
+
selectedToken: string | undefined;
|
|
9
|
+
isValidAddress: boolean;
|
|
10
|
+
isRiskyAddress: boolean;
|
|
11
|
+
}): React.JSX.Element;
|
|
@@ -3,7 +3,7 @@ import React, { type ReactNode } from 'react';
|
|
|
3
3
|
import type { Address } from 'viem';
|
|
4
4
|
import { type PaymentMethodInfo } from '../../domains/paymentMethods';
|
|
5
5
|
import type { AssetHoldingsItem } from '../../utils/assets';
|
|
6
|
-
import type { WithdrawalClient } from '../../wallets/Wallet';
|
|
6
|
+
import type { WithdrawalClient, WithdrawalTransaction } from '../../wallets/Wallet';
|
|
7
7
|
import { type FunkitCheckoutQuoteResult } from '../FunkitHistoryContext';
|
|
8
8
|
import type { FunkitActiveCheckoutItem, FunkitActiveWithdrawalItem, FunkitCheckoutConfig, FunkitWithdrawalConfig, UseFunkitCheckoutProps, UseFunkitCheckoutPropsWithFullConfig } from './types';
|
|
9
9
|
export * from './types';
|
|
@@ -25,7 +25,7 @@ interface FunkitCheckoutContextInterface {
|
|
|
25
25
|
}): void;
|
|
26
26
|
updateSelectedPaymentMethodInfo(newPaymentMethodInfo: PaymentMethodInfo): void;
|
|
27
27
|
updateCustomRecipient: (recipient: Address) => void;
|
|
28
|
-
confirmCheckout(quote: FunkitCheckoutQuoteResult, stepMessageSetter: (m: string) => void, withdrawalClient?: WithdrawalClient): Promise<Address>;
|
|
28
|
+
confirmCheckout(quote: FunkitCheckoutQuoteResult, stepMessageSetter: (m: string) => void, withdrawalClient?: WithdrawalClient, preWithdrawalTxs?: WithdrawalTransaction[]): Promise<Address>;
|
|
29
29
|
cancelCheckout(depositAddress: Address): Promise<boolean>;
|
|
30
30
|
/** @deprecated to be removed after quote migration is finished (historically named setCheckoutQuote) */
|
|
31
31
|
setCheckout: (checkout: FunkitActiveCheckoutItem) => void;
|
|
@@ -4,7 +4,7 @@ import type { ReactNode } from 'react';
|
|
|
4
4
|
import type { Address } from 'viem';
|
|
5
5
|
import type { PaymentMethodInfo } from '../../domains/paymentMethods';
|
|
6
6
|
import type { CheckoutBlockedReason } from '../../modals/CheckoutModal/CheckoutBlockedReason';
|
|
7
|
-
import type { WithdrawalClient } from '../../wallets/Wallet';
|
|
7
|
+
import type { WithdrawalClient, WithdrawalTransaction } from '../../wallets/Wallet';
|
|
8
8
|
import type { FunkitCheckoutQuoteResult } from '../FunkitHistoryContext';
|
|
9
9
|
export type FunkitCheckoutActionParams = ApiFunkitCheckoutActionParams;
|
|
10
10
|
export interface TokenInfo {
|
|
@@ -120,6 +120,26 @@ export interface WithdrawalConfigBase {
|
|
|
120
120
|
export interface WalletWithdrawalConfig extends WithdrawalConfigBase {
|
|
121
121
|
/** Wallet instance used to execute the quote */
|
|
122
122
|
wallet: WithdrawalClient;
|
|
123
|
+
/**
|
|
124
|
+
* Optional async hook that runs **before** the SDK executes the wallet-based
|
|
125
|
+
* withdrawal quote. Return any transactions that must execute as part of the
|
|
126
|
+
* withdrawal flow *prior* to the SDK's withdrawal transaction (e.g. an
|
|
127
|
+
* `approve` and a custom-collateral `unwrap` that produces the source token).
|
|
128
|
+
*
|
|
129
|
+
* The SDK atomically prepends the returned array to the withdrawal txn(s)
|
|
130
|
+
* via the integrator's `wallet.sendTransactions` primitive, so the
|
|
131
|
+
* approve/unwrap and the withdrawal land in a single user signature.
|
|
132
|
+
*
|
|
133
|
+
* Return `[]` if no extra transactions are required — the hook is then
|
|
134
|
+
* purely a side-effect / preflight step.
|
|
135
|
+
*
|
|
136
|
+
* Throw to abort the withdrawal — the thrown error message is surfaced to
|
|
137
|
+
* the user in the standard error UI.
|
|
138
|
+
*
|
|
139
|
+
* Mutually exclusive with {@link CustomWithdrawalConfig['withdrawCallback']}
|
|
140
|
+
* by virtue of living on a different config variant.
|
|
141
|
+
*/
|
|
142
|
+
preWithdrawalAction?: (param: WithdrawalParam) => Promise<WithdrawalTransaction[]>;
|
|
123
143
|
}
|
|
124
144
|
export interface CustomWithdrawalConfig extends WithdrawalConfigBase {
|
|
125
145
|
/**
|
|
@@ -176,6 +196,7 @@ export interface MultiMethodWithdrawalConfig {
|
|
|
176
196
|
sectionTitle?: string;
|
|
177
197
|
/** The methods the user can choose between. Order is preserved in the UI. */
|
|
178
198
|
methods: WithdrawalMethodOption[];
|
|
199
|
+
disableConnectedWallet?: boolean;
|
|
179
200
|
}
|
|
180
201
|
export type FunkitWithdrawalConfig = WalletWithdrawalConfig | CustomWithdrawalConfig | MultiMethodWithdrawalConfig;
|
|
181
202
|
export interface FunkitCheckoutValidationResult {
|
|
@@ -184,6 +184,8 @@ export interface FunkitUiCustomizationsConfig {
|
|
|
184
184
|
showTargetAssetSelection?: boolean;
|
|
185
185
|
/** Whether to show wallet option when balance is insufficient - defaults to false (hides wallet) */
|
|
186
186
|
showWalletOnInsufficientBalance?: boolean;
|
|
187
|
+
/** Whether to show the wallet connect payment option - defaults to true */
|
|
188
|
+
showWalletConnect?: boolean;
|
|
187
189
|
/** Function that returns a custom React component to render before other UIs in the source change screen */
|
|
188
190
|
customTopComponent?: () => ReactNode;
|
|
189
191
|
paymentMethodIcons?: {
|
|
@@ -3,15 +3,13 @@ import React, { type ReactNode } from 'react';
|
|
|
3
3
|
import type { Address } from 'viem';
|
|
4
4
|
import { type UseDisconnectReturnType, type UseReconnectReturnType } from '../wagmi/hooks';
|
|
5
5
|
import { type FunkitUserInfo } from '../consts/funkit';
|
|
6
|
+
import { LoginType } from '../utils/userInfo';
|
|
6
7
|
/** AssetBalanceInfo with known price and totalUsdValue */
|
|
7
8
|
export interface KnownAssetBalanceInfo extends AssetBalanceInfo {
|
|
8
9
|
price: number;
|
|
9
10
|
totalUsdValue: number;
|
|
10
11
|
}
|
|
11
|
-
export
|
|
12
|
-
Web3 = "web3",
|
|
13
|
-
Guest = "guest"
|
|
14
|
-
}
|
|
12
|
+
export { LoginType } from '../utils/userInfo';
|
|
15
13
|
export interface GeneralWalletContextProps {
|
|
16
14
|
walletAddress: Address | '';
|
|
17
15
|
isUserLoggedIn: boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import fallbackFeatureGates from '../../__generated__/default_feature_gates';
|
|
2
|
+
type FeatureGateName = keyof typeof fallbackFeatureGates;
|
|
3
|
+
/**
|
|
4
|
+
* Synchronous, non-hook variant of {@link useFeatureGate}. Reads the gate
|
|
5
|
+
* value directly from the connect package's Statsig client singleton.
|
|
6
|
+
*
|
|
7
|
+
* Use this from non-React contexts (event handlers, async callbacks created
|
|
8
|
+
* outside render) where calling a hook is not possible. Behavior:
|
|
9
|
+
* - Returns the live gate value once `FunkitStatsigProvider`'s async init
|
|
10
|
+
* has resolved (typical case for event-driven calls — by the time a user
|
|
11
|
+
* clicks a button, init has long since completed).
|
|
12
|
+
* - Returns the bundled default if called before init completes or if the
|
|
13
|
+
* provider has not been mounted (graceful fallback rather than throw).
|
|
14
|
+
*
|
|
15
|
+
* For render-time consumers, prefer {@link useFeatureGate} so the consumer
|
|
16
|
+
* re-renders when values update mid-session.
|
|
17
|
+
*/
|
|
18
|
+
export declare function checkFeatureGate(name: FeatureGateName): boolean;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Address } from 'viem';
|
|
2
|
+
import { type FunkitUserInfo } from '../consts/funkit';
|
|
3
|
+
export declare enum LoginType {
|
|
4
|
+
Web3 = "web3",
|
|
5
|
+
Guest = "guest"
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Whether externalUserId should be treated as a trusted wallet address.
|
|
9
|
+
* Currently only Lighter mobile QR flow passes externalUserId as an L1 address.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getIsExternalUserIdAddress(apiKey: string, externalUserId: string | undefined): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Resolve the wallet address, preferring wagmi's connected address.
|
|
14
|
+
* When `isExternalUserIdAddress` is true, externalUserId is treated as a trusted
|
|
15
|
+
* wallet address and used as fallback when wagmi is not connected.
|
|
16
|
+
* Currently used by Lighter mobile QR flow where the L1 address is passed via externalUserId.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveWalletAddress(address: Address | undefined, externalUserId: string | undefined, isExternalUserIdAddress: boolean): Address | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the userId for the current session.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveUserId(address: Address | undefined, externalUserId: string | undefined, apiKey: string, isExternalUserIdAddress: boolean): string;
|
|
23
|
+
/**
|
|
24
|
+
* Build the FunkitUserInfo for the current session.
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildUserInfo({ address, effectiveAddress, externalUserId, apiKey, isExternalUserIdAddress, loginType, connectorName, ensName, ensAvatar, }: {
|
|
27
|
+
address: Address | undefined;
|
|
28
|
+
effectiveAddress: Address | undefined;
|
|
29
|
+
externalUserId: string | undefined;
|
|
30
|
+
apiKey: string;
|
|
31
|
+
isExternalUserIdAddress: boolean;
|
|
32
|
+
loginType: LoginType;
|
|
33
|
+
connectorName: string | undefined;
|
|
34
|
+
ensName: string | null | undefined;
|
|
35
|
+
ensAvatar: string | null | undefined;
|
|
36
|
+
}): FunkitUserInfo;
|
package/dist/wallets/Wallet.d.ts
CHANGED
|
@@ -108,6 +108,17 @@ export interface WithdrawalClient {
|
|
|
108
108
|
getChainId: () => Promise<number>;
|
|
109
109
|
switchChain: (chainId: number) => Promise<void>;
|
|
110
110
|
sendTransaction: (chainId: number, transaction: WithdrawalTransaction) => Promise<string>;
|
|
111
|
+
/**
|
|
112
|
+
* Optional batched submitter. When provided, the SDK collapses approve +
|
|
113
|
+
* swap/deposit steps into a single user signature via this method (e.g.
|
|
114
|
+
* EIP-5792 `wallet_sendCalls` with `forceAtomic`).
|
|
115
|
+
*
|
|
116
|
+
* Must return a tx hash that {@link confirmTransaction} can wait on.
|
|
117
|
+
* Implementations using `wallet_sendCalls` should map the calls-id back to
|
|
118
|
+
* the underlying tx hash via `waitForCallsStatus` →
|
|
119
|
+
* `receipts[0].transactionHash`.
|
|
120
|
+
*/
|
|
121
|
+
sendTransactions?: (chainId: number, transactions: WithdrawalTransaction[]) => Promise<string>;
|
|
111
122
|
confirmTransaction: (txHash: string, chainId: number) => Promise<TransactionReceipt>;
|
|
112
123
|
address: () => string;
|
|
113
124
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
bifrostWallet
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-YYYRPQHB.js";
|
|
4
|
+
} from "../chunk-OD6B2ISG.js";
|
|
6
5
|
import "../chunk-FMVNQKZL.js";
|
|
6
|
+
import "../chunk-YYYRPQHB.js";
|
|
7
7
|
import "../chunk-3K2MFXCO.js";
|
|
8
8
|
export {
|
|
9
9
|
bifrostWallet
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
bitgetWallet
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-YYYRPQHB.js";
|
|
4
|
+
} from "../chunk-IMNI4AGV.js";
|
|
6
5
|
import "../chunk-FMVNQKZL.js";
|
|
6
|
+
import "../chunk-YYYRPQHB.js";
|
|
7
7
|
import "../chunk-3K2MFXCO.js";
|
|
8
8
|
export {
|
|
9
9
|
bitgetWallet
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
bybitWallet
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-YYYRPQHB.js";
|
|
4
|
+
} from "../chunk-7IEUTLHY.js";
|
|
6
5
|
import "../chunk-FMVNQKZL.js";
|
|
6
|
+
import "../chunk-YYYRPQHB.js";
|
|
7
7
|
import "../chunk-3K2MFXCO.js";
|
|
8
8
|
export {
|
|
9
9
|
bybitWallet
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
coin98Wallet
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-YYYRPQHB.js";
|
|
4
|
+
} from "../chunk-RZQ4B4Z7.js";
|
|
6
5
|
import "../chunk-FMVNQKZL.js";
|
|
6
|
+
import "../chunk-YYYRPQHB.js";
|
|
7
7
|
import "../chunk-3K2MFXCO.js";
|
|
8
8
|
export {
|
|
9
9
|
coin98Wallet
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
frontierWallet
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-YYYRPQHB.js";
|
|
4
|
+
} from "../chunk-J3PJOMO7.js";
|
|
6
5
|
import "../chunk-FMVNQKZL.js";
|
|
6
|
+
import "../chunk-YYYRPQHB.js";
|
|
7
7
|
import "../chunk-3K2MFXCO.js";
|
|
8
8
|
export {
|
|
9
9
|
frontierWallet
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-A5EZBNME.js";
|
|
5
5
|
import {
|
|
6
6
|
zerionWallet
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-UFYNHHDU.js";
|
|
8
8
|
import {
|
|
9
9
|
tahoWallet
|
|
10
10
|
} from "./chunk-KS5MJNGD.js";
|
|
@@ -13,34 +13,34 @@ import {
|
|
|
13
13
|
} from "./chunk-T3VMQBBI.js";
|
|
14
14
|
import {
|
|
15
15
|
tokenPocketWallet
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-UYW6MV74.js";
|
|
17
17
|
import {
|
|
18
18
|
tokenaryWallet
|
|
19
19
|
} from "./chunk-R7X5RIO7.js";
|
|
20
|
-
import {
|
|
21
|
-
trustWallet
|
|
22
|
-
} from "./chunk-T4ROGPMF.js";
|
|
23
20
|
import {
|
|
24
21
|
uniswapWallet
|
|
25
22
|
} from "./chunk-UKSIXGWC.js";
|
|
23
|
+
import {
|
|
24
|
+
trustWallet
|
|
25
|
+
} from "./chunk-FWM4KTOV.js";
|
|
26
26
|
import {
|
|
27
27
|
walletConnectWallet
|
|
28
28
|
} from "./chunk-O7ZCUI2Y.js";
|
|
29
29
|
import {
|
|
30
30
|
xdefiWallet
|
|
31
31
|
} from "./chunk-KSNA53EX.js";
|
|
32
|
+
import {
|
|
33
|
+
rainbowWallet
|
|
34
|
+
} from "./chunk-AZYMJ4C6.js";
|
|
32
35
|
import {
|
|
33
36
|
rabbyWallet
|
|
34
37
|
} from "./chunk-7PVUEV4M.js";
|
|
35
|
-
import {
|
|
36
|
-
rainbowWallet
|
|
37
|
-
} from "./chunk-LCIPVVH5.js";
|
|
38
38
|
import {
|
|
39
39
|
ramperWallet
|
|
40
40
|
} from "./chunk-P4E2ZFQB.js";
|
|
41
41
|
import {
|
|
42
42
|
roninWallet
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-OSOB6QYX.js";
|
|
44
44
|
import {
|
|
45
45
|
safeWallet
|
|
46
46
|
} from "./chunk-BHAPTB57.js";
|
|
@@ -49,13 +49,13 @@ import {
|
|
|
49
49
|
} from "./chunk-AM5MSNVQ.js";
|
|
50
50
|
import {
|
|
51
51
|
safepalWallet
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-VMMROPXK.js";
|
|
53
53
|
import {
|
|
54
54
|
subWallet
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-ZJJWGKB6.js";
|
|
56
56
|
import {
|
|
57
57
|
metaMaskWallet
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-IRHK6SOW.js";
|
|
59
59
|
import {
|
|
60
60
|
mewWallet
|
|
61
61
|
} from "./chunk-DP5ICBEB.js";
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
} from "./chunk-BBPTPMH7.js";
|
|
65
65
|
import {
|
|
66
66
|
okxWallet
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-ZL6XCMV5.js";
|
|
68
68
|
import {
|
|
69
69
|
omniWallet
|
|
70
70
|
} from "./chunk-G3RQSCYR.js";
|
|
@@ -79,16 +79,16 @@ import {
|
|
|
79
79
|
} from "./chunk-57GN4W23.js";
|
|
80
80
|
import {
|
|
81
81
|
foxWallet
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-YGMU5VWD.js";
|
|
83
83
|
import {
|
|
84
84
|
frameWallet
|
|
85
85
|
} from "./chunk-MTJIPVYB.js";
|
|
86
86
|
import {
|
|
87
87
|
frontierWallet
|
|
88
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-J3PJOMO7.js";
|
|
89
89
|
import {
|
|
90
90
|
gateWallet
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-LEAZMT5Y.js";
|
|
92
92
|
import {
|
|
93
93
|
imTokenWallet
|
|
94
94
|
} from "./chunk-BWLMNATA.js";
|
|
@@ -101,21 +101,21 @@ import {
|
|
|
101
101
|
import {
|
|
102
102
|
ledgerWallet
|
|
103
103
|
} from "./chunk-V4EXM3KB.js";
|
|
104
|
-
import {
|
|
105
|
-
braveWallet
|
|
106
|
-
} from "./chunk-XVH4JIXB.js";
|
|
107
104
|
import {
|
|
108
105
|
clvWallet
|
|
109
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-3ZJN3PXP.js";
|
|
110
107
|
import {
|
|
111
108
|
coin98Wallet
|
|
112
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-RZQ4B4Z7.js";
|
|
110
|
+
import {
|
|
111
|
+
bybitWallet
|
|
112
|
+
} from "./chunk-7IEUTLHY.js";
|
|
113
113
|
import {
|
|
114
114
|
coinbaseWallet
|
|
115
115
|
} from "./chunk-OUM6H3WU.js";
|
|
116
116
|
import {
|
|
117
117
|
coreWallet
|
|
118
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-55VS2NKG.js";
|
|
119
119
|
import {
|
|
120
120
|
dawnWallet
|
|
121
121
|
} from "./chunk-PARFRRNI.js";
|
|
@@ -125,15 +125,12 @@ import {
|
|
|
125
125
|
import {
|
|
126
126
|
enkryptWallet
|
|
127
127
|
} from "./chunk-2DKNXOPL.js";
|
|
128
|
-
import {
|
|
129
|
-
argentWallet
|
|
130
|
-
} from "./chunk-XTD6OMZP.js";
|
|
131
128
|
import {
|
|
132
129
|
bifrostWallet
|
|
133
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-OD6B2ISG.js";
|
|
134
131
|
import {
|
|
135
132
|
bitgetWallet
|
|
136
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-IMNI4AGV.js";
|
|
137
134
|
import {
|
|
138
135
|
bitskiWallet
|
|
139
136
|
} from "./chunk-Y36HPFB3.js";
|
|
@@ -144,10 +141,13 @@ import {
|
|
|
144
141
|
bloomWallet
|
|
145
142
|
} from "./chunk-S6R4B763.js";
|
|
146
143
|
import {
|
|
147
|
-
|
|
148
|
-
} from "./chunk-
|
|
149
|
-
import "./chunk-YYYRPQHB.js";
|
|
144
|
+
argentWallet
|
|
145
|
+
} from "./chunk-XTD6OMZP.js";
|
|
150
146
|
import "./chunk-FMVNQKZL.js";
|
|
147
|
+
import {
|
|
148
|
+
braveWallet
|
|
149
|
+
} from "./chunk-XVH4JIXB.js";
|
|
150
|
+
import "./chunk-YYYRPQHB.js";
|
|
151
151
|
import "./chunk-3K2MFXCO.js";
|
|
152
152
|
export {
|
|
153
153
|
argentWallet,
|