# Sample Usage

### **1. Detecting Adena**

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

<figure><img src="/files/oNsKzztwjhcW8TWquRU4" 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="/files/jK7U8Fbh1O4Muqr4TyLT" 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="/files/NTCgqM8hjKNhL0wpBJEC" 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="/files/ef5zVHKK8ieMwRUTI184" 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="/files/TOcOt1fN19XVgeRCzavV" 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="/files/opF57olId4OhZo5gvgCO" 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="/files/yDqw2MKaKQUHO6ccnbdn" 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="/files/957WOltsmrHWr6beqRMy" 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="/files/JvhUCvdz2laYrXe8YY31" 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="/files/u86XmGTcqSxAoy6but69" alt=""><figcaption></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://docs.adena.app/integrations/sample-usage.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.
