# Token Services

### Token Data

Dequanto includes JSONs with `>5000` popular tokens - names, addresses, chains, decimals.&#x20;

```typescript
import { TokensService } from '@dequanto/tokens/TokensService';

let service = new TokensService('eth');
let usdc = await service.getKnownToken('USDC');

console.log(usdc);

/* output
{
  symbol: 'USDC',
  name: 'USD Coin',
  platform: 'eth',
  address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
  decimals: 6
}
*/

        
```

### ERC20 Contracts

Ready to use strongly-typed erc20 contract class.

```typescript
import { TokensService } from '@dequanto/tokens/TokensService';

let service = new TokensService('eth');
let usdc = await service.erc20('USDC');

let balance: bigint = await usdc.balanceOf('0x....')
```

### Token Price&#x20;

> An article regarding token prices - [get-token-price-at-a-specific-block-onchain](https://dev.kit.eco/ethereum-get-token-price-at-a-specific-block-onchain)🔗

### Token Swap

See [TokenSwapService](https://github.com/0xweb-org/dequanto/blob/master/src/tokens/TokenSwapService.ts)🔗 for details.

> [Paraswap ](https://www.paraswap.io/)is implemented as the default exchange

```typescript
import { TokenSwapService } from '@dequanto/tokens/TokenSwapService'
import { EthWeb3Client } from '@dequanto/clients/EthWeb3Client';

let client = new EthWeb3Client();
let exchange = new TokenSwapService(client);

let account = { key: '' }
let tx = await exchange.swap(account, {
    from: 'USDC',
    to: 'WETH',
    amount: 1000
});
let receipt = await tx.wait();
```

### Token Transfer

Transfer tokens by a **specific amount**, **all** or with the **remainder**.

See [TokenTransferService](https://github.com/0xweb-org/dequanto/blob/master/src/tokens/TokenTransferService.ts)🔗 for details.

```typescript
import { TokenTransferService} from '@dequanto/tokens/TokenTransferService'
import { EthWeb3Client } from '@dequanto/clients/EthWeb3Client';

let client = new EthWeb3Client();
let service = new TokenTransferService(client);

let account = { key: '' }
let tx = await service.transferAll(account, '0x...', 'USDC');
let receipt = await tx.wait();
```


---

# 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.0xweb.org/dequanto/token-services.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.
