# LYNC Metamask PC SDK

LYNC Metamask Wallet SDK is a one-stop solution for game developers to easily integrate Metamask into their game engine and deploy their game on multiple networks with just a few clicks. This SDK allows game developers to monitor gamers’ data via LYNC analytics system and update the SDK without leaving the game engine.

<figure><img src="/files/jDlzslJ7Aqd3paGIkJf0" alt=""><figcaption><p>Integrate Metamask wallet inside any game using LYNC SDK</p></figcaption></figure>

## Get Your API Key&#x20;

Please get your API key before downloading the SDK from [**here**](https://dashboard.lync.world/auth/login)

## Installation

Download the LYNC - Metamask Wallet SDK from [**here**](https://github.com/LYNC-WORLD/Metamask-Unity-PC-SDK/releases)

Example Project- <https://github.com/LYNC-WORLD/Metamask-Unity-PC-SDK>

Import the SDK .unitypackage file to your project. or simply drag and drop .unitypackage file to your project.

<figure><img src="/files/WKpr8TZQ2Hc38raIfTxY" alt="" width="561"><figcaption><p>Assets -> Import Package -> Custom Package</p></figcaption></figure>

Once the Metamask PC SDK package has finished importing into your Unity project, you can begin integrating it into your game. To do this, open the **Metamask** scene provided by the LYNC - Metamask SDK.\
\
&#x20;                                            **Path : Assets ->LYNC -> Metamask**

<figure><img src="/files/CjGLUr4dOcRLDedhZBEY" alt=""><figcaption><p><strong>Assets ->LYNC -> Metamask</strong></p></figcaption></figure>

## Choose blockchain network&#x20;

{% hint style="info" %}
If you haven't generated an API Key, please check [#get-your-api-key](#get-your-api-key "mention")
{% endhint %}

the After opening **Metamask** scene, Go to **LYNC Manager.** In the "Inspector" window, go to the API key & Enter the **API key**.&#x20;

<figure><img src="/files/mOQovM2xBQyzydhf3Maf" alt=""><figcaption><p>Enter the API key</p></figcaption></figure>

To choose the blockchain network, simply go to the **Network** drop-down menu and pick the network of your preference to deploy your game on.

<figure><img src="/files/PKKFpprdXbmJBBlsqYow" alt=""><figcaption><p>LYNC Manager -> Network</p></figcaption></figure>

## Integrating the Transaction Layer

The Transactions are divided into 2 parts:

1. No Code Transactions
2. Modular Transactions

#### No-code Transaction![image.png](https://files.slack.com/files-tmb/T057H0P2RJ6-F07SXLZMG4S-2de4ecf691/image_480.png)

<figure><img src="/files/V9DRktQEWBwtlSv3u2OJ" alt=""><figcaption><p>LYNC Intigration Example</p></figcaption></figure>

Check the **LYNCIntigrationExample** GameObject, you can just pass in a few parameters to write on any custom contract inside the game.

Just pass the following parameters:

1. Contract Address - Type any contract address on the chain you selected in the LYNCInterface GameObject.
2. ABI - You can get the contract ABI of a verified contract on the explorer.<br>

   <figure><img src="/files/5T4buGzSfStpIYMHF0MP" alt="" width="563"><figcaption><p>Copy ABI from explorer</p></figcaption></figure>
3. Function Name - Write the exact function name from the contract
4. Arguments - The arguments required by the transaction, are left blank if none.

#### Modular Transactions

Check the TransactionExample GameObject, it has a TransactionExample.cs file attached. \
This example contains 3 types of transaction transactions, ERC-721, ERC-1155 and ERC-20.

<figure><img src="/files/n9I3207kBB6PqorXd3aM" alt=""><figcaption><p>Example Code</p></figcaption></figure>

In this example:

1. contractAddress - is the contract address for a custom transaction. [(In this case, it's a Sepolia contract address on Ethereum Testnet)](https://sepolia.etherscan.io/address/0x79107ad6bd949bd955640fc1c861a2d2909e2bbd)
2. ABI - [You can get the ABI from Contract(Code)](https://sepolia.etherscan.io/address/0x79107ad6bd949bd955640fc1c861a2d2909e2bbd#code)
3. functionName - Write the exact function name from the contract [(In this case, sendToken)](https://sepolia.etherscan.io/address/0x79107ad6bd949bd955640fc1c861a2d2909e2bbd#writeContract)
4. cost - The cost required to do the transaction, if it's free you can pass 0 else pass the value in wei. (In this case, as the function is not payable the value is 0).
5. ParametersOfFunctions - You can pass in the arguments required for the transaction. (In this example, the argument is how much amount you want to send, [1000 is the value in wei, i.e 0.000000000000001 eth.](https://eth-converter.com/) You can pass n number of arguments separated with a comma( , ) ).
6. args - Converts compatible to be a JSON

Congratulation, you have successfully integrated the Metamask wallet with your favourite blockchain network using LYNC SDK. \
\
NOTE: If you wish to use wallet address inside game after user's wallet is connected, use:

```
PlayerPrefs.GetString("WalletAddress");
```

If you face any error in ABI, then open in JSON Format and select result as ABI.

<figure><img src="/files/UZCVBPF6Pi4nG8LTw2Xe" alt=""><figcaption><p>Open in JSON Format</p></figcaption></figure>

<figure><img src="/files/TSghx7TjCvic9IfeAtFV" alt=""><figcaption><p>Copy the Result</p></figcaption></figure>


---

# 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://lync-1.gitbook.io/lync/products/lync-metamask-pc-sdk.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.
