@funkit/connect 9.13.0 → 9.14.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.
@@ -35,6 +35,14 @@ export type SourceChangeNext = {
35
35
  selectedPaymentOption: SwappedFormOfPayment;
36
36
  /** Payment method type filter to restore when returning */
37
37
  paymentMethodTypeFilter: PaymentMethodType;
38
+ } | {
39
+ /**
40
+ * Skip the asset-select screen; land on InputAmount with the
41
+ * source asset pre-set on the checkout context. Used by the
42
+ * Native fast-path row.
43
+ */
44
+ skipAssetSelect: true;
45
+ paymentMethodInfo: ConnectablePaymentMethodInfo;
38
46
  };
39
47
  export declare const SourceChangeInfo: ModalStepInfo<FunCheckoutStep.SOURCE_CHANGE>;
40
48
  export declare function SourceChange({ modalState, onClose, onNext, setModalState, }: ModalStepComponentProps<FunCheckoutStep.SOURCE_CHANGE>): React.JSX.Element;
@@ -4,6 +4,12 @@ interface SourceListProps {
4
4
  moreSources: ReactNode[];
5
5
  unavailable: ReactNode[];
6
6
  isFallback: boolean;
7
+ /**
8
+ * Pre-rendered Native fast-path row, threaded through to
9
+ * `buildSourceGroups`. Caller (SourceChange) owns the row's click
10
+ * handler since it depends on the modal's `onNext` callback.
11
+ */
12
+ nativeRow?: ReactNode;
7
13
  testId?: string;
8
14
  }
9
15
  /**
@@ -17,5 +23,5 @@ interface SourceListProps {
17
23
  * `SourceList` has no DOM of its own; the primitive it returns owns
18
24
  * the outer `data-testid` element.
19
25
  */
20
- export declare function SourceList({ preferred, moreSources, unavailable, isFallback, testId, }: SourceListProps): React.JSX.Element;
26
+ export declare function SourceList({ preferred, moreSources, unavailable, isFallback, nativeRow, testId, }: SourceListProps): React.JSX.Element;
21
27
  export {};
@@ -3,9 +3,16 @@ import { type ReactNode } from 'react';
3
3
  export interface SourceGroup {
4
4
  /** Section header. Omit to render the group's body without a header. */
5
5
  label?: string;
6
+ /**
7
+ * Optional tooltip surfaced via an info icon next to the label.
8
+ * Only renders when `showLabels` and `label` are both set.
9
+ */
10
+ labelTooltip?: string;
6
11
  children: ReactNode;
7
12
  }
8
13
  interface BuildSourceGroupsArgs {
14
+ /** Customer identity — used to dispatch to per-customer section composition. */
15
+ apiKey: string;
9
16
  preferred: ReactNode[];
10
17
  moreSources: ReactNode[];
11
18
  unavailable: ReactNode[];
@@ -13,6 +20,14 @@ interface BuildSourceGroupsArgs {
13
20
  isSwappedEnabled: boolean;
14
21
  enableSourceGroupLabels: boolean;
15
22
  t: TFunction;
23
+ /**
24
+ * Pre-rendered Native fast-path row. Caller resolves the customer's
25
+ * native asset, looks up the wallet holding, and constructs the row
26
+ * component; this function decides where in the Aave section
27
+ * structure it belongs. Only the Aave branch consumes it; the
28
+ * default branch ignores it.
29
+ */
30
+ nativeRow?: ReactNode;
16
31
  }
17
32
  export type BuildSourceGroupsResult = {
18
33
  layout: 'flat';
@@ -24,11 +39,12 @@ export type BuildSourceGroupsResult = {
24
39
  };
25
40
  /**
26
41
  * Composes source-list sections from `usePaymentSources` buckets +
27
- * the relevant Statsig flags. Returns a discriminated layout shape;
28
- * the composer (`SourceList`) dispatches to the matching layout
29
- * primitive.
42
+ * the relevant Statsig flags + the customer identity. Returns a
43
+ * discriminated layout shape; the composer (`SourceList`) dispatches
44
+ * to the matching layout primitive.
30
45
  *
31
- * Default behaviour mirrors SourceList's prior output:
46
+ * **Default branch** (most customers) mirrors SourceList's prior
47
+ * output:
32
48
  * - `isSwappedEnabled=false` → flat layout. One group for `preferred`
33
49
  * (if any), one combined group for `moreSources + unavailable` (if
34
50
  * any), with a single divider between them. (`SourceList` places
@@ -39,9 +55,16 @@ export type BuildSourceGroupsResult = {
39
55
  * "Other options" header is suppressed when no preferred group
40
56
  * precedes it.
41
57
  *
42
- * Future customer-aware section structures (e.g. Aave's
43
- * "Native" + "Use other assets") branch inside this helper without
44
- * touching either layout primitive.
58
+ * **Aave branch** (per Figma, [ENG-3743](https://linear.app/funxyz/issue/ENG-3743)
59
+ * + [ENG-3747](https://linear.app/funxyz/issue/ENG-3747)
60
+ * + [ENG-3755](https://linear.app/funxyz/issue/ENG-3755)):
61
+ * - "Native" section with the user's underlying-asset row when
62
+ * `nativeRow` is provided.
63
+ * - Second section flattens preferred + moreSources + unavailable
64
+ * into "Use other assets" (with native present) or "Use any asset"
65
+ * (without). Header carries a tooltip via `labelTooltip`.
66
+ * - Layout is always `grouped` with `showLabels=true` for Aave so the
67
+ * section headers render.
45
68
  */
46
- export declare function buildSourceGroups({ preferred, moreSources, unavailable, isFallback, isSwappedEnabled, enableSourceGroupLabels, t, }: BuildSourceGroupsArgs): BuildSourceGroupsResult;
69
+ export declare function buildSourceGroups(args: BuildSourceGroupsArgs): BuildSourceGroupsResult;
47
70
  export {};
@@ -6,14 +6,20 @@ export interface SourceTokenOption {
6
6
  label: string;
7
7
  iconSrc?: string;
8
8
  }
9
- export declare function WithdrawAmountInput({ withdrawalUSD, setWithdrawalUSD, sourceTokenBalance, isWithdrawAmountTooLow, isWithdrawAmountValid, minWithdrawalUsd, config, sourceTokenOptions, onSourceTokenChange, selectedSourceToken, sourceTokenUsdPrice, }: {
9
+ export declare function WithdrawAmountInput({ withdrawalInputAmount, setWithdrawalInputAmount, sourceTokenBalance, isWithdrawAmountTooLow, isWithdrawAmountValid, minWithdrawalDisplayValue, config, sourceTokenOptions, onSourceTokenChange, selectedSourceToken, sourceTokenUsdPrice, }: {
10
10
  config: Exclude<FunkitWithdrawalConfig, MultiMethodWithdrawalConfig>;
11
11
  sourceTokenBalance: string;
12
- withdrawalUSD: string;
13
- setWithdrawalUSD: (s: string) => void;
12
+ /** User-entered amount in source-token units (e.g. "0.5" for 0.5 ETH). */
13
+ withdrawalInputAmount: string;
14
+ setWithdrawalInputAmount: (s: string) => void;
14
15
  isWithdrawAmountTooLow: boolean;
15
16
  isWithdrawAmountValid: boolean;
16
- minWithdrawalUsd: number;
17
+ /**
18
+ * Minimum-withdrawal value formatted for display. Token units when the
19
+ * config provides `getMinWithdrawalAmount` (Lighter Secure); USD otherwise.
20
+ * The component picks the rendering style from `isLighter`.
21
+ */
22
+ minWithdrawalDisplayValue: number;
17
23
  sourceTokenOptions?: SourceTokenOption[];
18
24
  onSourceTokenChange?: (opt: SourceTokenOption) => void;
19
25
  /** Currently selected source token symbol (drives chip label + icon). */
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { Hex } from 'viem';
3
- import type { CustomWithdrawalConfig, FunkitActiveWithdrawalItem, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
3
+ import type { CustomWithdrawalConfig, FunkitActiveWithdrawalItem, FunkitCheckoutConfig, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
4
4
  import { type WithdrawalFormData } from './useWithdrawal';
5
5
  /**
6
6
  * WithdrawalContent only operates on concrete single-method withdrawal configs.
@@ -12,6 +12,37 @@ interface WithdrawContentProps {
12
12
  config: FunkitWithdrawalConfig;
13
13
  withdrawalItem: FunkitActiveWithdrawalItem | null;
14
14
  }
15
+ /**
16
+ * Converts a source-token amount string to its USD value using the given unit
17
+ * price. Returns `undefined` when the price is not yet loaded so callers can
18
+ * differentiate "still loading" from "actually $0".
19
+ *
20
+ * Exported for testing.
21
+ */
22
+ export declare function toUsdValue(sourceAmount: string, sourceTokenUsdPrice: number | undefined): number | undefined;
23
+ export declare function isValidWithdrawal({ config, checkoutConfig, withdrawalInputAmount, sourceTokenUsdPrice, recipientAddress, selectedChainId, sourceTokenBalance, selectedSourceToken, }: {
24
+ config: FunkitWithdrawalConfig;
25
+ checkoutConfig: FunkitCheckoutConfig | undefined;
26
+ /** User-entered amount in source-token units (e.g. "0.5" for 0.5 ETH). */
27
+ withdrawalInputAmount: string;
28
+ /**
29
+ * USD price per unit of the source token. Hardcoded to 1 for stablecoin
30
+ * sources; only Lighter Secure resolves a live spot price, and that path
31
+ * uses `getMinWithdrawalAmount` (per-token) which takes priority over the
32
+ * USD-min branch — so this field is only meaningfully consumed when it's 1.
33
+ */
34
+ sourceTokenUsdPrice: number;
35
+ sourceTokenBalance: string;
36
+ recipientAddress: string;
37
+ selectedChainId: number | undefined;
38
+ selectedSourceToken: string | undefined;
39
+ }): {
40
+ isValidAddress: boolean;
41
+ isValidAddressAndChain: boolean;
42
+ isWithdrawAmountTooLow: boolean;
43
+ isWithdrawAmountValid: boolean;
44
+ minWithdrawalDisplayValue: number;
45
+ };
15
46
  /**
16
47
  * Builds the source-token options list for the Lighter compound input dropdown.
17
48
  * Currently returns a single option per config; expands when Lighter exposes
@@ -11,6 +11,7 @@ export interface FunkitTextCustomizationsConfig {
11
11
  sourceMethodTitle: string;
12
12
  tokensListTitle: string;
13
13
  transferTokens: string;
14
+ bitcoinLightning: string;
14
15
  receiveDropdownTitle: string;
15
16
  receiveDropdownLabel: string;
16
17
  txStatus?: {
@@ -58,6 +59,7 @@ export interface FunkitTextCustomizationsConfig {
58
59
  debitOrCredit?: string;
59
60
  paypal?: string;
60
61
  transferTokens?: string;
62
+ bitcoinLightning?: string;
61
63
  virtualFiat?: string;
62
64
  };
63
65
  }
@@ -1,40 +1,37 @@
1
1
  "use client";
2
2
  import {
3
- zealWallet
4
- } from "./chunk-A5EZBNME.js";
3
+ safeheronWallet
4
+ } from "./chunk-AM5MSNVQ.js";
5
5
  import {
6
6
  zerionWallet
7
7
  } from "./chunk-UFYNHHDU.js";
8
- import {
9
- tahoWallet
10
- } from "./chunk-KS5MJNGD.js";
11
- import {
12
- talismanWallet
13
- } from "./chunk-T3VMQBBI.js";
14
8
  import {
15
9
  tokenPocketWallet
16
10
  } from "./chunk-UYW6MV74.js";
11
+ import {
12
+ frontierWallet
13
+ } from "./chunk-J3PJOMO7.js";
17
14
  import {
18
15
  tokenaryWallet
19
16
  } from "./chunk-R7X5RIO7.js";
20
- import {
21
- uniswapWallet
22
- } from "./chunk-UKSIXGWC.js";
23
17
  import {
24
18
  trustWallet
25
19
  } from "./chunk-FWM4KTOV.js";
20
+ import {
21
+ uniswapWallet
22
+ } from "./chunk-UKSIXGWC.js";
26
23
  import {
27
24
  walletConnectWallet
28
25
  } from "./chunk-O7ZCUI2Y.js";
29
26
  import {
30
27
  xdefiWallet
31
28
  } from "./chunk-KSNA53EX.js";
29
+ import {
30
+ zealWallet
31
+ } from "./chunk-A5EZBNME.js";
32
32
  import {
33
33
  rainbowWallet
34
34
  } from "./chunk-AZYMJ4C6.js";
35
- import {
36
- rabbyWallet
37
- } from "./chunk-7PVUEV4M.js";
38
35
  import {
39
36
  ramperWallet
40
37
  } from "./chunk-P4E2ZFQB.js";
@@ -44,9 +41,6 @@ import {
44
41
  import {
45
42
  safeWallet
46
43
  } from "./chunk-BHAPTB57.js";
47
- import {
48
- safeheronWallet
49
- } from "./chunk-AM5MSNVQ.js";
50
44
  import {
51
45
  safepalWallet
52
46
  } from "./chunk-VMMROPXK.js";
@@ -54,11 +48,11 @@ import {
54
48
  subWallet
55
49
  } from "./chunk-ZJJWGKB6.js";
56
50
  import {
57
- metaMaskWallet
58
- } from "./chunk-IRHK6SOW.js";
51
+ tahoWallet
52
+ } from "./chunk-KS5MJNGD.js";
59
53
  import {
60
- mewWallet
61
- } from "./chunk-DP5ICBEB.js";
54
+ talismanWallet
55
+ } from "./chunk-T3VMQBBI.js";
62
56
  import {
63
57
  oktoWallet
64
58
  } from "./chunk-BBPTPMH7.js";
@@ -78,14 +72,14 @@ import {
78
72
  phantomWallet
79
73
  } from "./chunk-57GN4W23.js";
80
74
  import {
81
- foxWallet
82
- } from "./chunk-YGMU5VWD.js";
75
+ rabbyWallet
76
+ } from "./chunk-7PVUEV4M.js";
83
77
  import {
84
78
  frameWallet
85
79
  } from "./chunk-MTJIPVYB.js";
86
80
  import {
87
- frontierWallet
88
- } from "./chunk-J3PJOMO7.js";
81
+ enkryptWallet
82
+ } from "./chunk-2DKNXOPL.js";
89
83
  import {
90
84
  gateWallet
91
85
  } from "./chunk-LEAZMT5Y.js";
@@ -101,36 +95,42 @@ import {
101
95
  import {
102
96
  ledgerWallet
103
97
  } from "./chunk-V4EXM3KB.js";
98
+ import {
99
+ metaMaskWallet
100
+ } from "./chunk-IRHK6SOW.js";
101
+ import {
102
+ mewWallet
103
+ } from "./chunk-DP5ICBEB.js";
104
104
  import {
105
105
  clvWallet
106
106
  } from "./chunk-3ZJN3PXP.js";
107
+ import {
108
+ bitgetWallet
109
+ } from "./chunk-IMNI4AGV.js";
107
110
  import {
108
111
  coin98Wallet
109
112
  } from "./chunk-RZQ4B4Z7.js";
110
- import {
111
- bybitWallet
112
- } from "./chunk-7IEUTLHY.js";
113
113
  import {
114
114
  coinbaseWallet
115
115
  } from "./chunk-OUM6H3WU.js";
116
116
  import {
117
117
  coreWallet
118
118
  } from "./chunk-55VS2NKG.js";
119
+ import {
120
+ desigWallet
121
+ } from "./chunk-TNVLCMJD.js";
119
122
  import {
120
123
  dawnWallet
121
124
  } from "./chunk-PARFRRNI.js";
122
125
  import {
123
- desigWallet
124
- } from "./chunk-TNVLCMJD.js";
126
+ foxWallet
127
+ } from "./chunk-YGMU5VWD.js";
125
128
  import {
126
- enkryptWallet
127
- } from "./chunk-2DKNXOPL.js";
129
+ argentWallet
130
+ } from "./chunk-XTD6OMZP.js";
128
131
  import {
129
132
  bifrostWallet
130
133
  } from "./chunk-OD6B2ISG.js";
131
- import {
132
- bitgetWallet
133
- } from "./chunk-IMNI4AGV.js";
134
134
  import {
135
135
  bitskiWallet
136
136
  } from "./chunk-Y36HPFB3.js";
@@ -140,13 +140,13 @@ import {
140
140
  import {
141
141
  bloomWallet
142
142
  } from "./chunk-S6R4B763.js";
143
- import {
144
- argentWallet
145
- } from "./chunk-XTD6OMZP.js";
146
- import "./chunk-FMVNQKZL.js";
147
143
  import {
148
144
  braveWallet
149
145
  } from "./chunk-XVH4JIXB.js";
146
+ import {
147
+ bybitWallet
148
+ } from "./chunk-7IEUTLHY.js";
149
+ import "./chunk-FMVNQKZL.js";
150
150
  import "./chunk-YYYRPQHB.js";
151
151
  import "./chunk-3K2MFXCO.js";
152
152
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect",
3
- "version": "9.13.0",
3
+ "version": "9.14.0",
4
4
  "description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
5
5
  "files": [
6
6
  "dist",
@@ -107,9 +107,9 @@
107
107
  "ua-parser-js": "^1.0.37",
108
108
  "use-debounce": "^10.0.5",
109
109
  "uuid": "^9.0.1",
110
- "@funkit/api-base": "4.2.2",
111
- "@funkit/chains": "1.1.3",
110
+ "@funkit/api-base": "4.2.3",
112
111
  "@funkit/fun-relay": "2.7.2",
112
+ "@funkit/chains": "1.2.0",
113
113
  "@funkit/utils": "3.0.1"
114
114
  },
115
115
  "repository": {