Skip to content

Commit

Permalink
split transactions and transfers
Browse files Browse the repository at this point in the history
  • Loading branch information
Rovak committed May 27, 2018
1 parent 3cf71e9 commit 60cc8e1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tronscan/client",
"version": "0.0.7",
"version": "0.1.0",
"description": "Tronscan API Client",
"main": "src/index.js",
"homepage": "https://api.tronscan.org/",
Expand Down
19 changes: 17 additions & 2 deletions src/client/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,21 @@ class ApiClient {
};
}

async getTransfers(options = {}) {
let {data} = await xhr.get(`${this.apiUrl}/api/transfer`, {
params: Object.assign({
sort: '-timestamp',
count: true,
limit: 50,
}, options)
});

return {
transfers: data.data,
total: data.total,
};
}

async getBlockByNumber(number) {
let {blocks} = await this.getBlocks({
limit: 1,
Expand Down Expand Up @@ -289,8 +304,8 @@ class ApiClient {
return data;
}

async getTransactionStats(options = {}) {
let {data} = await xhr.get(`${this.apiUrl}/api/transaction/stats`, {
async getTransferStats(options = {}) {
let {data} = await xhr.get(`${this.apiUrl}/api/transfer/stats`, {
params: Object.assign({
}, options)
});
Expand Down
1 change: 1 addition & 0 deletions src/utils/transactionBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ function buildAssetIssue(options) {
let contract = new AssetIssueContract();
contract.setOwnerAddress(Uint8Array.from(decode58Check(options.address)));
contract.setName(encodeString(options.name));
contract.setAbbr(encodeString(options.shortName));
contract.setTotalSupply(options.totalSupply);
contract.setNum(options.num);
contract.setEndTime(Date.parse(options.endTime));
Expand Down

0 comments on commit 60cc8e1

Please sign in to comment.