@funkit/connect 12.17.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/clients/axiom.d.ts +0 -4
  3. package/dist/clients/{chunk-V4RIF2NR.js → chunk-AELXD5XA.js} +1 -1
  4. package/dist/clients/{chunk-HANOVGPH.js → chunk-FOXMRDKD.js} +1 -1
  5. package/dist/clients/{chunk-TWP5LFPX.js → chunk-G6A62MZO.js} +5 -5
  6. package/dist/clients/{chunk-LVR6RQMO.js → chunk-L6JL2XJY.js} +1 -1
  7. package/dist/clients/{chunk-I5VRAFH6.js → chunk-LCYJLY4X.js} +1 -1
  8. package/dist/clients/{chunk-2L6IKKNH.js → chunk-YSAAJSWT.js} +224 -16
  9. package/dist/clients/fanatics.js +2 -2
  10. package/dist/clients/internal/nado/withdrawalCallback.js +4 -4
  11. package/dist/clients/internal/nado/withdrawalConfig.js +2 -2
  12. package/dist/clients/internal/nado/withdrawalErrors.js +2 -2
  13. package/dist/clients/internal/nado/withdrawalForm.js +5 -5
  14. package/dist/clients/internal/nado/withdrawalStatus.js +3 -3
  15. package/dist/clients/lighter.css +8 -8
  16. package/dist/clients/lighter.js +3 -3
  17. package/dist/clients/mallard.js +2 -2
  18. package/dist/clients/nado.js +4 -4
  19. package/dist/components/LargeAmountInput/LargeAmountInput.d.ts +3 -1
  20. package/dist/components/TokenSwapWidget/TokenSelectButton/TokenSelectButton.d.ts +5 -2
  21. package/dist/components/TokenSwapWidget/TokenSwapCard/TokenSwapCard.d.ts +7 -3
  22. package/dist/components/TokenSwapWidget/TokenSwapWidget.d.ts +7 -2
  23. package/dist/domains/convert/assets.d.ts +9 -1
  24. package/dist/domains/convert/balances.d.ts +31 -8
  25. package/dist/domains/convert/errors.d.ts +2 -2
  26. package/dist/domains/convert/hostTimeout.d.ts +8 -0
  27. package/dist/domains/convert/inputAmount.d.ts +30 -1
  28. package/dist/domains/convert/quote.d.ts +17 -8
  29. package/dist/domains/convert/recipient.d.ts +2 -1
  30. package/dist/domains/convert/reducer.d.ts +112 -0
  31. package/dist/domains/convert/screen.d.ts +169 -0
  32. package/dist/domains/convert/settlement.d.ts +6 -1
  33. package/dist/domains/convert/sourceWallet.d.ts +5 -4
  34. package/dist/domains/convert/submit.d.ts +25 -4
  35. package/dist/domains/convert/types.d.ts +15 -6
  36. package/dist/domains/convert/view.d.ts +111 -0
  37. package/dist/hooks/track/CheckoutModalEvent.d.ts +2 -0
  38. package/dist/hooks/useConvertAssetList.d.ts +23 -0
  39. package/dist/hooks/useConvertAssets.d.ts +3 -1
  40. package/dist/hooks/useConvertBalances.d.ts +9 -3
  41. package/dist/hooks/useConvertExecute.d.ts +17 -61
  42. package/dist/hooks/useConvertQuote.d.ts +22 -2
  43. package/dist/hooks/useConvertSelectionWallets.d.ts +34 -0
  44. package/dist/hooks/useConvertTransactionStatus.d.ts +11 -17
  45. package/dist/index.css +8 -8
  46. package/dist/index.d.ts +2 -1
  47. package/dist/index.js +6460 -2580
  48. package/dist/modals/CheckoutModal/Convert/ConvertAssetList.d.ts +16 -0
  49. package/dist/modals/CheckoutModal/Convert/ConvertAssetRow.d.ts +21 -0
  50. package/dist/modals/CheckoutModal/Convert/ConvertChainPills.d.ts +14 -0
  51. package/dist/modals/CheckoutModal/Convert/ConvertSelectDestinationStep.d.ts +30 -0
  52. package/dist/modals/CheckoutModal/Convert/ConvertSelectSourceStep.d.ts +18 -0
  53. package/dist/modals/CheckoutModal/Convert/ConvertStep.d.ts +4 -2
  54. package/dist/modals/CheckoutModal/FunCheckoutStep.d.ts +2 -0
  55. package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +5 -3
  56. package/dist/modals/CheckoutModal/Withdrawal/WithdrawalComplete.d.ts +5 -2
  57. package/dist/modals/CheckoutModal/Withdrawal/WithdrawalEnterAmount.d.ts +4 -2
  58. package/dist/modals/CheckoutModal/stepTransition.d.ts +6 -0
  59. package/dist/modals/CheckoutModal/stepTransition.shared.d.ts +0 -1
  60. package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +15 -4
  61. package/dist/modals/WithdrawalModal/WithdrawalContent.d.ts +7 -7
  62. package/dist/modals/WithdrawalModal/useMultiSourceWithdrawal.d.ts +41 -0
  63. package/dist/providers/ConvertProvider.d.ts +40 -0
  64. package/dist/providers/FunkitCheckoutContext/index.d.ts +2 -2
  65. package/dist/providers/FunkitCheckoutContext/types.d.ts +36 -2
  66. package/dist/shadow-css.js +1 -1
  67. package/dist/utils/withdrawal.d.ts +28 -1
  68. package/dist/wallets/multiSourceWithdrawal.d.ts +36 -0
  69. package/dist/wallets/walletConnectors/index.js +43 -43
  70. package/package.json +3 -3
  71. package/dist/hooks/useConvertInputAmount.d.ts +0 -26
  72. package/dist/hooks/useConvertMaxAmount.d.ts +0 -11
  73. package/dist/hooks/usePrepareConvertSubmit.d.ts +0 -22
  74. /package/dist/clients/{chunk-4DBUYTEE.js → chunk-LICTGZXW.js} +0 -0
@@ -1,4 +1,4 @@
1
- import type { CustomWithdrawalConfig, FunkitWithdrawalConfig, MultiMethodWithdrawalConfig, SourceTokenOption, WalletWithdrawalConfig } from '../providers/FunkitCheckoutContext';
1
+ import type { CustomWithdrawalConfig, FunkitWithdrawalConfig, MultiMethodWithdrawalConfig, MultiSourceWithdrawalConfig, SingleWithdrawalConfig, SourceTokenOption, WalletWithdrawalConfig, WithdrawalSourceOption } from '../providers/FunkitCheckoutContext';
2
2
  /**
3
3
  * Type guard to check if withdrawal config uses wallet-based flow
4
4
  */
@@ -34,6 +34,33 @@ export declare function isCustomWithdrawalConfig(config: FunkitWithdrawalConfig)
34
34
  * must pick between (e.g. "Fast" vs "Secure").
35
35
  */
36
36
  export declare function isMultiMethodWithdrawalConfig(config: FunkitWithdrawalConfig): config is MultiMethodWithdrawalConfig;
37
+ /**
38
+ * Type guard for a config whose source is picked from the amount screen's
39
+ * dropdown, each source carrying its own chain, token and wallet.
40
+ */
41
+ export declare function isMultiSourceWithdrawalConfig(config: FunkitWithdrawalConfig): config is MultiSourceWithdrawalConfig;
42
+ /**
43
+ * The source `sourceId` names, falling back to the default (then the first)
44
+ * when it names none. Its config carries the container's header and
45
+ * `disableConnectedWallet`, so it can drive the flow on its own. `undefined`
46
+ * only for an empty container.
47
+ */
48
+ export declare function resolveWithdrawalSource(config: MultiSourceWithdrawalConfig, sourceId?: string): {
49
+ source: WithdrawalSourceOption;
50
+ config: SingleWithdrawalConfig;
51
+ } | undefined;
52
+ /**
53
+ * The single config a flow starts on before the user picks anything: the
54
+ * first method, the default source, or the config itself. `undefined` for an
55
+ * empty container.
56
+ */
57
+ export declare function getDefaultWithdrawalConfig(config: FunkitWithdrawalConfig): SingleWithdrawalConfig | undefined;
58
+ /**
59
+ * The config a withdrawal item is seeded from. A multi-source config leaves out
60
+ * its default source's balance callback: the item's callback is the fallback
61
+ * for sources without their own, and the default source's reads another wallet.
62
+ */
63
+ export declare function getWithdrawalItemSeedConfig(config: FunkitWithdrawalConfig): SingleWithdrawalConfig | undefined;
37
64
  /**
38
65
  * Converts a human-readable token amount to base units using string arithmetic
39
66
  * to avoid floating-point precision loss.
@@ -0,0 +1,36 @@
1
+ import type { MultiSourceWithdrawalConfig, SingleWithdrawalConfig, WithdrawalSourceOption } from '../providers/FunkitCheckoutContext/types';
2
+ export interface MultiSourceWithdrawalOptions {
3
+ modalTitle?: string;
4
+ modalTitleMeta?: string;
5
+ disableConnectedWallet?: boolean;
6
+ /**
7
+ * Sources in dropdown order. A source whose `config` is `null` (its wallet
8
+ * isn't connected yet) is left out, so per-VM hooks can be passed as-is.
9
+ */
10
+ sources: ReadonlyArray<Omit<WithdrawalSourceOption, 'config'> & {
11
+ config: SingleWithdrawalConfig | null | undefined;
12
+ }>;
13
+ /** Initially selected source. Defaults to the first available. */
14
+ defaultSourceId?: string;
15
+ }
16
+ /**
17
+ * Composes per-source configs (Solana, HyperCore, one per EVM chain, ...) into
18
+ * one withdrawal whose source is picked from the amount screen's dropdown.
19
+ * Each source keeps its own wallet, balance and limits.
20
+ *
21
+ * `null` when no source has a config yet — keep the withdraw entry point
22
+ * disabled until it resolves. Pure, so memoize the result on the inputs.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const sol = useSolanaWithdrawalConfig(solanaParams)
27
+ * const config = useMemo(() => createMultiSourceWithdrawalConfig({
28
+ * modalTitle: 'Withdraw',
29
+ * sources: [
30
+ * { id: 'SOL', config: sol },
31
+ * { id: 'ETH_BASE', label: 'ETH', config: ethOnBase },
32
+ * ],
33
+ * }), [sol, ethOnBase])
34
+ * ```
35
+ */
36
+ export declare function createMultiSourceWithdrawalConfig(options: MultiSourceWithdrawalOptions): MultiSourceWithdrawalConfig | null;
@@ -1,58 +1,58 @@
1
1
  "use client";
2
2
  import {
3
- zealWallet
4
- } from "./chunk-GLX5FULK.js";
3
+ xdefiWallet
4
+ } from "./chunk-HXX4PRE2.js";
5
5
  import {
6
6
  zerionWallet
7
7
  } from "./chunk-34B7OJNT.js";
8
8
  import {
9
- walletConnectWallet
10
- } from "./chunk-DUX4XCDV.js";
9
+ zealWallet
10
+ } from "./chunk-GLX5FULK.js";
11
11
  import {
12
12
  subWallet
13
13
  } from "./chunk-XODA5ESL.js";
14
- import {
15
- tahoWallet
16
- } from "./chunk-U74RFZOL.js";
17
14
  import {
18
15
  talismanWallet
19
16
  } from "./chunk-IAYYWCVB.js";
20
17
  import {
21
18
  tokenPocketWallet
22
19
  } from "./chunk-NXWG6FG2.js";
20
+ import {
21
+ tahoWallet
22
+ } from "./chunk-U74RFZOL.js";
23
23
  import {
24
24
  tokenaryWallet
25
25
  } from "./chunk-TPM5PUJD.js";
26
- import {
27
- trustWallet
28
- } from "./chunk-SR5CZR3L.js";
29
26
  import {
30
27
  uniswapWallet
31
28
  } from "./chunk-UNDWHCDH.js";
32
29
  import {
33
- xdefiWallet
34
- } from "./chunk-HXX4PRE2.js";
35
- import {
36
- rainbowWallet
37
- } from "./chunk-ZSSSLFQF.js";
30
+ trustWallet
31
+ } from "./chunk-SR5CZR3L.js";
38
32
  import {
39
- oneKeyWallet
40
- } from "./chunk-KN32ITJ7.js";
33
+ walletConnectWallet
34
+ } from "./chunk-DUX4XCDV.js";
41
35
  import {
42
- ramperWallet
43
- } from "./chunk-GPXIBTWN.js";
36
+ phantomWallet
37
+ } from "./chunk-Q27YVDDH.js";
44
38
  import {
45
39
  rabbyWallet
46
40
  } from "./chunk-RQ2GXOJL.js";
41
+ import {
42
+ rainbowWallet
43
+ } from "./chunk-ZSSSLFQF.js";
47
44
  import {
48
45
  roninWallet
49
46
  } from "./chunk-IA5432IR.js";
50
47
  import {
51
- safeWallet
52
- } from "./chunk-IR3PJMVM.js";
48
+ ramperWallet
49
+ } from "./chunk-GPXIBTWN.js";
53
50
  import {
54
51
  safepalWallet
55
52
  } from "./chunk-BBB2J3US.js";
53
+ import {
54
+ safeWallet
55
+ } from "./chunk-IR3PJMVM.js";
56
56
  import {
57
57
  safeheronWallet
58
58
  } from "./chunk-UN3ONVNC.js";
@@ -65,21 +65,21 @@ import {
65
65
  import {
66
66
  metaMaskWallet
67
67
  } from "./chunk-RXRYHMRI.js";
68
- import {
69
- okxWallet
70
- } from "./chunk-CU5J53XR.js";
71
68
  import {
72
69
  oktoWallet
73
70
  } from "./chunk-V4M3SNPS.js";
74
71
  import {
75
72
  omniWallet
76
73
  } from "./chunk-2TAUCVX7.js";
74
+ import {
75
+ okxWallet
76
+ } from "./chunk-CU5J53XR.js";
77
77
  import {
78
78
  oneInchWallet
79
79
  } from "./chunk-GFS2AVAH.js";
80
80
  import {
81
- phantomWallet
82
- } from "./chunk-Q27YVDDH.js";
81
+ oneKeyWallet
82
+ } from "./chunk-KN32ITJ7.js";
83
83
  import {
84
84
  enkryptWallet
85
85
  } from "./chunk-Z6LDN2AN.js";
@@ -89,12 +89,12 @@ import {
89
89
  import {
90
90
  frameWallet
91
91
  } from "./chunk-B572YIAQ.js";
92
- import {
93
- frontierWallet
94
- } from "./chunk-IWOMSW64.js";
95
92
  import {
96
93
  gateWallet
97
94
  } from "./chunk-YRMBR6NA.js";
95
+ import {
96
+ frontierWallet
97
+ } from "./chunk-IWOMSW64.js";
98
98
  import {
99
99
  imTokenWallet
100
100
  } from "./chunk-YY2JA23M.js";
@@ -104,33 +104,30 @@ import {
104
104
  import {
105
105
  kresusWallet
106
106
  } from "./chunk-V77ATGZT.js";
107
- import {
108
- bybitWallet
109
- } from "./chunk-BBDNB5TQ.js";
110
107
  import {
111
108
  clvWallet
112
109
  } from "./chunk-4FHNLTR3.js";
113
110
  import {
114
111
  coin98Wallet
115
112
  } from "./chunk-RFCZYLNR.js";
116
- import {
117
- coinbaseWallet
118
- } from "./chunk-SM2A3OSG.js";
119
113
  import {
120
114
  coreWallet
121
115
  } from "./chunk-TRZDAXCQ.js";
116
+ import {
117
+ coinbaseWallet
118
+ } from "./chunk-SM2A3OSG.js";
122
119
  import {
123
120
  dawnWallet
124
121
  } from "./chunk-LV6YV3DE.js";
125
122
  import {
126
123
  customWallet
127
124
  } from "./chunk-VKM5M5UK.js";
125
+ import {
126
+ bitverseWallet
127
+ } from "./chunk-5AEWIKRA.js";
128
128
  import {
129
129
  desigWallet
130
130
  } from "./chunk-DFHP75HV.js";
131
- import {
132
- argentWallet
133
- } from "./chunk-XSDTNMQY.js";
134
131
  import {
135
132
  bifrostWallet
136
133
  } from "./chunk-ALGPGI6V.js";
@@ -138,18 +135,21 @@ import {
138
135
  bitgetWallet
139
136
  } from "./chunk-HOCKAU5H.js";
140
137
  import {
141
- bitverseWallet
142
- } from "./chunk-5AEWIKRA.js";
138
+ bitskiWallet
139
+ } from "./chunk-NPITCCJE.js";
140
+ import {
141
+ argentWallet
142
+ } from "./chunk-XSDTNMQY.js";
143
143
  import {
144
144
  bloomWallet
145
145
  } from "./chunk-PNHDOC77.js";
146
- import "./chunk-AALSJCUR.js";
147
146
  import {
148
147
  braveWallet
149
148
  } from "./chunk-U2XXV45G.js";
150
149
  import {
151
- bitskiWallet
152
- } from "./chunk-NPITCCJE.js";
150
+ bybitWallet
151
+ } from "./chunk-BBDNB5TQ.js";
152
+ import "./chunk-AALSJCUR.js";
153
153
  import "./chunk-EYWGX5LT.js";
154
154
  import "./chunk-B454LLKJ.js";
155
155
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect",
3
- "version": "12.17.0",
3
+ "version": "12.18.0",
4
4
  "description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
5
5
  "files": [
6
6
  "dist",
@@ -120,10 +120,10 @@
120
120
  "use-debounce": "^10.0.5",
121
121
  "uuid": "^11.1.1",
122
122
  "@funkit/api-base": "9.1.0",
123
+ "@funkit/chains": "2.6.0",
123
124
  "@funkit/connect-core": "10.0.0",
124
- "@funkit/utils": "5.1.0",
125
125
  "@funkit/fun-relay": "3.2.0",
126
- "@funkit/chains": "2.6.0"
126
+ "@funkit/utils": "5.1.0"
127
127
  },
128
128
  "repository": {
129
129
  "type": "git",
@@ -1,26 +0,0 @@
1
- import { type AmountUnit, type AmountUnitToggleState } from '../components/TokenSwapWidget/AmountUnitToggle/useAmountUnitToggle';
2
- export interface ConvertInputAmountState extends AmountUnitToggleState {
3
- /** What to quote: Max's exact amount, or the typed one. */
4
- baseUnits: bigint | undefined;
5
- /** The amount came from Max; typing clears it. */
6
- isMax: boolean;
7
- /** Above the source balance; `false` while the balance is unknown. */
8
- exceedsBalance: boolean;
9
- /** Sets an exact Max; the field shows it rounded down. */
10
- setMax: (baseUnits: bigint) => void;
11
- }
12
- /**
13
- * Convert's amount entry: the unit toggle plus an exact base-unit amount.
14
- * - Max is held apart from the field text, which is capped at 5 decimals and
15
- * can't carry an 18-decimal balance.
16
- * - While Max is on, the field and its converted amounts are derived from it
17
- * each render, so a price change or unit flip never leaves them stale.
18
- * - Reset it (remount or key) when the source token changes, like the toggle.
19
- */
20
- export declare function useConvertInputAmount({ decimals, unitPriceUsd, balanceBaseUnits, initialUnit, }: {
21
- decimals: number;
22
- unitPriceUsd: number | undefined;
23
- /** Source balance as a base-unit integer string, when known. */
24
- balanceBaseUnits: string | undefined;
25
- initialUnit?: AmountUnit;
26
- }): ConvertInputAmountState;
@@ -1,11 +0,0 @@
1
- import type { ConvertBalanceState } from '../domains/convert/balances';
2
- import type { ConvertResolvedAsset } from '../domains/convert/types';
3
- /**
4
- * What Max fills in for a Convert source, in its base units: the balance less
5
- * its fee reserve. `null` disables Max: the balance is unavailable or not yet
6
- * read, or a native EVM source's gas price is still loading.
7
- */
8
- export declare function useConvertMaxAmount({ asset, balance, }: {
9
- asset: ConvertResolvedAsset;
10
- balance: ConvertBalanceState | undefined;
11
- }): bigint | null;
@@ -1,22 +0,0 @@
1
- import { type ConvertBalances } from '../domains/convert/balances';
2
- import type { ConvertQuote } from '../domains/convert/quote';
3
- import { type ConvertSubmitPreparation } from '../domains/convert/submit';
4
- import type { ConvertResolvedAsset } from '../domains/convert/types';
5
- interface UsePrepareConvertSubmitParams {
6
- sourceAsset: ConvertResolvedAsset;
7
- /** The amount being quoted, from `useConvertInputAmount`. */
8
- amountInBaseUnits: bigint | undefined;
9
- /** The quote on screen, from `useConvertQuote`; it's the one signed. */
10
- quote: ConvertQuote | undefined;
11
- /** `useConvertBalances.refetch`; called with only the source asset. */
12
- refetchBalances: (assets: ConvertResolvedAsset[]) => Promise<ConvertBalances>;
13
- }
14
- /**
15
- * The pre-sign check, run on every submit before the first source step: check
16
- * the quote on screen, re-read the source balance and check the amount against
17
- * the fresh Max. Returns `ready` with the quote to execute, or why not to sign
18
- * yet. Like withdrawal, it doesn't requote. Never signs, sends, or edits the
19
- * amount.
20
- */
21
- export declare function usePrepareConvertSubmit({ sourceAsset, amountInBaseUnits, quote, refetchBalances, }: UsePrepareConvertSubmitParams): () => Promise<ConvertSubmitPreparation>;
22
- export {};