@funkit/connect 12.17.0 → 12.18.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 (75) hide show
  1. package/CHANGELOG.md +38 -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/FunTransactionSummary/PaymentFeesSummary.d.ts +3 -1
  20. package/dist/components/LargeAmountInput/LargeAmountInput.d.ts +3 -1
  21. package/dist/components/TokenSwapWidget/TokenSelectButton/TokenSelectButton.d.ts +5 -2
  22. package/dist/components/TokenSwapWidget/TokenSwapCard/TokenSwapCard.d.ts +7 -3
  23. package/dist/components/TokenSwapWidget/TokenSwapWidget.d.ts +7 -2
  24. package/dist/domains/convert/assets.d.ts +9 -1
  25. package/dist/domains/convert/balances.d.ts +31 -8
  26. package/dist/domains/convert/errors.d.ts +2 -2
  27. package/dist/domains/convert/hostTimeout.d.ts +8 -0
  28. package/dist/domains/convert/inputAmount.d.ts +30 -1
  29. package/dist/domains/convert/quote.d.ts +17 -8
  30. package/dist/domains/convert/recipient.d.ts +2 -1
  31. package/dist/domains/convert/reducer.d.ts +112 -0
  32. package/dist/domains/convert/screen.d.ts +169 -0
  33. package/dist/domains/convert/settlement.d.ts +6 -1
  34. package/dist/domains/convert/sourceWallet.d.ts +5 -4
  35. package/dist/domains/convert/submit.d.ts +25 -4
  36. package/dist/domains/convert/types.d.ts +15 -6
  37. package/dist/domains/convert/view.d.ts +111 -0
  38. package/dist/hooks/track/CheckoutModalEvent.d.ts +2 -0
  39. package/dist/hooks/useConvertAssetList.d.ts +23 -0
  40. package/dist/hooks/useConvertAssets.d.ts +3 -1
  41. package/dist/hooks/useConvertBalances.d.ts +9 -3
  42. package/dist/hooks/useConvertExecute.d.ts +17 -61
  43. package/dist/hooks/useConvertQuote.d.ts +22 -2
  44. package/dist/hooks/useConvertSelectionWallets.d.ts +34 -0
  45. package/dist/hooks/useConvertTransactionStatus.d.ts +11 -17
  46. package/dist/index.css +8 -8
  47. package/dist/index.d.ts +2 -1
  48. package/dist/index.js +6471 -2584
  49. package/dist/modals/CheckoutModal/Convert/ConvertAssetList.d.ts +16 -0
  50. package/dist/modals/CheckoutModal/Convert/ConvertAssetRow.d.ts +21 -0
  51. package/dist/modals/CheckoutModal/Convert/ConvertChainPills.d.ts +14 -0
  52. package/dist/modals/CheckoutModal/Convert/ConvertSelectDestinationStep.d.ts +30 -0
  53. package/dist/modals/CheckoutModal/Convert/ConvertSelectSourceStep.d.ts +18 -0
  54. package/dist/modals/CheckoutModal/Convert/ConvertStep.d.ts +4 -2
  55. package/dist/modals/CheckoutModal/FunCheckoutStep.d.ts +2 -0
  56. package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +5 -3
  57. package/dist/modals/CheckoutModal/Withdrawal/WithdrawalComplete.d.ts +5 -2
  58. package/dist/modals/CheckoutModal/Withdrawal/WithdrawalEnterAmount.d.ts +4 -2
  59. package/dist/modals/CheckoutModal/stepTransition.d.ts +6 -0
  60. package/dist/modals/CheckoutModal/stepTransition.shared.d.ts +0 -1
  61. package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +15 -4
  62. package/dist/modals/WithdrawalModal/WithdrawalContent.d.ts +7 -7
  63. package/dist/modals/WithdrawalModal/useMultiSourceWithdrawal.d.ts +41 -0
  64. package/dist/providers/ConvertProvider.d.ts +40 -0
  65. package/dist/providers/FunkitCheckoutContext/index.d.ts +2 -2
  66. package/dist/providers/FunkitCheckoutContext/types.d.ts +36 -2
  67. package/dist/shadow-css.js +1 -1
  68. package/dist/utils/withdrawal.d.ts +28 -1
  69. package/dist/wallets/multiSourceWithdrawal.d.ts +36 -0
  70. package/dist/wallets/walletConnectors/index.js +45 -45
  71. package/package.json +5 -5
  72. package/dist/hooks/useConvertInputAmount.d.ts +0 -26
  73. package/dist/hooks/useConvertMaxAmount.d.ts +0 -11
  74. package/dist/hooks/usePrepareConvertSubmit.d.ts +0 -22
  75. /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,88 +1,88 @@
1
1
  "use client";
2
+ import {
3
+ tokenaryWallet
4
+ } from "./chunk-TPM5PUJD.js";
2
5
  import {
3
6
  zealWallet
4
7
  } from "./chunk-GLX5FULK.js";
5
8
  import {
6
9
  zerionWallet
7
10
  } from "./chunk-34B7OJNT.js";
8
- import {
9
- walletConnectWallet
10
- } from "./chunk-DUX4XCDV.js";
11
- import {
12
- subWallet
13
- } from "./chunk-XODA5ESL.js";
14
11
  import {
15
12
  tahoWallet
16
13
  } from "./chunk-U74RFZOL.js";
17
14
  import {
18
15
  talismanWallet
19
16
  } from "./chunk-IAYYWCVB.js";
17
+ import {
18
+ safepalWallet
19
+ } from "./chunk-BBB2J3US.js";
20
20
  import {
21
21
  tokenPocketWallet
22
22
  } from "./chunk-NXWG6FG2.js";
23
- import {
24
- tokenaryWallet
25
- } from "./chunk-TPM5PUJD.js";
26
- import {
27
- trustWallet
28
- } from "./chunk-SR5CZR3L.js";
29
23
  import {
30
24
  uniswapWallet
31
25
  } from "./chunk-UNDWHCDH.js";
26
+ import {
27
+ walletConnectWallet
28
+ } from "./chunk-DUX4XCDV.js";
32
29
  import {
33
30
  xdefiWallet
34
31
  } from "./chunk-HXX4PRE2.js";
32
+ import {
33
+ trustWallet
34
+ } from "./chunk-SR5CZR3L.js";
35
+ import {
36
+ rabbyWallet
37
+ } from "./chunk-RQ2GXOJL.js";
38
+ import {
39
+ omniWallet
40
+ } from "./chunk-2TAUCVX7.js";
35
41
  import {
36
42
  rainbowWallet
37
43
  } from "./chunk-ZSSSLFQF.js";
38
- import {
39
- oneKeyWallet
40
- } from "./chunk-KN32ITJ7.js";
41
44
  import {
42
45
  ramperWallet
43
46
  } from "./chunk-GPXIBTWN.js";
44
- import {
45
- rabbyWallet
46
- } from "./chunk-RQ2GXOJL.js";
47
- import {
48
- roninWallet
49
- } from "./chunk-IA5432IR.js";
50
47
  import {
51
48
  safeWallet
52
49
  } from "./chunk-IR3PJMVM.js";
53
50
  import {
54
- safepalWallet
55
- } from "./chunk-BBB2J3US.js";
51
+ roninWallet
52
+ } from "./chunk-IA5432IR.js";
56
53
  import {
57
54
  safeheronWallet
58
55
  } from "./chunk-UN3ONVNC.js";
56
+ import {
57
+ subWallet
58
+ } from "./chunk-XODA5ESL.js";
59
+ import {
60
+ metaMaskWallet
61
+ } from "./chunk-RXRYHMRI.js";
62
+ import {
63
+ oktoWallet
64
+ } from "./chunk-V4M3SNPS.js";
59
65
  import {
60
66
  mewWallet
61
67
  } from "./chunk-DSPQXAB2.js";
62
68
  import {
63
69
  ledgerWallet
64
70
  } from "./chunk-BL4OC2EJ.js";
65
- import {
66
- metaMaskWallet
67
- } from "./chunk-RXRYHMRI.js";
68
71
  import {
69
72
  okxWallet
70
73
  } from "./chunk-CU5J53XR.js";
71
- import {
72
- oktoWallet
73
- } from "./chunk-V4M3SNPS.js";
74
- import {
75
- omniWallet
76
- } from "./chunk-2TAUCVX7.js";
77
74
  import {
78
75
  oneInchWallet
79
76
  } from "./chunk-GFS2AVAH.js";
77
+ import {
78
+ oneKeyWallet
79
+ } from "./chunk-KN32ITJ7.js";
80
80
  import {
81
81
  phantomWallet
82
82
  } from "./chunk-Q27YVDDH.js";
83
83
  import {
84
- enkryptWallet
85
- } from "./chunk-Z6LDN2AN.js";
84
+ customWallet
85
+ } from "./chunk-VKM5M5UK.js";
86
86
  import {
87
87
  foxWallet
88
88
  } from "./chunk-U52QO5HF.js";
@@ -119,37 +119,37 @@ import {
119
119
  import {
120
120
  coreWallet
121
121
  } from "./chunk-TRZDAXCQ.js";
122
+ import {
123
+ desigWallet
124
+ } from "./chunk-DFHP75HV.js";
122
125
  import {
123
126
  dawnWallet
124
127
  } from "./chunk-LV6YV3DE.js";
125
128
  import {
126
- customWallet
127
- } from "./chunk-VKM5M5UK.js";
128
- import {
129
- desigWallet
130
- } from "./chunk-DFHP75HV.js";
129
+ enkryptWallet
130
+ } from "./chunk-Z6LDN2AN.js";
131
131
  import {
132
132
  argentWallet
133
133
  } from "./chunk-XSDTNMQY.js";
134
134
  import {
135
135
  bifrostWallet
136
136
  } from "./chunk-ALGPGI6V.js";
137
- import {
138
- bitgetWallet
139
- } from "./chunk-HOCKAU5H.js";
140
137
  import {
141
138
  bitverseWallet
142
139
  } from "./chunk-5AEWIKRA.js";
140
+ import {
141
+ bitgetWallet
142
+ } from "./chunk-HOCKAU5H.js";
143
143
  import {
144
144
  bloomWallet
145
145
  } from "./chunk-PNHDOC77.js";
146
146
  import "./chunk-AALSJCUR.js";
147
- import {
148
- braveWallet
149
- } from "./chunk-U2XXV45G.js";
150
147
  import {
151
148
  bitskiWallet
152
149
  } from "./chunk-NPITCCJE.js";
150
+ import {
151
+ braveWallet
152
+ } from "./chunk-U2XXV45G.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.1",
4
4
  "description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
5
5
  "files": [
6
6
  "dist",
@@ -119,11 +119,11 @@
119
119
  "ua-parser-js": "^1.0.37",
120
120
  "use-debounce": "^10.0.5",
121
121
  "uuid": "^11.1.1",
122
- "@funkit/api-base": "9.1.0",
123
- "@funkit/connect-core": "10.0.0",
122
+ "@funkit/api-base": "9.1.1",
123
+ "@funkit/chains": "2.6.0",
124
+ "@funkit/connect-core": "10.0.1",
124
125
  "@funkit/utils": "5.1.0",
125
- "@funkit/fun-relay": "3.2.0",
126
- "@funkit/chains": "2.6.0"
126
+ "@funkit/fun-relay": "3.2.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 {};