[@node-fi/sdk-core](../README.md) / [Exports](../modules.md) / TokenAmount

# Class: TokenAmount

## Hierarchy

- `CurrencyAmount`

  ↳ **`TokenAmount`**

## Table of contents

### Constructors

- [constructor](TokenAmount.md#constructor)

### Properties

- [amount](TokenAmount.md#amount)
- [scaledAmount](TokenAmount.md#scaledamount)
- [token](TokenAmount.md#token)

### Accessors

- [raw](TokenAmount.md#raw)

### Methods

- [add](TokenAmount.md#add)
- [subtract](TokenAmount.md#subtract)
- [toExact](TokenAmount.md#toexact)
- [toFixed](TokenAmount.md#tofixed)
- [toJSON](TokenAmount.md#tojson)
- [toSignificant](TokenAmount.md#tosignificant)
- [isSerializedTokenAmount](TokenAmount.md#isserializedtokenamount)
- [parseJson](TokenAmount.md#parsejson)

## Constructors

### constructor

• **new TokenAmount**(`token`, `amount`)

#### Parameters

| Name | Type |
| :------ | :------ |
| `token` | [`Token`](Token.md) |
| `amount` | `string` \| `BigNumber` |

#### Overrides

CurrencyAmount.constructor

#### Defined in

[Tokens/TokenAmount.ts:66](https://github.com/Node-Fi/SDK-Core/blob/1f4f819/src/Tokens/TokenAmount.ts#L66)

## Properties

### amount

• `Readonly` **amount**: `BigNumber`

#### Inherited from

CurrencyAmount.amount

#### Defined in

[Tokens/TokenAmount.ts:17](https://github.com/Node-Fi/SDK-Core/blob/1f4f819/src/Tokens/TokenAmount.ts#L17)

___

### scaledAmount

• `Readonly` **scaledAmount**: `number`

#### Inherited from

CurrencyAmount.scaledAmount

#### Defined in

[Tokens/TokenAmount.ts:18](https://github.com/Node-Fi/SDK-Core/blob/1f4f819/src/Tokens/TokenAmount.ts#L18)

___

### token

• `Readonly` **token**: [`Token`](Token.md)

#### Overrides

CurrencyAmount.token

#### Defined in

[Tokens/TokenAmount.ts:63](https://github.com/Node-Fi/SDK-Core/blob/1f4f819/src/Tokens/TokenAmount.ts#L63)

## Accessors

### raw

• `get` **raw**(): `BigNumber`

#### Returns

`BigNumber`

#### Inherited from

CurrencyAmount.raw

#### Defined in

[Tokens/TokenAmount.ts:29](https://github.com/Node-Fi/SDK-Core/blob/1f4f819/src/Tokens/TokenAmount.ts#L29)

## Methods

### add

▸ **add**(`other`): [`TokenAmount`](TokenAmount.md)

#### Parameters

| Name | Type |
| :------ | :------ |
| `other` | [`TokenAmount`](TokenAmount.md) |

#### Returns

[`TokenAmount`](TokenAmount.md)

#### Defined in

[Tokens/TokenAmount.ts:71](https://github.com/Node-Fi/SDK-Core/blob/1f4f819/src/Tokens/TokenAmount.ts#L71)

___

### subtract

▸ **subtract**(`other`): [`TokenAmount`](TokenAmount.md)

#### Parameters

| Name | Type |
| :------ | :------ |
| `other` | [`TokenAmount`](TokenAmount.md) |

#### Returns

[`TokenAmount`](TokenAmount.md)

#### Defined in

[Tokens/TokenAmount.ts:76](https://github.com/Node-Fi/SDK-Core/blob/1f4f819/src/Tokens/TokenAmount.ts#L76)

___

### toExact

▸ **toExact**(`format?`): `string`

#### Parameters

| Name | Type |
| :------ | :------ |
| `format?` | `IFormatNumberOptions` |

#### Returns

`string`

#### Inherited from

CurrencyAmount.toExact

#### Defined in

[Tokens/TokenAmount.ts:56](https://github.com/Node-Fi/SDK-Core/blob/1f4f819/src/Tokens/TokenAmount.ts#L56)

___

### toFixed

▸ **toFixed**(`decimalPlaces?`, `format?`): `string`

#### Parameters

| Name | Type |
| :------ | :------ |
| `decimalPlaces` | `number` |
| `format?` | `IFormatNumberOptions` |

#### Returns

`string`

#### Inherited from

CurrencyAmount.toFixed

#### Defined in

[Tokens/TokenAmount.ts:43](https://github.com/Node-Fi/SDK-Core/blob/1f4f819/src/Tokens/TokenAmount.ts#L43)

___

### toJSON

▸ **toJSON**(): `Object`

#### Returns

`Object`

| Name | Type |
| :------ | :------ |
| `_type` | `string` |
| `amount` | `string` |
| `token` | { `_type`: `string` = "Erc20Token"; `address`: `string` ; `chainId`: [`ChainId`](../enums/ChainId.md) ; `decimals`: `number` ; `imageUri`: `undefined` \| `string` ; `name`: `undefined` \| `string` ; `symbol`: `undefined` \| `string`  } |
| `token._type` | `string` |
| `token.address` | `string` |
| `token.chainId` | [`ChainId`](../enums/ChainId.md) |
| `token.decimals` | `number` |
| `token.imageUri` | `undefined` \| `string` |
| `token.name` | `undefined` \| `string` |
| `token.symbol` | `undefined` \| `string` |

#### Defined in

[Tokens/TokenAmount.ts:81](https://github.com/Node-Fi/SDK-Core/blob/1f4f819/src/Tokens/TokenAmount.ts#L81)

___

### toSignificant

▸ **toSignificant**(`significantDigits?`, `format?`): `string`

#### Parameters

| Name | Type | Default value |
| :------ | :------ | :------ |
| `significantDigits` | `number` | `6` |
| `format?` | `IFormatNumberOptions` | `undefined` |

#### Returns

`string`

#### Inherited from

CurrencyAmount.toSignificant

#### Defined in

[Tokens/TokenAmount.ts:33](https://github.com/Node-Fi/SDK-Core/blob/1f4f819/src/Tokens/TokenAmount.ts#L33)

___

### isSerializedTokenAmount

▸ `Static` **isSerializedTokenAmount**(`obj`): obj is SerializedTokenAmount

#### Parameters

| Name | Type |
| :------ | :------ |
| `obj` | `Record`<`string`, `any`\> |

#### Returns

obj is SerializedTokenAmount

#### Defined in

[Tokens/TokenAmount.ts:87](https://github.com/Node-Fi/SDK-Core/blob/1f4f819/src/Tokens/TokenAmount.ts#L87)

___

### parseJson

▸ `Static` **parseJson**(`ta`): [`TokenAmount`](TokenAmount.md)

#### Parameters

| Name | Type |
| :------ | :------ |
| `ta` | `SerializedTokenAmount` |

#### Returns

[`TokenAmount`](TokenAmount.md)

#### Defined in

[Tokens/TokenAmount.ts:91](https://github.com/Node-Fi/SDK-Core/blob/1f4f819/src/Tokens/TokenAmount.ts#L91)
