> For the complete documentation index, see [llms.txt](https://xpansionchain-1.gitbook.io/xpansionchain/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xpansionchain-1.gitbook.io/xpansionchain/products/passport/enable-user-wallet-interactions/guides/transfer.md).

# Transfer

## Transfer

This page instructs you how to transfer assets from a logged-in users Passport wallet to another wallet.

#### Pre-requisites[​](https://docs.x.immutable.com/docs/x/passport/guides/transfer#pre-requisites) <a href="#pre-requisites" id="pre-requisites"></a>

* The user must be <mark style="color:blue;">logged into</mark> your application via Passport

#### 1. Creating the transfer[​](https://docs.x.immutable.com/docs/x/passport/guides/transfer#1-creating-the-transfer) <a href="#id-1-creating-the-transfer" id="id-1-creating-the-transfer"></a>

Once you have a user logged into your application via Passport, you will be able to initiate the transfer of an asset (`ETH`, `ERC20` or `ERC721`) from the users Passport wallet to another wallet. To do this, we must create an `UnsignedTransferRequest` argument that will be passed to the `transfer` function. The structure of the `UnsignedTransferRequest` varies depending on the `type` property, which specifies the type of asset that is being transferred. You'll need to ensure that the wallet that you're attempting to transfer the asset from is in fact the owner, otherwise the transfer request will fail.

**1.1. Transferring an ERC721**[**​**](https://docs.x.immutable.com/docs/x/passport/guides/transfer#11-transferring-an-erc721)

To transfer an `ERC721`, the following properties must be specified:

* type: The type of asset to transfer. Must be `ERC721`
* tokenId: The unique identifier of the NFT to be transferred
* tokenAddress: The address of the `ERC721` contract to be transferred
* receiver: The address of the wallet that will receive the `ERC721`

For example:

```
const transferRequest: UnsignedTransferRequest = {
  type: 'ERC721',
  tokenId: '1295',
  receiver: '0x0000000000000000000000000000000000000000',
  tokenAddress: '0xacb3c6a43d15b907e8433077b6d38ae40936fe2c',
};
```

**1.2. Transferring an ERC20**[**​**](https://docs.x.immutable.com/docs/x/passport/guides/transfer#12-transferring-an-erc20)

To transfer `ERC20`, the following properties must be specified:

* type: The type of asset to transfer. Must be `ERC20`
* amount: The amount of the `ERC20` token to be transferred
* receiver: The address of the wallet that will receive the `ERC20`
* tokenAddress: The address of the `ERC20` contract to be transferred

For example:

```
const transferRequest: UnsignedTransferRequest = {
  type: 'ERC20',
  amount: '1',
  receiver: '0x0000000000000000000000000000000000000000',
  tokenAddress: '0xacb3c6a43d15b907e8433077b6d38ae40936fe2c',
};
```

**1.3. Transferring ETH**[**​**](https://docs.x.immutable.com/docs/x/passport/guides/transfer#13-transferring-eth)

To transfer `ETH`, the following properties must be specified:

* type: The type of asset to transfer. Must be `ETH`
* amount: The amount of the `ERC20` token to be transferred
* receiver: The address of the wallet that will receive the `ETH`

For example:

```
const transferRequest: UnsignedTransferRequest = {
  type: 'ETH',
  amount: '1',
  receiver: '0x0000000000000000000000000000000000000000',
};
```

#### 2. Performing the transfer[​](https://docs.x.immutable.com/docs/x/passport/guides/transfer#2-performing-the-transfer) <a href="#id-2-performing-the-transfer" id="id-2-performing-the-transfer"></a>

Once you've created an `UnsignedTransferRequest`, it's time to perform the transfer. This can be done by calling the `transfer` function on the `IMXProvider` instance that is returned from the `connectImx` function:

```
const transferResponse: CreateTransferResponseV1 = await provider.transfer(transferRequest);
```

The `transfer` function returns a promise that resolves to a `CreateTransferResponseV1`, which contains the following properties:

* sent\_signature: The signature of the transfer that was executed
* status: The status of the transfer
* time: The time that the transfer occurred
* transfer\_id: The unique identifier for the transfer

In the event of a failure, the promise will reject with the following properties:

* code: The error code associated with the failure
* details: A string containing details about the failure
  * message: A string containing a message that describes the failure
