@funkit/connect 9.22.0 → 9.23.1

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 (57) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/clients/{chunk-KSSSSWR6.js → chunk-2LMREKV6.js} +1 -1
  3. package/dist/clients/{chunk-NCCAYPLO.js → chunk-4M57JDJK.js} +1 -1
  4. package/dist/clients/{chunk-ZMVXBMON.js → chunk-GCIUIPM7.js} +1 -1
  5. package/dist/clients/{chunk-OWXKWC7I.js → chunk-H3CKQIYI.js} +10 -10
  6. package/dist/clients/{chunk-4752IYY6.js → chunk-KWIR3HO4.js} +1 -1
  7. package/dist/clients/fanatics.css +2 -2
  8. package/dist/clients/fanatics.js +3 -3
  9. package/dist/clients/lighter.css +2 -2
  10. package/dist/clients/lighter.js +5 -3
  11. package/dist/clients/mallard.d.ts +49 -0
  12. package/dist/clients/mallard.js +86 -0
  13. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +91 -91
  14. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +6 -6
  15. package/dist/clients/polymarket/createPolymarketDepositConfig.js +2 -2
  16. package/dist/clients/polymarket/index.css +91 -91
  17. package/dist/clients/polymarket/index.js +6 -6
  18. package/dist/clients/polymarket/polymarket.js +1 -1
  19. package/dist/clients/rolly.js +1 -14
  20. package/dist/components/Box/Box.d.ts +21 -21
  21. package/dist/components/Icons/New/ArrowCircleUpRightIcon.d.ts +4 -0
  22. package/dist/consts/customers.d.ts +2 -0
  23. package/dist/css/sprinkles.css.d.ts +21 -21
  24. package/dist/domains/asset.d.ts +2 -2
  25. package/dist/domains/clientMetadata.d.ts +6 -1
  26. package/dist/domains/swapped.d.ts +10 -1
  27. package/dist/hooks/queries/useRecentCheckouts.d.ts +4 -2
  28. package/dist/hooks/queries/useRecentDeposits.d.ts +4 -9
  29. package/dist/hooks/track/CheckoutModalEvent.d.ts +1 -0
  30. package/dist/hooks/useEffectEvent.d.ts +1 -3
  31. package/dist/hooks/usePaymentMethodTabs.d.ts +5 -0
  32. package/dist/hooks/usePaymentSources.d.ts +1 -1
  33. package/dist/hooks/useTokenTransferConfig.d.ts +7 -0
  34. package/dist/index.css +32 -32
  35. package/dist/index.js +1412 -1465
  36. package/dist/interfaces/identity.d.ts +7 -0
  37. package/dist/modals/CheckoutModal/FunCheckoutStep.d.ts +3 -1
  38. package/dist/modals/CheckoutModal/SelectAsset/SelectAsset.d.ts +1 -1
  39. package/dist/modals/CheckoutModal/SourceChange/CryptoCashToggle.d.ts +2 -2
  40. package/dist/modals/CheckoutModal/Withdrawal/WithdrawalComplete.d.ts +14 -0
  41. package/dist/modals/CheckoutModal/Withdrawal/WithdrawalEnterAmount.d.ts +15 -0
  42. package/dist/modals/CheckoutModal/stepTransition.d.ts +6 -0
  43. package/dist/modals/CheckoutModal/stepTransition.track.d.ts +1 -1
  44. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +31 -0
  45. package/dist/providers/FunkitCheckoutContext/types.d.ts +2 -28
  46. package/dist/providers/FunkitConfigContext.d.ts +2 -0
  47. package/dist/providers/SwappedProvider.d.ts +2 -2
  48. package/dist/utils/checkout.d.ts +2 -20
  49. package/dist/utils/customer.d.ts +13 -1
  50. package/dist/utils/tokenTransfer/disabledList.d.ts +1 -14
  51. package/dist/utils/tokenTransfer/types.d.ts +5 -30
  52. package/dist/wallets/walletConnectors/index.js +12 -12
  53. package/package.json +4 -4
  54. package/dist/clients/nado.d.ts +0 -78
  55. package/dist/clients/nado.js +0 -107
  56. /package/dist/clients/{chunk-52NKHZS2.js → chunk-OG254LB3.js} +0 -0
  57. /package/dist/clients/{chunk-MOUTRRN3.js → chunk-S7FRYR55.js} +0 -0
@@ -30,6 +30,13 @@ export interface FunkitIdentity {
30
30
  walletAddress: Address | '';
31
31
  /** How the user authenticated (guest vs web3). */
32
32
  loginType: LoginType;
33
+ /**
34
+ * Email the integrator supplies to prefill the Swapped fiat ramp iframe, when
35
+ * present. Like `externalUserId`, it's set by the integrator but describes the
36
+ * end user, so it belongs on the identity seam rather than being read from
37
+ * `useFunkitConfig` directly by core hooks.
38
+ */
39
+ prefillFiatEmail?: string;
33
40
  }
34
41
  /**
35
42
  * Contract a platform implements to feed identity into core. Each platform
@@ -22,5 +22,7 @@ export declare enum FunCheckoutStep {
22
22
  BROKERAGE_TWO_FA = "brokerage_two_fa",
23
23
  BROKERAGE_SUCCESS = "brokerage_success",
24
24
  SWAPPED_IFRAME = "swapped_iframe",
25
- PERPS_TRANSFER = "perps_transfer"
25
+ PERPS_TRANSFER = "perps_transfer",
26
+ WITHDRAWAL_ENTER_AMOUNT = "withdrawal_enter_amount",
27
+ WITHDRAWAL_COMPLETE = "withdrawal_complete"
26
28
  }
@@ -15,4 +15,4 @@ export type SelectAssetNext = {
15
15
  };
16
16
  export declare const SelectAssetInfo: ModalStepInfo<FunCheckoutStep.SELECT_ASSET>;
17
17
  export declare function SelectAsset({ modalState, onNext, onClose, }: ModalStepComponentProps<FunCheckoutStep.SELECT_ASSET>): React.JSX.Element;
18
- export declare function isTreatedAsNativeToken(apiKey: string, asset: AssetHoldingsItem, dynamicTargetAssetCandidates: DynamicTargetAssetCandidate[], findDynamicPath: IndexedDynamicRoutingConfig[string]['findPath']): boolean;
18
+ export declare function isTreatedAsNativeToken(apiKey: string, asset: AssetHoldingsItem, dynamicTargetAssetCandidates: DynamicTargetAssetCandidate[], findDynamicPath: IndexedDynamicRoutingConfig[string]['findPath'], isUserSelected: boolean): boolean;
@@ -3,12 +3,12 @@ import { type BoxProps } from '../../../components/Box/Box';
3
3
  import type { PaymentMethodType } from '../../../hooks/usePaymentSources';
4
4
  interface CryptoCashToggleProps {
5
5
  activeTab: PaymentMethodType;
6
- defaultTab?: PaymentMethodType;
7
6
  disabled?: boolean;
8
7
  onTabChange: (tab: PaymentMethodType) => void;
9
8
  marginTop?: BoxProps['marginTop'];
10
9
  marginBottom?: BoxProps['marginBottom'];
11
10
  style?: React.CSSProperties;
11
+ tabs: PaymentMethodType[];
12
12
  }
13
- export declare const CryptoCashToggle: ({ activeTab, defaultTab, disabled, onTabChange, marginTop, marginBottom, style, }: CryptoCashToggleProps) => React.JSX.Element;
13
+ export declare const CryptoCashToggle: ({ activeTab, disabled, onTabChange, marginTop, marginBottom, style, tabs: tabTypes, }: CryptoCashToggleProps) => React.JSX.Element;
14
14
  export {};
@@ -0,0 +1,14 @@
1
+ import type { Hex } from 'viem';
2
+ import type { FunkitCheckoutQuoteResult } from '../../../domains/quote';
3
+ import type { CustomWithdrawalConfig, WalletWithdrawalConfig } from '../../../providers/FunkitCheckoutContext';
4
+ import { type CheckoutModalCommonState, FunCheckoutStep, type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
5
+ export type WithdrawalCompleteState = CheckoutModalCommonState & {
6
+ withdrawalConfig: WalletWithdrawalConfig | CustomWithdrawalConfig;
7
+ hash: Hex;
8
+ withdrawnAmount: string;
9
+ tokenSymbol: string;
10
+ quote?: FunkitCheckoutQuoteResult;
11
+ };
12
+ export type WithdrawalCompleteNext = Record<never, never>;
13
+ export declare const WithdrawalCompleteInfo: ModalStepInfo<FunCheckoutStep.WITHDRAWAL_COMPLETE>;
14
+ export declare function WithdrawalComplete(_props: ModalStepComponentProps<FunCheckoutStep.WITHDRAWAL_COMPLETE>): null;
@@ -0,0 +1,15 @@
1
+ import type { Hex } from 'viem';
2
+ import type { FunkitCheckoutQuoteResult } from '../../../domains/quote';
3
+ import type { CustomWithdrawalConfig, WalletWithdrawalConfig } from '../../../providers/FunkitCheckoutContext';
4
+ import { type CheckoutModalCommonState, FunCheckoutStep, type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
5
+ export type WithdrawalEnterAmountState = CheckoutModalCommonState & {
6
+ withdrawalConfig: WalletWithdrawalConfig | CustomWithdrawalConfig;
7
+ };
8
+ export type WithdrawalEnterAmountNext = {
9
+ hash: Hex;
10
+ withdrawnAmount: string;
11
+ tokenSymbol: string;
12
+ quote?: FunkitCheckoutQuoteResult;
13
+ };
14
+ export declare const WithdrawalEnterAmountInfo: ModalStepInfo<FunCheckoutStep.WITHDRAWAL_ENTER_AMOUNT>;
15
+ export declare function WithdrawalEnterAmount(_props: ModalStepComponentProps<FunCheckoutStep.WITHDRAWAL_ENTER_AMOUNT>): null;
@@ -26,6 +26,8 @@ import { type SwappedIframeNext, type SwappedIframeState } from './SwappedIframe
26
26
  import { type TransferTokenNext, type TransferTokenState } from './TransferToken/TransferToken';
27
27
  import { type FiatAccountDetailNext, type FiatAccountDetailState } from './VirtualFiatAccount/FiatAccountDetail';
28
28
  import { type KycIframeNext, type KycIframeState } from './VirtualFiatAccount/KycIframe';
29
+ import { type WithdrawalCompleteNext, type WithdrawalCompleteState } from './Withdrawal/WithdrawalComplete';
30
+ import { type WithdrawalEnterAmountNext, type WithdrawalEnterAmountState } from './Withdrawal/WithdrawalEnterAmount';
29
31
  export { FunCheckoutStep };
30
32
  export interface CheckoutModalCommonState {
31
33
  checkoutId: string;
@@ -123,6 +125,8 @@ export type CheckoutModalState<S extends FunCheckoutStep = FunCheckoutStep> = {
123
125
  [FunCheckoutStep.BROKERAGE_SUCCESS]: BrokerageSuccessState;
124
126
  [FunCheckoutStep.SWAPPED_IFRAME]: SwappedIframeState;
125
127
  [FunCheckoutStep.PERPS_TRANSFER]: PerpsTransferState;
128
+ [FunCheckoutStep.WITHDRAWAL_ENTER_AMOUNT]: WithdrawalEnterAmountState;
129
+ [FunCheckoutStep.WITHDRAWAL_COMPLETE]: WithdrawalCompleteState;
126
130
  }[T] & {
127
131
  step: T;
128
132
  previousStep?: FunCheckoutStep | null;
@@ -153,6 +157,8 @@ export type NextPayload<S extends FunCheckoutStep = FunCheckoutStep> = {
153
157
  [FunCheckoutStep.BROKERAGE_SUCCESS]: null;
154
158
  [FunCheckoutStep.SWAPPED_IFRAME]: SwappedIframeNext;
155
159
  [FunCheckoutStep.PERPS_TRANSFER]: PerpsTransferNext;
160
+ [FunCheckoutStep.WITHDRAWAL_ENTER_AMOUNT]: WithdrawalEnterAmountNext;
161
+ [FunCheckoutStep.WITHDRAWAL_COMPLETE]: WithdrawalCompleteNext;
156
162
  }[S] & {
157
163
  /** Whether screen transition should change direction to simulate back transition. Only applies if there is a history entry in the stack*/
158
164
  reverseAnimation?: boolean;
@@ -3,4 +3,4 @@ import type { TrackEventData } from '../../hooks/track/useTrack';
3
3
  import { FunCheckoutStep } from './FunCheckoutStep';
4
4
  import type { CheckoutModalState } from './stepTransition';
5
5
  export declare const CHECKOUT_STEP_TO_READY_EVENT: Partial<Record<FunCheckoutStep, CheckoutModalEvent>>;
6
- export declare const trackEventFromNextState: (nextState: CheckoutModalState<FunCheckoutStep>) => TrackEventData;
6
+ export declare const trackEventFromNextState: (nextState: CheckoutModalState<FunCheckoutStep>) => TrackEventData | null;
@@ -6,9 +6,37 @@
6
6
  import type { LighterAccountIndex } from '@funkit/api-base';
7
7
  import React from 'react';
8
8
  import type { CustomWithdrawalConfig, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
9
+ import type { LighterShare } from '../../utils/customer';
9
10
  import type { SourceTokenOption } from './WithdrawAmountInput';
10
11
  /** Free (withdrawable) balance for a single Lighter asset: balance - locked. */
11
12
  export declare function freeBalance(balance: string, lockedBalance: string): string;
13
+ /**
14
+ * Lighter Fast charges an "unstaked" fee — a flat deduction taken off the
15
+ * withdrawal amount before quoting — for users who aren't sufficiently staked
16
+ * in Lighter's staking pool. Sufficiently-staked users pay nothing.
17
+ *
18
+ * "Sufficiently staked" = the user holds a share in the staking pool with a
19
+ * principal above the threshold. The staking pool is identified by its index,
20
+ * hardcoded here (previously read from `systemConfig.staking_pool_index`) since
21
+ * it's currently the only public pool a withdrawing user holds a share in.
22
+ * Non-stakers report `shares: []`.
23
+ */
24
+ export declare const LIGHTER_STAKING_POOL_INDEX = 281474976624800;
25
+ export declare const LIGHTER_UNSTAKED_FEE_TOKENS = 3;
26
+ export declare const LIGHTER_STAKING_PRINCIPAL_THRESHOLD = 100;
27
+ /**
28
+ * Resolves the Lighter Fast unstaked fee (in source tokens, i.e. USDC) for a
29
+ * user. Returns 0 when the user's staking-pool principal exceeds the threshold,
30
+ * otherwise {@link LIGHTER_UNSTAKED_FEE_TOKENS}. A non-staker (`shares: []`,
31
+ * or no staking-pool share) pays the fee.
32
+ */
33
+ export declare function resolveLighterUnstakedFeeTokens(shares: LighterShare[]): number;
34
+ /**
35
+ * Deducts the Lighter Fast unstaked fee from a withdrawal input amount, clamped
36
+ * at 0. Uses `dnum` fixed-point math so the subtraction stays exact (e.g. the
37
+ * input is a decimal string straight from the amount field).
38
+ */
39
+ export declare function deductLighterUnstakedFee(inputAmount: string, feeTokens: number): string;
12
40
  /**
13
41
  * Fetches all asset balances for a Lighter account. Returns:
14
42
  *
@@ -20,6 +48,7 @@ export declare function useLighterWithdrawalBalances({ accountIndex, }: {
20
48
  }): {
21
49
  balances: Record<string, string>;
22
50
  assets: import("../../utils/customer").LighterAsset[];
51
+ shares: LighterShare[];
23
52
  isLoading: boolean;
24
53
  };
25
54
  type FunkitWithdrawalConfig = WalletWithdrawalConfig | CustomWithdrawalConfig;
@@ -50,9 +79,11 @@ export declare function buildLighterSourceTokenOptions(config: FunkitWithdrawalC
50
79
  */
51
80
  export declare function useLighterWithdrawal(config: FunkitWithdrawalConfig, setRecipientAddress: (addr: string) => void): {
52
81
  isLighterSecure: boolean;
82
+ isLighterFast: boolean;
53
83
  connectedAddress: `0x${string}` | undefined;
54
84
  lighterBalances: Record<string, string>;
55
85
  lighterAssets: import("../../utils/customer").LighterAsset[];
86
+ lighterFastUnstakedFee: number;
56
87
  };
57
88
  /**
58
89
  * Resolves the source-token dropdown options for a Lighter customer.
@@ -7,10 +7,8 @@ import type { CheckoutBlockedReason } from '../../modals/CheckoutModal/CheckoutB
7
7
  import type { WithdrawalClient, WithdrawalTransaction } from '../../wallets/Wallet';
8
8
  import type { FunkitCheckoutQuoteResult } from '../FunkitHistoryContext';
9
9
  export type FunkitCheckoutActionParams = ApiFunkitCheckoutActionParams;
10
- export interface TokenInfo {
11
- tokenAddress: Address;
12
- tokenChainId: string;
13
- }
10
+ import type { DynamicTargetAssetCandidate, TokenInfo } from '@funkit/connect-core';
11
+ export type { DynamicTargetAssetCandidate, TokenInfo, } from '@funkit/connect-core';
14
12
  /**
15
13
  * Argument passed to a dynamic {@link FunkitCheckoutConfig.modalTitle} resolver.
16
14
  * Extends {@link TokenInfo} with the active dynamic routing id so titles can be
@@ -21,30 +19,6 @@ export interface TokenInfo {
21
19
  export interface ModalTitleContext extends TokenInfo {
22
20
  dynamicRoutingId?: string;
23
21
  }
24
- export interface DynamicTargetAssetCandidate extends TokenInfo {
25
- iconSrc: string;
26
- tokenSymbol: string;
27
- isDefault?: boolean;
28
- badgeText?: string;
29
- targetAssetMinAmount?: number;
30
- /**
31
- * Exchange rate of the target asset in terms of the finalized token.
32
- * Represents how many finalized tokens one unit of the target asset can be exchanged for.
33
- *
34
- * Example: If `targetAsset`/`finalizedToken` is USDT/hbUSDT and the rate is 1.01,
35
- * 1 USDT can be exchanged for 1.01 hbUSDT.
36
- */
37
- finalizedTokenRate?: number;
38
- dynamicRoutingId?: string;
39
- /**
40
- * Recipient to point the checkout at when this candidate is selected. Set when
41
- * candidates represent destination *accounts* that share a target token but
42
- * differ by recipient (e.g. Polymarket Predictions vs Perps); selecting one
43
- * routes funds to its address. Omit for plain token candidates (the recipient
44
- * is unchanged).
45
- */
46
- customRecipient?: Address;
47
- }
48
22
  /**
49
23
  * A token to offer adding to the user's wallet (EIP-747 `wallet_watchAsset`) on
50
24
  * the post-checkout success screen.
@@ -263,6 +263,8 @@ export type FunkitConfig = {
263
263
  uiCustomizations?: FunkitUiCustomizationsConfig;
264
264
  /** used to link funkit users to your own user system */
265
265
  externalUserId?: string;
266
+ /** Email prefilled into the Swapped fiat onramp/offramp iframe. Set once at provider init. */
267
+ prefillFiatEmail?: string;
266
268
  /** Disable Datadog logging - defaults to false (logging enabled) */
267
269
  disableLogging?: boolean;
268
270
  };
@@ -1,5 +1,5 @@
1
- import { type FormOfPaymentType } from '@funkit/api-base';
2
- import type { SwappedTransport } from '@funkit/connect-core';
1
+ import type { FormOfPaymentType } from '@funkit/api-base';
2
+ import { type SwappedTransport } from '@funkit/connect-core';
3
3
  import React from 'react';
4
4
  import { type SwappedTheme } from '../utils/swapped';
5
5
  interface SwappedContextValue {
@@ -1,7 +1,7 @@
1
- import { type CheckoutHistoryItem, type CheckoutRefundState, CheckoutState, type DirectExecution } from '@funkit/api-base';
1
+ export { isCheckoutHistoryDirectExecution, isCheckoutValid, type MergedCheckoutHistoryItem, toMergedCheckoutHistoryItem, } from '@funkit/connect-core';
2
2
  import { type ApiFunkitCheckoutQuoteResult, type CheckoutQuoteResponse } from '@funkit/utils';
3
3
  import type { Dnum } from 'dnum';
4
- import { type Address, type Hex } from 'viem';
4
+ import { type Address } from 'viem';
5
5
  import type { ServerCheckoutConfig } from '../domains/clientMetadata';
6
6
  import type { FunkitCheckoutQuoteResult } from '../domains/quote';
7
7
  import type { Config, UseConfigReturnType } from '../wagmi/hooks';
@@ -101,23 +101,6 @@ export declare function isCheckoutCrFlow(config: FunkitCheckoutConfig): boolean;
101
101
  * @param config can be either be a config from live checkoutItem OR from checkout history's clientMetadata
102
102
  */
103
103
  export declare function isCheckoutPostActionRequired(config: FunkitCheckoutConfig | ServerCheckoutConfig): boolean;
104
- /**
105
- * @returns whether we should show the checkout to the user (ie. supported in current sdk version & not cancelled)
106
- */
107
- export declare const isCheckoutValid: (checkout: CheckoutHistoryItem | MergedCheckoutHistoryItem) => boolean;
108
- export declare const isCheckoutHistoryDirectExecution: (checkoutId: string) => boolean;
109
- export type MergedCheckoutHistoryItem = {
110
- directExecution: boolean;
111
- /** For direction execution this is the tx hash, for checkouts it is the deposit address */
112
- id: Hex;
113
- refundState?: CheckoutRefundState;
114
- state: CheckoutState;
115
- } & ((CheckoutHistoryItem & {
116
- directExecution: false;
117
- }) | (DirectExecution & {
118
- directExecution: true;
119
- }));
120
- export declare function toMergedCheckoutHistoryItem(item: CheckoutHistoryItem | DirectExecution): MergedCheckoutHistoryItem;
121
104
  export declare function isVaultDepositCheckout(checkoutConfig: FunkitCheckoutConfig, sourceHolding: {
122
105
  chainId: string;
123
106
  tokenAddress: string;
@@ -144,4 +127,3 @@ export declare function computeSwitcherDisplayToken({ checkoutConfig, displayAss
144
127
  amount: number;
145
128
  symbol: string;
146
129
  };
147
- export {};
@@ -25,6 +25,18 @@ export type LighterAsset = {
25
25
  balance: string;
26
26
  locked_balance: string;
27
27
  };
28
+ /**
29
+ * A user's stake in a Lighter public pool. The staking pool is identified by
30
+ * matching `public_pool_index` against the known staking pool index;
31
+ * `principal_amount` is the staked USDC principal (decimal string).
32
+ */
33
+ export type LighterShare = {
34
+ public_pool_index: number;
35
+ shares_amount: number;
36
+ entry_usdc: string;
37
+ principal_amount: string;
38
+ entry_timestamp: number;
39
+ };
28
40
  export type LighterAccount = {
29
41
  code: number;
30
42
  account_type: number;
@@ -50,7 +62,7 @@ export type LighterAccount = {
50
62
  assets: LighterAsset[];
51
63
  total_asset_value: string;
52
64
  cross_asset_value: string;
53
- shares: unknown[];
65
+ shares: LighterShare[];
54
66
  pending_unlocks: unknown[];
55
67
  };
56
68
  export type LighterAccountResponse = {
@@ -1,14 +1 @@
1
- /**
2
- * Keys are chainId strings. Values are arrays of token addresses,
3
- * or ["*"] to disable the entire chain.
4
- */
5
- export type DisabledChainsAndAssets = Record<string, string[]>;
6
- /** Returns true if an entire chain is disabled (has ["*"]). */
7
- export declare function isChainDisabled(disabledConfig: DisabledChainsAndAssets, chainId: number | string): boolean;
8
- /**
9
- * Returns true if a specific chain + asset combination is disabled.
10
- * - If the chain has ["*"], the entire chain (and all its assets) is disabled.
11
- * - If the chain has specific addresses, only those tokens are disabled.
12
- * - Address comparison is case-insensitive.
13
- */
14
- export declare function isAssetDisabled(disabledConfig: DisabledChainsAndAssets, chainId: number | string, tokenAddress: string): boolean;
1
+ export { type DisabledChainsAndAssets, isAssetDisabled, isChainDisabled, } from '@funkit/connect-core';
@@ -1,32 +1,7 @@
1
- import type { GetSupportedAssetsResponse, SupportedAssetInfo } from '@funkit/api-base';
2
- /** Raw asset entry from the Statsig tokentransferconfig */
3
- export interface TokenTransferAssetConfig {
4
- address: string;
5
- /** Show a "New" badge for this token. 'primary' promotes it as the highlighted new token. */
6
- showNewBadge?: 'primary' | true;
7
- }
8
- /** Resolved asset: API metadata merged with config-driven fields */
9
- export type ResolvedAssetInfo = SupportedAssetInfo & TokenTransferAssetConfig;
10
- /** Raw chain entry from the Statsig tokentransferconfig */
11
- export interface TokenTransferChainConfig {
12
- readonly chainId: number;
13
- readonly isDefault?: boolean;
14
- readonly assets: readonly TokenTransferAssetConfig[];
15
- }
16
- /** The full output of useTokenTransferConfig */
17
- export interface TokenTransferConfig {
18
- /** Supported assets filtered by config, keyed by [chainId][address] */
19
- supportedAssets: GetSupportedAssetsResponse;
20
- /** Backward-compatible Record<number, string[]> (chainId -> symbol[]) */
21
- symbolsByChainId: Record<number, string[]>;
22
- /** Chain IDs in config display order */
23
- chainIdSortOrder: number[];
24
- /** Default chain ID (from isDefault on chain entry) */
25
- defaultChainId: number | undefined;
26
- /** Token symbols to prioritize at the top of the dropdown */
27
- priorityTokenSymbols: string[];
28
- /** Token symbols that have a "New" badge. The 'primary' symbol is first. */
29
- newBadgeSymbols: Set<string>;
30
- /** True while /assets/supported is still loading */
1
+ import type { TokenTransferConfigResult } from '@funkit/connect-core';
2
+ export type { ResolvedAssetInfo, TokenTransferAssetConfig, TokenTransferChainConfig, TokenTransferConfigResult, } from '@funkit/connect-core';
3
+ /** The full output of useTokenTransferConfig: the resolved config + load state. */
4
+ export interface TokenTransferConfig extends TokenTransferConfigResult {
5
+ /** True while /assets/supported is still loading. */
31
6
  isLoading: boolean;
32
7
  }
@@ -23,15 +23,15 @@ import {
23
23
  import {
24
24
  uniswapWallet
25
25
  } from "./chunk-Z3PPW6NC.js";
26
- import {
27
- walletConnectWallet
28
- } from "./chunk-3FCWJRI4.js";
29
26
  import {
30
27
  xdefiWallet
31
28
  } from "./chunk-JN5I3DNC.js";
32
29
  import {
33
- rabbyWallet
34
- } from "./chunk-RB66PKPA.js";
30
+ walletConnectWallet
31
+ } from "./chunk-3FCWJRI4.js";
32
+ import {
33
+ phantomWallet
34
+ } from "./chunk-QY53O7WG.js";
35
35
  import {
36
36
  rainbowWallet
37
37
  } from "./chunk-W2LCLDPX.js";
@@ -75,8 +75,8 @@ import {
75
75
  oneKeyWallet
76
76
  } from "./chunk-WVT6BBJH.js";
77
77
  import {
78
- phantomWallet
79
- } from "./chunk-QY53O7WG.js";
78
+ rabbyWallet
79
+ } from "./chunk-RB66PKPA.js";
80
80
  import {
81
81
  foxWallet
82
82
  } from "./chunk-GUQM4QSL.js";
@@ -101,18 +101,18 @@ import {
101
101
  import {
102
102
  ledgerWallet
103
103
  } from "./chunk-RPV27V2Y.js";
104
- import {
105
- clvWallet
106
- } from "./chunk-OEEGYENV.js";
107
104
  import {
108
105
  bybitWallet
109
106
  } from "./chunk-OX37G4YT.js";
110
107
  import {
111
- coinbaseWallet
112
- } from "./chunk-2DLDAZRH.js";
108
+ clvWallet
109
+ } from "./chunk-OEEGYENV.js";
113
110
  import {
114
111
  coin98Wallet
115
112
  } from "./chunk-WAHGI5L7.js";
113
+ import {
114
+ coinbaseWallet
115
+ } from "./chunk-2DLDAZRH.js";
116
116
  import {
117
117
  coreWallet
118
118
  } from "./chunk-4NV5BYRP.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect",
3
- "version": "9.22.0",
3
+ "version": "9.23.1",
4
4
  "description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
5
5
  "files": [
6
6
  "dist",
@@ -112,9 +112,9 @@
112
112
  "use-debounce": "^10.0.5",
113
113
  "uuid": "^11.1.1",
114
114
  "@funkit/api-base": "4.5.1",
115
- "@funkit/chains": "2.1.0",
116
- "@funkit/connect-core": "0.3.2",
117
- "@funkit/fun-relay": "2.8.2",
115
+ "@funkit/chains": "2.1.1",
116
+ "@funkit/connect-core": "1.1.0",
117
+ "@funkit/fun-relay": "2.8.3",
118
118
  "@funkit/utils": "3.1.0"
119
119
  },
120
120
  "repository": {
@@ -1,78 +0,0 @@
1
- /**
2
- * Nado deposit routed through the Ink VaultDepositooor.
3
- *
4
- * Each deposit is a 2-action batch:
5
- * 1. approve(collateralToken, VAULT_DEPOSITOR, maxUint256) — covers the live balance pull
6
- * 2. VAULT_DEPOSITOR.deposit(collateralToken, NADO_ENDPOINT, calldata, 0)
7
- *
8
- * No zero-first approve reset: USDT0 on Ink (TetherTokenOFTExtension) inherits
9
- * OpenZeppelin's plain approve — verified on the Ink explorer, no legacy
10
- * non-zero->non-zero revert — and the other collaterals are standard OZ tokens.
11
- *
12
- * The Endpoint calldata carries AMOUNT_PLACEHOLDER where the uint128 amount
13
- * goes; the VaultDepositooor injects its caller's LIVE collateral balance over
14
- * the placeholder before calling the Endpoint. That makes the deposit robust
15
- * to bridge fee drift: whatever actually arrived is what gets deposited, with
16
- * no under-funded revert and no dust stranded on the EOA. The selector is the
17
- * canonical uint128 one (0x221f0939, registered for the Endpoint on the Ink
18
- * VaultDepositooor) while the head encodes the amount slot as uint256 so the
19
- * 32-byte placeholder word fits — uint128 and uint256 head-encode identically.
20
- *
21
- * `subaccount` packs the recipient address (high 20 bytes) with the
22
- * subaccount name "default" (right-padded to the remaining 12 bytes) into a
23
- * single bytes32 word. `productId` is per-collateral and is looked up by the
24
- * integrator from the Nado SpotEngine allowlist.
25
- *
26
- * Spec: https://www.notion.so/the-fun-group/37bfc3b2a002816bac41c920902e03c2
27
- */
28
- import { type Address, type Hex } from 'viem';
29
- import type { FunkitCheckoutActionParams } from '../providers/FunkitCheckoutContext/types';
30
- /** Nado Endpoint on Ink mainnet (chain 57073). */
31
- export declare const NADO_ENDPOINT_ADDRESS: `0x${string}`;
32
- /** VaultDepositooor on Ink — fresh CREATE3 deploy (differs from the canonical
33
- * address on other chains). The Nado Endpoint is registered on it with
34
- * selector 0x221f0939 and no decimal conversion. Mirrors
35
- * VAULT_DEPOSITOR_ADDRESSES[INK] in fun-backend's packages/types. */
36
- export declare const INK_VAULT_DEPOSITOR_ADDRESS: `0x${string}`;
37
- /** Sentinel value Nado treats as "no referral". */
38
- export declare const NADO_NO_REFERRAL_CODE = "-1";
39
- /** Default subaccount name used by the Nado UI/SDK. */
40
- export declare const NADO_DEFAULT_SUBACCOUNT_NAME = "default";
41
- /**
42
- * Build a Nado `bytes32` subaccount from an owner address and subaccount
43
- * name. Layout: `[owner (20 bytes)] [name (right-padded to 12 bytes)]`.
44
- *
45
- * Throws if `name` encodes to more than 12 bytes — without this, `pad()`
46
- * surfaces viem's opaque `SizeExceedsPaddingSizeError`.
47
- */
48
- export declare function buildNadoSubaccount(owner: Address, name?: string): Hex;
49
- export interface NadoDepositActionsConfig {
50
- /** Address credited on Nado (typically the connected wallet). */
51
- recipientAddress: Address | undefined;
52
- /** Collateral ERC20 on Ink being deposited (USDT0, kBTC, WETH, USDC, ...). */
53
- collateralTokenAddress: Address;
54
- /** Nado SpotEngine productId for the collateral token. */
55
- productId: number;
56
- /** Optional subaccount name. Defaults to "default". */
57
- subaccountName?: string;
58
- /** Optional referral code. Defaults to the no-referral sentinel "-1". */
59
- referralCode?: string;
60
- }
61
- /**
62
- * Builds the 2-action batch (approve + deposit) for a Nado collateral
63
- * deposit routed through the Endpoint.
64
- *
65
- * Usage:
66
- * ```ts
67
- * const checkoutConfig: FunkitCheckoutConfig = {
68
- * // ...
69
- * generateActionsParams: () => async (amount, output) =>
70
- * createNadoDepositActions({
71
- * recipientAddress: walletAddress,
72
- * collateralTokenAddress: output.targetAsset,
73
- * productId: NADO_PRODUCT_ID_BY_TOKEN[output.targetAsset],
74
- * }),
75
- * }
76
- * ```
77
- */
78
- export declare function createNadoDepositActions(config: NadoDepositActionsConfig): FunkitCheckoutActionParams[];
@@ -1,107 +0,0 @@
1
- "use client";
2
-
3
- // src/clients/nado.tsx
4
- import {
5
- concat,
6
- encodeAbiParameters,
7
- erc20Abi,
8
- getAddress,
9
- maxUint256,
10
- pad,
11
- stringToHex,
12
- toFunctionSelector
13
- } from "viem";
14
- var NADO_ENDPOINT_ADDRESS = getAddress(
15
- "0x05ec92d78ed421f3d3ada77ffde167106565974e"
16
- );
17
- var INK_VAULT_DEPOSITOR_ADDRESS = getAddress(
18
- "0xDB9d579B0DCbf566E372C73A2e374c44B161E1Ee"
19
- );
20
- var AMOUNT_PLACEHOLDER = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffdeadbeefn;
21
- var VAULT_DEPOSITOR_ABI = [
22
- {
23
- name: "deposit",
24
- type: "function",
25
- stateMutability: "nonpayable",
26
- inputs: [
27
- { name: "token", type: "address" },
28
- { name: "vault", type: "address" },
29
- { name: "callData", type: "bytes" },
30
- { name: "minAmountOut", type: "uint256" }
31
- ],
32
- outputs: []
33
- }
34
- ];
35
- var NADO_NO_REFERRAL_CODE = "-1";
36
- var NADO_DEFAULT_SUBACCOUNT_NAME = "default";
37
- var NADO_SUBACCOUNT_NAME_MAX_BYTES = 12;
38
- function buildNadoSubaccount(owner, name = NADO_DEFAULT_SUBACCOUNT_NAME) {
39
- const nameHex = stringToHex(name);
40
- const nameByteLength = (nameHex.length - 2) / 2;
41
- if (nameByteLength > NADO_SUBACCOUNT_NAME_MAX_BYTES) {
42
- throw new Error(
43
- `Nado subaccount name must encode to \u2264 ${NADO_SUBACCOUNT_NAME_MAX_BYTES} bytes (got ${nameByteLength}: "${name}")`
44
- );
45
- }
46
- return concat([
47
- owner,
48
- pad(nameHex, { dir: "right", size: NADO_SUBACCOUNT_NAME_MAX_BYTES })
49
- ]);
50
- }
51
- function createNadoDepositActions(config) {
52
- const {
53
- recipientAddress,
54
- collateralTokenAddress,
55
- productId,
56
- subaccountName,
57
- referralCode = NADO_NO_REFERRAL_CODE
58
- } = config;
59
- if (!recipientAddress) {
60
- throw new Error("Please connect your wallet before starting a Nado deposit");
61
- }
62
- const collateral = getAddress(collateralTokenAddress);
63
- const subaccount = buildNadoSubaccount(recipientAddress, subaccountName);
64
- const depositCalldata = concat([
65
- toFunctionSelector(
66
- "depositCollateralWithReferral(bytes32,uint32,uint128,string)"
67
- ),
68
- encodeAbiParameters(
69
- [
70
- { type: "bytes32" },
71
- { type: "uint32" },
72
- { type: "uint256" },
73
- { type: "string" }
74
- ],
75
- [subaccount, productId, AMOUNT_PLACEHOLDER, referralCode]
76
- )
77
- ]);
78
- return [
79
- // MAX approve so the pull covers whatever balance actually arrived (the
80
- // amount is only known at execution); the spender is Fun's own audited
81
- // VaultDepositooor. No zero-first reset needed: Ink USDT0 uses plain OZ
82
- // approve (verified), unlike legacy mainnet USDT.
83
- {
84
- contractAbi: erc20Abi,
85
- contractAddress: collateral,
86
- functionName: "approve",
87
- functionArgs: [INK_VAULT_DEPOSITOR_ADDRESS, maxUint256]
88
- },
89
- // VaultDepositooor pulls the live balance, injects it over the
90
- // placeholder, and calls the Endpoint. minAmountOut is 0 because the
91
- // collateral passes through 1:1 (no vault rate to bound).
92
- {
93
- contractAbi: VAULT_DEPOSITOR_ABI,
94
- contractAddress: INK_VAULT_DEPOSITOR_ADDRESS,
95
- functionName: "deposit",
96
- functionArgs: [collateral, NADO_ENDPOINT_ADDRESS, depositCalldata, 0n]
97
- }
98
- ];
99
- }
100
- export {
101
- INK_VAULT_DEPOSITOR_ADDRESS,
102
- NADO_DEFAULT_SUBACCOUNT_NAME,
103
- NADO_ENDPOINT_ADDRESS,
104
- NADO_NO_REFERRAL_CODE,
105
- buildNadoSubaccount,
106
- createNadoDepositActions
107
- };