# Sample Usage

### **1. Detecting Adena**

Since Adena is installed on the user's device, `window.adena` will return available functions.

<figure><img src="https://2333345107-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE9KbeG02NWziIZPTAFaB%2Fuploads%2FoT28gzsmSV8aXDwiY8KM%2F1.png?alt=media&#x26;token=5402ed92-784f-4d21-8310-022ea72e235e" alt=""><figcaption></figcaption></figure>

### 2. Establishing a Connection

Once the application confirms that Adena is installed on the current device, it must first request to establish a connection via `window.adena.AddEstablish("name")`.

<figure><img src="https://2333345107-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE9KbeG02NWziIZPTAFaB%2Fuploads%2FT0tmjtZs8Ayy0wp6nPI1%2F2.png?alt=media&#x26;token=4c4662d5-ed50-449b-8562-273bd35f7195" alt=""><figcaption></figcaption></figure>

This will open a connection request page asking the user to approve adding the current domain to a local whitelist.

<figure><img src="https://2333345107-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE9KbeG02NWziIZPTAFaB%2Fuploads%2FfOMZEZrHuJ51zobyVq6k%2F3.png?alt=media&#x26;token=b1b9b9bd-5b9f-4a50-867d-0ffb56357216" alt=""><figcaption></figcaption></figure>

### 3. Getting Account Information

Provided that the user approves the connection request, running `window.adena.GetAccount();` will return information about the current account.

<figure><img src="https://2333345107-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE9KbeG02NWziIZPTAFaB%2Fuploads%2F2UGnMgpqSkQilKifyIvH%2F4.png?alt=media&#x26;token=9a483c87-3e03-4912-928d-67b3f6522f3d" alt=""><figcaption></figcaption></figure>

### 4. Sending Tokens

Let's first send some $GNOTs to an address. We'll be using `/bank.MsgSend` for this operation.

<figure><img src="https://2333345107-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE9KbeG02NWziIZPTAFaB%2Fuploads%2FsJx3h1U6Wh5RwnwchDwj%2Fimage%20327.png?alt=media&#x26;token=fdf9eea8-4744-44d4-8e59-2267ce78825b" alt=""><figcaption></figcaption></figure>

Running the function will open a pop-up page asking the user to approve the transaction. Clicking on <mark style="color:blue;">**Approve**</mark> will submit the transaction. The console will return `TRANSACTION_SENT` if the transaction has been successfully sent. Once confirmed, the transaction will appear in your <mark style="color:blue;">**History**</mark> and its details can be found on Gnoscan, the explorer for Gnoland.

<figure><img src="https://2333345107-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE9KbeG02NWziIZPTAFaB%2Fuploads%2F3RP21Qccy2JuDX8Nt1K8%2Fimage.png?alt=media&#x26;token=e24c815d-c9b9-4e7a-8b7d-3a7aad589a43" alt=""><figcaption></figcaption></figure>

### 5. Calling a Contract

Let's try creating a board named **integrate\_adena**. We'll use the same sample code from the **Establish a Connection** section, `/vm.m_call`, with different parameters.

<figure><img src="https://2333345107-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE9KbeG02NWziIZPTAFaB%2Fuploads%2FFLtqwInkGhmZaZvnecVg%2F5.png?alt=media&#x26;token=1f41b9da-408b-4a22-bd47-7784398dc42c" alt=""><figcaption></figcaption></figure>

Running the function will open a pop-up page asking the user to approve the transaction. Clicking on <mark style="color:blue;">**Approve**</mark> will complete the transaction. The console will return `TRANSACTION_SENT` if the transaction has been successfully submitted to the blockchain. Once the transaction is confirmed, the board will be created on [Test2 Gnoland Boards](https://test2.gno.land/r/boards).

<figure><img src="https://2333345107-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE9KbeG02NWziIZPTAFaB%2Fuploads%2FrEnXazYCGTqHm1LjVYXM%2Fboard%20created.png?alt=media&#x26;token=47c22091-1fa3-48f0-b2c4-a67fe5cd9451" alt=""><figcaption></figcaption></figure>

As you can see, a board named **integrate\_adena** has been created.

### 6. Adding a Package

Let's upload a test package with a simple function. We'll be using `/vm.m_addpkg` for this operation. Note that the actual code of the package is entered under `Files` as an array.

<figure><img src="https://2333345107-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE9KbeG02NWziIZPTAFaB%2Fuploads%2FNuG2k3bSohRgwPmf2zVp%2Fimage.png?alt=media&#x26;token=0be08b33-536e-4a0d-af2b-6a152002ae58" alt=""><figcaption></figcaption></figure>

Running the function will open a pop-up page asking the user to approve the transaction. Clicking on <mark style="color:blue;">**Approve**</mark> will complete the transaction. The console will return `TRANSACTION_SENT` if the transaction has been successfully submitted to the blockchain. Just like other transactions above, it will appear in your <mark style="color:blue;">**History**</mark> once confirmed. Track it on Gnoscan, and you'll see that your code will be fully auditable and transparent for anyone to see.

<figure><img src="https://2333345107-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE9KbeG02NWziIZPTAFaB%2Fuploads%2FFHN9f9wepkeQHsk9YsNS%2Fimage.png?alt=media&#x26;token=c75aa9f4-7b8b-428c-a7ac-ab3dbd809cad" alt=""><figcaption></figcaption></figure>
