Transfer Ada/Token
Transfering ada to different addresses
You can transfer ada to different addresses by specifying the address and the amount of ada you want to transfer in the outputs
field. outputs
is a list of objects, so you can specify multiple outputs. The value
field is the amount of ada you want to transfer, which could be written as string or number, eg. "10A"
() or 10000000
(in lovelace). The payment will be made from your wallet.
{
"outputs": [
{
"address": "addr_test1qqmwpnc72ts9a7fw2trmc2syfy7khtjgrw9vh2cja3psp4lee858y3kj7qmn3pvfdtfgqjmj99nnypx2eysgx3wpafds78dunz",
"value": "10A"
},
{
"address": "addr_test1qzq2uxdnhnrk2rsd6tpr5nku9zmkc3aqc8kdtk3r0zsy9e0ee858y3kj7qmn3pvfdtfgqjmj99nnypx2eysgx3wpafdsxan2r6",
"value": 10000000
}
]
}
Using deductFee option
In the above transaction, fee will be deducted from the sender's wallet. If you want to deduct the fee from the receiver's wallet, you can set the deductFee
option to true
in the output object.
{
"outputs": [
{
"address": "addr_test1qqmwpnc72ts9a7fw2trmc2syfy7khtjgrw9vh2cja3psp4lee858y3kj7qmn3pvfdtfgqjmj99nnypx2eysgx3wpafds78dunz",
"value": "10A",
"deductFee": true
}
]
}
Transferring assets/nfts
In order to transfer assets or NFT, you need to specify the policyId and assetName of the asset you want to transfer. If you don't have an NFT/Token in your wallet, please follow minting tutorial to mint tokens/NFTs in the testnet.
In the following example, we are transferring 2 tokens of the asset with policyId 981a76013c22440ad5a7202d811f3a9eddd6e9bfa48523de5acfec53
and assetName Token1
to the given address.
{
"outputs": [
{
"address": "addr_test1qzq2uxdnhnrk2rsd6tpr5nku9zmkc3aqc8kdtk3r0zsy9e0ee858y3kj7qmn3pvfdtfgqjmj99nnypx2eysgx3wpafdsxan2r6",
"value": "2 981a76013c22440ad5a7202d811f3a9eddd6e9bfa48523de5acfec53.Token1"
}
]
}