@funkit/connect 12.22.1 → 12.24.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/clients/{chunk-HGLDKRSQ.js → chunk-35XAIUH6.js} +80 -0
  3. package/dist/clients/{chunk-Y2O77SJO.js → chunk-55LEL7SW.js} +1 -1
  4. package/dist/clients/{chunk-S4SMCBQ4.js → chunk-ENWRWMKF.js} +7 -3
  5. package/dist/clients/{chunk-5JVG4MS2.js → chunk-GQINBV24.js} +1 -1
  6. package/dist/clients/{chunk-UBZOARBX.js → chunk-JBJ5FEIA.js} +2 -2
  7. package/dist/clients/{chunk-R7I5OO6C.js → chunk-QS3S2PXZ.js} +1 -1
  8. package/dist/clients/{chunk-T4Q43DNC.js → chunk-QYUAS6KD.js} +1 -1
  9. package/dist/clients/fanatics.js +2 -2
  10. package/dist/clients/internal/nado/withdrawalCallback.js +3 -3
  11. package/dist/clients/internal/nado/withdrawalErrors.js +2 -2
  12. package/dist/clients/internal/nado/withdrawalForm.js +5 -5
  13. package/dist/clients/internal/nado/withdrawalStatus.js +3 -3
  14. package/dist/clients/lighter.js +5 -5
  15. package/dist/clients/mallard.js +4 -4
  16. package/dist/clients/nado.js +3 -3
  17. package/dist/clients/polymarket/createPolymarketDepositConfig.js +2 -2
  18. package/dist/clients/polymarket/index.js +2 -2
  19. package/dist/clients/polymarket/polymarket.d.ts +29 -2
  20. package/dist/clients/polymarket/polymarket.js +1 -1
  21. package/dist/components/Dropdown/BaseDropdown.d.ts +3 -1
  22. package/dist/components/Dropdown/BaseDropdownItem.d.ts +3 -1
  23. package/dist/components/Dropdown/TokenAndChainDropdown.d.ts +6 -1
  24. package/dist/components/Icons/AlertCircleIcon.d.ts +4 -0
  25. package/dist/domains/withdrawalAllowlist.d.ts +55 -0
  26. package/dist/domains/withdrawalChunking.d.ts +11 -0
  27. package/dist/hooks/queries/useWithdrawalRisk.d.ts +3 -1
  28. package/dist/hooks/useCheckoutDirectExecution.d.ts +2 -1
  29. package/dist/hooks/useEnforcedAllowedRecipients.d.ts +11 -0
  30. package/dist/hooks/useIsBlacklistedWithdrawalAddress.d.ts +2 -0
  31. package/dist/hooks/useIsCashWithdrawalEnabled.d.ts +8 -0
  32. package/dist/hooks/useIsChunkedWithdrawal.d.ts +6 -0
  33. package/dist/index.css +103 -103
  34. package/dist/index.d.ts +2 -1
  35. package/dist/index.js +4627 -3841
  36. package/dist/modals/WithdrawalModal/AllowedRecipientDropdown.d.ts +18 -0
  37. package/dist/modals/WithdrawalModal/ChunkedWithdrawalNotice.d.ts +2 -0
  38. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +1 -0
  39. package/dist/modals/WithdrawalModal/LockedReceiveDisplay.d.ts +9 -0
  40. package/dist/modals/WithdrawalModal/useWithdrawal.d.ts +4 -1
  41. package/dist/modals/WithdrawalModal/useWithdrawalRecipientAllowlist.d.ts +44 -0
  42. package/dist/modals/WithdrawalModal/withdrawalFormHelpers.d.ts +3 -1
  43. package/dist/providers/FunkitCheckoutContext/index.d.ts +2 -2
  44. package/dist/shadow-css.js +1 -1
  45. package/dist/wallets/Wallet.d.ts +16 -1
  46. package/dist/wallets/walletConnectors/index.js +43 -43
  47. package/package.json +4 -4
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { type AllowedRecipientOption } from '../../domains/withdrawalAllowlist';
3
+ export interface AllowedRecipientDropdownProps {
4
+ /** Build with `toAllowedRecipientOptions`; order is kept. */
5
+ options: readonly AllowedRecipientOption[];
6
+ /** The option to show, which may be blocked. The parent owns that rule. */
7
+ selectedOption: AllowedRecipientOption | undefined;
8
+ onSelect: (option: AllowedRecipientOption) => void;
9
+ /** Opens the integrator's allowlist settings. Without it, Manage and Add are hidden. */
10
+ onManageClick?: () => void;
11
+ testId?: string;
12
+ }
13
+ /**
14
+ * Recipient picker for withdrawals limited to an allowlist. Blocked addresses
15
+ * stay listed but can't be picked; with none usable, the closed field shows
16
+ * the first one and a notice asks for another address.
17
+ */
18
+ export declare function AllowedRecipientDropdown({ options, selectedOption, onSelect, onManageClick, testId, }: AllowedRecipientDropdownProps): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const ChunkedWithdrawalNotice: () => React.JSX.Element;
@@ -92,6 +92,7 @@ export declare function resolveLighterWithdrawalInstance(sourceChainId: string):
92
92
  export declare function useLighterWithdrawal(config: FunkitWithdrawalConfig, setRecipientAddress: (addr: string) => void, selectedSourceToken: string): {
93
93
  lighterChainId: 3586256 | 548123634 | undefined;
94
94
  isLighterSecure: boolean;
95
+ skipsRecipientScreening: boolean;
95
96
  isLighterFast: boolean;
96
97
  isUnifiedTradingMode: boolean;
97
98
  connectedAddress: `0x${string}` | undefined;
@@ -7,6 +7,15 @@ type LockedReceiveDisplayProps = {
7
7
  tokenTooltip?: string;
8
8
  chainTooltip?: string;
9
9
  };
10
+ /**
11
+ * The receive chain, read-only, with a tooltip saying why it can't change.
12
+ * It sits beside the token dropdown, so it takes the dropdown's sizes.
13
+ */
14
+ export declare const LockedReceiveChain: (props: {
15
+ chainId: number;
16
+ tooltip: string;
17
+ testId?: string;
18
+ }) => React.JSX.Element;
10
19
  /**
11
20
  * The "Receive token" / "Receive chain" pair, rendered read-only. Drops in where
12
21
  * `TokenAndChainDropdown` would go when the flow fixes both. Tooltips default
@@ -1,5 +1,6 @@
1
1
  import type { Hex } from 'viem';
2
2
  import { type CheckoutConfirmationError } from '../../domains/checkoutErrors';
3
+ import { type AllowedRecipient } from '../../domains/withdrawalAllowlist';
3
4
  import { type FunkitActiveWithdrawalItem, type FunkitWithdrawalConfig, type WithdrawalFormData } from '../../providers/FunkitCheckoutContext';
4
5
  interface UseWithdrawalResult {
5
6
  handleWithdrawal: (withdrawal: WithdrawalFormData) => Promise<Hex | null>;
@@ -8,8 +9,10 @@ interface UseWithdrawalResult {
8
9
  stepMessage: string | null;
9
10
  }
10
11
  export type { WithdrawalFormData };
11
- export declare function useWithdrawal({ config, withdrawalItem, onSuccess, }: {
12
+ export declare function useWithdrawal({ config, withdrawalItem, onSuccess, allowedRecipients, }: {
12
13
  config: FunkitWithdrawalConfig;
13
14
  withdrawalItem: FunkitActiveWithdrawalItem | null;
14
15
  onSuccess?: (withdrawal: WithdrawalFormData, txHash: Hex) => void;
16
+ /** When set, a destination missing from it is refused before anything is signed. */
17
+ allowedRecipients?: readonly AllowedRecipient[];
15
18
  }): UseWithdrawalResult;
@@ -0,0 +1,44 @@
1
+ import { type AllowedRecipientListState, type AllowedRecipientOption } from '../../domains/withdrawalAllowlist';
2
+ import type { TokenTransferSourceChainsAndAssets } from '../../modals/CheckoutModal/TransferToken/TransferToken';
3
+ import { type SingleWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
4
+ /** The recipient picker's rows and the row the checkout item pays. */
5
+ export interface WithdrawalRecipientAllowlist {
6
+ options: AllowedRecipientOption[];
7
+ listState: AllowedRecipientListState;
8
+ /** The row for the item's `customRecipient` on the receive chain. */
9
+ selected: AllowedRecipientOption | undefined;
10
+ /** Sends to `recipient`: its address to the item, its chain to the dropdown. */
11
+ pick: (recipient: AllowedRecipientOption) => void;
12
+ }
13
+ /**
14
+ * The form a pick keeps in step with the item: the receive chain dropdown,
15
+ * moved to the address's chain, and the typed address field, which shows the
16
+ * address if the list goes away.
17
+ */
18
+ interface WithdrawalForm {
19
+ /** The receive tokens by chain, once loaded. A listed address on a chain with none is dropped. */
20
+ receiveAssets: TokenTransferSourceChainsAndAssets | undefined;
21
+ chainId: number | undefined;
22
+ handleChainChange: (chainId: number, autoUpdate: boolean) => unknown;
23
+ setTypedRecipientAddress: (address: string) => void;
24
+ }
25
+ /**
26
+ * The enforced allowlist and its picker. The pick lives only in the checkout
27
+ * item's `customRecipient`, which the quote pays, so the form can't show one
28
+ * address and pay another. `allowlist` is undefined with the gate off or
29
+ * without a list.
30
+ */
31
+ export declare function useWithdrawalRecipientAllowlist(config: SingleWithdrawalConfig, { receiveAssets, chainId, handleChainChange, setTypedRecipientAddress, }: WithdrawalForm): {
32
+ allowedRecipients: readonly import("../../domains/withdrawalAllowlist").AllowedRecipient[] | undefined;
33
+ allowlist: WithdrawalRecipientAllowlist | undefined;
34
+ };
35
+ /**
36
+ * Writes the first usable listed address to the item on open, unless it
37
+ * already holds one. Like main's connected-wallet prefill, it runs until the
38
+ * form shows a usable listed address, then stops, so a pick that later
39
+ * becomes blocked stays.
40
+ */
41
+ export declare function useAutoSelectAllowedRecipient(allowlist: WithdrawalRecipientAllowlist | undefined,
42
+ /** Whether a pick may write the item now. */
43
+ canPick: boolean): void;
44
+ export {};
@@ -19,8 +19,10 @@ export interface SelectedTargetAsset {
19
19
  export declare function resolveTargetAsset(sourceTokenOption: SourceTokenOption | undefined, selectedTargetAsset: SelectedTargetAsset): SelectedTargetAsset & {
20
20
  isLocked: boolean;
21
21
  };
22
- export declare function getWithdrawButtonText({ isWithdrawing, isValidAddress, isRecipientBlacklisted, isRecipientSameAsSource, withdrawalInputAmount, isWithdrawAmountValid, isWithdrawAmountTooHigh, isValidAddressAndChain, selectedToken, selectedChainId, selectedChainName, t, }: {
22
+ export declare function getWithdrawButtonText({ isWithdrawing, hasNoUsableRecipient, isValidAddress, isRecipientBlacklisted, isRecipientSameAsSource, withdrawalInputAmount, isWithdrawAmountValid, isWithdrawAmountTooHigh, isValidAddressAndChain, selectedToken, selectedChainId, selectedChainName, t, }: {
23
23
  isWithdrawing: boolean;
24
+ /** The allowlist has no address to pick, so there's no recipient field. */
25
+ hasNoUsableRecipient: boolean;
24
26
  isValidAddress: boolean;
25
27
  isRecipientBlacklisted: boolean;
26
28
  isRecipientSameAsSource: boolean;
@@ -4,7 +4,7 @@ import type { Address, Hex } from 'viem';
4
4
  import { type ApplyDynamicRoutingPath } from '../../domains/dynamicRouting';
5
5
  import { type PaymentMethodInfo } from '../../domains/paymentMethods';
6
6
  import type { AssetHoldingsItem } from '../../utils/assets';
7
- import type { WithdrawalClient, WithdrawalTransaction } from '../../wallets/Wallet';
7
+ import type { WithdrawalClient, WithdrawalSignContext, WithdrawalTransaction } from '../../wallets/Wallet';
8
8
  import { type FunkitCheckoutQuoteResult } from '../FunkitHistoryContext';
9
9
  import type { DynamicTargetAssetCandidate, FunkitActiveCheckoutItem, FunkitActiveWithdrawalItem, FunkitCheckoutConfig, FunkitWithdrawalConfig, MultiSourceWithdrawalConfig, PolymarketPerpsTransferPending, SingleWithdrawalConfig, UseFunkitCheckoutProps, UseFunkitCheckoutPropsWithFullConfig } from './types';
10
10
  export * from './types';
@@ -27,7 +27,7 @@ interface FunkitCheckoutContextInterface {
27
27
  }): void;
28
28
  updateSelectedPaymentMethodInfo(newPaymentMethodInfo: PaymentMethodInfo): void;
29
29
  updateCustomRecipient: (recipient: Address) => void;
30
- confirmCheckout(quote: FunkitCheckoutQuoteResult, stepMessageSetter: (m: string) => void, withdrawalClient?: WithdrawalClient, preWithdrawalTxs?: WithdrawalTransaction[]): Promise<CheckoutConfirmationResult>;
30
+ confirmCheckout(quote: FunkitCheckoutQuoteResult, stepMessageSetter: (m: string) => void, withdrawalClient?: WithdrawalClient, preWithdrawalTxs?: WithdrawalTransaction[], withdrawalSignContext?: WithdrawalSignContext): Promise<CheckoutConfirmationResult>;
31
31
  cancelCheckout(depositAddress: Address): Promise<boolean>;
32
32
  /**
33
33
  * Partial-update the active checkout item. Exposed for direct-execution