@funkit/connect 10.1.0 → 10.2.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.
@@ -21,10 +21,10 @@ interface FormOfPaymentsListProps {
21
21
  isDisabled?: boolean;
22
22
  /**
23
23
  * Maps a FOP to its disclaimer-limit string. Defaults to the rounded deposit
24
- * limit (getFopsLimit); the withdrawal off-ramp passes getWithdrawalFopsLimit
25
- * so the user's exact withdrawable balance isn't rounded down.
24
+ * limit (getFopsLimit). Return undefined to omit the limit and show only the
25
+ * processing time (the withdrawal off-ramp hides limits).
26
26
  */
27
- getDisclaimerLimit?: (fop: SwappedFormOfPayment, exchangeRates: ExchangeRates | undefined) => string;
27
+ getDisclaimerLimit?: (fop: SwappedFormOfPayment, exchangeRates: ExchangeRates | undefined) => string | undefined;
28
28
  /**
29
29
  * Withdrawal off-ramp only: balance is below the cash sell minimum, so every
30
30
  * cash method is disabled with a "Low Balance" badge. A single flag is enough
@@ -0,0 +1 @@
1
+ export declare const scrollableIframeWrapper: string;
@@ -119,10 +119,14 @@ export declare function resolveLighterAssetIndex(lighterAssets: {
119
119
  * - Fast path: only USDC (Perps).
120
120
  * - Secure path: USDC (Perps) (from total_asset_value) + USDC (Spot) when the
121
121
  * account carries a spot USDC asset + every non-USDC asset on the account.
122
+ *
123
+ * Unified Trading accounts (`isUnifiedTradingMode`) have a single USDC balance
124
+ * — no spot/perps split — so the perps entry is labeled plain `USDC` and the
125
+ * `USDC (Spot)` entry is hidden on both paths.
122
126
  */
123
127
  export declare function buildLighterSourceTokenOptions(config: FunkitWithdrawalConfig, lighterAssets: {
124
128
  symbol: string;
125
- }[]): SourceTokenOption[];
129
+ }[], isUnifiedTradingMode?: boolean): SourceTokenOption[];
126
130
  /**
127
131
  * Detects Lighter Secure withdrawal (mainnet source chain), auto-fills the
128
132
  * recipient address with the connected wallet, and fetches the Lighter account
@@ -131,6 +135,7 @@ export declare function buildLighterSourceTokenOptions(config: FunkitWithdrawalC
131
135
  export declare function useLighterWithdrawal(config: FunkitWithdrawalConfig, setRecipientAddress: (addr: string) => void): {
132
136
  isLighterSecure: boolean;
133
137
  isLighterFast: boolean;
138
+ isUnifiedTradingMode: boolean;
134
139
  connectedAddress: `0x${string}` | undefined;
135
140
  lighterBalances: Record<string, string>;
136
141
  lighterAssets: import("../../utils/customer").LighterAsset[];
@@ -143,7 +148,7 @@ export declare function useLighterWithdrawal(config: FunkitWithdrawalConfig, set
143
148
  */
144
149
  export declare function useLighterSourceTokenOptions(config: FunkitWithdrawalConfig, apiKey: string, lighterAssets: {
145
150
  symbol: string;
146
- }[]): SourceTokenOption[] | undefined;
151
+ }[], isUnifiedTradingMode?: boolean): SourceTokenOption[] | undefined;
147
152
  /**
148
153
  * Lighter Secure: recipient address, locked to the connected wallet. A
149
154
  * read-only `FunInput` (not a `<div>`) keeps it focusable and announced by
@@ -1,3 +1,4 @@
1
+ import type { TFunction } from 'i18next';
1
2
  import React from 'react';
2
3
  import type { Hex } from 'viem';
3
4
  import type { CustomWithdrawalConfig, FunkitActiveWithdrawalItem, FunkitCheckoutConfig, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
@@ -25,6 +26,20 @@ interface WithdrawContentProps {
25
26
  * Exported for testing.
26
27
  */
27
28
  export declare function toUsdValue(sourceAmount: string, sourceTokenUsdPrice: number | undefined): number | undefined;
29
+ export declare function getWithdrawButtonText({ isWithdrawing, isValidAddress, isRecipientBlacklisted, isRecipientSameAsSource, withdrawalInputAmount, isWithdrawAmountValid, isWithdrawAmountTooHigh, isValidAddressAndChain, selectedToken, selectedChainId, selectedChainName, t, }: {
30
+ isWithdrawing: boolean;
31
+ isValidAddress: boolean;
32
+ isRecipientBlacklisted: boolean;
33
+ isRecipientSameAsSource: boolean;
34
+ withdrawalInputAmount: string;
35
+ isWithdrawAmountValid: boolean;
36
+ isWithdrawAmountTooHigh: boolean;
37
+ isValidAddressAndChain: boolean;
38
+ selectedToken: string | undefined;
39
+ selectedChainId: number | undefined;
40
+ selectedChainName: string | undefined;
41
+ t: TFunction;
42
+ }): string;
28
43
  export declare function isValidWithdrawal({ config, checkoutConfig, withdrawalInputAmount, sourceTokenUsdPrice, recipientAddress, selectedChainId, sourceTokenBalance, selectedSourceToken, }: {
29
44
  config: FunkitWithdrawalConfig;
30
45
  checkoutConfig: FunkitCheckoutConfig | undefined;
@@ -1,5 +1,29 @@
1
1
  import type { LighterAccountIndex } from '@funkit/api-base';
2
+ import type { DynamicTargetAssetCandidate } from '@funkit/connect-core';
2
3
  import type { Address } from 'viem';
4
+ /**
5
+ * Lighter `account_trading_mode` discriminator: `0` = simple (separate spot
6
+ * and perps USDC balances), `1` = Unified Trading account (one USDC balance —
7
+ * no spot/perps split). Unified accounts hide the spot USDC option and label
8
+ * perps USDC as plain `USDC` in both deposit and withdrawal flows.
9
+ */
10
+ export declare const LIGHTER_TRADING_MODE: {
11
+ readonly SIMPLE: 0;
12
+ readonly UNIFIED: 1;
13
+ };
14
+ /**
15
+ * Strips the ` (Perps)` variant suffix off a Lighter ticker (e.g.
16
+ * `USDC (Perps)` → `USDC`). Non-perps tickers pass through unchanged.
17
+ */
18
+ export declare function stripLighterPerpsSuffix(symbol: string): string;
19
+ export declare function stripLighterPerpsSuffix(symbol: string | undefined): string | undefined;
20
+ /**
21
+ * Rewrites the deposit target-asset candidates for a Unified Trading account:
22
+ * drops the spot-USDC candidates and relabels `USDC (Perps)` as `USDC`. The
23
+ * underlying routing is unchanged — unified deposits still ride the perps
24
+ * routes (`LIGHTER_USDC_PERPS*`), only the presentation differs.
25
+ */
26
+ export declare function adaptLighterTargetAssetsForUnifiedAccount(candidates: DynamicTargetAssetCandidate[]): DynamicTargetAssetCandidate[];
3
27
  export type LighterSubAccount = {
4
28
  code: number;
5
29
  account_type: number;
@@ -12,6 +36,8 @@ export type LighterSubAccount = {
12
36
  available_balance: string;
13
37
  status: number;
14
38
  collateral: string;
39
+ transaction_time: number;
40
+ account_trading_mode: number;
15
41
  };
16
42
  export type LighterAccountsByL1AddressResponse = {
17
43
  code: number;
@@ -247,6 +273,7 @@ export declare function useLighterAccounts({ address, }: {
247
273
  address: Address | '' | undefined;
248
274
  }): {
249
275
  mainAccountIndex: string | undefined;
276
+ isUnifiedTradingMode: boolean;
250
277
  subAccounts: LighterSubAccount[] | undefined;
251
278
  data: LighterAccountsByL1AddressResponse;
252
279
  error: Error;
@@ -275,6 +302,7 @@ export declare function useLighterAccounts({ address, }: {
275
302
  promise: Promise<LighterAccountsByL1AddressResponse>;
276
303
  } | {
277
304
  mainAccountIndex: string | undefined;
305
+ isUnifiedTradingMode: boolean;
278
306
  subAccounts: LighterSubAccount[] | undefined;
279
307
  data: LighterAccountsByL1AddressResponse;
280
308
  error: null;
@@ -303,6 +331,7 @@ export declare function useLighterAccounts({ address, }: {
303
331
  promise: Promise<LighterAccountsByL1AddressResponse>;
304
332
  } | {
305
333
  mainAccountIndex: string | undefined;
334
+ isUnifiedTradingMode: boolean;
306
335
  subAccounts: LighterSubAccount[] | undefined;
307
336
  data: undefined;
308
337
  error: Error;
@@ -331,6 +360,7 @@ export declare function useLighterAccounts({ address, }: {
331
360
  promise: Promise<LighterAccountsByL1AddressResponse>;
332
361
  } | {
333
362
  mainAccountIndex: string | undefined;
363
+ isUnifiedTradingMode: boolean;
334
364
  subAccounts: LighterSubAccount[] | undefined;
335
365
  data: undefined;
336
366
  error: null;
@@ -359,6 +389,7 @@ export declare function useLighterAccounts({ address, }: {
359
389
  promise: Promise<LighterAccountsByL1AddressResponse>;
360
390
  } | {
361
391
  mainAccountIndex: string | undefined;
392
+ isUnifiedTradingMode: boolean;
362
393
  subAccounts: LighterSubAccount[] | undefined;
363
394
  data: undefined;
364
395
  error: null;
@@ -387,6 +418,7 @@ export declare function useLighterAccounts({ address, }: {
387
418
  promise: Promise<LighterAccountsByL1AddressResponse>;
388
419
  } | {
389
420
  mainAccountIndex: string | undefined;
421
+ isUnifiedTradingMode: boolean;
390
422
  subAccounts: LighterSubAccount[] | undefined;
391
423
  data: LighterAccountsByL1AddressResponse;
392
424
  isError: false;
@@ -1,16 +1,16 @@
1
1
  "use client";
2
2
  import {
3
- xdefiWallet
4
- } from "./chunk-JN5I3DNC.js";
3
+ zealWallet
4
+ } from "./chunk-52QXXLDS.js";
5
5
  import {
6
6
  zerionWallet
7
7
  } from "./chunk-SWFF3TWJ.js";
8
- import {
9
- tahoWallet
10
- } from "./chunk-7ZYCBDQ4.js";
11
8
  import {
12
9
  talismanWallet
13
10
  } from "./chunk-4DCO3TGL.js";
11
+ import {
12
+ tahoWallet
13
+ } from "./chunk-7ZYCBDQ4.js";
14
14
  import {
15
15
  tokenPocketWallet
16
16
  } from "./chunk-WKNQMP4A.js";
@@ -20,15 +20,15 @@ import {
20
20
  import {
21
21
  trustWallet
22
22
  } from "./chunk-KCRO2AGO.js";
23
- import {
24
- uniswapWallet
25
- } from "./chunk-Z3PPW6NC.js";
26
23
  import {
27
24
  walletConnectWallet
28
25
  } from "./chunk-3FCWJRI4.js";
29
26
  import {
30
- zealWallet
31
- } from "./chunk-52QXXLDS.js";
27
+ uniswapWallet
28
+ } from "./chunk-Z3PPW6NC.js";
29
+ import {
30
+ xdefiWallet
31
+ } from "./chunk-JN5I3DNC.js";
32
32
  import {
33
33
  rabbyWallet
34
34
  } from "./chunk-RB66PKPA.js";
@@ -86,12 +86,12 @@ import {
86
86
  import {
87
87
  frontierWallet
88
88
  } from "./chunk-AVDUNQUW.js";
89
- import {
90
- imTokenWallet
91
- } from "./chunk-WNAGGFMG.js";
92
89
  import {
93
90
  gateWallet
94
91
  } from "./chunk-JPN6TWIT.js";
92
+ import {
93
+ imTokenWallet
94
+ } from "./chunk-WNAGGFMG.js";
95
95
  import {
96
96
  injectedWallet
97
97
  } from "./chunk-T6LGKC3F.js";
@@ -102,8 +102,8 @@ import {
102
102
  ledgerWallet
103
103
  } from "./chunk-RPV27V2Y.js";
104
104
  import {
105
- bybitWallet
106
- } from "./chunk-OX37G4YT.js";
105
+ bloomWallet
106
+ } from "./chunk-PJ7Y57EH.js";
107
107
  import {
108
108
  clvWallet
109
109
  } from "./chunk-OEEGYENV.js";
@@ -137,12 +137,12 @@ import {
137
137
  import {
138
138
  bitskiWallet
139
139
  } from "./chunk-7HRFUZFX.js";
140
- import {
141
- bloomWallet
142
- } from "./chunk-PJ7Y57EH.js";
143
140
  import {
144
141
  bitverseWallet
145
142
  } from "./chunk-NSK6A7TI.js";
143
+ import {
144
+ bybitWallet
145
+ } from "./chunk-OX37G4YT.js";
146
146
  import "./chunk-N4IJLYFY.js";
147
147
  import {
148
148
  braveWallet
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect",
3
- "version": "10.1.0",
3
+ "version": "10.2.0",
4
4
  "description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
5
5
  "files": [
6
6
  "dist",
@@ -63,11 +63,8 @@
63
63
  "@vitejs/plugin-react": "^6.0.2",
64
64
  "autoprefixer": "^10.4.27",
65
65
  "buffer": "^6.0.3",
66
- "dotenv": "^17.2.3",
67
66
  "esbuild-plugin-replace": "^1.4.0",
68
67
  "jsdom": "^26.1.0",
69
- "openapi-fetch": "^0.17.0",
70
- "openapi-typescript": "^7.13.0",
71
68
  "postcss": "^8.5.10",
72
69
  "postcss-prefix-selector": "^1.16.0",
73
70
  "process": "^0.11.10",
@@ -75,7 +72,6 @@
75
72
  "storybook": "^10.3.6",
76
73
  "stream-browserify": "^3.0.0",
77
74
  "tsc-alias": "1.8.17",
78
- "tsx": "^4.22.4",
79
75
  "util": "^0.12.5",
80
76
  "vite-plugin-node-polyfills": "^0.26.0",
81
77
  "vitest": "^4.1.6",
@@ -111,9 +107,9 @@
111
107
  "uuid": "^11.1.1",
112
108
  "@funkit/api-base": "6.0.0",
113
109
  "@funkit/chains": "2.1.3",
114
- "@funkit/connect-core": "1.6.2",
115
- "@funkit/utils": "4.0.0",
116
- "@funkit/fun-relay": "2.9.0"
110
+ "@funkit/connect-core": "1.7.1",
111
+ "@funkit/fun-relay": "2.9.0",
112
+ "@funkit/utils": "4.0.0"
117
113
  },
118
114
  "repository": {
119
115
  "type": "git",
@@ -125,9 +121,8 @@
125
121
  "svgo": "svgo -rf .",
126
122
  "build": "node build.js && pnpm typecheck",
127
123
  "build:watch": "node build.js --watch",
128
- "predev": "pnpm statsig:generate",
129
124
  "dev": "pnpm build:watch & pnpm typegen:watch",
130
- "prebuild": "pnpm statsig:generate && pnpm typegen",
125
+ "prebuild": "pnpm typegen",
131
126
  "typecheck": "pnpm tsc --noEmit",
132
127
  "typegen": "tsc --project tsconfig.build.json --emitDeclarationOnly && tsc-alias",
133
128
  "typegen:watch": "tsc --project tsconfig.build.json --emitDeclarationOnly --watch",
@@ -140,8 +135,6 @@
140
135
  "storybook:fast": "NODE_OPTIONS='--max-old-space-size=4096' storybook dev -p 6006 --no-open",
141
136
  "storybook:clean": "rm -rf node_modules/.vite && npm run storybook",
142
137
  "build-storybook": "storybook build",
143
- "statsig:api-types": "openapi-typescript https://api.statsig.com/openapi/20240601.json -o scripts/statsig/api-types.ts",
144
- "statsig:generate": "tsx scripts/statsig/generate.ts",
145
138
  "i18n:unused": "node scripts/find-unused-i18n-keys.mjs"
146
139
  }
147
140
  }