# SNIP20

[**SecretNET.Token**](https://github.com/0xxCodemonkey/SecretNET.Token) is a layer on top of the Secret.NET which supports all methods of the [reference implementation](https://github.com/scrtlabs/snip20-reference-impl) of the [**SNIP20 contract**](https://docs.scrt.network/secret-network-documentation/development/snips/snip-20-spec-private-fungible-tokens).

`nuget install SecretNET.Token`

### Transfer SNIP-20 tokens

```csharp
var snip20Client = new SecretNET.Token.Snip20Client(secretClient);

var txExec = await snip20Client.Tx.Transfer(
                       contractAddress,
                       recipient,
                       amount, // int as string
                       codeHash,
                       txOptions: new TxOptions() { GasLimit = 5_000_000 }
                    );
```

### Send SNIP-20 Tokens

```csharp
var txExec = await snip20Client.Tx.Send(
                       contractAddress,
                       recipient,
                       amount, // int as string
                       codeHash,
                       txOptions: new TxOptions() { GasLimit = 5_000_000 }
                    );
```

### Set Viewing Key and Query Balance

```csharp
var txExec = await snip20Client.Tx.SetViewingKey(
                    contractAddress,
                    "hello",
                    txOptions: new TxOptions() { GasLimit = 100_000 });

var txQuery = await snip20Client.Query.GetBalance(
                    contractAddress, 
                    viewingKey: "hello", 
                    codeHash: codeHash
                    );
```

## Query Token Parameters

```csharp
var txQuery = await await snip20Client.Query.GetTokenInfo(
                    contractAddress, 
                    codeHash: codeHash
                    );
```

### Get Transaction History

```csharp
var txQuery = await snip20Client.Query.GetTransactionHistory(
                    contractAddress, 
                    pageSize: 10,
                    viewingKey: "hello",                     
                    codeHash: codeHash
                    );
```


---

# 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.scrt.network/secret-network-documentation/development/example-contracts/tools-and-libraries/network-interaction-sdks/secret-net/snippets/snip20.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.
