@funkit/connect 9.25.0 → 9.26.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 (30) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/clients/{chunk-7G3QEQFB.js → chunk-2NBYHUIW.js} +1 -1
  3. package/dist/clients/{chunk-SQ2RX7WY.js → chunk-4IWQ2UT5.js} +11 -8
  4. package/dist/clients/{chunk-VJZW3MA3.js → chunk-F4SCUKY6.js} +1 -1
  5. package/dist/clients/{chunk-7UIDHSYG.js → chunk-LUHEVXPD.js} +1 -8
  6. package/dist/clients/chunk-STLOQEN7.js +11 -0
  7. package/dist/clients/chunk-UPZNKPYU.js +27 -0
  8. package/dist/clients/{chunk-MXPZTW2H.js → chunk-VT3ERWXE.js} +4 -2
  9. package/dist/clients/fanatics.js +5 -3
  10. package/dist/clients/lighter.js +7 -4
  11. package/dist/clients/mallard.d.ts +43 -1
  12. package/dist/clients/mallard.js +112 -3
  13. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +7 -5
  14. package/dist/clients/polymarket/createPolymarketDepositConfig.js +2 -2
  15. package/dist/clients/polymarket/index.js +7 -5
  16. package/dist/clients/polymarket/polymarket.js +1 -1
  17. package/dist/domains/clientMetadata.d.ts +21 -0
  18. package/dist/index.js +567 -242
  19. package/dist/modals/CheckoutModal/SourceChange/FormOfPaymentsList.d.ts +1 -1
  20. package/dist/modals/CheckoutModal/SourceChange/buildSourceGroups.d.ts +2 -2
  21. package/dist/modals/WithdrawalModal/RecipientAddress.d.ts +12 -0
  22. package/dist/modals/WithdrawalModal/WithdrawalSwappedIframeController.d.ts +3 -1
  23. package/dist/modals/WithdrawalModal/useFiatWithdrawal.d.ts +40 -0
  24. package/dist/modals/WithdrawalModal/useWithdrawal.d.ts +2 -2
  25. package/dist/providers/FunkitCheckoutContext/types.d.ts +18 -0
  26. package/dist/utils/swappedRouteOverride.d.ts +27 -0
  27. package/dist/wagmi/actions.d.ts +1 -1
  28. package/dist/wallets/walletConnectors/index.js +26 -26
  29. package/package.json +3 -3
  30. /package/dist/clients/{chunk-ME4OAQIY.js → chunk-O5CTDT3L.js} +0 -0
@@ -11,7 +11,7 @@ interface FormOfPaymentsListProps {
11
11
  }
12
12
  interface FormOfPaymentSection {
13
13
  items: SwappedFormOfPayment[];
14
- labelKey: 'sourceChange.mostPopular' | 'sourceChange.savedPaymentMethods' | 'sourceChange.moreOptions' | 'sourceChange.otherOptions';
14
+ labelKey: 'sourceChange.mostPopular' | 'sourceChange.savedPaymentMethods' | 'sourceChange.moreOptions';
15
15
  }
16
16
  export declare function getFormOfPaymentSections(fopsData: GetFopsResponse, fopPriority: readonly string[]): {
17
17
  primary: FormOfPaymentSection;
@@ -51,8 +51,8 @@ export type BuildSourceGroupsResult = {
51
51
  * `<PayPal />` as the flat footer.)
52
52
  * - `isSwappedEnabled=true` → grouped layout. Same two groups, but
53
53
  * rendered in separate boxes with `showLabels` toggling the section
54
- * headers ("Connected" / "Most popular" / "Other options"). The
55
- * "Other options" header is suppressed when no preferred group
54
+ * headers ("Connected" / "Most popular" / "More options"). The
55
+ * "More options" header is suppressed when no preferred group
56
56
  * precedes it.
57
57
  *
58
58
  * **Aave branch** (per Figma, [ENG-3743](https://linear.app/funxyz/issue/ENG-3743)
@@ -1,5 +1,17 @@
1
1
  import React from 'react';
2
2
  import type { FunkitWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
3
+ /**
4
+ * Whether to offer the "Use connected wallet" recipient shortcut: shown when a
5
+ * wallet is connected and the integrator hasn't set `disableConnectedWallet`.
6
+ * Independent of the withdrawal source address — for connected-wallet
7
+ * withdrawals (e.g. Mallard) the source IS the connected wallet, and
8
+ * withdrawing to it on the destination chain is valid.
9
+ */
10
+ export declare function shouldShowUseConnectedWallet({ disableConnectedWallet, isConnected, connectedWalletAddress, }: {
11
+ disableConnectedWallet: boolean | undefined;
12
+ isConnected: boolean;
13
+ connectedWalletAddress: string | undefined;
14
+ }): boolean;
3
15
  export declare function WithdrawRecipientAddress({ config, recipientAddress, setRecipientAddress, selectedChainId, selectedToken, isValidAddress, isRiskyAddress, }: {
4
16
  config: FunkitWithdrawalConfig;
5
17
  recipientAddress: string;
@@ -1,11 +1,13 @@
1
1
  import type { SwappedFormOfPayment } from '@funkit/api-base';
2
2
  import React from 'react';
3
+ import type { CustomWithdrawalConfig, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
3
4
  interface WithdrawalSwappedIframeControllerProps {
4
5
  selectedFop: SwappedFormOfPayment;
6
+ activeConfig: WalletWithdrawalConfig | CustomWithdrawalConfig;
5
7
  isError: boolean;
6
8
  onError: () => void;
7
9
  onBack: () => void;
8
10
  onClose: () => void;
9
11
  }
10
- export declare function WithdrawalSwappedIframeController({ selectedFop, isError, onError, onBack, onClose, }: WithdrawalSwappedIframeControllerProps): React.JSX.Element;
12
+ export declare function WithdrawalSwappedIframeController({ selectedFop, activeConfig, isError, onError, onBack, onClose, }: WithdrawalSwappedIframeControllerProps): React.JSX.Element;
11
13
  export {};
@@ -0,0 +1,40 @@
1
+ import { type Address } from 'viem';
2
+ import { type CustomWithdrawalConfig, type FunkitActiveWithdrawalItem, type WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
3
+ /**
4
+ * Provider-agnostic fiat off-ramp order: deliver `amount` of the accepted
5
+ * token to `destinationAddress`. The Swapped controller maps its order payload
6
+ * onto this shape.
7
+ */
8
+ export interface FiatWithdrawalOrder {
9
+ orderId: string;
10
+ destinationAddress: Address;
11
+ /** Amount (human units) of the target/accepted token the provider expects. */
12
+ amount: string;
13
+ /**
14
+ * Provider-reported accepted asset, by name (e.g. `'USDC'` / `'base'`).
15
+ * Informational only — surfaced in the route-decision log for reconciliation,
16
+ * never used to determine routing (routing comes from config + the Statsig
17
+ * source override).
18
+ */
19
+ providerCrypto?: string;
20
+ providerNetwork?: string;
21
+ }
22
+ interface UseFiatWithdrawalParams {
23
+ config: WalletWithdrawalConfig | CustomWithdrawalConfig;
24
+ withdrawalItem: FunkitActiveWithdrawalItem | null;
25
+ /** Invoked for unrecoverable failures (the caller tears down the flow). */
26
+ onError: () => void;
27
+ }
28
+ /**
29
+ * Owns the order → quote → execute pipeline for a fiat off-ramp withdrawal,
30
+ * keeping the iframe controller a thin lifecycle/dispatch shell.
31
+ *
32
+ * Quoting is **EXACT_OUT** — the provider credits fiat on the exact deposited
33
+ * amount, so we deliver exactly what it expects. Execution itself is delegated
34
+ * to {@link useWithdrawal}, which owns preWithdrawalAction + confirmCheckout +
35
+ * error mapping.
36
+ */
37
+ export declare function useFiatWithdrawal({ config, withdrawalItem, onError, }: UseFiatWithdrawalParams): {
38
+ processOrder: (order: FiatWithdrawalOrder) => Promise<void>;
39
+ };
40
+ export {};
@@ -3,7 +3,7 @@ import { type CheckoutConfirmationError } from '../../domains/checkoutErrors';
3
3
  import type { FunkitCheckoutQuoteResult } from '../../domains/quote';
4
4
  import { type FunkitActiveWithdrawalItem, type FunkitWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
5
5
  interface UseWithdrawalResult {
6
- handleWithdrawal: (withdrawal: WithdrawalFormData) => Promise<void>;
6
+ handleWithdrawal: (withdrawal: WithdrawalFormData) => Promise<Hex | null>;
7
7
  isWithdrawing: boolean;
8
8
  withdrawalError: CheckoutConfirmationError | null;
9
9
  stepMessage: string | null;
@@ -22,6 +22,6 @@ export type WithdrawalFormData = {
22
22
  export declare function useWithdrawal({ config, withdrawalItem, onSuccess, }: {
23
23
  config: FunkitWithdrawalConfig;
24
24
  withdrawalItem: FunkitActiveWithdrawalItem | null;
25
- onSuccess: (withdrawal: WithdrawalFormData, txHash: Hex) => void;
25
+ onSuccess?: (withdrawal: WithdrawalFormData, txHash: Hex) => void;
26
26
  }): UseWithdrawalResult;
27
27
  export {};
@@ -257,6 +257,24 @@ export interface WalletWithdrawalConfig extends WithdrawalConfigBase {
257
257
  * by virtue of living on a different config variant.
258
258
  */
259
259
  preWithdrawalAction?: (param: WithdrawalParam) => Promise<WithdrawalTransaction[]>;
260
+ /**
261
+ * Token that Swapped accepts for fiat withdrawal. When set and differs from
262
+ * {@link WithdrawalConfigBase.sourceTokenAddress}, the Swapped controller
263
+ * fetches a Relay quote to swap the source token into this token before
264
+ * sending to Swapped's deposit address.
265
+ */
266
+ swappedTargetTokenAddress?: Address;
267
+ /**
268
+ * Chain ID for the Swapped target token. Defaults to
269
+ * {@link WithdrawalConfigBase.sourceChainId} when omitted.
270
+ */
271
+ swappedTargetChainId?: string;
272
+ /**
273
+ * Symbol of the Swapped target token (e.g. 'USDC'). Recorded against the
274
+ * on-chain movement, which is denominated in the target — not the source —
275
+ * token. Defaults to {@link WithdrawalConfigBase.sourceTokenSymbol}.
276
+ */
277
+ swappedTargetTokenSymbol?: string;
260
278
  }
261
279
  export interface CustomWithdrawalConfig extends WithdrawalConfigBase {
262
280
  /**
@@ -0,0 +1,27 @@
1
+ import type { Address } from 'viem';
2
+ /**
3
+ * Operator override (Statsig `swappedwithdrawalsourceoverrides`) pinning a
4
+ * Swapped withdrawal to a known-good accepted asset, keyed on the source asset,
5
+ * for when the config's requested target isn't supported by Swapped. `when`
6
+ * matches the source; `use` is the target the Relay quote delivers.
7
+ */
8
+ export interface SwappedSourceRouteOverride {
9
+ when: {
10
+ chainId: string;
11
+ tokenAddress: string;
12
+ };
13
+ use: {
14
+ chainId: string;
15
+ tokenAddress: Address;
16
+ symbol: string;
17
+ };
18
+ }
19
+ /**
20
+ * First well-formed override whose `when` matches the source asset, or
21
+ * `undefined`. First match wins so ops can order more specific rules ahead of
22
+ * broader ones.
23
+ */
24
+ export declare function findSwappedSourceOverride(overrides: readonly SwappedSourceRouteOverride[] | undefined, source: {
25
+ chainId: string;
26
+ tokenAddress: string;
27
+ }): SwappedSourceRouteOverride | undefined;
@@ -1,6 +1,6 @@
1
1
  import type { Config } from 'wagmi';
2
2
  import { type GetBalanceParameters, type GetBalanceReturnType } from 'wagmi/actions';
3
- export { estimateGas, getGasPrice, getTransaction, getWalletClient, multicall, readContract, waitForTransactionReceipt, } from 'wagmi/actions';
3
+ export { estimateGas, getAccount, getGasPrice, getTransaction, getWalletClient, multicall, readContract, sendTransaction, switchChain, waitForTransactionReceipt, } from 'wagmi/actions';
4
4
  export type GetBalanceReturnTypeCompat = GetBalanceReturnType & {
5
5
  formatted: string;
6
6
  };
@@ -42,20 +42,23 @@ import {
42
42
  roninWallet
43
43
  } from "./chunk-VAPGUPHO.js";
44
44
  import {
45
- safeheronWallet
46
- } from "./chunk-76S7R2ND.js";
45
+ safeWallet
46
+ } from "./chunk-RCY66YHF.js";
47
47
  import {
48
48
  safepalWallet
49
49
  } from "./chunk-VTM6EECM.js";
50
50
  import {
51
- safeWallet
52
- } from "./chunk-RCY66YHF.js";
51
+ safeheronWallet
52
+ } from "./chunk-76S7R2ND.js";
53
53
  import {
54
54
  subWallet
55
55
  } from "./chunk-X6CGV36L.js";
56
56
  import {
57
57
  metaMaskWallet
58
58
  } from "./chunk-CCQV2ZET.js";
59
+ import {
60
+ mewWallet
61
+ } from "./chunk-MQM45ADF.js";
59
62
  import {
60
63
  oktoWallet
61
64
  } from "./chunk-YWOVAU6O.js";
@@ -68,9 +71,6 @@ import {
68
71
  import {
69
72
  oneInchWallet
70
73
  } from "./chunk-QG6ZHI7B.js";
71
- import {
72
- mewWallet
73
- } from "./chunk-MQM45ADF.js";
74
74
  import {
75
75
  oneKeyWallet
76
76
  } from "./chunk-WVT6BBJH.js";
@@ -80,12 +80,12 @@ import {
80
80
  import {
81
81
  foxWallet
82
82
  } from "./chunk-MIQTHJ6X.js";
83
- import {
84
- frontierWallet
85
- } from "./chunk-YEZM4CK4.js";
86
83
  import {
87
84
  frameWallet
88
85
  } from "./chunk-BU3ZAT5X.js";
86
+ import {
87
+ frontierWallet
88
+ } from "./chunk-YEZM4CK4.js";
89
89
  import {
90
90
  gateWallet
91
91
  } from "./chunk-HNRB7KJU.js";
@@ -95,42 +95,42 @@ import {
95
95
  import {
96
96
  injectedWallet
97
97
  } from "./chunk-T6LGKC3F.js";
98
- import {
99
- ledgerWallet
100
- } from "./chunk-RPV27V2Y.js";
101
98
  import {
102
99
  kresusWallet
103
100
  } from "./chunk-RICTB3FA.js";
104
101
  import {
105
- braveWallet
106
- } from "./chunk-DS73TZ6O.js";
102
+ ledgerWallet
103
+ } from "./chunk-RPV27V2Y.js";
104
+ import {
105
+ clvWallet
106
+ } from "./chunk-UK7C2JXW.js";
107
107
  import {
108
108
  coin98Wallet
109
109
  } from "./chunk-6BW3HLBG.js";
110
- import {
111
- bloomWallet
112
- } from "./chunk-PJ7Y57EH.js";
113
110
  import {
114
111
  coinbaseWallet
115
112
  } from "./chunk-2DLDAZRH.js";
116
113
  import {
117
- coreWallet
118
- } from "./chunk-RB3HR4R2.js";
114
+ braveWallet
115
+ } from "./chunk-DS73TZ6O.js";
119
116
  import {
120
117
  dawnWallet
121
118
  } from "./chunk-G2PHTVL6.js";
119
+ import {
120
+ coreWallet
121
+ } from "./chunk-RB3HR4R2.js";
122
122
  import {
123
123
  desigWallet
124
124
  } from "./chunk-FW3WZETT.js";
125
125
  import {
126
126
  enkryptWallet
127
127
  } from "./chunk-HBQK5RD5.js";
128
- import {
129
- argentWallet
130
- } from "./chunk-NTMBEOR2.js";
131
128
  import {
132
129
  bifrostWallet
133
130
  } from "./chunk-4T6ZSRJF.js";
131
+ import {
132
+ argentWallet
133
+ } from "./chunk-NTMBEOR2.js";
134
134
  import {
135
135
  bitgetWallet
136
136
  } from "./chunk-CPI4TD43.js";
@@ -140,12 +140,12 @@ import {
140
140
  import {
141
141
  bitverseWallet
142
142
  } from "./chunk-NSK6A7TI.js";
143
+ import {
144
+ bloomWallet
145
+ } from "./chunk-PJ7Y57EH.js";
143
146
  import {
144
147
  bybitWallet
145
148
  } from "./chunk-F5XEEVG6.js";
146
- import {
147
- clvWallet
148
- } from "./chunk-UK7C2JXW.js";
149
149
  import "./chunk-OLZ7626J.js";
150
150
  import "./chunk-N4IJLYFY.js";
151
151
  import "./chunk-IGKXZBTA.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect",
3
- "version": "9.25.0",
3
+ "version": "9.26.0",
4
4
  "description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
5
5
  "files": [
6
6
  "dist",
@@ -113,8 +113,8 @@
113
113
  "uuid": "^11.1.1",
114
114
  "@funkit/api-base": "5.0.0",
115
115
  "@funkit/chains": "2.1.1",
116
- "@funkit/connect-core": "1.3.0",
117
- "@funkit/fun-relay": "2.8.4",
116
+ "@funkit/connect-core": "1.4.0",
117
+ "@funkit/fun-relay": "2.8.5",
118
118
  "@funkit/utils": "3.1.0"
119
119
  },
120
120
  "repository": {