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.
Parameter Type EVM Substrate Description to str
Required Required The recipient address (either SS58 or EVM H160). amount int | float | str | Decimal
Required Required Human-readable token amount (e.g., 1.5).
Native Token Transfer Code Examples
EVM to EVM
EVM to EVM receipt
EVM to Substrate
EVM to Substrate receipt
Substrate to EVM
Substrate to EVM receipt
Substrate to Substrate
Substrate to Substrate receipt
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.
Parameter Type EVM Substrate Description erc_20_address str
Required N/A The address of the ERC-20 contract. recipient_address str
Required N/A The recipient’s address. amount int | float | str | Decimal
Required N/A Human-readable token amount. token_decimals int | float | str | Decimal
Optional N/A Number of decimals for the token (defaults to 18).
ERC-20 Transfer Code Examples
EVM Write Tx
EVM Write Tx Receipt
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.
Parameter Type EVM Substrate Description erc_721_address str
Required N/A The address of the ERC-721 contract. recipient_address str
Required N/A The recipient’s address. token_id int
Required N/A The ID of the token to transfer.
ERC-721 Transfer Code Examples
EVM Write Tx
EVM Write Tx Receipt
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
)