@funkit/connect 9.22.0 → 9.23.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.
@@ -30,6 +30,13 @@ export interface FunkitIdentity {
30
30
  walletAddress: Address | '';
31
31
  /** How the user authenticated (guest vs web3). */
32
32
  loginType: LoginType;
33
+ /**
34
+ * Email the integrator supplies to prefill the Swapped fiat ramp iframe, when
35
+ * present. Like `externalUserId`, it's set by the integrator but describes the
36
+ * end user, so it belongs on the identity seam rather than being read from
37
+ * `useFunkitConfig` directly by core hooks.
38
+ */
39
+ prefillFiatEmail?: string;
33
40
  }
34
41
  /**
35
42
  * Contract a platform implements to feed identity into core. Each platform
@@ -3,12 +3,12 @@ import { type BoxProps } from '../../../components/Box/Box';
3
3
  import type { PaymentMethodType } from '../../../hooks/usePaymentSources';
4
4
  interface CryptoCashToggleProps {
5
5
  activeTab: PaymentMethodType;
6
- defaultTab?: PaymentMethodType;
7
6
  disabled?: boolean;
8
7
  onTabChange: (tab: PaymentMethodType) => void;
9
8
  marginTop?: BoxProps['marginTop'];
10
9
  marginBottom?: BoxProps['marginBottom'];
11
10
  style?: React.CSSProperties;
11
+ tabs: PaymentMethodType[];
12
12
  }
13
- export declare const CryptoCashToggle: ({ activeTab, defaultTab, disabled, onTabChange, marginTop, marginBottom, style, }: CryptoCashToggleProps) => React.JSX.Element;
13
+ export declare const CryptoCashToggle: ({ activeTab, disabled, onTabChange, marginTop, marginBottom, style, tabs: tabTypes, }: CryptoCashToggleProps) => React.JSX.Element;
14
14
  export {};
@@ -6,9 +6,37 @@
6
6
  import type { LighterAccountIndex } from '@funkit/api-base';
7
7
  import React from 'react';
8
8
  import type { CustomWithdrawalConfig, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
9
+ import type { LighterShare } from '../../utils/customer';
9
10
  import type { SourceTokenOption } from './WithdrawAmountInput';
10
11
  /** Free (withdrawable) balance for a single Lighter asset: balance - locked. */
11
12
  export declare function freeBalance(balance: string, lockedBalance: string): string;
13
+ /**
14
+ * Lighter Fast charges an "unstaked" fee — a flat deduction taken off the
15
+ * withdrawal amount before quoting — for users who aren't sufficiently staked
16
+ * in Lighter's staking pool. Sufficiently-staked users pay nothing.
17
+ *
18
+ * "Sufficiently staked" = the user holds a share in the staking pool with a
19
+ * principal above the threshold. The staking pool is identified by its index,
20
+ * hardcoded here (previously read from `systemConfig.staking_pool_index`) since
21
+ * it's currently the only public pool a withdrawing user holds a share in.
22
+ * Non-stakers report `shares: []`.
23
+ */
24
+ export declare const LIGHTER_STAKING_POOL_INDEX = 281474976624800;
25
+ export declare const LIGHTER_UNSTAKED_FEE_TOKENS = 3;
26
+ export declare const LIGHTER_STAKING_PRINCIPAL_THRESHOLD = 100;
27
+ /**
28
+ * Resolves the Lighter Fast unstaked fee (in source tokens, i.e. USDC) for a
29
+ * user. Returns 0 when the user's staking-pool principal exceeds the threshold,
30
+ * otherwise {@link LIGHTER_UNSTAKED_FEE_TOKENS}. A non-staker (`shares: []`,
31
+ * or no staking-pool share) pays the fee.
32
+ */
33
+ export declare function resolveLighterUnstakedFeeTokens(shares: LighterShare[]): number;
34
+ /**
35
+ * Deducts the Lighter Fast unstaked fee from a withdrawal input amount, clamped
36
+ * at 0. Uses `dnum` fixed-point math so the subtraction stays exact (e.g. the
37
+ * input is a decimal string straight from the amount field).
38
+ */
39
+ export declare function deductLighterUnstakedFee(inputAmount: string, feeTokens: number): string;
12
40
  /**
13
41
  * Fetches all asset balances for a Lighter account. Returns:
14
42
  *
@@ -20,6 +48,7 @@ export declare function useLighterWithdrawalBalances({ accountIndex, }: {
20
48
  }): {
21
49
  balances: Record<string, string>;
22
50
  assets: import("../../utils/customer").LighterAsset[];
51
+ shares: LighterShare[];
23
52
  isLoading: boolean;
24
53
  };
25
54
  type FunkitWithdrawalConfig = WalletWithdrawalConfig | CustomWithdrawalConfig;
@@ -50,9 +79,11 @@ export declare function buildLighterSourceTokenOptions(config: FunkitWithdrawalC
50
79
  */
51
80
  export declare function useLighterWithdrawal(config: FunkitWithdrawalConfig, setRecipientAddress: (addr: string) => void): {
52
81
  isLighterSecure: boolean;
82
+ isLighterFast: boolean;
53
83
  connectedAddress: `0x${string}` | undefined;
54
84
  lighterBalances: Record<string, string>;
55
85
  lighterAssets: import("../../utils/customer").LighterAsset[];
86
+ lighterFastUnstakedFee: number;
56
87
  };
57
88
  /**
58
89
  * Resolves the source-token dropdown options for a Lighter customer.
@@ -263,6 +263,8 @@ export type FunkitConfig = {
263
263
  uiCustomizations?: FunkitUiCustomizationsConfig;
264
264
  /** used to link funkit users to your own user system */
265
265
  externalUserId?: string;
266
+ /** Email prefilled into the Swapped fiat onramp/offramp iframe. Set once at provider init. */
267
+ prefillFiatEmail?: string;
266
268
  /** Disable Datadog logging - defaults to false (logging enabled) */
267
269
  disableLogging?: boolean;
268
270
  };
@@ -1,5 +1,5 @@
1
- import { type FormOfPaymentType } from '@funkit/api-base';
2
- import type { SwappedTransport } from '@funkit/connect-core';
1
+ import type { FormOfPaymentType } from '@funkit/api-base';
2
+ import { type SwappedTransport } from '@funkit/connect-core';
3
3
  import React from 'react';
4
4
  import { type SwappedTheme } from '../utils/swapped';
5
5
  interface SwappedContextValue {
@@ -1,7 +1,7 @@
1
- import { type CheckoutHistoryItem, type CheckoutRefundState, CheckoutState, type DirectExecution } from '@funkit/api-base';
1
+ export { isCheckoutHistoryDirectExecution, isCheckoutValid, type MergedCheckoutHistoryItem, toMergedCheckoutHistoryItem, } from '@funkit/connect-core';
2
2
  import { type ApiFunkitCheckoutQuoteResult, type CheckoutQuoteResponse } from '@funkit/utils';
3
3
  import type { Dnum } from 'dnum';
4
- import { type Address, type Hex } from 'viem';
4
+ import { type Address } from 'viem';
5
5
  import type { ServerCheckoutConfig } from '../domains/clientMetadata';
6
6
  import type { FunkitCheckoutQuoteResult } from '../domains/quote';
7
7
  import type { Config, UseConfigReturnType } from '../wagmi/hooks';
@@ -101,23 +101,6 @@ export declare function isCheckoutCrFlow(config: FunkitCheckoutConfig): boolean;
101
101
  * @param config can be either be a config from live checkoutItem OR from checkout history's clientMetadata
102
102
  */
103
103
  export declare function isCheckoutPostActionRequired(config: FunkitCheckoutConfig | ServerCheckoutConfig): boolean;
104
- /**
105
- * @returns whether we should show the checkout to the user (ie. supported in current sdk version & not cancelled)
106
- */
107
- export declare const isCheckoutValid: (checkout: CheckoutHistoryItem | MergedCheckoutHistoryItem) => boolean;
108
- export declare const isCheckoutHistoryDirectExecution: (checkoutId: string) => boolean;
109
- export type MergedCheckoutHistoryItem = {
110
- directExecution: boolean;
111
- /** For direction execution this is the tx hash, for checkouts it is the deposit address */
112
- id: Hex;
113
- refundState?: CheckoutRefundState;
114
- state: CheckoutState;
115
- } & ((CheckoutHistoryItem & {
116
- directExecution: false;
117
- }) | (DirectExecution & {
118
- directExecution: true;
119
- }));
120
- export declare function toMergedCheckoutHistoryItem(item: CheckoutHistoryItem | DirectExecution): MergedCheckoutHistoryItem;
121
104
  export declare function isVaultDepositCheckout(checkoutConfig: FunkitCheckoutConfig, sourceHolding: {
122
105
  chainId: string;
123
106
  tokenAddress: string;
@@ -144,4 +127,3 @@ export declare function computeSwitcherDisplayToken({ checkoutConfig, displayAss
144
127
  amount: number;
145
128
  symbol: string;
146
129
  };
147
- export {};
@@ -25,6 +25,18 @@ export type LighterAsset = {
25
25
  balance: string;
26
26
  locked_balance: string;
27
27
  };
28
+ /**
29
+ * A user's stake in a Lighter public pool. The staking pool is identified by
30
+ * matching `public_pool_index` against the known staking pool index;
31
+ * `principal_amount` is the staked USDC principal (decimal string).
32
+ */
33
+ export type LighterShare = {
34
+ public_pool_index: number;
35
+ shares_amount: number;
36
+ entry_usdc: string;
37
+ principal_amount: string;
38
+ entry_timestamp: number;
39
+ };
28
40
  export type LighterAccount = {
29
41
  code: number;
30
42
  account_type: number;
@@ -50,7 +62,7 @@ export type LighterAccount = {
50
62
  assets: LighterAsset[];
51
63
  total_asset_value: string;
52
64
  cross_asset_value: string;
53
- shares: unknown[];
65
+ shares: LighterShare[];
54
66
  pending_unlocks: unknown[];
55
67
  };
56
68
  export type LighterAccountResponse = {
@@ -1,19 +1,16 @@
1
1
  "use client";
2
- import {
3
- zealWallet
4
- } from "./chunk-52QXXLDS.js";
5
2
  import {
6
3
  zerionWallet
7
4
  } from "./chunk-SWFF3TWJ.js";
8
5
  import {
9
- tahoWallet
10
- } from "./chunk-7ZYCBDQ4.js";
11
- import {
12
- talismanWallet
13
- } from "./chunk-4DCO3TGL.js";
6
+ gateWallet
7
+ } from "./chunk-JPN6TWIT.js";
14
8
  import {
15
9
  tokenPocketWallet
16
10
  } from "./chunk-WKNQMP4A.js";
11
+ import {
12
+ talismanWallet
13
+ } from "./chunk-4DCO3TGL.js";
17
14
  import {
18
15
  tokenaryWallet
19
16
  } from "./chunk-VH3THHJY.js";
@@ -30,8 +27,8 @@ import {
30
27
  xdefiWallet
31
28
  } from "./chunk-JN5I3DNC.js";
32
29
  import {
33
- rabbyWallet
34
- } from "./chunk-RB66PKPA.js";
30
+ zealWallet
31
+ } from "./chunk-52QXXLDS.js";
35
32
  import {
36
33
  rainbowWallet
37
34
  } from "./chunk-W2LCLDPX.js";
@@ -54,11 +51,8 @@ import {
54
51
  subWallet
55
52
  } from "./chunk-NR2OGDHQ.js";
56
53
  import {
57
- metaMaskWallet
58
- } from "./chunk-YO2K4MBH.js";
59
- import {
60
- mewWallet
61
- } from "./chunk-MQM45ADF.js";
54
+ tahoWallet
55
+ } from "./chunk-7ZYCBDQ4.js";
62
56
  import {
63
57
  oktoWallet
64
58
  } from "./chunk-YWOVAU6O.js";
@@ -71,6 +65,9 @@ import {
71
65
  import {
72
66
  oneInchWallet
73
67
  } from "./chunk-QG6ZHI7B.js";
68
+ import {
69
+ mewWallet
70
+ } from "./chunk-MQM45ADF.js";
74
71
  import {
75
72
  oneKeyWallet
76
73
  } from "./chunk-WVT6BBJH.js";
@@ -78,20 +75,20 @@ import {
78
75
  phantomWallet
79
76
  } from "./chunk-QY53O7WG.js";
80
77
  import {
81
- foxWallet
82
- } from "./chunk-GUQM4QSL.js";
78
+ rabbyWallet
79
+ } from "./chunk-RB66PKPA.js";
80
+ import {
81
+ desigWallet
82
+ } from "./chunk-FW3WZETT.js";
83
83
  import {
84
84
  frameWallet
85
85
  } from "./chunk-BU3ZAT5X.js";
86
- import {
87
- frontierWallet
88
- } from "./chunk-AVDUNQUW.js";
89
- import {
90
- gateWallet
91
- } from "./chunk-JPN6TWIT.js";
92
86
  import {
93
87
  imTokenWallet
94
88
  } from "./chunk-WNAGGFMG.js";
89
+ import {
90
+ frontierWallet
91
+ } from "./chunk-AVDUNQUW.js";
95
92
  import {
96
93
  injectedWallet
97
94
  } from "./chunk-T6LGKC3F.js";
@@ -102,29 +99,32 @@ import {
102
99
  ledgerWallet
103
100
  } from "./chunk-RPV27V2Y.js";
104
101
  import {
105
- clvWallet
106
- } from "./chunk-OEEGYENV.js";
102
+ metaMaskWallet
103
+ } from "./chunk-YO2K4MBH.js";
107
104
  import {
108
105
  bybitWallet
109
106
  } from "./chunk-OX37G4YT.js";
110
107
  import {
111
- coinbaseWallet
112
- } from "./chunk-2DLDAZRH.js";
108
+ clvWallet
109
+ } from "./chunk-OEEGYENV.js";
113
110
  import {
114
111
  coin98Wallet
115
112
  } from "./chunk-WAHGI5L7.js";
113
+ import {
114
+ coinbaseWallet
115
+ } from "./chunk-2DLDAZRH.js";
116
116
  import {
117
117
  coreWallet
118
118
  } from "./chunk-4NV5BYRP.js";
119
- import {
120
- dawnWallet
121
- } from "./chunk-G2PHTVL6.js";
122
- import {
123
- desigWallet
124
- } from "./chunk-FW3WZETT.js";
125
119
  import {
126
120
  enkryptWallet
127
121
  } from "./chunk-HBQK5RD5.js";
122
+ import {
123
+ foxWallet
124
+ } from "./chunk-GUQM4QSL.js";
125
+ import {
126
+ dawnWallet
127
+ } from "./chunk-G2PHTVL6.js";
128
128
  import {
129
129
  argentWallet
130
130
  } from "./chunk-NTMBEOR2.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect",
3
- "version": "9.22.0",
3
+ "version": "9.23.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,7 +113,7 @@
113
113
  "uuid": "^11.1.1",
114
114
  "@funkit/api-base": "4.5.1",
115
115
  "@funkit/chains": "2.1.0",
116
- "@funkit/connect-core": "0.3.2",
116
+ "@funkit/connect-core": "1.0.0",
117
117
  "@funkit/fun-relay": "2.8.2",
118
118
  "@funkit/utils": "3.1.0"
119
119
  },