@funkit/connect 12.9.0 → 12.10.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @funkit/connect
2
2
 
3
+ ## 12.10.1
4
+
5
+ ### Patch Changes
6
+
7
+ - e06ae58: Skip wallet holdings with a malformed balance instead of crashing the checkout modal.
8
+ - 28803f9: Show the clear button on the withdrawal recipient address input when both an EVM and a Solana wallet are connected.
9
+ - Updated dependencies [bd9d5e8]
10
+ - Updated dependencies [e06ae58]
11
+ - Updated dependencies [48aae63]
12
+ - @funkit/api-base@8.5.1
13
+ - @funkit/connect-core@8.4.0
14
+ - @funkit/chains@2.4.1
15
+ - @funkit/fun-relay@3.1.1
16
+ - @funkit/utils@5.0.1
17
+
18
+ ## 12.10.0
19
+
20
+ ### Minor Changes
21
+
22
+ - 54a6a79: Polymarket deposit configs can set the direction and amount the Transfer tab opens with.
23
+
24
+ ### Patch Changes
25
+
26
+ - d4de552: Solana withdrawal signing now comes from the shared connect-core client.
27
+ - 400e342: The Polymarket transfer amount field shows dollars to the cent; Max still moves the full balance.
28
+ - Updated dependencies [d4de552]
29
+ - Updated dependencies [28c7128]
30
+ - Updated dependencies [30c01e5]
31
+ - Updated dependencies [d4de552]
32
+ - Updated dependencies [12a70d7]
33
+ - Updated dependencies [c452c25]
34
+ - Updated dependencies [ab41aa7]
35
+ - @funkit/api-base@8.5.0
36
+ - @funkit/connect-core@8.3.0
37
+ - @funkit/fun-relay@3.1.0
38
+
3
39
  ## 12.9.0
4
40
 
5
41
  ### Minor Changes
@@ -78,7 +78,8 @@ function createPolymarketDepositConfig({
78
78
  modalTitles,
79
79
  defaultAccount = "predictions",
80
80
  pendingTransfers,
81
- access
81
+ access,
82
+ transferDefaults
82
83
  }) {
83
84
  const isPerpsRoute = (routingId) => routingId === POLYMARKET_PERPS_ROUTING_ID;
84
85
  const resolvedAccess = { ...access ?? FULL_DEPOSIT_ACCESS };
@@ -138,7 +139,9 @@ function createPolymarketDepositConfig({
138
139
  predictions,
139
140
  perps,
140
141
  pending: pendingTransfers,
141
- access: resolvedAccess
142
+ access: resolvedAccess,
143
+ initialDirection: transferDefaults?.direction,
144
+ initialAmountUsd: transferDefaults?.amountUsd
142
145
  }
143
146
  };
144
147
  }
@@ -5,7 +5,6 @@ import {
5
5
  import {
6
6
  PLACEHOLDER_FUNKIT_USER_INFO
7
7
  } from "../../chunk-CE42WHAA.js";
8
- import "../../chunk-4DBUYTEE.js";
9
8
  import "../../chunk-6EU6CXNH.js";
10
9
  import {
11
10
  useFunkitConfig
@@ -13,6 +12,7 @@ import {
13
12
  import {
14
13
  useFunkitTranslation
15
14
  } from "../../chunk-ATNOIBW2.js";
15
+ import "../../chunk-4DBUYTEE.js";
16
16
  import "../../chunk-2W2P3OS6.js";
17
17
  import "../../chunk-7GPRX32F.js";
18
18
  import {
@@ -1,5 +1,5 @@
1
1
  import { POLYMARKET_PERPS_ROUTING_ID, POLYMARKET_PREDICTIONS_ROUTING_ID } from '../../consts/polymarket';
2
- import type { DepositAccess, FunkitCheckoutActionParams, FunkitCheckoutConfig, PolymarketPerpsTransferPending, PolymarketTransferAccount } from '../../providers/FunkitCheckoutContext/types';
2
+ import type { DepositAccess, FunkitCheckoutActionParams, FunkitCheckoutConfig, PerpsTransferDirection, PolymarketPerpsTransferPending, PolymarketTransferAccount } from '../../providers/FunkitCheckoutContext/types';
3
3
  import { type PolymarketPerpsDepositConfig } from './polymarket';
4
4
  export { POLYMARKET_PERPS_ROUTING_ID, POLYMARKET_PREDICTIONS_ROUTING_ID };
5
5
  /**
@@ -22,7 +22,21 @@ export type PolymarketAccount = PolymarketTransferAccount;
22
22
  * reaching outside this entry point — returning the rail's id is what lets a
23
23
  * transfer record be joined to Polymarket's side of the same transfer.
24
24
  */
25
- export type { PolymarketPerpsTransferPending, DepositAccess, PolymarketTransferResult, } from '../../providers/FunkitCheckoutContext/types';
25
+ export type { PolymarketPerpsTransferPending, DepositAccess, PerpsTransferDirection, PolymarketTransferResult, } from '../../providers/FunkitCheckoutContext/types';
26
+ /** What the transfer step opens with. Both fields are optional. */
27
+ export interface PolymarketTransferDefaults {
28
+ /**
29
+ * Direction on open. Defaults to Predictions → Perps. Ignored when `access`
30
+ * leaves only one product fundable — that product is the destination.
31
+ */
32
+ direction?: PerpsTransferDirection;
33
+ /**
34
+ * Amount the field opens with, as a plain USD string with up to 2 decimals
35
+ * and no commas/separators. Examples of acceptable values: `'12.50'`,
36
+ * `'25'`, `'1000.00'`. Anything else is ignored.
37
+ */
38
+ amountUsd?: string;
39
+ }
26
40
  export interface CreatePolymarketDepositConfigParams {
27
41
  /** Predictions account (the user's predictions proxy). */
28
42
  predictions: PolymarketAccount;
@@ -57,6 +71,8 @@ export interface CreatePolymarketDepositConfigParams {
57
71
  * location".
58
72
  */
59
73
  access?: DepositAccess;
74
+ /** Direction and amount the Transfer tab opens with. */
75
+ transferDefaults?: PolymarketTransferDefaults;
60
76
  }
61
77
  /**
62
78
  * Builds the entire Polymarket deposit checkout config from the two accounts.
@@ -66,4 +82,4 @@ export interface CreatePolymarketDepositConfigParams {
66
82
  * step; modal title, min deposit, recipient and on-chain deposit actions are
67
83
  * derived per account. Supersedes the "Deposit to" dropdown.
68
84
  */
69
- export declare function createPolymarketDepositConfig({ predictions, perps, modalTitleMeta, modalTitles, defaultAccount, pendingTransfers, access, }: CreatePolymarketDepositConfigParams): FunkitCheckoutConfig;
85
+ export declare function createPolymarketDepositConfig({ predictions, perps, modalTitleMeta, modalTitles, defaultAccount, pendingTransfers, access, transferDefaults, }: CreatePolymarketDepositConfigParams): FunkitCheckoutConfig;
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  createPolymarketDepositConfig,
4
4
  createPredictionsGenerateActionParams
5
- } from "../chunk-RAJJSGNT.js";
5
+ } from "../chunk-U33QNTIA.js";
6
6
  import {
7
7
  POLYMARKET_PERPS_ROUTING_ID,
8
8
  POLYMARKET_PREDICTIONS_ROUTING_ID
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  createPolymarketDepositConfig,
4
4
  createPredictionsGenerateActionParams
5
- } from "../chunk-RAJJSGNT.js";
5
+ } from "../chunk-U33QNTIA.js";
6
6
  import {
7
7
  AMOUNT_PLACEHOLDER,
8
8
  COLLATERAL_ONRAMP_ABI,
@@ -1,4 +1,7 @@
1
+ import type { ChainAssetBalanceInfo } from '@funkit/api-base';
1
2
  import { type AssetHoldingsMap } from '../utils/assets';
3
+ import { type IsStablecoinFn } from './useIsStablecoin';
4
+ export declare const processWalletAssets: (walletAssets: ChainAssetBalanceInfo | undefined, targetChain: string, isStablecoin: IsStablecoinFn) => AssetHoldingsMap<import("../domains/wallet").AssetHoldingsItem> | undefined;
2
5
  interface UseWalletAssetHoldingsResponse {
3
6
  data: AssetHoldingsMap | undefined;
4
7
  isLoading: boolean;
package/dist/index.js CHANGED
@@ -113,7 +113,7 @@ function setFunkitConnectVersion({ version }) {
113
113
  localStorage.setItem(storageKey, version);
114
114
  }
115
115
  function getCurrentSdkVersion() {
116
- return "12.9.0";
116
+ return "12.10.1";
117
117
  }
118
118
  function useFingerprint() {
119
119
  const fingerprint = useCallback(() => {
@@ -9861,43 +9861,21 @@ var useSolanaWallet = () => {
9861
9861
  // src/utils/solanaRelayWallet.ts
9862
9862
  import { isSolanaChainId as isSolanaChainId2 } from "@funkit/chains";
9863
9863
  import {
9864
- getSolanaWallet
9865
- } from "@funkit/fun-relay";
9864
+ createSolanaRelayWallet as createSharedSolanaRelayWallet,
9865
+ resolveSolanaSigner
9866
+ } from "@funkit/connect-core/clients/solana";
9866
9867
 
9867
9868
  // src/wallets/Wallet.ts
9868
- function isSolanaWithdrawalClient(client) {
9869
- return "_type" in client && client._type === "solana";
9870
- }
9869
+ import {
9870
+ isSolanaWithdrawalClient
9871
+ } from "@funkit/connect-core/clients/solana";
9871
9872
  function isLighterWithdrawalClient(client) {
9872
9873
  return "_type" in client && client._type === "lighter";
9873
9874
  }
9874
9875
 
9875
9876
  // src/utils/solanaRelayWallet.ts
9876
- function resolveSigner(wallet) {
9877
- if (wallet.signTransaction) {
9878
- logger.info("solanaSigner:resolved", {
9879
- address: wallet.address,
9880
- path: "signTransaction"
9881
- });
9882
- return { signTransaction: wallet.signTransaction.bind(wallet) };
9883
- }
9884
- if (wallet.signAndSendTransaction) {
9885
- logger.info("solanaSigner:resolved", {
9886
- address: wallet.address,
9887
- path: "signAndSendTransaction"
9888
- });
9889
- return {
9890
- signAndSendTransaction: wallet.signAndSendTransaction.bind(wallet)
9891
- };
9892
- }
9893
- throw new Error("Solana wallet supplied no way to sign a transaction");
9894
- }
9895
9877
  function createSolanaRelayWallet(wallet) {
9896
- return getSolanaWallet({
9897
- walletAddress: wallet.address,
9898
- connection: wallet.connection,
9899
- signer: resolveSigner(wallet)
9900
- });
9878
+ return createSharedSolanaRelayWallet(wallet, logger);
9901
9879
  }
9902
9880
  function resolveSolanaRelayWallet({
9903
9881
  sourceChainId,
@@ -17275,8 +17253,11 @@ var FunInput = forwardRef4(function FunInputWithRef({
17275
17253
  paddingLeft: "4",
17276
17254
  paddingRight: "10",
17277
17255
  ...allowMultiline ? {
17256
+ display: "flex",
17257
+ alignItems: "center",
17278
17258
  style: {
17279
- paddingTop: `calc(${themeVars.spacing.inputPaddingY} - 3px)`
17259
+ marginTop: themeVars.spacing.inputPaddingY,
17260
+ height: themeVars.fontSize.inputValue.lineHeight
17280
17261
  }
17281
17262
  } : {}
17282
17263
  },
@@ -20149,6 +20130,7 @@ import {
20149
20130
  FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS as FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS4,
20150
20131
  FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7
20151
20132
  } from "@funkit/chains";
20133
+ import { parseBigInt } from "@funkit/connect-core";
20152
20134
  import * as dnum5 from "dnum";
20153
20135
  import { useMemo as useMemo31 } from "react";
20154
20136
 
@@ -20492,6 +20474,17 @@ var processWalletAssets = (walletAssets, targetChain, isStablecoin) => {
20492
20474
  if (!asset.symbol || !asset.contractAddress) {
20493
20475
  return result;
20494
20476
  }
20477
+ const tokenBalanceBaseUnit = parseBigInt(asset.tokenBalance);
20478
+ if (tokenBalanceBaseUnit === void 0 || tokenBalanceBaseUnit < 0n) {
20479
+ logger.warn("walletAssetsSkipped:malformedBalance", {
20480
+ chainId: asset.chainId,
20481
+ contractAddress: asset.contractAddress,
20482
+ symbol: asset.symbol,
20483
+ decimals: asset.decimals,
20484
+ tokenBalance: asset.tokenBalance
20485
+ });
20486
+ return result;
20487
+ }
20495
20488
  const assetChainInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7[asset.chainId];
20496
20489
  const isAssetOnMainnet = assetChainInfo?.isMainnet;
20497
20490
  if (isCheckoutOnMainnet && !isAssetOnMainnet) {
@@ -20509,13 +20502,13 @@ var processWalletAssets = (walletAssets, targetChain, isStablecoin) => {
20509
20502
  });
20510
20503
  const normalizedTokenAddress = assetChainInfo?.nativeCurrency.symbol.toUpperCase() === asset.symbol.toUpperCase() ? FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS4 : asset.contractAddress;
20511
20504
  const normalizeAmount = getNormalizedTokenBalance(
20512
- BigInt(asset.tokenBalance),
20505
+ tokenBalanceBaseUnit,
20513
20506
  asset.decimals
20514
20507
  );
20515
20508
  const unitPriceUsd = asset.price != null && isStablecoin(asset.symbol) ? 1 : asset.price;
20516
20509
  const usdAmount = unitPriceUsd != null ? toDisplayNumber(
20517
20510
  mulByPriceRoundedDown(
20518
- dnum5.from([BigInt(asset.tokenBalance), asset.decimals]),
20511
+ dnum5.from([tokenBalanceBaseUnit, asset.decimals]),
20519
20512
  unitPriceUsd,
20520
20513
  2
20521
20514
  )
@@ -26156,6 +26149,7 @@ function useConnectedWalletShortcut({
26156
26149
  ]);
26157
26150
  return {
26158
26151
  showUseConnected,
26152
+ hasMultipleWalletsConnected,
26159
26153
  connectedWalletAddress,
26160
26154
  connectedWalletIconUrl
26161
26155
  };
@@ -26185,7 +26179,12 @@ function WithdrawRecipientAddress({
26185
26179
  const addressAtFocusRef = useRef21(recipientAddress);
26186
26180
  const { updateCustomRecipient } = useCheckoutContext();
26187
26181
  const showCheckAddressAlert = false;
26188
- const { showUseConnected, connectedWalletAddress, connectedWalletIconUrl } = useConnectedWalletShortcut({ config });
26182
+ const {
26183
+ showUseConnected,
26184
+ hasMultipleWalletsConnected,
26185
+ connectedWalletAddress,
26186
+ connectedWalletIconUrl
26187
+ } = useConnectedWalletShortcut({ config });
26189
26188
  const isPrefillConnectedAddressEnabled = useFeatureGate(
26190
26189
  "enable-prefill-withdrawal-connected-address"
26191
26190
  );
@@ -26193,6 +26192,7 @@ function WithdrawRecipientAddress({
26193
26192
  firstAddress: recipientAddress,
26194
26193
  secondAddress: connectedWalletAddress
26195
26194
  });
26195
+ const showClearButton = isShowingConnectedAddress || hasMultipleWalletsConnected && recipientAddress !== "";
26196
26196
  const inputRef = useRef21(null);
26197
26197
  const { fontSize: connectedAddressFontSize } = useFittedText({
26198
26198
  enabled: isShowingConnectedAddress,
@@ -26308,7 +26308,7 @@ function WithdrawRecipientAddress({
26308
26308
  }
26309
26309
  )
26310
26310
  )) : void 0,
26311
- suffix: isShowingConnectedAddress ? /* @__PURE__ */ React146.createElement(
26311
+ suffix: showClearButton ? /* @__PURE__ */ React146.createElement(
26312
26312
  FunIconButton,
26313
26313
  {
26314
26314
  icon: /* @__PURE__ */ React146.createElement(CloseIcon, { size: 8 }),
@@ -38549,7 +38549,7 @@ function PerpsTransferBody({ form }) {
38549
38549
  /* @__PURE__ */ React229.createElement(
38550
38550
  PerpsTransferAmountInput,
38551
38551
  {
38552
- amount: form.amount,
38552
+ amount: form.displayAmount,
38553
38553
  onAmountChange: form.setAmount
38554
38554
  }
38555
38555
  ),
@@ -38751,9 +38751,13 @@ function parseAmount(amount) {
38751
38751
  return Number(amount.replace(/,/g, ""));
38752
38752
  }
38753
38753
  var MAX_AMOUNT_DECIMALS = 6;
38754
- var VALID_AMOUNT_INPUT = new RegExp(
38755
- `^[\\d,]*\\.?\\d{0,${MAX_AMOUNT_DECIMALS}}$`
38756
- );
38754
+ var MAX_TYPED_DECIMALS = 2;
38755
+ var VALID_FILLED_AMOUNT = buildAmountInputPattern(MAX_AMOUNT_DECIMALS);
38756
+ var VALID_TYPED_AMOUNT = buildAmountInputPattern(MAX_TYPED_DECIMALS);
38757
+ var VALID_PREFILL_AMOUNT = /^\d+(\.\d{1,2})?$/;
38758
+ function buildAmountInputPattern(maxDecimals) {
38759
+ return new RegExp(`^[\\d,]*\\.?\\d{0,${maxDecimals}}$`);
38760
+ }
38757
38761
  function toNumericString(amount) {
38758
38762
  const cleaned = amount.replace(/,/g, "").replace(/\.$/, "");
38759
38763
  return cleaned.startsWith(".") ? `0${cleaned}` : cleaned;
@@ -38763,6 +38767,12 @@ function formatAmountValue(value) {
38763
38767
  maximumFractionDigits: 6
38764
38768
  });
38765
38769
  }
38770
+ function formatDisplayAmount(amount) {
38771
+ return floorToDecimals(parseAmount(amount), 2).toLocaleString("en-US", {
38772
+ minimumFractionDigits: 2,
38773
+ maximumFractionDigits: 2
38774
+ });
38775
+ }
38766
38776
  function getLockedTransferDirection(access) {
38767
38777
  if (!access || access.predictions === access.perps) {
38768
38778
  return void 0;
@@ -38784,8 +38794,14 @@ function usePerpsTransferForm({
38784
38794
  }) {
38785
38795
  const { t } = useFunkitTranslation();
38786
38796
  const { logEvent } = useTrack();
38787
- const [amount, setAmount] = useState62(initialAmountUsd);
38788
- const [amountSelection, setAmountSelection] = useState62(null);
38797
+ const initialAmount = Number(initialAmountUsd);
38798
+ const isInitialAmountUsdValid = VALID_PREFILL_AMOUNT.test(initialAmountUsd) && Number.isFinite(initialAmount) && initialAmount > 0;
38799
+ const [amount, setAmount] = useState62(
38800
+ isInitialAmountUsdValid ? initialAmountUsd : ""
38801
+ );
38802
+ const [amountSelection, setAmountSelection] = useState62(
38803
+ isInitialAmountUsdValid ? "prefill" : null
38804
+ );
38789
38805
  const lockedDirection = getLockedTransferDirection(access);
38790
38806
  const predictionsAccessible = access?.predictions ?? true;
38791
38807
  const perpsAccessible = access?.perps ?? true;
@@ -38801,10 +38817,12 @@ function usePerpsTransferForm({
38801
38817
  },
38802
38818
  initialDirection,
38803
38819
  resolvedDirection: lockedDirection ?? initialDirection,
38804
- isDirectionLocked: Boolean(lockedDirection) || !hasAccessibleDestination
38820
+ isDirectionLocked: Boolean(lockedDirection) || !hasAccessibleDestination,
38821
+ initialAmountUsd
38805
38822
  });
38806
38823
  }, [
38807
38824
  hasAccessibleDestination,
38825
+ initialAmountUsd,
38808
38826
  initialDirection,
38809
38827
  lockedDirection,
38810
38828
  perpsAccessible,
@@ -38822,7 +38840,8 @@ function usePerpsTransferForm({
38822
38840
  }
38823
38841
  }, [status]);
38824
38842
  const applyValidAmount = (next, selection) => {
38825
- if (VALID_AMOUNT_INPUT.test(next)) {
38843
+ const pattern = selection === "manual" ? VALID_TYPED_AMOUNT : VALID_FILLED_AMOUNT;
38844
+ if (pattern.test(next)) {
38826
38845
  setAmount(next);
38827
38846
  setAmountSelection(selection);
38828
38847
  }
@@ -38926,8 +38945,10 @@ function usePerpsTransferForm({
38926
38945
  amountSelection
38927
38946
  });
38928
38947
  };
38948
+ const displayAmount = amountSelection !== null && amountSelection !== "manual" ? formatDisplayAmount(amount) : amount;
38929
38949
  return {
38930
38950
  amount,
38951
+ displayAmount,
38931
38952
  setAmount: handleAmountChange,
38932
38953
  fillMaxAmount,
38933
38954
  fillPercentAmount,
@@ -39039,6 +39060,8 @@ function PerpsTransferStepComponent({
39039
39060
  perpsBalanceUsd,
39040
39061
  predictionsMinTransferUsd: perpsTransfer?.predictions.getMinTopupAmount("pUSD"),
39041
39062
  perpsMinTransferUsd: perpsTransfer?.perps.getMinTopupAmount("pUSD"),
39063
+ initialDirection: perpsTransfer?.initialDirection,
39064
+ initialAmountUsd: perpsTransfer?.initialAmountUsd,
39042
39065
  status,
39043
39066
  isBalanceRefreshing,
39044
39067
  pendingTransfers: perpsTransfer?.pending,
@@ -56581,22 +56604,10 @@ function createConnectedWithdrawalClient(config, ownerAddress, sourceChainId) {
56581
56604
  // src/wallets/solanaWithdrawal.ts
56582
56605
  import { solanaChain as solanaChain8 } from "@funkit/chains";
56583
56606
  import { toValidatedSolanaAddress as toValidatedSolanaAddress2, useLogOnce as useLogOnce6 } from "@funkit/connect-core";
56607
+ import {
56608
+ createSolanaWithdrawalClient
56609
+ } from "@funkit/connect-core/clients/solana";
56584
56610
  import { useMemo as useMemo76 } from "react";
56585
- function unsupported(member) {
56586
- throw new Error(`SolanaWithdrawalClient does not support ${member}`);
56587
- }
56588
- function createSolanaWithdrawalClient(wallet) {
56589
- return {
56590
- _type: "solana",
56591
- adaptedWallet: createSolanaRelayWallet(wallet),
56592
- address: () => wallet.address,
56593
- getChainId: async () => solanaChain8.id,
56594
- switchChain: async () => {
56595
- },
56596
- sendTransaction: () => unsupported("sendTransaction"),
56597
- confirmTransaction: () => unsupported("confirmTransaction")
56598
- };
56599
- }
56600
56611
  function useSolanaWithdrawalConfig(params) {
56601
56612
  const signer = params?.signer;
56602
56613
  const address = toValidatedSolanaAddress2(signer?.address);
@@ -56618,7 +56629,10 @@ function useSolanaWithdrawalConfig(params) {
56618
56629
  // TODO: Cast until #6751 widens the source address type.
56619
56630
  sourceTokenAddress,
56620
56631
  sourceChainId: String(solanaChain8.id),
56621
- wallet: createSolanaWithdrawalClient({ ...signer, address })
56632
+ wallet: createSolanaWithdrawalClient(
56633
+ signer,
56634
+ logger
56635
+ )
56622
56636
  };
56623
56637
  }, [params, signer, address]);
56624
56638
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import type { DepositAccess, PolymarketPerpsTransferPending } from '../../providers/FunkitCheckoutContext/types';
2
+ import type { DepositAccess, PerpsTransferDirection, PolymarketPerpsTransferPending } from '../../providers/FunkitCheckoutContext/types';
3
3
  import { type PerpsTransferAmountSelection } from './usePerpsTransferForm';
4
- export type PerpsTransferDirection = 'toPerps' | 'toPredictions';
4
+ export type { PerpsTransferDirection };
5
5
  /**
6
6
  * `pending` and `loading` can be derived by the form from transfer and balance
7
7
  * state. Explicit host-provided statuses are honored as well.
@@ -1,23 +1,19 @@
1
1
  import type { DepositAccess, PolymarketPerpsTransferPending } from '../../providers/FunkitCheckoutContext/types';
2
2
  import type { PerpsTransferDirection, PerpsTransferStatus } from './PolymarketPerpsTransferScreen';
3
3
  /**
4
- * pUSD has 6 on-chain decimals, so balances carry up to 6 decimal places. We
5
- * render only the decimals actually present, up to 6: capping at 2 rounded
6
- * `196.867461` *up* to `196.87`, so Max filled a value above the real balance
7
- * and tripped the insufficient-balance guard. At 6 decimals the value is
8
- * reproduced exactly. There is no minimum, so trailing zeros are trimmed —
9
- * a `1.1` balance fills as `1.1`, not `1.100000` (or `1.10`).
10
- *
11
- * Not `formatCurrencyAndStringify` — that helper produces a 2-decimal `$`
12
- * display string, while this fills the editable input with an exact,
13
- * re-parsable pUSD amount.
4
+ * The *held* value of a chip/Max fill. pUSD has 6 on-chain decimals, so only
5
+ * 6 decimals reproduce a balance exactly: capping at 2 rounded `196.867461`
6
+ * *up* to `196.87`, which exceeded the real balance and tripped the
7
+ * insufficient-balance guard. Trailing zeros are trimmed. The 2-decimal view
8
+ * the user sees is {@link formatDisplayAmount}.
14
9
  */
15
10
  export declare function formatAmountValue(value: number): string;
16
11
  /**
17
12
  * How the confirmed amount was chosen — `manual` typing, a percent chip
18
- * (`preset`), or the Max chip. `null` until the amount is first set.
13
+ * (`preset`), the Max chip, or an integrator-supplied `prefill` the user left
14
+ * untouched. `null` until the amount is first set.
19
15
  */
20
- export type PerpsTransferAmountSelection = 'manual' | 'preset' | 'max';
16
+ export type PerpsTransferAmountSelection = 'manual' | 'preset' | 'max' | 'prefill';
21
17
  export interface PerpsTransferFormProps {
22
18
  predictionsBalanceUsd: number;
23
19
  perpsBalanceUsd: number;
@@ -26,7 +22,7 @@ export interface PerpsTransferFormProps {
26
22
  /** Minimum pUSD to transfer *into* perps (USD). */
27
23
  perpsMinTransferUsd?: number;
28
24
  initialDirection?: PerpsTransferDirection;
29
- /** Initial amount input string (pUSD). */
25
+ /** Initial amount (plain USD string, up to 2 decimals). Omit for an empty field. */
30
26
  initialAmountUsd?: string;
31
27
  status?: PerpsTransferStatus;
32
28
  /** Whether a retained balance is waiting for a fresh authoritative value. */
@@ -51,9 +47,18 @@ export interface PerpsTransferAccount {
51
47
  }
52
48
  /** Plain form state consumed by `PerpsTransferBody` and `PerpsTransferBottomBar`. */
53
49
  export interface PerpsTransferForm {
54
- /** Raw amount input string (may contain separators). */
50
+ /**
51
+ * The held amount (may contain separators) — what `onTransfer` forwards.
52
+ * A chip/Max fill keeps up to 6 decimals here so no balance is stranded.
53
+ */
55
54
  amount: string;
56
- /** Validated setter — ignores input that isn't numeric with ≤6 decimals. */
55
+ /**
56
+ * What the input renders: `amount` verbatim while the user types, or a
57
+ * 2-decimal cent-floored view of a chip/Max fill. Editing a fill replaces
58
+ * the held value with the edited string, so the two converge on first edit.
59
+ */
60
+ displayAmount: string;
61
+ /** Validated setter — ignores input that isn't numeric with ≤2 decimals. */
57
62
  setAmount: (next: string) => void;
58
63
  /** Fills the amount with the source balance at full 6-decimal precision. */
59
64
  fillMaxAmount: () => void;
@@ -120,6 +120,8 @@ export interface PolymarketPerpsTransferPending {
120
120
  /** A perps → predictions withdrawal was submitted and has not yet landed. */
121
121
  isPerpsWithdrawalPending: boolean;
122
122
  }
123
+ /** Which way funds move on the transfer step; the name is the destination. */
124
+ export type PerpsTransferDirection = 'toPerps' | 'toPredictions';
123
125
  /** The two accounts the perps transfer step moves funds between. */
124
126
  export interface PolymarketPerpsTransferHandles {
125
127
  predictions: PolymarketTransferAccount;
@@ -127,6 +129,17 @@ export interface PolymarketPerpsTransferHandles {
127
129
  /** Integrator-reported in-flight transfers; absent means none pending. */
128
130
  pending?: PolymarketPerpsTransferPending;
129
131
  access?: DepositAccess;
132
+ /**
133
+ * Direction the transfer step opens with. Defaults to Predictions → Perps;
134
+ * a single-product `access` still wins and locks the direction.
135
+ */
136
+ initialDirection?: PerpsTransferDirection;
137
+ /**
138
+ * Amount the transfer step opens with: a plain USD string, up to 2 decimals,
139
+ * no commas/separators (`'12.50'`, `'25'`, `'1000.00'`). Invalid or zero
140
+ * values are ignored; empty by default.
141
+ */
142
+ initialAmountUsd?: string;
130
143
  }
131
144
  export interface FunkitCheckoutConfig extends Omit<ApiFunkitCheckoutConfig, 'generateActionsParams' | 'customRecipient' | 'modalTitle' | 'iconSrc' | 'modalTitleMeta'> {
132
145
  /** List of contract action params **/
@@ -1,13 +1,9 @@
1
- import { type SolanaSigner, type SolanaWallet } from '@funkit/fun-relay';
1
+ import type { SolanaSigner, SolanaWallet } from '@funkit/fun-relay';
2
2
  import type { SolanaAddress } from '@funkit/api-base';
3
3
  import type { SolanaWalletSigner } from '../interfaces/solanaWallet';
4
4
  import type { ValidatedSolanaWallet } from '../providers/SolanaWalletProvider';
5
5
  import { type WithdrawalClient } from '../wallets/Wallet';
6
6
  export declare function resolveSigner(wallet: SolanaWalletSigner): SolanaSigner;
7
- /**
8
- * Takes a wallet that cleared `SolanaWalletProvider`'s validation: relay's
9
- * adapter types the payer as a base58 address, not the host's bare string.
10
- */
11
7
  export declare function createSolanaRelayWallet(wallet: SolanaWalletSigner & {
12
8
  address: SolanaAddress;
13
9
  }): SolanaWallet;
@@ -3,6 +3,7 @@ import type { Connector, CreateConnectorFn } from '../wagmi/hooks';
3
3
  import type { TransactionReceipt, TypedDataDomain } from 'viem';
4
4
  import type { CoinbaseWalletOptions } from './walletConnectors/coinbaseWallet/coinbaseWallet';
5
5
  import type { WalletConnectWalletOptions } from './walletConnectors/walletConnectWallet/walletConnectWallet';
6
+ export { isSolanaWithdrawalClient, type SolanaWithdrawalClient, } from '@funkit/connect-core/clients/solana';
6
7
  export type InstructionStepName = 'install' | 'create' | 'scan' | 'connect' | 'refresh';
7
8
  type FunkitSdkConnector = {
8
9
  mobile?: {
@@ -153,14 +154,4 @@ export interface LighterWithdrawalClient extends WithdrawalClient {
153
154
  readonly _type: 'lighter';
154
155
  readonly adaptedWallet: import('@funkit/fun-relay').LighterWallet;
155
156
  }
156
- /**
157
- * Solana-source variant. Carries the relay adapted wallet (Lighter pattern) so
158
- * execution skips the EVM shim; the EVM-shaped members only satisfy the contract.
159
- */
160
- export interface SolanaWithdrawalClient extends WithdrawalClient {
161
- readonly _type: 'solana';
162
- readonly adaptedWallet: import('@funkit/fun-relay').SolanaWallet;
163
- }
164
- export declare function isSolanaWithdrawalClient(client: WithdrawalClient): client is SolanaWithdrawalClient;
165
157
  export declare function isLighterWithdrawalClient(client: WithdrawalClient): client is LighterWithdrawalClient;
166
- export {};
@@ -2,57 +2,57 @@
2
2
  import {
3
3
  xdefiWallet
4
4
  } from "./chunk-HXX4PRE2.js";
5
- import {
6
- zerionWallet
7
- } from "./chunk-34B7OJNT.js";
8
5
  import {
9
6
  zealWallet
10
7
  } from "./chunk-GLX5FULK.js";
8
+ import {
9
+ zerionWallet
10
+ } from "./chunk-34B7OJNT.js";
11
11
  import {
12
12
  subWallet
13
13
  } from "./chunk-XODA5ESL.js";
14
14
  import {
15
15
  tahoWallet
16
16
  } from "./chunk-U74RFZOL.js";
17
- import {
18
- talismanWallet
19
- } from "./chunk-IAYYWCVB.js";
20
17
  import {
21
18
  tokenPocketWallet
22
19
  } from "./chunk-NXWG6FG2.js";
23
20
  import {
24
- tokenaryWallet
25
- } from "./chunk-TPM5PUJD.js";
21
+ talismanWallet
22
+ } from "./chunk-IAYYWCVB.js";
23
+ import {
24
+ trustWallet
25
+ } from "./chunk-SR5CZR3L.js";
26
26
  import {
27
27
  uniswapWallet
28
28
  } from "./chunk-UNDWHCDH.js";
29
29
  import {
30
- trustWallet
31
- } from "./chunk-SR5CZR3L.js";
30
+ tokenaryWallet
31
+ } from "./chunk-TPM5PUJD.js";
32
32
  import {
33
33
  walletConnectWallet
34
34
  } from "./chunk-DUX4XCDV.js";
35
35
  import {
36
- oneKeyWallet
37
- } from "./chunk-KN32ITJ7.js";
36
+ phantomWallet
37
+ } from "./chunk-Q27YVDDH.js";
38
38
  import {
39
39
  rabbyWallet
40
40
  } from "./chunk-RQ2GXOJL.js";
41
- import {
42
- rainbowWallet
43
- } from "./chunk-ZSSSLFQF.js";
44
41
  import {
45
42
  ramperWallet
46
43
  } from "./chunk-GPXIBTWN.js";
47
44
  import {
48
- safeWallet
49
- } from "./chunk-IR3PJMVM.js";
45
+ rainbowWallet
46
+ } from "./chunk-ZSSSLFQF.js";
50
47
  import {
51
48
  roninWallet
52
49
  } from "./chunk-IA5432IR.js";
53
50
  import {
54
51
  safeheronWallet
55
52
  } from "./chunk-UN3ONVNC.js";
53
+ import {
54
+ safeWallet
55
+ } from "./chunk-IR3PJMVM.js";
56
56
  import {
57
57
  safepalWallet
58
58
  } from "./chunk-BBB2J3US.js";
@@ -68,6 +68,9 @@ import {
68
68
  import {
69
69
  oktoWallet
70
70
  } from "./chunk-V4M3SNPS.js";
71
+ import {
72
+ okxWallet
73
+ } from "./chunk-CU5J53XR.js";
71
74
  import {
72
75
  omniWallet
73
76
  } from "./chunk-2TAUCVX7.js";
@@ -75,23 +78,20 @@ import {
75
78
  oneInchWallet
76
79
  } from "./chunk-GFS2AVAH.js";
77
80
  import {
78
- okxWallet
79
- } from "./chunk-CU5J53XR.js";
81
+ oneKeyWallet
82
+ } from "./chunk-KN32ITJ7.js";
80
83
  import {
81
- phantomWallet
82
- } from "./chunk-Q27YVDDH.js";
84
+ enkryptWallet
85
+ } from "./chunk-Z6LDN2AN.js";
83
86
  import {
84
87
  foxWallet
85
88
  } from "./chunk-U52QO5HF.js";
86
89
  import {
87
- clvWallet
88
- } from "./chunk-4FHNLTR3.js";
90
+ frameWallet
91
+ } from "./chunk-B572YIAQ.js";
89
92
  import {
90
93
  frontierWallet
91
94
  } from "./chunk-IWOMSW64.js";
92
- import {
93
- frameWallet
94
- } from "./chunk-B572YIAQ.js";
95
95
  import {
96
96
  gateWallet
97
97
  } from "./chunk-YRMBR6NA.js";
@@ -105,50 +105,50 @@ import {
105
105
  kresusWallet
106
106
  } from "./chunk-V77ATGZT.js";
107
107
  import {
108
- braveWallet
109
- } from "./chunk-U2XXV45G.js";
108
+ bybitWallet
109
+ } from "./chunk-BBDNB5TQ.js";
110
110
  import {
111
111
  coin98Wallet
112
112
  } from "./chunk-RFCZYLNR.js";
113
113
  import {
114
114
  coinbaseWallet
115
115
  } from "./chunk-SM2A3OSG.js";
116
+ import {
117
+ bitverseWallet
118
+ } from "./chunk-5AEWIKRA.js";
116
119
  import {
117
120
  coreWallet
118
121
  } from "./chunk-TRZDAXCQ.js";
119
- import {
120
- customWallet
121
- } from "./chunk-VKM5M5UK.js";
122
122
  import {
123
123
  dawnWallet
124
124
  } from "./chunk-LV6YV3DE.js";
125
125
  import {
126
- enkryptWallet
127
- } from "./chunk-Z6LDN2AN.js";
126
+ customWallet
127
+ } from "./chunk-VKM5M5UK.js";
128
128
  import {
129
129
  desigWallet
130
130
  } from "./chunk-DFHP75HV.js";
131
+ import {
132
+ argentWallet
133
+ } from "./chunk-XSDTNMQY.js";
134
+ import {
135
+ bitskiWallet
136
+ } from "./chunk-NPITCCJE.js";
131
137
  import {
132
138
  bifrostWallet
133
139
  } from "./chunk-ALGPGI6V.js";
134
140
  import {
135
141
  bitgetWallet
136
142
  } from "./chunk-HOCKAU5H.js";
137
- import {
138
- argentWallet
139
- } from "./chunk-XSDTNMQY.js";
140
143
  import {
141
144
  bloomWallet
142
145
  } from "./chunk-PNHDOC77.js";
143
146
  import {
144
- bitverseWallet
145
- } from "./chunk-5AEWIKRA.js";
146
- import {
147
- bitskiWallet
148
- } from "./chunk-NPITCCJE.js";
147
+ braveWallet
148
+ } from "./chunk-U2XXV45G.js";
149
149
  import {
150
- bybitWallet
151
- } from "./chunk-BBDNB5TQ.js";
150
+ clvWallet
151
+ } from "./chunk-4FHNLTR3.js";
152
152
  import "./chunk-AALSJCUR.js";
153
153
  import "./chunk-EYWGX5LT.js";
154
154
  import "./chunk-B454LLKJ.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect",
3
- "version": "12.9.0",
3
+ "version": "12.10.1",
4
4
  "description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
5
5
  "files": [
6
6
  "dist",
@@ -119,11 +119,11 @@
119
119
  "ua-parser-js": "^1.0.37",
120
120
  "use-debounce": "^10.0.5",
121
121
  "uuid": "^11.1.1",
122
- "@funkit/api-base": "8.4.0",
123
- "@funkit/chains": "2.4.0",
124
- "@funkit/connect-core": "8.2.0",
125
- "@funkit/fun-relay": "3.0.1",
126
- "@funkit/utils": "5.0.0"
122
+ "@funkit/api-base": "8.5.1",
123
+ "@funkit/connect-core": "8.4.0",
124
+ "@funkit/utils": "5.0.1",
125
+ "@funkit/fun-relay": "3.1.1",
126
+ "@funkit/chains": "2.4.1"
127
127
  },
128
128
  "repository": {
129
129
  "type": "git",