@funkit/connect 9.8.0 → 9.10.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 +36 -0
- package/dist/__generated__/default_feature_gates.d.ts +2 -0
- package/dist/clients/lighter.d.ts +35 -28
- package/dist/clients/lighter.js +121 -25
- package/dist/components/ApprovalMethodToggle/ApprovalMethodToggle.d.ts +19 -0
- package/dist/components/Dropdown/BaseActiveDropdownItem.d.ts +2 -1
- package/dist/components/Dropdown/BaseDropdown.d.ts +4 -2
- package/dist/domains/quote.d.ts +9 -1
- package/dist/hooks/useCheckoutDirectExecution.d.ts +7 -0
- package/dist/index.js +1337 -1113
- package/dist/providers/FunkitCheckoutContext/index.d.ts +1 -0
- package/dist/providers/FunkitQuoteContext.d.ts +6 -0
- package/dist/utils/polymarket.d.ts +6 -0
- package/dist/wallets/walletConnectors/index.js +35 -35
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @funkit/connect
|
|
2
2
|
|
|
3
|
+
## 9.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b902702: Render live Lighter Secure-withdrawal delay and consolidate Lighter setup behind one hook.
|
|
8
|
+
|
|
9
|
+
- `useLighterWithdrawalConfig(config | null)` is now the single React entry — it resolves the account index, balances, locale, and live `/api/v1/withdrawalDelay` internally and returns `null` until ready.
|
|
10
|
+
- `LighterWithdrawalConfig` no longer requires `accountIndex`.
|
|
11
|
+
- Removed the static `createLighterWithdrawalConfig` factory; use the hook.
|
|
12
|
+
- Secure-withdrawal disclaimer now reads "All tokens · Ethereum chain only · 1 h 50 min" (live, localized) instead of the static "60+ minutes".
|
|
13
|
+
- `getSecureMinWithdrawalAmount` is fully optional and may now return `undefined` to defer to the new exported `LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS` dictionary, which is also used as the fallback when the callback is omitted.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- ab32d56: Render Lighter withdrawal receive amount and USD label with fractional digits instead of scientific notation
|
|
18
|
+
- d3769c2: Block Polymarket withdrawals to the user's own source (proxy) wallet address
|
|
19
|
+
|
|
20
|
+
## 9.9.0
|
|
21
|
+
|
|
22
|
+
### Minor Changes
|
|
23
|
+
|
|
24
|
+
- cb719cf: Add source-side authorization toggle ("Sign message" vs "Approve transaction") to the checkout confirmation screen for Wallet/direct-execution flows, behind the `enable-permit-toggle` Statsig gate.
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- 82368fd: api-base: thread client `checkoutId` through POST /checkout
|
|
29
|
+
- cb719cf: Add labelSize, labelStyle, dropdownWidth, and dropdownAlign override props to BaseDropdown components
|
|
30
|
+
- 82368fd: fix: regenerate checkoutItem.id on SWAPPED_NEW_DEPOSIT so repeat fiat deposits in one modal session produce distinct client metadata ids
|
|
31
|
+
- cb719cf: Address review feedback on permit toggle: move usePermit derivation to FunkitQuoteContext, add missing translations, useCallback on handleSelect, clean up test mocks.
|
|
32
|
+
- Updated dependencies [82368fd]
|
|
33
|
+
- Updated dependencies [9684ac0]
|
|
34
|
+
- Updated dependencies [cb719cf]
|
|
35
|
+
- Updated dependencies [9684ac0]
|
|
36
|
+
- @funkit/api-base@4.2.0
|
|
37
|
+
- @funkit/fun-relay@2.7.0
|
|
38
|
+
|
|
3
39
|
## 9.8.0
|
|
4
40
|
|
|
5
41
|
### Minor Changes
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
readonly 'compliance-review-blocker': false;
|
|
3
3
|
readonly 'enable-across-wallet-flow': false;
|
|
4
|
+
readonly 'enable-permit-toggle': false;
|
|
5
|
+
readonly 'enable-swapped-exchanges': false;
|
|
4
6
|
readonly 'exact-in': false;
|
|
5
7
|
readonly 'faster-notifications': false;
|
|
6
8
|
readonly 'new-token-transfer-config': false;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* caller provides the actual on-chain implementation.
|
|
15
15
|
*/
|
|
16
16
|
import type { LighterAccountIndex } from '@funkit/api-base';
|
|
17
|
+
import type { Address } from 'viem';
|
|
17
18
|
import type { CustomWithdrawalConfig, MultiMethodWithdrawalConfig } from '../providers/FunkitCheckoutContext/types';
|
|
18
19
|
export type LighterTransferParams = {
|
|
19
20
|
toAccountIndex: number;
|
|
@@ -38,13 +39,18 @@ export type LighterSigner = {
|
|
|
38
39
|
transfer: (params: LighterTransferParams) => Promise<[unknown, string, string | null]>;
|
|
39
40
|
};
|
|
40
41
|
export interface LighterWithdrawalConfig {
|
|
41
|
-
|
|
42
|
+
/**
|
|
43
|
+
* The connected user's L1 address. The hook resolves the Lighter account
|
|
44
|
+
* index from this internally — get it from `useFunkitUserInfo` (or your
|
|
45
|
+
* own wallet hook) in the caller and pass it through.
|
|
46
|
+
*/
|
|
47
|
+
l1Address: Address;
|
|
42
48
|
/** Title shown on the selection screen. Defaults to "Withdraw". */
|
|
43
49
|
modalTitle?: string;
|
|
44
50
|
disableConnectedWallet?: boolean;
|
|
45
51
|
fastIconSrc?: string;
|
|
46
52
|
secureIconSrc?: string;
|
|
47
|
-
/** Pre-built Lighter signer.
|
|
53
|
+
/** Pre-built Lighter signer. */
|
|
48
54
|
signerClient: LighterSigner;
|
|
49
55
|
sendLighterSecureWithdrawal: LighterSecureWithdrawalExec;
|
|
50
56
|
/**
|
|
@@ -54,8 +60,14 @@ export interface LighterWithdrawalConfig {
|
|
|
54
60
|
* getSecureMinWithdrawalAmount: (symbol) => ({ USDC: 1, ETH: 0.001 }[symbol] ?? 0)
|
|
55
61
|
* ```
|
|
56
62
|
*/
|
|
57
|
-
getSecureMinWithdrawalAmount?: (symbol: string) => number;
|
|
63
|
+
getSecureMinWithdrawalAmount?: (symbol: string) => number | undefined;
|
|
58
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Default minimum Secure-withdrawal amounts (token units) for known Lighter
|
|
67
|
+
* assets. Used as a fallback when `LighterWithdrawalConfig.getSecureMinWithdrawalAmount`
|
|
68
|
+
* is omitted or returns `undefined` for a symbol.
|
|
69
|
+
*/
|
|
70
|
+
export declare const LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS: Record<string, number>;
|
|
59
71
|
export interface LighterSecureWithdrawalCallbackParams {
|
|
60
72
|
/** Withdrawal amount in token units (e.g. "1.5" for 1.5 ETH). */
|
|
61
73
|
amountTokenUnits: string;
|
|
@@ -100,35 +112,30 @@ export declare function useLighterWithdrawalBalances({ accountIndex, }: {
|
|
|
100
112
|
/** Single-method config for Lighter's Secure withdrawal (bridge to Ethereum). */
|
|
101
113
|
export declare function createLighterSecureWithdrawalConfig(config: LighterSecureWithdrawalConfig): CustomWithdrawalConfig;
|
|
102
114
|
/**
|
|
103
|
-
*
|
|
115
|
+
* The single React entry point for Lighter withdrawals. Returns a
|
|
116
|
+
* `MultiMethodWithdrawalConfig` ready to hand to the withdrawal modal, or
|
|
117
|
+
* `null` while the inputs aren't ready yet.
|
|
104
118
|
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
119
|
+
* The hook owns every Lighter-specific concern that requires React context:
|
|
120
|
+
* - the user's Lighter account index (resolved from `config.l1Address`)
|
|
121
|
+
* - all Lighter asset balances (so the form validates against the real
|
|
122
|
+
* account)
|
|
123
|
+
* - the live Secure-withdrawal delay (`/api/v1/withdrawalDelay`)
|
|
124
|
+
* - the active locale (so the disclaimer renders correctly)
|
|
108
125
|
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
126
|
+
* Pass `null` while prerequisites (wallet, signer, etc.) aren't ready — the
|
|
127
|
+
* hook always invokes its inner hooks (Rules of Hooks) and returns `null`
|
|
128
|
+
* until you supply a real config and the account resolves:
|
|
111
129
|
*
|
|
112
130
|
* ```tsx
|
|
113
|
-
* const
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* }
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
|
|
120
|
-
export declare function useLighterWithdrawalConfig(config: LighterWithdrawalConfig): MultiMethodWithdrawalConfig;
|
|
121
|
-
/**
|
|
122
|
-
* Creates a full {@link MultiMethodWithdrawalConfig} for Lighter that renders
|
|
123
|
-
* the Fast vs Secure selection screen before the standard withdrawal flow.
|
|
124
|
-
*
|
|
125
|
-
* Usage:
|
|
126
|
-
* ```ts
|
|
127
|
-
* const withdrawalConfig = createLighterWithdrawalConfig({
|
|
128
|
-
* accountIndex: '0',
|
|
129
|
-
* sendLighterSecureWithdrawal: async ({ amountTokenUnits, assetIndex }) => { ... },
|
|
130
|
-
* })
|
|
131
|
+
* const { address: l1Address } = useFunkitUserInfo()
|
|
132
|
+
* const lighter = useLighterWithdrawalConfig(
|
|
133
|
+
* userId && walletClient
|
|
134
|
+
* ? { l1Address, signerClient, sendLighterSecureWithdrawal, ... }
|
|
135
|
+
* : null,
|
|
136
|
+
* )
|
|
137
|
+
* if (!lighter) return { ready: false, disabledReason: '...' }
|
|
131
138
|
* ```
|
|
132
139
|
*/
|
|
133
|
-
export declare function
|
|
140
|
+
export declare function useLighterWithdrawalConfig(config: LighterWithdrawalConfig | null): MultiMethodWithdrawalConfig | null;
|
|
134
141
|
export {};
|
package/dist/clients/lighter.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import { SOLANA_MAINNET_CHAIN_ID } from "@funkit/chains";
|
|
13
13
|
import { RELAY_LIGHTER_CHAIN_ID } from "@funkit/fun-relay";
|
|
14
14
|
import { retry } from "@lifeomic/attempt";
|
|
15
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
15
16
|
import i18next from "i18next";
|
|
16
17
|
import React2, { useEffect, useMemo as useMemo2 } from "react";
|
|
17
18
|
import { arbitrum, base, bsc, mainnet as mainnet2, optimism } from "viem/chains";
|
|
@@ -238,6 +239,16 @@ function useFunkitConfig() {
|
|
|
238
239
|
}
|
|
239
240
|
|
|
240
241
|
// src/utils/customer.ts
|
|
242
|
+
async function getLighterAccountsByL1Address(address) {
|
|
243
|
+
const response = await fetch(
|
|
244
|
+
`https://mainnet.zklighter.elliot.ai/api/v1/accountsByL1Address?l1_address=${address}`
|
|
245
|
+
);
|
|
246
|
+
if (!response.ok) {
|
|
247
|
+
throw new Error(`Failed to fetch lighter accounts: ${response.statusText}`);
|
|
248
|
+
}
|
|
249
|
+
const data = await response.json();
|
|
250
|
+
return data;
|
|
251
|
+
}
|
|
241
252
|
async function getLighterAccount(lookup, activeOnly) {
|
|
242
253
|
const params = new URLSearchParams({
|
|
243
254
|
by: lookup.by,
|
|
@@ -274,11 +285,75 @@ function useLighterAccount(lookup, options) {
|
|
|
274
285
|
account: query.data?.accounts?.[0]
|
|
275
286
|
};
|
|
276
287
|
}
|
|
288
|
+
function useLighterAccounts({
|
|
289
|
+
address
|
|
290
|
+
}) {
|
|
291
|
+
const { apiKey } = useFunkitConfig();
|
|
292
|
+
const isLighter = isLighterxyzCustomer(apiKey);
|
|
293
|
+
const enabled = !!address && address !== "0x" && isLighter;
|
|
294
|
+
const query = useQuery({
|
|
295
|
+
queryKey: ["lighterAccounts", address],
|
|
296
|
+
queryFn: () => getLighterAccountsByL1Address(address),
|
|
297
|
+
enabled,
|
|
298
|
+
staleTime: Number.POSITIVE_INFINITY,
|
|
299
|
+
gcTime: Number.POSITIVE_INFINITY,
|
|
300
|
+
retry: false,
|
|
301
|
+
// allows us to always refetch the data but return the previous data until the new data is fetched
|
|
302
|
+
refetchOnMount: "always"
|
|
303
|
+
});
|
|
304
|
+
return {
|
|
305
|
+
...query,
|
|
306
|
+
mainAccountIndex: query.data?.sub_accounts?.[0]?.index?.toString(),
|
|
307
|
+
subAccounts: query.data?.sub_accounts
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// src/utils/timeFormat.ts
|
|
312
|
+
import { formatSecondsToReadableForm } from "@funkit/utils";
|
|
313
|
+
function formatSecondsTranslated(seconds, t, specifyUnderMinute = false, omitSeconds = false) {
|
|
314
|
+
return formatSecondsToReadableForm(seconds, specifyUnderMinute, omitSeconds, {
|
|
315
|
+
lessThanOneMin: t("time.lessThanOneMin"),
|
|
316
|
+
seconds: (count) => t("time.seconds", { count }),
|
|
317
|
+
minutes: (count) => t("time.minutes", { count }),
|
|
318
|
+
hours: (count) => t("time.hours", { count }),
|
|
319
|
+
secondsShort: (count) => t("time.secondsShort", { count })
|
|
320
|
+
});
|
|
321
|
+
}
|
|
277
322
|
|
|
278
323
|
// src/clients/lighter.tsx
|
|
279
324
|
var LIGHTER_USDC_PERPS_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
280
325
|
var MAINNET_USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
|
|
281
326
|
var LIGHTER_API_BASE = "https://mainnet.zklighter.elliot.ai";
|
|
327
|
+
async function getLighterWithdrawalDelay() {
|
|
328
|
+
const response = await fetch(`${LIGHTER_API_BASE}/api/v1/withdrawalDelay`);
|
|
329
|
+
if (!response.ok) {
|
|
330
|
+
throw new Error(
|
|
331
|
+
`Failed to fetch Lighter withdrawal delay: ${response.statusText}`
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
return response.json();
|
|
335
|
+
}
|
|
336
|
+
function useLighterSecureDelayText() {
|
|
337
|
+
const { t } = useFunkitTranslation();
|
|
338
|
+
const query = useQuery2({
|
|
339
|
+
queryKey: ["lighterWithdrawalDelay"],
|
|
340
|
+
queryFn: getLighterWithdrawalDelay,
|
|
341
|
+
staleTime: 6e4,
|
|
342
|
+
retry: 2
|
|
343
|
+
});
|
|
344
|
+
const seconds = query.data?.seconds;
|
|
345
|
+
if (seconds === void 0 || !Number.isFinite(seconds) || seconds <= 0) {
|
|
346
|
+
return void 0;
|
|
347
|
+
}
|
|
348
|
+
return formatSecondsTranslated(
|
|
349
|
+
seconds,
|
|
350
|
+
t,
|
|
351
|
+
/*specifyUnderMinutes*/
|
|
352
|
+
false,
|
|
353
|
+
/*omitSeconds*/
|
|
354
|
+
true
|
|
355
|
+
);
|
|
356
|
+
}
|
|
282
357
|
var LIGHTER_TX_STATUS = {
|
|
283
358
|
PENDING: 0,
|
|
284
359
|
QUEUED: 1,
|
|
@@ -402,15 +477,20 @@ function createLighterAdaptedWallet({
|
|
|
402
477
|
}
|
|
403
478
|
};
|
|
404
479
|
}
|
|
480
|
+
var LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS = {
|
|
481
|
+
USDC: 1,
|
|
482
|
+
ETH: 1e-3,
|
|
483
|
+
LIT: 1,
|
|
484
|
+
LINK: 0.1,
|
|
485
|
+
UNI: 0.2,
|
|
486
|
+
AAVE: 0.01,
|
|
487
|
+
SKY: 20,
|
|
488
|
+
LDO: 2,
|
|
489
|
+
AZTEC: 100
|
|
490
|
+
};
|
|
405
491
|
function freeBalance(balance, lockedBalance) {
|
|
406
492
|
return String(Math.max(0, Number(balance) - Number(lockedBalance)));
|
|
407
493
|
}
|
|
408
|
-
function asLighterAccountIndex(s) {
|
|
409
|
-
if (!/^\d+$/.test(s)) {
|
|
410
|
-
throw new Error(`Invalid LighterAccountIndex: ${s}`);
|
|
411
|
-
}
|
|
412
|
-
return s;
|
|
413
|
-
}
|
|
414
494
|
function useLighterWithdrawalBalances({
|
|
415
495
|
accountIndex
|
|
416
496
|
}) {
|
|
@@ -578,23 +658,31 @@ var LIGHTER_FAST_PREVIEW_CHAIN_IDS = [
|
|
|
578
658
|
var LIGHTER_SECURE_PREVIEW_CHAIN_IDS = [mainnet2.id];
|
|
579
659
|
function buildLighterMultiMethodConfig({
|
|
580
660
|
config,
|
|
661
|
+
accountIndex,
|
|
581
662
|
t,
|
|
582
|
-
withBalance
|
|
663
|
+
withBalance,
|
|
664
|
+
secureDelayText
|
|
583
665
|
}) {
|
|
584
666
|
const fastConfig = buildLighterFastWalletWithdrawalConfig({
|
|
585
667
|
signerClient: config.signerClient,
|
|
586
|
-
accountIndex: Number(
|
|
668
|
+
accountIndex: Number(accountIndex),
|
|
587
669
|
modalTitle: config.modalTitle,
|
|
588
670
|
disableConnectedWallet: config.disableConnectedWallet,
|
|
589
671
|
iconSrc: config.fastIconSrc
|
|
590
672
|
});
|
|
591
673
|
const secureConfig = createLighterSecureWithdrawalConfig({
|
|
592
|
-
accountIndex
|
|
674
|
+
accountIndex,
|
|
593
675
|
modalTitle: config.modalTitle,
|
|
594
676
|
disableConnectedWallet: config.disableConnectedWallet,
|
|
595
677
|
iconSrc: config.secureIconSrc,
|
|
596
678
|
sendLighterSecureWithdrawal: config.sendLighterSecureWithdrawal,
|
|
597
|
-
getMinWithdrawalAmount:
|
|
679
|
+
getMinWithdrawalAmount: (symbol) => {
|
|
680
|
+
const userMin = config.getSecureMinWithdrawalAmount?.(symbol);
|
|
681
|
+
if (userMin !== void 0) {
|
|
682
|
+
return userMin;
|
|
683
|
+
}
|
|
684
|
+
return LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS[symbol.toUpperCase()] ?? 0;
|
|
685
|
+
}
|
|
598
686
|
});
|
|
599
687
|
const fast = {
|
|
600
688
|
id: "lighter-fast",
|
|
@@ -612,7 +700,12 @@ function buildLighterMultiMethodConfig({
|
|
|
612
700
|
const secure = {
|
|
613
701
|
id: "lighter-secure",
|
|
614
702
|
keyText: t("withdrawal.methodSecure"),
|
|
615
|
-
subtitleText: t("withdrawal.secureDisclaimer"
|
|
703
|
+
subtitleText: t("withdrawal.secureDisclaimer", {
|
|
704
|
+
// Until the live value loads, show the localized "60+ minutes"
|
|
705
|
+
// historical estimate. The "+" lives in the per-locale fallback string
|
|
706
|
+
// so it doesn't bleed into live values, which are exact.
|
|
707
|
+
delay: secureDelayText ?? t("withdrawal.secureFallbackDelay")
|
|
708
|
+
}),
|
|
616
709
|
icon: /* @__PURE__ */ React2.createElement(EvmWallet, { size: 20 }),
|
|
617
710
|
valueIcon: /* @__PURE__ */ React2.createElement(ChainIconStack, { chainIds: LIGHTER_SECURE_PREVIEW_CHAIN_IDS }),
|
|
618
711
|
config: withBalance ? {
|
|
@@ -630,27 +723,30 @@ function buildLighterMultiMethodConfig({
|
|
|
630
723
|
}
|
|
631
724
|
function useLighterWithdrawalConfig(config) {
|
|
632
725
|
const { t } = useFunkitTranslation();
|
|
726
|
+
const { mainAccountIndex } = useLighterAccounts({
|
|
727
|
+
address: config?.l1Address
|
|
728
|
+
});
|
|
729
|
+
const accountIndex = mainAccountIndex && /^\d+$/.test(mainAccountIndex) ? mainAccountIndex : void 0;
|
|
633
730
|
const { balances } = useLighterWithdrawalBalances({
|
|
634
|
-
accountIndex
|
|
731
|
+
accountIndex
|
|
635
732
|
});
|
|
636
|
-
|
|
637
|
-
|
|
733
|
+
const secureDelayText = useLighterSecureDelayText();
|
|
734
|
+
return useMemo2(() => {
|
|
735
|
+
if (!config || !accountIndex) {
|
|
736
|
+
return null;
|
|
737
|
+
}
|
|
738
|
+
return buildLighterMultiMethodConfig({
|
|
638
739
|
config,
|
|
740
|
+
accountIndex,
|
|
639
741
|
t,
|
|
640
|
-
withBalance: (symbol) => () => balances[symbol.toUpperCase()] ?? "0"
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
);
|
|
644
|
-
}
|
|
645
|
-
function createLighterWithdrawalConfig(config) {
|
|
646
|
-
return buildLighterMultiMethodConfig({
|
|
647
|
-
config,
|
|
648
|
-
t: i18next.t.bind(i18next)
|
|
649
|
-
});
|
|
742
|
+
withBalance: (symbol) => () => balances[symbol.toUpperCase()] ?? "0",
|
|
743
|
+
secureDelayText
|
|
744
|
+
});
|
|
745
|
+
}, [config, accountIndex, balances, t, secureDelayText]);
|
|
650
746
|
}
|
|
651
747
|
export {
|
|
748
|
+
LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS,
|
|
652
749
|
createLighterSecureWithdrawalConfig,
|
|
653
|
-
createLighterWithdrawalConfig,
|
|
654
750
|
freeBalance,
|
|
655
751
|
useLighterWithdrawalBalances,
|
|
656
752
|
useLighterWithdrawalConfig
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ApprovalMethod } from '../../providers/FunkitQuoteContext';
|
|
3
|
+
interface ApprovalMethodToggleProps {
|
|
4
|
+
value: ApprovalMethod;
|
|
5
|
+
onChange: (next: ApprovalMethod) => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
testId?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A small dropdown selector for the user's preferred source-side
|
|
11
|
+
* authorization method ("Approve transaction" vs "Signed message").
|
|
12
|
+
*
|
|
13
|
+
* Pure presentation: state lives in `useApprovalMethodSelection`. The
|
|
14
|
+
* component is screen-agnostic so it can be mounted on either
|
|
15
|
+
* `ConfirmationStep` (non-native flow) or `InputAmount` (native flow,
|
|
16
|
+
* future) without changes.
|
|
17
|
+
*/
|
|
18
|
+
export declare function ApprovalMethodToggle({ value, onChange, disabled, testId, }: ApprovalMethodToggleProps): React.JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -14,9 +14,10 @@ export interface BaseActiveDropdownItemProps {
|
|
|
14
14
|
color?: BoxProps['color'];
|
|
15
15
|
arrowColor?: BoxProps['color'];
|
|
16
16
|
background?: BoxProps['background'];
|
|
17
|
+
labelStyle?: React.CSSProperties;
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* Represents the component used to open the dropdown, usually displayed all the time.
|
|
20
21
|
*/
|
|
21
|
-
declare function BaseActiveDropdownItem({ iconComponent, label, isOpened, onClick, horizontalIconGap, alwaysVisibleLabel, tagComponent, tagPosition, size, color, arrowColor, background, }: BaseActiveDropdownItemProps): React.JSX.Element;
|
|
22
|
+
declare function BaseActiveDropdownItem({ iconComponent, label, isOpened, onClick, horizontalIconGap, alwaysVisibleLabel, tagComponent, tagPosition, size, color, arrowColor, background, labelStyle, }: BaseActiveDropdownItemProps): React.JSX.Element;
|
|
22
23
|
export default BaseActiveDropdownItem;
|
|
@@ -11,7 +11,7 @@ export declare const HORIZONTAL_ICON_GAP = "4";
|
|
|
11
11
|
export declare const HORIZONTAL_OUTER_PADDING_X = "12";
|
|
12
12
|
export interface BaseDropdownProps<T = string, G extends string = never> {
|
|
13
13
|
value: string;
|
|
14
|
-
activeItemProps?: Partial<Pick<BaseActiveDropdownItemProps, 'iconComponent' | 'label' | 'color' | 'alwaysVisibleLabel' | 'tagComponent' | 'tagPosition' | 'background'>>;
|
|
14
|
+
activeItemProps?: Partial<Pick<BaseActiveDropdownItemProps, 'iconComponent' | 'label' | 'color' | 'alwaysVisibleLabel' | 'tagComponent' | 'tagPosition' | 'background' | 'labelStyle'>>;
|
|
15
15
|
/**
|
|
16
16
|
* List of groups to show and the corresponding labels, in the expected order.
|
|
17
17
|
*
|
|
@@ -65,7 +65,9 @@ export interface BaseDropdownProps<T = string, G extends string = never> {
|
|
|
65
65
|
* This values should be set so that the last dropdown item is partially visible to indicate that there are more options.
|
|
66
66
|
*/
|
|
67
67
|
maxDropdownHeight?: number;
|
|
68
|
+
dropdownWidth?: number;
|
|
69
|
+
dropdownAlign?: 'start' | 'center' | 'end';
|
|
68
70
|
testId?: string;
|
|
69
71
|
}
|
|
70
|
-
declare function BaseDropdown<T extends string = string, G extends string = never>({ activeItemProps, value, options, groups, additionalGroup, additionalGroupLabel, allowUnselect, unselectLabel, onOptionSelected, onOpen, renderDropdownOption, searchableOptions, searchPlaceholder, placeholder, resetSearchOnClose, openToTopOnMobile, alwaysOpenToTop, openDropdownFullWidth, isLoading, preloadIconUrls, horizontalIconGap, openDropdownBackgroundColor, size, label, maxDropdownHeight, testId, }: BaseDropdownProps<T, G>): React.JSX.Element;
|
|
72
|
+
declare function BaseDropdown<T extends string = string, G extends string = never>({ activeItemProps, value, options, groups, additionalGroup, additionalGroupLabel, allowUnselect, unselectLabel, onOptionSelected, onOpen, renderDropdownOption, searchableOptions, searchPlaceholder, placeholder, resetSearchOnClose, openToTopOnMobile, alwaysOpenToTop, openDropdownFullWidth, isLoading, preloadIconUrls, horizontalIconGap, openDropdownBackgroundColor, size, label, maxDropdownHeight, dropdownWidth, dropdownAlign, testId, }: BaseDropdownProps<T, G>): React.JSX.Element;
|
|
71
73
|
export default BaseDropdown;
|
package/dist/domains/quote.d.ts
CHANGED
|
@@ -13,7 +13,15 @@ export interface FunkitCheckoutQuoteResult extends Omit<ApiFunkitCheckoutQuoteRe
|
|
|
13
13
|
finalSpreadUsd: string;
|
|
14
14
|
finalFeesBreakdown: CheckoutFees;
|
|
15
15
|
}
|
|
16
|
-
export declare function getCheckoutBaseQuote(checkoutItem: FunkitActiveCheckoutItem, userId: string, walletAddress: Address, apiKey: string, wagmiConfig: Config, directExecutionInfo: FunkitDirectExecutionInfo, senderAddress?: Address, isWithdrawal?: boolean, quoteBuilder?: QuoteBuilder
|
|
16
|
+
export declare function getCheckoutBaseQuote(checkoutItem: FunkitActiveCheckoutItem, userId: string, walletAddress: Address, apiKey: string, wagmiConfig: Config, directExecutionInfo: FunkitDirectExecutionInfo, senderAddress?: Address, isWithdrawal?: boolean, quoteBuilder?: QuoteBuilder,
|
|
17
|
+
/**
|
|
18
|
+
* User-driven preference for the source-side authorization step. Forwarded
|
|
19
|
+
* to the direct-execution branch (`getDirectExecutionQuote` →
|
|
20
|
+
* `getCheckoutQuoteV2`) where Relay's `usePermit` flag actually flows. The
|
|
21
|
+
* legacy `getApiCheckoutQuote` branch ignores this; the permit toggle is
|
|
22
|
+
* scoped to Wallet (Relay direct-execution) only.
|
|
23
|
+
*/
|
|
24
|
+
usePermit?: boolean): Promise<CheckoutQuoteResponse>;
|
|
17
25
|
export declare function getQuoteFinalEstimation(baseQuote: CheckoutQuoteResponse, checkoutItem: FunkitActiveCheckoutItem, newPaymentMethodInfo: PaymentMethodInfo, wagmiConfig: Config, apiKey: string, loginType: LoginType, isWithdrawal?: boolean, brokerageQuote?: BluvoBrokerageQuote): Promise<{
|
|
18
26
|
finalEstimation: FunkitCheckoutQuoteResult;
|
|
19
27
|
brokerage?: BrokerageDetails;
|
|
@@ -15,6 +15,13 @@ interface DirectExecutionQuoteRequestParamsBase {
|
|
|
15
15
|
toTokenAddress: Address;
|
|
16
16
|
recipientAddress: Address;
|
|
17
17
|
senderAddress?: Address;
|
|
18
|
+
/**
|
|
19
|
+
* Explicit permit preference for the source-side authorization step.
|
|
20
|
+
* Forwarded as `usePermit` on the v2 quote request body. When defined,
|
|
21
|
+
* takes priority over the legacy auto-gasless-fallback (see frog's
|
|
22
|
+
* getUsePermit for the full resolution order).
|
|
23
|
+
*/
|
|
24
|
+
usePermit?: boolean;
|
|
18
25
|
}
|
|
19
26
|
interface RegularDEQuoteRequest extends DirectExecutionQuoteRequestParamsBase {
|
|
20
27
|
toTokenAmount: number;
|