@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.
- package/dist/index.browser.cjs +6 -4
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.mjs +6 -4
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.native.mjs +6 -4
- package/dist/index.native.mjs.map +1 -1
- package/dist/index.node.cjs +6 -4
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +6 -4
- package/dist/index.node.mjs.map +1 -1
- package/dist/types/client/actions.d.ts.map +1 -1
- package/dist/types/serialization/state.d.ts.map +1 -1
- package/dist/types/types.d.ts +3 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.node.mjs
CHANGED
|
@@ -246,6 +246,7 @@ __name(deserializeSolanaState, "deserializeSolanaState");
|
|
|
246
246
|
function getSerializableStateSnapshot(client) {
|
|
247
247
|
const state = client.store.getState();
|
|
248
248
|
const wallet = state.wallet;
|
|
249
|
+
const autoConnectPreference = wallet.autoConnect;
|
|
249
250
|
let lastConnectorId = null;
|
|
250
251
|
let lastPublicKey = null;
|
|
251
252
|
if ("connectorId" in wallet) {
|
|
@@ -255,7 +256,7 @@ function getSerializableStateSnapshot(client) {
|
|
|
255
256
|
}
|
|
256
257
|
}
|
|
257
258
|
return {
|
|
258
|
-
autoconnect: Boolean(lastConnectorId),
|
|
259
|
+
autoconnect: autoConnectPreference ?? Boolean(lastConnectorId),
|
|
259
260
|
commitment: state.cluster.commitment,
|
|
260
261
|
endpoint: state.cluster.endpoint,
|
|
261
262
|
lastConnectorId,
|
|
@@ -455,17 +456,18 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
|
|
|
455
456
|
if (!connector.isSupported()) {
|
|
456
457
|
throw new Error(`Wallet connector "${connectorId}" is not supported in this environment.`);
|
|
457
458
|
}
|
|
459
|
+
const autoConnectPreference = options.autoConnect ?? true;
|
|
458
460
|
store.setState((state) => ({
|
|
459
461
|
...state,
|
|
460
462
|
lastUpdatedAt: now(),
|
|
461
|
-
wallet: { connectorId, status: "connecting" }
|
|
463
|
+
wallet: { autoConnect: autoConnectPreference, connectorId, status: "connecting" }
|
|
462
464
|
}));
|
|
463
465
|
try {
|
|
464
466
|
const session = await connector.connect(options);
|
|
465
467
|
store.setState((state) => ({
|
|
466
468
|
...state,
|
|
467
469
|
lastUpdatedAt: now(),
|
|
468
|
-
wallet: { connectorId, session, status: "connected" }
|
|
470
|
+
wallet: { autoConnect: autoConnectPreference, connectorId, session, status: "connected" }
|
|
469
471
|
}));
|
|
470
472
|
logger({
|
|
471
473
|
data: { address: session.account.address.toString(), connectorId },
|
|
@@ -476,7 +478,7 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
|
|
|
476
478
|
store.setState((state) => ({
|
|
477
479
|
...state,
|
|
478
480
|
lastUpdatedAt: now(),
|
|
479
|
-
wallet: { connectorId, error, status: "error" }
|
|
481
|
+
wallet: { autoConnect: autoConnectPreference, connectorId, error, status: "error" }
|
|
480
482
|
}));
|
|
481
483
|
logger({
|
|
482
484
|
data: { connectorId, ...formatError(error) },
|