@solana/client 1.0.0-rc.0 → 1.0.0-rc.2
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/actions.d.ts +41 -0
- package/dist/types/actions.d.ts.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.browser.cjs
CHANGED
|
@@ -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) },
|