@funkit/connect 5.5.13 → 5.5.14

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 (27) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/components/CopyAddress/CopyInputDisplayedAddress.css.d.ts +11 -0
  3. package/dist/components/CopyAddress/CopyInputDisplayedAddress.d.ts +0 -1
  4. package/dist/components/FunCheckoutHistory/FunCheckoutHistoryContent.d.ts +3 -1
  5. package/dist/components/Icons/CheckIcon.d.ts +2 -1
  6. package/dist/consts/customers.d.ts +0 -1
  7. package/dist/domains/asset.d.ts +2 -3
  8. package/dist/domains/clientMetadata.d.ts +7 -1
  9. package/dist/domains/quote.d.ts +3 -2
  10. package/dist/domains/relay.d.ts +5 -0
  11. package/dist/domains/wallet.d.ts +1 -1
  12. package/dist/hooks/queries/useWithdrawalQuote.d.ts +2 -3
  13. package/dist/hooks/useCheckoutDirectExecution.d.ts +17 -15
  14. package/dist/hooks/useCheckoutTimeEstimate.d.ts +3 -0
  15. package/dist/index.css +230 -88
  16. package/dist/index.js +8162 -8023
  17. package/dist/modals/CheckoutModal/ConfirmationStep/useCheckoutConfirmation.d.ts +1 -0
  18. package/dist/modals/CheckoutModal/InputAmount/InputAmountLoaded.d.ts +1 -1
  19. package/dist/modals/CheckoutModal/InputAmount/state.d.ts +1 -2
  20. package/dist/{components/Withdraw/WithdrawContent.d.ts → modals/WithdrwalModal/WithdrawalContent.d.ts} +1 -9
  21. package/dist/{components/Withdraw/WithdrawSuccess.d.ts → modals/WithdrwalModal/WithdrawalSuccess.d.ts} +3 -1
  22. package/dist/modals/WithdrwalModal/useWithdrawal.d.ts +24 -0
  23. package/dist/providers/FunkitCheckoutContext.d.ts +4 -1
  24. package/dist/utils/flags/config.d.ts +19 -12
  25. package/dist/wallets/walletConnectors/index.js +54 -54
  26. package/package.json +6 -6
  27. package/dist/hooks/useWithdrawal.d.ts +0 -15
@@ -20,5 +20,6 @@ interface UseCheckoutConfirmationResult {
20
20
  handleCheckoutConfirmation(): Promise<void>;
21
21
  isConfirming: boolean;
22
22
  }
23
+ export declare function toCheckoutConfirmationError(error: unknown): CheckoutConfirmationError;
23
24
  export declare function useCheckoutConfirmation({ onError, onSuccess, }: UseCheckoutConfirmationOptions): UseCheckoutConfirmationResult;
24
25
  export {};
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { type FunkitTextCustomizationsConfig } from '~/providers/FunkitConfigContext';
2
+ import type { FunkitTextCustomizationsConfig } from '~/providers/FunkitConfigContext';
3
3
  import type { AssetHoldingsItem } from '~/utils/assets';
4
4
  import type { FunkitCheckoutConfig } from '../../../providers/FunkitCheckoutContext';
5
5
  import { FunCheckoutStep, type ModalStepComponentProps } from '../stepTransition';
@@ -2,7 +2,6 @@ import { PaymentMethod } from '~/domains/paymentMethods';
2
2
  import type { AssetHoldingsItem } from '~/utils/assets';
3
3
  import type { FunkitCheckoutConfig } from '../../../providers/FunkitCheckoutContext';
4
4
  export interface AmountInputInitOptions {
5
- apiKey: string;
6
5
  checkoutConfig: FunkitCheckoutConfig;
7
6
  paymentMethod: PaymentMethod;
8
7
  sourceHolding: AssetHoldingsItem | null;
@@ -79,6 +78,6 @@ export type AmountInputError = {
79
78
  /** Input is empty */
80
79
  type: 'noInput';
81
80
  };
82
- export declare function initializeState({ apiKey, checkoutConfig, maxUsd, minUsd, paymentMethod, sourceHolding, unitPrice, defaultAmount, fiatCurrency, quickOptions, }: AmountInputInitOptions): AmountInputState;
81
+ export declare function initializeState({ checkoutConfig, maxUsd, minUsd, paymentMethod, sourceHolding, unitPrice, defaultAmount, fiatCurrency, quickOptions, }: AmountInputInitOptions): AmountInputState;
83
82
  export declare function reduceState(state: AmountInputState, action: AmountInputAction): AmountInputState;
84
83
  export declare function getDerivedState(state: AmountInputState): AmountInputDerivedState;
@@ -1,15 +1,7 @@
1
- import { type CheckoutQuoteResponse } from '@funkit/utils';
2
1
  import React from 'react';
3
2
  import { type Hex } from 'viem';
4
- import type { Address } from 'viem';
5
3
  import type { FunkitActiveWithdrawalItem, FunkitWithdrawalConfig } from '~/providers/FunkitCheckoutContext';
6
- export type WithdrawalFormData = {
7
- destinationAddress: Address;
8
- amount: string;
9
- token: string;
10
- chainId: number;
11
- quote: CheckoutQuoteResponse;
12
- };
4
+ import { type WithdrawalFormData } from './useWithdrawal';
13
5
  interface WithdrawContentProps {
14
6
  onContinue: (withdrawal: WithdrawalFormData, txHash: Hex) => void;
15
7
  config: FunkitWithdrawalConfig;
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
+ import type { Address } from 'viem';
2
3
  interface WithdrawSuccessProps {
4
+ depositAddress: Address;
3
5
  amount: number;
4
6
  token: string;
5
7
  tokenIconSrc: string;
@@ -9,5 +11,5 @@ interface WithdrawSuccessProps {
9
11
  onNewWithdrawal: () => void;
10
12
  onClose: () => void;
11
13
  }
12
- export declare const WithdrawSuccess: ({ amount, token, tokenIconSrc, chainId, txHash, bottomBarId, onNewWithdrawal, onClose, }: WithdrawSuccessProps) => React.JSX.Element;
14
+ export declare const WithdrawSuccess: ({ depositAddress, bottomBarId, onNewWithdrawal, onClose, }: WithdrawSuccessProps) => React.JSX.Element;
13
15
  export {};
@@ -0,0 +1,24 @@
1
+ import type { Address, Hex } from 'viem';
2
+ import type { FunkitCheckoutQuoteResult } from '~/domains/quote';
3
+ import { type FunkitActiveWithdrawalItem } from '~/providers/FunkitCheckoutContext';
4
+ import type { WithdrawalClient } from '~/wallets/Wallet';
5
+ import { type CheckoutConfirmationError } from '../CheckoutModal/ConfirmationStep/useCheckoutConfirmation';
6
+ interface UseWithdrawalResult {
7
+ handleWithdrawal: (withdrawal: WithdrawalFormData) => Promise<void>;
8
+ isWithdrawing: boolean;
9
+ withdrawalError: CheckoutConfirmationError | null;
10
+ stepMessage: string | null;
11
+ }
12
+ export type WithdrawalFormData = {
13
+ destinationAddress: Address;
14
+ amount: string;
15
+ token: string;
16
+ chainId: number;
17
+ quote: FunkitCheckoutQuoteResult;
18
+ };
19
+ export declare function useWithdrawal({ withdrawalWallet, withdrawalItem, onSuccess, }: {
20
+ withdrawalWallet: WithdrawalClient;
21
+ withdrawalItem: FunkitActiveWithdrawalItem | null;
22
+ onSuccess: (withdrawal: WithdrawalFormData, txHash: Hex) => void;
23
+ }): UseWithdrawalResult;
24
+ export {};
@@ -132,6 +132,7 @@ export interface FunkitActiveCheckoutItem extends Omit<ApiCheckoutClientMetadata
132
132
  };
133
133
  /** Time of completion of the active checkout item. For frontend use only. **/
134
134
  completedTimestampMs: number | null;
135
+ sourceAssetAmount: number | null;
135
136
  }
136
137
  export interface FunkitActiveWithdrawalItem {
137
138
  /** Unique identifier for frontend use only. */
@@ -154,13 +155,15 @@ interface FunkitCheckoutContextInterface {
154
155
  iconSrc: string | undefined;
155
156
  }): void;
156
157
  updateSelectedPaymentMethodInfo(newPaymentMethodInfo: PaymentMethodInfo): void;
157
- confirmCheckout(shouldBatchOpBypassInit: boolean, quote: FunkitCheckoutQuoteResult, stepMessageSetter: (m: string) => void): Promise<Address>;
158
+ updateCustomRecipient: (recipient: Address) => void;
159
+ confirmCheckout(shouldBatchOpBypassInit: boolean, quote: FunkitCheckoutQuoteResult, stepMessageSetter: (m: string) => void, withdrawalClient?: WithdrawalClient): Promise<Address>;
158
160
  cancelCheckout(depositAddress: Address): Promise<boolean>;
159
161
  /** @deprecated to be removed after quote migration is finished (historically named setCheckoutQuote) */
160
162
  setCheckout: (checkout: FunkitActiveCheckoutItem) => void;
161
163
  setCompletedTimestamp(timestampMs: number): void;
162
164
  withdrawalItem: FunkitActiveWithdrawalItem | null;
163
165
  initNewWithdrawal(initSettings: Partial<UseFunkitCheckoutPropsWithFullConfig>): string;
166
+ updateWithdrawalSourceAssetAmount(newSourceAmount: number): void;
164
167
  }
165
168
  export declare function FunkitCheckoutProvider({ children }: {
166
169
  children: ReactNode;
@@ -207,38 +207,45 @@ export declare const flagConfig: {
207
207
  help_tutorial_url: {
208
208
  type: "string";
209
209
  default_value: string;
210
- overrides: {
211
- if_any: {
212
- key: "apiKey";
213
- type: "isAnyOf";
214
- values: string[];
215
- }[];
216
- value: string;
217
- }[];
210
+ overrides: never[];
218
211
  };
219
212
  enable_card: {
220
213
  type: "boolean";
221
214
  default_value: true;
222
- overrides: {
215
+ overrides: ({
216
+ if_any: {
217
+ key: "userId";
218
+ type: "isAnyOf";
219
+ values: string[];
220
+ }[];
221
+ value: true;
222
+ } | {
223
223
  if_any: {
224
224
  key: "apiKey";
225
225
  type: "isAnyOf";
226
226
  values: string[];
227
227
  }[];
228
228
  value: false;
229
- }[];
229
+ })[];
230
230
  };
231
231
  enable_brokerage: {
232
232
  type: "boolean";
233
233
  default_value: true;
234
- overrides: {
234
+ overrides: ({
235
+ if_any: {
236
+ key: "userId";
237
+ type: "isAnyOf";
238
+ values: string[];
239
+ }[];
240
+ value: true;
241
+ } | {
235
242
  if_any: {
236
243
  key: "apiKey";
237
244
  type: "isAnyOf";
238
245
  values: string[];
239
246
  }[];
240
247
  value: false;
241
- }[];
248
+ })[];
242
249
  };
243
250
  enable_meld_payment: {
244
251
  type: "boolean";
@@ -1,49 +1,52 @@
1
1
  "use client";
2
2
  import {
3
- zerionWallet
4
- } from "./chunk-AXWP3GD4.js";
5
- import {
6
- walletConnectWallet
7
- } from "./chunk-NP5QGWNL.js";
3
+ xdefiWallet
4
+ } from "./chunk-NO7XMBB5.js";
8
5
  import {
9
6
  zealWallet
10
7
  } from "./chunk-JROWU5BP.js";
11
8
  import {
12
- subWallet
13
- } from "./chunk-AD2KIJB6.js";
9
+ zerionWallet
10
+ } from "./chunk-AXWP3GD4.js";
14
11
  import {
15
12
  tahoWallet
16
13
  } from "./chunk-6P2EMPZI.js";
14
+ import {
15
+ safepalWallet
16
+ } from "./chunk-MSFKSQBY.js";
17
17
  import {
18
18
  talismanWallet
19
19
  } from "./chunk-ABFSXBE6.js";
20
- import {
21
- tokenPocketWallet
22
- } from "./chunk-IDKVN5CF.js";
23
- import {
24
- trustWallet
25
- } from "./chunk-ISIBREBO.js";
26
20
  import {
27
21
  tokenaryWallet
28
22
  } from "./chunk-SLOIIJGP.js";
23
+ import {
24
+ tokenPocketWallet
25
+ } from "./chunk-IDKVN5CF.js";
29
26
  import {
30
27
  uniswapWallet
31
28
  } from "./chunk-LH7BMNFZ.js";
32
29
  import {
33
- xdefiWallet
34
- } from "./chunk-NO7XMBB5.js";
30
+ walletConnectWallet
31
+ } from "./chunk-NP5QGWNL.js";
32
+ import {
33
+ trustWallet
34
+ } from "./chunk-ISIBREBO.js";
35
35
  import {
36
36
  phantomWallet
37
37
  } from "./chunk-ZSVTX6EK.js";
38
38
  import {
39
- rabbyWallet
40
- } from "./chunk-BVX4XGNP.js";
39
+ oneKeyWallet
40
+ } from "./chunk-4AD7VI2P.js";
41
+ import {
42
+ rainbowWallet
43
+ } from "./chunk-2UCNRD7H.js";
41
44
  import {
42
45
  ramperWallet
43
46
  } from "./chunk-PIUNLQJG.js";
44
47
  import {
45
- rainbowWallet
46
- } from "./chunk-2UCNRD7H.js";
48
+ safeWallet
49
+ } from "./chunk-BQQQL6UD.js";
47
50
  import {
48
51
  roninWallet
49
52
  } from "./chunk-63YLN6R5.js";
@@ -51,26 +54,23 @@ import {
51
54
  safeheronWallet
52
55
  } from "./chunk-R6RWZRFF.js";
53
56
  import {
54
- safepalWallet
55
- } from "./chunk-MSFKSQBY.js";
56
- import {
57
- safeWallet
58
- } from "./chunk-BQQQL6UD.js";
59
- import {
60
- imTokenWallet
61
- } from "./chunk-COZ7MIQS.js";
57
+ subWallet
58
+ } from "./chunk-AD2KIJB6.js";
62
59
  import {
63
60
  metaMaskWallet
64
61
  } from "./chunk-G73C6P5P.js";
62
+ import {
63
+ ledgerWallet
64
+ } from "./chunk-BRBKM4PW.js";
65
65
  import {
66
66
  mewWallet
67
67
  } from "./chunk-V57WLZEE.js";
68
- import {
69
- okxWallet
70
- } from "./chunk-4WEHDI4Y.js";
71
68
  import {
72
69
  oktoWallet
73
70
  } from "./chunk-ADIXAKUL.js";
71
+ import {
72
+ okxWallet
73
+ } from "./chunk-4WEHDI4Y.js";
74
74
  import {
75
75
  omniWallet
76
76
  } from "./chunk-7CUY5G6R.js";
@@ -78,65 +78,65 @@ import {
78
78
  oneInchWallet
79
79
  } from "./chunk-OESTDX6I.js";
80
80
  import {
81
- oneKeyWallet
82
- } from "./chunk-4AD7VI2P.js";
83
- import {
84
- enkryptWallet
85
- } from "./chunk-SJTXS4ZW.js";
81
+ rabbyWallet
82
+ } from "./chunk-BVX4XGNP.js";
86
83
  import {
87
84
  foxWallet
88
85
  } from "./chunk-LMZMXEXL.js";
86
+ import {
87
+ frameWallet
88
+ } from "./chunk-ZMYVTWDF.js";
89
+ import {
90
+ frontierWallet
91
+ } from "./chunk-3S2U24BJ.js";
89
92
  import {
90
93
  gateWallet
91
94
  } from "./chunk-GSOYKKIS.js";
92
95
  import {
93
- frameWallet
94
- } from "./chunk-ZMYVTWDF.js";
96
+ imTokenWallet
97
+ } from "./chunk-COZ7MIQS.js";
95
98
  import {
96
99
  injectedWallet
97
100
  } from "./chunk-VCVVV2K7.js";
98
- import {
99
- ledgerWallet
100
- } from "./chunk-BRBKM4PW.js";
101
101
  import {
102
102
  kresusWallet
103
103
  } from "./chunk-MJXPRJZT.js";
104
104
  import {
105
- clvWallet
106
- } from "./chunk-KR6JBW5E.js";
105
+ bybitWallet
106
+ } from "./chunk-6ONTSPEY.js";
107
107
  import {
108
108
  coin98Wallet
109
109
  } from "./chunk-DTRYS3MO.js";
110
110
  import {
111
- bybitWallet
112
- } from "./chunk-6ONTSPEY.js";
113
- import {
114
- coreWallet
115
- } from "./chunk-HBA36GW3.js";
111
+ clvWallet
112
+ } from "./chunk-KR6JBW5E.js";
116
113
  import {
117
114
  coinbaseWallet
118
115
  } from "./chunk-H4IRCEZN.js";
119
116
  import {
120
- dawnWallet
121
- } from "./chunk-LN7OD5EC.js";
117
+ coreWallet
118
+ } from "./chunk-HBA36GW3.js";
122
119
  import {
123
120
  desigWallet
124
121
  } from "./chunk-CTU6JCOK.js";
125
122
  import {
126
- frontierWallet
127
- } from "./chunk-3S2U24BJ.js";
123
+ dawnWallet
124
+ } from "./chunk-LN7OD5EC.js";
125
+ import {
126
+ enkryptWallet
127
+ } from "./chunk-SJTXS4ZW.js";
128
128
  import {
129
129
  argentWallet
130
130
  } from "./chunk-WSQ2YJO2.js";
131
131
  import {
132
132
  bitgetWallet
133
133
  } from "./chunk-A5APNTGL.js";
134
- import {
135
- bitskiWallet
136
- } from "./chunk-P74YPRF6.js";
137
134
  import {
138
135
  bifrostWallet
139
136
  } from "./chunk-W6N74MS3.js";
137
+ import {
138
+ bitskiWallet
139
+ } from "./chunk-P74YPRF6.js";
140
140
  import {
141
141
  bitverseWallet
142
142
  } from "./chunk-3HZRRP4Y.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect",
3
- "version": "5.5.13",
3
+ "version": "5.5.14",
4
4
  "description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
5
5
  "files": [
6
6
  "dist",
@@ -88,12 +88,12 @@
88
88
  "ua-parser-js": "^1.0.37",
89
89
  "use-debounce": "^10.0.5",
90
90
  "uuid": "^9.0.1",
91
- "@funkit/api-base": "1.9.5",
92
- "@funkit/chains": "0.3.2",
91
+ "@funkit/api-base": "1.9.6",
92
+ "@funkit/core": "2.3.28",
93
+ "@funkit/chains": "0.3.3",
93
94
  "@funkit/fun-relay": "0.1.9",
94
- "@funkit/utils": "1.1.4",
95
- "@funkit/wagmi-tools": "3.0.49",
96
- "@funkit/core": "2.3.27"
95
+ "@funkit/utils": "1.1.5",
96
+ "@funkit/wagmi-tools": "3.0.50"
97
97
  },
98
98
  "repository": {
99
99
  "type": "git",
@@ -1,15 +0,0 @@
1
- import type { Hex } from 'viem';
2
- import type { WithdrawalFormData } from '~/components/Withdraw/WithdrawContent';
3
- import type { FunkitActiveWithdrawalItem } from '~/providers/FunkitCheckoutContext';
4
- import type { WithdrawalClient } from '~/wallets/Wallet';
5
- interface UseWithdrawalResult {
6
- handleWithdrawal: (withdrawal: WithdrawalFormData) => Promise<void>;
7
- isWithdrawing: boolean;
8
- }
9
- export declare function useWithdrawal({ withdrawalWallet, withdrawalItem, onSuccess, onError, }: {
10
- withdrawalWallet: WithdrawalClient;
11
- withdrawalItem: FunkitActiveWithdrawalItem | null;
12
- onSuccess: (withdrawal: WithdrawalFormData, txHash: Hex) => void;
13
- onError: (error: Error) => void;
14
- }): UseWithdrawalResult;
15
- export {};