# SPL Token Transfers

### Common Properties

All decoded events include the following base properties from `BaseTransactionRecord`:

| Property          | Type             | JSON Type        | Description                                                               |
| ----------------- | ---------------- | ---------------- | ------------------------------------------------------------------------- |
| `uuid`            | `bigint`         | `string`         | Unique identifier for the transaction record                              |
| `instructionPath` | `string`         | `string`         | Path to the instruction within the transaction                            |
| `parentProgramId` | `string \| null` | `string \| null` | ID of the parent program if applicable                                    |
| `txSignature`     | `string`         | `string`         | Transaction signature                                                     |
| `blockTime`       | `number`         | `number`         | Block timestamp                                                           |
| `programId`       | `string`         | `string`         | SPL Token program ID                                                      |
| `eventType`       | `string`         | `string`         | Type of event (TRANSFER, MINT, BURN, INITIALIZE\_ACCOUNT, CLOSE\_ACCOUNT) |
| `decoderType`     | `DecoderType`    | `string`         | Decoder type identifier                                                   |
| `blockHeight`     | `number`         | `number`         | Block height                                                              |
| `slot`            | `number`         | `number`         | Blockchain slot number                                                    |
| `txFee`           | `number`         | `number`         | Transaction fee in lamports                                               |
| `txFeeUiAmount`   | `PreciseDecimal` | `string`         | UI-formatted transaction fee                                              |

### TRANSFER Event

Token transfer event between accounts.

| Property                  | Type             | JSON Type | Description                                  |
| ------------------------- | ---------------- | --------- | -------------------------------------------- |
| `sourceAccount`           | `string`         | `string`  | Source token account address                 |
| `sourceOwner`             | `string`         | `string`  | Owner of the source account                  |
| `destinationAccount`      | `string`         | `string`  | Destination token account address            |
| `destinationOwner`        | `string`         | `string`  | Owner of the destination account             |
| `mint`                    | `string`         | `string`  | Token mint address                           |
| `amount`                  | `bigint`         | `string`  | Transfer amount in raw units                 |
| `uiAmount`                | `PreciseDecimal` | `string`  | UI-formatted transfer amount                 |
| `sourcePreUiAmount`       | `PreciseDecimal` | `string`  | Source account balance before transfer       |
| `sourcePreAmount`         | `bigint`         | `string`  | Source account balance before transfer (raw) |
| `sourcePostUiAmount`      | `PreciseDecimal` | `string`  | Source account balance after transfer        |
| `sourcePostAmount`        | `bigint`         | `string`  | Source account balance after transfer (raw)  |
| `destinationPreUiAmount`  | `PreciseDecimal` | `string`  | Destination balance before transfer          |
| `destinationPreAmount`    | `bigint`         | `string`  | Destination balance before transfer (raw)    |
| `destinationPostUiAmount` | `PreciseDecimal` | `string`  | Destination balance after transfer           |
| `destinationPostAmount`   | `bigint`         | `string`  | Destination balance after transfer (raw)     |

### MINT Event

Token minting event where new tokens are created.

| Property                  | Type             | JSON Type | Description                              |
| ------------------------- | ---------------- | --------- | ---------------------------------------- |
| `mint`                    | `string`         | `string`  | Token mint address                       |
| `destinationAccount`      | `string`         | `string`  | Account receiving minted tokens          |
| `destinationOwner`        | `string`         | `string`  | Owner of the destination account         |
| `amount`                  | `bigint`         | `string`  | Amount of tokens minted (raw)            |
| `uiAmount`                | `PreciseDecimal` | `string`  | UI-formatted minted amount               |
| `destinationPreUiAmount`  | `PreciseDecimal` | `string`  | Destination balance before minting       |
| `destinationPreAmount`    | `bigint`         | `string`  | Destination balance before minting (raw) |
| `destinationPostUiAmount` | `PreciseDecimal` | `string`  | Destination balance after minting        |
| `destinationPostAmount`   | `bigint`         | `string`  | Destination balance after minting (raw)  |

### BURN Event

Token burning event where tokens are destroyed.

| Property             | Type             | JSON Type | Description                                 |
| -------------------- | ---------------- | --------- | ------------------------------------------- |
| `mint`               | `string`         | `string`  | Token mint address                          |
| `sourceAccount`      | `string`         | `string`  | Account from which tokens are burned        |
| `sourceOwner`        | `string`         | `string`  | Owner of the source account                 |
| `amount`             | `bigint`         | `string`  | Amount of tokens burned (raw)               |
| `uiAmount`           | `PreciseDecimal` | `string`  | UI-formatted burned amount                  |
| `sourcePreUiAmount`  | `PreciseDecimal` | `string`  | Source account balance before burning       |
| `sourcePreAmount`    | `bigint`         | `string`  | Source account balance before burning (raw) |
| `sourcePostUiAmount` | `PreciseDecimal` | `string`  | Source account balance after burning        |
| `sourcePostAmount`   | `bigint`         | `string`  | Source account balance after burning (raw)  |

### INITIALIZE\_ACCOUNT Event

Token account initialization event.

| Property  | Type     | JSON Type | Description                       |
| --------- | -------- | --------- | --------------------------------- |
| `mint`    | `string` | `string`  | Token mint address                |
| `account` | `string` | `string`  | Newly initialized account address |
| `owner`   | `string` | `string`  | Owner of the initialized account  |

### CLOSE\_ACCOUNT Event

Token account closure event.

| Property      | Type     | JSON Type | Description                       |
| ------------- | -------- | --------- | --------------------------------- |
| `mint`        | `string` | `string`  | Token mint address                |
| `account`     | `string` | `string`  | Account being closed              |
| `destination` | `string` | `string`  | Account receiving remaining SOL   |
| `owner`       | `string` | `string`  | Owner of the account being closed |

### Data Types

* `bigint`: Large integer values for token amounts
* `string`: Text values for addresses and identifiers
* `number`: Numeric values for timestamps
* `PreciseDecimal`: High-precision decimal representation for UI display
* `DecoderType`: Enum indicating the decoder type (SPL\_TOKEN)

### Usage

The decoder automatically determines the event type and returns the appropriate structure. All monetary values are provided in both raw (`bigint`) and UI-formatted (`PreciseDecimal`) versions for flexibility in different use cases.
