> For the complete documentation index, see [llms.txt](https://docs.kubchain.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kubchain.com/build-on-kub/libraries-and-sdks/next-sdk/code-cookbook.md).

# Code Cookbook

This document collects all developers' best practices for the NEXT SDK and distributes them widely to KUB developers. You can visit the [GitHub repository](https://github.com/kub-chain/bitkubnext-sdk-cookbook/tree/main) for more information.

## Authentication

| Projects       | Links                                                                                                             |
| -------------- | ----------------------------------------------------------------------------------------------------------------- |
| Authentication | [Source Code](https://github.com/kub-chain/bitkubnext-sdk-cookbook/blob/main/src/pages/authentications/index.tsx) |

## Token Interaction

| Projects                | Links                                                                                                              |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------ |
| KAP-20 Interaction      | [Source Code](https://github.com/kub-chain/bitkubnext-sdk-cookbook/blob/main/src/pages/balances/KAP20/index.tsx)   |
| KAP-721 Interaction     | [Source Code](https://github.com/kub-chain/bitkubnext-sdk-cookbook/blob/main/src/pages/balances/KAP721/index.tsx)  |
| KAP-1155 Interaction    | [Source Code](https://github.com/kub-chain/bitkubnext-sdk-cookbook/blob/main/src/pages/balances/KAP1155/index.tsx) |
| Native Coin Interaction | [Source Code](https://github.com/kub-chain/bitkubnext-sdk-cookbook/blob/main/src/pages/balances/NATIVE/index.tsx)  |

## Token Approval

| Projects       | Links                                                                                                            |
| -------------- | ---------------------------------------------------------------------------------------------------------------- |
| Token Approval | [Source Code](https://github.com/kub-chain/bitkubnext-sdk-cookbook/blob/main/src/pages/approval/token/index.tsx) |
| NFT Approval   | [Source Code](https://github.com/kub-chain/bitkubnext-sdk-cookbook/blob/main/src/pages/approval/nft/index.tsx)   |

## Custom Transaction

| Projects           | Links                                                                                                       |
| ------------------ | ----------------------------------------------------------------------------------------------------------- |
| Custom Transaction | [Source Code](https://github.com/kub-chain/bitkubnext-sdk-cookbook/blob/main/src/pages/custom-tx/index.tsx) |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.kubchain.com/build-on-kub/libraries-and-sdks/next-sdk/code-cookbook.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
