# Migrating from version 2x to 3x

These are a list of changes that must be applied to migrate from a version 2x of Token Negotiator to version 3x.

**'tokens' passive mode hook has been deprecated**

For Passive mode installations. The event hook 'tokens' has been changed to 'tokens-selected' to align with active mode.&#x20;

migration steps:

* Update use of 'tokens' hook to 'selected-tokens'. &#x20;
* Align your changes with this data structure

```
data: object
  selectedTokens: object
    issuer: string
      tokens: array
        token: Object
```

Example usage

```
negotiator.on("tokens-selected", (issuerTokens) => {
  ['devcon', 'edcon'].forEach((issuer) => {
     console.log(issuerTokens.selectedTokens[issuer].tokens)
  });
});
```

***

**Off-Chain Token / Attestation storage Migration (for off-chain token issuers only)**

The outlet (constructor) has been updated to support multiple issuers within the new interface below. Please update your configuration to use the following input data structure.

```
 const outlet = new Outlet({ 
    issuers: issuerConfigs, 
    whitelistDialogRenderer(permissionTxt: string, acceptBtn: string, denyBtn: string) => { ... }
 });
```

example usage:

```
const outletConfig: OutletInterface = {
  issuers: issuerConfigs,
  whitelistDialogRenderer: (
    permissionTxt: string,
    acceptBtn: string,
    denyBtn: string
  ) => {
    return `
      <div class="tn-auth-box">
        <div class="tn-auth-heading">
          <img alt="devcon" src="devcon_logo.svg" style="width: 150px;" />
        </div>
        <div class="tn-auth-content">
          <p>${permissionTxt}</p>
          ${acceptBtn} 
          ${denyBtn}
        </div>
      </div>
    `;
  }
};
```

The attestation management has also been optimised to use a new format when storing data. Please utilise the method below to migrate active users attestations to the new format.

```
migrateLegacyTokenStorage(tokenStorageKey:string)
```

example usage:

```
const outlet = new Outlet(outletConfig);

outlet.ticketStorage.migrateLegacyTokenStorage("devconnectTokens");
```

For support and any questions please reach out to us on [discord](https://discord.com/invite/CfvmYFyujW) or via <sayhi@smarttokenlabs.com>


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tokenscript.gitbook.io/token-negotiator/migrating-from-version-2x-to-3x.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
