VRC-10转账
HTTP接口:
wallet/transferasset
作用:转账Token
demo:curl -X POST https://vpioneer.infragrid.v.network/wallet/transferasset -d '{
"owner_address":"46d1e7a6bc354106cb410e65ff8b181c600ff14292",
"to_address": "46e552f6487585c2b58bc2c9bb4492bc1f17132cd0",
"asset_name": "0x6173736574497373756531353330383934333132313538",
"amount": 100
}'
参数说明:
owner_address是通证转出地址,需要是hexString格式
to_address是通证转入地址,需要是hexString格式
asset_name是通证名称,需要是hexString格式
amount是通证转账数量
返回值:通证转账的Transaction
Visionweb示例:
const privateKey = "...";
var toAddress = "VM2TmqauSEiRf16CyFgzHV2BVxBejY9iyR";
var tokenID= "1000088";
var amount = 1000;
var fromAddress = "VVDGpn4hCSzJ5nkHPLetk8KQBtwaTppnkr";
//创建一个未签名的 VRC10 转账交易
tradeobj = await vsWeb.transactionBuilder.sendToken(
toAddress,
amount,
tokenID,
fromAddress,
).then(output => {
console.log('- Output:', output, '\n');
return output;
});
//签名
const signedtxn = await vsWeb.vs.sign(
tradeobj,
privateKey
);
//广播
const receipt = await vsWeb.vs.sendRawTransaction(
signedtxn
).then(output => {
console.log('- Output:', output, '\n');
return output;
});
Wallet-cli示例
#用法:TransferAsset [OwnerAddress] ToAddress AssertID Amount
TransferAsset VWbcHNCYzqAGbrQteKnseKJdxfzBHyTfuh 1000099 1000
请按照以下说明步骤完成本次交易:
1.提示:“Please confirm and input your permission id, if input y or Y means default 0, other non-numeric characters will cancel transaction.”,输入“y” 或是“Y”, 确认本次交易;
2.提示:“lease choose your key for sign. …… Please choose between 1 and 2”,选择签名账户的序号;
3.提示:“Please input your password.”,输入本地密码;
4.提示:“TransferAsset 1000 to VWbcHNCYzqAGbrQteKnseKJdxfzBHyTfuh successful !!” ,表示转账VRC10代币成功。
Updated about 3 years ago