# Approval of Tokens

The Trikon Smart Wallet provides a streamlined way to manage token approvals on the blockchain. This is particularly useful when you want to allow a spender to spend a certain amount of your tokens on your behalf. Below is a detailed explanation of how this process works, along with a sample Curl command to execute the approval.

**Step-by-Step Process**

1. **Generate API Key and ID Token**:
   * Ensure you have your API key, which is provided by Trikon. This key is necessary to authenticate your requests.
   * The ID Token is automatically assigned to the logged-in user and can be retrieved from the Trikon console.
2. **Prepare the Curl Command**:
   * The Curl command below demonstrates how to request token approval using the Trikon Smart Wallet. This command includes necessary headers and data that specify details about the transaction.

**Curl Command**

```bash
curl --location 'https://paymasterdev.trikon.io/wallet/ApproveERC20' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer dummy_token' \
--data '{
    "apiKey": "Developer--api--Key",
    "idToken": "Token",
    "chainId": "Chain--ID",
    "toAddress": "address",
    "valueInEther": "ethers",
    "contractAddress": "address",
    "typeOfLogin": "social"
}'
```

**Explanation of Parameters**

* **apiKey**: This is the developer's API key, which is necessary for authentication and authorization. It should be kept secure and not shared publicly.
* **idToken**: This token represents the logged-in user. It is automatically assigned when a user logs in and can be retrieved from the Trikon console. This is critical for verifying the user's identity.
* **toAddress**: This is the address of the wallet that will be approving the amount of tokens to be spent by the designated spender.
* **valueInEther**: Specifies the amount of tokens to be approved. This value is represented in Ether units, which are typically converted into the appropriate token decimal format internally.
* **contractAddress**: The address of the token contract. For example, this would be the contract address of an ERC20 token.
* **chainId**: The Chain ID of the blockchain network the transaction will interact with. Each blockchain network has a unique Chain ID that identifies it.
* **typeOfLogin**: Indicates the type of login used, in this case, "social," which might imply a login through a social authentication provider.

**Conclusion**

By using the above Curl command and understanding the necessary parameters, developers can seamlessly implement token approval functionality within their applications using the Trikon Smart Wallet. This enhances the user experience by providing a secure and efficient way to manage token permissions.


---

# 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://trikon.gitbook.io/trikon-ecosystem/developers/approval-of-tokens.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.
