# Natural Language Commands

Unlike most protocols, the Lnfi is a natural language protocol where all sub-protocols interact through commands expressed in natural language.

As an illustration, in the Lnfi, the command "balance of npubxxx" allows users to inquire about the balance of a particular address. This command resembles the input format of ERC20's "balanceOf()" function, which is widely used for retrieving token balances.

{% hint style="info" %}
This unique approach enables a more intuitive and user-friendly interaction experience within the Lnfi ecosystem.
{% endhint %}

## About Chat-To-Trade

{% embed url="<https://youtu.be/ryPXdCEC2T8>" %}

## Chat-to-Trade Commands

Users may send commands through any Nostr Client (e.g. Damus) to Lnfi's Nostr public addresses. Commands are written in small caps.

Users can input the following basic commands:

## 1. Retrieve the Token List

Query the list of supported tokens.

{% code fullWidth="false" %}

```
token list
```

{% endcode %}

## 2. Check The Account Balance

```
balance
```

Check the account balance for a specific token (SATS).

<mark style="background-color:green;">balance for (token)</mark>

```
balance for sats
```

Check the account balance for a specific Nostr address.

<mark style="background-color:green;">balance of (npub address)</mark>

```
balance of npub00000
```

Check the account balance for a specific token in an Nostr address.

<mark style="background-color:green;">balance of (npub address) for (token)</mark>

```
balance of npub00000 for sats
```

## 3. Transfer Tokens to a Specified Nostr Address

<mark style="background-color:green;">transfer (quantity) (token) to (npub address)</mark>

{% code fullWidth="false" %}

```
transfer 100 sats to npub00000
```

{% endcode %}

## 4. Approve Operator(s) to Control User's Asset(s)

Approves a single token to an operator's account address. The operator will be able to use the approved amount of tokens for transactions on behalf of the asset owner.

<mark style="background-color:green;">approve (quantity) (token) to (npub address)</mark>

```
approve 1000 sats to npub00000
```

For approving multiple tokens to an operator's account address.

```
approve 1000 sats to npub000000; approve 100 eth to npub000000
```

## 5. Transfer Token by Operator from Sending Address to Receiving Address

Transfer a single token to a receiving address on behalf of the asset owner.

<mark style="background-color:green;">transfer (quantity) (token) from (sending address) to (receiving address)</mark>

```
transfer 1000 sats from npub00000 to npub11111
```

Transfer multiple tokens to receiving address on behalf of the asset owner.

<mark style="background-color:green;">transfer (quantity) (token 1) from (sending address) to (receiving address); transfer (quantity) (token 2) from (sending address) to (receiving address)</mark>

{% code overflow="wrap" %}

```
transfer 1000 sats from npub00000 to npub11111; transfer 100 eth from npub00000 to npub11111
```

{% endcode %}

## 6. Check the Allowance Approved to the Operator

Check the allowance of a specific token approved to a specific operator by a specific owner.

<mark style="background-color:green;">allowance to (operator's npub address) by (owner's npub address) for (token)</mark>

```
allowance to npub00000 by npub11111 for sats
```

The Asset Owner can check the allowance of a specific token approved for a specific operator.

<mark style="background-color:green;">allowance to (operator's npub address) for (token)</mark>

```
allowance to npub00000 for sats
```

The Approved Operator can check the allowance of a specific token approved by the Asset Owner.

<mark style="background-color:green;">allowance by (owner's npub address) for (token)</mark>

```
allowance by npub00000 for sats
```

## 7. Retrieve Nonce

Check nonce of the last executed order.

```
nonce
```

Check nonce of the last executed order by a specific npub address.

<mark style="background-color:green;">nonce of (npub address)</mark>

```
nonce of npub00011
```

## 8. Check Deposits

Get deposit info.

```
deposit
```

## 9. Withdraw Token

{% hint style="info" %}
Withdrawal of tokens from Lnfi to a designated wallet would cost network fees
{% endhint %}

Withdraw token to a specific account address.

<mark style="background-color:green;">withdraw (quantity) (token) to (wallet address)</mark>

```
withdraw 1000 sats to 0x01....8047
```

Withdraw multiple tokens to different account addresses.

<mark style="background-color:green;">withdraw (quantity) (token 1) to (wallet address 1); withdraw (quantity) (token 2) to</mark> \ <mark style="background-color:green;">(wallet address 2); withdraw (quantity) (token 1) to (wallet address 2)</mark>

{% code overflow="wrap" %}

```
withdraw 1000 sats to 0x01....8047; withdraw 1000 usdt to 0xD7....9812; withdraw 100 sats to to 0xD7....9812
```

{% endcode %}

## 10. Address Book

Query the list of names and addresses in the user's address book

```
address book
```

Add name and npub address as a key-value pair to address.

<mark style="background-color:green;">add address (npub address) name (name to be shown on address book)</mark>

```
add address npub000000 name bob
```

{% hint style="info" %}
Subsequently, users can execute commands with names in the address instead of using long npub address.\
\
example:

```
transfer 1000 sats to bob
approve 1000 sats to bob
```

{% endhint %}

Delete name from address book.

<mark style="background-color:green;">delete (name) from address book</mark>

```
delete bob from address book
```

## 11. Help

Query the system for help, which returns a list of available commands

```
help
```

## 12. Pro Mode

Tell users what is the current mode they are using

```
query mode
```

Change to Pro mode

```
open pro mode
```

Change to Normal mode

```
close pro mode
```


---

# 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.lnfi.network/natural-language-commands.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.
