Sends VRC10 token from one address to another. Will create and broadcast the transaction if a private key is provided.
WARNING
Do not use this in any web / user-facing applications. This will expose the private key.
Usage
visionWeb.vs.sendToken(to, amount, tokenId, privateKey);
Parameters
Parameter | Description | Type | Default |
---|---|---|---|
to | Address to send to. | string | - |
amount | Amount of token to send. | number | - |
tokenId | Vrc10 token id. | number|string | - |
privateKey | Optionally provide a private key to sign the transaction. | string | - |
Returns
Object
Example
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'
]
}
}