HomeGuidesAPI ReferenceChangelog
GuidesAPI ReferenceCommunityDiscordBlogFAQBug BountyAnnouncementsChange Log
Guides

TRC10 Token

getAssetIssueByAccount

Query the TRC10 token information issued by an account.

getAssetIssueByAccount(address)

PARAMS

  1. address(String)*

address, the Token Issuer account address, default hexString.

RETURN

AssetIssueList object.

EXAMPLE

wrapper.getAssetIssueByAccount("TD9tMPSfBJ3To8s71vdBz2BLT2wwBNWyLc");

The result is:

assets {
    owner_address: "A\"\355b\226~\320\322\030k/\3069\327\227-\027*\225\310U"
    name: "lsp1"
    abbr: "saf1"
    total_supply: 100000000
    frozen_supply {
      frozen_amount: 1
      frozen_days: 1
    }
    trx_num: 1
    precision: 6
    num: 1000
    start_time: 1609833139923
    end_time: 1610833137923
    description: "newlsp"
    url: "sadf"
    free_asset_net_limit: 1
    public_free_asset_net_limit: 2
    id: "1000204"
  }

getAssetIssueById

Query a token by token id.

getAssetIssueById(assetId)

PARAMS

  1. assetId(String)*

the ID of the TRC10 token.

RETURN

AssetIssueContract object.

EXAMPLE

wrapper.getAssetIssueById("1000200");

The result is:

owner_address: "Aw\326^\303g\274`\360\216\276\327\302k\023\274\226\232S\364\217"
  name: "lsp"
  abbr: "saf"
  total_supply: 1
  frozen_supply {
    frozen_amount: 1
    frozen_days: 1
  }
  trx_num: 1
  precision: 1
  num: 1000
  start_time: 1609826985753
  end_time: 1610826983753
  description: "stest-assetissue"
  url: "7777772e6578616d706c652e636f6d"
  free_asset_net_limit: 100000
  public_free_asset_net_limit: 1
  id: "1000200"

getAssetIssueList

Query the list of all the TRC10 tokens.

getAssetIssueList()

RETURN

AssetIssueList object.

EXAMPLE

wrapper.getAssetIssueList();

The result is:

assets {
    owner_address: "A~\225\344_Z`\314E\362\320\257\343~\351\367\177\270\316\237\377"
    name: "tronlink_token"
    abbr: "tronlink_token"
    total_supply: 1000000000000000
    frozen_supply {
      frozen_amount: 1
      frozen_days: 1
    }
    trx_num: 1
    precision: 6
    num: 1
    start_time: 1574757000000
    end_time: 1757595000000
    description: "Description"
    url: "https://blog.csdn.net/u010270891/article/details/82978260"
    free_asset_net_limit: 1000
    public_free_asset_net_limit: 2000
    id: "1000001"
  }
 ...

getPaginatedAssetIssueList

Query the list of all the tokens by pagination.

getPaginatedAssetIssueList(offset, limit)

PARAMS

  1. offset(long)*

the index of the start token.

  1. limit(long)*

the amount of tokens per page.

RETURN

AssetIssueList object.

EXAMPLE

wrapper.getPaginatedAssetIssueList(0,20);

The result is:

assets {
    owner_address: "A\250\251\006\315\235^\177\363\344r\323L\245hD\034\356\264\317["
    name: "00Dice"
    abbr: "0x0"
    total_supply: 1000000000000000000
    trx_num: 1000000
    precision: 6
    num: 100000000
    start_time: 1592841600000
    end_time: 1592928000000
    description: "\347\224\250\344\272\216\346\265\213\350\257\225"
    url: "https://www.baidu.com"
    id: "1000052"
  }
  ...

TransferTrc10

Transfers TRC10 Asset.

transferTrc10(fromAddress, toAddress, tokenId, amount)

PARAMS

  1. fromAddress(String)*

fromAddress is the owner address.

  1. toAddress(String)*

toAddress is the recipient address.

  1. tokenId(int)*

asset name

  1. amount(int)*

amount is the amount of TRX to transfer in SUN.

RETURN

TransactionExtention, including execution results.

THROWS

IllegalException, if fail to transfer trc10.

EXAMPLE

TransactionExtention transactionExtention = wrapper.transferTrc10("TLtrDb1udekjDumnrf3EVeke3Q6pHkZxjm", "TP8LKAf3R3FHDAcrQXuwBEWmaGrrUdRvzb",
                    1000016, 1_000_000);
Transaction signedTxn = wrapper.signTransaction(transactionExtention);
String ret = wrapper.broadcastTransaction(signedTxn);

The result is:

ad42e2116d30cd55c9c9bb6b01ba940cdc411ca5c052454c66951f58eef79372

createAssetIssue

Issue a token.

createAssetIssue(ownerAddress, name, abbr, totalSupply, trxNum, icoNum, startTime, endTime, url, freeAssetNetLimit, publicFreeAssetNetLimit, precision, frozenSupply, description)

PARAMS

  1. ownerAddress(String)*

Owner address, default hexString.

  1. name(String)*

Token name, default hexString.

  1. abbr(String)*

Token name abbreviation, default hexString.

  1. totalSupply(long)*

Token total supply.

  1. trxNum(int)*

Define the price by the ratio of trx_num/num.

  1. icoNum(int)*

Define the price by the ratio of trx_num/num.

  1. startTime(long)*

ICO start time.

  1. endTime(long)*

ICO end time.

  1. url(String)*

Token official website url, default hexString.

  1. freeAssetNetLimit(long)*

Token free asset net limit.

  1. publicFreeAssetNetLimit(long)*

Token public free asset net limit.

  1. precision(int)*

  2. frozenSupply

HashMap<frozenDay, frozenAmount>.

  1. description(String)*

Token description, default hexString.

RETURN

TransactionExtention object.

THROWS

IllegalException, if fail to create AssetIssue.

EXAMPLE

long start = System.currentTimeMillis() + 2000;
long end = System.currentTimeMillis() + 1000000000;
HashMap<String, String> frozenSupply = new HashMap<String, String>();
frozenSupply.put("1","1");
frozenSupply.put("2","1");
frozenSupply.put("3","2");
TransactionExtention transaction = wrapper.createAssetIssue("TJ3Zyr26kzS8wRGz7aWYGgenMcqkUuPzLf","name", "saf1",100000000L, 1, 1000,start,end,"7777772e6578616d706c652e636f6d",
                    100000L,1L,6,frozenSupply,"stest-assetissue");
Transaction signedTxn = wrapper.signTransaction(transaction);
String ret = wrapper.broadcastTransaction(signedTxn);

The result is:

ff88e516799642161ca100bfcd3b67226793f003048c49e04aaaf48b8f5b6477

participateAssetIssue

Participate a token.

participateAssetIssue(toAddress, ownerAddress, assertName, amount)

PARAMS

  1. toAddress(String)*

the issuer address of the token, default hexString.

  1. ownerAddress(String)*

the participant address, default hexString.

  1. assertName(String)*

token id, default hexString.

  1. amount(long)*

participate token amount.

RETURN

TransactionExtention object.

THROWS

IllegalException, if fail to participate AssetIssue.

EXAMPLE

TransactionExtention transaction = wrapper.participateAssetIssue("TJ3Zyr26kzS8wRGz7aWYGgenMcqkUuPzLf","TLtrDb1udekjDumnrf3EVeke3Q6pHkZxjm","1000251", 1L);
Transaction signedTxn = wrapper.signTransaction(transaction);
String ret = wrapper.broadcastTransaction(signedTxn);

The result is:

8ae5067d3b2b822e7de3cfeb5df19bb9d1c8af2de5d9163ddc96d81baf7af58b

unfreezeAsset

Unstake a token that has passed the minimum stake duration.

unfreezeAsset(ownerAddress)

PARAMS

  1. ownerAddress(String)*

owner address, default hexString.

RETURN

TransactionExtention object.

THROWS

IllegalException, if fail to unstake asset.

EXAMPLE

TransactionExtention transaction = wrapper.unfreezeAsset("TJ3Zyr26kzS8wRGz7aWYGgenMcqkUuPzLf");
Transaction signedTxn = wrapper.signTransaction(transaction);
String ret = wrapper.broadcastTransaction(signedTxn);

The result is:

3baeafe39df63f6125dabfc317977498fb6f30933da2c5e6610dcbee1cfc9437

updateAsset

Update basic TRC10 token information.

updateAsset(ownerAddress, description, url, newLimit, newPublicLimit)

PARAMS

  1. ownerAddress(String)*

owner address, default hexString.

  1. description(String)*

the description of token, default hexString.

  1. url(String)*

The token's website url, default hexString.

  1. newLimit(int)*

each token holder's free bandwidth.

  1. newPublicLimit(int)*

the total free bandwidth of the token.

RETURN

TransactionExtention object.

THROWS

IllegalException, if fail to update asset.

EXAMPLE

TransactionExtention transaction = wrapper.updateAsset("TD9tMPSfBJ3To8s71vdBz2BLT2wwBNWyLc","newname","sadf", 1,2);
Transaction signedTxn = wrapper.signTransaction(transaction);
String ret = wrapper.broadcastTransaction(signedTxn);

The result is:

9a1234914e3ed5926d4f14584745514006be523adacd5cc208991018d5d31084

getAssetIssueByName

Query a token by token name

getAssetIssueByName(name)

PARAMS

  1. name(String)*

the name of the TRC10 token.

RETURN

AssetIssueContract object.

EXAMPLE

wrapper.getAssetIssueByName("name");

The result is:

owner_address: "AX\224.\275P\223\324\313\344\241\365N\300\3470bXx\301{"
  name: "name"
  abbr: "saf1"
  total_supply: 100000000
  frozen_supply {
    frozen_amount: 1
    frozen_days: 1
  }
  ...
  trx_num: 1
  precision: 6
  num: 1000
  start_time: 1614768027088
  end_time: 1615768025088
  description: "stest-assetissue"
  url: "7777772e6578616d706c652e636f6d"
  free_asset_net_limit: 100000
  public_free_asset_net_limit: 1
  id: "1000251"

getAssetIssueListByName

Query the list of all the TRC10 tokens by token name.

getAssetIssueListByName(name)

PARAMS

  1. name(String)*

the name of the TRC10 token.

RETURN

AssetIssueList object.

EXAMPLE

wrapper.getAssetIssueListByName("name");

The result is:

owner_address: "AX\224.\275P\223\324\313\344\241\365N\300\3470bXx\301{"
  name: "name"
  abbr: "saf1"
  total_supply: 100000000
  frozen_supply {
    frozen_amount: 1
    frozen_days: 1
  }
  ...
  trx_num: 1
  precision: 6
  num: 1000
  start_time: 1614768027088
  end_time: 1615768025088
  description: "stest-assetissue"
  url: "7777772e6578616d706c652e636f6d"
  free_asset_net_limit: 100000
  public_free_asset_net_limit: 1
  id: "1000251"