Transfer Tokens Between Wallets

To transfer ERC-20 tokens between wallets, send a POST request to the /wallet/erc20/token endpoint, calling the :transfer method.

Transfer tokens between wallets

POST https://api.playfix.io/wallet/erc20/tokens:transfer

Headers

Name
Type
Description

Authorization*

String

Bearer <your_access_token>

Request Body

Name
Type
Description

wallet*

String

Name of the sender's wallet. This should be the value of name from a previously created wallet. It begins with wallets/ followed by a ULID.

receiverAddress*

String

Wallet address of the destination where you want to send the token. This begins with "0x..."

contractAddress*

String

Contract address of the ERC-20 token you want to transfer. You can get this by reading the details of the token.

amount*

Integer

Amount of the ERC-20 token you want to transfer. The amount must be expressed in WEI. That is, to send 1 unit of a token, express it as 10¹⁸ (1000000000000000000).

password*

String

The 32-character long password to the sender's wallet. This should be the password entered when creating the wallet.

{
  "transactionHash": "0x88aa63e79dc1d15c7b4a46c8be5a4a6e86cebf85df4dc930c5ae12e9fed996ec"
}

Example cURL API Call

curl --request POST \
  --url 'https://api.playfix.io/wallet/erc20/tokens:transfer' \
  --header 'Authorization: Bearer <your_access_token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
    "wallet": "<sender_wallet_name>",
    "receiverAddress": "<receiver_wallet_address>",
    "amount": 4000000000000000000,
    "contractAddress": "<token_contract_address>",
    "password": "<sender_wallet_password>"
    }'

Example Python API Call

import requests
import json

payload = {
    "wallet": "<sender_wallet_name>",
    "receiverAddress": "<receiver_wallet_address>",
    "amount": 4000000000000000000,
    "contractAddress": "<token_contract_address>",
    "password": "<sender_wallet_password>"
    }

r = requests.post(
    "https://api.playfix.io/wallet/erc20/tokens:transfer",
    headers={
        "Authorization": "Bearer <your_access_token>",
        "Accept": "application/json",
        "Content-Type": "application/json"
        },
    data=json.dumps(payload)
    )

print(r.text)

Request Body

  • wallet - Name of the sender's wallet. This should be the value of name from a previously created wallet. It begins with "wallets/" followed by a ULID.

  • receiverAddress - Wallet address of the destination where you want to send the token. This begins with "0x..."

  • amount - Amount of the ERC-20 token you want to transfer. The amount must be expressed in WEI. That is, to send 1 unit of a token, express it as 10¹⁸ (1000000000000000000).

  • contractAddress - Contract address of the ERC-20 token you want to transfer. You can get this by reading the details of the token.

  • password - The 32-character long password to the sender's wallet. This should be the password entered when creating the wallet.

WEI is the smallest denomination of the ether, the native Ethereum currency.

1 ether = 10¹⁸ wei

Response

{
  "transactionHash": "0x88aa63e79dc1d15c7b4a46c8be5a4a6e86cebf85df4dc930c5ae12e9fed996ec"
}

Response Field

  • transactionHash - Transaction hash of the token transfer.

Note: You can only transfer tokens between wallets that are on the same network.

Last updated