@funkit/connect 10.3.0 → 10.4.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 (52) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/clients/chunk-2YWQL3AO.js +46 -0
  3. package/dist/clients/chunk-APQYFP6X.js +207 -0
  4. package/dist/clients/chunk-BNMZM23Q.js +42 -0
  5. package/dist/clients/chunk-II5CZTBC.js +18 -0
  6. package/dist/clients/chunk-KNHO756P.js +28 -0
  7. package/dist/clients/chunk-L2KSNS7H.js +112 -0
  8. package/dist/clients/{chunk-3STGJU6Z.js → chunk-M6C7MBQN.js} +1 -1
  9. package/dist/clients/chunk-OZ3KD24N.js +107 -0
  10. package/dist/clients/{chunk-RWCJ4XGX.js → chunk-RCMAGKMG.js} +30 -1
  11. package/dist/clients/internal/nado/consts.d.ts +16 -0
  12. package/dist/clients/internal/nado/consts.js +13 -0
  13. package/dist/clients/internal/nado/encoding.d.ts +22 -0
  14. package/dist/clients/internal/nado/encoding.js +32 -0
  15. package/dist/clients/internal/nado/errors.d.ts +55 -0
  16. package/dist/clients/internal/nado/errors.js +15 -0
  17. package/dist/clients/internal/nado/fetch.d.ts +15 -0
  18. package/dist/clients/internal/nado/fetch.js +9 -0
  19. package/dist/clients/internal/nado/gateway.d.ts +83 -0
  20. package/dist/clients/internal/nado/gateway.js +23 -0
  21. package/dist/clients/internal/nado/hooks.d.ts +360 -0
  22. package/dist/clients/internal/nado/hooks.js +132 -0
  23. package/dist/clients/internal/nado/indexer.d.ts +43 -0
  24. package/dist/clients/internal/nado/indexer.js +13 -0
  25. package/dist/clients/internal/nado/products.d.ts +36 -0
  26. package/dist/clients/internal/nado/products.js +19 -0
  27. package/dist/clients/internal/nado/typedData.d.ts +80 -0
  28. package/dist/clients/internal/nado/typedData.js +43 -0
  29. package/dist/clients/lighter.js +117 -40
  30. package/dist/clients/mallard.js +8 -23
  31. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +2 -2
  32. package/dist/clients/polymarket/index.js +2 -2
  33. package/dist/components/ChainIcon/ChainIcon.d.ts +16 -0
  34. package/dist/components/FreeUsdcBanner/FreeUsdcBanner.d.ts +1 -1
  35. package/dist/components/FunAssetAvatar/FunAssetAvatar.d.ts +1 -2
  36. package/dist/hooks/useChainMetadata.d.ts +11 -0
  37. package/dist/hooks/usePaymentMethodTabs.d.ts +8 -2
  38. package/dist/hooks/useSwappedIframeLifecycle.d.ts +5 -2
  39. package/dist/hooks/useSwappedPreload.d.ts +7 -11
  40. package/dist/hooks/useUserIpInfo.d.ts +1 -19
  41. package/dist/index.js +2710 -2638
  42. package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +3 -0
  43. package/dist/modals/CheckoutModal/SwappedIframe/SwappedIframe.d.ts +4 -1
  44. package/dist/modals/CheckoutModal/SwappedIframe/SwappedIframeController.d.ts +3 -0
  45. package/dist/modals/CheckoutModal/isWithdrawalStep.d.ts +3 -2
  46. package/dist/providers/FunkitCheckoutContext/types.d.ts +34 -13
  47. package/dist/providers/FunkitConfigContext.d.ts +4 -0
  48. package/dist/providers/SwappedProvider.d.ts +5 -3
  49. package/dist/utils/tokenIconUrl.d.ts +5 -0
  50. package/dist/wallets/walletConnectors/index.js +28 -28
  51. package/package.json +3 -2
  52. package/dist/hooks/useSkipSwappedPreload.d.ts +0 -7
@@ -6,6 +6,7 @@ import type { FunkitCheckoutQuoteResult } from '../../../domains/quote';
6
6
  import { type PaymentMethodType } from '../../../hooks/usePaymentSources';
7
7
  import { type CustomWithdrawalConfig, type WalletWithdrawalConfig } from '../../../providers/FunkitCheckoutContext';
8
8
  import { type CheckoutModalCommonState, FunCheckoutStep, type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
9
+ import type { SwappedMode } from '../../../providers/SwappedProvider';
9
10
  export type SourceChangeState = CheckoutModalCommonState & {
10
11
  paymentMethodInfo: ConnectablePaymentMethodInfo | null;
11
12
  /** Persisted payment method type filter (crypto/fiat tab) */
@@ -56,6 +57,8 @@ export type SourceChangeNext = {
56
57
  selectedPaymentOption: SwappedFormOfPayment;
57
58
  /** Payment method type filter to restore when returning */
58
59
  paymentMethodTypeFilter: PaymentMethodType;
60
+ /** Slot/origin for the shared Swapped iframe step */
61
+ swappedMode: SwappedMode;
59
62
  } | {
60
63
  /**
61
64
  * Skip the asset-select screen; land on InputAmount with the
@@ -1,3 +1,6 @@
1
1
  import React from 'react';
2
- declare const _default: React.MemoExoticComponent<() => React.JSX.Element | null>;
2
+ import { type SwappedMode } from '../../../providers/SwappedProvider';
3
+ declare const _default: React.MemoExoticComponent<({ mode }: {
4
+ mode: SwappedMode;
5
+ }) => React.JSX.Element | null>;
3
6
  export default _default;
@@ -2,11 +2,14 @@ import type { SwappedFormOfPayment } from '@funkit/api-base';
2
2
  import React from 'react';
3
3
  import type { PaymentMethodType } from '../../../hooks/usePaymentSources';
4
4
  import { type CheckoutModalCommonState, FunCheckoutStep, type ModalStepComponentProps, type ModalStepInfo } from '../../../modals/CheckoutModal/stepTransition';
5
+ import { type SwappedMode } from '../../../providers/SwappedProvider';
5
6
  export type SwappedIframeState = CheckoutModalCommonState & {
6
7
  /** The selected payment option from the fops API */
7
8
  selectedPaymentOption: SwappedFormOfPayment;
8
9
  /** Payment method type filter to restore when returning to SOURCE_CHANGE */
9
10
  paymentMethodTypeFilter?: PaymentMethodType;
11
+ /** Slot/origin for the shared Swapped iframe step */
12
+ swappedMode: SwappedMode;
10
13
  /** Set to true when an error occurs (iframe error or load timeout) */
11
14
  error?: boolean;
12
15
  };
@@ -8,8 +8,9 @@ type WithdrawalStep = FunCheckoutStep.WITHDRAWAL_ENTER_AMOUNT | FunCheckoutStep.
8
8
  * checkout↔withdrawal lifecycle effect keys off this.
9
9
  *
10
10
  * - Dedicated withdrawal steps (enter-amount, complete) always qualify.
11
- * - The Withdraw tab on SourceChange qualifies while active — it surfaces
12
- * withdrawal-mode UI before advancing to a dedicated step.
11
+ * - The Withdraw tab on SourceChange qualifies only once its `withdrawalConfig`
12
+ * is seeded: the swapped chooser tab leaves it undefined, so a mere tab visit
13
+ * must not hijack deposit query authority into withdrawal mode.
13
14
  *
14
15
  * Narrows to the states that carry `withdrawalConfig`, so callers can read it
15
16
  * without re-checking the step. Adding a new withdrawal screen? Add its step
@@ -381,17 +381,10 @@ export type FunkitCheckoutResult = {
381
381
  message: string;
382
382
  metadata: object | Error;
383
383
  };
384
- export interface UseFunkitCheckoutProps {
384
+ /** Props common to every checkout, regardless of form factor. */
385
+ interface UseFunkitCheckoutBaseProps {
385
386
  /** @optional the checkout config object **/
386
387
  config?: FunkitCheckoutConfig;
387
- /**
388
- * @optional withdrawal config for the unified cashier flow. When provided,
389
- * the checkout modal's withdraw tab can enter the in-modal withdrawal flow.
390
- * TODO(cashier): the final wiring PR formalizes resolution (multi-method,
391
- * per-source); for now a single- or multi-method config is accepted and the
392
- * first method is used as the default.
393
- */
394
- withdrawalConfig?: FunkitWithdrawalConfig;
395
388
  /** @optional fires when the checkout modal is opened **/
396
389
  onOpen?: () => void;
397
390
  /** @optional fires when the checkout modal is closed **/
@@ -415,18 +408,46 @@ export interface UseFunkitCheckoutProps {
415
408
  onLoginRequired?: ({ onLoginFinished, }: {
416
409
  onLoginFinished?: () => void;
417
410
  }) => void;
418
- /** @optional fires when a withdrawal is confirmed with the funkit server. Returns the newly created withdrawalId. **/
419
- onWithdrawalConfirmation?: (withdrawalId: string) => void;
420
411
  /** @optional fires when checkout is blocked (e.g. geo-restriction, security hold, or missing wallet connection). **/
421
412
  onCheckoutBlocked?: (params: {
422
413
  blockedReason: CheckoutBlockedReason;
423
414
  }) => void;
415
+ }
416
+ /**
417
+ * Cashier form factor: the withdraw tab is explicitly requested. The coupling
418
+ * is compile-time — `withdrawalConfig` is required, so cashier intent can never
419
+ * be confused with a dropped config, and withdrawal callbacks are permitted
420
+ * only here.
421
+ */
422
+ interface CashierFormFactorProps {
423
+ formFactor: 'cashier';
424
+ withdrawalConfig: FunkitWithdrawalConfig;
425
+ /** @optional fires when a withdrawal is confirmed with the funkit server. Returns the newly created withdrawalId. **/
426
+ onWithdrawalConfirmation?: (withdrawalId: string) => void;
424
427
  /** @optional fires if the withdrawal fails at any point **/
425
428
  onWithdrawalError?: (result: FunkitCheckoutResult) => void;
426
429
  }
427
- /** Ensures that config is defined */
428
- export interface UseFunkitCheckoutPropsWithFullConfig extends UseFunkitCheckoutProps {
430
+ /** Default checkout form factor: no withdrawal wiring is permitted. */
431
+ interface CheckoutFormFactorProps {
432
+ formFactor?: 'checkout';
433
+ withdrawalConfig?: never;
434
+ onWithdrawalConfirmation?: never;
435
+ onWithdrawalError?: never;
436
+ }
437
+ export type UseFunkitCheckoutProps = UseFunkitCheckoutBaseProps & (CashierFormFactorProps | CheckoutFormFactorProps);
438
+ /**
439
+ * Resolved settings stored on the checkout item (config guaranteed). This is a
440
+ * structural superset of both public-prop union members — the `never`-typed
441
+ * withdrawal fields are relaxed — so internal rebuilds of `initSettings` don't
442
+ * fight the discriminant. The compile-time cashier↔withdrawalConfig coupling
443
+ * lives on the public `UseFunkitCheckoutProps` surface, which flows in here.
444
+ */
445
+ export interface UseFunkitCheckoutPropsWithFullConfig extends UseFunkitCheckoutBaseProps {
429
446
  config: FunkitCheckoutConfig;
447
+ formFactor?: 'cashier' | 'checkout';
448
+ withdrawalConfig?: FunkitWithdrawalConfig;
449
+ onWithdrawalConfirmation?: (withdrawalId: string) => void;
450
+ onWithdrawalError?: (result: FunkitCheckoutResult) => void;
430
451
  }
431
452
  /**
432
453
  * Checkout Item for frontend use
@@ -106,6 +106,8 @@ export interface FunkitUiCustomizationsConfig {
106
106
  simplifiedUi?: boolean;
107
107
  };
108
108
  confirmationScreen?: {
109
+ /** Whether to auto-expand the transaction breakdown once fees are loaded - defaults to false */
110
+ autoExpandFeesSummary?: boolean;
109
111
  /** Custom destination icon and text used in checkout summary */
110
112
  destinationConfig?: FunkitUiDestinationConfig;
111
113
  /** when source and destination are the same address, show destination as payment method instead of source - defaults to false */
@@ -168,6 +170,8 @@ export interface FunkitUiCustomizationsConfig {
168
170
  customTopComponent?: () => ReactNode;
169
171
  };
170
172
  withdrawalScreen?: {
173
+ /** Whether to auto-expand the transaction breakdown once fees are loaded - defaults to false */
174
+ autoExpandFeesSummary?: boolean;
171
175
  /** Function that returns a custom React component to render before other UIs in the withdrawal amount screen */
172
176
  customTopComponent?: () => ReactNode;
173
177
  };
@@ -2,7 +2,9 @@ import type { FormOfPaymentType } from '@funkit/api-base';
2
2
  import { type SwappedTransport } from '@funkit/connect-core';
3
3
  import React from 'react';
4
4
  import { type SwappedTheme } from '../utils/swapped';
5
- interface SwappedContextValue {
5
+ /** Deposit and withdrawal each own an independent Swapped iframe slot. */
6
+ export type SwappedMode = 'deposit' | 'withdrawal';
7
+ interface SwappedSlot {
6
8
  iframeUrl: string | null;
7
9
  isSwappedReady: boolean;
8
10
  isActive: boolean;
@@ -12,11 +14,11 @@ interface SwappedContextValue {
12
14
  resetIframe: () => void;
13
15
  setIframeRef: (el: HTMLIFrameElement | null) => void;
14
16
  focusAmountInput: () => void;
15
- swappedTheme: SwappedTheme;
16
17
  swappedTransport: SwappedTransport;
17
18
  }
18
19
  export declare function SwappedProvider({ children }: {
19
20
  children: React.ReactNode;
20
21
  }): React.JSX.Element;
21
- export declare function useSwappedContext(): SwappedContextValue;
22
+ export declare function useSwappedContext(mode: SwappedMode): SwappedSlot;
23
+ export declare function useSwappedTheme(): SwappedTheme;
22
24
  export {};
@@ -1,2 +1,7 @@
1
1
  import type { DynamicTargetAssetCandidate } from '../providers/FunkitCheckoutContext';
2
2
  export declare const getTokenIconUrl: (symbol: string, tokens?: DynamicTargetAssetCandidate[]) => string;
3
+ export declare function resolveAssetIconSrc({ assetTicker, assetSrc, prioritizeDefaults, }: {
4
+ assetTicker?: string;
5
+ assetSrc?: string;
6
+ prioritizeDefaults: boolean;
7
+ }): string | undefined;
@@ -8,27 +8,27 @@ import {
8
8
  import {
9
9
  tahoWallet
10
10
  } from "./chunk-7ZYCBDQ4.js";
11
- import {
12
- talismanWallet
13
- } from "./chunk-4DCO3TGL.js";
14
11
  import {
15
12
  tokenPocketWallet
16
13
  } from "./chunk-WKNQMP4A.js";
17
14
  import {
18
15
  tokenaryWallet
19
16
  } from "./chunk-VH3THHJY.js";
17
+ import {
18
+ talismanWallet
19
+ } from "./chunk-4DCO3TGL.js";
20
20
  import {
21
21
  trustWallet
22
22
  } from "./chunk-KCRO2AGO.js";
23
23
  import {
24
24
  uniswapWallet
25
25
  } from "./chunk-Z3PPW6NC.js";
26
- import {
27
- xdefiWallet
28
- } from "./chunk-JN5I3DNC.js";
29
26
  import {
30
27
  walletConnectWallet
31
28
  } from "./chunk-3FCWJRI4.js";
29
+ import {
30
+ xdefiWallet
31
+ } from "./chunk-JN5I3DNC.js";
32
32
  import {
33
33
  rabbyWallet
34
34
  } from "./chunk-RB66PKPA.js";
@@ -44,12 +44,12 @@ import {
44
44
  import {
45
45
  safeWallet
46
46
  } from "./chunk-RCY66YHF.js";
47
- import {
48
- safepalWallet
49
- } from "./chunk-XCNHV3HS.js";
50
47
  import {
51
48
  safeheronWallet
52
49
  } from "./chunk-76S7R2ND.js";
50
+ import {
51
+ safepalWallet
52
+ } from "./chunk-XCNHV3HS.js";
53
53
  import {
54
54
  subWallet
55
55
  } from "./chunk-NR2OGDHQ.js";
@@ -62,18 +62,18 @@ import {
62
62
  import {
63
63
  oktoWallet
64
64
  } from "./chunk-YWOVAU6O.js";
65
- import {
66
- okxWallet
67
- } from "./chunk-KI5Y2BBF.js";
68
65
  import {
69
66
  omniWallet
70
67
  } from "./chunk-2CX7LX4J.js";
71
68
  import {
72
- oneKeyWallet
73
- } from "./chunk-WVT6BBJH.js";
69
+ okxWallet
70
+ } from "./chunk-KI5Y2BBF.js";
74
71
  import {
75
72
  oneInchWallet
76
73
  } from "./chunk-QG6ZHI7B.js";
74
+ import {
75
+ oneKeyWallet
76
+ } from "./chunk-WVT6BBJH.js";
77
77
  import {
78
78
  phantomWallet
79
79
  } from "./chunk-QY53O7WG.js";
@@ -102,23 +102,20 @@ import {
102
102
  ledgerWallet
103
103
  } from "./chunk-RPV27V2Y.js";
104
104
  import {
105
- bybitWallet
106
- } from "./chunk-OX37G4YT.js";
107
- import {
108
- clvWallet
109
- } from "./chunk-OEEGYENV.js";
105
+ argentWallet
106
+ } from "./chunk-NTMBEOR2.js";
110
107
  import {
111
108
  coin98Wallet
112
109
  } from "./chunk-WAHGI5L7.js";
113
110
  import {
114
111
  coinbaseWallet
115
112
  } from "./chunk-2DLDAZRH.js";
113
+ import {
114
+ clvWallet
115
+ } from "./chunk-OEEGYENV.js";
116
116
  import {
117
117
  coreWallet
118
118
  } from "./chunk-4NV5BYRP.js";
119
- import {
120
- dawnWallet
121
- } from "./chunk-G2PHTVL6.js";
122
119
  import {
123
120
  desigWallet
124
121
  } from "./chunk-FW3WZETT.js";
@@ -126,27 +123,30 @@ import {
126
123
  enkryptWallet
127
124
  } from "./chunk-HBQK5RD5.js";
128
125
  import {
129
- argentWallet
130
- } from "./chunk-NTMBEOR2.js";
126
+ dawnWallet
127
+ } from "./chunk-G2PHTVL6.js";
131
128
  import {
132
129
  bifrostWallet
133
130
  } from "./chunk-IULPZP2Q.js";
134
- import {
135
- bitverseWallet
136
- } from "./chunk-NSK6A7TI.js";
137
131
  import {
138
132
  bitgetWallet
139
133
  } from "./chunk-TKB2OY6G.js";
134
+ import {
135
+ bitverseWallet
136
+ } from "./chunk-NSK6A7TI.js";
140
137
  import {
141
138
  bitskiWallet
142
139
  } from "./chunk-7HRFUZFX.js";
143
140
  import {
144
141
  bloomWallet
145
142
  } from "./chunk-PJ7Y57EH.js";
146
- import "./chunk-N4IJLYFY.js";
147
143
  import {
148
144
  braveWallet
149
145
  } from "./chunk-DS73TZ6O.js";
146
+ import {
147
+ bybitWallet
148
+ } from "./chunk-OX37G4YT.js";
149
+ import "./chunk-N4IJLYFY.js";
150
150
  import "./chunk-OLZ7626J.js";
151
151
  import "./chunk-IGKXZBTA.js";
152
152
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect",
3
- "version": "10.3.0",
3
+ "version": "10.4.0",
4
4
  "description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
5
5
  "files": [
6
6
  "dist",
@@ -13,6 +13,7 @@
13
13
  ".": "./dist/index.js",
14
14
  "./styles.css": "./dist/index.css",
15
15
  "./wallets": "./dist/wallets/walletConnectors/index.js",
16
+ "./clients/internal/*": null,
16
17
  "./clients/*": "./dist/clients/*.js",
17
18
  "./clients/polymarket": "./dist/clients/polymarket/index.js"
18
19
  },
@@ -108,7 +109,7 @@
108
109
  "uuid": "^11.1.1",
109
110
  "@funkit/api-base": "6.0.0",
110
111
  "@funkit/chains": "2.1.3",
111
- "@funkit/connect-core": "2.0.0",
112
+ "@funkit/connect-core": "2.1.0",
112
113
  "@funkit/fun-relay": "2.9.0",
113
114
  "@funkit/utils": "4.0.0"
114
115
  },
@@ -1,7 +0,0 @@
1
- /**
2
- * When true, useSwappedPreload is silenced — it won't call setIframeUrl.
3
- * SourceChange sets this around the leaving tab overlay during transitions
4
- * to prevent the leaving tab's preload from racing the active tab's.
5
- */
6
- export declare const SkipSwappedPreloadContext: import("react").Context<boolean>;
7
- export declare function useSkipSwappedPreload(): boolean;