@cosmjs/stargate
Advanced tools
Comparing version 0.27.0-rc2 to 0.27.0
@@ -22,3 +22,8 @@ import { StdFee } from "@cosmjs/amino"; | ||
static fromString(gasPrice: string): GasPrice; | ||
/** | ||
* Returns a string representation of this gas price, e.g. "0.025uatom". | ||
* This can be used as an input to `GasPrice.fromString`. | ||
*/ | ||
toString(): string; | ||
} | ||
export declare function calculateFee(gasLimit: number, gasPrice: GasPrice | string): StdFee; |
@@ -48,2 +48,9 @@ "use strict"; | ||
} | ||
/** | ||
* Returns a string representation of this gas price, e.g. "0.025uatom". | ||
* This can be used as an input to `GasPrice.fromString`. | ||
*/ | ||
toString() { | ||
return this.amount.toString() + this.denom; | ||
} | ||
} | ||
@@ -50,0 +57,0 @@ exports.GasPrice = GasPrice; |
@@ -53,2 +53,13 @@ "use strict"; | ||
}); | ||
describe("toString", () => { | ||
it("works", () => { | ||
const price1 = new fee_1.GasPrice(math_1.Decimal.fromUserInput("3.14", 18), "utest"); | ||
expect(price1.toString()).toEqual("3.14utest"); | ||
const price2 = new fee_1.GasPrice(math_1.Decimal.fromUserInput("0.14", 18), "utest"); | ||
expect(price2.toString()).toEqual("0.14utest"); | ||
// is normalized just like other Decimals | ||
const price3 = new fee_1.GasPrice(math_1.Decimal.fromUserInput("003.000", 18), "utest"); | ||
expect(price3.toString()).toEqual("3utest"); | ||
}); | ||
}); | ||
}); | ||
@@ -55,0 +66,0 @@ describe("calculateFee", () => { |
@@ -8,3 +8,3 @@ export { Account, accountFromAny } from "./accounts"; | ||
export { makeMultisignedTx } from "./multisignature"; | ||
export { AuthExtension, BankExtension, createPagination, createProtobufRpcClient, DistributionExtension, GovExtension, GovParamsType, GovProposalId, IbcExtension, ProtobufRpcClient, QueryClient, setupAuthExtension, setupBankExtension, setupDistributionExtension, setupGovExtension, setupIbcExtension, setupStakingExtension, setupTxExtension, StakingExtension, TxExtension, } from "./queries"; | ||
export { AuthExtension, BankExtension, createPagination, createProtobufRpcClient, decodeCosmosSdkDecFromProto, DistributionExtension, GovExtension, GovParamsType, GovProposalId, IbcExtension, MintExtension, MintParams, ProtobufRpcClient, QueryClient, setupAuthExtension, setupBankExtension, setupDistributionExtension, setupGovExtension, setupIbcExtension, setupMintExtension, setupStakingExtension, setupTxExtension, StakingExtension, TxExtension, } from "./queries"; | ||
export { isSearchByHeightQuery, isSearchBySentFromOrToQuery, isSearchByTagsQuery, SearchByHeightQuery, SearchBySentFromOrToQuery, SearchByTagsQuery, SearchTxFilter, SearchTxQuery, } from "./search"; | ||
@@ -11,0 +11,0 @@ export { defaultRegistryTypes, SignerData, SigningStargateClient, SigningStargateClientOptions, } from "./signingstargateclient"; |
@@ -22,4 +22,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isDeliverTxSuccess = exports.isDeliverTxFailure = exports.assertIsDeliverTxSuccess = exports.assertIsDeliverTxFailure = exports.SigningStargateClient = exports.defaultRegistryTypes = exports.isSearchByTagsQuery = exports.isSearchBySentFromOrToQuery = exports.isSearchByHeightQuery = exports.setupTxExtension = exports.setupStakingExtension = exports.setupIbcExtension = exports.setupGovExtension = exports.setupDistributionExtension = exports.setupBankExtension = exports.setupAuthExtension = exports.QueryClient = exports.createProtobufRpcClient = exports.createPagination = exports.makeMultisignedTx = exports.logs = exports.GasPrice = exports.calculateFee = exports.isMsgWithdrawDelegatorRewardEncodeObject = exports.isMsgVoteEncodeObject = exports.isMsgUndelegateEncodeObject = exports.isMsgTransferEncodeObject = exports.isMsgSubmitProposalEncodeObject = exports.isMsgSendEncodeObject = exports.isMsgDepositEncodeObject = exports.isMsgDelegateEncodeObject = exports.AminoTypes = exports.isAminoMsgWithdrawValidatorCommission = exports.isAminoMsgWithdrawDelegatorReward = exports.isAminoMsgVote = exports.isAminoMsgVerifyInvariant = exports.isAminoMsgUnjail = exports.isAminoMsgUndelegate = exports.isAminoMsgSubmitProposal = exports.isAminoMsgSubmitEvidence = exports.isAminoMsgSetWithdrawAddress = exports.isAminoMsgSend = exports.isAminoMsgMultiSend = exports.isAminoMsgFundCommunityPool = exports.isAminoMsgEditValidator = exports.isAminoMsgDeposit = exports.isAminoMsgDelegate = exports.isAminoMsgCreateValidator = exports.isAminoMsgBeginRedelegate = exports.accountFromAny = void 0; | ||
exports.parseCoins = exports.makeCosmoshubPath = exports.coins = exports.coin = exports.TimeoutError = exports.StargateClient = void 0; | ||
exports.assertIsDeliverTxSuccess = exports.assertIsDeliverTxFailure = exports.SigningStargateClient = exports.defaultRegistryTypes = exports.isSearchByTagsQuery = exports.isSearchBySentFromOrToQuery = exports.isSearchByHeightQuery = exports.setupTxExtension = exports.setupStakingExtension = exports.setupMintExtension = exports.setupIbcExtension = exports.setupGovExtension = exports.setupDistributionExtension = exports.setupBankExtension = exports.setupAuthExtension = exports.QueryClient = exports.decodeCosmosSdkDecFromProto = exports.createProtobufRpcClient = exports.createPagination = exports.makeMultisignedTx = exports.logs = exports.GasPrice = exports.calculateFee = exports.isMsgWithdrawDelegatorRewardEncodeObject = exports.isMsgVoteEncodeObject = exports.isMsgUndelegateEncodeObject = exports.isMsgTransferEncodeObject = exports.isMsgSubmitProposalEncodeObject = exports.isMsgSendEncodeObject = exports.isMsgDepositEncodeObject = exports.isMsgDelegateEncodeObject = exports.AminoTypes = exports.isAminoMsgWithdrawValidatorCommission = exports.isAminoMsgWithdrawDelegatorReward = exports.isAminoMsgVote = exports.isAminoMsgVerifyInvariant = exports.isAminoMsgUnjail = exports.isAminoMsgUndelegate = exports.isAminoMsgSubmitProposal = exports.isAminoMsgSubmitEvidence = exports.isAminoMsgSetWithdrawAddress = exports.isAminoMsgSend = exports.isAminoMsgMultiSend = exports.isAminoMsgFundCommunityPool = exports.isAminoMsgEditValidator = exports.isAminoMsgDeposit = exports.isAminoMsgDelegate = exports.isAminoMsgCreateValidator = exports.isAminoMsgBeginRedelegate = exports.accountFromAny = void 0; | ||
exports.parseCoins = exports.makeCosmoshubPath = exports.coins = exports.coin = exports.TimeoutError = exports.StargateClient = exports.isDeliverTxSuccess = exports.isDeliverTxFailure = void 0; | ||
var accounts_1 = require("./accounts"); | ||
@@ -65,2 +65,3 @@ Object.defineProperty(exports, "accountFromAny", { enumerable: true, get: function () { return accounts_1.accountFromAny; } }); | ||
Object.defineProperty(exports, "createProtobufRpcClient", { enumerable: true, get: function () { return queries_1.createProtobufRpcClient; } }); | ||
Object.defineProperty(exports, "decodeCosmosSdkDecFromProto", { enumerable: true, get: function () { return queries_1.decodeCosmosSdkDecFromProto; } }); | ||
Object.defineProperty(exports, "QueryClient", { enumerable: true, get: function () { return queries_1.QueryClient; } }); | ||
@@ -72,2 +73,3 @@ Object.defineProperty(exports, "setupAuthExtension", { enumerable: true, get: function () { return queries_1.setupAuthExtension; } }); | ||
Object.defineProperty(exports, "setupIbcExtension", { enumerable: true, get: function () { return queries_1.setupIbcExtension; } }); | ||
Object.defineProperty(exports, "setupMintExtension", { enumerable: true, get: function () { return queries_1.setupMintExtension; } }); | ||
Object.defineProperty(exports, "setupStakingExtension", { enumerable: true, get: function () { return queries_1.setupStakingExtension; } }); | ||
@@ -74,0 +76,0 @@ Object.defineProperty(exports, "setupTxExtension", { enumerable: true, get: function () { return queries_1.setupTxExtension; } }); |
@@ -7,4 +7,5 @@ export { QueryClient } from "./queryclient"; | ||
export { IbcExtension, setupIbcExtension } from "./ibc"; | ||
export { MintExtension, MintParams, setupMintExtension } from "./mint"; | ||
export { setupStakingExtension, StakingExtension } from "./staking"; | ||
export { setupTxExtension, TxExtension } from "./tx"; | ||
export { createPagination, createProtobufRpcClient, ProtobufRpcClient } from "./utils"; | ||
export { createPagination, createProtobufRpcClient, decodeCosmosSdkDecFromProto, ProtobufRpcClient, } from "./utils"; |
"use strict"; | ||
// Base symbols | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createProtobufRpcClient = exports.createPagination = exports.setupTxExtension = exports.setupStakingExtension = exports.setupIbcExtension = exports.setupGovExtension = exports.setupDistributionExtension = exports.setupBankExtension = exports.setupAuthExtension = exports.QueryClient = void 0; | ||
exports.decodeCosmosSdkDecFromProto = exports.createProtobufRpcClient = exports.createPagination = exports.setupTxExtension = exports.setupStakingExtension = exports.setupMintExtension = exports.setupIbcExtension = exports.setupGovExtension = exports.setupDistributionExtension = exports.setupBankExtension = exports.setupAuthExtension = exports.QueryClient = void 0; | ||
var queryclient_1 = require("./queryclient"); | ||
@@ -18,2 +18,4 @@ Object.defineProperty(exports, "QueryClient", { enumerable: true, get: function () { return queryclient_1.QueryClient; } }); | ||
Object.defineProperty(exports, "setupIbcExtension", { enumerable: true, get: function () { return ibc_1.setupIbcExtension; } }); | ||
var mint_1 = require("./mint"); | ||
Object.defineProperty(exports, "setupMintExtension", { enumerable: true, get: function () { return mint_1.setupMintExtension; } }); | ||
var staking_1 = require("./staking"); | ||
@@ -26,2 +28,3 @@ Object.defineProperty(exports, "setupStakingExtension", { enumerable: true, get: function () { return staking_1.setupStakingExtension; } }); | ||
Object.defineProperty(exports, "createProtobufRpcClient", { enumerable: true, get: function () { return utils_1.createProtobufRpcClient; } }); | ||
Object.defineProperty(exports, "decodeCosmosSdkDecFromProto", { enumerable: true, get: function () { return utils_1.decodeCosmosSdkDecFromProto; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import { Uint64 } from "@cosmjs/math"; | ||
import { Decimal, Uint64 } from "@cosmjs/math"; | ||
import { PageRequest } from "cosmjs-types/cosmos/base/query/v1beta1/pagination"; | ||
@@ -28,1 +28,8 @@ import Long from "long"; | ||
export declare function longify(value: string | number | Long | Uint64): Long; | ||
/** | ||
* Takes a string or binary encoded `github.com/cosmos/cosmos-sdk/types.Dec` from the | ||
* protobuf API and converts it into a `Decimal` with 18 fractional digits. | ||
* | ||
* See https://github.com/cosmos/cosmos-sdk/issues/10863 for more context why this is needed. | ||
*/ | ||
export declare function decodeCosmosSdkDecFromProto(input: string | Uint8Array): Decimal; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.longify = exports.createProtobufRpcClient = exports.createPagination = exports.toAccAddress = void 0; | ||
exports.decodeCosmosSdkDecFromProto = exports.longify = exports.createProtobufRpcClient = exports.createPagination = exports.toAccAddress = void 0; | ||
const encoding_1 = require("@cosmjs/encoding"); | ||
@@ -57,2 +57,13 @@ const math_1 = require("@cosmjs/math"); | ||
exports.longify = longify; | ||
/** | ||
* Takes a string or binary encoded `github.com/cosmos/cosmos-sdk/types.Dec` from the | ||
* protobuf API and converts it into a `Decimal` with 18 fractional digits. | ||
* | ||
* See https://github.com/cosmos/cosmos-sdk/issues/10863 for more context why this is needed. | ||
*/ | ||
function decodeCosmosSdkDecFromProto(input) { | ||
const asString = typeof input === "string" ? input : (0, encoding_1.fromAscii)(input); | ||
return math_1.Decimal.fromAtomics(asString, 18); | ||
} | ||
exports.decodeCosmosSdkDecFromProto = decodeCosmosSdkDecFromProto; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "@cosmjs/stargate", | ||
"version": "0.27.0-rc2", | ||
"version": "0.27.0", | ||
"description": "Utilities for Cosmos SDK 0.40", | ||
@@ -42,9 +42,9 @@ "contributors": [ | ||
"@confio/ics23": "^0.6.3", | ||
"@cosmjs/amino": "0.27.0-rc2", | ||
"@cosmjs/encoding": "0.27.0-rc2", | ||
"@cosmjs/math": "0.27.0-rc2", | ||
"@cosmjs/proto-signing": "0.27.0-rc2", | ||
"@cosmjs/stream": "0.27.0-rc2", | ||
"@cosmjs/tendermint-rpc": "0.27.0-rc2", | ||
"@cosmjs/utils": "0.27.0-rc2", | ||
"@cosmjs/amino": "0.27.0", | ||
"@cosmjs/encoding": "0.27.0", | ||
"@cosmjs/math": "0.27.0", | ||
"@cosmjs/proto-signing": "0.27.0", | ||
"@cosmjs/stream": "0.27.0", | ||
"@cosmjs/tendermint-rpc": "0.27.0", | ||
"@cosmjs/utils": "0.27.0", | ||
"cosmjs-types": "^0.4.0", | ||
@@ -56,3 +56,3 @@ "long": "^4.0.0", | ||
"devDependencies": { | ||
"@cosmjs/crypto": "0.27.0-rc2", | ||
"@cosmjs/crypto": "0.27.0", | ||
"@istanbuljs/nyc-config-typescript": "^1.0.1", | ||
@@ -95,4 +95,3 @@ "@types/eslint-plugin-prettier": "^3", | ||
"webpack-cli": "^4.6.0" | ||
}, | ||
"stableVersion": "0.26.5" | ||
} | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
671225
126
8034
+ Added@cosmjs/amino@0.27.0(transitive)
+ Added@cosmjs/crypto@0.27.0(transitive)
+ Added@cosmjs/encoding@0.27.0(transitive)
+ Added@cosmjs/json-rpc@0.27.0(transitive)
+ Added@cosmjs/math@0.27.0(transitive)
+ Added@cosmjs/proto-signing@0.27.0(transitive)
+ Added@cosmjs/socket@0.27.0(transitive)
+ Added@cosmjs/stream@0.27.0(transitive)
+ Added@cosmjs/tendermint-rpc@0.27.0(transitive)
+ Added@cosmjs/utils@0.27.0(transitive)
- Removed@cosmjs/amino@0.27.0-rc2(transitive)
- Removed@cosmjs/crypto@0.27.0-rc2(transitive)
- Removed@cosmjs/encoding@0.27.0-rc2(transitive)
- Removed@cosmjs/json-rpc@0.27.0-rc2(transitive)
- Removed@cosmjs/math@0.27.0-rc2(transitive)
- Removed@cosmjs/proto-signing@0.27.0-rc2(transitive)
- Removed@cosmjs/socket@0.27.0-rc2(transitive)
- Removed@cosmjs/stream@0.27.0-rc2(transitive)
- Removed@cosmjs/tendermint-rpc@0.27.0-rc2(transitive)
- Removed@cosmjs/utils@0.27.0-rc2(transitive)
Updated@cosmjs/amino@0.27.0
Updated@cosmjs/encoding@0.27.0
Updated@cosmjs/math@0.27.0
Updated@cosmjs/proto-signing@0.27.0
Updated@cosmjs/stream@0.27.0
Updated@cosmjs/utils@0.27.0