# Design guides

## User wallet interactions

This guide is aimed at providing clarity on the minimum requirements when implementing user wallet connections and interactions.

Previously, applications using the <mark style="color:blue;">Link SDK</mark> did not have to worry about this because the Link SDK provided an opinionated UI that implemented our best practices. Now, when using the <mark style="color:blue;">Core SDK</mark> with the Wallet SDK, applications may need to implement their own design. Other than the must-haves outlined in this guide, the rest is up the application.

#### Interactions:[​](https://docs.x.immutable.com/docs/x/wallet-sdk-ui-guide#interactions) <a href="#interactions" id="interactions"></a>

* <mark style="color:blue;">Connect wallet</mark>
* <mark style="color:blue;">Disconnect wallet</mark>
* <mark style="color:blue;">List asset</mark>
* <mark style="color:blue;">Buy asset</mark>
* <mark style="color:blue;">L1 to L2 deposit</mark>
* <mark style="color:blue;">L2 to L1 withdrawals</mark>
* <mark style="color:blue;">Fiat onramp</mark>
* <mark style="color:blue;">Crypto to fiat offramp</mark>
* <mark style="color:blue;">Error states</mark>
* <mark style="color:blue;">Transaction history</mark>

#### Connect wallet[​](https://docs.x.immutable.com/docs/x/wallet-sdk-ui-guide#connect-wallet) <a href="#connect-wallet" id="connect-wallet"></a>

<table><thead><tr><th width="136.33333333333331">Flow</th><th>Link UI /XpansionChain marketplace example</th><th>Requirements</th></tr></thead><tbody><tr><td>Provider list</td><td><a href="https://docs.x.immutable.com/img/wallet-sdk-ui-guide/list.png"><img src="https://3017072639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7a6afyDwSEkvWtt1UhmH%2Fuploads%2FroOuvxPuPDciwM282kLv%2F1.%E6%A0%87%E9%A2%98%E5%92%8C%E7%AC%AC%E4%B8%89%E8%A1%8C%E6%9C%89immutableX%20%E6%94%B9%E4%B8%BA%EF%BC%9AXpansionChain.png?alt=media&#x26;token=e78627d3-e765-47fc-bb2a-14f88a495e06" alt="Provider List"></a></td><td><ul><li>Provide a mechanism to surface the wallet options</li><li>Include user acceptance statement of XpansionChain’s T&#x26;C and privacy policy</li></ul></td></tr><tr><td>Email login</td><td><a href="https://docs.x.immutable.com/img/wallet-sdk-ui-guide/email.png"><img src="https://3017072639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7a6afyDwSEkvWtt1UhmH%2Fuploads%2Fkg4SaFwzPR6HoTLhIsz9%2F2.%E6%A0%87%E9%A2%98%E6%9C%89%EF%BC%8C%E6%94%B9%E4%B8%BAXpansionChain.png?alt=media&#x26;token=611024a2-0a74-4a25-b6eb-1cc6a240adfe" alt="Email Login"></a></td><td><p>If an application chooses to provide the email wallet (provided by Magic) as an option, it must:</p><ul><li>Provide a field for the user to enter their email address</li><li>Include Magic’s T&#x26;C and privacy policy</li></ul></td></tr><tr><td>MetaMask + GameStop</td><td><a href="https://docs.x.immutable.com/img/wallet-sdk-ui-guide/sign.png"><img src="https://3017072639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7a6afyDwSEkvWtt1UhmH%2Fuploads%2F6mLkVWzCzgIK3DnDON9f%2F3.%E6%A0%87%E9%A2%981%20%E6%A0%87%E9%A2%982%20%E7%AC%AC%E4%B8%89%E7%82%B9%E6%9C%89%20%E6%94%B9%E4%B8%BAXpansionChain.png?alt=media&#x26;token=fcf60258-9d7d-4c02-a1e7-5077a892b009" alt="Signature Request"></a></td><td><p>Not mandatory, but useful to include:</p><ul><li>An explanation of why there are multiple signature requests from the non-custodial wallet for:</li><li><p></p><ul><li>Connecting to a user wallet</li><li>Requesting for the user's signature</li><li>Setting up an XpansionChain layer 2 wallet key (only needed the first time a user connects with XpansionChain - this is user registration)</li></ul></li><li>If MetaMask and GameStop are both provided as wallet options, explain that having both plugins at the same time can create wallet connection issues (more information available <a href="https://support.immutable.com/hc/en-us/articles/5160531224079-Managing-multiple-wallet-extensions-for-Immutable">here</a>)</li></ul></td></tr><tr><td>Wallet connected</td><td></td><td><p>Not mandatory, but useful to include:</p><ul><li>User feedback that wallet is successfully connected</li></ul></td></tr></tbody></table>

#### Disconnect wallet[​](https://docs.x.immutable.com/docs/x/wallet-sdk-ui-guide#disconnect-wallet) <a href="#disconnect-wallet" id="disconnect-wallet"></a>

<table><thead><tr><th width="156.33333333333331">Flow</th><th>Link UI / XpansionChain marketplace example</th><th>Requirements</th></tr></thead><tbody><tr><td>Disconnect wallet</td><td><a href="https://docs.x.immutable.com/img/wallet-sdk-ui-guide/disconnect.png"><img src="https://3017072639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7a6afyDwSEkvWtt1UhmH%2Fuploads%2FzEVN7Y8rtYKuWk5LWwUX%2F1.png?alt=media&#x26;token=2331bc6b-c548-4e5b-a282-21bc54539cdd" alt="Disconnect Wallet"></a></td><td><ul><li>Provide an way for users to disconnect their wallets from the application</li></ul></td></tr></tbody></table>

#### List asset[​](https://docs.x.immutable.com/docs/x/wallet-sdk-ui-guide#list-asset) <a href="#list-asset" id="list-asset"></a>

<table><thead><tr><th width="150.33333333333331">Flow</th><th>Link UI / XpansionChain marketplace example</th><th>Requirements</th></tr></thead><tbody><tr><td>Listing screen</td><td><a href="https://docs.x.immutable.com/img/wallet-sdk-ui-guide/list-1.png"><img src="https://3017072639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7a6afyDwSEkvWtt1UhmH%2Fuploads%2FuGesdWtTZm5zLHIzUrPj%2F2.png?alt=media&#x26;token=c027be8c-d044-4c83-9fbf-02179f3f22f0" alt="List asset 1"></a><br><a href="https://docs.x.immutable.com/img/wallet-sdk-ui-guide/list-2.png"><img src="https://3017072639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7a6afyDwSEkvWtt1UhmH%2Fuploads%2FSgrTajdlBm3mFKi58ZQl%2F3.png?alt=media&#x26;token=930156af-7524-4682-ae57-b6b41ab16a59" alt="List asset 2"></a></td><td><ul><li>Enable the user to input their listing price</li><li>Enable the user to select their listing currency (if multiple options are provided)</li><li>Provide breakdown of any maker and taker fees that apply</li></ul><p>Not mandatory, but useful to have:</p><ul><li>Processing indicator when the user has initiated listing an asset and the transaction has not yet completed</li><li>Feedback when an asset has successfully been listed</li></ul></td></tr></tbody></table>

#### Buy asset[​](https://docs.x.immutable.com/docs/x/wallet-sdk-ui-guide#buy-asset) <a href="#buy-asset" id="buy-asset"></a>

<table><thead><tr><th width="143.33333333333331">Flow</th><th>Link UI /XpansionChain marketplace example</th><th>Requirements</th></tr></thead><tbody><tr><td>Asset screen</td><td><a href="https://docs.x.immutable.com/img/wallet-sdk-ui-guide/buy.png"><img src="https://3017072639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7a6afyDwSEkvWtt1UhmH%2Fuploads%2Fku9vZquZfMXwxQ9ZbV4z%2F4.png?alt=media&#x26;token=cfac115e-6dd3-4492-825b-f4a2bc02b963" alt="Buy Asset Screen"></a></td><td><ul><li>Display the purchase price</li><li>Display the purchase currency</li><li>Provide breakdown of any maker and taker fees that apply</li></ul><p>Not mandatory, but useful to have:</p><ul><li>User feedback that purchase was successful</li><li>Send users to an "add funds" flow if they have insufficient funds</li></ul></td></tr></tbody></table>

#### L1 to L2 deposit[​](https://docs.x.immutable.com/docs/x/wallet-sdk-ui-guide#l1-to-l2-deposit) <a href="#l1-to-l2-deposit" id="l1-to-l2-deposit"></a>

<table><thead><tr><th width="147.33333333333331">Flow</th><th>Link UI /XpansionChain marketplace example</th><th>Requirements</th></tr></thead><tbody><tr><td>Add funds flow</td><td><a href="https://docs.x.immutable.com/img/wallet-sdk-ui-guide/add-funds.png"><img src="https://3017072639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7a6afyDwSEkvWtt1UhmH%2Fuploads%2FisENNyKHNIuaDxLK1VWP%2F5.png?alt=media&#x26;token=fb23bed9-3716-4971-b78e-fdac38dcd8bb" alt="Add Funds"></a></td><td><ul><li>Provide an "add funds" flow</li></ul></td></tr><tr><td>Deposit flow</td><td><a href="https://docs.x.immutable.com/img/wallet-sdk-ui-guide/deposit.png"><img src="https://docs.x.immutable.com/img/wallet-sdk-ui-guide/deposit.png" alt="Deposit Screen"></a></td><td><ul><li>Provide a field for the user to input the currency type</li><li>Provide a field for the user to input the amount they want to deposit</li></ul><p>Not mandatory, but useful to have:</p><ul><li>Icons representing different currency types</li><li>Available L1 balance to be deposited</li><li>Feedback when a deposit is successful</li></ul></td></tr></tbody></table>

#### L2 to L1 withdrawals[​](https://docs.x.immutable.com/docs/x/wallet-sdk-ui-guide#l2-to-l1-withdrawals) <a href="#l2-to-l1-withdrawals" id="l2-to-l1-withdrawals"></a>

<table><thead><tr><th width="146.33333333333331">Flow</th><th>Link UI / XpansionChain marketplace example</th><th>Requirements</th></tr></thead><tbody><tr><td>Withdraw flow</td><td>withdraw screen</td><td><p><strong>Partner must</strong></p><ul><li>Surface withdrawal flow</li><li>Collect currency type (assuming multiple currencies available to be withdrawn)</li><li>Collect amount to be withdrawn</li></ul><p>Useful to have:</p><ul><li>Icon for different currency types</li><li>Available L2 balance to be deposited</li><li>Notice that withdrawal will require L1 gas to be paid</li><li>Notice that withdrawal has 2 stage: preparation &#x26; execution of withdrawal (more information available <mark style="color:blue;">here</mark>)</li></ul></td></tr></tbody></table>

#### Fiat onramp[​](https://docs.x.immutable.com/docs/x/wallet-sdk-ui-guide#fiat-onramp) <a href="#fiat-onramp" id="fiat-onramp"></a>

NOTE

*Fiat onramp* is still under development and not available in the SDK yet.

| Flow        | Link UI / XpansionChain marketplace example                                                                                                                                                                                                                                                                                                                                                                                            | Requirements                                                                              |
| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| Fiat onramp | [![Add Funds](https://3017072639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7a6afyDwSEkvWtt1UhmH%2Fuploads%2FVgMQtICoLsqTXgz62nla%2F5.%E7%AC%AC%E4%B8%89%E8%A1%8C%EF%BC%8C%E6%9C%80%E5%90%8E%E4%B8%80%E8%A1%8C%E9%83%BD%E6%9C%89%20%E6%94%B9%E4%B8%BA%EF%BC%9AXpansionChain.png?alt=media\&token=fe2e9967-cb37-4342-a480-76030be99582)](https://docs.x.immutable.com/img/wallet-sdk-ui-guide/fiat-onramp.png) | <ul><li>Trigger the onramp flow (the MoonPay widget will take care of the rest)</li></ul> |

#### Crypto to fiat offramp[​](https://docs.x.immutable.com/docs/x/wallet-sdk-ui-guide#crypto-to-fiat-offramp) <a href="#crypto-to-fiat-offramp" id="crypto-to-fiat-offramp"></a>

NOTE

*Crypto to fiat offramp* is still under development and not available in the SDK yet.

| Flow           | Link UI / XpansionChain marketplace example                                                                                                                                                                                                                                                                      | Requirements                                                                                                                                                                                                                                              |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Crypto offramp | [![Withdraw to bank account](https://3017072639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7a6afyDwSEkvWtt1UhmH%2Fuploads%2FeIeqLS61MeuLIFFIAEC1%2F1.png?alt=media\&token=41aae6ef-9d7f-44fc-8277-b819f594bf2d)](https://docs.x.immutable.com/img/wallet-sdk-ui-guide/fiat-offramp.png) | <ul><li>Trigger the offramp flow (the MoonPay widget will take care of the rest)</li></ul><p>Not mandatory, but useful to have:</p><ul><li>A note informing the user that the MoonPay offramp is only available to users in the US, UK, and EU.</li></ul> |

#### Error states[​](https://docs.x.immutable.com/docs/x/wallet-sdk-ui-guide#error-states) <a href="#error-states" id="error-states"></a>

| Flow         | Link UI / IXpansionChain marketplace example                                                                                                                                                                                                                                                    | Requirements                                                                                                                                                                                                                        |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Error states | [![Error screens](https://3017072639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7a6afyDwSEkvWtt1UhmH%2Fuploads%2F67GXieduIr7VEKncUzT4%2F2.png?alt=media\&token=ec62d494-2bd9-4bb3-ba75-9014e12a15d9)](https://docs.x.immutable.com/img/wallet-sdk-ui-guide/errors.png) | <ul><li>Provide user feedback about specific errors (full list of errors can be found <mark style="color:blue;">here</mark>)</li></ul><p>Not mandatory, but useful to have:</p><ul><li>Link to XpansionChain support page</li></ul> |

#### Transaction history[​](https://docs.x.immutable.com/docs/x/wallet-sdk-ui-guide#transaction-history) <a href="#transaction-history" id="transaction-history"></a>

NOTE

*Transaction history* is still under development and not available in the SDK yet.

| Flow                | Link UI / XpansionChain marketplace example                                                                                                                                                                                                                                                                               | Requirements                                                                                                                                                                                                                        |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Transaction history | [![Transaction history screen](https://3017072639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7a6afyDwSEkvWtt1UhmH%2Fuploads%2FDxqeyK9PRVjEd3CMg1ZY%2F3.png?alt=media\&token=bb4afbe8-cc6f-47ad-94eb-aea987a3d05e)](https://docs.x.immutable.com/img/wallet-sdk-ui-guide/transaction-history.png) | <ul><li>Provide users with the ability to view their transaction history</li><li>For each transaction, they must provide information about the transaction ID, asset details, type of transaction and the costs involved.</li></ul> |
