@injectivelabs/chain-consumer
Advanced tools
Comparing version
@@ -6,27 +6,16 @@ # Change Log | ||
## [0.0.73](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/chain-consumer@0.0.72...@injectivelabs/chain-consumer@0.0.73) (2021-08-14) | ||
## [0.0.72](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/chain-consumer@0.0.71...@injectivelabs/chain-consumer@0.0.72) (2021-08-20) | ||
### Features | ||
* create insurance fund composer ([b541429](https://github.com/InjectiveLabs/injective-ts/commit/b541429bfb35aa740e4226af1b54a2e51d041fe9)) | ||
* added text proposal decomposer ([70b510a](https://github.com/InjectiveLabs/injective-ts/commit/70b510a72d52c4e8805c31b51ff1f7bb51e4739c)) | ||
## [0.0.72](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/chain-consumer@0.0.61...@injectivelabs/chain-consumer@0.0.72) (2021-08-11) | ||
### Bug Fixes | ||
* abstraction removal ([f9ceb3c](https://github.com/InjectiveLabs/injective-ts/commit/f9ceb3cae076114e104b8a1448bf0f2542c9e032)) | ||
* bank comoposer export ([028a498](https://github.com/InjectiveLabs/injective-ts/commit/028a498ec2af82d4e63b4fa24b892baf021fe731)) | ||
* param types ([fad34ab](https://github.com/InjectiveLabs/injective-ts/commit/fad34ab89fb58b1f7604585ce7a9d747ea1674cd)) | ||
* redundant param ([279b431](https://github.com/InjectiveLabs/injective-ts/commit/279b4318d05e88040fcc66188ba616e584b8efcd)) | ||
### Features | ||
* added batch cancelling for the orders ([3990a3b](https://github.com/InjectiveLabs/injective-ts/commit/3990a3b0c6607d6b825a9e28fb28b47a28244d96)) | ||
* added proposal decomposer for exchange-enable-proposal ([e59f22d](https://github.com/InjectiveLabs/injective-ts/commit/e59f22d66dc56459ad4c025639c5adc4446b94bf)) | ||
* fetching params ([afa8684](https://github.com/InjectiveLabs/injective-ts/commit/afa86840ab0149e8fe6a5e47dfcffa519f112a28)) | ||
* sending to another inj address ([95c180e](https://github.com/InjectiveLabs/injective-ts/commit/95c180e1801a72cde9ceb5f008a510fb79bc7510)) | ||
* staking consumer improvements ([346690d](https://github.com/InjectiveLabs/injective-ts/commit/346690dbad345bd767c5f7222a7b45bc849b1035)) | ||
## [0.0.71](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/chain-consumer@0.0.70...@injectivelabs/chain-consumer@0.0.71) (2021-08-10) | ||
### Features | ||
@@ -36,4 +25,9 @@ | ||
## [0.0.70](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/chain-consumer@0.0.69...@injectivelabs/chain-consumer@0.0.70) (2021-08-09) | ||
### Bug Fixes | ||
@@ -43,4 +37,9 @@ | ||
## [0.0.69](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/chain-consumer@0.0.68...@injectivelabs/chain-consumer@0.0.69) (2021-08-09) | ||
### Features | ||
@@ -50,4 +49,9 @@ | ||
## [0.0.68](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/chain-consumer@0.0.67...@injectivelabs/chain-consumer@0.0.68) (2021-08-05) | ||
### Bug Fixes | ||
@@ -57,2 +61,6 @@ | ||
## [0.0.67](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/chain-consumer@0.0.66...@injectivelabs/chain-consumer@0.0.67) (2021-08-05) | ||
@@ -62,4 +70,9 @@ | ||
## [0.0.66](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/chain-consumer@0.0.65...@injectivelabs/chain-consumer@0.0.66) (2021-07-31) | ||
### Bug Fixes | ||
@@ -69,4 +82,9 @@ | ||
## [0.0.65](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/chain-consumer@0.0.64...@injectivelabs/chain-consumer@0.0.65) (2021-07-31) | ||
### Bug Fixes | ||
@@ -76,4 +94,9 @@ | ||
## [0.0.64](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/chain-consumer@0.0.63...@injectivelabs/chain-consumer@0.0.64) (2021-07-31) | ||
### Features | ||
@@ -83,4 +106,9 @@ | ||
## [0.0.63](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/chain-consumer@0.0.62...@injectivelabs/chain-consumer@0.0.63) (2021-07-14) | ||
### Features | ||
@@ -90,4 +118,9 @@ | ||
## [0.0.62](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/chain-consumer@0.0.61...@injectivelabs/chain-consumer@0.0.62) (2021-06-25) | ||
### Features | ||
@@ -97,4 +130,9 @@ | ||
## [0.0.61](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/chain-consumer@0.0.60...@injectivelabs/chain-consumer@0.0.61) (2021-06-25) | ||
### Features | ||
@@ -104,2 +142,6 @@ | ||
## [0.0.60](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/chain-consumer@0.0.58...@injectivelabs/chain-consumer@0.0.60) (2021-06-17) | ||
@@ -106,0 +148,0 @@ |
import { AccountAddress } from '@injectivelabs/ts-types'; | ||
import { OracleTypeMap } from '@injectivelabs/chain-api/injective/oracle/v1beta1/oracle_pb'; | ||
export declare class InsuranceComposer { | ||
static createInsuranceFund({ fund, amount, denom, injectiveAddress, }: { | ||
fund: { | ||
ticker: string; | ||
quoteDenom: string; | ||
oracleBase: string; | ||
oracleQuote: string; | ||
oracleType: OracleTypeMap[keyof OracleTypeMap]; | ||
expiry?: number; | ||
}; | ||
denom: string; | ||
amount: string; | ||
injectiveAddress: AccountAddress; | ||
}): { | ||
initial_deposit: { | ||
[x: string]: any; | ||
}[]; | ||
'@type': string; | ||
}; | ||
static underwrite({ marketId, amount, denom, injectiveAddress, }: { | ||
@@ -23,0 +4,0 @@ marketId: string; |
@@ -11,19 +11,2 @@ "use strict"; | ||
class InsuranceComposer { | ||
static createInsuranceFund({ fund, amount, denom, injectiveAddress, }) { | ||
const deposit = new coin_pb_1.Coin(); | ||
deposit.setAmount(amount); | ||
deposit.setDenom(denom); | ||
const message = new tx_pb_1.MsgCreateInsuranceFund(); | ||
message.setInitialDeposit(deposit); | ||
message.setTicker(fund.ticker); | ||
message.setOracleBase(fund.oracleBase); | ||
message.setQuoteDenom(fund.quoteDenom); | ||
message.setOracleQuote(fund.oracleQuote); | ||
message.setOracleType(fund.oracleType); | ||
message.setSender(injectiveAddress); | ||
message.setExpiry(fund.expiry || -1); | ||
const messageObj = Object.assign(Object.assign({}, snakecase_keys_1.default(message.toObject())), { initial_deposit: [Object.assign({}, snakecase_keys_1.default(deposit.toObject()))], '@type': '/cosmos.gov.v1beta1.MsgDeposit' }); | ||
delete messageObj.initialDeposit; | ||
return messageObj; | ||
} | ||
static underwrite({ marketId, amount, denom, injectiveAddress, }) { | ||
@@ -30,0 +13,0 @@ const deposit = new coin_pb_1.Coin(); |
import { ProposalStatusMap } from '@injectivelabs/chain-api/cosmos/gov/v1beta1/gov_pb'; | ||
import { QueryParamsResponse } from '@injectivelabs/chain-api/cosmos/gov/v1beta1/query_pb'; | ||
import BaseConsumer from '../BaseConsumer'; | ||
import { PaginationOption } from '../types'; | ||
import { GrpcGovernanceDepositParams, GrpcGovernanceTallyParams, GrpcGovernanceVotingParams, PaginationOption } from '../types'; | ||
export declare class GovernanceConsumer extends BaseConsumer { | ||
fetchVotingParams(): Promise<import("@injectivelabs/chain-api/cosmos/gov/v1beta1/gov_pb").VotingParams | undefined>; | ||
fetchDepositParams(): Promise<import("@injectivelabs/chain-api/cosmos/gov/v1beta1/gov_pb").DepositParams | undefined>; | ||
fetchTallyingParams(): Promise<import("@injectivelabs/chain-api/cosmos/gov/v1beta1/gov_pb").TallyParams | undefined>; | ||
fetchParams(): Promise<{ | ||
depositParams: GrpcGovernanceDepositParams; | ||
tallyParams: GrpcGovernanceTallyParams; | ||
votingParams: GrpcGovernanceVotingParams; | ||
}>; | ||
fetchParamsByType(type: string): Promise<QueryParamsResponse>; | ||
@@ -10,0 +12,0 @@ fetchProposals({ status, pagination, }: { |
@@ -22,9 +22,20 @@ "use strict"; | ||
class GovernanceConsumer extends BaseConsumer_1.default { | ||
fetchVotingParams() { | ||
fetchParams() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const request = new query_pb_1.QueryParamsRequest(); | ||
request.setParamsType('voting'); | ||
const paramTypes = ['voting', 'deposit', 'tallying']; | ||
const requests = paramTypes.map((type) => { | ||
const request = new query_pb_1.QueryParamsRequest(); | ||
request.setParamsType(type); | ||
return request; | ||
}); | ||
try { | ||
const response = yield this.request(request, query_pb_service_1.Query.Params); | ||
return response.getVotingParams(); | ||
const responses = yield Promise.all(requests.map((request) => this.request(request, query_pb_service_1.Query.Params))); | ||
const votingParams = responses.find((response) => response.hasVotingParams()); | ||
const tallyParams = responses.find((response) => response.hasTallyParams()); | ||
const depositParams = responses.find((response) => response.hasDepositParams()); | ||
return { | ||
votingParams: votingParams.getVotingParams(), | ||
tallyParams: tallyParams.getTallyParams(), | ||
depositParams: depositParams.getDepositParams(), | ||
}; | ||
} | ||
@@ -36,28 +47,2 @@ catch (e) { | ||
} | ||
fetchDepositParams() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const request = new query_pb_1.QueryParamsRequest(); | ||
request.setParamsType('deposit'); | ||
try { | ||
const response = yield this.request(request, query_pb_service_1.Query.Params); | ||
return response.getDepositParams(); | ||
} | ||
catch (e) { | ||
throw new exceptions_1.GrpcException(e.message); | ||
} | ||
}); | ||
} | ||
fetchTallyingParams() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const request = new query_pb_1.QueryParamsRequest(); | ||
request.setParamsType('tallying'); | ||
try { | ||
const response = yield this.request(request, query_pb_service_1.Query.Params); | ||
return response.getTallyParams(); | ||
} | ||
catch (e) { | ||
throw new exceptions_1.GrpcException(e.message); | ||
} | ||
}); | ||
} | ||
fetchParamsByType(type) { | ||
@@ -64,0 +49,0 @@ return __awaiter(this, void 0, void 0, function* () { |
export * from './ExchangeProposalDecomposer'; | ||
export * from './GovernanceProposalDecomposer'; | ||
export * from './CosmosProposalDecomposer'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -15,2 +15,3 @@ "use strict"; | ||
__exportStar(require("./GovernanceProposalDecomposer"), exports); | ||
__exportStar(require("./CosmosProposalDecomposer"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@injectivelabs/chain-consumer", | ||
"description": "Interacting with our Chain API made easy. Can be reused throughout Injective's projects.", | ||
"version": "0.0.73", | ||
"version": "0.0.732", | ||
"license": "MIT", | ||
@@ -42,3 +42,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "8121620aec5e060f0754f59f71700f8c66f4c2b9" | ||
"gitHead": "05eb3472375cb5f1d46ba545222f1edafedbda75" | ||
} |
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
107
2.88%158729
-2.6%1638
-1.97%