Skip to content

Commit fac945d

Browse files
committed
add asset usage to tokens
use latest block to make queries
1 parent 60cc8e1 commit fac945d

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

src/client/http.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,7 @@ class ApiClient {
4848

4949
async addRef(transaction) {
5050

51-
let {blocks: latestBlock} = await this.getBlocks({
52-
sort: '-timestamp',
53-
limit: 1
54-
});
55-
56-
latestBlock = latestBlock[0];
51+
let latestBlock = await this.getLatestBlock();
5752

5853
let latestBlockHash = latestBlock.hash;
5954
let latestBlockNum = latestBlock.number;
@@ -177,6 +172,7 @@ class ApiClient {
177172
params: Object.assign({
178173
sort: '-number',
179174
limit: 50,
175+
count: true,
180176
}, options),
181177
});
182178

@@ -186,12 +182,8 @@ class ApiClient {
186182
};
187183
}
188184
async getLatestBlock() {
189-
let {blocks} = await this.getBlocks({
190-
sort: '-number',
191-
limit: 1,
192-
});
193-
194-
return blocks[0];
185+
let {data} = await xhr.get(`${this.apiUrl}/api/block/latest`);
186+
return data;
195187
}
196188

197189
async getTransactions(options = {}) {
@@ -299,11 +291,21 @@ class ApiClient {
299291
return data;
300292
}
301293

294+
async getRichList() {
295+
let {data} = await xhr.get(`${this.apiUrl}/api/account/richlist`);
296+
return data;
297+
}
298+
302299
async getVotesForCurrentCycle() {
303300
let {data} = await xhr.get(`${this.apiUrl}/api/vote/current-cycle`);
304301
return data;
305302
}
306303

304+
async getLiveVotes() {
305+
let {data} = await xhr.get(`${this.apiUrl}/api/vote/live`);
306+
return data.data;
307+
}
308+
307309
async getTransferStats(options = {}) {
308310
let {data} = await xhr.get(`${this.apiUrl}/api/transfer/stats`, {
309311
params: Object.assign({
@@ -413,8 +415,8 @@ class ApiClient {
413415
return data;
414416
}
415417

416-
async getSyncStatus() {
417-
let {data} = await xhr.get(`${this.apiUrl}/api/system/sync`);
418+
async getSystemStatus() {
419+
let {data} = await xhr.get(`${this.apiUrl}/api/system/status`);
418420
return data;
419421
}
420422

src/utils/transactionBuilder.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ function buildAssetIssue(options) {
160160
contract.setTrxNum(options.trxNum);
161161
contract.setDescription(encodeString(options.description));
162162
contract.setUrl(encodeString(options.url));
163+
contract.setPublicFreeAssetNetUsage(0);
164+
contract.setFreeAssetNetLimit(0);
165+
contract.setPublicFreeAssetNetLimit(0);
163166

164167
if (options.frozenSupply) {
165168
for (let frozenSupply of options.frozenSupply) {

0 commit comments

Comments
 (0)