> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qu.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# getTxType

> **注意**: 此页面尚未翻译成中文。以下内容为英文原版。

```ts theme={null}
function getTxType(from, to): number
```

Determines the transaction type based on the sender and recipient addresses. The function checks if both addresses
are UTXO addresses, in which case it returns 2. If only the sender address is a UTXO address, it returns 1.
Otherwise, it returns 0.

## Parameters

| Parameter | Type               | Description                                             |
| :-------- | :----------------- | :------------------------------------------------------ |
| `from`    | `null` \| `string` | The sender address. If null, the function returns 0.    |
| `to`      | `null` \| `string` | The recipient address. If null, the function returns 0. |

## Returns

`number`

The transaction type based on the addresses.

## Source

[utils/shards.ts:53](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/utils/shards.ts#L53)
