@terra-money/terra.js
Advanced tools
Comparing version 2.1.20 to 2.1.22
@@ -84,3 +84,3 @@ "use strict"; | ||
return [2 /*return*/, this.c | ||
.get("/bank/total", params) | ||
.get("/cosmos/bank/v1beta1/supply", params) | ||
.then(function (d) { return [core_1.Coins.fromData(d.supply), d.pagination]; })]; | ||
@@ -87,0 +87,0 @@ }); |
@@ -70,3 +70,3 @@ "use strict"; | ||
return [2 /*return*/, this.c | ||
.get('/ibc/client/v1/params', params) | ||
.get("/ibc/client/v1/params", params) | ||
.then(function (_a) { | ||
@@ -86,3 +86,3 @@ var d = _a.params; | ||
return [2 /*return*/, this.c | ||
.get('/ibc/core/client/v1/client_states', params) | ||
.get("/ibc/core/client/v1/client_states", params) | ||
.then(function (d) { return [ | ||
@@ -89,0 +89,0 @@ d.client_states.map(IdentifiedClient_1.IdentifiedClientState.fromData), |
@@ -98,3 +98,3 @@ "use strict"; | ||
return [2 /*return*/, this.c | ||
.get('/ibc/apps/transfer/v1/params', params) | ||
.get("/ibc/apps/transfer/v1/params", params) | ||
.then(function (_a) { | ||
@@ -101,0 +101,0 @@ var d = _a.params; |
import { BaseAPI } from './BaseAPI'; | ||
import { BlockInfo, ValidatorSet } from '../../../core'; | ||
import { APIParams } from '../APIRequester'; | ||
import { BlockInfo, DelegateValidator } from '../../../core'; | ||
import { APIParams, Pagination } from '../APIRequester'; | ||
export declare class TendermintAPI extends BaseAPI { | ||
@@ -17,3 +17,3 @@ /** | ||
*/ | ||
validatorSet(height?: number, params?: APIParams): Promise<ValidatorSet>; | ||
validatorSet(height?: number, params?: APIParams): Promise<[DelegateValidator[], Pagination]>; | ||
/** | ||
@@ -20,0 +20,0 @@ * Gets the block information at the specified height. If no height is given, the latest block is returned. |
@@ -68,3 +68,3 @@ "use strict"; | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.c.getRaw("/node_info", params)]; | ||
return [2 /*return*/, this.c.getRaw("/cosmos/base/tendermint/v1beta1/node_info", params)]; | ||
}); | ||
@@ -81,3 +81,3 @@ }); | ||
return [2 /*return*/, this.c | ||
.getRaw("/syncing", params) | ||
.getRaw("/cosmos/base/tendermint/v1beta1/syncing", params) | ||
.then(function (d) { return d.syncing; })]; | ||
@@ -97,7 +97,7 @@ }); | ||
url = height !== undefined | ||
? "/validatorsets/" + height | ||
: "/validatorsets/latest"; | ||
? "/cosmos/base/tendermint/v1beta1/validatorsets/" + height | ||
: "/cosmos/base/tendermint/v1beta1/validatorsets/latest"; | ||
return [2 /*return*/, this.c | ||
.get(url, params) | ||
.then(function (d) { return d.result; })]; | ||
.then(function (d) { return [d.validators, d.pagination]; })]; | ||
}); | ||
@@ -115,3 +115,5 @@ }); | ||
return __generator(this, function (_a) { | ||
url = height !== undefined ? "/blocks/" + height : "/blocks/latest"; | ||
url = height !== undefined | ||
? "/cosmos/base/tendermint/v1beta1/blocks/" + height | ||
: "/cosmos/base/tendermint/v1beta1/blocks/latest"; | ||
return [2 /*return*/, this.c.getRaw(url, params)]; | ||
@@ -118,0 +120,0 @@ }); |
@@ -47,3 +47,8 @@ import { BaseAPI } from './BaseAPI'; | ||
/** | ||
* Gets the current registered Tax Cap for a specified denomation. | ||
* Gets the current registered Tax caps for all denomination | ||
* @returns Coin[] | ||
*/ | ||
taxCaps(params?: APIParams): Promise<Coins>; | ||
/** | ||
* Gets the current registered Tax Cap for a specified denomination. | ||
* @param denom denomination desired for Tax Cap query. | ||
@@ -50,0 +55,0 @@ */ |
@@ -74,3 +74,17 @@ "use strict"; | ||
/** | ||
* Gets the current registered Tax Cap for a specified denomation. | ||
* Gets the current registered Tax caps for all denomination | ||
* @returns Coin[] | ||
*/ | ||
TreasuryAPI.prototype.taxCaps = function (params) { | ||
if (params === void 0) { params = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.c | ||
.get("/terra/treasury/v1beta1/tax_caps", params) | ||
.then(function (d) { return new core_1.Coins(d.tax_caps.map(function (c) { return new core_1.Coin(c.denom, c.tax_cap); })); })]; | ||
}); | ||
}); | ||
}; | ||
/** | ||
* Gets the current registered Tax Cap for a specified denomination. | ||
* @param denom denomination desired for Tax Cap query. | ||
@@ -77,0 +91,0 @@ */ |
@@ -72,3 +72,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var validatorSetResponse, validatorSet, validators, next_key, validatorsRes, res, _i, validators_1, v, delegateInfo; | ||
var validatorSet, validatorSetByPubKey, validators, next_key, validatorsRes, res, _i, validators_1, v, delegateInfo; | ||
return __generator(this, function (_a) { | ||
@@ -78,5 +78,5 @@ switch (_a.label) { | ||
case 1: | ||
validatorSetResponse = _a.sent(); | ||
validatorSet = validatorSetResponse.validators.reduce(function (m, o) { | ||
m[o.pub_key.value] = o; | ||
validatorSet = (_a.sent())[0]; | ||
validatorSetByPubKey = validatorSet.reduce(function (m, o) { | ||
m[o.pub_key.key] = o; | ||
return m; | ||
@@ -101,3 +101,3 @@ }, {}); | ||
v = validators_1[_i]; | ||
delegateInfo = validatorSet[v.consensus_pubkey.toData().key]; | ||
delegateInfo = validatorSetByPubKey[v.consensus_pubkey.toData().key]; | ||
if (delegateInfo === undefined) | ||
@@ -104,0 +104,0 @@ continue; |
@@ -15,3 +15,3 @@ export interface BlockInfo { | ||
export interface Evidence { | ||
evidence: string | null; | ||
evidence: string[]; | ||
} | ||
@@ -39,3 +39,3 @@ export interface Header { | ||
hash: string; | ||
parts: Parts; | ||
part_set_header: Parts; | ||
} | ||
@@ -52,3 +52,3 @@ export interface Parts { | ||
height: string; | ||
round: string; | ||
round: number; | ||
block_id: BlockID; | ||
@@ -55,0 +55,0 @@ signatures: Signature[]; |
import { ValConsAddress } from './bech32'; | ||
import { ValConsPublicKey } from './PublicKey'; | ||
export interface ValidatorSet { | ||
block_height: string; | ||
validators: DelegateValidator[]; | ||
@@ -9,5 +8,5 @@ } | ||
address: ValConsAddress; | ||
pub_key: ValConsPublicKey.Amino; | ||
pub_key: ValConsPublicKey.Data; | ||
proposer_priority: string; | ||
voting_power: string; | ||
} |
@@ -19,4 +19,4 @@ "use strict"; | ||
} | ||
// string or number | ||
if (typeof obj !== "object") { | ||
// string, number, or null | ||
if (typeof obj !== "object" || obj === null) { | ||
return obj; | ||
@@ -23,0 +23,0 @@ } |
{ | ||
"name": "@terra-money/terra.js", | ||
"version": "2.1.20", | ||
"version": "2.1.22", | ||
"description": "The JavaScript SDK for Terra", | ||
@@ -69,3 +69,2 @@ "license": "MIT", | ||
"eslint": "^8.1.0", | ||
"google-protobuf": "^3.15.5", | ||
"husky": "^4.3.6", | ||
@@ -72,0 +71,0 @@ "jest": "^27.0.4", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
13258756
24
35291