@funkit/connect 6.15.8 → 6.15.11

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @funkit/connect
2
2
 
3
+ ## 6.15.11
4
+
5
+ ### Patch Changes
6
+
7
+ - 2ab1e61: chore(connect): add WMON and AUSD symbols
8
+
9
+ ## 6.15.10
10
+
11
+ ### Patch Changes
12
+
13
+ - 0d40882: fix calling eoa endpoint during withdrawal
14
+ - 135c6eb: fix(connect): fix bug with smart wallets causing trimmed txHashes and broken UI
15
+
16
+ ## 6.15.9
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [d63acb4]
21
+ - @funkit/chains@0.4.8
22
+ - @funkit/core@2.3.65
23
+ - @funkit/wagmi-tools@3.0.88
24
+
3
25
  ## 6.15.8
4
26
 
5
27
  ### Patch Changes
@@ -22,5 +22,5 @@ export declare function getCheckoutTokenTransferParams({ checkoutConfig, userId,
22
22
  /**
23
23
  * creates QR code transfer EOA
24
24
  */
25
- export declare const useCheckoutTransferInit: () => UseCheckoutTransferInitResponse;
25
+ export declare const useCheckoutTransferInit: (enabled?: boolean) => UseCheckoutTransferInitResponse;
26
26
  export {};
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import {
3
- darkTheme
4
- } from "./chunk-KG5Q63KL.js";
5
2
  import {
6
3
  lightTheme
7
4
  } from "./chunk-L3BEU75V.js";
5
+ import {
6
+ darkTheme
7
+ } from "./chunk-KG5Q63KL.js";
8
8
  import {
9
9
  systemFontStack
10
10
  } from "./chunk-WCUXJAGT.js";
@@ -1514,7 +1514,7 @@ function setFunkitConnectVersion({ version }) {
1514
1514
  localStorage.setItem(storageKey, version);
1515
1515
  }
1516
1516
  function getCurrentSdkVersion() {
1517
- return "6.15.8";
1517
+ return "6.15.11";
1518
1518
  }
1519
1519
  function useFingerprint() {
1520
1520
  const fingerprint = useCallback2(() => {
@@ -2409,6 +2409,63 @@ var getWeb3AccountBalanceMessage = (t) => ({
2409
2409
  [2 /* APPROVE_TRANSFER */]: (tokenSymbol) => t("checkoutConfirmation.confirmTokenTransfer", { tokenSymbol })
2410
2410
  });
2411
2411
 
2412
+ // src/utils/directExecution.ts
2413
+ function getDirectExecutionCreatedTimeMs(directExecution) {
2414
+ const createdAt = directExecution?.listenerInfo?.relayExecutionRequestDetails?.createdAt || directExecution?.createdTimeMs || // Fallback to 0 if updatedAt is not defined. Not ideal but should really not happen unless its a really old test direct execution record
2415
+ 0;
2416
+ return new Date(createdAt).getTime();
2417
+ }
2418
+ function getDirectExecutionUpdatedTimeMs(directExecution) {
2419
+ const updatedAt = directExecution?.listenerInfo?.relayExecutionRequestDetails?.updatedAt || directExecution?.listenerInfo?.time || directExecution?.updatedTimeMs || // Fallback to 0 if updatedAt is not defined. Not ideal but should really not happen unless its a really old test direct execution record
2420
+ 0;
2421
+ return new Date(updatedAt).getTime();
2422
+ }
2423
+ function getDirectExecutionRunTimeSeconds(directExecution) {
2424
+ const beginTime = new Date(
2425
+ directExecution?.listenerInfo?.relayExecutionRequestDetails?.createdAt || directExecution.createdTimeMs
2426
+ ).getTime();
2427
+ const endTime = getDirectExecutionUpdatedTimeMs(directExecution);
2428
+ if (!beginTime || !endTime) {
2429
+ return 0;
2430
+ }
2431
+ return (endTime - beginTime) / 1e3;
2432
+ }
2433
+ async function supportsAtomicBatch(wallet, chainId) {
2434
+ if (!wallet.account) {
2435
+ return false;
2436
+ }
2437
+ try {
2438
+ const capabilities = await wallet.getCapabilities({
2439
+ account: wallet.account,
2440
+ chainId
2441
+ });
2442
+ return capabilities?.atomicBatch?.supported ?? (capabilities.atomic?.status && capabilities.atomic.status === "supported");
2443
+ } catch {
2444
+ return false;
2445
+ }
2446
+ }
2447
+ async function disableAtomicBatchIfSupported(wallet, chainId) {
2448
+ const hasAtomicBatch = await supportsAtomicBatch(wallet, chainId);
2449
+ if (!hasAtomicBatch) {
2450
+ return wallet;
2451
+ }
2452
+ return new Proxy(wallet, {
2453
+ get(target, prop, receiver) {
2454
+ if (prop === "getCapabilities") {
2455
+ return async (params) => {
2456
+ const capabilities = await target.getCapabilities(params);
2457
+ return {
2458
+ ...capabilities,
2459
+ atomicBatch: { supported: false },
2460
+ atomic: void 0
2461
+ };
2462
+ };
2463
+ }
2464
+ return Reflect.get(target, prop, receiver);
2465
+ }
2466
+ });
2467
+ }
2468
+
2412
2469
  // src/hooks/useRelayBypass.ts
2413
2470
  import { FlagKey as FlagKey3, isTokenAddressEquivalent as isTokenAddressEquivalent2 } from "@funkit/utils";
2414
2471
  import { useCallback as useCallback5, useMemo as useMemo9 } from "react";
@@ -3731,7 +3788,7 @@ function useCheckoutDirectExecution() {
3731
3788
  const { address } = useFunkitUserInfo();
3732
3789
  const { switchChainAsync } = useFunkitSwitchChains({});
3733
3790
  const { connector } = useFunkitAccount();
3734
- const { data: walletClient } = useWalletClient();
3791
+ const { data: _walletClient } = useWalletClient();
3735
3792
  const { getIsRelayEnabled } = useRelayBypass();
3736
3793
  const { apiKey } = useFunkitConfig();
3737
3794
  const getRelayDirectExecutionBaseQuote = useCallback6(
@@ -3811,13 +3868,14 @@ function useCheckoutDirectExecution() {
3811
3868
  if (!relayQuote) {
3812
3869
  throw new Error("Relay quote is not found in latestQuote");
3813
3870
  }
3814
- if (!walletClient && !withdrawalClient) {
3815
- throw new Error("Viem wallet client is not defined");
3816
- }
3817
3871
  const executionChainId = Number.parseInt(
3818
3872
  checkoutItem.selectedSourceAssetInfo.chainId
3819
3873
  );
3820
3874
  logger.log(`${logPrefix3}:executionChainId`, { executionChainId });
3875
+ const walletClient = _walletClient ? await disableAtomicBatchIfSupported(_walletClient, executionChainId) : void 0;
3876
+ if (!walletClient && !withdrawalClient) {
3877
+ throw new Error("Viem wallet client is not defined");
3878
+ }
3821
3879
  await checkAndSwitchChains({ executionChainId, stepMessageSetter });
3822
3880
  const translateRelayMessage = (message) => {
3823
3881
  const messageMap2 = {
@@ -3886,7 +3944,7 @@ function useCheckoutDirectExecution() {
3886
3944
  };
3887
3945
  return await waitForConfirmation();
3888
3946
  },
3889
- [walletClient, checkAndSwitchChains, t]
3947
+ [_walletClient, checkAndSwitchChains, t]
3890
3948
  );
3891
3949
  const getDirectExecutionInfo = useCallback6(
3892
3950
  (checkoutItem) => {
@@ -3998,7 +4056,7 @@ function getCheckoutTokenTransferParams({
3998
4056
  toTokenAddress: checkoutConfig.targetAsset
3999
4057
  };
4000
4058
  }
4001
- var useCheckoutTransferInit = () => {
4059
+ var useCheckoutTransferInit = (enabled = true) => {
4002
4060
  const { checkoutItem } = useCheckoutContext();
4003
4061
  const checkoutConfig = checkoutItem?.initSettings.config;
4004
4062
  const { walletAddress, userInfo } = useGeneralWallet();
@@ -4021,7 +4079,7 @@ var useCheckoutTransferInit = () => {
4021
4079
  queryFn: ({ queryKey: [_, queryKey2] }) => queryKey2 ? checkoutTransferFetch(queryKey2) : void 0,
4022
4080
  refetchOnWindowFocus: false,
4023
4081
  refetchOnMount: false,
4024
- enabled: !!queryKey && // Is flag enabled
4082
+ enabled: enabled && !!queryKey && // Is flag enabled
4025
4083
  isQrCodeEnabled && // QR Code is only supported for post action checkouts with action type
4026
4084
  isQRCodeEnabledWithPostAction
4027
4085
  });
@@ -4207,6 +4265,7 @@ function FunkitCheckoutProvider({ children }) {
4207
4265
  symbol: null,
4208
4266
  iconSrc: null
4209
4267
  },
4268
+ isWithdrawal: true,
4210
4269
  initSettings: {
4211
4270
  config: {
4212
4271
  ...checkoutConfig.config,
@@ -5269,28 +5328,6 @@ function useMultiStepDirectExecutionStatus(multiStepDirectExecution, disabled =
5269
5328
  };
5270
5329
  }
5271
5330
 
5272
- // src/utils/directExecution.ts
5273
- function getDirectExecutionCreatedTimeMs(directExecution) {
5274
- const createdAt = directExecution?.listenerInfo?.relayExecutionRequestDetails?.createdAt || directExecution?.createdTimeMs || // Fallback to 0 if updatedAt is not defined. Not ideal but should really not happen unless its a really old test direct execution record
5275
- 0;
5276
- return new Date(createdAt).getTime();
5277
- }
5278
- function getDirectExecutionUpdatedTimeMs(directExecution) {
5279
- const updatedAt = directExecution?.listenerInfo?.relayExecutionRequestDetails?.updatedAt || directExecution?.listenerInfo?.time || directExecution?.updatedTimeMs || // Fallback to 0 if updatedAt is not defined. Not ideal but should really not happen unless its a really old test direct execution record
5280
- 0;
5281
- return new Date(updatedAt).getTime();
5282
- }
5283
- function getDirectExecutionRunTimeSeconds(directExecution) {
5284
- const beginTime = new Date(
5285
- directExecution?.listenerInfo?.relayExecutionRequestDetails?.createdAt || directExecution.createdTimeMs
5286
- ).getTime();
5287
- const endTime = getDirectExecutionUpdatedTimeMs(directExecution);
5288
- if (!beginTime || !endTime) {
5289
- return 0;
5290
- }
5291
- return (endTime - beginTime) / 1e3;
5292
- }
5293
-
5294
5331
  // src/utils/purifyCheckoutHistoryItem.ts
5295
5332
  var purifyCheckoutHistoryItem = (item) => {
5296
5333
  if ("depositAddr" in item) {
@@ -7116,7 +7153,9 @@ var ASSET_LOGO_SRCS = {
7116
7153
  LIQUIDHYPE: "https://sdk-cdn.fun.xyz/images/liquidhype.svg",
7117
7154
  VHYPE: "https://sdk-cdn.fun.xyz/images/vhype.png",
7118
7155
  HBHYPE: "https://sdk-cdn.fun.xyz/images/hbhype.svg",
7119
- MON: "https://sdk-cdn.fun.xyz/images/monad.svg"
7156
+ MON: "https://sdk-cdn.fun.xyz/images/monad.svg",
7157
+ WMON: "https://sdk-cdn.fun.xyz/images/wmon.svg",
7158
+ AUSD: "https://sdk-cdn.fun.xyz/images/ausd.svg"
7120
7159
  };
7121
7160
  var FALLBACK_ASSET = "https://sdk-cdn.fun.xyz/images/dollar_circle.png";
7122
7161
  function getAssetLogoSrc(symbol) {
@@ -12594,7 +12633,8 @@ var useBluvoExchangeBalance = ({
12594
12633
  };
12595
12634
  var useBluvoCheckoutQuote = () => {
12596
12635
  const { bluvoClient } = useFunkitBrokerageContext();
12597
- const { transferInit } = useCheckoutTransferInit();
12636
+ const { checkoutItem } = useCheckoutContext();
12637
+ const { transferInit } = useCheckoutTransferInit(!checkoutItem?.isWithdrawal);
12598
12638
  const { selectedBrokerageAsset } = useFunkitBrokerageContext();
12599
12639
  async function getBluvoCheckoutQuote({
12600
12640
  amount,
@@ -1,4 +1,11 @@
1
1
  import type { DirectExecution } from '@funkit/api-base';
2
+ import type { WalletClient } from 'viem';
2
3
  export declare function getDirectExecutionCreatedTimeMs(directExecution: DirectExecution): number;
3
4
  export declare function getDirectExecutionUpdatedTimeMs(directExecution: DirectExecution): number;
4
5
  export declare function getDirectExecutionRunTimeSeconds(directExecution: DirectExecution): number;
6
+ export declare function supportsAtomicBatch(wallet: WalletClient, chainId: number): Promise<boolean>;
7
+ /**
8
+ * Returns a proxied wallet with getCapabilities patched to disable atomic batch support.
9
+ * This forces Relay to use sequential transactions instead of batched ones.
10
+ */
11
+ export declare function disableAtomicBatchIfSupported(wallet: WalletClient, chainId: number): Promise<WalletClient>;
@@ -57,8 +57,8 @@ import {
57
57
  safepalWallet
58
58
  } from "./chunk-NT2HYJKW.js";
59
59
  import {
60
- injectedWallet
61
- } from "./chunk-XWUJE7MW.js";
60
+ ledgerWallet
61
+ } from "./chunk-BRBKM4PW.js";
62
62
  import {
63
63
  metaMaskWallet
64
64
  } from "./chunk-2HYNUNAS.js";
@@ -68,12 +68,12 @@ import {
68
68
  import {
69
69
  oktoWallet
70
70
  } from "./chunk-ADIXAKUL.js";
71
- import {
72
- okxWallet
73
- } from "./chunk-TDIEHTMB.js";
74
71
  import {
75
72
  omniWallet
76
73
  } from "./chunk-7CUY5G6R.js";
74
+ import {
75
+ okxWallet
76
+ } from "./chunk-TDIEHTMB.js";
77
77
  import {
78
78
  oneInchWallet
79
79
  } from "./chunk-OESTDX6I.js";
@@ -86,24 +86,24 @@ import {
86
86
  import {
87
87
  frameWallet
88
88
  } from "./chunk-IFON7E6U.js";
89
- import {
90
- gateWallet
91
- } from "./chunk-FKJJQNKX.js";
92
89
  import {
93
90
  frontierWallet
94
91
  } from "./chunk-TCAGNB4B.js";
92
+ import {
93
+ gateWallet
94
+ } from "./chunk-FKJJQNKX.js";
95
95
  import {
96
96
  imTokenWallet
97
97
  } from "./chunk-COZ7MIQS.js";
98
+ import {
99
+ injectedWallet
100
+ } from "./chunk-XWUJE7MW.js";
98
101
  import {
99
102
  kresusWallet
100
103
  } from "./chunk-MJXPRJZT.js";
101
104
  import {
102
- ledgerWallet
103
- } from "./chunk-BRBKM4PW.js";
104
- import {
105
- bybitWallet
106
- } from "./chunk-2STUC6QL.js";
105
+ bloomWallet
106
+ } from "./chunk-S27IADFU.js";
107
107
  import {
108
108
  clvWallet
109
109
  } from "./chunk-M3NZ6R2E.js";
@@ -140,13 +140,13 @@ import {
140
140
  import {
141
141
  bitverseWallet
142
142
  } from "./chunk-3HZRRP4Y.js";
143
- import {
144
- bloomWallet
145
- } from "./chunk-S27IADFU.js";
146
- import "./chunk-23WIEY36.js";
147
143
  import {
148
144
  braveWallet
149
145
  } from "./chunk-BPZ2XJO2.js";
146
+ import {
147
+ bybitWallet
148
+ } from "./chunk-2STUC6QL.js";
149
+ import "./chunk-23WIEY36.js";
150
150
  import "./chunk-DNSG5Q7V.js";
151
151
  export {
152
152
  argentWallet,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect",
3
- "version": "6.15.8",
3
+ "version": "6.15.11",
4
4
  "description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
5
5
  "files": [
6
6
  "dist",
@@ -102,11 +102,11 @@
102
102
  "use-debounce": "^10.0.5",
103
103
  "uuid": "^9.0.1",
104
104
  "@funkit/api-base": "1.12.18",
105
- "@funkit/chains": "0.4.7",
106
- "@funkit/core": "2.3.64",
107
- "@funkit/fun-relay": "2.1.13",
105
+ "@funkit/chains": "0.4.8",
106
+ "@funkit/core": "2.3.65",
108
107
  "@funkit/utils": "1.1.19",
109
- "@funkit/wagmi-tools": "3.0.87"
108
+ "@funkit/fun-relay": "2.1.13",
109
+ "@funkit/wagmi-tools": "3.0.88"
110
110
  },
111
111
  "repository": {
112
112
  "type": "git",