diff --git a/package.json b/package.json index cf68064..7112b5b 100644 --- a/package.json +++ b/package.json @@ -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/", diff --git a/src/client/http.js b/src/client/http.js index dc625cc..9fef043 100644 --- a/src/client/http.js +++ b/src/client/http.js @@ -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, @@ -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) }); diff --git a/src/utils/transactionBuilder.js b/src/utils/transactionBuilder.js index fd430b5..b486f60 100644 --- a/src/utils/transactionBuilder.js +++ b/src/utils/transactionBuilder.js @@ -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));