@funkit/connect 11.2.0 → 11.4.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 +100 -0
- package/dist/clients/{chunk-SU3YSNMB.js → chunk-3Y5EIONT.js} +3 -9
- package/dist/clients/chunk-6EU6CXNH.js +20 -0
- package/dist/clients/{chunk-DGBIV3ZS.js → chunk-B7UU2ETA.js} +0 -13
- package/dist/clients/{chunk-QQEGNLGD.js → chunk-EQFVPSR2.js} +1 -1
- package/dist/clients/internal/nado/withdrawalCallback.js +2 -2
- package/dist/clients/internal/nado/withdrawalConfig.d.ts +2 -0
- package/dist/clients/internal/nado/withdrawalConfig.js +2 -2
- package/dist/clients/internal/nado/withdrawalForm.js +13 -58
- package/dist/clients/lighter.d.ts +4 -61
- package/dist/clients/lighter.js +66 -338
- package/dist/clients/nado.d.ts +2 -0
- package/dist/clients/nado.js +7 -6
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +1 -1
- package/dist/clients/polymarket/createPolymarketDepositConfig.d.ts +6 -0
- package/dist/clients/polymarket/index.js +1 -1
- package/dist/components/FunCheckoutHistory/FunCheckoutHistoryContent.d.ts +3 -1
- package/dist/components/FunCheckoutHistory/PendingSuccessScreen.d.ts +3 -1
- package/dist/domains/checkout.d.ts +8 -2
- package/dist/hooks/track/analytics/claimAnalyticsEvent.d.ts +5 -0
- package/dist/hooks/track/analytics/events.d.ts +176 -9
- package/dist/hooks/track/analytics/mappers.d.ts +15 -0
- package/dist/hooks/track/analytics/quote.d.ts +12 -0
- package/dist/hooks/track/analytics/resolveExecutionProgressContext.d.ts +40 -0
- package/dist/hooks/track/analytics/useDepositAnalytics.d.ts +71 -3
- package/dist/hooks/track/analytics/useTrackExecutionProgressEvents.d.ts +17 -0
- package/dist/hooks/track/analytics/useWithdrawalAnalytics.d.ts +18 -0
- package/dist/hooks/track/useTrackV2.d.ts +2 -0
- package/dist/hooks/useAssetPrice.d.ts +1 -6
- package/dist/hooks/useIsBlacklistedWithdrawalAddress.d.ts +4 -1
- package/dist/index.js +2214 -1094
- package/dist/modals/CheckoutModal/ConfirmationStep/useCheckoutConfirmation.d.ts +2 -1
- package/dist/modals/CheckoutModal/ConfirmationStep/useQuoteRefresh.d.ts +5 -1
- package/dist/modals/CheckoutModal/ConfirmationStep/useTrackDepositQuoteEvents.d.ts +20 -0
- package/dist/modals/CheckoutModal/MeldQuotes/useMeldQuotes.d.ts +1 -1
- package/dist/modals/CheckoutModal/SourceChange/useTrackSourceChangeEvents.d.ts +10 -0
- package/dist/modals/CheckoutModal/TransferToken/useTrackDepositNotificationEvents.d.ts +6 -0
- package/dist/modals/CheckoutModal/TransferToken/useTransferTokenTracking.d.ts +9 -3
- package/dist/modals/PolymarketPerpsTransfer/recordPerpsTransfer.d.ts +40 -0
- package/dist/modals/PolymarketPerpsTransfer/useRecordPerpsTransfer.d.ts +24 -0
- package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +14 -92
- package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +3 -1
- package/dist/modals/WithdrawalModal/useTrackWithdrawalEvents.d.ts +1 -0
- package/dist/providers/FunkitCheckoutContext/index.d.ts +10 -2
- package/dist/providers/FunkitCheckoutContext/types.d.ts +17 -2
- package/dist/providers/FunkitStatsigProvider.d.ts +1 -1
- package/dist/utils/customer.d.ts +24 -276
- package/dist/utils/lighter.d.ts +1 -83
- package/dist/utils/signature.d.ts +1 -2
- package/dist/utils/withdrawal.d.ts +1 -21
- package/dist/wallets/walletConnectors/index.js +10 -10
- package/package.json +4 -5
- package/dist/clients/chunk-6QCAWEAT.js +0 -53
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Address } from 'viem';
|
|
2
2
|
import { type CheckoutConfirmationError } from '../../../domains/checkoutErrors';
|
|
3
|
+
import { type CheckoutConfirmationResult } from '../../../providers/FunkitCheckoutContext';
|
|
3
4
|
interface UseCheckoutConfirmationOptions {
|
|
4
5
|
onError(error: CheckoutConfirmationError): void;
|
|
5
6
|
onSuccess(depositAddress: Address): void;
|
|
@@ -7,7 +8,7 @@ interface UseCheckoutConfirmationOptions {
|
|
|
7
8
|
interface UseCheckoutConfirmationResult {
|
|
8
9
|
confirmationError: CheckoutConfirmationError | null;
|
|
9
10
|
confirmationStepMessage: string | null;
|
|
10
|
-
handleCheckoutConfirmation(): Promise<
|
|
11
|
+
handleCheckoutConfirmation(): Promise<CheckoutConfirmationResult | undefined>;
|
|
11
12
|
isConfirming: boolean;
|
|
12
13
|
}
|
|
13
14
|
export declare function useCheckoutConfirmation({ onError, onSuccess, }: UseCheckoutConfirmationOptions): UseCheckoutConfirmationResult;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ErrorNotification } from '../../../components/FunNotification/FunNotification';
|
|
2
2
|
interface UseQuoteRefreshOptions {
|
|
3
|
+
/** Resets refresh state when the active checkout changes. */
|
|
4
|
+
checkoutId: string | null;
|
|
3
5
|
/**
|
|
4
6
|
* Freeze the latest quote state, e.g. so we do not change the quote mid-confirmation
|
|
5
7
|
*/
|
|
@@ -16,8 +18,10 @@ interface UseQuoteRefreshResult {
|
|
|
16
18
|
countdown: React.ReactNode;
|
|
17
19
|
quoteError: ErrorNotification | null;
|
|
18
20
|
quoteStepMessage: string | null;
|
|
21
|
+
/** Number of refreshed quotes that have successfully become active. */
|
|
22
|
+
numQuoteRefreshes: number;
|
|
19
23
|
/** Safe to call asynchronously */
|
|
20
24
|
refreshQuote(ignorePreloaded?: boolean): Promise<void>;
|
|
21
25
|
}
|
|
22
|
-
export declare function useQuoteRefresh({ isOnHold, refreshIntervalSeconds, }: UseQuoteRefreshOptions): UseQuoteRefreshResult;
|
|
26
|
+
export declare function useQuoteRefresh({ checkoutId, isOnHold, refreshIntervalSeconds, }: UseQuoteRefreshOptions): UseQuoteRefreshResult;
|
|
23
27
|
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type PaymentMethodInfo } from '../../../domains/paymentMethods';
|
|
2
|
+
import type { TrackDepositQuoteSnapshotArgs } from '../../../hooks/track/analytics/useDepositAnalytics';
|
|
3
|
+
interface UseTrackDepositQuoteEventsArgs {
|
|
4
|
+
paymentMethodInfo: PaymentMethodInfo;
|
|
5
|
+
/** Only the local quote-fetching state matters here — everything else
|
|
6
|
+
* (checkout item, quote, wallet, execution info) is read from shared
|
|
7
|
+
* context so ConfirmationStep doesn't have to thread it through. */
|
|
8
|
+
isQuoteLoading: boolean;
|
|
9
|
+
numQuoteRefreshes: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Fires `fc_deposit_quote_displayed` once per distinct quote id.
|
|
13
|
+
* `trackQuoteConfirmed` fires `fc_deposit_quote_confirmed` for the CTA path
|
|
14
|
+
* that calls it, and returns the confirmed snapshot so the caller can pair it
|
|
15
|
+
* with the transaction that results from the confirmation.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useTrackDepositQuoteEvents({ paymentMethodInfo, isQuoteLoading, numQuoteRefreshes, }: UseTrackDepositQuoteEventsArgs): {
|
|
18
|
+
trackQuoteConfirmed: () => TrackDepositQuoteSnapshotArgs | null;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PaymentMethodType } from '../../../hooks/usePaymentSources';
|
|
2
|
+
/** Source Change step events (modal opened, tab switched, etc.) */
|
|
3
|
+
export declare function useTrackSourceChangeEvents({ tab, }: {
|
|
4
|
+
tab: PaymentMethodType;
|
|
5
|
+
}): {
|
|
6
|
+
trackTabSwitched: (input: {
|
|
7
|
+
fromTab: PaymentMethodType;
|
|
8
|
+
tab: PaymentMethodType;
|
|
9
|
+
}) => void;
|
|
10
|
+
};
|
|
@@ -5,18 +5,24 @@ export declare const addressDisplayedAtMsByCheckoutKey: {
|
|
|
5
5
|
};
|
|
6
6
|
interface UseTransferTokenTrackingProps {
|
|
7
7
|
depositAddress: string | undefined;
|
|
8
|
+
estPriceImpact: number | null;
|
|
8
9
|
fromChainId: string | undefined;
|
|
10
|
+
fromTokenAddress: string | undefined;
|
|
9
11
|
fromTokenSymbol: string | undefined;
|
|
12
|
+
minAmountUsd: number;
|
|
13
|
+
targetChainId: string | undefined;
|
|
14
|
+
targetTokenAddress: string | undefined;
|
|
15
|
+
targetTokenSymbol: string | null;
|
|
10
16
|
toChainId: string | undefined;
|
|
11
17
|
toTokenAddress: string | undefined;
|
|
12
18
|
}
|
|
13
19
|
type UseTransferTokenTrackingResult = {
|
|
14
20
|
trackAddressCopied: () => void;
|
|
15
21
|
trackImpactExpanded: (estPriceImpactPct: number | undefined) => void;
|
|
16
|
-
trackSourceChainChange: (newChainId: string) => void;
|
|
17
|
-
trackSourceTokenChange: (newTokenSymbol: string) => void;
|
|
22
|
+
trackSourceChainChange: (newChainId: string, newTokenSymbol: string, queueInteraction?: boolean) => void;
|
|
23
|
+
trackSourceTokenChange: (newTokenSymbol: string, newChainId: number | undefined, queueInteraction?: boolean) => void;
|
|
18
24
|
};
|
|
19
|
-
export declare function useTransferTokenTracking({ depositAddress, fromChainId, fromTokenSymbol, toChainId, toTokenAddress, }: UseTransferTokenTrackingProps): UseTransferTokenTrackingResult;
|
|
25
|
+
export declare function useTransferTokenTracking({ depositAddress, estPriceImpact, fromChainId, fromTokenAddress, fromTokenSymbol, minAmountUsd, targetChainId, targetTokenAddress, targetTokenSymbol, toChainId, toTokenAddress, }: UseTransferTokenTrackingProps): UseTransferTokenTrackingResult;
|
|
20
26
|
interface UseNotificationTrackingProps {
|
|
21
27
|
item: NotificationItem | null;
|
|
22
28
|
status: NotificationStatus;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Records a perps ⇄ predictions transfer as a tracking-only direct execution, so
|
|
3
|
+
* transfer volume outlives the Datadog logs it currently lives in (ENG-4867).
|
|
4
|
+
*
|
|
5
|
+
* `EXTERNALLY_FULFILLED` because Fun only initiates the move and Polymarket's own
|
|
6
|
+
* contracts settle it — the same shape Lighter's fills use, which the backend
|
|
7
|
+
* closes out as a terminal SUCCESS without polling for settlement.
|
|
8
|
+
*/
|
|
9
|
+
import type { Address } from 'viem';
|
|
10
|
+
import type { FunkitActiveCheckoutItem } from '../../providers/FunkitCheckoutContext';
|
|
11
|
+
import type { PerpsTransferDirection } from './PolymarketPerpsTransferScreen';
|
|
12
|
+
/**
|
|
13
|
+
* `sourceOfFund` is a persisted, GSI-indexed column, making this prefix the
|
|
14
|
+
* stable key transfer volume is reported on — do not reformat it.
|
|
15
|
+
*/
|
|
16
|
+
export declare const PERPS_TRANSFER_SOURCE_OF_FUND_PREFIX = "polymarket_perps_transfer";
|
|
17
|
+
export declare function buildPerpsTransferSourceOfFund(direction: PerpsTransferDirection, sourceAddress: Address): string;
|
|
18
|
+
export interface RecordPerpsTransferParams {
|
|
19
|
+
direction: PerpsTransferDirection;
|
|
20
|
+
sourceAddress: Address;
|
|
21
|
+
/** Becomes the row's `recipientAddr`. */
|
|
22
|
+
destinationAddress: Address;
|
|
23
|
+
/** Exact string the user entered (validated numeric, ≤6 decimals). */
|
|
24
|
+
amountUsd: string;
|
|
25
|
+
/**
|
|
26
|
+
* The rail's own id, when the integrator returns one. Absent for integrators
|
|
27
|
+
* still on the void-returning `transfer()`, which falls back to a local uuid
|
|
28
|
+
* and leaves the record with no join key to the venue's side.
|
|
29
|
+
*/
|
|
30
|
+
railId?: string;
|
|
31
|
+
userId: string | undefined;
|
|
32
|
+
apiKey: string;
|
|
33
|
+
checkoutItem: FunkitActiveCheckoutItem;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Best-effort by design: the transfer already succeeded when this runs, so a
|
|
37
|
+
* bookkeeping failure must never surface to the user or be retried. Callers do
|
|
38
|
+
* not need to catch — every failure path is swallowed at WARN here.
|
|
39
|
+
*/
|
|
40
|
+
export declare function recordPerpsTransfer({ direction, sourceAddress, destinationAddress, amountUsd, railId, userId, apiKey, checkoutItem, }: RecordPerpsTransferParams): Promise<void>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supplies the inputs for recording a perps ⇄ predictions transfer, so the step
|
|
3
|
+
* passes only what the user did and knows nothing about the API key, the user id
|
|
4
|
+
* or the checkout snapshot.
|
|
5
|
+
*
|
|
6
|
+
* Lives beside the step rather than in `~/hooks/` because it is Polymarket-specific
|
|
7
|
+
* and those directories must stay customer-agnostic.
|
|
8
|
+
*/
|
|
9
|
+
import type { Address } from 'viem';
|
|
10
|
+
import type { PerpsTransferDirection } from './PolymarketPerpsTransferScreen';
|
|
11
|
+
export interface RecordPerpsTransferInput {
|
|
12
|
+
direction: PerpsTransferDirection;
|
|
13
|
+
sourceAddress: Address;
|
|
14
|
+
destinationAddress: Address;
|
|
15
|
+
/** Exact string the user entered (validated numeric, ≤6 decimals). */
|
|
16
|
+
amountUsd: string;
|
|
17
|
+
/** The rail's own id, when the integrator's `transfer()` returns one. */
|
|
18
|
+
railId?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Never rejects: the underlying record swallows its own failures. No-ops when
|
|
22
|
+
* there is no active checkout to attribute the transfer to.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useRecordPerpsTransfer(): (input: RecordPerpsTransferInput) => Promise<void>;
|
|
@@ -8,36 +8,10 @@ import React from 'react';
|
|
|
8
8
|
import { type Address, type Hex } from 'viem';
|
|
9
9
|
import { type CheckoutConfirmationError } from '../../domains/checkoutErrors';
|
|
10
10
|
import type { CustomWithdrawalConfig, LighterRouteType, TokenInfo, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
|
|
11
|
-
import type { LighterAsset, LighterPoolInfo, LighterShare } from '../../utils/customer';
|
|
12
11
|
/** Stable method ids for the Fast / Secure options (used for tracking + switching). */
|
|
13
12
|
export declare const LIGHTER_FAST_METHOD_ID = "lighter-fast";
|
|
14
13
|
export declare const LIGHTER_SECURE_METHOD_ID = "lighter-secure";
|
|
15
|
-
|
|
16
|
-
* USDC exists twice on a Lighter account: as perps collateral
|
|
17
|
-
* (`total_asset_value`, withdrawn via route 0) and as a spot asset balance
|
|
18
|
-
* (asset entry 3, withdrawn via route 1). The Secure dropdown keys selection
|
|
19
|
-
* by `symbol`, so the spot variant gets a pseudo-symbol to stay selectable
|
|
20
|
-
* alongside the plain `USDC` (perps) entry.
|
|
21
|
-
*/
|
|
22
|
-
export declare const LIGHTER_USDC_SPOT_SYMBOL = "USDC (Spot)";
|
|
23
|
-
/** Lighter L2 route types (`RouteType` in the withdraw/transfer tx payload). */
|
|
24
|
-
export declare const LIGHTER_ROUTE_TYPE: {
|
|
25
|
-
readonly PERPS: 0;
|
|
26
|
-
readonly SPOT: 1;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Strips the ` (Spot)` / ` (Perps)` variant suffix off a Lighter source-token
|
|
30
|
-
* selection, returning the real token symbol (e.g. `USDC (Spot)` → `USDC`).
|
|
31
|
-
* Symbol-keyed lookups (icons, prices, asset indices, min amounts) operate on
|
|
32
|
-
* the base symbol; only selection identity and route resolution keep the suffix.
|
|
33
|
-
*/
|
|
34
|
-
export declare function getLighterBaseSymbol(symbol: string): string;
|
|
35
|
-
/**
|
|
36
|
-
* Resolves the Lighter L2 route type for a Secure source-token selection.
|
|
37
|
-
* Plain `USDC` withdraws perps collateral (route 0); everything else —
|
|
38
|
-
* including the `USDC (Spot)` pseudo-symbol — is a spot asset (route 1).
|
|
39
|
-
*/
|
|
40
|
-
export declare function resolveLighterSecureRouteType(selectedSourceToken: string): LighterRouteType;
|
|
14
|
+
export { LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS, LIGHTER_FAST_MAX_WITHDRAWAL_USD, LIGHTER_ROUTE_TYPE, LIGHTER_SECURE_ASSETS_BY_INDEX, LIGHTER_STAKING_POOL_INDEX, LIGHTER_STAKING_THRESHOLD_LIT, LIGHTER_UNSTAKED_FEE_TOKENS, LIGHTER_USDC_SPOT_SYMBOL, getLighterBaseSymbol, getLighterSecureMainnetAddress, resolveLighterAssetIndex, resolveLighterSecureRouteType, resolveLighterSharePrice, resolveLighterUnstakedFeeTokens, } from '@funkit/connect-core/clients/lighter';
|
|
41
15
|
/**
|
|
42
16
|
* The selected source token as identified on Lighter's own L2, rather than by
|
|
43
17
|
* its mainnet bridge address — two Secure selections can share one mainnet
|
|
@@ -53,18 +27,16 @@ export declare function resolveLighterSourceAsset({ assetIndex, routeType, }: {
|
|
|
53
27
|
assetIndex: number | undefined;
|
|
54
28
|
routeType: LighterRouteType;
|
|
55
29
|
}): TokenInfo | undefined;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
*/
|
|
67
|
-
export declare const LIGHTER_FAST_MAX_WITHDRAWAL_USD = 3000000;
|
|
30
|
+
export declare function resolveLighterConfirmedTarget({ isLighterSecure, mainnetTokenAddress, selectedSourceToken, withdrawalInputAmount, }: {
|
|
31
|
+
isLighterSecure: boolean;
|
|
32
|
+
mainnetTokenAddress: Address | undefined;
|
|
33
|
+
selectedSourceToken: string;
|
|
34
|
+
withdrawalInputAmount: string;
|
|
35
|
+
}): {
|
|
36
|
+
asset: TokenInfo;
|
|
37
|
+
ticker: string;
|
|
38
|
+
amount: number;
|
|
39
|
+
} | undefined;
|
|
68
40
|
/**
|
|
69
41
|
* Footer shown beneath the CTA when a Lighter Fast amount exceeds the $3M cap.
|
|
70
42
|
* Renders as the `description` of a FunNotification, which supplies the shared
|
|
@@ -73,44 +45,6 @@ export declare const LIGHTER_FAST_MAX_WITHDRAWAL_USD = 3000000;
|
|
|
73
45
|
export declare function LighterFastMaxExceededMessage({ onSwitchToSecure, }: {
|
|
74
46
|
onSwitchToSecure: () => void;
|
|
75
47
|
}): React.JSX.Element;
|
|
76
|
-
/**
|
|
77
|
-
* Lighter Fast charges an "unstaked" fee — a flat deduction taken off the
|
|
78
|
-
* withdrawal amount before quoting — for users who aren't sufficiently staked
|
|
79
|
-
* in Lighter's staking pool. Sufficiently-staked users pay nothing.
|
|
80
|
-
*
|
|
81
|
-
* "Sufficiently staked" = the *current* LIT value of the user's staking-pool
|
|
82
|
-
* share is at or above the threshold. The pool is LIT-denominated and
|
|
83
|
-
* identified by its index, hardcoded here (previously read from
|
|
84
|
-
* `systemConfig.staking_pool_index`) since it's currently the only public pool
|
|
85
|
-
* a withdrawing user holds a share in. Non-stakers report `shares: []`.
|
|
86
|
-
*/
|
|
87
|
-
export declare const LIGHTER_STAKING_POOL_INDEX = 281474976624800;
|
|
88
|
-
export declare const LIGHTER_UNSTAKED_FEE_TOKENS = 3;
|
|
89
|
-
export declare const LIGHTER_STAKING_THRESHOLD_LIT = 100;
|
|
90
|
-
/**
|
|
91
|
-
* LIT per share unit for the staking pool: its LIT balance over total shares.
|
|
92
|
-
*
|
|
93
|
-
* `undefined` when the pool account is unavailable or reports no shares — the
|
|
94
|
-
* fee gate then degrades to the entry principal rather than guessing.
|
|
95
|
-
*/
|
|
96
|
-
export declare function resolveLighterSharePrice(poolAccount: {
|
|
97
|
-
assets?: LighterAsset[];
|
|
98
|
-
pool_info?: LighterPoolInfo;
|
|
99
|
-
} | undefined): number | undefined;
|
|
100
|
-
/**
|
|
101
|
-
* Resolves the Lighter Fast unstaked fee (in source tokens, i.e. USDC) for a
|
|
102
|
-
* user. A non-staker (`shares: []`, or no staking-pool share) pays the fee.
|
|
103
|
-
*
|
|
104
|
-
* Gated on the share's *current* LIT value (`shares_amount × sharePrice` — the
|
|
105
|
-
* "Your Stake" figure in Lighter's UI), not `principal_amount`, which is the
|
|
106
|
-
* entry deposit and never grows with accrued yield. Gating on the principal
|
|
107
|
-
* charged stakers whose position had appreciated past the minimum from below.
|
|
108
|
-
*
|
|
109
|
-
* Falls back to the principal when `sharePrice` is unavailable — never worse
|
|
110
|
-
* than the previous behaviour, and avoids waiving the fee for everyone when
|
|
111
|
-
* the pool account fails to load.
|
|
112
|
-
*/
|
|
113
|
-
export declare function resolveLighterUnstakedFeeTokens(shares: LighterShare[], sharePrice?: number): number;
|
|
114
48
|
/**
|
|
115
49
|
* Share price for the staking pool, read off the pool's own account. Kept a
|
|
116
50
|
* separate query from the user's account: a user's `shares[]` carries entry
|
|
@@ -126,22 +60,11 @@ export declare function useLighterStakingSharePrice(enabled: boolean): number |
|
|
|
126
60
|
export declare function useLighterWithdrawalBalances({ accountIndex, }: {
|
|
127
61
|
accountIndex: LighterAccountIndex | undefined;
|
|
128
62
|
}): {
|
|
129
|
-
assets: LighterAsset[];
|
|
130
|
-
shares: LighterShare[];
|
|
63
|
+
assets: import("@funkit/connect-core").LighterAsset[];
|
|
64
|
+
shares: import("@funkit/connect-core").LighterShare[];
|
|
131
65
|
isLoading: boolean;
|
|
132
66
|
};
|
|
133
67
|
type FunkitWithdrawalConfig = WalletWithdrawalConfig | CustomWithdrawalConfig;
|
|
134
|
-
/**
|
|
135
|
-
* Resolves the Lighter `asset_id` for a selected source token symbol. Returns
|
|
136
|
-
* `undefined` when the token isn't in the fetched assets list (e.g. timing
|
|
137
|
-
* race before balances load, or an invalid selection) — callers should treat
|
|
138
|
-
* that as "not ready to submit" rather than falling back to `0`, which would
|
|
139
|
-
* silently target the wrong Lighter asset.
|
|
140
|
-
*/
|
|
141
|
-
export declare function resolveLighterAssetIndex(lighterAssets: {
|
|
142
|
-
symbol: string;
|
|
143
|
-
asset_id: number;
|
|
144
|
-
}[], selectedSourceToken: string): number | undefined;
|
|
145
68
|
/**
|
|
146
69
|
* Detects Lighter Secure withdrawal (mainnet source chain), auto-fills the
|
|
147
70
|
* recipient address with the connected wallet, and fetches the Lighter account
|
|
@@ -152,7 +75,7 @@ export declare function useLighterWithdrawal(config: FunkitWithdrawalConfig, set
|
|
|
152
75
|
isLighterFast: boolean;
|
|
153
76
|
isUnifiedTradingMode: boolean;
|
|
154
77
|
connectedAddress: `0x${string}` | undefined;
|
|
155
|
-
lighterAssets: LighterAsset[];
|
|
78
|
+
lighterAssets: import("@funkit/connect-core").LighterAsset[];
|
|
156
79
|
lighterFastUnstakedFee: number;
|
|
157
80
|
invalidateLighterAccount: () => void;
|
|
158
81
|
};
|
|
@@ -229,4 +152,3 @@ export declare function LighterSecureWithdrawalSuccess({ onClose, onNewWithdrawa
|
|
|
229
152
|
tokenSymbol: string;
|
|
230
153
|
txHash: string;
|
|
231
154
|
}): React.JSX.Element;
|
|
232
|
-
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { WithdrawalAmountSelectionType } from '../../hooks/track/analytics/events';
|
|
2
3
|
import type { FunkitWithdrawalConfig, MultiMethodWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
|
|
3
4
|
import type { SourceTokenOption } from '../../providers/FunkitCheckoutContext';
|
|
4
5
|
export type { SourceTokenOption };
|
|
5
|
-
export declare function WithdrawAmountInput({ withdrawalInputAmount, setWithdrawalInputAmount, sourceTokenBalance, isWithdrawAmountTooLow, isWithdrawAmountTooHigh, isWithdrawAmountAboveBalance, isWithdrawAmountValid, minWithdrawalDisplayValue, config, sourceTokenOptions, onSourceTokenChange, selectedSourceToken, sourceTokenUsdPrice, }: {
|
|
6
|
+
export declare function WithdrawAmountInput({ withdrawalInputAmount, setWithdrawalInputAmount, sourceTokenBalance, isWithdrawAmountTooLow, isWithdrawAmountTooHigh, isWithdrawAmountAboveBalance, isWithdrawAmountValid, minWithdrawalDisplayValue, config, sourceTokenOptions, onSourceTokenChange, selectedSourceToken, sourceTokenUsdPrice, onAmountSelectionChange, }: {
|
|
6
7
|
config: Exclude<FunkitWithdrawalConfig, MultiMethodWithdrawalConfig>;
|
|
7
8
|
sourceTokenBalance: string;
|
|
8
9
|
/** User-entered amount in source-token units (e.g. "0.5" for 0.5 ETH). */
|
|
@@ -35,4 +36,5 @@ export declare function WithdrawAmountInput({ withdrawalInputAmount, setWithdraw
|
|
|
35
36
|
* assuming a 1:1 stablecoin rate.
|
|
36
37
|
*/
|
|
37
38
|
sourceTokenUsdPrice?: number;
|
|
39
|
+
onAmountSelectionChange?: (selectionType: WithdrawalAmountSelectionType) => void;
|
|
38
40
|
}): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useTrackWithdrawalEvents(): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { DirectExecutionType } from '@funkit/api-base';
|
|
1
2
|
import React, { type ReactNode } from 'react';
|
|
2
|
-
import type { Address } from 'viem';
|
|
3
|
+
import type { Address, Hex } from 'viem';
|
|
3
4
|
import { type ApplyDynamicRoutingPath } from '../../domains/dynamicRouting';
|
|
4
5
|
import { type PaymentMethodInfo } from '../../domains/paymentMethods';
|
|
5
6
|
import type { AssetHoldingsItem } from '../../utils/assets';
|
|
@@ -25,7 +26,7 @@ interface FunkitCheckoutContextInterface {
|
|
|
25
26
|
}): void;
|
|
26
27
|
updateSelectedPaymentMethodInfo(newPaymentMethodInfo: PaymentMethodInfo): void;
|
|
27
28
|
updateCustomRecipient: (recipient: Address) => void;
|
|
28
|
-
confirmCheckout(quote: FunkitCheckoutQuoteResult, stepMessageSetter: (m: string) => void, withdrawalClient?: WithdrawalClient, preWithdrawalTxs?: WithdrawalTransaction[]): Promise<
|
|
29
|
+
confirmCheckout(quote: FunkitCheckoutQuoteResult, stepMessageSetter: (m: string) => void, withdrawalClient?: WithdrawalClient, preWithdrawalTxs?: WithdrawalTransaction[]): Promise<CheckoutConfirmationResult>;
|
|
29
30
|
cancelCheckout(depositAddress: Address): Promise<boolean>;
|
|
30
31
|
/**
|
|
31
32
|
* Partial-update the active checkout item. Exposed for direct-execution
|
|
@@ -73,6 +74,13 @@ export type CheckoutProgressStep = 1 | 2;
|
|
|
73
74
|
export type CheckoutProgress = {
|
|
74
75
|
step: CheckoutProgressStep;
|
|
75
76
|
};
|
|
77
|
+
export type CheckoutConfirmationResult = {
|
|
78
|
+
depositAddress: Address;
|
|
79
|
+
transactionSubmitted?: {
|
|
80
|
+
txHash: Hex;
|
|
81
|
+
executionType: DirectExecutionType | null;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
76
84
|
export declare function FunkitCheckoutProvider({ children }: {
|
|
77
85
|
children: ReactNode;
|
|
78
86
|
}): React.JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FunAddress } from '@funkit/api-base';
|
|
2
|
+
import type { LighterRouteType } from '@funkit/connect-core/clients/lighter';
|
|
2
3
|
import type { ApiCheckoutClientMetadata, ApiFunkitCheckoutActionParams, ApiFunkitCheckoutConfig } from '@funkit/utils';
|
|
3
4
|
import type { ReactNode } from 'react';
|
|
4
5
|
import type { Address } from 'viem';
|
|
@@ -54,6 +55,15 @@ export declare enum FunCheckoutStartingStep {
|
|
|
54
55
|
}
|
|
55
56
|
/** Token a Polymarket account can be topped up with. */
|
|
56
57
|
export type PolymarketTopupToken = 'pUSD';
|
|
58
|
+
/**
|
|
59
|
+
* What a transfer rail returns once it accepts. `id` is whatever identifies the
|
|
60
|
+
* transfer on the venue's side and can later be joined against it — an on-chain
|
|
61
|
+
* transaction hash, a relayer id, or a perps API withdraw id, depending on how
|
|
62
|
+
* the integrator implements that direction.
|
|
63
|
+
*/
|
|
64
|
+
export interface PolymarketTransferResult {
|
|
65
|
+
id: string;
|
|
66
|
+
}
|
|
57
67
|
/**
|
|
58
68
|
* A Polymarket account in the transfer step. Both accounts share the same shape
|
|
59
69
|
* so each direction is symmetrical and integrator-owned.
|
|
@@ -69,11 +79,16 @@ export interface PolymarketTransferAccount {
|
|
|
69
79
|
* source account's transfer when the user confirms. `amountUsd` is the exact
|
|
70
80
|
* string the user entered (validated numeric, ≤6 decimals) — never a parsed
|
|
71
81
|
* number — so no float precision is lost before the integrator scales it.
|
|
82
|
+
*
|
|
83
|
+
* Returning {@link PolymarketTransferResult} is optional and recommended: the
|
|
84
|
+
* rail's own id becomes the tracking record's key, which is the only thing
|
|
85
|
+
* that can later join a Fun record to the venue's side of the same transfer.
|
|
86
|
+
* Returning nothing still records the transfer under a locally minted id.
|
|
72
87
|
*/
|
|
73
88
|
transfer: (params: {
|
|
74
89
|
toAddress: Address;
|
|
75
90
|
amountUsd: string;
|
|
76
|
-
}) => Promise<void>;
|
|
91
|
+
}) => Promise<void | PolymarketTransferResult>;
|
|
77
92
|
/**
|
|
78
93
|
* Fetches this account's live balance (USD). The transfer step polls this so
|
|
79
94
|
* the displayed balances reconcile with the real on-chain / perps-API state
|
|
@@ -324,7 +339,7 @@ export interface CustomWithdrawalConfig extends WithdrawalConfigBase {
|
|
|
324
339
|
customerConfig?: WithdrawalCustomerConfig;
|
|
325
340
|
}
|
|
326
341
|
/** Lighter L2 route type: 0 = perps (USDC collateral), 1 = spot. */
|
|
327
|
-
export type LighterRouteType
|
|
342
|
+
export type { LighterRouteType };
|
|
328
343
|
/**
|
|
329
344
|
* Lighter-specific data for quoteless Secure withdrawal. `assetIndex` selects
|
|
330
345
|
* the L2 asset (avoids overloading targetChainId); `routeType` disambiguates
|
|
@@ -5,7 +5,7 @@ export declare const STATSIG_CLIENT_KEY: "client-UmFd8WIJljA7cLmZuDqs3X25M8sKd5W
|
|
|
5
5
|
export declare const STATSIG_CLIENT_KEY_FUNWHN: "client-UrueDVSY9et85npGccWMFidPs00V5jzTYyzsDKlLAjr";
|
|
6
6
|
/**
|
|
7
7
|
* THIS IS THE TEMPORARY CLIENT FOR V2 ANALYTICS. IT DOES NOT CONTAIN ANY CONFIGS.
|
|
8
|
-
* DO NOT USE THIS CONTEXT DIRECTLY. USE
|
|
8
|
+
* DO NOT USE THIS CONTEXT DIRECTLY. USE useTrackV2 INSTEAD.
|
|
9
9
|
*/
|
|
10
10
|
export declare function useFunWhnStatsigClient(): StatsigClient | null;
|
|
11
11
|
interface FunkitStatsigProviderProps {
|