进行 vrc10 代币转账,如果提供私钥,将创建交易并进行签名广播。
注意
该方法会泄露私钥。
用法
visionWeb.vs.sendToken(to, amount, tokenId, privateKey);
入参
参数 | 描述 | 类型 | 默认值 |
---|---|---|---|
to | 目标账户地址 | string | - |
amount | 转账数量 | number | - |
tokenId | vrc10 tokenId | number|string | - |
privateKey | 私钥 | string | - |
返回值
object,交易对象。
示例
visionWeb.vs.sendToken("VEoh3WDXviqcPZ1qVNCQpqLHYzigrQWTPL",1000,"1000001","private key");
> {
result: true,
txid: '57fad8e04e8b2238a96be4945a34f9ab5c850277f8d49007fb5118687ab10f1b',
transaction: {
visible: false,
txID: '57fad8e04e8b2238a96be4945a34f9ab5c850277f8d49007fb5118687ab10f1b',
raw_data: {
contract: [Array],
ref_block_bytes: '6374',
ref_block_hash: 'b37f834f7fbbf721',
expiration: 1608375474000,
timestamp: 1608375415254
},
raw_data_hex: '0a0263742208b37f834f7fbbf72140d0ae98d5e72e5a74080212700a32747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e736665724173736574436f6e7472616374123a0a0731303030303031121541401a8da8a7fc86f0087f8c62e630d10df10a963b1a1541934a8d6e5c47f83ae9742a1cdd94fd681fce3ef520e80770d6e394d5e72e',
signature: [
'8f4406fc8e9f5b839a5f0a92adff28a522354617abbf495fcc6a209601e4654130f411f7a7ba42c60075b164a61d8fbc7494744c2bf1e70ef91a5ac58a84adab00'
]
}
}