@funkit/connect 7.0.3-next.0 → 7.0.3-next.1

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.
@@ -1,3 +1,4 @@
1
+ import type { DynamicRoutePath } from '@funkit/fun-relay';
1
2
  import React, { type ReactNode } from 'react';
2
3
  import type { Address } from 'viem';
3
4
  import { type PaymentMethodInfo } from '../../domains/paymentMethods';
@@ -20,6 +21,7 @@ interface FunkitCheckoutContextInterface {
20
21
  targetAssetTicker: string;
21
22
  targetAssetMinAmount: number | undefined;
22
23
  iconSrc: string | undefined;
24
+ generateActionsParams?: FunkitCheckoutConfig['generateActionsParams'];
23
25
  }): void;
24
26
  updateSelectedPaymentMethodInfo(newPaymentMethodInfo: PaymentMethodInfo): void;
25
27
  updateCustomRecipient: (recipient: Address) => void;
@@ -31,6 +33,10 @@ interface FunkitCheckoutContextInterface {
31
33
  withdrawalItem: FunkitActiveWithdrawalItem | null;
32
34
  initNewWithdrawal(initSettings: Partial<UseFunkitCheckoutPropsWithFullConfig>, config: UseFunkitCheckoutPropsWithFullConfig): string;
33
35
  updateWithdrawalSourceAssetAmount(newSourceAmount: number): void;
36
+ applyDynamicRouting(path: Omit<DynamicRoutePath, 'getCustomRecipient' | 'generateActionsParams'> & {
37
+ customRecipient?: FunkitCheckoutConfig['customRecipient'];
38
+ generateActionsParams?: FunkitCheckoutConfig['generateActionsParams'];
39
+ }): void;
34
40
  }
35
41
  export type CheckoutProgressStep = 1 | 2;
36
42
  export type CheckoutProgress = {
@@ -74,6 +74,10 @@ export interface FunkitCheckoutConfig extends Omit<ApiFunkitCheckoutConfig, 'gen
74
74
  qrcodeActionType?: string;
75
75
  /** set this if you want enable vault like deposit*/
76
76
  stakingToken?: DynamicTargetAssetCandidate;
77
+ /**
78
+ * For dynamic routing, the id of the dynamic route to use
79
+ */
80
+ dynamicRoutingId?: string;
77
81
  }
78
82
  export interface WithdrawalConfigBase {
79
83
  /** Title to show in the checkout modal. Defaults to "Checkout" **/
@@ -95,7 +95,6 @@ export declare function getQuoteExchangeRate(config: FunkitCheckoutConfig, baseQ
95
95
  */
96
96
  export declare function getMaxTargetAssetAmountEstimate(sourceAssetBalance: number, config: FunkitCheckoutConfig, quoteResult: FunkitCheckoutQuoteResult): number;
97
97
  export declare function getTokenDecimals(wagmiConfig: Config, chainId: string, tokenAddress: Address): Promise<number>;
98
- export declare function getLighterTickSize(wagmiConfig: Config, chainId: string, assetIndex: number): Promise<bigint>;
99
98
  export declare function evaluateCheckoutGenerateActionsParams(config: FunkitCheckoutConfig): Promise<FunkitCheckoutActionParams[]>;
100
99
  export declare function isCheckoutCrFlow(config: FunkitCheckoutConfig): boolean;
101
100
  /**
@@ -1,6 +1,202 @@
1
+ import type { Address } from 'viem';
1
2
  import type { ServerCheckoutConfig } from '~/domains/clientMetadata';
2
3
  import type { FunkitCheckoutConfig } from '~/providers/FunkitCheckoutContext';
3
4
  export declare function isKatanaEarnFlow({ apiKey, checkoutConfig, }: {
4
5
  apiKey: string;
5
6
  checkoutConfig: FunkitCheckoutConfig | ServerCheckoutConfig | undefined;
6
7
  }): boolean;
8
+ export type LighterSubAccount = {
9
+ code: number;
10
+ account_type: number;
11
+ index: number;
12
+ l1_address: Address;
13
+ cancel_all_time: number;
14
+ total_order_count: number;
15
+ total_isolated_order_count: number;
16
+ pending_order_count: number;
17
+ available_balance: string;
18
+ status: number;
19
+ collateral: string;
20
+ };
21
+ export type LighterAccountsByL1AddressResponse = {
22
+ code: number;
23
+ l1_address: Address;
24
+ sub_accounts: LighterSubAccount[];
25
+ };
26
+ export declare function getLighterAccountsByL1Address(address: Address): Promise<LighterAccountsByL1AddressResponse>;
27
+ export declare function useLighterAccounts({ address, isEnabled, }: {
28
+ address: Address | undefined;
29
+ isEnabled?: boolean;
30
+ }): {
31
+ mainAccountIndex: string | undefined;
32
+ subAccounts: LighterSubAccount[] | undefined;
33
+ data: LighterAccountsByL1AddressResponse;
34
+ error: Error;
35
+ isError: true;
36
+ isPending: false;
37
+ isLoading: false;
38
+ isLoadingError: false;
39
+ isRefetchError: true;
40
+ isSuccess: false;
41
+ isPlaceholderData: false;
42
+ status: "error";
43
+ dataUpdatedAt: number;
44
+ errorUpdatedAt: number;
45
+ failureCount: number;
46
+ failureReason: Error | null;
47
+ errorUpdateCount: number;
48
+ isFetched: boolean;
49
+ isFetchedAfterMount: boolean;
50
+ isFetching: boolean;
51
+ isInitialLoading: boolean;
52
+ isPaused: boolean;
53
+ isRefetching: boolean;
54
+ isStale: boolean;
55
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<LighterAccountsByL1AddressResponse, Error>>;
56
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
57
+ promise: Promise<LighterAccountsByL1AddressResponse>;
58
+ } | {
59
+ mainAccountIndex: string | undefined;
60
+ subAccounts: LighterSubAccount[] | undefined;
61
+ data: LighterAccountsByL1AddressResponse;
62
+ error: null;
63
+ isError: false;
64
+ isPending: false;
65
+ isLoading: false;
66
+ isLoadingError: false;
67
+ isRefetchError: false;
68
+ isSuccess: true;
69
+ isPlaceholderData: false;
70
+ status: "success";
71
+ dataUpdatedAt: number;
72
+ errorUpdatedAt: number;
73
+ failureCount: number;
74
+ failureReason: Error | null;
75
+ errorUpdateCount: number;
76
+ isFetched: boolean;
77
+ isFetchedAfterMount: boolean;
78
+ isFetching: boolean;
79
+ isInitialLoading: boolean;
80
+ isPaused: boolean;
81
+ isRefetching: boolean;
82
+ isStale: boolean;
83
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<LighterAccountsByL1AddressResponse, Error>>;
84
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
85
+ promise: Promise<LighterAccountsByL1AddressResponse>;
86
+ } | {
87
+ mainAccountIndex: string | undefined;
88
+ subAccounts: LighterSubAccount[] | undefined;
89
+ data: undefined;
90
+ error: Error;
91
+ isError: true;
92
+ isPending: false;
93
+ isLoading: false;
94
+ isLoadingError: true;
95
+ isRefetchError: false;
96
+ isSuccess: false;
97
+ isPlaceholderData: false;
98
+ status: "error";
99
+ dataUpdatedAt: number;
100
+ errorUpdatedAt: number;
101
+ failureCount: number;
102
+ failureReason: Error | null;
103
+ errorUpdateCount: number;
104
+ isFetched: boolean;
105
+ isFetchedAfterMount: boolean;
106
+ isFetching: boolean;
107
+ isInitialLoading: boolean;
108
+ isPaused: boolean;
109
+ isRefetching: boolean;
110
+ isStale: boolean;
111
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<LighterAccountsByL1AddressResponse, Error>>;
112
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
113
+ promise: Promise<LighterAccountsByL1AddressResponse>;
114
+ } | {
115
+ mainAccountIndex: string | undefined;
116
+ subAccounts: LighterSubAccount[] | undefined;
117
+ data: undefined;
118
+ error: null;
119
+ isError: false;
120
+ isPending: true;
121
+ isLoading: true;
122
+ isLoadingError: false;
123
+ isRefetchError: false;
124
+ isSuccess: false;
125
+ isPlaceholderData: false;
126
+ status: "pending";
127
+ dataUpdatedAt: number;
128
+ errorUpdatedAt: number;
129
+ failureCount: number;
130
+ failureReason: Error | null;
131
+ errorUpdateCount: number;
132
+ isFetched: boolean;
133
+ isFetchedAfterMount: boolean;
134
+ isFetching: boolean;
135
+ isInitialLoading: boolean;
136
+ isPaused: boolean;
137
+ isRefetching: boolean;
138
+ isStale: boolean;
139
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<LighterAccountsByL1AddressResponse, Error>>;
140
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
141
+ promise: Promise<LighterAccountsByL1AddressResponse>;
142
+ } | {
143
+ mainAccountIndex: string | undefined;
144
+ subAccounts: LighterSubAccount[] | undefined;
145
+ data: undefined;
146
+ error: null;
147
+ isError: false;
148
+ isPending: true;
149
+ isLoadingError: false;
150
+ isRefetchError: false;
151
+ isSuccess: false;
152
+ isPlaceholderData: false;
153
+ status: "pending";
154
+ dataUpdatedAt: number;
155
+ errorUpdatedAt: number;
156
+ failureCount: number;
157
+ failureReason: Error | null;
158
+ errorUpdateCount: number;
159
+ isFetched: boolean;
160
+ isFetchedAfterMount: boolean;
161
+ isFetching: boolean;
162
+ isLoading: boolean;
163
+ isInitialLoading: boolean;
164
+ isPaused: boolean;
165
+ isRefetching: boolean;
166
+ isStale: boolean;
167
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<LighterAccountsByL1AddressResponse, Error>>;
168
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
169
+ promise: Promise<LighterAccountsByL1AddressResponse>;
170
+ } | {
171
+ mainAccountIndex: string | undefined;
172
+ subAccounts: LighterSubAccount[] | undefined;
173
+ data: LighterAccountsByL1AddressResponse;
174
+ isError: false;
175
+ error: null;
176
+ isPending: false;
177
+ isLoading: false;
178
+ isLoadingError: false;
179
+ isRefetchError: false;
180
+ isSuccess: true;
181
+ isPlaceholderData: true;
182
+ status: "success";
183
+ dataUpdatedAt: number;
184
+ errorUpdatedAt: number;
185
+ failureCount: number;
186
+ failureReason: Error | null;
187
+ errorUpdateCount: number;
188
+ isFetched: boolean;
189
+ isFetchedAfterMount: boolean;
190
+ isFetching: boolean;
191
+ isInitialLoading: boolean;
192
+ isPaused: boolean;
193
+ isRefetching: boolean;
194
+ isStale: boolean;
195
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<LighterAccountsByL1AddressResponse, Error>>;
196
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
197
+ promise: Promise<LighterAccountsByL1AddressResponse>;
198
+ };
199
+ export declare function useLighterNativeFlowNeeded(apiKey: string, checkoutConfig: FunkitCheckoutConfig | undefined): {
200
+ isLoading: boolean;
201
+ lighterNativeNeeded: boolean | undefined;
202
+ };
@@ -30,7 +30,7 @@ export declare const flagConfig: {
30
30
  };
31
31
  readonly enable_token_transfer: {
32
32
  readonly type: "boolean";
33
- readonly default_value: false;
33
+ readonly default_value: true;
34
34
  readonly overrides: [{
35
35
  readonly if_any: [{
36
36
  readonly key: "apiKey";
@@ -38,25 +38,11 @@ export declare const flagConfig: {
38
38
  readonly values: ["di9ZSqn1Ya68Y2XpBPUV1rCtNGXh8Xe5MGWzb1Xe"];
39
39
  }];
40
40
  readonly value: true;
41
- }, {
42
- readonly if_any: [{
43
- readonly key: "userId";
44
- readonly type: "isAnyOf";
45
- readonly values: string[];
46
- }];
47
- readonly value: true;
48
- }, Override<boolean>, {
49
- readonly if_any: [{
50
- readonly key: "apiKey";
51
- readonly type: "isAnyOf";
52
- readonly values: ["6TUi99Tq3O9MWj1IFX8Pv6spmPXzcvhy9NvBoeW2", "vWe20Dfyui2ouvfOhtSTY3Czeo8lFdbo5xXQBALZ", "clDebbfo9edXq1GydZ0CahSAfSimPj616lFa9p8e", "57G91zNoew4nYxIoqSCpS1vWr8JT3gGVasNqMwgG", "BPVeP8zThG467vVIYzuiu5aVWAkS9KiR6tT1TdTP", "M3uox3cw0u8YCPV9cIREA6AugUMvPFTk6qOpm4um", "cGlmpTmNh657m8TiV5RFdwna6FG5pxM6ajiNHvw3", "1QxzeJ4XKT78ba86whLct6sc7dW60Dl461UVWFdw", "pLQBJsA6zS9tg990rbdBD6UdABkWRv5O60vlrVcW", "lUzTaIRxs95iin3pCAafB1ChA5akBiuQ1tjhXnau", "di9ZSqn1Ya68Y2XpBPUV1rCtNGXh8Xe5MGWzb1Xe", "53OWivH0fK2VIAuMZTycr52EnSEnPWj97Jy3Dpiz", "AH7lRIhbsL167nptv6eub9xDJXVHnYUm2vL7FLjK", "OXLUmejkh9PlNDS4gSvi9gcEWacOpTz2KUVepVf4", "i6e1I8cfX625TTwRJlD2DshKyAoaUtO8aeoaR4i2", "i6e1I8cfX625TTwRJlD2DshKyAoaUtO8aeoaR4i2", "1cRIX8XoWP801OILra02i13IJ08IARBP5B6ydcnp", "2hicPxo2vy2NMHcg2cEU9crOeKtDpc14NEfMCthc", "2SrxurU07T2XPDxCAItjj4yYEMXlwV8K2kJB78AX", "SMbBD7DS9b3EPcyBVg4a8az1rRWR9xB068chHoUN", "wQDLu86Qab61vbtru7thf8Yj0xaeqVUH4ohoXESu", "Y53dikxXdT4E3afI1l8BMBSWgyhKvf65k6Dut1k6", "iMTsSsgDdI2FC0FjeEejS9LMxuJgDhFO3OHlwVjT", "HKHvPSPDezaxsTohFgDuG4WpKW6hB4SFYyztm9vc", "5UzOrcAE2F3rcuMX2EeIlaYv5VUcDe6Lyh0PeZX2", "AiXTqs1RO13a47tS5vjqA1UdRggx0tzJ3xKrrNH6"];
53
- }];
54
- readonly value: true;
55
- }];
41
+ }, Override<boolean>];
56
42
  };
57
43
  readonly enable_fiat_deposit: {
58
44
  readonly type: "boolean";
59
- readonly default_value: false;
45
+ readonly default_value: true;
60
46
  readonly overrides: [{
61
47
  readonly if_any: [{
62
48
  readonly key: "apiKey";
@@ -64,14 +50,7 @@ export declare const flagConfig: {
64
50
  readonly values: ["di9ZSqn1Ya68Y2XpBPUV1rCtNGXh8Xe5MGWzb1Xe"];
65
51
  }];
66
52
  readonly value: true;
67
- }, Override<boolean>, {
68
- readonly if_any: [{
69
- readonly key: "userId";
70
- readonly type: "pctRollout";
71
- readonly pct: 100;
72
- }];
73
- readonly value: true;
74
- }];
53
+ }, Override<boolean>];
75
54
  };
76
55
  readonly token_transfer_source_chains_and_assets: {
77
56
  readonly type: "string";
@@ -83,6 +62,13 @@ export declare const flagConfig: {
83
62
  readonly values: ["M3uox3cw0u8YCPV9cIREA6AugUMvPFTk6qOpm4um"];
84
63
  }];
85
64
  readonly value: string;
65
+ }, {
66
+ readonly if_any: [{
67
+ readonly key: "apiKey";
68
+ readonly type: "isAnyOf";
69
+ readonly values: ["OXLUmejkh9PlNDS4gSvi9gcEWacOpTz2KUVepVf4"];
70
+ }];
71
+ readonly value: string;
86
72
  }, {
87
73
  readonly if_any: [{
88
74
  readonly key: "apiKey";
@@ -196,26 +182,14 @@ export declare const flagConfig: {
196
182
  readonly type: "string";
197
183
  readonly default_value: string;
198
184
  };
199
- readonly help_tutorial_url: {
200
- readonly type: "string";
201
- readonly default_value: "";
202
- };
203
185
  readonly enable_card: {
204
186
  readonly type: "boolean";
205
- readonly default_value: true;
206
- readonly overrides: [Override<boolean>, {
207
- readonly if_any: [{
208
- readonly key: "apiKey";
209
- readonly type: "isAnyOf";
210
- readonly values: ["OXLUmejkh9PlNDS4gSvi9gcEWacOpTz2KUVepVf4"];
211
- }];
212
- readonly value: false;
213
- }];
187
+ readonly default_value: false;
188
+ readonly overrides: [];
214
189
  };
215
190
  readonly enable_brokerage: {
216
191
  readonly type: "boolean";
217
192
  readonly default_value: false;
218
- readonly overrides: [Override<boolean>];
219
193
  };
220
194
  readonly enable_bluvo_brokerage: {
221
195
  readonly type: "boolean";
@@ -292,7 +266,7 @@ export declare const flagConfig: {
292
266
  };
293
267
  readonly enable_bitcoin: {
294
268
  readonly type: "boolean";
295
- readonly default_value: true;
269
+ readonly default_value: false;
296
270
  readonly overrides: [{
297
271
  readonly if_any: [{
298
272
  readonly key: "apiKey";
@@ -6,6 +6,7 @@ declare class FunLogger {
6
6
  protected userName: string | null;
7
7
  protected userLoginType: string | null;
8
8
  protected sdkVersion: string | null;
9
+ protected l2Address: string | null;
9
10
  constructor();
10
11
  private getFunLogEnv;
11
12
  private logDataDog;
@@ -32,7 +33,8 @@ declare class FunLogger {
32
33
  getUserAddress(): string | null;
33
34
  getUserName(): string | null;
34
35
  getUserLoginType(): string | null;
35
- setUserInfo(userId: string, userAddress: string, userName: string, userLoginType: string): void;
36
+ getL2Address(): string | null;
37
+ setUserInfo(userId: string, userAddress: string, userName: string, userLoginType: string, l2Address?: string): void;
36
38
  }
37
39
  declare const logger: FunLogger;
38
40
  export { logger };
@@ -1,4 +1,4 @@
1
- import { type Abi, type Address } from 'viem';
2
- export declare const LIGHTER_DEPOSIT_ABI: Abi;
1
+ import { type Address } from 'viem';
3
2
  export declare const LIGHTER_DEPOSIT_ADDRESS: Address;
4
- export declare const roundDownToTick: (amount: bigint, tickSize: bigint) => bigint;
3
+ export declare const LIGHTER_NATIVE_FLOW_TIME_ESTIMATE_SECONDS = 110;
4
+ export declare const LIGHTER_DELAYED_AUTO_TRIGGER_CUTOFF: number;
@@ -23,12 +23,12 @@ import {
23
23
  import {
24
24
  uniswapWallet
25
25
  } from "./chunk-LH7BMNFZ.js";
26
- import {
27
- xdefiWallet
28
- } from "./chunk-BOU4WKRZ.js";
29
26
  import {
30
27
  walletConnectWallet
31
28
  } from "./chunk-NP5QGWNL.js";
29
+ import {
30
+ xdefiWallet
31
+ } from "./chunk-BOU4WKRZ.js";
32
32
  import {
33
33
  phantomWallet
34
34
  } from "./chunk-362NXNTM.js";
@@ -92,15 +92,15 @@ import {
92
92
  import {
93
93
  imTokenWallet
94
94
  } from "./chunk-COZ7MIQS.js";
95
- import {
96
- injectedWallet
97
- } from "./chunk-XWUJE7MW.js";
98
95
  import {
99
96
  kresusWallet
100
97
  } from "./chunk-MJXPRJZT.js";
101
98
  import {
102
99
  ledgerWallet
103
100
  } from "./chunk-BRBKM4PW.js";
101
+ import {
102
+ injectedWallet
103
+ } from "./chunk-XWUJE7MW.js";
104
104
  import {
105
105
  bybitWallet
106
106
  } from "./chunk-2STUC6QL.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect",
3
- "version": "7.0.3-next.0",
3
+ "version": "7.0.3-next.1",
4
4
  "description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
5
5
  "files": [
6
6
  "dist",
@@ -100,10 +100,10 @@
100
100
  "ua-parser-js": "^1.0.37",
101
101
  "use-debounce": "^10.0.5",
102
102
  "uuid": "^9.0.1",
103
- "@funkit/api-base": "1.12.21",
103
+ "@funkit/api-base": "1.12.22-next.0",
104
104
  "@funkit/chains": "0.5.2-next.0",
105
- "@funkit/fun-relay": "2.1.16-next.0",
106
- "@funkit/utils": "1.1.21"
105
+ "@funkit/fun-relay": "2.1.16-next.1",
106
+ "@funkit/utils": "1.1.22-next.0"
107
107
  },
108
108
  "repository": {
109
109
  "type": "git",