@solana/client 1.0.0-rc.0 → 1.0.0-rc.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.
@@ -248,6 +248,7 @@ __name(deserializeSolanaState, "deserializeSolanaState");
248
248
  function getSerializableStateSnapshot(client) {
249
249
  const state = client.store.getState();
250
250
  const wallet = state.wallet;
251
+ const autoConnectPreference = wallet.autoConnect;
251
252
  let lastConnectorId = null;
252
253
  let lastPublicKey = null;
253
254
  if ("connectorId" in wallet) {
@@ -257,7 +258,7 @@ function getSerializableStateSnapshot(client) {
257
258
  }
258
259
  }
259
260
  return {
260
- autoconnect: Boolean(lastConnectorId),
261
+ autoconnect: autoConnectPreference ?? Boolean(lastConnectorId),
261
262
  commitment: state.cluster.commitment,
262
263
  endpoint: state.cluster.endpoint,
263
264
  lastConnectorId,
@@ -457,17 +458,18 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
457
458
  if (!connector.isSupported()) {
458
459
  throw new Error(`Wallet connector "${connectorId}" is not supported in this environment.`);
459
460
  }
461
+ const autoConnectPreference = options.autoConnect ?? true;
460
462
  store.setState((state) => ({
461
463
  ...state,
462
464
  lastUpdatedAt: now(),
463
- wallet: { connectorId, status: "connecting" }
465
+ wallet: { autoConnect: autoConnectPreference, connectorId, status: "connecting" }
464
466
  }));
465
467
  try {
466
468
  const session = await connector.connect(options);
467
469
  store.setState((state) => ({
468
470
  ...state,
469
471
  lastUpdatedAt: now(),
470
- wallet: { connectorId, session, status: "connected" }
472
+ wallet: { autoConnect: autoConnectPreference, connectorId, session, status: "connected" }
471
473
  }));
472
474
  logger({
473
475
  data: { address: session.account.address.toString(), connectorId },
@@ -478,7 +480,7 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
478
480
  store.setState((state) => ({
479
481
  ...state,
480
482
  lastUpdatedAt: now(),
481
- wallet: { connectorId, error, status: "error" }
483
+ wallet: { autoConnect: autoConnectPreference, connectorId, error, status: "error" }
482
484
  }));
483
485
  logger({
484
486
  data: { connectorId, ...formatError(error) },