@cosmjs/stargate
Advanced tools
Comparing version 0.28.0-rc1 to 0.28.0-rc2
@@ -8,9 +8,4 @@ import { AminoMsg } from "@cosmjs/amino"; | ||
} | ||
export interface AminoTypesOptions { | ||
/** | ||
* The Bech32 address prefix of the chain you work with (also called Bech32 human-readable part). | ||
*/ | ||
readonly prefix: string; | ||
readonly additions?: Record<string, AminoConverter>; | ||
} | ||
/** A map from protobuf type URL to the AminoConverter implementation if supported on chain */ | ||
export declare type AminoConverters = Record<string, AminoConverter | "not_supported_by_chain">; | ||
/** | ||
@@ -22,5 +17,5 @@ * A map from Stargate message types as used in the messages's `Any` type | ||
private readonly register; | ||
constructor({ prefix, additions }: AminoTypesOptions); | ||
constructor(types: AminoConverters); | ||
toAmino({ typeUrl, value }: EncodeObject): AminoMsg; | ||
fromAmino({ type, value }: AminoMsg): EncodeObject; | ||
} |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AminoTypes = void 0; | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
const amino_1 = require("@cosmjs/amino"); | ||
const encoding_1 = require("@cosmjs/encoding"); | ||
const utils_1 = require("@cosmjs/utils"); | ||
const gov_1 = require("cosmjs-types/cosmos/gov/v1beta1/gov"); | ||
const any_1 = require("cosmjs-types/google/protobuf/any"); | ||
const long_1 = __importDefault(require("long")); | ||
function omitDefault(input) { | ||
if (typeof input === "string") { | ||
return input === "" ? undefined : input; | ||
} | ||
if (typeof input === "number") { | ||
return input === 0 ? undefined : input; | ||
} | ||
if (long_1.default.isLong(input)) { | ||
return input.isZero() ? undefined : input; | ||
} | ||
throw new Error(`Got unsupported type '${typeof input}'`); | ||
} | ||
function createDefaultTypes(prefix) { | ||
return { | ||
// authz | ||
"/cosmos.authz.v1beta1.MsgGrant": "not_supported_by_chain", | ||
"/cosmos.authz.v1beta1.MsgExec": "not_supported_by_chain", | ||
"/cosmos.authz.v1beta1.MsgRevoke": "not_supported_by_chain", | ||
// bank | ||
"/cosmos.bank.v1beta1.MsgSend": { | ||
aminoType: "cosmos-sdk/MsgSend", | ||
toAmino: ({ fromAddress, toAddress, amount }) => ({ | ||
from_address: fromAddress, | ||
to_address: toAddress, | ||
amount: [...amount], | ||
}), | ||
fromAmino: ({ from_address, to_address, amount }) => ({ | ||
fromAddress: from_address, | ||
toAddress: to_address, | ||
amount: [...amount], | ||
}), | ||
}, | ||
"/cosmos.bank.v1beta1.MsgMultiSend": { | ||
aminoType: "cosmos-sdk/MsgMultiSend", | ||
toAmino: ({ inputs, outputs }) => ({ | ||
inputs: inputs.map((input) => ({ | ||
address: input.address, | ||
coins: [...input.coins], | ||
})), | ||
outputs: outputs.map((output) => ({ | ||
address: output.address, | ||
coins: [...output.coins], | ||
})), | ||
}), | ||
fromAmino: ({ inputs, outputs }) => ({ | ||
inputs: inputs.map((input) => ({ | ||
address: input.address, | ||
coins: [...input.coins], | ||
})), | ||
outputs: outputs.map((output) => ({ | ||
address: output.address, | ||
coins: [...output.coins], | ||
})), | ||
}), | ||
}, | ||
// distribution | ||
"/cosmos.distribution.v1beta1.MsgFundCommunityPool": { | ||
aminoType: "cosmos-sdk/MsgFundCommunityPool", | ||
toAmino: ({ amount, depositor }) => ({ | ||
amount: [...amount], | ||
depositor: depositor, | ||
}), | ||
fromAmino: ({ amount, depositor }) => ({ | ||
amount: [...amount], | ||
depositor: depositor, | ||
}), | ||
}, | ||
"/cosmos.distribution.v1beta1.MsgSetWithdrawAddress": { | ||
aminoType: "cosmos-sdk/MsgModifyWithdrawAddress", | ||
toAmino: ({ delegatorAddress, withdrawAddress, }) => ({ | ||
delegator_address: delegatorAddress, | ||
withdraw_address: withdrawAddress, | ||
}), | ||
fromAmino: ({ delegator_address, withdraw_address, }) => ({ | ||
delegatorAddress: delegator_address, | ||
withdrawAddress: withdraw_address, | ||
}), | ||
}, | ||
"/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward": { | ||
aminoType: "cosmos-sdk/MsgWithdrawDelegationReward", | ||
toAmino: ({ delegatorAddress, validatorAddress, }) => ({ | ||
delegator_address: delegatorAddress, | ||
validator_address: validatorAddress, | ||
}), | ||
fromAmino: ({ delegator_address, validator_address, }) => ({ | ||
delegatorAddress: delegator_address, | ||
validatorAddress: validator_address, | ||
}), | ||
}, | ||
"/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission": { | ||
aminoType: "cosmos-sdk/MsgWithdrawValidatorCommission", | ||
toAmino: ({ validatorAddress, }) => ({ | ||
validator_address: validatorAddress, | ||
}), | ||
fromAmino: ({ validator_address, }) => ({ | ||
validatorAddress: validator_address, | ||
}), | ||
}, | ||
// gov | ||
"/cosmos.gov.v1beta1.MsgDeposit": { | ||
aminoType: "cosmos-sdk/MsgDeposit", | ||
toAmino: ({ amount, depositor, proposalId }) => { | ||
return { | ||
amount, | ||
depositor, | ||
proposal_id: proposalId.toString(), | ||
}; | ||
}, | ||
fromAmino: ({ amount, depositor, proposal_id }) => { | ||
return { | ||
amount: Array.from(amount), | ||
depositor, | ||
proposalId: long_1.default.fromString(proposal_id), | ||
}; | ||
}, | ||
}, | ||
"/cosmos.gov.v1beta1.MsgVote": { | ||
aminoType: "cosmos-sdk/MsgVote", | ||
toAmino: ({ option, proposalId, voter }) => { | ||
return { | ||
option: option, | ||
proposal_id: proposalId.toString(), | ||
voter: voter, | ||
}; | ||
}, | ||
fromAmino: ({ option, proposal_id, voter }) => { | ||
return { | ||
option: (0, gov_1.voteOptionFromJSON)(option), | ||
proposalId: long_1.default.fromString(proposal_id), | ||
voter: voter, | ||
}; | ||
}, | ||
}, | ||
"/cosmos.gov.v1beta1.MsgSubmitProposal": { | ||
aminoType: "cosmos-sdk/MsgSubmitProposal", | ||
toAmino: ({ initialDeposit, proposer, content, }) => { | ||
(0, utils_1.assertDefinedAndNotNull)(content); | ||
let proposal; | ||
switch (content.typeUrl) { | ||
case "/cosmos.gov.v1beta1.TextProposal": { | ||
const textProposal = gov_1.TextProposal.decode(content.value); | ||
proposal = { | ||
type: "cosmos-sdk/TextProposal", | ||
value: { | ||
description: textProposal.description, | ||
title: textProposal.title, | ||
}, | ||
}; | ||
break; | ||
} | ||
default: | ||
throw new Error(`Unsupported proposal type: '${content.typeUrl}'`); | ||
} | ||
return { | ||
initial_deposit: initialDeposit, | ||
proposer: proposer, | ||
content: proposal, | ||
}; | ||
}, | ||
fromAmino: ({ initial_deposit, proposer, content, }) => { | ||
let any_content; | ||
switch (content.type) { | ||
case "cosmos-sdk/TextProposal": { | ||
const { value } = content; | ||
(0, utils_1.assert)((0, utils_1.isNonNullObject)(value)); | ||
const { title, description } = value; | ||
(0, utils_1.assert)(typeof title === "string"); | ||
(0, utils_1.assert)(typeof description === "string"); | ||
any_content = any_1.Any.fromPartial({ | ||
typeUrl: "/cosmos.gov.v1beta1.TextProposal", | ||
value: gov_1.TextProposal.encode(gov_1.TextProposal.fromPartial({ | ||
title: title, | ||
description: description, | ||
})).finish(), | ||
}); | ||
break; | ||
} | ||
default: | ||
throw new Error(`Unsupported proposal type: '${content.type}'`); | ||
} | ||
return { | ||
initialDeposit: Array.from(initial_deposit), | ||
proposer: proposer, | ||
content: any_content, | ||
}; | ||
}, | ||
}, | ||
// staking | ||
"/cosmos.staking.v1beta1.MsgBeginRedelegate": { | ||
aminoType: "cosmos-sdk/MsgBeginRedelegate", | ||
toAmino: ({ delegatorAddress, validatorSrcAddress, validatorDstAddress, amount, }) => { | ||
(0, utils_1.assertDefinedAndNotNull)(amount, "missing amount"); | ||
return { | ||
delegator_address: delegatorAddress, | ||
validator_src_address: validatorSrcAddress, | ||
validator_dst_address: validatorDstAddress, | ||
amount: amount, | ||
}; | ||
}, | ||
fromAmino: ({ delegator_address, validator_src_address, validator_dst_address, amount, }) => ({ | ||
delegatorAddress: delegator_address, | ||
validatorSrcAddress: validator_src_address, | ||
validatorDstAddress: validator_dst_address, | ||
amount: amount, | ||
}), | ||
}, | ||
"/cosmos.staking.v1beta1.MsgCreateValidator": { | ||
aminoType: "cosmos-sdk/MsgCreateValidator", | ||
toAmino: ({ description, commission, minSelfDelegation, delegatorAddress, validatorAddress, pubkey, value, }) => { | ||
(0, utils_1.assertDefinedAndNotNull)(description, "missing description"); | ||
(0, utils_1.assertDefinedAndNotNull)(commission, "missing commission"); | ||
(0, utils_1.assertDefinedAndNotNull)(pubkey, "missing pubkey"); | ||
(0, utils_1.assertDefinedAndNotNull)(value, "missing value"); | ||
return { | ||
description: { | ||
moniker: description.moniker, | ||
identity: description.identity, | ||
website: description.website, | ||
security_contact: description.securityContact, | ||
details: description.details, | ||
}, | ||
commission: { | ||
rate: commission.rate, | ||
max_rate: commission.maxRate, | ||
max_change_rate: commission.maxChangeRate, | ||
}, | ||
min_self_delegation: minSelfDelegation, | ||
delegator_address: delegatorAddress, | ||
validator_address: validatorAddress, | ||
pubkey: (0, amino_1.encodeBech32Pubkey)({ | ||
type: "tendermint/PubKeySecp256k1", | ||
value: (0, encoding_1.toBase64)(pubkey.value), | ||
}, prefix), | ||
value: value, | ||
}; | ||
}, | ||
fromAmino: ({ description, commission, min_self_delegation, delegator_address, validator_address, pubkey, value, }) => { | ||
const decodedPubkey = (0, amino_1.decodeBech32Pubkey)(pubkey); | ||
if (decodedPubkey.type !== "tendermint/PubKeySecp256k1") { | ||
throw new Error("Only Secp256k1 public keys are supported"); | ||
} | ||
return { | ||
description: { | ||
moniker: description.moniker, | ||
identity: description.identity, | ||
website: description.website, | ||
securityContact: description.security_contact, | ||
details: description.details, | ||
}, | ||
commission: { | ||
rate: commission.rate, | ||
maxRate: commission.max_rate, | ||
maxChangeRate: commission.max_change_rate, | ||
}, | ||
minSelfDelegation: min_self_delegation, | ||
delegatorAddress: delegator_address, | ||
validatorAddress: validator_address, | ||
pubkey: { | ||
typeUrl: "/cosmos.crypto.secp256k1.PubKey", | ||
value: (0, encoding_1.fromBase64)(decodedPubkey.value), | ||
}, | ||
value: value, | ||
}; | ||
}, | ||
}, | ||
"/cosmos.staking.v1beta1.MsgDelegate": { | ||
aminoType: "cosmos-sdk/MsgDelegate", | ||
toAmino: ({ delegatorAddress, validatorAddress, amount }) => { | ||
(0, utils_1.assertDefinedAndNotNull)(amount, "missing amount"); | ||
return { | ||
delegator_address: delegatorAddress, | ||
validator_address: validatorAddress, | ||
amount: amount, | ||
}; | ||
}, | ||
fromAmino: ({ delegator_address, validator_address, amount, }) => ({ | ||
delegatorAddress: delegator_address, | ||
validatorAddress: validator_address, | ||
amount: amount, | ||
}), | ||
}, | ||
"/cosmos.staking.v1beta1.MsgEditValidator": { | ||
aminoType: "cosmos-sdk/MsgEditValidator", | ||
toAmino: ({ description, commissionRate, minSelfDelegation, validatorAddress, }) => { | ||
(0, utils_1.assertDefinedAndNotNull)(description, "missing description"); | ||
return { | ||
description: { | ||
moniker: description.moniker, | ||
identity: description.identity, | ||
website: description.website, | ||
security_contact: description.securityContact, | ||
details: description.details, | ||
}, | ||
commission_rate: commissionRate, | ||
min_self_delegation: minSelfDelegation, | ||
validator_address: validatorAddress, | ||
}; | ||
}, | ||
fromAmino: ({ description, commission_rate, min_self_delegation, validator_address, }) => ({ | ||
description: { | ||
moniker: description.moniker, | ||
identity: description.identity, | ||
website: description.website, | ||
securityContact: description.security_contact, | ||
details: description.details, | ||
}, | ||
commissionRate: commission_rate, | ||
minSelfDelegation: min_self_delegation, | ||
validatorAddress: validator_address, | ||
}), | ||
}, | ||
"/cosmos.staking.v1beta1.MsgUndelegate": { | ||
aminoType: "cosmos-sdk/MsgUndelegate", | ||
toAmino: ({ delegatorAddress, validatorAddress, amount, }) => { | ||
(0, utils_1.assertDefinedAndNotNull)(amount, "missing amount"); | ||
return { | ||
delegator_address: delegatorAddress, | ||
validator_address: validatorAddress, | ||
amount: amount, | ||
}; | ||
}, | ||
fromAmino: ({ delegator_address, validator_address, amount, }) => ({ | ||
delegatorAddress: delegator_address, | ||
validatorAddress: validator_address, | ||
amount: amount, | ||
}), | ||
}, | ||
// ibc | ||
"/ibc.applications.transfer.v1.MsgTransfer": { | ||
aminoType: "cosmos-sdk/MsgTransfer", | ||
toAmino: ({ sourcePort, sourceChannel, token, sender, receiver, timeoutHeight, timeoutTimestamp, }) => { | ||
var _a, _b, _c; | ||
return ({ | ||
source_port: sourcePort, | ||
source_channel: sourceChannel, | ||
token: token, | ||
sender: sender, | ||
receiver: receiver, | ||
timeout_height: timeoutHeight | ||
? { | ||
revision_height: (_a = omitDefault(timeoutHeight.revisionHeight)) === null || _a === void 0 ? void 0 : _a.toString(), | ||
revision_number: (_b = omitDefault(timeoutHeight.revisionNumber)) === null || _b === void 0 ? void 0 : _b.toString(), | ||
} | ||
: {}, | ||
timeout_timestamp: (_c = omitDefault(timeoutTimestamp)) === null || _c === void 0 ? void 0 : _c.toString(), | ||
}); | ||
}, | ||
fromAmino: ({ source_port, source_channel, token, sender, receiver, timeout_height, timeout_timestamp, }) => ({ | ||
sourcePort: source_port, | ||
sourceChannel: source_channel, | ||
token: token, | ||
sender: sender, | ||
receiver: receiver, | ||
timeoutHeight: timeout_height | ||
? { | ||
revisionHeight: long_1.default.fromString(timeout_height.revision_height || "0", true), | ||
revisionNumber: long_1.default.fromString(timeout_height.revision_number || "0", true), | ||
} | ||
: undefined, | ||
timeoutTimestamp: long_1.default.fromString(timeout_timestamp || "0", true), | ||
}), | ||
}, | ||
"/cosmos.feegrant.v1beta1.MsgGrantAllowance": "not_supported_by_chain", | ||
"/cosmos.feegrant.v1beta1.MsgRevokeAllowance": "not_supported_by_chain", | ||
}; | ||
} | ||
function isAminoConverter(converter) { | ||
@@ -388,5 +12,4 @@ return typeof converter[1] !== "string"; | ||
class AminoTypes { | ||
constructor({ prefix, additions = {} }) { | ||
const defaultTypes = createDefaultTypes(prefix); | ||
this.register = { ...defaultTypes, ...additions }; | ||
constructor(types) { | ||
this.register = types; | ||
} | ||
@@ -393,0 +16,0 @@ toAmino({ typeUrl, value }) { |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
const amino_1 = require("@cosmjs/amino"); | ||
const encoding_1 = require("@cosmjs/encoding"); | ||
const proto_signing_1 = require("@cosmjs/proto-signing"); | ||
const gov_1 = require("cosmjs-types/cosmos/gov/v1beta1/gov"); | ||
const long_1 = __importDefault(require("long")); | ||
const aminotypes_1 = require("./aminotypes"); | ||
const modules_1 = require("./modules"); | ||
describe("AminoTypes", () => { | ||
@@ -22,16 +15,13 @@ describe("constructor", () => { | ||
const types = new aminotypes_1.AminoTypes({ | ||
prefix: "cosmos", | ||
additions: { | ||
"/cosmos.staking.v1beta1.MsgDelegate": { | ||
aminoType: "my-override/MsgDelegate", | ||
toAmino: (m) => { | ||
var _a; | ||
return ({ | ||
foo: (_a = m.delegatorAddress) !== null && _a !== void 0 ? _a : "", | ||
}); | ||
}, | ||
fromAmino: () => ({ | ||
bar: 123, | ||
}), | ||
"/cosmos.staking.v1beta1.MsgDelegate": { | ||
aminoType: "my-override/MsgDelegate", | ||
toAmino: (m) => { | ||
var _a; | ||
return ({ | ||
foo: (_a = m.delegatorAddress) !== null && _a !== void 0 ? _a : "", | ||
}); | ||
}, | ||
fromAmino: () => ({ | ||
bar: 123, | ||
}), | ||
}, | ||
@@ -58,16 +48,14 @@ }); | ||
const types = new aminotypes_1.AminoTypes({ | ||
prefix: "cosmos", | ||
additions: { | ||
"/cosmos.staking.otherVersion456.MsgDelegate": { | ||
aminoType: "cosmos-sdk/MsgDelegate", | ||
toAmino: (m) => { | ||
var _a; | ||
return ({ | ||
foo: (_a = m.delegatorAddress) !== null && _a !== void 0 ? _a : "", | ||
}); | ||
}, | ||
fromAmino: () => ({ | ||
bar: 123, | ||
}), | ||
...(0, modules_1.createStakingAminoConverters)("cosmos"), | ||
"/cosmos.staking.otherVersion456.MsgDelegate": { | ||
aminoType: "cosmos-sdk/MsgDelegate", | ||
toAmino: (m) => { | ||
var _a; | ||
return ({ | ||
foo: (_a = m.delegatorAddress) !== null && _a !== void 0 ? _a : "", | ||
}); | ||
}, | ||
fromAmino: () => ({ | ||
bar: 123, | ||
}), | ||
}, | ||
@@ -89,443 +77,2 @@ }); | ||
describe("toAmino", () => { | ||
// bank | ||
it("works for MsgSend", () => { | ||
const msg = { | ||
fromAddress: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
toAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
amount: (0, proto_signing_1.coins)(1234, "ucosm"), | ||
}; | ||
const aminoMsg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).toAmino({ | ||
typeUrl: "/cosmos.bank.v1beta1.MsgSend", | ||
value: msg, | ||
}); | ||
const expected = { | ||
type: "cosmos-sdk/MsgSend", | ||
value: { | ||
from_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
to_address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
amount: (0, proto_signing_1.coins)(1234, "ucosm"), | ||
}, | ||
}; | ||
expect(aminoMsg).toEqual(expected); | ||
}); | ||
it("works for MsgMultiSend", () => { | ||
const msg = { | ||
inputs: [ | ||
{ address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", coins: (0, proto_signing_1.coins)(1234, "ucosm") }, | ||
{ address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", coins: (0, proto_signing_1.coins)(5678, "ucosm") }, | ||
], | ||
outputs: [ | ||
{ address: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", coins: (0, proto_signing_1.coins)(6000, "ucosm") }, | ||
{ address: "cosmos142u9fgcjdlycfcez3lw8x6x5h7rfjlnfhpw2lx", coins: (0, proto_signing_1.coins)(912, "ucosm") }, | ||
], | ||
}; | ||
const aminoMsg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).toAmino({ | ||
typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", | ||
value: msg, | ||
}); | ||
const expected = { | ||
type: "cosmos-sdk/MsgMultiSend", | ||
value: { | ||
inputs: [ | ||
{ address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", coins: (0, proto_signing_1.coins)(1234, "ucosm") }, | ||
{ address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", coins: (0, proto_signing_1.coins)(5678, "ucosm") }, | ||
], | ||
outputs: [ | ||
{ address: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", coins: (0, proto_signing_1.coins)(6000, "ucosm") }, | ||
{ address: "cosmos142u9fgcjdlycfcez3lw8x6x5h7rfjlnfhpw2lx", coins: (0, proto_signing_1.coins)(912, "ucosm") }, | ||
], | ||
}, | ||
}; | ||
expect(aminoMsg).toEqual(expected); | ||
}); | ||
// gov | ||
it("works for MsgDeposit", () => { | ||
const msg = { | ||
amount: [{ amount: "12300000", denom: "ustake" }], | ||
depositor: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
proposalId: long_1.default.fromNumber(5), | ||
}; | ||
const aminoMsg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).toAmino({ | ||
typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", | ||
value: msg, | ||
}); | ||
const expected = { | ||
type: "cosmos-sdk/MsgDeposit", | ||
value: { | ||
amount: [{ amount: "12300000", denom: "ustake" }], | ||
depositor: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
proposal_id: "5", | ||
}, | ||
}; | ||
expect(aminoMsg).toEqual(expected); | ||
}); | ||
it("works for MsgSubmitProposal", () => { | ||
const msg = { | ||
initialDeposit: [{ amount: "12300000", denom: "ustake" }], | ||
proposer: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
content: { | ||
typeUrl: "/cosmos.gov.v1beta1.TextProposal", | ||
value: gov_1.TextProposal.encode({ | ||
description: "This proposal proposes to test whether this proposal passes", | ||
title: "Test Proposal", | ||
}).finish(), | ||
}, | ||
}; | ||
const aminoMsg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).toAmino({ | ||
typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", | ||
value: msg, | ||
}); | ||
const expected = { | ||
type: "cosmos-sdk/MsgSubmitProposal", | ||
value: { | ||
initial_deposit: [{ amount: "12300000", denom: "ustake" }], | ||
proposer: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
content: { | ||
type: "cosmos-sdk/TextProposal", | ||
value: { | ||
description: "This proposal proposes to test whether this proposal passes", | ||
title: "Test Proposal", | ||
}, | ||
}, | ||
}, | ||
}; | ||
expect(aminoMsg).toEqual(expected); | ||
}); | ||
it("works for MsgVote", () => { | ||
const msg = { | ||
option: gov_1.VoteOption.VOTE_OPTION_NO_WITH_VETO, | ||
proposalId: long_1.default.fromNumber(5), | ||
voter: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", | ||
}; | ||
const aminoMsg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).toAmino({ | ||
typeUrl: "/cosmos.gov.v1beta1.MsgVote", | ||
value: msg, | ||
}); | ||
const expected = { | ||
type: "cosmos-sdk/MsgVote", | ||
value: { | ||
option: 4, | ||
proposal_id: "5", | ||
voter: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", | ||
}, | ||
}; | ||
expect(aminoMsg).toEqual(expected); | ||
}); | ||
// distribution | ||
it("works for MsgFundCommunityPool", async () => { | ||
const msg = { | ||
amount: (0, proto_signing_1.coins)(1234, "ucosm"), | ||
depositor: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
}; | ||
const aminoMsg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).toAmino({ | ||
typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", | ||
value: msg, | ||
}); | ||
const expected = { | ||
type: "cosmos-sdk/MsgFundCommunityPool", | ||
value: { | ||
amount: (0, proto_signing_1.coins)(1234, "ucosm"), | ||
depositor: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
}, | ||
}; | ||
expect(aminoMsg).toEqual(expected); | ||
}); | ||
it("works for MsgSetWithdrawAddress", async () => { | ||
const msg = { | ||
delegatorAddress: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
withdrawAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
}; | ||
const aminoMsg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).toAmino({ | ||
typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", | ||
value: msg, | ||
}); | ||
const expected = { | ||
type: "cosmos-sdk/MsgModifyWithdrawAddress", | ||
value: { | ||
delegator_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
withdraw_address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
}, | ||
}; | ||
expect(aminoMsg).toEqual(expected); | ||
}); | ||
it("works for MsgWithdrawDelegatorReward", async () => { | ||
const msg = { | ||
delegatorAddress: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
validatorAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
}; | ||
const aminoMsg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).toAmino({ | ||
typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", | ||
value: msg, | ||
}); | ||
const expected = { | ||
type: "cosmos-sdk/MsgWithdrawDelegationReward", | ||
value: { | ||
delegator_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
validator_address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
}, | ||
}; | ||
expect(aminoMsg).toEqual(expected); | ||
}); | ||
it("works for MsgWithdrawValidatorCommission", async () => { | ||
const msg = { | ||
validatorAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
}; | ||
const aminoMsg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).toAmino({ | ||
typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", | ||
value: msg, | ||
}); | ||
const expected = { | ||
type: "cosmos-sdk/MsgWithdrawValidatorCommission", | ||
value: { | ||
validator_address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
}, | ||
}; | ||
expect(aminoMsg).toEqual(expected); | ||
}); | ||
// staking | ||
it("works for MsgBeginRedelegate", () => { | ||
const msg = { | ||
delegatorAddress: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
validatorSrcAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
validatorDstAddress: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", | ||
amount: (0, proto_signing_1.coin)(1234, "ucosm"), | ||
}; | ||
const aminoMsg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).toAmino({ | ||
typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", | ||
value: msg, | ||
}); | ||
const expected = { | ||
type: "cosmos-sdk/MsgBeginRedelegate", | ||
value: { | ||
delegator_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
validator_src_address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
validator_dst_address: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", | ||
amount: (0, proto_signing_1.coin)(1234, "ucosm"), | ||
}, | ||
}; | ||
expect(aminoMsg).toEqual(expected); | ||
}); | ||
it("works for MsgCreateValidator", () => { | ||
const msg = { | ||
description: { | ||
moniker: "validator", | ||
identity: "me", | ||
website: "valid.com", | ||
securityContact: "Hamburglar", | ||
details: "...", | ||
}, | ||
commission: { | ||
rate: "0.2", | ||
maxRate: "0.3", | ||
maxChangeRate: "0.1", | ||
}, | ||
minSelfDelegation: "123", | ||
delegatorAddress: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
validatorAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
pubkey: { | ||
typeUrl: "/cosmos.crypto.secp256k1.PubKey", | ||
value: (0, encoding_1.fromBase64)("A08EGB7ro1ORuFhjOnZcSgwYlpe0DSFjVNUIkNNQxwKQ"), | ||
}, | ||
value: (0, proto_signing_1.coin)(1234, "ucosm"), | ||
}; | ||
const aminoMsg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).toAmino({ | ||
typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", | ||
value: msg, | ||
}); | ||
const expected = { | ||
type: "cosmos-sdk/MsgCreateValidator", | ||
value: { | ||
description: { | ||
moniker: "validator", | ||
identity: "me", | ||
website: "valid.com", | ||
security_contact: "Hamburglar", | ||
details: "...", | ||
}, | ||
commission: { | ||
rate: "0.2", | ||
max_rate: "0.3", | ||
max_change_rate: "0.1", | ||
}, | ||
min_self_delegation: "123", | ||
delegator_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
validator_address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
pubkey: (0, amino_1.encodeBech32Pubkey)({ type: "tendermint/PubKeySecp256k1", value: "A08EGB7ro1ORuFhjOnZcSgwYlpe0DSFjVNUIkNNQxwKQ" }, "cosmos"), | ||
value: (0, proto_signing_1.coin)(1234, "ucosm"), | ||
}, | ||
}; | ||
expect(aminoMsg).toEqual(expected); | ||
}); | ||
it("works for MsgDelegate", () => { | ||
const msg = { | ||
delegatorAddress: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
validatorAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
amount: (0, proto_signing_1.coin)(1234, "ucosm"), | ||
}; | ||
const aminoMsg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).toAmino({ | ||
typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", | ||
value: msg, | ||
}); | ||
const expected = { | ||
type: "cosmos-sdk/MsgDelegate", | ||
value: { | ||
delegator_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
validator_address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
amount: (0, proto_signing_1.coin)(1234, "ucosm"), | ||
}, | ||
}; | ||
expect(aminoMsg).toEqual(expected); | ||
}); | ||
it("works for MsgEditValidator", () => { | ||
const msg = { | ||
description: { | ||
moniker: "validator", | ||
identity: "me", | ||
website: "valid.com", | ||
securityContact: "Hamburglar", | ||
details: "...", | ||
}, | ||
commissionRate: "0.2", | ||
minSelfDelegation: "123", | ||
validatorAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
}; | ||
const aminoMsg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).toAmino({ | ||
typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", | ||
value: msg, | ||
}); | ||
const expected = { | ||
type: "cosmos-sdk/MsgEditValidator", | ||
value: { | ||
description: { | ||
moniker: "validator", | ||
identity: "me", | ||
website: "valid.com", | ||
security_contact: "Hamburglar", | ||
details: "...", | ||
}, | ||
commission_rate: "0.2", | ||
min_self_delegation: "123", | ||
validator_address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
}, | ||
}; | ||
expect(aminoMsg).toEqual(expected); | ||
}); | ||
it("works for MsgUndelegate", () => { | ||
const msg = { | ||
delegatorAddress: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
validatorAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
amount: (0, proto_signing_1.coin)(1234, "ucosm"), | ||
}; | ||
const aminoMsg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).toAmino({ | ||
typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", | ||
value: msg, | ||
}); | ||
const expected = { | ||
type: "cosmos-sdk/MsgUndelegate", | ||
value: { | ||
delegator_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
validator_address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
amount: (0, proto_signing_1.coin)(1234, "ucosm"), | ||
}, | ||
}; | ||
expect(aminoMsg).toEqual(expected); | ||
}); | ||
// ibc | ||
it("works for MsgTransfer", () => { | ||
const msg = { | ||
sourcePort: "testport", | ||
sourceChannel: "testchannel", | ||
token: (0, proto_signing_1.coin)(1234, "utest"), | ||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
timeoutHeight: { | ||
revisionHeight: long_1.default.fromString("123", true), | ||
revisionNumber: long_1.default.fromString("456", true), | ||
}, | ||
timeoutTimestamp: long_1.default.fromString("789", true), | ||
}; | ||
const aminoMsg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).toAmino({ | ||
typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", | ||
value: msg, | ||
}); | ||
const expected = { | ||
type: "cosmos-sdk/MsgTransfer", | ||
value: { | ||
source_port: "testport", | ||
source_channel: "testchannel", | ||
token: (0, proto_signing_1.coin)(1234, "utest"), | ||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
timeout_height: { | ||
revision_height: "123", | ||
revision_number: "456", | ||
}, | ||
timeout_timestamp: "789", | ||
}, | ||
}; | ||
expect(aminoMsg).toEqual(expected); | ||
}); | ||
it("works for MsgTransfer with empty values", () => { | ||
const msg = { | ||
sourcePort: "testport", | ||
sourceChannel: "testchannel", | ||
token: (0, proto_signing_1.coin)(1234, "utest"), | ||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
timeoutHeight: { | ||
revisionHeight: long_1.default.UZERO, | ||
revisionNumber: long_1.default.UZERO, | ||
}, | ||
timeoutTimestamp: long_1.default.UZERO, | ||
}; | ||
const aminoMsg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).toAmino({ | ||
typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", | ||
value: msg, | ||
}); | ||
const expected = { | ||
type: "cosmos-sdk/MsgTransfer", | ||
value: { | ||
source_port: "testport", | ||
source_channel: "testchannel", | ||
token: (0, proto_signing_1.coin)(1234, "utest"), | ||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
timeout_height: { | ||
revision_height: undefined, | ||
revision_number: undefined, | ||
}, | ||
timeout_timestamp: undefined, | ||
}, | ||
}; | ||
expect(aminoMsg).toEqual(expected); | ||
}); | ||
it("works for MsgTransfer with no height timeout", () => { | ||
const msg = { | ||
sourcePort: "testport", | ||
sourceChannel: "testchannel", | ||
token: (0, proto_signing_1.coin)(1234, "utest"), | ||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
timeoutHeight: undefined, | ||
timeoutTimestamp: long_1.default.UZERO, | ||
}; | ||
const aminoMsg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).toAmino({ | ||
typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", | ||
value: msg, | ||
}); | ||
const expected = { | ||
type: "cosmos-sdk/MsgTransfer", | ||
value: { | ||
source_port: "testport", | ||
source_channel: "testchannel", | ||
token: (0, proto_signing_1.coin)(1234, "utest"), | ||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
timeout_height: {}, | ||
timeout_timestamp: undefined, | ||
}, | ||
}; | ||
expect(aminoMsg).toEqual(expected); | ||
}); | ||
// other | ||
it("works with custom type url", () => { | ||
@@ -536,12 +83,9 @@ const msg = { | ||
const aminoMsg = new aminotypes_1.AminoTypes({ | ||
prefix: "cosmos", | ||
additions: { | ||
"/my.CustomType": { | ||
aminoType: "my-sdk/CustomType", | ||
toAmino: ({ foo, }) => ({ | ||
foo: `amino-prefix-${foo}`, | ||
constant: "something-for-amino", | ||
}), | ||
fromAmino: () => { }, | ||
}, | ||
"/my.CustomType": { | ||
aminoType: "my-sdk/CustomType", | ||
toAmino: ({ foo, }) => ({ | ||
foo: `amino-prefix-${foo}`, | ||
constant: "something-for-amino", | ||
}), | ||
fromAmino: () => { }, | ||
}, | ||
@@ -564,14 +108,11 @@ }).toAmino({ typeUrl: "/my.CustomType", value: msg }); | ||
const aminoMsg = new aminotypes_1.AminoTypes({ | ||
prefix: "cosmos", | ||
additions: { | ||
"/cosmos.staking.v1beta1.MsgDelegate": { | ||
aminoType: "my-override/MsgDelegate", | ||
toAmino: (m) => { | ||
var _a; | ||
return ({ | ||
foo: (_a = m.delegatorAddress) !== null && _a !== void 0 ? _a : "", | ||
}); | ||
}, | ||
fromAmino: () => { }, | ||
"/cosmos.staking.v1beta1.MsgDelegate": { | ||
aminoType: "my-override/MsgDelegate", | ||
toAmino: (m) => { | ||
var _a; | ||
return ({ | ||
foo: (_a = m.delegatorAddress) !== null && _a !== void 0 ? _a : "", | ||
}); | ||
}, | ||
fromAmino: () => { }, | ||
}, | ||
@@ -591,353 +132,9 @@ }).toAmino({ | ||
it("throws for unknown type url", () => { | ||
expect(() => new aminotypes_1.AminoTypes({ prefix: "cosmos" }).toAmino({ typeUrl: "/xxx.Unknown", value: { foo: "bar" } })).toThrowError(/Type URL '\/xxx\.Unknown' does not exist in the Amino message type register./i); | ||
expect(() => new aminotypes_1.AminoTypes((0, modules_1.createBankAminoConverters)()).toAmino({ | ||
typeUrl: "/xxx.Unknown", | ||
value: { foo: "bar" }, | ||
})).toThrowError(/Type URL '\/xxx\.Unknown' does not exist in the Amino message type register./i); | ||
}); | ||
}); | ||
describe("fromAmino", () => { | ||
// bank | ||
it("works for MsgSend", () => { | ||
const aminoMsg = { | ||
type: "cosmos-sdk/MsgSend", | ||
value: { | ||
from_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
to_address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
amount: (0, proto_signing_1.coins)(1234, "ucosm"), | ||
}, | ||
}; | ||
const msg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).fromAmino(aminoMsg); | ||
const expectedValue = { | ||
fromAddress: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
toAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
amount: (0, proto_signing_1.coins)(1234, "ucosm"), | ||
}; | ||
expect(msg).toEqual({ | ||
typeUrl: "/cosmos.bank.v1beta1.MsgSend", | ||
value: expectedValue, | ||
}); | ||
}); | ||
it("works for MsgMultiSend", () => { | ||
const aminoMsg = { | ||
type: "cosmos-sdk/MsgMultiSend", | ||
value: { | ||
inputs: [ | ||
{ address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", coins: (0, proto_signing_1.coins)(1234, "ucosm") }, | ||
{ address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", coins: (0, proto_signing_1.coins)(5678, "ucosm") }, | ||
], | ||
outputs: [ | ||
{ address: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", coins: (0, proto_signing_1.coins)(6000, "ucosm") }, | ||
{ address: "cosmos142u9fgcjdlycfcez3lw8x6x5h7rfjlnfhpw2lx", coins: (0, proto_signing_1.coins)(912, "ucosm") }, | ||
], | ||
}, | ||
}; | ||
const msg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).fromAmino(aminoMsg); | ||
const expectedValue = { | ||
inputs: [ | ||
{ address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", coins: (0, proto_signing_1.coins)(1234, "ucosm") }, | ||
{ address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", coins: (0, proto_signing_1.coins)(5678, "ucosm") }, | ||
], | ||
outputs: [ | ||
{ address: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", coins: (0, proto_signing_1.coins)(6000, "ucosm") }, | ||
{ address: "cosmos142u9fgcjdlycfcez3lw8x6x5h7rfjlnfhpw2lx", coins: (0, proto_signing_1.coins)(912, "ucosm") }, | ||
], | ||
}; | ||
expect(msg).toEqual({ | ||
typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", | ||
value: expectedValue, | ||
}); | ||
}); | ||
// gov | ||
it("works for MsgDeposit", () => { | ||
const aminoMsg = { | ||
type: "cosmos-sdk/MsgDeposit", | ||
value: { | ||
amount: [{ amount: "12300000", denom: "ustake" }], | ||
depositor: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
proposal_id: "5", | ||
}, | ||
}; | ||
const msg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).fromAmino(aminoMsg); | ||
const expectedValue = { | ||
amount: [{ amount: "12300000", denom: "ustake" }], | ||
depositor: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
proposalId: long_1.default.fromNumber(5), | ||
}; | ||
expect(msg).toEqual({ | ||
typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", | ||
value: expectedValue, | ||
}); | ||
}); | ||
it("works for MsgSubmitProposal", () => { | ||
const aminoMsg = { | ||
type: "cosmos-sdk/MsgSubmitProposal", | ||
value: { | ||
initial_deposit: [{ amount: "12300000", denom: "ustake" }], | ||
proposer: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
content: { | ||
type: "cosmos-sdk/TextProposal", | ||
value: { | ||
description: "This proposal proposes to test whether this proposal passes", | ||
title: "Test Proposal", | ||
}, | ||
}, | ||
}, | ||
}; | ||
const msg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).fromAmino(aminoMsg); | ||
const expectedValue = { | ||
initialDeposit: [{ amount: "12300000", denom: "ustake" }], | ||
proposer: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
content: { | ||
typeUrl: "/cosmos.gov.v1beta1.TextProposal", | ||
value: gov_1.TextProposal.encode({ | ||
description: "This proposal proposes to test whether this proposal passes", | ||
title: "Test Proposal", | ||
}).finish(), | ||
}, | ||
}; | ||
expect(msg).toEqual({ | ||
typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", | ||
value: expectedValue, | ||
}); | ||
}); | ||
it("works for MsgVote", () => { | ||
const aminoMsg = { | ||
type: "cosmos-sdk/MsgVote", | ||
value: { | ||
option: 4, | ||
proposal_id: "5", | ||
voter: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", | ||
}, | ||
}; | ||
const msg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).fromAmino(aminoMsg); | ||
const expectedValue = { | ||
option: gov_1.VoteOption.VOTE_OPTION_NO_WITH_VETO, | ||
proposalId: long_1.default.fromNumber(5), | ||
voter: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", | ||
}; | ||
expect(msg).toEqual({ | ||
typeUrl: "/cosmos.gov.v1beta1.MsgVote", | ||
value: expectedValue, | ||
}); | ||
}); | ||
// distribution | ||
// TODO: MsgFundCommunityPool | ||
// TODO: MsgSetWithdrawAddress | ||
// TODO: MsgWithdrawDelegatorReward | ||
// TODO: MsgWithdrawValidatorCommission | ||
// staking | ||
it("works for MsgBeginRedelegate", () => { | ||
const aminoMsg = { | ||
type: "cosmos-sdk/MsgBeginRedelegate", | ||
value: { | ||
delegator_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
validator_src_address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
validator_dst_address: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", | ||
amount: (0, proto_signing_1.coin)(1234, "ucosm"), | ||
}, | ||
}; | ||
const msg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).fromAmino(aminoMsg); | ||
const expectedValue = { | ||
delegatorAddress: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
validatorSrcAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
validatorDstAddress: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", | ||
amount: (0, proto_signing_1.coin)(1234, "ucosm"), | ||
}; | ||
expect(msg).toEqual({ | ||
typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", | ||
value: expectedValue, | ||
}); | ||
}); | ||
it("works for MsgCreateValidator", () => { | ||
const aminoMsg = { | ||
type: "cosmos-sdk/MsgCreateValidator", | ||
value: { | ||
description: { | ||
moniker: "validator", | ||
identity: "me", | ||
website: "valid.com", | ||
security_contact: "Hamburglar", | ||
details: "...", | ||
}, | ||
commission: { | ||
rate: "0.2", | ||
max_rate: "0.3", | ||
max_change_rate: "0.1", | ||
}, | ||
min_self_delegation: "123", | ||
delegator_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
validator_address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
pubkey: (0, amino_1.encodeBech32Pubkey)({ type: "tendermint/PubKeySecp256k1", value: "A08EGB7ro1ORuFhjOnZcSgwYlpe0DSFjVNUIkNNQxwKQ" }, "cosmos"), | ||
value: (0, proto_signing_1.coin)(1234, "ucosm"), | ||
}, | ||
}; | ||
const msg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).fromAmino(aminoMsg); | ||
const expectedValue = { | ||
description: { | ||
moniker: "validator", | ||
identity: "me", | ||
website: "valid.com", | ||
securityContact: "Hamburglar", | ||
details: "...", | ||
}, | ||
commission: { | ||
rate: "0.2", | ||
maxRate: "0.3", | ||
maxChangeRate: "0.1", | ||
}, | ||
minSelfDelegation: "123", | ||
delegatorAddress: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
validatorAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
pubkey: { | ||
typeUrl: "/cosmos.crypto.secp256k1.PubKey", | ||
value: (0, encoding_1.fromBase64)("A08EGB7ro1ORuFhjOnZcSgwYlpe0DSFjVNUIkNNQxwKQ"), | ||
}, | ||
value: (0, proto_signing_1.coin)(1234, "ucosm"), | ||
}; | ||
expect(msg).toEqual({ | ||
typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", | ||
value: expectedValue, | ||
}); | ||
}); | ||
it("works for MsgDelegate", () => { | ||
const aminoMsg = { | ||
type: "cosmos-sdk/MsgDelegate", | ||
value: { | ||
delegator_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
validator_address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
amount: (0, proto_signing_1.coin)(1234, "ucosm"), | ||
}, | ||
}; | ||
const msg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).fromAmino(aminoMsg); | ||
const expectedValue = { | ||
delegatorAddress: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
validatorAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
amount: (0, proto_signing_1.coin)(1234, "ucosm"), | ||
}; | ||
expect(msg).toEqual({ | ||
typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", | ||
value: expectedValue, | ||
}); | ||
}); | ||
it("works for MsgEditValidator", () => { | ||
const aminoMsg = { | ||
type: "cosmos-sdk/MsgEditValidator", | ||
value: { | ||
description: { | ||
moniker: "validator", | ||
identity: "me", | ||
website: "valid.com", | ||
security_contact: "Hamburglar", | ||
details: "...", | ||
}, | ||
commission_rate: "0.2", | ||
min_self_delegation: "123", | ||
validator_address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
}, | ||
}; | ||
const msg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).fromAmino(aminoMsg); | ||
const expectedValue = { | ||
description: { | ||
moniker: "validator", | ||
identity: "me", | ||
website: "valid.com", | ||
securityContact: "Hamburglar", | ||
details: "...", | ||
}, | ||
commissionRate: "0.2", | ||
minSelfDelegation: "123", | ||
validatorAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
}; | ||
expect(msg).toEqual({ | ||
typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", | ||
value: expectedValue, | ||
}); | ||
}); | ||
it("works for MsgUndelegate", () => { | ||
const aminoMsg = { | ||
type: "cosmos-sdk/MsgUndelegate", | ||
value: { | ||
delegator_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
validator_address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
amount: (0, proto_signing_1.coin)(1234, "ucosm"), | ||
}, | ||
}; | ||
const msg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).fromAmino(aminoMsg); | ||
const expectedValue = { | ||
delegatorAddress: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
validatorAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
amount: (0, proto_signing_1.coin)(1234, "ucosm"), | ||
}; | ||
expect(msg).toEqual({ | ||
typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", | ||
value: expectedValue, | ||
}); | ||
}); | ||
// ibc | ||
it("works for MsgTransfer", () => { | ||
const aminoMsg = { | ||
type: "cosmos-sdk/MsgTransfer", | ||
value: { | ||
source_port: "testport", | ||
source_channel: "testchannel", | ||
token: (0, proto_signing_1.coin)(1234, "utest"), | ||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
timeout_height: { | ||
revision_height: "123", | ||
revision_number: "456", | ||
}, | ||
timeout_timestamp: "789", | ||
}, | ||
}; | ||
const msg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).fromAmino(aminoMsg); | ||
const expectedValue = { | ||
sourcePort: "testport", | ||
sourceChannel: "testchannel", | ||
token: (0, proto_signing_1.coin)(1234, "utest"), | ||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
timeoutHeight: { | ||
revisionHeight: long_1.default.fromString("123", true), | ||
revisionNumber: long_1.default.fromString("456", true), | ||
}, | ||
timeoutTimestamp: long_1.default.fromString("789", true), | ||
}; | ||
expect(msg).toEqual({ | ||
typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", | ||
value: expectedValue, | ||
}); | ||
}); | ||
it("works for MsgTransfer with default values", () => { | ||
const aminoMsg = { | ||
type: "cosmos-sdk/MsgTransfer", | ||
value: { | ||
source_port: "testport", | ||
source_channel: "testchannel", | ||
token: (0, proto_signing_1.coin)(1234, "utest"), | ||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
timeout_height: { | ||
// revision_height omitted | ||
// revision_number omitted | ||
}, | ||
// timeout_timestamp omitted | ||
}, | ||
}; | ||
const msg = new aminotypes_1.AminoTypes({ prefix: "cosmos" }).fromAmino(aminoMsg); | ||
const expectedValue = { | ||
sourcePort: "testport", | ||
sourceChannel: "testchannel", | ||
token: (0, proto_signing_1.coin)(1234, "utest"), | ||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", | ||
receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
timeoutHeight: { | ||
revisionHeight: long_1.default.UZERO, | ||
revisionNumber: long_1.default.UZERO, | ||
}, | ||
timeoutTimestamp: long_1.default.UZERO, | ||
}; | ||
expect(msg).toEqual({ | ||
typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", | ||
value: expectedValue, | ||
}); | ||
}); | ||
// other | ||
it("works for custom type url", () => { | ||
@@ -952,11 +149,8 @@ const aminoMsg = { | ||
const msg = new aminotypes_1.AminoTypes({ | ||
prefix: "cosmos", | ||
additions: { | ||
"/my.CustomType": { | ||
aminoType: "my-sdk/CustomType", | ||
toAmino: () => { }, | ||
fromAmino: ({ foo }) => ({ | ||
foo: foo.slice(13), | ||
}), | ||
}, | ||
"/my.CustomType": { | ||
aminoType: "my-sdk/CustomType", | ||
toAmino: () => { }, | ||
fromAmino: ({ foo }) => ({ | ||
foo: foo.slice(13), | ||
}), | ||
}, | ||
@@ -974,13 +168,10 @@ }).fromAmino(aminoMsg); | ||
const msg = new aminotypes_1.AminoTypes({ | ||
prefix: "cosmos", | ||
additions: { | ||
"/cosmos.staking.v1beta1.MsgDelegate": { | ||
aminoType: "cosmos-sdk/MsgDelegate2", | ||
toAmino: () => { }, | ||
fromAmino: ({ foo }) => ({ | ||
delegatorAddress: foo, | ||
validatorAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
amount: (0, proto_signing_1.coin)(1234, "ucosm"), | ||
}), | ||
}, | ||
"/cosmos.staking.v1beta1.MsgDelegate": { | ||
aminoType: "cosmos-sdk/MsgDelegate2", | ||
toAmino: () => { }, | ||
fromAmino: ({ foo }) => ({ | ||
delegatorAddress: foo, | ||
validatorAddress: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", | ||
amount: (0, proto_signing_1.coin)(1234, "ucosm"), | ||
}), | ||
}, | ||
@@ -1004,3 +195,3 @@ }).fromAmino({ | ||
expect(() => { | ||
new aminotypes_1.AminoTypes({ prefix: "cosmos" }).toAmino({ | ||
new aminotypes_1.AminoTypes({ "/cosmos.feegrant.v1beta1.MsgRevokeAllowance": "not_supported_by_chain" }).toAmino({ | ||
typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", | ||
@@ -1012,3 +203,3 @@ value: 0, | ||
it("throws for unknown type url", () => { | ||
expect(() => new aminotypes_1.AminoTypes({ prefix: "cosmos" }).fromAmino({ | ||
expect(() => new aminotypes_1.AminoTypes((0, modules_1.createBankAminoConverters)()).fromAmino({ | ||
type: "cosmos-sdk/MsgUnknown", | ||
@@ -1015,0 +206,0 @@ value: { foo: "bar" }, |
export { Account, accountFromAny } from "./accounts"; | ||
export { AminoMsgBeginRedelegate, AminoMsgCreateValidator, AminoMsgDelegate, AminoMsgDeposit, AminoMsgEditValidator, AminoMsgFundCommunityPool, AminoMsgMultiSend, AminoMsgSend, AminoMsgSetWithdrawAddress, AminoMsgSubmitEvidence, AminoMsgSubmitProposal, AminoMsgUndelegate, AminoMsgUnjail, AminoMsgVerifyInvariant, AminoMsgVote, AminoMsgWithdrawDelegatorReward, AminoMsgWithdrawValidatorCommission, isAminoMsgBeginRedelegate, isAminoMsgCreateValidator, isAminoMsgDelegate, isAminoMsgDeposit, isAminoMsgEditValidator, isAminoMsgFundCommunityPool, isAminoMsgMultiSend, isAminoMsgSend, isAminoMsgSetWithdrawAddress, isAminoMsgSubmitEvidence, isAminoMsgSubmitProposal, isAminoMsgUndelegate, isAminoMsgUnjail, isAminoMsgVerifyInvariant, isAminoMsgVote, isAminoMsgWithdrawDelegatorReward, isAminoMsgWithdrawValidatorCommission, } from "./aminomsgs"; | ||
export { AminoConverter, AminoTypes, AminoTypesOptions } from "./aminotypes"; | ||
export { isMsgDelegateEncodeObject, isMsgDepositEncodeObject, isMsgSendEncodeObject, isMsgSubmitProposalEncodeObject, isMsgTransferEncodeObject, isMsgUndelegateEncodeObject, isMsgVoteEncodeObject, isMsgWithdrawDelegatorRewardEncodeObject, MsgDelegateEncodeObject, MsgDepositEncodeObject, MsgSendEncodeObject, MsgSubmitProposalEncodeObject, MsgTransferEncodeObject, MsgUndelegateEncodeObject, MsgVoteEncodeObject, MsgWithdrawDelegatorRewardEncodeObject, } from "./encodeobjects"; | ||
export { AminoConverter, AminoConverters, AminoTypes } from "./aminotypes"; | ||
export { calculateFee, GasPrice } from "./fee"; | ||
export * as logs from "./logs"; | ||
export { AminoMsgBeginRedelegate, AminoMsgCreateValidator, AminoMsgDelegate, AminoMsgDeposit, AminoMsgEditValidator, AminoMsgFundCommunityPool, AminoMsgMultiSend, AminoMsgSend, AminoMsgSetWithdrawAddress, AminoMsgSubmitEvidence, AminoMsgSubmitProposal, AminoMsgUndelegate, AminoMsgUnjail, AminoMsgVerifyInvariant, AminoMsgVote, AminoMsgWithdrawDelegatorReward, AminoMsgWithdrawValidatorCommission, AuthExtension, BankExtension, DistributionExtension, GovExtension, GovParamsType, GovProposalId, IbcExtension, isAminoMsgBeginRedelegate, isAminoMsgCreateValidator, isAminoMsgDelegate, isAminoMsgDeposit, isAminoMsgEditValidator, isAminoMsgFundCommunityPool, isAminoMsgMultiSend, isAminoMsgSend, isAminoMsgSetWithdrawAddress, isAminoMsgSubmitEvidence, isAminoMsgSubmitProposal, isAminoMsgUndelegate, isAminoMsgUnjail, isAminoMsgVerifyInvariant, isAminoMsgVote, isAminoMsgWithdrawDelegatorReward, isAminoMsgWithdrawValidatorCommission, isMsgDelegateEncodeObject, isMsgDepositEncodeObject, isMsgSendEncodeObject, isMsgSubmitProposalEncodeObject, isMsgTransferEncodeObject, isMsgUndelegateEncodeObject, isMsgVoteEncodeObject, isMsgWithdrawDelegatorRewardEncodeObject, MintExtension, MintParams, MsgDelegateEncodeObject, MsgDepositEncodeObject, MsgSendEncodeObject, MsgSubmitProposalEncodeObject, MsgTransferEncodeObject, MsgUndelegateEncodeObject, MsgVoteEncodeObject, MsgWithdrawDelegatorRewardEncodeObject, setupAuthExtension, setupBankExtension, setupDistributionExtension, setupGovExtension, setupIbcExtension, setupMintExtension, setupStakingExtension, setupTxExtension, StakingExtension, TxExtension, } from "./modules"; | ||
export { createAuthzAminoConverters, createBankAminoConverters, createDistributionAminoConverters, createFreegrantAminoConverters, createGovAminoConverters, createIbcAminoConverters, createStakingAminoConverters, } from "./modules"; | ||
export { makeMultisignedTx } from "./multisignature"; | ||
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 { createPagination, createProtobufRpcClient, decodeCosmosSdkDecFromProto, ProtobufRpcClient, QueryClient, } from "./queryclient"; | ||
export { isSearchByHeightQuery, isSearchBySentFromOrToQuery, isSearchByTagsQuery, SearchByHeightQuery, SearchBySentFromOrToQuery, SearchByTagsQuery, SearchTxFilter, SearchTxQuery, } from "./search"; | ||
@@ -10,0 +10,0 @@ export { defaultRegistryTypes, SignerData, SigningStargateClient, SigningStargateClientOptions, } from "./signingstargateclient"; |
@@ -22,35 +22,8 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
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; | ||
exports.QueryClient = exports.decodeCosmosSdkDecFromProto = exports.createProtobufRpcClient = exports.createPagination = exports.makeMultisignedTx = exports.createStakingAminoConverters = exports.createIbcAminoConverters = exports.createGovAminoConverters = exports.createFreegrantAminoConverters = exports.createDistributionAminoConverters = exports.createBankAminoConverters = exports.createAuthzAminoConverters = exports.setupTxExtension = exports.setupStakingExtension = exports.setupMintExtension = exports.setupIbcExtension = exports.setupGovExtension = exports.setupDistributionExtension = exports.setupBankExtension = exports.setupAuthExtension = exports.isMsgWithdrawDelegatorRewardEncodeObject = exports.isMsgVoteEncodeObject = exports.isMsgUndelegateEncodeObject = exports.isMsgTransferEncodeObject = exports.isMsgSubmitProposalEncodeObject = exports.isMsgSendEncodeObject = exports.isMsgDepositEncodeObject = exports.isMsgDelegateEncodeObject = 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.logs = exports.GasPrice = exports.calculateFee = exports.AminoTypes = exports.accountFromAny = void 0; | ||
exports.parseCoins = exports.makeCosmoshubPath = exports.coins = exports.coin = exports.TimeoutError = exports.StargateClient = exports.isDeliverTxSuccess = exports.isDeliverTxFailure = exports.assertIsDeliverTxSuccess = exports.assertIsDeliverTxFailure = exports.SigningStargateClient = exports.defaultRegistryTypes = exports.isSearchByTagsQuery = exports.isSearchBySentFromOrToQuery = exports.isSearchByHeightQuery = void 0; | ||
var accounts_1 = require("./accounts"); | ||
Object.defineProperty(exports, "accountFromAny", { enumerable: true, get: function () { return accounts_1.accountFromAny; } }); | ||
var aminomsgs_1 = require("./aminomsgs"); | ||
Object.defineProperty(exports, "isAminoMsgBeginRedelegate", { enumerable: true, get: function () { return aminomsgs_1.isAminoMsgBeginRedelegate; } }); | ||
Object.defineProperty(exports, "isAminoMsgCreateValidator", { enumerable: true, get: function () { return aminomsgs_1.isAminoMsgCreateValidator; } }); | ||
Object.defineProperty(exports, "isAminoMsgDelegate", { enumerable: true, get: function () { return aminomsgs_1.isAminoMsgDelegate; } }); | ||
Object.defineProperty(exports, "isAminoMsgDeposit", { enumerable: true, get: function () { return aminomsgs_1.isAminoMsgDeposit; } }); | ||
Object.defineProperty(exports, "isAminoMsgEditValidator", { enumerable: true, get: function () { return aminomsgs_1.isAminoMsgEditValidator; } }); | ||
Object.defineProperty(exports, "isAminoMsgFundCommunityPool", { enumerable: true, get: function () { return aminomsgs_1.isAminoMsgFundCommunityPool; } }); | ||
Object.defineProperty(exports, "isAminoMsgMultiSend", { enumerable: true, get: function () { return aminomsgs_1.isAminoMsgMultiSend; } }); | ||
Object.defineProperty(exports, "isAminoMsgSend", { enumerable: true, get: function () { return aminomsgs_1.isAminoMsgSend; } }); | ||
Object.defineProperty(exports, "isAminoMsgSetWithdrawAddress", { enumerable: true, get: function () { return aminomsgs_1.isAminoMsgSetWithdrawAddress; } }); | ||
Object.defineProperty(exports, "isAminoMsgSubmitEvidence", { enumerable: true, get: function () { return aminomsgs_1.isAminoMsgSubmitEvidence; } }); | ||
Object.defineProperty(exports, "isAminoMsgSubmitProposal", { enumerable: true, get: function () { return aminomsgs_1.isAminoMsgSubmitProposal; } }); | ||
Object.defineProperty(exports, "isAminoMsgUndelegate", { enumerable: true, get: function () { return aminomsgs_1.isAminoMsgUndelegate; } }); | ||
Object.defineProperty(exports, "isAminoMsgUnjail", { enumerable: true, get: function () { return aminomsgs_1.isAminoMsgUnjail; } }); | ||
Object.defineProperty(exports, "isAminoMsgVerifyInvariant", { enumerable: true, get: function () { return aminomsgs_1.isAminoMsgVerifyInvariant; } }); | ||
Object.defineProperty(exports, "isAminoMsgVote", { enumerable: true, get: function () { return aminomsgs_1.isAminoMsgVote; } }); | ||
Object.defineProperty(exports, "isAminoMsgWithdrawDelegatorReward", { enumerable: true, get: function () { return aminomsgs_1.isAminoMsgWithdrawDelegatorReward; } }); | ||
Object.defineProperty(exports, "isAminoMsgWithdrawValidatorCommission", { enumerable: true, get: function () { return aminomsgs_1.isAminoMsgWithdrawValidatorCommission; } }); | ||
var aminotypes_1 = require("./aminotypes"); | ||
Object.defineProperty(exports, "AminoTypes", { enumerable: true, get: function () { return aminotypes_1.AminoTypes; } }); | ||
var encodeobjects_1 = require("./encodeobjects"); | ||
Object.defineProperty(exports, "isMsgDelegateEncodeObject", { enumerable: true, get: function () { return encodeobjects_1.isMsgDelegateEncodeObject; } }); | ||
Object.defineProperty(exports, "isMsgDepositEncodeObject", { enumerable: true, get: function () { return encodeobjects_1.isMsgDepositEncodeObject; } }); | ||
Object.defineProperty(exports, "isMsgSendEncodeObject", { enumerable: true, get: function () { return encodeobjects_1.isMsgSendEncodeObject; } }); | ||
Object.defineProperty(exports, "isMsgSubmitProposalEncodeObject", { enumerable: true, get: function () { return encodeobjects_1.isMsgSubmitProposalEncodeObject; } }); | ||
Object.defineProperty(exports, "isMsgTransferEncodeObject", { enumerable: true, get: function () { return encodeobjects_1.isMsgTransferEncodeObject; } }); | ||
Object.defineProperty(exports, "isMsgUndelegateEncodeObject", { enumerable: true, get: function () { return encodeobjects_1.isMsgUndelegateEncodeObject; } }); | ||
Object.defineProperty(exports, "isMsgVoteEncodeObject", { enumerable: true, get: function () { return encodeobjects_1.isMsgVoteEncodeObject; } }); | ||
Object.defineProperty(exports, "isMsgWithdrawDelegatorRewardEncodeObject", { enumerable: true, get: function () { return encodeobjects_1.isMsgWithdrawDelegatorRewardEncodeObject; } }); | ||
var fee_1 = require("./fee"); | ||
@@ -60,17 +33,51 @@ Object.defineProperty(exports, "calculateFee", { enumerable: true, get: function () { return fee_1.calculateFee; } }); | ||
exports.logs = __importStar(require("./logs")); | ||
var modules_1 = require("./modules"); | ||
Object.defineProperty(exports, "isAminoMsgBeginRedelegate", { enumerable: true, get: function () { return modules_1.isAminoMsgBeginRedelegate; } }); | ||
Object.defineProperty(exports, "isAminoMsgCreateValidator", { enumerable: true, get: function () { return modules_1.isAminoMsgCreateValidator; } }); | ||
Object.defineProperty(exports, "isAminoMsgDelegate", { enumerable: true, get: function () { return modules_1.isAminoMsgDelegate; } }); | ||
Object.defineProperty(exports, "isAminoMsgDeposit", { enumerable: true, get: function () { return modules_1.isAminoMsgDeposit; } }); | ||
Object.defineProperty(exports, "isAminoMsgEditValidator", { enumerable: true, get: function () { return modules_1.isAminoMsgEditValidator; } }); | ||
Object.defineProperty(exports, "isAminoMsgFundCommunityPool", { enumerable: true, get: function () { return modules_1.isAminoMsgFundCommunityPool; } }); | ||
Object.defineProperty(exports, "isAminoMsgMultiSend", { enumerable: true, get: function () { return modules_1.isAminoMsgMultiSend; } }); | ||
Object.defineProperty(exports, "isAminoMsgSend", { enumerable: true, get: function () { return modules_1.isAminoMsgSend; } }); | ||
Object.defineProperty(exports, "isAminoMsgSetWithdrawAddress", { enumerable: true, get: function () { return modules_1.isAminoMsgSetWithdrawAddress; } }); | ||
Object.defineProperty(exports, "isAminoMsgSubmitEvidence", { enumerable: true, get: function () { return modules_1.isAminoMsgSubmitEvidence; } }); | ||
Object.defineProperty(exports, "isAminoMsgSubmitProposal", { enumerable: true, get: function () { return modules_1.isAminoMsgSubmitProposal; } }); | ||
Object.defineProperty(exports, "isAminoMsgUndelegate", { enumerable: true, get: function () { return modules_1.isAminoMsgUndelegate; } }); | ||
Object.defineProperty(exports, "isAminoMsgUnjail", { enumerable: true, get: function () { return modules_1.isAminoMsgUnjail; } }); | ||
Object.defineProperty(exports, "isAminoMsgVerifyInvariant", { enumerable: true, get: function () { return modules_1.isAminoMsgVerifyInvariant; } }); | ||
Object.defineProperty(exports, "isAminoMsgVote", { enumerable: true, get: function () { return modules_1.isAminoMsgVote; } }); | ||
Object.defineProperty(exports, "isAminoMsgWithdrawDelegatorReward", { enumerable: true, get: function () { return modules_1.isAminoMsgWithdrawDelegatorReward; } }); | ||
Object.defineProperty(exports, "isAminoMsgWithdrawValidatorCommission", { enumerable: true, get: function () { return modules_1.isAminoMsgWithdrawValidatorCommission; } }); | ||
Object.defineProperty(exports, "isMsgDelegateEncodeObject", { enumerable: true, get: function () { return modules_1.isMsgDelegateEncodeObject; } }); | ||
Object.defineProperty(exports, "isMsgDepositEncodeObject", { enumerable: true, get: function () { return modules_1.isMsgDepositEncodeObject; } }); | ||
Object.defineProperty(exports, "isMsgSendEncodeObject", { enumerable: true, get: function () { return modules_1.isMsgSendEncodeObject; } }); | ||
Object.defineProperty(exports, "isMsgSubmitProposalEncodeObject", { enumerable: true, get: function () { return modules_1.isMsgSubmitProposalEncodeObject; } }); | ||
Object.defineProperty(exports, "isMsgTransferEncodeObject", { enumerable: true, get: function () { return modules_1.isMsgTransferEncodeObject; } }); | ||
Object.defineProperty(exports, "isMsgUndelegateEncodeObject", { enumerable: true, get: function () { return modules_1.isMsgUndelegateEncodeObject; } }); | ||
Object.defineProperty(exports, "isMsgVoteEncodeObject", { enumerable: true, get: function () { return modules_1.isMsgVoteEncodeObject; } }); | ||
Object.defineProperty(exports, "isMsgWithdrawDelegatorRewardEncodeObject", { enumerable: true, get: function () { return modules_1.isMsgWithdrawDelegatorRewardEncodeObject; } }); | ||
Object.defineProperty(exports, "setupAuthExtension", { enumerable: true, get: function () { return modules_1.setupAuthExtension; } }); | ||
Object.defineProperty(exports, "setupBankExtension", { enumerable: true, get: function () { return modules_1.setupBankExtension; } }); | ||
Object.defineProperty(exports, "setupDistributionExtension", { enumerable: true, get: function () { return modules_1.setupDistributionExtension; } }); | ||
Object.defineProperty(exports, "setupGovExtension", { enumerable: true, get: function () { return modules_1.setupGovExtension; } }); | ||
Object.defineProperty(exports, "setupIbcExtension", { enumerable: true, get: function () { return modules_1.setupIbcExtension; } }); | ||
Object.defineProperty(exports, "setupMintExtension", { enumerable: true, get: function () { return modules_1.setupMintExtension; } }); | ||
Object.defineProperty(exports, "setupStakingExtension", { enumerable: true, get: function () { return modules_1.setupStakingExtension; } }); | ||
Object.defineProperty(exports, "setupTxExtension", { enumerable: true, get: function () { return modules_1.setupTxExtension; } }); | ||
var modules_2 = require("./modules"); | ||
Object.defineProperty(exports, "createAuthzAminoConverters", { enumerable: true, get: function () { return modules_2.createAuthzAminoConverters; } }); | ||
Object.defineProperty(exports, "createBankAminoConverters", { enumerable: true, get: function () { return modules_2.createBankAminoConverters; } }); | ||
Object.defineProperty(exports, "createDistributionAminoConverters", { enumerable: true, get: function () { return modules_2.createDistributionAminoConverters; } }); | ||
Object.defineProperty(exports, "createFreegrantAminoConverters", { enumerable: true, get: function () { return modules_2.createFreegrantAminoConverters; } }); | ||
Object.defineProperty(exports, "createGovAminoConverters", { enumerable: true, get: function () { return modules_2.createGovAminoConverters; } }); | ||
Object.defineProperty(exports, "createIbcAminoConverters", { enumerable: true, get: function () { return modules_2.createIbcAminoConverters; } }); | ||
Object.defineProperty(exports, "createStakingAminoConverters", { enumerable: true, get: function () { return modules_2.createStakingAminoConverters; } }); | ||
var multisignature_1 = require("./multisignature"); | ||
Object.defineProperty(exports, "makeMultisignedTx", { enumerable: true, get: function () { return multisignature_1.makeMultisignedTx; } }); | ||
var queries_1 = require("./queries"); | ||
Object.defineProperty(exports, "createPagination", { enumerable: true, get: function () { return queries_1.createPagination; } }); | ||
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; } }); | ||
Object.defineProperty(exports, "setupAuthExtension", { enumerable: true, get: function () { return queries_1.setupAuthExtension; } }); | ||
Object.defineProperty(exports, "setupBankExtension", { enumerable: true, get: function () { return queries_1.setupBankExtension; } }); | ||
Object.defineProperty(exports, "setupDistributionExtension", { enumerable: true, get: function () { return queries_1.setupDistributionExtension; } }); | ||
Object.defineProperty(exports, "setupGovExtension", { enumerable: true, get: function () { return queries_1.setupGovExtension; } }); | ||
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; } }); | ||
Object.defineProperty(exports, "setupTxExtension", { enumerable: true, get: function () { return queries_1.setupTxExtension; } }); | ||
var queryclient_1 = require("./queryclient"); | ||
Object.defineProperty(exports, "createPagination", { enumerable: true, get: function () { return queryclient_1.createPagination; } }); | ||
Object.defineProperty(exports, "createProtobufRpcClient", { enumerable: true, get: function () { return queryclient_1.createProtobufRpcClient; } }); | ||
Object.defineProperty(exports, "decodeCosmosSdkDecFromProto", { enumerable: true, get: function () { return queryclient_1.decodeCosmosSdkDecFromProto; } }); | ||
Object.defineProperty(exports, "QueryClient", { enumerable: true, get: function () { return queryclient_1.QueryClient; } }); | ||
var search_1 = require("./search"); | ||
@@ -77,0 +84,0 @@ Object.defineProperty(exports, "isSearchByHeightQuery", { enumerable: true, get: function () { return search_1.isSearchByHeightQuery; } }); |
@@ -13,59 +13,23 @@ "use strict"; | ||
const utils_1 = require("@cosmjs/utils"); | ||
const tx_1 = require("cosmjs-types/cosmos/authz/v1beta1/tx"); | ||
const tx_2 = require("cosmjs-types/cosmos/bank/v1beta1/tx"); | ||
const coin_1 = require("cosmjs-types/cosmos/base/v1beta1/coin"); | ||
const tx_3 = require("cosmjs-types/cosmos/distribution/v1beta1/tx"); | ||
const tx_4 = require("cosmjs-types/cosmos/feegrant/v1beta1/tx"); | ||
const tx_5 = require("cosmjs-types/cosmos/gov/v1beta1/tx"); | ||
const tx_6 = require("cosmjs-types/cosmos/staking/v1beta1/tx"); | ||
const tx_1 = require("cosmjs-types/cosmos/distribution/v1beta1/tx"); | ||
const tx_2 = require("cosmjs-types/cosmos/staking/v1beta1/tx"); | ||
const signing_1 = require("cosmjs-types/cosmos/tx/signing/v1beta1/signing"); | ||
const tx_7 = require("cosmjs-types/cosmos/tx/v1beta1/tx"); | ||
const tx_8 = require("cosmjs-types/ibc/applications/transfer/v1/tx"); | ||
const tx_9 = require("cosmjs-types/ibc/core/channel/v1/tx"); | ||
const tx_10 = require("cosmjs-types/ibc/core/client/v1/tx"); | ||
const tx_11 = require("cosmjs-types/ibc/core/connection/v1/tx"); | ||
const tx_3 = require("cosmjs-types/cosmos/tx/v1beta1/tx"); | ||
const tx_4 = require("cosmjs-types/ibc/applications/transfer/v1/tx"); | ||
const long_1 = __importDefault(require("long")); | ||
const aminotypes_1 = require("./aminotypes"); | ||
const fee_1 = require("./fee"); | ||
const modules_1 = require("./modules"); | ||
const modules_2 = require("./modules"); | ||
const stargateclient_1 = require("./stargateclient"); | ||
exports.defaultRegistryTypes = [ | ||
["/cosmos.authz.v1beta1.MsgExec", tx_1.MsgExec], | ||
["/cosmos.authz.v1beta1.MsgGrant", tx_1.MsgGrant], | ||
["/cosmos.authz.v1beta1.MsgRevoke", tx_1.MsgRevoke], | ||
["/cosmos.bank.v1beta1.MsgMultiSend", tx_2.MsgMultiSend], | ||
["/cosmos.bank.v1beta1.MsgSend", tx_2.MsgSend], | ||
["/cosmos.base.v1beta1.Coin", coin_1.Coin], | ||
["/cosmos.distribution.v1beta1.MsgFundCommunityPool", tx_3.MsgFundCommunityPool], | ||
["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", tx_3.MsgSetWithdrawAddress], | ||
["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", tx_3.MsgWithdrawDelegatorReward], | ||
["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", tx_3.MsgWithdrawValidatorCommission], | ||
["/cosmos.feegrant.v1beta1.MsgGrantAllowance", tx_4.MsgGrantAllowance], | ||
["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", tx_4.MsgRevokeAllowance], | ||
["/cosmos.gov.v1beta1.MsgDeposit", tx_5.MsgDeposit], | ||
["/cosmos.gov.v1beta1.MsgSubmitProposal", tx_5.MsgSubmitProposal], | ||
["/cosmos.gov.v1beta1.MsgVote", tx_5.MsgVote], | ||
["/cosmos.staking.v1beta1.MsgBeginRedelegate", tx_6.MsgBeginRedelegate], | ||
["/cosmos.staking.v1beta1.MsgCreateValidator", tx_6.MsgCreateValidator], | ||
["/cosmos.staking.v1beta1.MsgDelegate", tx_6.MsgDelegate], | ||
["/cosmos.staking.v1beta1.MsgEditValidator", tx_6.MsgEditValidator], | ||
["/cosmos.staking.v1beta1.MsgUndelegate", tx_6.MsgUndelegate], | ||
["/ibc.applications.transfer.v1.MsgTransfer", tx_8.MsgTransfer], | ||
["/ibc.core.channel.v1.MsgAcknowledgement", tx_9.MsgAcknowledgement], | ||
["/ibc.core.channel.v1.MsgChannelCloseConfirm", tx_9.MsgChannelCloseConfirm], | ||
["/ibc.core.channel.v1.MsgChannelCloseInit", tx_9.MsgChannelCloseInit], | ||
["/ibc.core.channel.v1.MsgChannelOpenAck", tx_9.MsgChannelOpenAck], | ||
["/ibc.core.channel.v1.MsgChannelOpenConfirm", tx_9.MsgChannelOpenConfirm], | ||
["/ibc.core.channel.v1.MsgChannelOpenInit", tx_9.MsgChannelOpenInit], | ||
["/ibc.core.channel.v1.MsgChannelOpenTry", tx_9.MsgChannelOpenTry], | ||
["/ibc.core.channel.v1.MsgRecvPacket", tx_9.MsgRecvPacket], | ||
["/ibc.core.channel.v1.MsgTimeout", tx_9.MsgTimeout], | ||
["/ibc.core.channel.v1.MsgTimeoutOnClose", tx_9.MsgTimeoutOnClose], | ||
["/ibc.core.client.v1.MsgCreateClient", tx_10.MsgCreateClient], | ||
["/ibc.core.client.v1.MsgSubmitMisbehaviour", tx_10.MsgSubmitMisbehaviour], | ||
["/ibc.core.client.v1.MsgUpdateClient", tx_10.MsgUpdateClient], | ||
["/ibc.core.client.v1.MsgUpgradeClient", tx_10.MsgUpgradeClient], | ||
["/ibc.core.connection.v1.MsgConnectionOpenAck", tx_11.MsgConnectionOpenAck], | ||
["/ibc.core.connection.v1.MsgConnectionOpenConfirm", tx_11.MsgConnectionOpenConfirm], | ||
["/ibc.core.connection.v1.MsgConnectionOpenInit", tx_11.MsgConnectionOpenInit], | ||
["/ibc.core.connection.v1.MsgConnectionOpenTry", tx_11.MsgConnectionOpenTry], | ||
...modules_1.authzTypes, | ||
...modules_1.bankTypes, | ||
...modules_1.distributionTypes, | ||
...modules_1.feegrantTypes, | ||
...modules_1.govTypes, | ||
...modules_1.stakingTypes, | ||
...modules_1.ibcTypes, | ||
]; | ||
@@ -75,2 +39,13 @@ function createDefaultRegistry() { | ||
} | ||
function createDefaultTypes(prefix) { | ||
return { | ||
...(0, modules_2.createAuthzAminoConverters)(), | ||
...(0, modules_2.createBankAminoConverters)(), | ||
...(0, modules_2.createDistributionAminoConverters)(), | ||
...(0, modules_2.createGovAminoConverters)(), | ||
...(0, modules_2.createStakingAminoConverters)(prefix), | ||
...(0, modules_2.createIbcAminoConverters)(), | ||
...(0, modules_2.createFreegrantAminoConverters)(), | ||
}; | ||
} | ||
class SigningStargateClient extends stargateclient_1.StargateClient { | ||
@@ -82,3 +57,3 @@ constructor(tmClient, signer, options) { | ||
const prefix = (_a = options.prefix) !== null && _a !== void 0 ? _a : "cosmos"; | ||
const { registry = createDefaultRegistry(), aminoTypes = new aminotypes_1.AminoTypes({ prefix }) } = options; | ||
const { registry = createDefaultRegistry(), aminoTypes = new aminotypes_1.AminoTypes(createDefaultTypes(prefix)) } = options; | ||
this.registry = registry; | ||
@@ -133,3 +108,3 @@ this.aminoTypes = aminoTypes; | ||
typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", | ||
value: tx_6.MsgDelegate.fromPartial({ | ||
value: tx_2.MsgDelegate.fromPartial({ | ||
delegatorAddress: delegatorAddress, | ||
@@ -145,3 +120,3 @@ validatorAddress: validatorAddress, | ||
typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", | ||
value: tx_6.MsgUndelegate.fromPartial({ | ||
value: tx_2.MsgUndelegate.fromPartial({ | ||
delegatorAddress: delegatorAddress, | ||
@@ -157,3 +132,3 @@ validatorAddress: validatorAddress, | ||
typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", | ||
value: tx_3.MsgWithdrawDelegatorReward.fromPartial({ | ||
value: tx_1.MsgWithdrawDelegatorReward.fromPartial({ | ||
delegatorAddress: delegatorAddress, | ||
@@ -173,3 +148,3 @@ validatorAddress: validatorAddress, | ||
typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", | ||
value: tx_8.MsgTransfer.fromPartial({ | ||
value: tx_4.MsgTransfer.fromPartial({ | ||
sourcePort: sourcePort, | ||
@@ -198,3 +173,3 @@ sourceChannel: sourceChannel, | ||
const txRaw = await this.sign(signerAddress, messages, usedFee, memo); | ||
const txBytes = tx_7.TxRaw.encode(txRaw).finish(); | ||
const txBytes = tx_3.TxRaw.encode(txRaw).finish(); | ||
return this.broadcastTx(txBytes, this.broadcastTimeoutMs, this.broadcastPollIntervalMs); | ||
@@ -253,3 +228,3 @@ } | ||
const signedAuthInfoBytes = (0, proto_signing_1.makeAuthInfoBytes)([{ pubkey, sequence: signedSequence }], signed.fee.amount, signedGasLimit, signMode); | ||
return tx_7.TxRaw.fromPartial({ | ||
return tx_3.TxRaw.fromPartial({ | ||
bodyBytes: signedTxBodyBytes, | ||
@@ -279,3 +254,3 @@ authInfoBytes: signedAuthInfoBytes, | ||
const { signature, signed } = await this.signer.signDirect(signerAddress, signDoc); | ||
return tx_7.TxRaw.fromPartial({ | ||
return tx_3.TxRaw.fromPartial({ | ||
bodyBytes: signed.bodyBytes, | ||
@@ -282,0 +257,0 @@ authInfoBytes: signed.authInfoBytes, |
@@ -341,25 +341,22 @@ "use strict"; | ||
const customAminoTypes = new aminotypes_1.AminoTypes({ | ||
prefix: "cosmos", | ||
additions: { | ||
"/cosmos.staking.v1beta1.MsgDelegate": { | ||
aminoType: "cosmos-sdk/MsgDelegate", | ||
toAmino: ({ customDelegatorAddress, customValidatorAddress, customAmount, }) => { | ||
(0, utils_1.assert)(customDelegatorAddress, "missing customDelegatorAddress"); | ||
(0, utils_1.assert)(customValidatorAddress, "missing validatorAddress"); | ||
(0, utils_1.assert)(customAmount, "missing amount"); | ||
return { | ||
delegator_address: customDelegatorAddress, | ||
validator_address: customValidatorAddress, | ||
amount: { | ||
amount: customAmount.amount, | ||
denom: customAmount.denom, | ||
}, | ||
}; | ||
}, | ||
fromAmino: ({ delegator_address, validator_address, amount, }) => ({ | ||
customDelegatorAddress: delegator_address, | ||
customValidatorAddress: validator_address, | ||
customAmount: coin_1.Coin.fromPartial(amount), | ||
}), | ||
"/cosmos.staking.v1beta1.MsgDelegate": { | ||
aminoType: "cosmos-sdk/MsgDelegate", | ||
toAmino: ({ customDelegatorAddress, customValidatorAddress, customAmount, }) => { | ||
(0, utils_1.assert)(customDelegatorAddress, "missing customDelegatorAddress"); | ||
(0, utils_1.assert)(customValidatorAddress, "missing validatorAddress"); | ||
(0, utils_1.assert)(customAmount, "missing amount"); | ||
return { | ||
delegator_address: customDelegatorAddress, | ||
validator_address: customValidatorAddress, | ||
amount: { | ||
amount: customAmount.amount, | ||
denom: customAmount.denom, | ||
}, | ||
}; | ||
}, | ||
fromAmino: ({ delegator_address, validator_address, amount, }) => ({ | ||
customDelegatorAddress: delegator_address, | ||
customValidatorAddress: validator_address, | ||
customAmount: coin_1.Coin.fromPartial(amount), | ||
}), | ||
}, | ||
@@ -577,25 +574,22 @@ }); | ||
const customAminoTypes = new aminotypes_1.AminoTypes({ | ||
prefix: "cosmos", | ||
additions: { | ||
"/cosmos.staking.v1beta1.MsgDelegate": { | ||
aminoType: "cosmos-sdk/MsgDelegate", | ||
toAmino: ({ customDelegatorAddress, customValidatorAddress, customAmount, }) => { | ||
(0, utils_1.assert)(customDelegatorAddress, "missing customDelegatorAddress"); | ||
(0, utils_1.assert)(customValidatorAddress, "missing validatorAddress"); | ||
(0, utils_1.assert)(customAmount, "missing amount"); | ||
return { | ||
delegator_address: customDelegatorAddress, | ||
validator_address: customValidatorAddress, | ||
amount: { | ||
amount: customAmount.amount, | ||
denom: customAmount.denom, | ||
}, | ||
}; | ||
}, | ||
fromAmino: ({ delegator_address, validator_address, amount, }) => ({ | ||
customDelegatorAddress: delegator_address, | ||
customValidatorAddress: validator_address, | ||
customAmount: coin_1.Coin.fromPartial(amount), | ||
}), | ||
"/cosmos.staking.v1beta1.MsgDelegate": { | ||
aminoType: "cosmos-sdk/MsgDelegate", | ||
toAmino: ({ customDelegatorAddress, customValidatorAddress, customAmount, }) => { | ||
(0, utils_1.assert)(customDelegatorAddress, "missing customDelegatorAddress"); | ||
(0, utils_1.assert)(customValidatorAddress, "missing validatorAddress"); | ||
(0, utils_1.assert)(customAmount, "missing amount"); | ||
return { | ||
delegator_address: customDelegatorAddress, | ||
validator_address: customValidatorAddress, | ||
amount: { | ||
amount: customAmount.amount, | ||
denom: customAmount.denom, | ||
}, | ||
}; | ||
}, | ||
fromAmino: ({ delegator_address, validator_address, amount, }) => ({ | ||
customDelegatorAddress: delegator_address, | ||
customValidatorAddress: validator_address, | ||
customAmount: coin_1.Coin.fromPartial(amount), | ||
}), | ||
}, | ||
@@ -602,0 +596,0 @@ }); |
@@ -5,3 +5,4 @@ import { Tendermint34Client } from "@cosmjs/tendermint-rpc"; | ||
import { Account } from "./accounts"; | ||
import { AuthExtension, BankExtension, QueryClient, StakingExtension, TxExtension } from "./queries"; | ||
import { AuthExtension, BankExtension, StakingExtension, TxExtension } from "./modules"; | ||
import { QueryClient } from "./queryclient"; | ||
import { SearchTxFilter, SearchTxQuery } from "./search"; | ||
@@ -8,0 +9,0 @@ export declare class TimeoutError extends Error { |
@@ -10,3 +10,4 @@ "use strict"; | ||
const accounts_1 = require("./accounts"); | ||
const queries_1 = require("./queries"); | ||
const modules_1 = require("./modules"); | ||
const queryclient_1 = require("./queryclient"); | ||
const search_1 = require("./search"); | ||
@@ -50,3 +51,3 @@ class TimeoutError extends Error { | ||
this.tmClient = tmClient; | ||
this.queryClient = queries_1.QueryClient.withExtensions(tmClient, queries_1.setupAuthExtension, queries_1.setupBankExtension, queries_1.setupStakingExtension, queries_1.setupTxExtension); | ||
this.queryClient = queryclient_1.QueryClient.withExtensions(tmClient, modules_1.setupAuthExtension, modules_1.setupBankExtension, modules_1.setupStakingExtension, modules_1.setupTxExtension); | ||
} | ||
@@ -215,3 +216,3 @@ } | ||
if (timedOut) { | ||
throw new TimeoutError(`Transaction with ID ${txId} was submitted but was not yet found on the chain. You might want to check later.`, txId); | ||
throw new TimeoutError(`Transaction with ID ${txId} was submitted but was not yet found on the chain. You might want to check later. There was a wait of ${timeoutMs / 10000} seconds.`, txId); | ||
} | ||
@@ -218,0 +219,0 @@ await (0, utils_1.sleep)(pollIntervalMs); |
@@ -7,3 +7,3 @@ "use strict"; | ||
const tx_1 = require("cosmjs-types/cosmos/tx/v1beta1/tx"); | ||
const encodeobjects_1 = require("./encodeobjects"); | ||
const modules_1 = require("./modules"); | ||
const stargateclient_1 = require("./stargateclient"); | ||
@@ -163,3 +163,3 @@ const testutils_spec_1 = require("./testutils.spec"); | ||
const filteredMsgs = tx.body.messages.filter((msg) => { | ||
if (!(0, encodeobjects_1.isMsgSendEncodeObject)(msg)) | ||
if (!(0, modules_1.isMsgSendEncodeObject)(msg)) | ||
return false; | ||
@@ -188,3 +188,3 @@ const decoded = registry.decode(msg); | ||
const filteredMsgs = tx.body.messages.filter((msg) => { | ||
if (!(0, encodeobjects_1.isMsgSendEncodeObject)(msg)) | ||
if (!(0, modules_1.isMsgSendEncodeObject)(msg)) | ||
return false; | ||
@@ -191,0 +191,0 @@ const decoded = registry.decode(msg); |
@@ -9,2 +9,3 @@ import { AminoSignResponse, Secp256k1HdWallet, Secp256k1HdWalletOptions, StdSignDoc } from "@cosmjs/amino"; | ||
export declare function simappEnabled(): boolean; | ||
export declare function pendingWithoutSimapp44(): void; | ||
export declare function pendingWithoutSimapp42(): void; | ||
@@ -11,0 +12,0 @@ export declare function pendingWithoutSimapp(): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ModifyingDirectSecp256k1HdWallet = exports.ModifyingSecp256k1HdWallet = exports.tendermintIdMatcher = exports.nonNegativeIntegerMatcher = exports.nonExistentAddress = exports.validator = exports.unused = exports.faucet = exports.defaultSigningClientOptions = exports.slowSimapp = exports.simapp = exports.defaultSendFee = exports.defaultGasPrice = exports.fromOneElementArray = exports.makeRandomAddress = exports.makeRandomAddressBytes = exports.pendingWithoutSlowSimapp = exports.slowSimappEnabled = exports.pendingWithoutSimapp = exports.pendingWithoutSimapp42 = exports.simappEnabled = exports.simapp44Enabled = exports.simapp42Enabled = void 0; | ||
exports.ModifyingDirectSecp256k1HdWallet = exports.ModifyingSecp256k1HdWallet = exports.tendermintIdMatcher = exports.nonNegativeIntegerMatcher = exports.nonExistentAddress = exports.validator = exports.unused = exports.faucet = exports.defaultSigningClientOptions = exports.slowSimapp = exports.simapp = exports.defaultSendFee = exports.defaultGasPrice = exports.fromOneElementArray = exports.makeRandomAddress = exports.makeRandomAddressBytes = exports.pendingWithoutSlowSimapp = exports.slowSimappEnabled = exports.pendingWithoutSimapp = exports.pendingWithoutSimapp42 = exports.pendingWithoutSimapp44 = exports.simappEnabled = exports.simapp44Enabled = exports.simapp42Enabled = void 0; | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
@@ -24,5 +24,11 @@ const amino_1 = require("@cosmjs/amino"); | ||
exports.simappEnabled = simappEnabled; | ||
function pendingWithoutSimapp44() { | ||
if (!simapp44Enabled()) { | ||
return pending("Set SIMAPP44_ENABLED to enable Simapp based tests"); | ||
} | ||
} | ||
exports.pendingWithoutSimapp44 = pendingWithoutSimapp44; | ||
function pendingWithoutSimapp42() { | ||
if (!simapp42Enabled()) { | ||
return pending("Set SIMAPP44_ENABLED to enable Simapp based tests"); | ||
return pending("Set SIMAPP42_ENABLED to enable Simapp based tests"); | ||
} | ||
@@ -29,0 +35,0 @@ } |
{ | ||
"name": "@cosmjs/stargate", | ||
"version": "0.28.0-rc1", | ||
"version": "0.28.0-rc2", | ||
"description": "Utilities for Cosmos SDK 0.40", | ||
@@ -42,9 +42,9 @@ "contributors": [ | ||
"@confio/ics23": "^0.6.8", | ||
"@cosmjs/amino": "0.28.0-rc1", | ||
"@cosmjs/encoding": "0.28.0-rc1", | ||
"@cosmjs/math": "0.28.0-rc1", | ||
"@cosmjs/proto-signing": "0.28.0-rc1", | ||
"@cosmjs/stream": "0.28.0-rc1", | ||
"@cosmjs/tendermint-rpc": "0.28.0-rc1", | ||
"@cosmjs/utils": "0.28.0-rc1", | ||
"@cosmjs/amino": "0.28.0-rc2", | ||
"@cosmjs/encoding": "0.28.0-rc2", | ||
"@cosmjs/math": "0.28.0-rc2", | ||
"@cosmjs/proto-signing": "0.28.0-rc2", | ||
"@cosmjs/stream": "0.28.0-rc2", | ||
"@cosmjs/tendermint-rpc": "0.28.0-rc2", | ||
"@cosmjs/utils": "0.28.0-rc2", | ||
"cosmjs-types": "^0.4.0", | ||
@@ -56,3 +56,3 @@ "long": "^4.0.0", | ||
"devDependencies": { | ||
"@cosmjs/crypto": "0.28.0-rc1", | ||
"@cosmjs/crypto": "0.28.0-rc2", | ||
"@istanbuljs/nyc-config-typescript": "^1.0.1", | ||
@@ -66,4 +66,4 @@ "@types/eslint-plugin-prettier": "^3", | ||
"@types/node": "^15.0.1", | ||
"@typescript-eslint/eslint-plugin": "^4.28", | ||
"@typescript-eslint/parser": "^4.28", | ||
"@typescript-eslint/eslint-plugin": "^5.13.0", | ||
"@typescript-eslint/parser": "^5.13.0", | ||
"eslint": "^7.5", | ||
@@ -70,0 +70,0 @@ "eslint-config-prettier": "^8.3.0", |
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
726805
201
8669
1
+ Added@cosmjs/amino@0.28.0-rc2(transitive)
+ Added@cosmjs/crypto@0.28.0-rc2(transitive)
+ Added@cosmjs/encoding@0.28.0-rc2(transitive)
+ Added@cosmjs/json-rpc@0.28.0-rc2(transitive)
+ Added@cosmjs/math@0.28.0-rc2(transitive)
+ Added@cosmjs/proto-signing@0.28.0-rc2(transitive)
+ Added@cosmjs/socket@0.28.0-rc2(transitive)
+ Added@cosmjs/stream@0.28.0-rc2(transitive)
+ Added@cosmjs/tendermint-rpc@0.28.0-rc2(transitive)
+ Added@cosmjs/utils@0.28.0-rc2(transitive)
- Removed@cosmjs/amino@0.28.0-rc1(transitive)
- Removed@cosmjs/crypto@0.28.0-rc1(transitive)
- Removed@cosmjs/encoding@0.28.0-rc1(transitive)
- Removed@cosmjs/json-rpc@0.28.0-rc1(transitive)
- Removed@cosmjs/math@0.28.0-rc1(transitive)
- Removed@cosmjs/proto-signing@0.28.0-rc1(transitive)
- Removed@cosmjs/socket@0.28.0-rc1(transitive)
- Removed@cosmjs/stream@0.28.0-rc1(transitive)
- Removed@cosmjs/tendermint-rpc@0.28.0-rc1(transitive)
- Removed@cosmjs/utils@0.28.0-rc1(transitive)
Updated@cosmjs/amino@0.28.0-rc2
Updated@cosmjs/encoding@0.28.0-rc2
Updated@cosmjs/math@0.28.0-rc2
Updated@cosmjs/stream@0.28.0-rc2
Updated@cosmjs/utils@0.28.0-rc2