@funkit/connect 10.6.0 → 11.0.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 (45) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/clients/chunk-2FSEE3AW.js +277 -0
  3. package/dist/clients/chunk-5MY7WMEJ.js +20 -0
  4. package/dist/clients/chunk-6CYZKITE.js +33 -0
  5. package/dist/clients/{chunk-TG2AACP2.js → chunk-C4SHJFOV.js} +2 -2
  6. package/dist/clients/{chunk-3LJQTM37.js → chunk-FNB7OPJI.js} +12 -198
  7. package/dist/clients/{chunk-2NBYHUIW.js → chunk-HZP4DXIZ.js} +1 -0
  8. package/dist/clients/{chunk-F6P4CN27.js → chunk-JD2J5K6S.js} +16 -8
  9. package/dist/clients/chunk-LT4EWLDA.js +30 -0
  10. package/dist/clients/chunk-MGQLVTSH.js +100 -0
  11. package/dist/clients/{chunk-FJ6GCMJ4.js → chunk-OODIKHYE.js} +3 -1
  12. package/dist/clients/chunk-SFDEST63.js +18 -0
  13. package/dist/clients/{chunk-OZ3KD24N.js → chunk-ZCCLJW6F.js} +0 -8
  14. package/dist/clients/fanatics.js +5 -6
  15. package/dist/clients/internal/nado/encoding.js +4 -25
  16. package/dist/clients/internal/nado/gateway.d.ts +0 -21
  17. package/dist/clients/internal/nado/gateway.js +1 -5
  18. package/dist/clients/internal/nado/hooks.d.ts +0 -158
  19. package/dist/clients/internal/nado/hooks.js +10 -121
  20. package/dist/clients/internal/nado/withdrawalConfig.js +3 -13
  21. package/dist/clients/internal/nado/withdrawalForm.css +17529 -0
  22. package/dist/clients/internal/nado/withdrawalForm.d.ts +41 -0
  23. package/dist/clients/internal/nado/withdrawalForm.js +283 -0
  24. package/dist/clients/internal/nado/withdrawalTypes.d.ts +7 -2
  25. package/dist/clients/lighter.d.ts +29 -1
  26. package/dist/clients/lighter.js +105 -99
  27. package/dist/clients/mallard.js +24 -3
  28. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +6 -3
  29. package/dist/clients/polymarket/index.js +6 -3
  30. package/dist/domains/swapped.d.ts +1 -10
  31. package/dist/hooks/useTokenAndChainDropdown.d.ts +8 -1
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.js +1369 -892
  34. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +20 -31
  35. package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +5 -9
  36. package/dist/providers/FunkitCheckoutContext/types.d.ts +61 -4
  37. package/dist/utils/customer.d.ts +349 -0
  38. package/dist/utils/withdrawal.d.ts +13 -6
  39. package/dist/wagmi/actions.d.ts +1 -1
  40. package/dist/wallets/Wallet.d.ts +21 -1
  41. package/dist/wallets/walletConnectors/index.js +11 -11
  42. package/package.json +3 -3
  43. package/dist/clients/chunk-A4WQS6QG.js +0 -207
  44. package/dist/clients/internal/nado/products.d.ts +0 -36
  45. package/dist/clients/internal/nado/products.js +0 -19
@@ -1,6 +1,6 @@
1
1
  import type { WalletConnectParameters } from '../wagmi/connectors';
2
2
  import type { Connector, CreateConnectorFn } from '../wagmi/hooks';
3
- import type { TransactionReceipt } from 'viem';
3
+ import type { TransactionReceipt, TypedDataDomain } from 'viem';
4
4
  import type { CoinbaseWalletOptions } from './walletConnectors/coinbaseWallet/coinbaseWallet';
5
5
  import type { WalletConnectWalletOptions } from './walletConnectors/walletConnectWallet/walletConnectWallet';
6
6
  export type InstructionStepName = 'install' | 'create' | 'scan' | 'connect' | 'refresh';
@@ -104,6 +104,16 @@ export type WithdrawalTransaction = {
104
104
  data: string;
105
105
  value: string;
106
106
  };
107
+ /** EIP-712 payload passed to {@link WithdrawalClient.signTypedData}. */
108
+ export type WithdrawalTypedData = {
109
+ domain: TypedDataDomain;
110
+ types: Record<string, readonly {
111
+ name: string;
112
+ type: string;
113
+ }[]>;
114
+ primaryType: string;
115
+ message: Record<string, unknown>;
116
+ };
107
117
  export interface WithdrawalClient {
108
118
  getChainId: () => Promise<number>;
109
119
  switchChain: (chainId: number) => Promise<void>;
@@ -121,6 +131,16 @@ export interface WithdrawalClient {
121
131
  sendTransactions?: (chainId: number, transactions: WithdrawalTransaction[]) => Promise<string>;
122
132
  confirmTransaction: (txHash: string, chainId: number) => Promise<TransactionReceipt>;
123
133
  address: () => string;
134
+ /**
135
+ * Optional signers for gasless relay routes (permit / EIP-3009), where Relay
136
+ * returns a signature step instead of a transaction. Implemented by
137
+ * connected-wallet clients (see `clients/mallard.tsx`).
138
+ */
139
+ signTypedData?: (typedData: WithdrawalTypedData) => Promise<string>;
140
+ /** 32-byte hashes arrive as `{ raw }` — sign as raw bytes. */
141
+ signMessage?: (message: string | {
142
+ raw: string;
143
+ }) => Promise<string>;
124
144
  }
125
145
  /**
126
146
  * WithdrawalClient variant for Lighter (LVM). Satisfies WithdrawalClient for
@@ -77,12 +77,12 @@ import {
77
77
  import {
78
78
  phantomWallet
79
79
  } from "./chunk-QY53O7WG.js";
80
- import {
81
- enkryptWallet
82
- } from "./chunk-HBQK5RD5.js";
83
80
  import {
84
81
  frontierWallet
85
82
  } from "./chunk-AVDUNQUW.js";
83
+ import {
84
+ foxWallet
85
+ } from "./chunk-GUQM4QSL.js";
86
86
  import {
87
87
  frameWallet
88
88
  } from "./chunk-BU3ZAT5X.js";
@@ -101,15 +101,15 @@ import {
101
101
  import {
102
102
  ledgerWallet
103
103
  } from "./chunk-RPV27V2Y.js";
104
- import {
105
- bybitWallet
106
- } from "./chunk-OX37G4YT.js";
107
104
  import {
108
105
  clvWallet
109
106
  } from "./chunk-OEEGYENV.js";
110
107
  import {
111
108
  coin98Wallet
112
109
  } from "./chunk-WAHGI5L7.js";
110
+ import {
111
+ bybitWallet
112
+ } from "./chunk-OX37G4YT.js";
113
113
  import {
114
114
  coinbaseWallet
115
115
  } from "./chunk-2DLDAZRH.js";
@@ -123,20 +123,20 @@ import {
123
123
  dawnWallet
124
124
  } from "./chunk-G2PHTVL6.js";
125
125
  import {
126
- foxWallet
127
- } from "./chunk-GUQM4QSL.js";
126
+ enkryptWallet
127
+ } from "./chunk-HBQK5RD5.js";
128
128
  import {
129
129
  argentWallet
130
130
  } from "./chunk-NTMBEOR2.js";
131
+ import {
132
+ bifrostWallet
133
+ } from "./chunk-IULPZP2Q.js";
131
134
  import {
132
135
  bitgetWallet
133
136
  } from "./chunk-TKB2OY6G.js";
134
137
  import {
135
138
  bitskiWallet
136
139
  } from "./chunk-7HRFUZFX.js";
137
- import {
138
- bifrostWallet
139
- } from "./chunk-IULPZP2Q.js";
140
140
  import {
141
141
  bitverseWallet
142
142
  } from "./chunk-NSK6A7TI.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect",
3
- "version": "10.6.0",
3
+ "version": "11.0.0",
4
4
  "description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
5
5
  "files": [
6
6
  "dist",
@@ -108,8 +108,8 @@
108
108
  "use-debounce": "^10.0.5",
109
109
  "uuid": "^11.1.1",
110
110
  "@funkit/api-base": "6.0.0",
111
- "@funkit/connect-core": "2.3.0",
112
- "@funkit/chains": "2.1.3",
111
+ "@funkit/chains": "2.2.0",
112
+ "@funkit/connect-core": "2.4.0",
113
113
  "@funkit/fun-relay": "2.9.0",
114
114
  "@funkit/utils": "4.0.0"
115
115
  },
@@ -1,207 +0,0 @@
1
- "use client";
2
- import {
3
- getNadoAllProducts,
4
- getNadoSymbols
5
- } from "./chunk-OZ3KD24N.js";
6
- import {
7
- INK_CHAIN_ID
8
- } from "./chunk-II5CZTBC.js";
9
- import {
10
- multicall
11
- } from "./chunk-FJ6GCMJ4.js";
12
- import {
13
- logger
14
- } from "./chunk-AHYOV7AV.js";
15
-
16
- // src/clients/internal/nado/products.ts
17
- import { erc20Abi, getAddress, isAddress } from "viem";
18
- var NADO_XSTOCK_WITHDRAWALS_ENABLED = false;
19
- var XSTOCK_SYMBOL_PATTERN = /^w\w+x$/;
20
- var NADO_SUPPORTED_PRODUCTS = [
21
- {
22
- productId: 0,
23
- symbol: "USDT0",
24
- tokenAddress: getAddress("0x0200C29006150606B650577BBE7B6248F58470c1"),
25
- decimals: 6,
26
- isXstock: false,
27
- isTradable: true,
28
- withdrawFeeX18: "1000000000000000000"
29
- },
30
- {
31
- productId: 1,
32
- symbol: "KBTC",
33
- tokenAddress: getAddress("0x73E0C0d45E048D25Fc26Fa3159b0aA04BfA4Db98"),
34
- decimals: 8,
35
- isXstock: false,
36
- isTradable: true,
37
- withdrawFeeX18: "10000000000000"
38
- },
39
- {
40
- productId: 3,
41
- symbol: "WETH",
42
- tokenAddress: getAddress("0x4200000000000000000000000000000000000006"),
43
- decimals: 18,
44
- isXstock: false,
45
- isTradable: true,
46
- withdrawFeeX18: "300000000000000"
47
- },
48
- {
49
- productId: 5,
50
- symbol: "USDC",
51
- tokenAddress: getAddress("0x2D270e6886d130D724215A266106e6832161EAEd"),
52
- decimals: 6,
53
- isXstock: false,
54
- isTradable: true,
55
- withdrawFeeX18: "1000000000000000000"
56
- },
57
- {
58
- productId: 115,
59
- symbol: "wQQQx",
60
- tokenAddress: getAddress("0x4C1AE29c159838fC1b224636E28E086EB69101f7"),
61
- decimals: 18,
62
- isXstock: true,
63
- isTradable: true,
64
- withdrawFeeX18: "2000000000000000"
65
- },
66
- {
67
- productId: 117,
68
- symbol: "wSPYx",
69
- tokenAddress: getAddress("0xe7e553cd128f0011777323a0b44a7b96ea1cb540"),
70
- decimals: 18,
71
- isXstock: true,
72
- isTradable: true,
73
- withdrawFeeX18: "2000000000000000"
74
- },
75
- {
76
- productId: 143,
77
- symbol: "wAAPLx",
78
- tokenAddress: getAddress("0x943bf64d566c32a2bcd41ac92fb63c111cc9de8f"),
79
- decimals: 18,
80
- isXstock: true,
81
- isTradable: true,
82
- withdrawFeeX18: "2000000000000000"
83
- },
84
- {
85
- productId: 145,
86
- symbol: "wAMZNx",
87
- tokenAddress: getAddress("0x910cabde3eba7fc1ce64fd14bd680b9f60fa0f90"),
88
- decimals: 18,
89
- isXstock: true,
90
- isTradable: false,
91
- withdrawFeeX18: "2000000000000000"
92
- },
93
- {
94
- productId: 147,
95
- symbol: "wGOOGLx",
96
- tokenAddress: getAddress("0xf8c5308f80e459bb53d9ebe689854d9cbb2caa6f"),
97
- decimals: 18,
98
- isXstock: true,
99
- isTradable: true,
100
- withdrawFeeX18: "2000000000000000"
101
- },
102
- {
103
- productId: 149,
104
- symbol: "wMETAx",
105
- tokenAddress: getAddress("0xe840946ffebcd66b7c4e95095effafadfa0d0e56"),
106
- decimals: 18,
107
- isXstock: true,
108
- isTradable: true,
109
- withdrawFeeX18: "2000000000000000"
110
- },
111
- {
112
- productId: 151,
113
- symbol: "wMSFTx",
114
- tokenAddress: getAddress("0x166fbe68274b6a47e025f4ba17388c539f1fa1d0"),
115
- decimals: 18,
116
- isXstock: true,
117
- isTradable: false,
118
- withdrawFeeX18: "2000000000000000"
119
- },
120
- {
121
- productId: 153,
122
- symbol: "wNVDAx",
123
- tokenAddress: getAddress("0xa8ddb5cd96b5222afe198316e9a57caa642850d5"),
124
- decimals: 18,
125
- isXstock: true,
126
- isTradable: true,
127
- withdrawFeeX18: "2000000000000000"
128
- },
129
- {
130
- productId: 155,
131
- symbol: "wTSLAx",
132
- tokenAddress: getAddress("0xc3FdBe3A68EE5dE461D30415a8165cf9Aefe1171"),
133
- decimals: 18,
134
- isXstock: true,
135
- isTradable: true,
136
- withdrawFeeX18: "2000000000000000"
137
- }
138
- ];
139
- var SUPPORTED_BY_PRODUCT_ID = new Map(
140
- NADO_SUPPORTED_PRODUCTS.map((p) => [p.productId, p])
141
- );
142
- function isWithdrawableNadoProduct(product) {
143
- return !product.isXstock || NADO_XSTOCK_WITHDRAWALS_ENABLED;
144
- }
145
- async function fetchNadoProducts(wagmiConfig, signal) {
146
- const [{ spot_products }, { symbols }] = await Promise.all([
147
- getNadoAllProducts(signal),
148
- getNadoSymbols(signal)
149
- ]);
150
- const symbolByProductId = new Map(
151
- Object.values(symbols).filter((s) => s.type === "spot").map((s) => [s.product_id, s])
152
- );
153
- const supported = spot_products.flatMap((product) => {
154
- const fallback = SUPPORTED_BY_PRODUCT_ID.get(product.product_id);
155
- if (!fallback) {
156
- return [];
157
- }
158
- if (!isAddress(product.config.token)) {
159
- logger.warn("nado:products_invalid_token", {
160
- productId: product.product_id,
161
- token: product.config.token
162
- });
163
- return [];
164
- }
165
- return [{ product, fallback }];
166
- });
167
- if (supported.length === 0) {
168
- logger.warn("nado:products_fallback", { message: "empty_join" });
169
- return NADO_SUPPORTED_PRODUCTS;
170
- }
171
- const decimalResults = await multicall(wagmiConfig, {
172
- chainId: INK_CHAIN_ID,
173
- allowFailure: true,
174
- contracts: supported.map(({ product }) => ({
175
- address: getAddress(product.config.token),
176
- abi: erc20Abi,
177
- functionName: "decimals"
178
- }))
179
- }).catch((error) => {
180
- logger.warn("nado:products_decimals_multicall_failed", {
181
- errorMessage: error instanceof Error ? error.message : String(error)
182
- });
183
- return void 0;
184
- });
185
- return supported.map(({ product, fallback }, i) => {
186
- const symbolInfo = symbolByProductId.get(product.product_id);
187
- const decimals = decimalResults?.[i];
188
- return {
189
- productId: product.product_id,
190
- symbol: symbolInfo?.symbol ?? fallback.symbol,
191
- tokenAddress: getAddress(product.config.token),
192
- decimals: decimals?.status === "success" ? decimals.result : fallback.decimals,
193
- isXstock: symbolInfo ? XSTOCK_SYMBOL_PATTERN.test(symbolInfo.symbol) : fallback.isXstock,
194
- // Withdrawals don't depend on market status (post_only/soft_reduce_only
195
- // are routine weekend states) — only fully disabled products are out
196
- isTradable: symbolInfo ? symbolInfo.trading_status !== "not_tradable" : fallback.isTradable,
197
- withdrawFeeX18: product.config.withdraw_fee_x18 ?? fallback.withdrawFeeX18
198
- };
199
- });
200
- }
201
-
202
- export {
203
- NADO_XSTOCK_WITHDRAWALS_ENABLED,
204
- NADO_SUPPORTED_PRODUCTS,
205
- isWithdrawableNadoProduct,
206
- fetchNadoProducts
207
- };
@@ -1,36 +0,0 @@
1
- /**
2
- * Withdrawable Nado spot products: live `all_products` ⋈ `symbols` join with
3
- * a verified static list as fallback.
4
- *
5
- * @see {@link https://docs.nado.xyz/developer-resources/api/gateway/queries/all-products | Nado all-products query}
6
- * @see {@link https://docs.nado.xyz/developer-resources/api/gateway/queries/symbols | Nado symbols query}
7
- */
8
- import { type Address } from 'viem';
9
- import type { Config } from '../../../wagmi/hooks';
10
- export interface NadoProduct {
11
- productId: number;
12
- symbol: string;
13
- tokenAddress: Address;
14
- decimals: number;
15
- isXstock: boolean;
16
- isTradable: boolean;
17
- /** Withdraw sequencer fee from the product config, x18 token units. */
18
- withdrawFeeX18: string;
19
- }
20
- /**
21
- * Xstocks stay out of the source picker until the backend confirms
22
- * same-token pass-through routing at the UDA. Flip to enable.
23
- */
24
- export declare const NADO_XSTOCK_WITHDRAWALS_ENABLED = false;
25
- /**
26
- * The withdrawable-product allowlist (membership gates the picker) and the
27
- * fallback when the gateway is down. Also the symbol source for USDT0,
28
- * which is absent from the symbols query. Verified against prod 2026-07-16.
29
- */
30
- export declare const NADO_SUPPORTED_PRODUCTS: NadoProduct[];
31
- export declare function isWithdrawableNadoProduct(product: NadoProduct): boolean;
32
- /**
33
- * Live product list: `all_products` ⋈ `symbols`, decimals from one multicall.
34
- * Per-field static fallbacks keep a partial gateway response usable.
35
- */
36
- export declare function fetchNadoProducts(wagmiConfig: Config, signal?: AbortSignal): Promise<NadoProduct[]>;
@@ -1,19 +0,0 @@
1
- "use client";
2
- import {
3
- NADO_SUPPORTED_PRODUCTS,
4
- NADO_XSTOCK_WITHDRAWALS_ENABLED,
5
- fetchNadoProducts,
6
- isWithdrawableNadoProduct
7
- } from "../../chunk-A4WQS6QG.js";
8
- import "../../chunk-OZ3KD24N.js";
9
- import "../../chunk-II5CZTBC.js";
10
- import "../../chunk-L2KSNS7H.js";
11
- import "../../chunk-2YWQL3AO.js";
12
- import "../../chunk-FJ6GCMJ4.js";
13
- import "../../chunk-AHYOV7AV.js";
14
- export {
15
- NADO_SUPPORTED_PRODUCTS,
16
- NADO_XSTOCK_WITHDRAWALS_ENABLED,
17
- fetchNadoProducts,
18
- isWithdrawableNadoProduct
19
- };