@funkit/connect 12.16.0 → 12.18.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 +86 -0
- package/dist/clients/axiom.d.ts +1 -5
- package/dist/clients/{chunk-BKK2BFIP.js → chunk-AELXD5XA.js} +1 -1
- package/dist/clients/{chunk-6IH7AWFA.js → chunk-FOXMRDKD.js} +1 -1
- package/dist/clients/{chunk-UZ3NA7HN.js → chunk-G6A62MZO.js} +3 -3
- package/dist/clients/{chunk-OB5GKTP2.js → chunk-L6JL2XJY.js} +1 -1
- package/dist/clients/{chunk-I5VRAFH6.js → chunk-LCYJLY4X.js} +1 -1
- package/dist/clients/chunk-R25GIAD5.js +59 -0
- package/dist/clients/{chunk-7JYLS7IF.js → chunk-YSAAJSWT.js} +272 -48
- package/dist/clients/fanatics.js +2 -2
- package/dist/clients/internal/nado/withdrawalCallback.js +4 -4
- package/dist/clients/internal/nado/withdrawalConfig.js +2 -2
- package/dist/clients/internal/nado/withdrawalErrors.js +2 -2
- package/dist/clients/internal/nado/withdrawalForm.js +6 -6
- package/dist/clients/internal/nado/withdrawalStatus.js +3 -3
- package/dist/clients/lighter.css +8 -8
- package/dist/clients/lighter.d.ts +29 -16
- package/dist/clients/lighter.js +149 -68
- package/dist/clients/mallard.js +2 -2
- package/dist/clients/nado.js +4 -4
- package/dist/components/LargeAmountInput/LargeAmountInput.d.ts +3 -1
- package/dist/components/TokenSwapWidget/TokenSelectButton/TokenSelectButton.d.ts +5 -2
- package/dist/components/TokenSwapWidget/TokenSwapCard/TokenSwapCard.d.ts +7 -3
- package/dist/components/TokenSwapWidget/TokenSwapWidget.d.ts +7 -2
- package/dist/consts/customers.d.ts +12 -1
- package/dist/domains/convert/assets.d.ts +30 -0
- package/dist/domains/convert/balances.d.ts +44 -24
- package/dist/domains/convert/errors.d.ts +38 -0
- package/dist/domains/convert/execution.d.ts +39 -0
- package/dist/domains/convert/hostTimeout.d.ts +8 -0
- package/dist/domains/convert/inputAmount.d.ts +53 -0
- package/dist/domains/convert/quote.d.ts +33 -0
- package/dist/domains/convert/recipient.d.ts +2 -1
- package/dist/domains/convert/reducer.d.ts +112 -0
- package/dist/domains/convert/screen.d.ts +169 -0
- package/dist/domains/convert/settlement.d.ts +52 -0
- package/dist/domains/convert/sourceWallet.d.ts +5 -4
- package/dist/domains/convert/submit.d.ts +67 -0
- package/dist/domains/convert/types.d.ts +52 -27
- package/dist/domains/convert/view.d.ts +111 -0
- package/dist/domains/nativeFeeReserve.d.ts +29 -0
- package/dist/domains/quote.d.ts +14 -1
- package/dist/hooks/queries/useWithdrawFops.d.ts +6 -0
- package/dist/hooks/queries/useWithdrawalQuote.d.ts +4 -1
- package/dist/hooks/track/CheckoutModalEvent.d.ts +2 -0
- package/dist/hooks/track/WithdrawModalEvent.d.ts +1 -0
- package/dist/hooks/track/analytics/events.d.ts +59 -1
- package/dist/hooks/track/analytics/mappers.d.ts +5 -4
- package/dist/hooks/track/analytics/resolveIframeStepNavigation.d.ts +18 -0
- package/dist/hooks/track/analytics/useDepositAnalytics.d.ts +2 -2
- package/dist/hooks/track/analytics/useTrackSwappedIframeEvents.d.ts +5 -0
- package/dist/hooks/track/analytics/useWithdrawalAnalytics.d.ts +2 -2
- package/dist/hooks/track/useQuoteAttemptCounter.d.ts +2 -0
- package/dist/hooks/useConvertAssetList.d.ts +23 -0
- package/dist/hooks/useConvertAssets.d.ts +11 -0
- package/dist/hooks/useConvertBalances.d.ts +50 -0
- package/dist/hooks/useConvertExecute.d.ts +33 -0
- package/dist/hooks/useConvertQuote.d.ts +53 -0
- package/dist/hooks/useConvertSelectionWallets.d.ts +34 -0
- package/dist/hooks/useConvertTransactionStatus.d.ts +17 -0
- package/dist/hooks/useMaxSpendableAmount.d.ts +19 -0
- package/dist/hooks/useStepQueryReadiness.d.ts +45 -15
- package/dist/index.css +8 -8
- package/dist/index.d.ts +3 -2
- package/dist/index.js +8169 -3491
- package/dist/modals/CheckoutModal/Convert/ConvertAssetList.d.ts +16 -0
- package/dist/modals/CheckoutModal/Convert/ConvertAssetRow.d.ts +21 -0
- package/dist/modals/CheckoutModal/Convert/ConvertChainPills.d.ts +14 -0
- package/dist/modals/CheckoutModal/Convert/ConvertSelectDestinationStep.d.ts +30 -0
- package/dist/modals/CheckoutModal/Convert/ConvertSelectSourceStep.d.ts +18 -0
- package/dist/modals/CheckoutModal/Convert/ConvertStep.d.ts +4 -2
- package/dist/modals/CheckoutModal/FunCheckoutStep.d.ts +2 -0
- package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +5 -3
- package/dist/modals/CheckoutModal/SwappedIframe/swappedIframeReady.track.d.ts +8 -0
- package/dist/modals/CheckoutModal/Withdrawal/WithdrawalComplete.d.ts +5 -2
- package/dist/modals/CheckoutModal/Withdrawal/WithdrawalEnterAmount.d.ts +4 -2
- package/dist/modals/CheckoutModal/stepTransition.d.ts +7 -2
- package/dist/modals/CheckoutModal/stepTransition.shared.d.ts +0 -1
- package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +48 -15
- package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +17 -4
- package/dist/modals/WithdrawalModal/WithdrawalContent.d.ts +10 -7
- package/dist/modals/WithdrawalModal/useMaxWithdrawableAmount.d.ts +10 -0
- package/dist/modals/WithdrawalModal/useMultiSourceWithdrawal.d.ts +41 -0
- package/dist/modals/WithdrawalModal/withdrawalFormHelpers.d.ts +28 -8
- package/dist/providers/ConvertProvider.d.ts +40 -0
- package/dist/providers/FunkitCheckoutContext/index.d.ts +2 -2
- package/dist/providers/FunkitCheckoutContext/types.d.ts +36 -2
- package/dist/providers/FunkitQuoteContext.track.d.ts +23 -3
- package/dist/providers/SwappedProvider.d.ts +7 -0
- package/dist/shadow-css.js +1 -1
- package/dist/utils/customer.d.ts +34 -4
- package/dist/utils/withdrawal.d.ts +28 -1
- package/dist/wallets/multiSourceWithdrawal.d.ts +36 -0
- package/dist/wallets/walletConnectors/index.js +42 -42
- package/package.json +6 -6
- package/dist/clients/chunk-6EU6CXNH.js +0 -20
- /package/dist/clients/{chunk-4DBUYTEE.js → chunk-LICTGZXW.js} +0 -0
package/dist/clients/lighter.css
CHANGED
|
@@ -17323,14 +17323,6 @@
|
|
|
17323
17323
|
background: var(--rk-colors-modalBackground);
|
|
17324
17324
|
}
|
|
17325
17325
|
|
|
17326
|
-
/* vanilla-extract-css-ns:src/components/FunSelectBrokerage/FunBrokerageItem.css.ts.vanilla.css?source=LmFuMzR5OTAgewogIGRpc3BsYXk6IGZsZXg7CiAganVzdGlmeS1jb250ZW50OiBzcGFjZS1iZXR3ZWVuOwogIGFsaWduLWl0ZW1zOiBjZW50ZXI7CiAgZmxleDogMTsKfQ */
|
|
17327
|
-
[data-rk] .an34y90 {
|
|
17328
|
-
display: flex;
|
|
17329
|
-
justify-content: space-between;
|
|
17330
|
-
align-items: center;
|
|
17331
|
-
flex: 1;
|
|
17332
|
-
}
|
|
17333
|
-
|
|
17334
17326
|
/* vanilla-extract-css-ns:src/components/FunCountdown/FunCountdown.css.ts.vanilla.css?source=Ll8xdDBiYzExMSB7CiAgcG9zaXRpb246IGFic29sdXRlOwogIGxlZnQ6IDA7CiAgdG9wOiAwOwogIGJvdHRvbTogMDsKICB0cmFuc2Zvcm06IHJvdGF0ZSgtOTBkZWcpOwp9Ci5fMXQwYmMxMTMgewogIHBvc2l0aW9uOiBhYnNvbHV0ZTsKICBsZWZ0OiAwOwogIHRvcDogMDsKICBib3R0b206IDA7CiAgdHJhbnNmb3JtOiByb3RhdGUoLTkwZGVnKTsKfQ */
|
|
17335
17327
|
[data-rk] ._1t0bc111 {
|
|
17336
17328
|
position: absolute;
|
|
@@ -17347,6 +17339,14 @@
|
|
|
17347
17339
|
transform: rotate(-90deg);
|
|
17348
17340
|
}
|
|
17349
17341
|
|
|
17342
|
+
/* vanilla-extract-css-ns:src/components/FunSelectBrokerage/FunBrokerageItem.css.ts.vanilla.css?source=LmFuMzR5OTAgewogIGRpc3BsYXk6IGZsZXg7CiAganVzdGlmeS1jb250ZW50OiBzcGFjZS1iZXR3ZWVuOwogIGFsaWduLWl0ZW1zOiBjZW50ZXI7CiAgZmxleDogMTsKfQ */
|
|
17343
|
+
[data-rk] .an34y90 {
|
|
17344
|
+
display: flex;
|
|
17345
|
+
justify-content: space-between;
|
|
17346
|
+
align-items: center;
|
|
17347
|
+
flex: 1;
|
|
17348
|
+
}
|
|
17349
|
+
|
|
17350
17350
|
/* vanilla-extract-css-ns:src/components/SourcePaymentMethodItem/SourcePaymentMethodItem.css.ts.vanilla.css?source=Ll8xeW9mZWZsMCB7CiAgZGlzcGxheTogaW5saW5lLWZsZXg7CiAgYWxpZ24taXRlbXM6IGNlbnRlcjsKICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjsKICBtaW4td2lkdGg6IDdweDsKfQouXzF5b2ZlZmwxIHsKICBwb3NpdGlvbjogcmVsYXRpdmU7Cn0KLl8xeW9mZWZsMSAuXzF5b2ZlZmwyIHsKICBiYWNrZ3JvdW5kOiBsaW5lYXItZ3JhZGllbnQoOTBkZWcsIHRyYW5zcGFyZW50IDYzLjE2JSwgdmFyKC0tcmstY29sb3JzLW9wdGlvbkJveEJhY2tncm91bmQpIDkxLjQ1JSk7Cn0KLl8xeW9mZWZsMTpob3ZlciAuXzF5b2ZlZmwyIHsKICBiYWNrZ3JvdW5kOiBsaW5lYXItZ3JhZGllbnQoOTBkZWcsIHRyYW5zcGFyZW50IDYzLjE2JSwgdmFyKC0tcmstY29sb3JzLW9mZkJhY2tncm91bmQpIDkxLjQ1JSk7Cn0 */
|
|
17351
17351
|
[data-rk] ._1yofefl0 {
|
|
17352
17352
|
display: inline-flex;
|
|
@@ -4,22 +4,26 @@
|
|
|
4
4
|
* Lighter supports two withdrawal types — the SDK exposes them as a
|
|
5
5
|
* multi-method config so the user is shown a selection screen first:
|
|
6
6
|
*
|
|
7
|
-
* 1. **Fast** — routed through Fun + Relay.
|
|
8
|
-
* destination chains/tokens supported.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* 1. **Fast** — routed through Fun + Relay. Perps collateral only (USDC;
|
|
8
|
+
* USDG on Robinhood). Multiple destination chains/tokens supported.
|
|
9
|
+
* Completes in seconds.
|
|
10
|
+
* 2. **Secure** — Lighter's native bridge to its L1 (Ethereum; Robinhood
|
|
11
|
+
* Chain for Lighter on Robinhood). Destination chain is locked to the L1
|
|
12
|
+
* and the destination token matches the source.
|
|
12
13
|
*
|
|
13
14
|
* Both callbacks conform to CustomWithdrawalConfig.withdrawCallback; the
|
|
14
15
|
* caller provides the actual on-chain implementation.
|
|
15
16
|
*/
|
|
17
|
+
import { type LighterChainId } from '@funkit/chains';
|
|
16
18
|
import { type Address } from 'viem';
|
|
17
19
|
import { type LighterSigner } from '@funkit/connect-core/clients/lighter';
|
|
18
20
|
import type { CustomWithdrawalConfig, LighterRouteType, MultiMethodWithdrawalConfig, SourceTokenOption, WithdrawalSourceTokenBalanceParams } from '../providers/FunkitCheckoutContext/types';
|
|
19
21
|
export { LIGHTER_ROUTE_TYPE } from '@funkit/connect-core/clients/lighter';
|
|
20
22
|
export type { LighterRouteType } from '../providers/FunkitCheckoutContext/types';
|
|
21
23
|
export type { LighterSigner, LighterTransaction, LighterTransferParams, } from '@funkit/connect-core/clients/lighter';
|
|
22
|
-
export { LIGHTER_WITHDRAW_ABI, buildLighterL1WithdrawTransaction, isLighterWithdrawalRateLimitError,
|
|
24
|
+
export { LIGHTER_WITHDRAW_ABI, buildLighterL1WithdrawTransaction, isLighterWithdrawalRateLimitError, } from '@funkit/connect-core/clients/lighter';
|
|
25
|
+
/** Lighter base units, defaulting to mainnet for existing connect integrators. */
|
|
26
|
+
export declare function lighterWithdrawBaseUnits(assetIndex: number, amountTokenUnits: string, chainId?: LighterChainId): bigint;
|
|
23
27
|
export interface LighterWithdrawalConfig {
|
|
24
28
|
/**
|
|
25
29
|
* The connected user's L1 address. The hook resolves the Lighter account
|
|
@@ -27,6 +31,8 @@ export interface LighterWithdrawalConfig {
|
|
|
27
31
|
* own wallet hook) in the caller and pass it through.
|
|
28
32
|
*/
|
|
29
33
|
l1Address: Address;
|
|
34
|
+
/** Instance both the signer and Secure callback sign on; defaults to mainnet. */
|
|
35
|
+
chainId?: LighterChainId;
|
|
30
36
|
/** Title shown on the selection screen. Defaults to "Withdraw". */
|
|
31
37
|
modalTitle?: string;
|
|
32
38
|
disableConnectedWallet?: boolean;
|
|
@@ -77,10 +83,17 @@ export interface LighterSecureWithdrawalCallbackParams {
|
|
|
77
83
|
* selects Perps vs Spot.
|
|
78
84
|
*/
|
|
79
85
|
routeType: LighterRouteType;
|
|
86
|
+
/**
|
|
87
|
+
* Lighter instance to withdraw from. Sign on this instance: the same asset
|
|
88
|
+
* index and account index mean different things on mainnet and RH.
|
|
89
|
+
*/
|
|
90
|
+
chainId: LighterChainId;
|
|
80
91
|
}
|
|
81
92
|
type LighterSecureWithdrawalExec = (params: LighterSecureWithdrawalCallbackParams) => Promise<string>;
|
|
82
93
|
export interface LighterSecureWithdrawalConfig {
|
|
83
94
|
accountIndex: string;
|
|
95
|
+
/** Lighter instance the callback signs on. Defaults to mainnet Lighter. */
|
|
96
|
+
chainId?: LighterChainId;
|
|
84
97
|
modalTitle?: string;
|
|
85
98
|
disableConnectedWallet?: boolean;
|
|
86
99
|
iconSrc?: string;
|
|
@@ -88,8 +101,8 @@ export interface LighterSecureWithdrawalConfig {
|
|
|
88
101
|
sourceTokens?: SourceTokenOption[];
|
|
89
102
|
withdrawalSourceTokenBalance?: (params: WithdrawalSourceTokenBalanceParams) => string | number;
|
|
90
103
|
/**
|
|
91
|
-
* Submit the Secure withdrawal on Lighter's L2. Funds bridge directly to
|
|
92
|
-
*
|
|
104
|
+
* Submit the Secure withdrawal on Lighter's L2. Funds bridge directly to the
|
|
105
|
+
* instance's L1. No relay/swap — the token withdrawn is the token received.
|
|
93
106
|
*/
|
|
94
107
|
sendLighterSecureWithdrawal: LighterSecureWithdrawalExec;
|
|
95
108
|
/**
|
|
@@ -106,26 +119,26 @@ export interface LighterSecureWithdrawalConfig {
|
|
|
106
119
|
*/
|
|
107
120
|
onBeforeSign?: () => Promise<void> | void;
|
|
108
121
|
}
|
|
109
|
-
/** Single-method config for
|
|
122
|
+
/** Single-method config for Secure withdrawal to the instance's L1. */
|
|
110
123
|
export declare function createLighterSecureWithdrawalConfig(config: LighterSecureWithdrawalConfig): CustomWithdrawalConfig;
|
|
111
124
|
/**
|
|
112
125
|
* Builds the source-token options list for the Lighter compound input dropdown.
|
|
113
126
|
*
|
|
114
|
-
* - Fast path: only
|
|
115
|
-
* - Secure path:
|
|
116
|
-
* account carries a spot USDC asset + every non-USDC asset on the account.
|
|
127
|
+
* - Fast path: only the instance's perps collateral.
|
|
128
|
+
* - Secure path: perps collateral + supported spot assets on the account.
|
|
117
129
|
*
|
|
118
|
-
* Unified Trading accounts
|
|
119
|
-
*
|
|
120
|
-
* `USDC (Spot)` entry is hidden on both paths.
|
|
130
|
+
* Unified Trading accounts have a single collateral balance: label it with
|
|
131
|
+
* the base symbol and suppress the separate collateral spot entry.
|
|
121
132
|
*/
|
|
122
|
-
export declare function buildLighterSourceTokenOptions({ isSecure, lighterAssets, isUnifiedTradingMode, }: {
|
|
133
|
+
export declare function buildLighterSourceTokenOptions({ isSecure, lighterAssets, isUnifiedTradingMode, chainId, }: {
|
|
123
134
|
/** Secure lists every spot asset alongside perps; Fast is perps-only. */
|
|
124
135
|
isSecure: boolean;
|
|
125
136
|
lighterAssets: {
|
|
126
137
|
symbol: string;
|
|
127
138
|
}[];
|
|
128
139
|
isUnifiedTradingMode?: boolean;
|
|
140
|
+
/** Lighter instance the options are for. Defaults to mainnet Lighter. */
|
|
141
|
+
chainId?: LighterChainId;
|
|
129
142
|
}): SourceTokenOption[];
|
|
130
143
|
/**
|
|
131
144
|
* The single React entry point for Lighter withdrawals. Returns a
|
package/dist/clients/lighter.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
+
LIGHTER_API_KEY_BY_CHAIN_ID,
|
|
3
4
|
useLighterAccountQuery,
|
|
4
5
|
useLighterAccountsQuery
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-R25GIAD5.js";
|
|
6
7
|
import {
|
|
7
8
|
useFunkitConfig
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FOXMRDKD.js";
|
|
9
10
|
import {
|
|
10
11
|
AsyncImage,
|
|
11
12
|
Box,
|
|
@@ -13,21 +14,24 @@ import {
|
|
|
13
14
|
} from "./chunk-RQALGV5U.js";
|
|
14
15
|
import {
|
|
15
16
|
useFunkitTranslation
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-L6JL2XJY.js";
|
|
17
18
|
import "./chunk-OODIKHYE.js";
|
|
18
19
|
import "./chunk-2W2P3OS6.js";
|
|
19
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-YSAAJSWT.js";
|
|
20
21
|
import {
|
|
21
22
|
logger
|
|
22
23
|
} from "./chunk-AHYOV7AV.js";
|
|
23
24
|
|
|
24
25
|
// src/clients/lighter.tsx
|
|
25
|
-
import {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
import {
|
|
27
|
+
LIGHTER_CHAIN_ID as LIGHTER_CHAIN_ID2,
|
|
28
|
+
LIGHTER_RH_CHAIN_ID,
|
|
29
|
+
SOLANA_MAINNET_CHAIN_ID
|
|
30
|
+
} from "@funkit/chains";
|
|
31
|
+
import { useLogOnce as useLogOnce2 } from "@funkit/connect-core";
|
|
28
32
|
import i18next from "i18next";
|
|
29
33
|
import React7, { useMemo as useMemo3 } from "react";
|
|
30
|
-
import { arbitrum, base, bsc,
|
|
34
|
+
import { arbitrum, base, bsc, optimism } from "viem/chains";
|
|
31
35
|
|
|
32
36
|
// src/components/Icons/EvmWallet.tsx
|
|
33
37
|
import React from "react";
|
|
@@ -281,11 +285,12 @@ function SupportedChainList({
|
|
|
281
285
|
|
|
282
286
|
// src/clients/lighter.tsx
|
|
283
287
|
import {
|
|
284
|
-
LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS as LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS2,
|
|
285
288
|
LIGHTER_FAST_MAX_WITHDRAWAL_USD as LIGHTER_FAST_MAX_WITHDRAWAL_USD2,
|
|
286
|
-
|
|
289
|
+
LIGHTER_INSTANCES as LIGHTER_INSTANCES2,
|
|
290
|
+
lighterWithdrawBaseUnits as coreLighterWithdrawBaseUnits,
|
|
287
291
|
createLighterAdaptedWallet,
|
|
288
292
|
getLighterBaseSymbol as getLighterBaseSymbol3,
|
|
293
|
+
getLighterDefaultSecureMinWithdrawalAmounts,
|
|
289
294
|
trackLighterSecureWithdrawal,
|
|
290
295
|
useLighterWithdrawalDelaySeconds
|
|
291
296
|
} from "@funkit/connect-core/clients/lighter";
|
|
@@ -295,7 +300,11 @@ import {
|
|
|
295
300
|
DirectExecutionType,
|
|
296
301
|
createDirectExecution
|
|
297
302
|
} from "@funkit/api-base";
|
|
298
|
-
import {
|
|
303
|
+
import {
|
|
304
|
+
LIGHTER_CHAIN_ID,
|
|
305
|
+
LIGHTER_CHAIN_IDS,
|
|
306
|
+
toLighterChainId
|
|
307
|
+
} from "@funkit/chains";
|
|
299
308
|
import { formatAddress, formatCryptoAndStringify } from "@funkit/utils";
|
|
300
309
|
import { v4 as uuid } from "uuid";
|
|
301
310
|
import React6, {
|
|
@@ -341,12 +350,16 @@ function formatSecondsTranslated(seconds, t, specifyUnderMinute = false, omitSec
|
|
|
341
350
|
// src/modals/WithdrawalModal/LighterWithdrawal.tsx
|
|
342
351
|
import { useLogOnce } from "@funkit/connect-core";
|
|
343
352
|
import {
|
|
353
|
+
LIGHTER_INSTANCES,
|
|
344
354
|
LIGHTER_ROUTE_TYPE,
|
|
345
355
|
buildLighterL1WithdrawTransaction,
|
|
346
356
|
getLighterBaseSymbol,
|
|
347
|
-
|
|
357
|
+
getLighterSecureL1Address,
|
|
358
|
+
getLighterSecureL1Decimals,
|
|
348
359
|
isLighterWithdrawalRateLimitError,
|
|
349
360
|
lighterWithdrawBaseUnits,
|
|
361
|
+
resolveLighterAssetIndex,
|
|
362
|
+
resolveLighterSecureRouteType,
|
|
350
363
|
resolveLighterWithdrawalExplorerUrl,
|
|
351
364
|
truncateToDecimals,
|
|
352
365
|
useLighterFastUnstakedFeeTokens
|
|
@@ -361,9 +374,9 @@ import {
|
|
|
361
374
|
LIGHTER_UNSTAKED_FEE_TOKENS,
|
|
362
375
|
LIGHTER_USDC_SPOT_SYMBOL,
|
|
363
376
|
getLighterBaseSymbol as getLighterBaseSymbol2,
|
|
364
|
-
|
|
365
|
-
resolveLighterAssetIndex,
|
|
366
|
-
resolveLighterSecureRouteType
|
|
377
|
+
getLighterSecureL1Address as getLighterSecureL1Address2,
|
|
378
|
+
resolveLighterAssetIndex as resolveLighterAssetIndex2,
|
|
379
|
+
resolveLighterSecureRouteType as resolveLighterSecureRouteType2
|
|
367
380
|
} from "@funkit/connect-core/clients/lighter";
|
|
368
381
|
var LIGHTER_FAST_METHOD_ID = "lighter-fast";
|
|
369
382
|
var LIGHTER_SECURE_METHOD_ID = "lighter-secure";
|
|
@@ -373,14 +386,15 @@ import { LIGHTER_ROUTE_TYPE as LIGHTER_ROUTE_TYPE3 } from "@funkit/connect-core/
|
|
|
373
386
|
import {
|
|
374
387
|
LIGHTER_WITHDRAW_ABI,
|
|
375
388
|
buildLighterL1WithdrawTransaction as buildLighterL1WithdrawTransaction2,
|
|
376
|
-
isLighterWithdrawalRateLimitError as isLighterWithdrawalRateLimitError2
|
|
377
|
-
lighterWithdrawBaseUnits as lighterWithdrawBaseUnits2
|
|
389
|
+
isLighterWithdrawalRateLimitError as isLighterWithdrawalRateLimitError2
|
|
378
390
|
} from "@funkit/connect-core/clients/lighter";
|
|
379
391
|
var LIGHTER_USDC_PERPS_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
380
|
-
|
|
381
|
-
|
|
392
|
+
function lighterWithdrawBaseUnits2(assetIndex, amountTokenUnits, chainId = LIGHTER_CHAIN_ID2) {
|
|
393
|
+
return coreLighterWithdrawBaseUnits(assetIndex, amountTokenUnits, chainId);
|
|
394
|
+
}
|
|
395
|
+
function useLighterSecureDelayText(enabled, chainId) {
|
|
382
396
|
const { t } = useFunkitTranslation();
|
|
383
|
-
const seconds = useLighterWithdrawalDelaySeconds();
|
|
397
|
+
const seconds = useLighterWithdrawalDelaySeconds({ enabled, chainId });
|
|
384
398
|
if (seconds === void 0) {
|
|
385
399
|
return void 0;
|
|
386
400
|
}
|
|
@@ -394,7 +408,8 @@ function useLighterSecureDelayText() {
|
|
|
394
408
|
);
|
|
395
409
|
}
|
|
396
410
|
function buildSecureWithdrawalCallback({
|
|
397
|
-
exec
|
|
411
|
+
exec,
|
|
412
|
+
chainId
|
|
398
413
|
}) {
|
|
399
414
|
return async (param) => {
|
|
400
415
|
const { targetAssetAddress, destinationAddress } = param;
|
|
@@ -418,7 +433,10 @@ function buildSecureWithdrawalCallback({
|
|
|
418
433
|
return;
|
|
419
434
|
}
|
|
420
435
|
const withdrawalUSD = param.withdrawalUSD ?? "0";
|
|
436
|
+
const l1ChainId = LIGHTER_INSTANCES2[chainId].secureL1Chain.id;
|
|
421
437
|
logger.info("lighter:withdrawal:secure:start", {
|
|
438
|
+
chainId,
|
|
439
|
+
l1ChainId,
|
|
422
440
|
assetIndex,
|
|
423
441
|
routeType,
|
|
424
442
|
amountTokenUnits,
|
|
@@ -428,16 +446,19 @@ function buildSecureWithdrawalCallback({
|
|
|
428
446
|
const txHash = await exec({
|
|
429
447
|
amountTokenUnits,
|
|
430
448
|
assetIndex,
|
|
431
|
-
routeType
|
|
449
|
+
routeType,
|
|
450
|
+
chainId
|
|
432
451
|
});
|
|
433
452
|
logger.info("lighter:withdrawal:secure:submitted", {
|
|
453
|
+
chainId,
|
|
454
|
+
l1ChainId,
|
|
434
455
|
amountTokenUnits,
|
|
435
456
|
assetIndex,
|
|
436
457
|
routeType,
|
|
437
458
|
txHash
|
|
438
459
|
});
|
|
439
460
|
void trackLighterSecureWithdrawal({
|
|
440
|
-
apiKey:
|
|
461
|
+
apiKey: LIGHTER_API_KEY_BY_CHAIN_ID[chainId],
|
|
441
462
|
logger,
|
|
442
463
|
// Secure locks the destination to the connected wallet, so the L1
|
|
443
464
|
// recipient address doubles as the userId for tracking purposes.
|
|
@@ -445,14 +466,17 @@ function buildSecureWithdrawalCallback({
|
|
|
445
466
|
txHash,
|
|
446
467
|
recipientAddr: destinationAddress,
|
|
447
468
|
assetIndex,
|
|
448
|
-
|
|
469
|
+
l1TokenAddress: targetAssetAddress,
|
|
449
470
|
amountTokenUnits,
|
|
450
|
-
withdrawalUSD
|
|
471
|
+
withdrawalUSD,
|
|
472
|
+
chainId
|
|
451
473
|
});
|
|
452
474
|
return txHash;
|
|
453
475
|
};
|
|
454
476
|
}
|
|
455
477
|
function createLighterSecureWithdrawalConfig(config) {
|
|
478
|
+
const chainId = config.chainId ?? LIGHTER_CHAIN_ID2;
|
|
479
|
+
const { perpsCollateral, secureL1Chain } = LIGHTER_INSTANCES2[chainId];
|
|
456
480
|
return {
|
|
457
481
|
modalTitle: config.modalTitle ?? i18next.t("withdrawal.withdraw"),
|
|
458
482
|
disableConnectedWallet: config.disableConnectedWallet,
|
|
@@ -460,12 +484,14 @@ function createLighterSecureWithdrawalConfig(config) {
|
|
|
460
484
|
sourceTokens: config.sourceTokens,
|
|
461
485
|
withdrawalSourceTokenBalance: config.withdrawalSourceTokenBalance,
|
|
462
486
|
withdrawCallback: buildSecureWithdrawalCallback({
|
|
463
|
-
exec: config.sendLighterSecureWithdrawal
|
|
487
|
+
exec: config.sendLighterSecureWithdrawal,
|
|
488
|
+
chainId
|
|
464
489
|
}),
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
490
|
+
// The L1 is the source chain the modal shows and prices against.
|
|
491
|
+
sourceChainId: secureL1Chain.id.toString(),
|
|
492
|
+
sourceTokenSymbol: perpsCollateral.symbol,
|
|
493
|
+
defaultReceiveToken: perpsCollateral.symbol,
|
|
494
|
+
sourceTokenAddress: perpsCollateral.l1Address,
|
|
469
495
|
iconSrc: config.iconSrc ?? "https://sdk-cdn.fun.xyz/images/logos/lighter.png",
|
|
470
496
|
getMinWithdrawalUSD: () => 0,
|
|
471
497
|
getMinWithdrawalAmount: config.getMinWithdrawalAmount
|
|
@@ -474,24 +500,30 @@ function createLighterSecureWithdrawalConfig(config) {
|
|
|
474
500
|
function buildLighterSourceTokenOptions({
|
|
475
501
|
isSecure,
|
|
476
502
|
lighterAssets,
|
|
477
|
-
isUnifiedTradingMode = false
|
|
503
|
+
isUnifiedTradingMode = false,
|
|
504
|
+
chainId = LIGHTER_CHAIN_ID2
|
|
478
505
|
}) {
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
506
|
+
const instance = LIGHTER_INSTANCES2[chainId];
|
|
507
|
+
const collateral = instance.perpsCollateral.symbol;
|
|
508
|
+
const perpsOption = {
|
|
509
|
+
symbol: collateral,
|
|
510
|
+
label: isUnifiedTradingMode ? collateral : `${collateral} (Perps)`,
|
|
511
|
+
iconSrc: getTokenIconUrl(collateral)
|
|
483
512
|
};
|
|
484
513
|
if (!isSecure) {
|
|
485
|
-
return [
|
|
514
|
+
return [perpsOption];
|
|
486
515
|
}
|
|
516
|
+
const supportedSymbols = new Set(
|
|
517
|
+
Object.values(instance.secureAssets).map((asset) => asset.symbol)
|
|
518
|
+
);
|
|
487
519
|
const spotOptions = lighterAssets.filter(
|
|
488
|
-
(asset) => !(isUnifiedTradingMode && asset.symbol.toUpperCase() ===
|
|
520
|
+
(asset) => supportedSymbols.has(asset.symbol.toUpperCase()) && !(isUnifiedTradingMode && asset.symbol.toUpperCase() === collateral)
|
|
489
521
|
).map((asset) => {
|
|
490
|
-
if (asset.symbol.toUpperCase() ===
|
|
522
|
+
if (asset.symbol.toUpperCase() === collateral) {
|
|
491
523
|
return {
|
|
492
|
-
symbol:
|
|
493
|
-
label:
|
|
494
|
-
iconSrc: getTokenIconUrl(
|
|
524
|
+
symbol: `${collateral} (Spot)`,
|
|
525
|
+
label: `${collateral} (Spot)`,
|
|
526
|
+
iconSrc: getTokenIconUrl(collateral)
|
|
495
527
|
};
|
|
496
528
|
}
|
|
497
529
|
return {
|
|
@@ -500,7 +532,7 @@ function buildLighterSourceTokenOptions({
|
|
|
500
532
|
iconSrc: getTokenIconUrl(asset.symbol)
|
|
501
533
|
};
|
|
502
534
|
});
|
|
503
|
-
return [
|
|
535
|
+
return [perpsOption, ...spotOptions];
|
|
504
536
|
}
|
|
505
537
|
function buildLighterFastWalletWithdrawalConfig({
|
|
506
538
|
signerClient,
|
|
@@ -510,18 +542,20 @@ function buildLighterFastWalletWithdrawalConfig({
|
|
|
510
542
|
iconSrc,
|
|
511
543
|
onBeforeSign,
|
|
512
544
|
isUnifiedTradingMode,
|
|
513
|
-
withdrawalSourceTokenBalance
|
|
545
|
+
withdrawalSourceTokenBalance,
|
|
546
|
+
chainId
|
|
514
547
|
}) {
|
|
515
548
|
const adaptedWallet = createLighterAdaptedWallet({
|
|
516
549
|
signerClient,
|
|
517
550
|
accountIndex,
|
|
518
|
-
logger
|
|
551
|
+
logger,
|
|
552
|
+
chainId
|
|
519
553
|
});
|
|
520
554
|
const wallet = {
|
|
521
555
|
_type: "lighter",
|
|
522
556
|
adaptedWallet,
|
|
523
557
|
address: () => String(accountIndex),
|
|
524
|
-
getChainId: async () =>
|
|
558
|
+
getChainId: async () => chainId,
|
|
525
559
|
// biome-ignore lint/suspicious/noEmptyBlockStatements: no-op — Lighter has no EVM chain switching
|
|
526
560
|
switchChain: async () => {
|
|
527
561
|
},
|
|
@@ -537,12 +571,13 @@ function buildLighterFastWalletWithdrawalConfig({
|
|
|
537
571
|
disableConnectedWallet,
|
|
538
572
|
onBeforeSign,
|
|
539
573
|
wallet,
|
|
540
|
-
sourceChainId:
|
|
541
|
-
sourceTokenSymbol:
|
|
574
|
+
sourceChainId: String(chainId),
|
|
575
|
+
sourceTokenSymbol: LIGHTER_INSTANCES2[chainId].perpsCollateral.symbol,
|
|
542
576
|
sourceTokens: buildLighterSourceTokenOptions({
|
|
543
577
|
isSecure: false,
|
|
544
578
|
lighterAssets: [],
|
|
545
|
-
isUnifiedTradingMode
|
|
579
|
+
isUnifiedTradingMode,
|
|
580
|
+
chainId
|
|
546
581
|
}),
|
|
547
582
|
withdrawalSourceTokenBalance,
|
|
548
583
|
defaultReceiveToken: "USDC",
|
|
@@ -552,6 +587,17 @@ function buildLighterFastWalletWithdrawalConfig({
|
|
|
552
587
|
getMaxWithdrawalUSD: () => LIGHTER_FAST_MAX_WITHDRAWAL_USD2
|
|
553
588
|
};
|
|
554
589
|
}
|
|
590
|
+
var LIGHTER_SECURE_DISCLAIMER = {
|
|
591
|
+
// Until the live value loads, show the localized "60+ minutes" historical
|
|
592
|
+
// estimate. The "+" lives in the per-locale fallback string so it doesn't
|
|
593
|
+
// bleed into live values, which are exact.
|
|
594
|
+
[LIGHTER_CHAIN_ID2]: (t, delay) => t("withdrawal.secureDisclaimer", {
|
|
595
|
+
delay: delay ?? t("withdrawal.secureFallbackDelay")
|
|
596
|
+
}),
|
|
597
|
+
// Mainnet's estimate would overstate RH's much shorter bridge delay, so RH
|
|
598
|
+
// omits the delay until the live value loads.
|
|
599
|
+
[LIGHTER_RH_CHAIN_ID]: (t, delay) => delay ? t("withdrawal.secureDisclaimerRobinhood", { delay }) : t("withdrawal.secureDisclaimerRobinhoodNoDelay")
|
|
600
|
+
};
|
|
555
601
|
var LIGHTER_FAST_PREVIEW_CHAIN_IDS = [
|
|
556
602
|
arbitrum.id,
|
|
557
603
|
base.id,
|
|
@@ -559,14 +605,14 @@ var LIGHTER_FAST_PREVIEW_CHAIN_IDS = [
|
|
|
559
605
|
bsc.id,
|
|
560
606
|
SOLANA_MAINNET_CHAIN_ID
|
|
561
607
|
].map(String);
|
|
562
|
-
var LIGHTER_SECURE_PREVIEW_CHAIN_IDS = [mainnet2.id].map(String);
|
|
563
608
|
function buildLighterMultiMethodConfig({
|
|
564
609
|
config,
|
|
565
610
|
accountIndex,
|
|
566
611
|
t,
|
|
567
612
|
secureDelayText,
|
|
568
613
|
isUnifiedTradingMode,
|
|
569
|
-
assets
|
|
614
|
+
assets,
|
|
615
|
+
chainId
|
|
570
616
|
}) {
|
|
571
617
|
const fastConfig = buildLighterFastWalletWithdrawalConfig({
|
|
572
618
|
signerClient: config.signerClient,
|
|
@@ -576,14 +622,17 @@ function buildLighterMultiMethodConfig({
|
|
|
576
622
|
iconSrc: config.fastIconSrc,
|
|
577
623
|
onBeforeSign: config.onBeforeSign,
|
|
578
624
|
isUnifiedTradingMode,
|
|
579
|
-
withdrawalSourceTokenBalance: config.withdrawalSourceTokenBalance
|
|
625
|
+
withdrawalSourceTokenBalance: config.withdrawalSourceTokenBalance,
|
|
626
|
+
chainId
|
|
580
627
|
});
|
|
581
628
|
const secureConfig = createLighterSecureWithdrawalConfig({
|
|
582
629
|
accountIndex,
|
|
630
|
+
chainId,
|
|
583
631
|
sourceTokens: buildLighterSourceTokenOptions({
|
|
584
632
|
isSecure: true,
|
|
585
633
|
lighterAssets: assets,
|
|
586
|
-
isUnifiedTradingMode
|
|
634
|
+
isUnifiedTradingMode,
|
|
635
|
+
chainId
|
|
587
636
|
}),
|
|
588
637
|
withdrawalSourceTokenBalance: config.withdrawalSourceTokenBalance,
|
|
589
638
|
modalTitle: config.modalTitle,
|
|
@@ -596,13 +645,17 @@ function buildLighterMultiMethodConfig({
|
|
|
596
645
|
if (userMin !== void 0) {
|
|
597
646
|
return userMin;
|
|
598
647
|
}
|
|
599
|
-
return
|
|
648
|
+
return getLighterDefaultSecureMinWithdrawalAmounts(chainId)[getLighterBaseSymbol3(symbol).toUpperCase()] ?? 0;
|
|
600
649
|
}
|
|
601
650
|
});
|
|
602
651
|
const fast = {
|
|
603
652
|
id: LIGHTER_FAST_METHOD_ID,
|
|
604
653
|
keyText: t("withdrawal.methodFast"),
|
|
605
|
-
subtitleText: isUnifiedTradingMode ? t("withdrawal.fastDisclaimerUnified"
|
|
654
|
+
subtitleText: isUnifiedTradingMode ? t("withdrawal.fastDisclaimerUnified", {
|
|
655
|
+
symbol: LIGHTER_INSTANCES2[chainId].perpsCollateral.symbol
|
|
656
|
+
}) : t("withdrawal.fastDisclaimer", {
|
|
657
|
+
symbol: LIGHTER_INSTANCES2[chainId].perpsCollateral.symbol
|
|
658
|
+
}),
|
|
606
659
|
icon: /* @__PURE__ */ React7.createElement(EvmWallet, { size: 20 }),
|
|
607
660
|
valueIcon: /* @__PURE__ */ React7.createElement(SupportedChainList, { chainIdList: LIGHTER_FAST_PREVIEW_CHAIN_IDS }),
|
|
608
661
|
config: fastConfig
|
|
@@ -610,32 +663,39 @@ function buildLighterMultiMethodConfig({
|
|
|
610
663
|
const secure = {
|
|
611
664
|
id: LIGHTER_SECURE_METHOD_ID,
|
|
612
665
|
keyText: t("withdrawal.methodSecure"),
|
|
613
|
-
subtitleText: t
|
|
614
|
-
// Until the live value loads, show the localized "60+ minutes"
|
|
615
|
-
// historical estimate. The "+" lives in the per-locale fallback string
|
|
616
|
-
// so it doesn't bleed into live values, which are exact.
|
|
617
|
-
delay: secureDelayText ?? t("withdrawal.secureFallbackDelay")
|
|
618
|
-
}),
|
|
666
|
+
subtitleText: LIGHTER_SECURE_DISCLAIMER[chainId](t, secureDelayText),
|
|
619
667
|
icon: /* @__PURE__ */ React7.createElement(EvmWallet, { size: 20 }),
|
|
620
|
-
valueIcon: /* @__PURE__ */ React7.createElement(
|
|
668
|
+
valueIcon: /* @__PURE__ */ React7.createElement(
|
|
669
|
+
SupportedChainList,
|
|
670
|
+
{
|
|
671
|
+
chainIdList: [LIGHTER_INSTANCES2[chainId].secureL1Chain.id.toString()]
|
|
672
|
+
}
|
|
673
|
+
),
|
|
621
674
|
config: secureConfig
|
|
622
675
|
};
|
|
623
676
|
return {
|
|
624
677
|
modalTitle: config.modalTitle ?? t("withdrawal.withdraw"),
|
|
625
678
|
sectionTitle: t("withdrawal.sectionCrypto"),
|
|
626
|
-
methods: [fast, secure]
|
|
679
|
+
methods: LIGHTER_INSTANCES2[chainId].supportsSecure ? [fast, secure] : [fast]
|
|
627
680
|
};
|
|
628
681
|
}
|
|
629
682
|
function useLighterWithdrawalConfig(config) {
|
|
630
683
|
const { t } = useFunkitTranslation();
|
|
631
|
-
const
|
|
632
|
-
const
|
|
684
|
+
const chainId = config?.chainId ?? LIGHTER_CHAIN_ID2;
|
|
685
|
+
const { mainAccountIndex: accountIndex, isUnifiedTradingMode } = useLighterAccountsQuery({
|
|
686
|
+
address: config?.l1Address,
|
|
687
|
+
chainId
|
|
688
|
+
});
|
|
689
|
+
const secureDelayText = useLighterSecureDelayText(
|
|
690
|
+
LIGHTER_INSTANCES2[chainId].supportsSecure,
|
|
691
|
+
chainId
|
|
692
|
+
);
|
|
633
693
|
const { account } = useLighterAccountQuery(
|
|
634
694
|
// The query validates it as numeric, so the template-literal narrowing holds.
|
|
635
|
-
accountIndex ? { by: "index", value: accountIndex } : null
|
|
695
|
+
accountIndex ? { by: "index", value: accountIndex, chainId } : null
|
|
636
696
|
);
|
|
637
697
|
const assets = useMemo3(() => account?.assets ?? [], [account]);
|
|
638
|
-
|
|
698
|
+
const multiMethodConfig = useMemo3(() => {
|
|
639
699
|
if (!config || !accountIndex) {
|
|
640
700
|
return null;
|
|
641
701
|
}
|
|
@@ -645,9 +705,30 @@ function useLighterWithdrawalConfig(config) {
|
|
|
645
705
|
t,
|
|
646
706
|
secureDelayText,
|
|
647
707
|
isUnifiedTradingMode,
|
|
648
|
-
assets
|
|
708
|
+
assets,
|
|
709
|
+
chainId
|
|
649
710
|
});
|
|
650
|
-
}, [
|
|
711
|
+
}, [
|
|
712
|
+
config,
|
|
713
|
+
accountIndex,
|
|
714
|
+
t,
|
|
715
|
+
secureDelayText,
|
|
716
|
+
isUnifiedTradingMode,
|
|
717
|
+
assets,
|
|
718
|
+
chainId
|
|
719
|
+
]);
|
|
720
|
+
const methodIds = multiMethodConfig?.methods.map((method) => method.id);
|
|
721
|
+
useLogOnce2(
|
|
722
|
+
methodIds ? `${chainId}|${accountIndex}|${methodIds.join(",")}` : void 0,
|
|
723
|
+
() => {
|
|
724
|
+
logger.info("lighter:withdrawal:instance", {
|
|
725
|
+
chainId,
|
|
726
|
+
accountIndex,
|
|
727
|
+
methodIds
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
);
|
|
731
|
+
return multiMethodConfig;
|
|
651
732
|
}
|
|
652
733
|
export {
|
|
653
734
|
LIGHTER_ROUTE_TYPE3 as LIGHTER_ROUTE_TYPE,
|
package/dist/clients/mallard.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
useFunkitTranslation
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-L6JL2XJY.js";
|
|
5
5
|
import {
|
|
6
6
|
getAccount,
|
|
7
7
|
sendTransaction,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
useAccount,
|
|
15
15
|
useConfig
|
|
16
16
|
} from "./chunk-2W2P3OS6.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-YSAAJSWT.js";
|
|
18
18
|
import {
|
|
19
19
|
logger
|
|
20
20
|
} from "./chunk-AHYOV7AV.js";
|
package/dist/clients/nado.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createNadoWithdrawalCallback
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-G6A62MZO.js";
|
|
5
|
+
import "./chunk-AELXD5XA.js";
|
|
6
|
+
import "./chunk-LICTGZXW.js";
|
|
7
7
|
import "./chunk-OODIKHYE.js";
|
|
8
8
|
import {
|
|
9
9
|
useAccount,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./chunk-2W2P3OS6.js";
|
|
12
12
|
import {
|
|
13
13
|
i18n_default
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-YSAAJSWT.js";
|
|
15
15
|
import "./chunk-TKEBGMVW.js";
|
|
16
16
|
import {
|
|
17
17
|
logger
|
|
@@ -18,9 +18,11 @@ export interface LargeAmountInputProps {
|
|
|
18
18
|
maxFontSize?: number;
|
|
19
19
|
/** Caps the width the text shrinks to fit, on top of the measured container. */
|
|
20
20
|
maxAvailableWidth?: number;
|
|
21
|
+
/** Overrides the measured text width, e.g. `'100%'` to widen the click target. */
|
|
22
|
+
width?: number | string;
|
|
21
23
|
testId?: string;
|
|
22
24
|
}
|
|
23
25
|
/**
|
|
24
26
|
* Big "$<amount>" field that shrinks its font to fit the available width.
|
|
25
27
|
*/
|
|
26
|
-
export declare function LargeAmountInput({ amount, onAmountChange, ariaLabel, align, prefix, suffix, placeholder, readOnly, autoFocus, maxFontSize: maxFontSizeProp, maxAvailableWidth, testId, }: LargeAmountInputProps): React.JSX.Element;
|
|
28
|
+
export declare function LargeAmountInput({ amount, onAmountChange, ariaLabel, align, prefix, suffix, placeholder, readOnly, autoFocus, maxFontSize: maxFontSizeProp, maxAvailableWidth, width, testId, }: LargeAmountInputProps): React.JSX.Element;
|
|
@@ -5,13 +5,16 @@ export interface TokenSwapToken {
|
|
|
5
5
|
chainId?: string | number;
|
|
6
6
|
}
|
|
7
7
|
export interface TokenSelectButtonProps {
|
|
8
|
-
token
|
|
8
|
+
/** Omit when nothing is picked yet; the button then reads "Select token". */
|
|
9
|
+
token?: TokenSwapToken;
|
|
9
10
|
/** Omit to render the token without the picker affordance. */
|
|
10
11
|
onClick?: () => void;
|
|
12
|
+
/** Keeps the picker affordance but ignores clicks. */
|
|
13
|
+
isDisabled?: boolean;
|
|
11
14
|
testId?: string;
|
|
12
15
|
}
|
|
13
16
|
/**
|
|
14
17
|
* Token icon (with chain badge), symbol and ">" that opens the token picker.
|
|
15
18
|
* Without `onClick` it renders as plain content, so it isn't a dead tab stop.
|
|
16
19
|
*/
|
|
17
|
-
export declare function TokenSelectButton({ token, onClick, testId, }: TokenSelectButtonProps): React.JSX.Element;
|
|
20
|
+
export declare function TokenSelectButton({ token, onClick, isDisabled, testId, }: TokenSelectButtonProps): React.JSX.Element | null;
|