参与TRC-10代币

HTTP接口:

wallet/participateassetissue
作用:参与通证发行
demo:curl -X POST https://api.shasta.trongrid.io/wallet/participateassetissue -d '{
"to_address": "41bf97a54f4b829c4e9253b26024b1829e1a3b1120",
"owner_address":"41010D3A8E0D80F8C83148240202DD17", 
"amount":100, 
"asset_name":"3230313271756265696a696e67"
}'

参数说明:
to_address是Token发行人的地址,需要是hexString格式
owner_address是参与token人的地址,需要是hexString格式
amount是参与token发行的trx数量
asset_name是token的名称,需要是hexString格式

返回值:参与token发行的transaction

Tronweb示例:

const privateKey = "..."; 
var issuerAddress = "TM2TmqauSEiRf16CyFgzHV2BVxBejY9iyR"; 
var tokenID= "1000088";
var amount = 1000;
var buyerAddress = "TVDGpn4hCSzJ5nkHPLetk8KQBtwaTppnkr";
//创建未签名的 ICO 通证购买交易。
tradeobj = await tronWeb.transactionBuilder.purchaseToken(
      issuerAddress,
      tokenID,
      amount,
      buyerAddress,    
).then(output => {
  console.log('- Output:', output, '\n');
  return output;
});
//签名
const signedtxn = await tronWeb.trx.sign(
      tradeobj,
      privateKey
);
//广播
const receipt = await tronWeb.trx.sendRawTransaction(
      signedtxn
).then(output => {
  console.log('- Output:', output, '\n');
  return output;
});

Wallet-cli示例:

#用法:ParticipateAssetIssue [OwnerAddress] ToAddress AssetID Amount
ParticipateAssetIssue TQmDzierQxEFJm1dT5YXnTXqVAfdN9HtXj 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.提示:“ParticipateAssetIssue 1000099 1000 from TQmDzierQxEFJm1dT5YXnTXqVAfdN9HtXj successful !!” ,表示参与成功TRC10代币发行。