purchaseAsset

创建一个未签名的交易,用于 ICO 购买代币。(与 purchaseToken 一致)

用法

visionWeb.transactionBuilder.purchaseAsset(
  issuerAddress,
  tokenId,
  amount,
  buyer,
  options
);

入参

参数描述类型默认值
issuerAddressvrc10 代币的发行者地址string-
tokenIdvrc10 代币 idstring | number-
amount购买的数量object-
buyer购买者地址string默认账户地址
options可选参数,具体参数见下方object-

options 参数

参数描述类型默认值
permissionId设置多重签名时使用number-

返回值

object,创建的 transaction 对象。

示例

visionWeb.transactionBuilder.purchaseAsset("4653cd48c2723cb985679f4e44d99c64d22d89f41d","1000001",1000);
> {
  visible: false,
  txID: 'e956a134e9f55121bfa7e45e75cbde4f82037a05f9ef8a27ac5e11a6f87f0676',
  raw_data: {
    contract: [ [Object] ],
    ref_block_bytes: '48ad',
    ref_block_hash: 'f5312b2bdeedcf8e',
    expiration: 1608468477000,
    timestamp: 1608468419037
  },
  raw_data_hex: '0a0248ad2208f5312b2bdeedcf8e40c8e8c481e82e5a65080112610a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412300a154653cd48c2723cb985679f4e44d99c64d22d89f41d1215462d7a77f8bef6fe225bf5e353dd6a380f588a1496180a70dda3c181e82e'
}