# MetaMask

{% hint style="success" %}
MetaMask extension on desktop browser or MetaMask native app on mobile must be installed in the environment of an enduser in advance.
{% endhint %}

{% hint style="info" %}
It’s strongly recommend to check that currently active EOA in MetaMask is equal to the one user logged in or signed up with before requesting signing action because MetaMask are always open to users’ action regardless of Startrail-sdk-js state. ie. It is possible for users to change the EOA account on MetaMask whenever they like.
{% endhint %}

### For Mobile Users

Users are directed to the internal browser within the MetaMask app if they already have the native app installed; otherwise, they are redirected to the app store page.

{% hint style="info" %}
When users attempt to connect to the MetaMask browser app using the login function, irrespective of whether the native browser app is installed or not, a "false" value is returned. Please handle this scenario appropriately on the client side.
{% endhint %}

## UI

### \[Popup] Connect with MetaMask

#### Condition to happen

For the first time user connects to the web-application(URL) with MetaMask.

#### Impact

Popup request opens up for users.

#### When to happen in your web-application

When users login to Metamask.

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><img src="https://3244648189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOu6aN3RW264zdJsOQMJ2%2Fuploads%2F7vePsTllknqHL5stgRmN%2FScreenshot%202021-11-18%20at%2010.37.44.png?alt=media&#x26;token=b6a3ac81-1de4-491d-af9b-f2bfa12a08cf" alt=""></td><td></td><td></td></tr><tr><td><img src="https://3244648189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOu6aN3RW264zdJsOQMJ2%2Fuploads%2FkEk0ntRARUqPi9oMirhj%2FScreenshot%202021-11-18%20at%2010.38.02.png?alt=media&#x26;token=26ede3c7-96bc-40f7-8ca2-1f305c7cb7cb" alt=""></td><td></td><td></td></tr></tbody></table>

### \[Popup] Allow this site to switch the network ?

#### Condition to happen

For the first time user connects Metamask to Polygon or Mumbai network.

#### Impact

Popup request opens up for users.

#### When to happen in your web-application

Whenever uses sign for blockchain tx such as create SRR or transfer ownership.

<table data-view="cards"><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><img src="https://3244648189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOu6aN3RW264zdJsOQMJ2%2Fuploads%2FSc8ZMBCFN7MYPLvySh2D%2FScreenshot%202021-10-25%20at%2010.08.37.png?alt=media&#x26;token=38ecb36c-337f-41e6-8ed9-71ef6d77c494" alt=""></td><td></td><td></td></tr><tr><td><img src="https://3244648189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOu6aN3RW264zdJsOQMJ2%2Fuploads%2FQh7nMNjZazoJzVla6I0H%2FScreenshot%202021-10-25%20at%2010.08.59.png?alt=media&#x26;token=40ff90f0-ed68-4d84-aef0-def4baa0cecc" alt=""></td><td></td><td></td></tr><tr><td><img src="https://3244648189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOu6aN3RW264zdJsOQMJ2%2Fuploads%2FAcYwsEQYVA9ToRQhopnh%2FScreenshot%202021-10-25%20at%2010.09.10.png?alt=media&#x26;token=b3485e90-c540-4eb5-86c5-094f6bad47a7" alt=""></td><td></td><td></td></tr></tbody></table>

### \[Popup] Signature Request

#### Condition to happen

`sdk.signMessage` is invoked / `sdk.signMessage`

#### Impact / 影響

Popup request opens up for users

#### When to happen in your web-application

When user signs the message `sdk.signMessage()`

{% hint style="danger" %}
Login to your application with signing requires Popup confirmation to users unlike the case with Startrail login
{% endhint %}

<figure><img src="https://3244648189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOu6aN3RW264zdJsOQMJ2%2Fuploads%2FghlP4fljInpUCfVEJFe4%2FScreenshot%202022-09-15%20at%2015.06.42.png?alt=media&#x26;token=ef361af4-f352-4a8a-9dd3-c49976ded47f" alt=""><figcaption></figcaption></figure>

### Network Error

When network error occurs, please go to Settings > Networks on MetaMask, select active network, and change **New RPC URL** to the live one selected from the list below.

[rpc-endpoint](https://docs.startrail.io/startrail-sdk-js/getting-started/rpc-endpoint "mention")

{% hint style="danger" %}
This Network error is more likely to occur in Test environment Mumbai.
{% endhint %}

<figure><img src="https://3244648189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOu6aN3RW264zdJsOQMJ2%2Fuploads%2FXnEG6vOtSq3NDySrIrN9%2FScreenshot%202022-06-30%20at%208.12.28%20(1).png?alt=media&#x26;token=311e29a1-44fb-434c-89ff-7d34bc71bf57" alt=""><figcaption></figcaption></figure>
