The peaq network provides methods to transfer tokens across supported chains (peaq and agung). This includes native token transfers, ERC-20 token transfers, and ERC-721 (NFT) transfers.

native(to, amount)

Transfers the native token from the signer to a target address.

ParameterTypeEVMSubstrateDescription
tostrRequiredRequiredThe recipient address (either SS58 or EVM H160).
amountint | float | str | DecimalRequiredRequiredHuman-readable token amount (e.g., 1.5).

Native Token Transfer Code Examples

import os
from dotenv import load_dotenv
from peaq_sdk import Sdk
from peaq_sdk.types import ChainType

load_dotenv()

HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")
EVM_PRIVATE_KEY = os.getenv("EVM_PRIVATE_KEY")
EVM_ADDRESS = os.getenv("EVM_ADDRESS")

sdk = Sdk.create_instance(
    base_url=HTTPS_PEAQ_URL,
    chain_type=ChainType.EVM,
    seed=EVM_PRIVATE_KEY
)

amount = 1.5

response = sdk.transfer.native(to=EVM_ADDRESS, amount=amount)

erc20(erc_20_address, recipient_address, amount, token_decimals)

Transfers ERC-20 tokens from the signer to a recipient address.

ParameterTypeEVMSubstrateDescription
erc_20_addressstrRequiredN/AThe address of the ERC-20 contract.
recipient_addressstrRequiredN/AThe recipient’s address.
amountint | float | str | DecimalRequiredN/AHuman-readable token amount.
token_decimalsint | float | str | DecimalOptionalN/ANumber of decimals for the token (defaults to 18).

ERC-20 Transfer Code Examples

import os
from dotenv import load_dotenv
from peaq_sdk import Sdk
from peaq_sdk.types import ChainType

load_dotenv()

HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")
EVM_PRIVATE_KEY = os.getenv("EVM_PRIVATE_KEY")

sdk = Sdk.create_instance(
    base_url=HTTPS_PEAQ_URL,
    chain_type=ChainType.EVM,
    seed=EVM_PRIVATE_KEY
)

ERC_20_ADDRESS = os.getenv("ERC_20_ADDRESS")
EVM_ADDRESS = os.getenv("EVM_ADDRESS")
amount = 1.5
token_decimals = 18

response = sdk.transfer.erc20(
    erc_20_address=ERC_20_ADDRESS,
    recipient_address=EVM_ADDRESS,
    amount=amount,
    token_decimals=token_decimals
)

erc721(erc_721_address, recipient_address, token_id)

Transfers an ERC-721 token (NFT) from the signer to a recipient address using the safeTransferFrom method.

ParameterTypeEVMSubstrateDescription
erc_721_addressstrRequiredN/AThe address of the ERC-721 contract.
recipient_addressstrRequiredN/AThe recipient’s address.
token_idintRequiredN/AThe ID of the token to transfer.

ERC-721 Transfer Code Examples

import os
from dotenv import load_dotenv
from peaq_sdk import Sdk
from peaq_sdk.types import ChainType

load_dotenv()

HTTPS_PEAQ_URL = os.getenv("HTTPS_PEAQ_URL")
EVM_PRIVATE_KEY = os.getenv("EVM_PRIVATE_KEY")

sdk = Sdk.create_instance(
    base_url=HTTPS_PEAQ_URL,
    chain_type=ChainType.EVM,
    seed=EVM_PRIVATE_KEY
)

ERC_721_ADDRESS = os.getenv("ERC_721_ADDRESS")
EVM_ADDRESS = os.getenv("EVM_ADDRESS")
TOKEN_ID = 1

response = sdk.transfer.erc721(
    erc_721_address=ERC_721_ADDRESS,
    recipient_address=EVM_ADDRESS,
    token_id=TOKEN_ID
)