purchaseToken

创建未签名的 ICO 通证购买交易。

用法

tronWeb.transactionBuilder.purchaseToken(issuerAddress, tokenID, amount, buyer, options);

参数类型

参数

描述

数据类型

issuerAddress

发出TRC10 代币的地址。

String

tokenID

TRC10代币的ID。

Integer

amount

购买的TRC10代币数量

Integer

buyer

购买TRC10代币的地址

String

options

可选参数,多重签名时使用,设置交易多重签名时使用的permissionId。

Integer

返回值类型
Object

示例

//示例 1
>tronWeb.transactionBuilder.purchaseToken("41bf97a54f4b829c4e9253b26024b1829e1a3b1120", "1000088", 100,"41010D3A8E0D80F8C83148240202DD17
8DF495B7BD", 1).then(result => console.log(result));
Promise { <pending> }
> {
  visible: false,
  txID: '9ffe34c87be9e803ca219c05a1e976cdbc1ee63459335a43fbdc290b616fe09f',
  raw_data: {
    contract: [ [Object] ],
    ref_block_bytes: '6ce6',
    ref_block_hash: 'e123937572ed7ab5',
    expiration: 1581384000000,
    timestamp: 1581383940593
  },
  raw_data_hex: '0a026ce62208e123937572ed7ab54080c4d38e832e5a7b080912770a3a747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e506172746963697061746541737365744973737565436f6e747261637412390a1541010d3a8e0d80f8c83148240202dd178df495b7bd121541bf97a54f4b829c4e9253b26024b1829e1a3b11201a0731303030303838206470f1f3cf8e832e'
}

//示例 2
> tronWeb.transactionBuilder.purchaseToken("TTSFjEG3Lu9WkHdp4JrWYhbGP6K1REqnGQ", "1000088", 100,"TPnBjYQEMo4Yd4866KCzXdi4a169KGd63n", 1).
then(result => console.log(result));
Promise { <pending> }
> {
  visible: false,
  txID: 'b86ac32d981d56ce7aef1461a6e8455c4176d2cb5daa5860d16d3132210ac49b',
  raw_data: {
    contract: [ [Object] ],
    ref_block_bytes: '6cfb',
    ref_block_hash: '5ff675a58150b8e0',
    expiration: 1581384063000,
    timestamp: 1581384004388
  },
  raw_data_hex: '0a026cfb22085ff675a58150b8e04098b0d78e832e5a7b080912770a3a747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e506172746963697061746541737365744973737565436f6e747261637412390a1541977c20977f412c2a1aa4ef3d49fee5ec4c31cdfb121541bf97a54f4b829c4e9253b26024b1829e1a3b11201a0731303030303838206470a4e6d38e832e'
}