# 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>
