> For the complete documentation index, see [llms.txt](https://docs.startrail.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.startrail.io/startrail-sdk-js/change-logs/latest.md).

# v2.3.1

MetaMask: logout() now disconnects the site, so signing in again shows the account picker instead of silently reconnecting the previous account

## [npmjs](https://www.npmjs.com/package/@startbahn/startrail-sdk-js/v/2.3.1)

{% hint style="success" %}
**Highlight —** with MetaMask, `logout()` now **disconnects your site from the extension**. The next `login()` — with or without `forceLogin` — makes MetaMask ask for the account again instead of silently reconnecting the one used before. Nothing changes for the Startrail wallet.
{% endhint %}

## 🐛 Fixed

### Signing in again after signing out, with MetaMask

**Before 2.3.1.** `logout()` only cleared the SDK's own state. The site kept the permission MetaMask had granted on the first connection, so the next `login()` resolved at once with the previous account — no account picker, even with `login({ forceLogin: true })`. A user could not switch MetaMask accounts through your app without disconnecting the site by hand inside the extension.

**From 2.3.1.** `logout()` revokes that permission (`wallet_revokePermissions`), so MetaMask treats the site as disconnected and the next `login()` opens its account picker. `login({ forceLogin: true })` does the same in one call. Where MetaMask cannot revoke the permission — MetaMask Mobile and older extension releases — the SDK asks for it explicitly on the next `login()` (`wallet_requestPermissions`), which opens the picker as well.

{% code title="Switch MetaMask account" overflow="wrap" %}

```typescript
const sdk = new Startrail({ wallet: 'metamask', env: 'staging' })
await sdk.login()               // MetaMask connects
await sdk.logout()              // the site is disconnected from MetaMask
const eoas = await sdk.login()  // MetaMask asks for the account again

// or, in one call while signed in:
const switched = await sdk.login({ forceLogin: true })
```

{% endcode %}

{% hint style="info" %}
**What to expect in your app.** After `logout()`, the next `login()` always opens MetaMask's connect window. If the user closes it, `login()` rejects with `WALLET_USER_REJECT_WALLET_REQUEST`. A page reload *without* `logout()` still reconnects silently, as before.
{% endhint %}

## 🎮 Verify it in the playground

The [playground](https://sdk.startrail.io/) gained two things for this release:

* A **version picker** in the top bar: run any release published on npm — deprecated ones included — or the page's own build, and compare.
* A **MetaMask re-login scenario** (section 8, *Scenarios*): login → logout → login, then `login({ forceLogin: true })` while signed in, with a pass/fail verdict kept per SDK version. Run it on 2.3.1, then pick 2.3.0 and run it again to see the old behaviour side by side.

## ⬆️ Upgrade from 2.3.0

```bash
npm install @startbahn/startrail-sdk-js@2.3.1   # or: yarn add / pnpm add
```

No API changes. If your app showed its own "disconnect the site in MetaMask first" instructions to work around the old behaviour, you can remove them.

{% hint style="warning" %}
Every version below 2.3.1 is now marked **deprecated** on npm: `npm install` prints a warning until you upgrade.
{% endhint %}

{% content-ref url="/pages/H3LoQfqf48sFDnIs1Vqm" %}
[MetaMask](/startrail-sdk-js/metamask.md)
{% endcontent-ref %}

{% content-ref url="/pages/PCMRbvcYYEapFskUvxvI" %}
[Wallet Methods](/startrail-sdk-js/wallet-methods.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.startrail.io/startrail-sdk-js/change-logs/latest.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
