# Transaction

Transactions for the Veilnyx protocol can be created via `TransactionRequest, TransactionOptions` types of the Veilnyx SDK. A `TransactionRequest` The object has the following fields:

```typescript
export type TransactionRequest = {
  type: TransactionType;
  assetIds: number[];
  values: bigint[];
  feeAssetId: number;
  to: string;
  payload?: string;
};
```

#### type <a href="#type" id="type"></a>

A `TransactionType` enum to define the type of transaction -  `DEPOSIT`, `WITHDRAW`, `TRANSFER` , and `CONVERT`. The types specify what you want to do with your account's assets.

* `DEPOSIT`: To specify that you want to fund a shielded account from your public wallet, i.e. it tops up the shielded account specified in `to` the field.&#x20;
* `WITHDRAW`: You may want to withdraw assets from your shielded account to your regular wallet address. This is what this type is for. The `to` field in this case must be a plain wallet address.
* `TRANSFER`This is to perform a fully private transfer of assets from your shielded account to another shielded account.
* `CONVERT`: This is the special one to perform a transaction with any protocol that integrates with Veilnyx. e.g. to swap with Uniswap, lend on Aave, stake on Lido, etc. The `to` must be the address of the target protocols' "adaptor" contract. [See more \[here\].](https://docs.veilnyx.com/veilnyx-sdk/integrating-with-defi-protocols)

#### assetIds <a href="#assets" id="assets"></a>

Specify a list of Veilnyx's `assetId`s of assets/tokens you intend to transact. You can get a list of all supported assets from `contractService::getAssets()`.

#### values <a href="#values" id="values"></a>

The corresponding values of `assetIds` you are transacting, in the same order.

#### to <a href="#to" id="to"></a>

The shielded address or public address to deposit, transfer or withdraw funds to. Or it could be the address of the integrated protocols' proxy contract.

#### payload <a href="#payload" id="payload"></a>

The optional arbitrary data that may be needed by the adaptor contract to function, in case of a `CONVERT` type transaction. It is empty (`0x`) by default. Feel free to [refer to the Uniswap integration example](https://docs.veilnyx.com/integrating-with-defi-protocols#labyrinth-iadaptor-implementation) to understand this better.

### Transaction Options

```typescript
export type TransactionOptions = {
  revokerId: number;
  paymaster?: Hex;
  viaBundler?: boolean;
};
```

You can modify the default options to change some parameters of the transactions by passing `TransactionOptions`object. Current available options are as follows:

* `revokerId`: The ID of the revoker chosen. You can query the registered revoker details from `contractSource::getRevoker(...)`.
* `viaBundler`: This is a boolean to specify if the prepared transactions will be sent via a bundler. This parameter affects the values used to generate proof and pay the gas fee.
* `paymaster`: The paymaster address that should pay the fee, if the transaction is sent via bundler.
