Merge pull request #730 from cosmos/657-independent-stargate-7
Reorganise amino msgs and update cli/scripts/ledger-amino
This commit is contained in:
commit
8621a8fb48
@ -1,5 +1,5 @@
|
||||
import { makeCosmoshubPath, Secp256k1HdWallet } from "@cosmjs/amino";
|
||||
import { toBase64 } from "@cosmjs/encoding";
|
||||
import { makeCosmoshubPath, Secp256k1HdWallet } from "@cosmjs/launchpad";
|
||||
|
||||
const mnemonic =
|
||||
"economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { encodeSecp256k1Pubkey, Secp256k1HdWallet } from "@cosmjs/amino";
|
||||
import { Bip39, Random } from "@cosmjs/crypto";
|
||||
import { encodeSecp256k1Pubkey, Secp256k1HdWallet } from "@cosmjs/launchpad";
|
||||
|
||||
const mnemonic = Bip39.encode(Random.getBytes(16)).toString();
|
||||
const wallet = await Secp256k1HdWallet.fromMnemonic(mnemonic);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Coin } from "@cosmjs/amino";
|
||||
import { toBase64, toUtf8 } from "@cosmjs/encoding";
|
||||
import { Coin } from "@cosmjs/launchpad";
|
||||
|
||||
// types auto-generated by wasm.glass and cleaned up manually
|
||||
export type HandleMsg =
|
||||
@ -36,8 +36,7 @@ export type HandleMsg =
|
||||
};
|
||||
};
|
||||
|
||||
export interface InitMsg {
|
||||
}
|
||||
export interface InitMsg {}
|
||||
|
||||
export interface OwnerResponse {
|
||||
owner: string;
|
||||
@ -62,9 +61,9 @@ const sendMsg = (from_address: string, to_address: string, amount: Coin[]) => {
|
||||
from_address,
|
||||
to_address,
|
||||
amount,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const contractMsg = (contract_addr: string, msg: object, amount?: Coin[]) => {
|
||||
return {
|
||||
@ -72,14 +71,14 @@ const contractMsg = (contract_addr: string, msg: object, amount?: Coin[]) => {
|
||||
contract_addr,
|
||||
msg: base64Msg(msg),
|
||||
send: amount || null,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const opaqueMsg = (data: object) => {
|
||||
return {
|
||||
opaque: {
|
||||
data: base64Msg(data),
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@ -86,7 +86,7 @@ export async function main(originalArgs: readonly string[]): Promise<void> {
|
||||
Secp256k1HdWallet,
|
||||
Secp256k1Wallet,
|
||||
StdFee,
|
||||
} from "@cosmjs/launchpad";
|
||||
} from "@cosmjs/amino";
|
||||
import { Decimal } from "@cosmjs/math";
|
||||
import { assert, arrayContentEquals, sleep } from "@cosmjs/utils";
|
||||
|
||||
|
||||
@ -46,7 +46,6 @@
|
||||
"@cosmjs/cosmwasm-launchpad": "^0.25.0-alpha.1",
|
||||
"@cosmjs/crypto": "^0.25.0-alpha.1",
|
||||
"@cosmjs/encoding": "^0.25.0-alpha.1",
|
||||
"@cosmjs/launchpad": "^0.25.0-alpha.1",
|
||||
"@cosmjs/math": "^0.25.0-alpha.1",
|
||||
"@cosmjs/proto-signing": "^0.25.0-alpha.1",
|
||||
"@cosmjs/stargate": "^0.25.0-alpha.1",
|
||||
|
||||
@ -3,9 +3,15 @@ import { Secp256k1HdWallet } from "@cosmjs/amino";
|
||||
import { UploadMeta } from "@cosmjs/cosmwasm-launchpad";
|
||||
import { sha256 } from "@cosmjs/crypto";
|
||||
import { toHex } from "@cosmjs/encoding";
|
||||
import { MsgDelegate as LaunchpadMsgDelegate } from "@cosmjs/launchpad";
|
||||
import { DirectSecp256k1HdWallet, Registry } from "@cosmjs/proto-signing";
|
||||
import { AminoTypes, assertIsBroadcastTxSuccess, coin, coins, GasPrice } from "@cosmjs/stargate";
|
||||
import {
|
||||
AminoMsgDelegate,
|
||||
AminoTypes,
|
||||
assertIsBroadcastTxSuccess,
|
||||
coin,
|
||||
coins,
|
||||
GasPrice,
|
||||
} from "@cosmjs/stargate";
|
||||
import { DeepPartial, MsgSend } from "@cosmjs/stargate/build/codec/cosmos/bank/v1beta1/tx";
|
||||
import { Coin } from "@cosmjs/stargate/build/codec/cosmos/base/v1beta1/coin";
|
||||
import { MsgDelegate } from "@cosmjs/stargate/build/codec/cosmos/staking/v1beta1/tx";
|
||||
@ -712,7 +718,7 @@ describe("SigningCosmWasmClient", () => {
|
||||
customDelegatorAddress,
|
||||
customValidatorAddress,
|
||||
customAmount,
|
||||
}: CustomMsgDelegate): LaunchpadMsgDelegate["value"] => {
|
||||
}: CustomMsgDelegate): AminoMsgDelegate["value"] => {
|
||||
assert(customDelegatorAddress, "missing customDelegatorAddress");
|
||||
assert(customValidatorAddress, "missing validatorAddress");
|
||||
assert(customAmount, "missing amount");
|
||||
@ -731,7 +737,7 @@ describe("SigningCosmWasmClient", () => {
|
||||
delegator_address,
|
||||
validator_address,
|
||||
amount,
|
||||
}: LaunchpadMsgDelegate["value"]): CustomMsgDelegate => ({
|
||||
}: AminoMsgDelegate["value"]): CustomMsgDelegate => ({
|
||||
customDelegatorAddress: delegator_address,
|
||||
customValidatorAddress: validator_address,
|
||||
customAmount: Coin.fromPartial(amount),
|
||||
|
||||
@ -37,12 +37,13 @@
|
||||
"pack-web": "yarn build-or-skip && webpack --mode development --config webpack.demo.config.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cosmjs/launchpad": "^0.25.0-alpha.1",
|
||||
"@cosmjs/amino": "^0.25.0-alpha.1",
|
||||
"@cosmjs/utils": "^0.25.0-alpha.1",
|
||||
"ledger-cosmos-js": "^2.1.8",
|
||||
"semver": "^7.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cosmjs/launchpad": "^0.25.0-alpha.1",
|
||||
"@cosmjs/stargate": "^0.25.0-alpha.1",
|
||||
"@ledgerhq/hw-transport": "^5.25.0",
|
||||
"@ledgerhq/hw-transport-node-hid": "^5.25.0",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { makeCosmoshubPath, makeSignDoc, StdFee, StdSignature } from "@cosmjs/amino";
|
||||
import { toBase64 } from "@cosmjs/encoding";
|
||||
import { makeCosmoshubPath, makeSignDoc, StdFee, StdSignature } from "@cosmjs/launchpad";
|
||||
import TransportNodeHid from "@ledgerhq/hw-transport-node-hid";
|
||||
|
||||
import { LedgerSigner } from "../ledgersigner";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { AccountData, makeCosmoshubPath, StdSignDoc } from "@cosmjs/amino";
|
||||
import { toBase64 } from "@cosmjs/encoding";
|
||||
import { AccountData, makeCosmoshubPath, StdSignDoc } from "@cosmjs/launchpad";
|
||||
import { Uint53 } from "@cosmjs/math";
|
||||
import { assert } from "@cosmjs/utils";
|
||||
import TransportWebUSB from "@ledgerhq/hw-transport-webusb";
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { makeCosmoshubPath } from "@cosmjs/amino";
|
||||
import { HdPath, Secp256k1Signature } from "@cosmjs/crypto";
|
||||
import { fromUtf8 } from "@cosmjs/encoding";
|
||||
import { makeCosmoshubPath } from "@cosmjs/launchpad";
|
||||
import { assert } from "@cosmjs/utils";
|
||||
import Transport from "@ledgerhq/hw-transport";
|
||||
import CosmosApp, {
|
||||
|
||||
@ -1,16 +1,18 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import {
|
||||
AminoMsg,
|
||||
coins,
|
||||
makeCosmoshubPath,
|
||||
makeSignDoc,
|
||||
Secp256k1HdWallet,
|
||||
serializeSignDoc,
|
||||
StdFee,
|
||||
} from "@cosmjs/amino";
|
||||
import { Secp256k1, Secp256k1Signature, sha256 } from "@cosmjs/crypto";
|
||||
import { fromBase64 } from "@cosmjs/encoding";
|
||||
import {
|
||||
assertIsBroadcastTxSuccess as assertIsBroadcastTxSuccessLaunchpad,
|
||||
coins,
|
||||
makeCosmoshubPath,
|
||||
makeSignDoc,
|
||||
Msg,
|
||||
Secp256k1HdWallet,
|
||||
serializeSignDoc,
|
||||
SigningCosmosClient,
|
||||
StdFee,
|
||||
} from "@cosmjs/launchpad";
|
||||
import {
|
||||
assertIsBroadcastTxSuccess as assertIsBroadcastTxSuccessStargate,
|
||||
@ -131,7 +133,7 @@ describe("LedgerSigner", () => {
|
||||
|
||||
const [firstAccount] = await signer.getAccounts();
|
||||
|
||||
const msgs: readonly Msg[] = [
|
||||
const msgs: readonly AminoMsg[] = [
|
||||
{
|
||||
type: "cosmos-sdk/MsgSend",
|
||||
value: {
|
||||
|
||||
@ -1,17 +1,18 @@
|
||||
import { HdPath } from "@cosmjs/crypto";
|
||||
import {
|
||||
AccountData,
|
||||
AminoSignResponse,
|
||||
encodeSecp256k1Signature,
|
||||
makeCosmoshubPath,
|
||||
OfflineSigner,
|
||||
OfflineAminoSigner,
|
||||
serializeSignDoc,
|
||||
StdSignDoc,
|
||||
} from "@cosmjs/launchpad";
|
||||
import { AminoSignResponse, serializeSignDoc } from "@cosmjs/launchpad";
|
||||
} from "@cosmjs/amino";
|
||||
import { HdPath } from "@cosmjs/crypto";
|
||||
import Transport from "@ledgerhq/hw-transport";
|
||||
|
||||
import { LaunchpadLedger, LaunchpadLedgerOptions } from "./launchpadledger";
|
||||
|
||||
export class LedgerSigner implements OfflineSigner {
|
||||
export class LedgerSigner implements OfflineAminoSigner {
|
||||
private readonly ledger: LaunchpadLedger;
|
||||
private readonly hdPaths: readonly HdPath[];
|
||||
private accounts?: readonly AccountData[];
|
||||
|
||||
@ -45,7 +45,6 @@
|
||||
"@confio/ics23": "^0.6.3",
|
||||
"@cosmjs/amino": "^0.25.0-alpha.1",
|
||||
"@cosmjs/encoding": "^0.25.0-alpha.1",
|
||||
"@cosmjs/launchpad": "^0.25.0-alpha.1",
|
||||
"@cosmjs/math": "^0.25.0-alpha.1",
|
||||
"@cosmjs/proto-signing": "^0.25.0-alpha.1",
|
||||
"@cosmjs/stream": "^0.25.0-alpha.1",
|
||||
|
||||
337
packages/stargate/src/aminomsgs.ts
Normal file
337
packages/stargate/src/aminomsgs.ts
Normal file
@ -0,0 +1,337 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { AminoMsg, Coin } from "@cosmjs/amino";
|
||||
|
||||
// auth (no messages) - see https://github.com/cosmos/cosmos-sdk/blob/efa73c7/proto/cosmos/auth/auth.proto
|
||||
|
||||
// bank - see https://github.com/cosmos/cosmos-sdk/blob/efa73c7/proto/cosmos/bank/bank.proto
|
||||
|
||||
/** A high level transaction of the coin module */
|
||||
export interface AminoMsgSend extends AminoMsg {
|
||||
readonly type: "cosmos-sdk/MsgSend";
|
||||
readonly value: {
|
||||
/** Bech32 account address */
|
||||
readonly from_address: string;
|
||||
/** Bech32 account address */
|
||||
readonly to_address: string;
|
||||
readonly amount: readonly Coin[];
|
||||
};
|
||||
}
|
||||
|
||||
export function isAminoMsgSend(msg: AminoMsg): msg is AminoMsgSend {
|
||||
return (msg as AminoMsgSend).type === "cosmos-sdk/MsgSend";
|
||||
}
|
||||
|
||||
interface Input {
|
||||
/** Bech32 account address */
|
||||
readonly address: string;
|
||||
readonly coins: readonly Coin[];
|
||||
}
|
||||
|
||||
interface Output {
|
||||
/** Bech32 account address */
|
||||
readonly address: string;
|
||||
readonly coins: readonly Coin[];
|
||||
}
|
||||
|
||||
/** A high level transaction of the coin module */
|
||||
export interface AminoMsgMultiSend extends AminoMsg {
|
||||
readonly type: "cosmos-sdk/MsgMultiSend";
|
||||
readonly value: {
|
||||
readonly inputs: readonly Input[];
|
||||
readonly outputs: readonly Output[];
|
||||
};
|
||||
}
|
||||
|
||||
export function isAminoMsgMultiSend(msg: AminoMsg): msg is AminoMsgMultiSend {
|
||||
return (msg as AminoMsgMultiSend).type === "cosmos-sdk/MsgMultiSend";
|
||||
}
|
||||
|
||||
// crisis - see https://github.com/cosmos/cosmos-sdk/blob/efa73c7/proto/cosmos/crisis/crisis.proto
|
||||
|
||||
/** Verifies a particular invariance */
|
||||
export interface AminoMsgVerifyInvariant extends AminoMsg {
|
||||
readonly type: "cosmos-sdk/MsgVerifyInvariant";
|
||||
readonly value: {
|
||||
/** Bech32 account address */
|
||||
readonly sender: string;
|
||||
readonly invariant_module_name: string;
|
||||
readonly invariant_route: string;
|
||||
};
|
||||
}
|
||||
|
||||
export function isAminoMsgVerifyInvariant(msg: AminoMsg): msg is AminoMsgVerifyInvariant {
|
||||
return (msg as AminoMsgVerifyInvariant).type === "cosmos-sdk/MsgVerifyInvariant";
|
||||
}
|
||||
|
||||
// distribution - see https://github.com/cosmos/cosmos-sdk/blob/efa73c7/proto/cosmos/distribution/distribution.proto
|
||||
|
||||
/** Changes the withdraw address for a delegator (or validator self-delegation) */
|
||||
export interface AminoMsgSetWithdrawAddress extends AminoMsg {
|
||||
// NOTE: Type string and names diverge here!
|
||||
readonly type: "cosmos-sdk/MsgModifyWithdrawAddress";
|
||||
readonly value: {
|
||||
/** Bech32 account address */
|
||||
readonly delegator_address: string;
|
||||
/** Bech32 account address */
|
||||
readonly withdraw_address: string;
|
||||
};
|
||||
}
|
||||
|
||||
export function isAminoMsgSetWithdrawAddress(msg: AminoMsg): msg is AminoMsgSetWithdrawAddress {
|
||||
// NOTE: Type string and names diverge here!
|
||||
return (msg as AminoMsgSetWithdrawAddress).type === "cosmos-sdk/MsgModifyWithdrawAddress";
|
||||
}
|
||||
|
||||
/** Message for delegation withdraw from a single validator */
|
||||
export interface AminoMsgWithdrawDelegatorReward extends AminoMsg {
|
||||
// NOTE: Type string and names diverge here!
|
||||
readonly type: "cosmos-sdk/MsgWithdrawDelegationReward";
|
||||
readonly value: {
|
||||
/** Bech32 account address */
|
||||
readonly delegator_address: string;
|
||||
/** Bech32 account address */
|
||||
readonly validator_address: string;
|
||||
};
|
||||
}
|
||||
|
||||
export function isAminoMsgWithdrawDelegatorReward(msg: AminoMsg): msg is AminoMsgWithdrawDelegatorReward {
|
||||
// NOTE: Type string and names diverge here!
|
||||
return (msg as AminoMsgWithdrawDelegatorReward).type === "cosmos-sdk/MsgWithdrawDelegationReward";
|
||||
}
|
||||
|
||||
/** Message for validator withdraw */
|
||||
export interface AminoMsgWithdrawValidatorCommission extends AminoMsg {
|
||||
readonly type: "cosmos-sdk/MsgWithdrawValidatorCommission";
|
||||
readonly value: {
|
||||
/** Bech32 account address */
|
||||
readonly validator_address: string;
|
||||
};
|
||||
}
|
||||
|
||||
export function isAminoMsgWithdrawValidatorCommission(
|
||||
msg: AminoMsg,
|
||||
): msg is AminoMsgWithdrawValidatorCommission {
|
||||
return (msg as AminoMsgWithdrawValidatorCommission).type === "cosmos-sdk/MsgWithdrawValidatorCommission";
|
||||
}
|
||||
|
||||
/** Allows an account to directly fund the community pool. */
|
||||
export interface AminoMsgFundCommunityPool extends AminoMsg {
|
||||
readonly type: "cosmos-sdk/MsgFundCommunityPool";
|
||||
readonly value: {
|
||||
readonly amount: readonly Coin[];
|
||||
/** Bech32 account address */
|
||||
readonly depositor: string;
|
||||
};
|
||||
}
|
||||
|
||||
export function isAminoMsgFundCommunityPool(msg: AminoMsg): msg is AminoMsgFundCommunityPool {
|
||||
return (msg as AminoMsgFundCommunityPool).type === "cosmos-sdk/MsgFundCommunityPool";
|
||||
}
|
||||
|
||||
// evidence - see https://github.com/cosmos/cosmos-sdk/blob/efa73c7/proto/cosmos/evidence/evidence.proto
|
||||
|
||||
interface Any {
|
||||
readonly type_url: string;
|
||||
readonly value: Uint8Array;
|
||||
}
|
||||
|
||||
/** Supports submitting arbitrary evidence */
|
||||
export interface AminoMsgSubmitEvidence extends AminoMsg {
|
||||
readonly type: "cosmos-sdk/MsgSubmitEvidence";
|
||||
readonly value: {
|
||||
/** Bech32 account address */
|
||||
readonly submitter: string;
|
||||
readonly evidence: Any;
|
||||
};
|
||||
}
|
||||
|
||||
export function isAminoMsgSubmitEvidence(msg: AminoMsg): msg is AminoMsgSubmitEvidence {
|
||||
return (msg as AminoMsgSubmitEvidence).type === "cosmos-sdk/MsgSubmitEvidence";
|
||||
}
|
||||
|
||||
// gov - https://github.com/cosmos/cosmos-sdk/blob/efa73c7edb31a7bd65786501da213b294f89267a/proto/cosmos/gov/gov.proto
|
||||
|
||||
/** Supports submitting arbitrary proposal content. */
|
||||
export interface AminoMsgSubmitProposal extends AminoMsg {
|
||||
readonly type: "cosmos-sdk/MsgSubmitProposal";
|
||||
readonly value: {
|
||||
readonly content: Any;
|
||||
readonly initial_deposit: readonly Coin[];
|
||||
/** Bech32 account address */
|
||||
readonly proposer: string;
|
||||
};
|
||||
}
|
||||
|
||||
export function isAminoMsgSubmitProposal(msg: AminoMsg): msg is AminoMsgSubmitProposal {
|
||||
return (msg as AminoMsgSubmitProposal).type === "cosmos-sdk/MsgSubmitProposal";
|
||||
}
|
||||
|
||||
enum VoteOption {
|
||||
VoteOptionUnspecified,
|
||||
VoteOptionYes,
|
||||
VoteOptionAbstain,
|
||||
VoteOptionNo,
|
||||
VoteOptionNoWithVeto,
|
||||
}
|
||||
|
||||
/** Casts a vote */
|
||||
export interface AminoMsgVote extends AminoMsg {
|
||||
readonly type: "cosmos-sdk/MsgVote";
|
||||
readonly value: {
|
||||
readonly proposal_id: number;
|
||||
/** Bech32 account address */
|
||||
readonly voter: string;
|
||||
readonly option: VoteOption;
|
||||
};
|
||||
}
|
||||
|
||||
export function isAminoMsgVote(msg: AminoMsg): msg is AminoMsgVote {
|
||||
return (msg as AminoMsgVote).type === "cosmos-sdk/MsgVote";
|
||||
}
|
||||
|
||||
/** Submits a deposit to an existing proposal */
|
||||
export interface AminoMsgDeposit extends AminoMsg {
|
||||
readonly type: "cosmos-sdk/MsgDeposit";
|
||||
readonly value: {
|
||||
readonly proposal_id: number;
|
||||
/** Bech32 account address */
|
||||
readonly depositor: string;
|
||||
readonly amount: readonly Coin[];
|
||||
};
|
||||
}
|
||||
|
||||
export function isAminoMsgDeposit(msg: AminoMsg): msg is AminoMsgDeposit {
|
||||
return (msg as AminoMsgDeposit).type === "cosmos-sdk/MsgDeposit";
|
||||
}
|
||||
|
||||
// ibc
|
||||
|
||||
// mint (no messages) - see https://github.com/cosmos/cosmos-sdk/blob/efa73c7/proto/cosmos/mint/mint.proto
|
||||
|
||||
// params (no messages) - see https://github.com/cosmos/cosmos-sdk/blob/efa73c7/proto/cosmos/params/params.proto
|
||||
|
||||
// slashing - see https://github.com/cosmos/cosmos-sdk/blob/efa73c7/proto/cosmos/slashing/slashing.proto
|
||||
|
||||
/** Unjails a jailed validator */
|
||||
export interface AminoMsgUnjail extends AminoMsg {
|
||||
readonly type: "cosmos-sdk/MsgUnjail";
|
||||
readonly value: {
|
||||
/** Bech32 account address */
|
||||
readonly validator_addr: string;
|
||||
};
|
||||
}
|
||||
|
||||
export function isAminoMsgUnjail(msg: AminoMsg): msg is AminoMsgUnjail {
|
||||
return (msg as AminoMsgUnjail).type === "cosmos-sdk/MsgUnjail";
|
||||
}
|
||||
|
||||
// staking - see https://github.com/cosmos/cosmos-sdk/blob/efa73c7/proto/cosmos/staking/staking.proto
|
||||
|
||||
/** The initial commission rates to be used for creating a validator */
|
||||
interface CommissionRates {
|
||||
readonly rate: string;
|
||||
readonly max_rate: string;
|
||||
readonly max_change_rate: string;
|
||||
}
|
||||
|
||||
/** A validator description. */
|
||||
interface Description {
|
||||
readonly moniker: string;
|
||||
readonly identity: string;
|
||||
readonly website: string;
|
||||
readonly security_contact: string;
|
||||
readonly details: string;
|
||||
}
|
||||
|
||||
/** Creates a new validator. */
|
||||
export interface AminoMsgCreateValidator extends AminoMsg {
|
||||
readonly type: "cosmos-sdk/MsgCreateValidator";
|
||||
readonly value: {
|
||||
readonly description: Description;
|
||||
readonly commission: CommissionRates;
|
||||
readonly min_self_delegation: string;
|
||||
/** Bech32 encoded delegator address */
|
||||
readonly delegator_address: string;
|
||||
/** Bech32 encoded validator address */
|
||||
readonly validator_address: string;
|
||||
/** Bech32 encoded public key */
|
||||
readonly pubkey: string;
|
||||
readonly value: Coin;
|
||||
};
|
||||
}
|
||||
|
||||
export function isAminoMsgCreateValidator(msg: AminoMsg): msg is AminoMsgCreateValidator {
|
||||
return (msg as AminoMsgCreateValidator).type === "cosmos-sdk/MsgCreateValidator";
|
||||
}
|
||||
|
||||
/** Edits an existing validator. */
|
||||
export interface AminoMsgEditValidator extends AminoMsg {
|
||||
readonly type: "cosmos-sdk/MsgEditValidator";
|
||||
readonly value: {
|
||||
readonly description: Description;
|
||||
/** Bech32 encoded validator address */
|
||||
readonly validator_address: string;
|
||||
readonly commission_rate: string;
|
||||
readonly min_self_delegation: string;
|
||||
};
|
||||
}
|
||||
|
||||
export function isAminoMsgEditValidator(msg: AminoMsg): msg is AminoMsgEditValidator {
|
||||
return (msg as AminoMsgEditValidator).type === "cosmos-sdk/MsgEditValidator";
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a delegation from a delegate to a validator.
|
||||
*
|
||||
* @see https://docs.cosmos.network/master/modules/staking/03_messages.html#msgdelegate
|
||||
*/
|
||||
export interface AminoMsgDelegate extends AminoMsg {
|
||||
readonly type: "cosmos-sdk/MsgDelegate";
|
||||
readonly value: {
|
||||
/** Bech32 encoded delegator address */
|
||||
readonly delegator_address: string;
|
||||
/** Bech32 encoded validator address */
|
||||
readonly validator_address: string;
|
||||
readonly amount: Coin;
|
||||
};
|
||||
}
|
||||
|
||||
export function isAminoMsgDelegate(msg: AminoMsg): msg is AminoMsgDelegate {
|
||||
return (msg as AminoMsgDelegate).type === "cosmos-sdk/MsgDelegate";
|
||||
}
|
||||
|
||||
/** Performs a redelegation from a delegate and source validator to a destination validator */
|
||||
export interface AminoMsgBeginRedelegate extends AminoMsg {
|
||||
readonly type: "cosmos-sdk/MsgBeginRedelegate";
|
||||
readonly value: {
|
||||
/** Bech32 encoded delegator address */
|
||||
readonly delegator_address: string;
|
||||
/** Bech32 encoded source validator address */
|
||||
readonly validator_src_address: string;
|
||||
/** Bech32 encoded destination validator address */
|
||||
readonly validator_dst_address: string;
|
||||
readonly amount: Coin;
|
||||
};
|
||||
}
|
||||
|
||||
export function isAminoMsgBeginRedelegate(msg: AminoMsg): msg is AminoMsgBeginRedelegate {
|
||||
return (msg as AminoMsgBeginRedelegate).type === "cosmos-sdk/MsgBeginRedelegate";
|
||||
}
|
||||
|
||||
/** Performs an undelegation from a delegate and a validator */
|
||||
export interface AminoMsgUndelegate extends AminoMsg {
|
||||
readonly type: "cosmos-sdk/MsgUndelegate";
|
||||
readonly value: {
|
||||
/** Bech32 encoded delegator address */
|
||||
readonly delegator_address: string;
|
||||
/** Bech32 encoded validator address */
|
||||
readonly validator_address: string;
|
||||
readonly amount: Coin;
|
||||
};
|
||||
}
|
||||
|
||||
export function isAminoMsgUndelegate(msg: AminoMsg): msg is AminoMsgUndelegate {
|
||||
return (msg as AminoMsgUndelegate).type === "cosmos-sdk/MsgUndelegate";
|
||||
}
|
||||
|
||||
// upgrade (no messages) - see https://github.com/cosmos/cosmos-sdk/blob/efa73c7/proto/cosmos/upgrade/upgrade.proto
|
||||
@ -1,21 +1,21 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { encodeBech32Pubkey } from "@cosmjs/amino";
|
||||
import { fromBase64 } from "@cosmjs/encoding";
|
||||
import {
|
||||
MsgBeginRedelegate as LaunchpadMsgBeginRedelegate,
|
||||
MsgCreateValidator as LaunchpadMsgCreateValidator,
|
||||
MsgDelegate as LaunchpadMsgDelegate,
|
||||
MsgEditValidator as LaunchpadMsgEditValidator,
|
||||
MsgFundCommunityPool as LaunchpadMsgFundCommunityPool,
|
||||
MsgMultiSend as LaunchpadMsgMultiSend,
|
||||
MsgSend as LaunchpadMsgSend,
|
||||
MsgSetWithdrawAddress as LaunchpadMsgSetWithdrawAddress,
|
||||
MsgUndelegate as LaunchpadMsgUndelegate,
|
||||
MsgWithdrawDelegatorReward as LaunchpadMsgWithdrawDelegatorReward,
|
||||
MsgWithdrawValidatorCommission as LaunchpadMsgWithdrawValidatorCommission,
|
||||
} from "@cosmjs/launchpad";
|
||||
import { coin, coins } from "@cosmjs/proto-signing";
|
||||
|
||||
import {
|
||||
AminoMsgBeginRedelegate,
|
||||
AminoMsgCreateValidator,
|
||||
AminoMsgDelegate,
|
||||
AminoMsgEditValidator,
|
||||
AminoMsgFundCommunityPool,
|
||||
AminoMsgMultiSend,
|
||||
AminoMsgSend,
|
||||
AminoMsgSetWithdrawAddress,
|
||||
AminoMsgUndelegate,
|
||||
AminoMsgWithdrawDelegatorReward,
|
||||
AminoMsgWithdrawValidatorCommission,
|
||||
} from "./aminomsgs";
|
||||
import { AminoTypes } from "./aminotypes";
|
||||
import { MsgMultiSend, MsgSend } from "./codec/cosmos/bank/v1beta1/tx";
|
||||
import {
|
||||
@ -44,7 +44,7 @@ describe("AminoTypes", () => {
|
||||
typeUrl: "/cosmos.bank.v1beta1.MsgSend",
|
||||
value: msg,
|
||||
});
|
||||
const expected: LaunchpadMsgSend = {
|
||||
const expected: AminoMsgSend = {
|
||||
type: "cosmos-sdk/MsgSend",
|
||||
value: {
|
||||
from_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
@ -70,7 +70,7 @@ describe("AminoTypes", () => {
|
||||
typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend",
|
||||
value: msg,
|
||||
});
|
||||
const expected: LaunchpadMsgMultiSend = {
|
||||
const expected: AminoMsgMultiSend = {
|
||||
type: "cosmos-sdk/MsgMultiSend",
|
||||
value: {
|
||||
inputs: [
|
||||
@ -95,7 +95,7 @@ describe("AminoTypes", () => {
|
||||
typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool",
|
||||
value: msg,
|
||||
});
|
||||
const expected: LaunchpadMsgFundCommunityPool = {
|
||||
const expected: AminoMsgFundCommunityPool = {
|
||||
type: "cosmos-sdk/MsgFundCommunityPool",
|
||||
value: {
|
||||
amount: coins(1234, "ucosm"),
|
||||
@ -114,7 +114,7 @@ describe("AminoTypes", () => {
|
||||
typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress",
|
||||
value: msg,
|
||||
});
|
||||
const expected: LaunchpadMsgSetWithdrawAddress = {
|
||||
const expected: AminoMsgSetWithdrawAddress = {
|
||||
type: "cosmos-sdk/MsgModifyWithdrawAddress",
|
||||
value: {
|
||||
delegator_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
@ -133,7 +133,7 @@ describe("AminoTypes", () => {
|
||||
typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward",
|
||||
value: msg,
|
||||
});
|
||||
const expected: LaunchpadMsgWithdrawDelegatorReward = {
|
||||
const expected: AminoMsgWithdrawDelegatorReward = {
|
||||
type: "cosmos-sdk/MsgWithdrawDelegationReward",
|
||||
value: {
|
||||
delegator_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
@ -151,7 +151,7 @@ describe("AminoTypes", () => {
|
||||
typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission",
|
||||
value: msg,
|
||||
});
|
||||
const expected: LaunchpadMsgWithdrawValidatorCommission = {
|
||||
const expected: AminoMsgWithdrawValidatorCommission = {
|
||||
type: "cosmos-sdk/MsgWithdrawValidatorCommission",
|
||||
value: {
|
||||
validator_address: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
|
||||
@ -171,7 +171,7 @@ describe("AminoTypes", () => {
|
||||
typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate",
|
||||
value: msg,
|
||||
});
|
||||
const expected: LaunchpadMsgBeginRedelegate = {
|
||||
const expected: AminoMsgBeginRedelegate = {
|
||||
type: "cosmos-sdk/MsgBeginRedelegate",
|
||||
value: {
|
||||
delegator_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
@ -210,7 +210,7 @@ describe("AminoTypes", () => {
|
||||
typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator",
|
||||
value: msg,
|
||||
});
|
||||
const expected: LaunchpadMsgCreateValidator = {
|
||||
const expected: AminoMsgCreateValidator = {
|
||||
type: "cosmos-sdk/MsgCreateValidator",
|
||||
value: {
|
||||
description: {
|
||||
@ -248,7 +248,7 @@ describe("AminoTypes", () => {
|
||||
typeUrl: "/cosmos.staking.v1beta1.MsgDelegate",
|
||||
value: msg,
|
||||
});
|
||||
const expected: LaunchpadMsgDelegate = {
|
||||
const expected: AminoMsgDelegate = {
|
||||
type: "cosmos-sdk/MsgDelegate",
|
||||
value: {
|
||||
delegator_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
@ -276,7 +276,7 @@ describe("AminoTypes", () => {
|
||||
typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator",
|
||||
value: msg,
|
||||
});
|
||||
const expected: LaunchpadMsgEditValidator = {
|
||||
const expected: AminoMsgEditValidator = {
|
||||
type: "cosmos-sdk/MsgEditValidator",
|
||||
value: {
|
||||
description: {
|
||||
@ -304,7 +304,7 @@ describe("AminoTypes", () => {
|
||||
typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate",
|
||||
value: msg,
|
||||
});
|
||||
const expected: LaunchpadMsgUndelegate = {
|
||||
const expected: AminoMsgUndelegate = {
|
||||
type: "cosmos-sdk/MsgUndelegate",
|
||||
value: {
|
||||
delegator_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
@ -382,7 +382,7 @@ describe("AminoTypes", () => {
|
||||
|
||||
describe("fromAmino", () => {
|
||||
it("works for MsgSend", () => {
|
||||
const aminoMsg: LaunchpadMsgSend = {
|
||||
const aminoMsg: AminoMsgSend = {
|
||||
type: "cosmos-sdk/MsgSend",
|
||||
value: {
|
||||
from_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
@ -403,7 +403,7 @@ describe("AminoTypes", () => {
|
||||
});
|
||||
|
||||
it("works for MsgMultiSend", () => {
|
||||
const aminoMsg: LaunchpadMsgMultiSend = {
|
||||
const aminoMsg: AminoMsgMultiSend = {
|
||||
type: "cosmos-sdk/MsgMultiSend",
|
||||
value: {
|
||||
inputs: [
|
||||
@ -434,7 +434,7 @@ describe("AminoTypes", () => {
|
||||
});
|
||||
|
||||
it("works for MsgBeginRedelegate", () => {
|
||||
const aminoMsg: LaunchpadMsgBeginRedelegate = {
|
||||
const aminoMsg: AminoMsgBeginRedelegate = {
|
||||
type: "cosmos-sdk/MsgBeginRedelegate",
|
||||
value: {
|
||||
delegator_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
@ -457,7 +457,7 @@ describe("AminoTypes", () => {
|
||||
});
|
||||
|
||||
it("works for MsgCreateValidator", () => {
|
||||
const aminoMsg: LaunchpadMsgCreateValidator = {
|
||||
const aminoMsg: AminoMsgCreateValidator = {
|
||||
type: "cosmos-sdk/MsgCreateValidator",
|
||||
value: {
|
||||
description: {
|
||||
@ -512,7 +512,7 @@ describe("AminoTypes", () => {
|
||||
});
|
||||
|
||||
it("works for MsgDelegate", () => {
|
||||
const aminoMsg: LaunchpadMsgDelegate = {
|
||||
const aminoMsg: AminoMsgDelegate = {
|
||||
type: "cosmos-sdk/MsgDelegate",
|
||||
value: {
|
||||
delegator_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
@ -533,7 +533,7 @@ describe("AminoTypes", () => {
|
||||
});
|
||||
|
||||
it("works for MsgEditValidator", () => {
|
||||
const aminoMsg: LaunchpadMsgEditValidator = {
|
||||
const aminoMsg: AminoMsgEditValidator = {
|
||||
type: "cosmos-sdk/MsgEditValidator",
|
||||
value: {
|
||||
description: {
|
||||
@ -568,7 +568,7 @@ describe("AminoTypes", () => {
|
||||
});
|
||||
|
||||
it("works for MsgUndelegate", () => {
|
||||
const aminoMsg: LaunchpadMsgUndelegate = {
|
||||
const aminoMsg: AminoMsgUndelegate = {
|
||||
type: "cosmos-sdk/MsgUndelegate",
|
||||
value: {
|
||||
delegator_address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
|
||||
@ -1,22 +1,22 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { AminoMsg, decodeBech32Pubkey, encodeBech32Pubkey } from "@cosmjs/amino";
|
||||
import { fromBase64, toBase64 } from "@cosmjs/encoding";
|
||||
import {
|
||||
MsgBeginRedelegate as LaunchpadMsgBeginRedelegate,
|
||||
MsgCreateValidator as LaunchpadMsgCreateValidator,
|
||||
MsgDelegate as LaunchpadMsgDelegate,
|
||||
MsgEditValidator as LaunchpadMsgEditValidator,
|
||||
MsgFundCommunityPool as LaunchpadMsgFundCommunityPool,
|
||||
MsgMultiSend as LaunchpadMsgMultiSend,
|
||||
MsgSend as LaunchpadMsgSend,
|
||||
MsgSetWithdrawAddress as LaunchpadMsgSetWithdrawAddress,
|
||||
MsgUndelegate as LaunchpadMsgUndelegate,
|
||||
MsgWithdrawDelegatorReward as LaunchpadMsgWithdrawDelegatorReward,
|
||||
MsgWithdrawValidatorCommission as LaunchpadMsgWithdrawValidatorCommission,
|
||||
} from "@cosmjs/launchpad";
|
||||
import { EncodeObject } from "@cosmjs/proto-signing";
|
||||
import { assertDefinedAndNotNull } from "@cosmjs/utils";
|
||||
|
||||
import {
|
||||
AminoMsgBeginRedelegate,
|
||||
AminoMsgCreateValidator,
|
||||
AminoMsgDelegate,
|
||||
AminoMsgEditValidator,
|
||||
AminoMsgFundCommunityPool,
|
||||
AminoMsgMultiSend,
|
||||
AminoMsgSend,
|
||||
AminoMsgSetWithdrawAddress,
|
||||
AminoMsgUndelegate,
|
||||
AminoMsgWithdrawDelegatorReward,
|
||||
AminoMsgWithdrawValidatorCommission,
|
||||
} from "./aminomsgs";
|
||||
import { MsgMultiSend, MsgSend } from "./codec/cosmos/bank/v1beta1/tx";
|
||||
import {
|
||||
MsgFundCommunityPool,
|
||||
@ -43,7 +43,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
return {
|
||||
"/cosmos.bank.v1beta1.MsgSend": {
|
||||
aminoType: "cosmos-sdk/MsgSend",
|
||||
toAmino: ({ fromAddress, toAddress, amount }: MsgSend): LaunchpadMsgSend["value"] => {
|
||||
toAmino: ({ fromAddress, toAddress, amount }: MsgSend): AminoMsgSend["value"] => {
|
||||
assertDefinedAndNotNull(fromAddress, "missing fromAddress");
|
||||
assertDefinedAndNotNull(toAddress, "missing toAddress");
|
||||
assertDefinedAndNotNull(amount, "missing amount");
|
||||
@ -53,7 +53,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
amount: amount.map(coinFromProto),
|
||||
};
|
||||
},
|
||||
fromAmino: ({ from_address, to_address, amount }: LaunchpadMsgSend["value"]): MsgSend => ({
|
||||
fromAmino: ({ from_address, to_address, amount }: AminoMsgSend["value"]): MsgSend => ({
|
||||
fromAddress: from_address,
|
||||
toAddress: to_address,
|
||||
amount: [...amount],
|
||||
@ -61,7 +61,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
},
|
||||
"/cosmos.bank.v1beta1.MsgMultiSend": {
|
||||
aminoType: "cosmos-sdk/MsgMultiSend",
|
||||
toAmino: ({ inputs, outputs }: MsgMultiSend): LaunchpadMsgMultiSend["value"] => {
|
||||
toAmino: ({ inputs, outputs }: MsgMultiSend): AminoMsgMultiSend["value"] => {
|
||||
assertDefinedAndNotNull(inputs, "missing inputs");
|
||||
assertDefinedAndNotNull(outputs, "missing outputs");
|
||||
return {
|
||||
@ -83,7 +83,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
}),
|
||||
};
|
||||
},
|
||||
fromAmino: ({ inputs, outputs }: LaunchpadMsgMultiSend["value"]): MsgMultiSend => ({
|
||||
fromAmino: ({ inputs, outputs }: AminoMsgMultiSend["value"]): MsgMultiSend => ({
|
||||
inputs: inputs.map((input) => ({
|
||||
address: input.address,
|
||||
coins: [...input.coins],
|
||||
@ -96,7 +96,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
},
|
||||
"/cosmos.distribution.v1beta1.MsgFundCommunityPool": {
|
||||
aminoType: "cosmos-sdk/MsgFundCommunityPool",
|
||||
toAmino: ({ amount, depositor }: MsgFundCommunityPool): LaunchpadMsgFundCommunityPool["value"] => {
|
||||
toAmino: ({ amount, depositor }: MsgFundCommunityPool): AminoMsgFundCommunityPool["value"] => {
|
||||
assertDefinedAndNotNull(amount);
|
||||
assertDefinedAndNotNull(depositor);
|
||||
return {
|
||||
@ -104,7 +104,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
depositor: depositor,
|
||||
};
|
||||
},
|
||||
fromAmino: ({ amount, depositor }: LaunchpadMsgFundCommunityPool["value"]): MsgFundCommunityPool => ({
|
||||
fromAmino: ({ amount, depositor }: AminoMsgFundCommunityPool["value"]): MsgFundCommunityPool => ({
|
||||
amount: [...amount],
|
||||
depositor: depositor,
|
||||
}),
|
||||
@ -114,7 +114,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
toAmino: ({
|
||||
delegatorAddress,
|
||||
withdrawAddress,
|
||||
}: MsgSetWithdrawAddress): LaunchpadMsgSetWithdrawAddress["value"] => {
|
||||
}: MsgSetWithdrawAddress): AminoMsgSetWithdrawAddress["value"] => {
|
||||
assertDefinedAndNotNull(delegatorAddress);
|
||||
assertDefinedAndNotNull(withdrawAddress);
|
||||
return {
|
||||
@ -125,7 +125,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
fromAmino: ({
|
||||
delegator_address,
|
||||
withdraw_address,
|
||||
}: LaunchpadMsgSetWithdrawAddress["value"]): MsgSetWithdrawAddress => ({
|
||||
}: AminoMsgSetWithdrawAddress["value"]): MsgSetWithdrawAddress => ({
|
||||
delegatorAddress: delegator_address,
|
||||
withdrawAddress: withdraw_address,
|
||||
}),
|
||||
@ -135,7 +135,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
toAmino: ({
|
||||
delegatorAddress,
|
||||
validatorAddress,
|
||||
}: MsgWithdrawDelegatorReward): LaunchpadMsgWithdrawDelegatorReward["value"] => {
|
||||
}: MsgWithdrawDelegatorReward): AminoMsgWithdrawDelegatorReward["value"] => {
|
||||
assertDefinedAndNotNull(delegatorAddress);
|
||||
assertDefinedAndNotNull(validatorAddress);
|
||||
return {
|
||||
@ -146,7 +146,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
fromAmino: ({
|
||||
delegator_address,
|
||||
validator_address,
|
||||
}: LaunchpadMsgWithdrawDelegatorReward["value"]): MsgWithdrawDelegatorReward => ({
|
||||
}: AminoMsgWithdrawDelegatorReward["value"]): MsgWithdrawDelegatorReward => ({
|
||||
delegatorAddress: delegator_address,
|
||||
validatorAddress: validator_address,
|
||||
}),
|
||||
@ -155,7 +155,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
aminoType: "cosmos-sdk/MsgWithdrawValidatorCommission",
|
||||
toAmino: ({
|
||||
validatorAddress,
|
||||
}: MsgWithdrawValidatorCommission): LaunchpadMsgWithdrawValidatorCommission["value"] => {
|
||||
}: MsgWithdrawValidatorCommission): AminoMsgWithdrawValidatorCommission["value"] => {
|
||||
assertDefinedAndNotNull(validatorAddress);
|
||||
return {
|
||||
validator_address: validatorAddress,
|
||||
@ -163,7 +163,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
},
|
||||
fromAmino: ({
|
||||
validator_address,
|
||||
}: LaunchpadMsgWithdrawValidatorCommission["value"]): MsgWithdrawValidatorCommission => ({
|
||||
}: AminoMsgWithdrawValidatorCommission["value"]): MsgWithdrawValidatorCommission => ({
|
||||
validatorAddress: validator_address,
|
||||
}),
|
||||
},
|
||||
@ -174,7 +174,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
validatorSrcAddress,
|
||||
validatorDstAddress,
|
||||
amount,
|
||||
}: MsgBeginRedelegate): LaunchpadMsgBeginRedelegate["value"] => {
|
||||
}: MsgBeginRedelegate): AminoMsgBeginRedelegate["value"] => {
|
||||
assertDefinedAndNotNull(delegatorAddress, "missing delegatorAddress");
|
||||
assertDefinedAndNotNull(validatorSrcAddress, "missing validatorSrcAddress");
|
||||
assertDefinedAndNotNull(validatorDstAddress, "missing validatorDstAddress");
|
||||
@ -191,7 +191,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
validator_src_address,
|
||||
validator_dst_address,
|
||||
amount,
|
||||
}: LaunchpadMsgBeginRedelegate["value"]): MsgBeginRedelegate => ({
|
||||
}: AminoMsgBeginRedelegate["value"]): MsgBeginRedelegate => ({
|
||||
delegatorAddress: delegator_address,
|
||||
validatorSrcAddress: validator_src_address,
|
||||
validatorDstAddress: validator_dst_address,
|
||||
@ -208,7 +208,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
validatorAddress,
|
||||
pubkey,
|
||||
value,
|
||||
}: MsgCreateValidator): LaunchpadMsgCreateValidator["value"] => {
|
||||
}: MsgCreateValidator): AminoMsgCreateValidator["value"] => {
|
||||
assertDefinedAndNotNull(description, "missing description");
|
||||
assertDefinedAndNotNull(description.moniker, "missing description.moniker");
|
||||
assertDefinedAndNotNull(description.identity, "missing description.identity");
|
||||
@ -259,7 +259,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
validator_address,
|
||||
pubkey,
|
||||
value,
|
||||
}: LaunchpadMsgCreateValidator["value"]): MsgCreateValidator => {
|
||||
}: AminoMsgCreateValidator["value"]): MsgCreateValidator => {
|
||||
const decodedPubkey = decodeBech32Pubkey(pubkey);
|
||||
if (decodedPubkey.type !== "tendermint/PubKeySecp256k1") {
|
||||
throw new Error("Only Secp256k1 public keys are supported");
|
||||
@ -290,11 +290,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
},
|
||||
"/cosmos.staking.v1beta1.MsgDelegate": {
|
||||
aminoType: "cosmos-sdk/MsgDelegate",
|
||||
toAmino: ({
|
||||
delegatorAddress,
|
||||
validatorAddress,
|
||||
amount,
|
||||
}: MsgDelegate): LaunchpadMsgDelegate["value"] => {
|
||||
toAmino: ({ delegatorAddress, validatorAddress, amount }: MsgDelegate): AminoMsgDelegate["value"] => {
|
||||
assertDefinedAndNotNull(delegatorAddress, "missing delegatorAddress");
|
||||
assertDefinedAndNotNull(validatorAddress, "missing validatorAddress");
|
||||
assertDefinedAndNotNull(amount, "missing amount");
|
||||
@ -308,7 +304,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
delegator_address,
|
||||
validator_address,
|
||||
amount,
|
||||
}: LaunchpadMsgDelegate["value"]): MsgDelegate => ({
|
||||
}: AminoMsgDelegate["value"]): MsgDelegate => ({
|
||||
delegatorAddress: delegator_address,
|
||||
validatorAddress: validator_address,
|
||||
amount: amount,
|
||||
@ -321,7 +317,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
commissionRate,
|
||||
minSelfDelegation,
|
||||
validatorAddress,
|
||||
}: MsgEditValidator): LaunchpadMsgEditValidator["value"] => {
|
||||
}: MsgEditValidator): AminoMsgEditValidator["value"] => {
|
||||
assertDefinedAndNotNull(description, "missing description");
|
||||
assertDefinedAndNotNull(description.moniker, "missing description.moniker");
|
||||
assertDefinedAndNotNull(description.identity, "missing description.identity");
|
||||
@ -349,7 +345,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
commission_rate,
|
||||
min_self_delegation,
|
||||
validator_address,
|
||||
}: LaunchpadMsgEditValidator["value"]): MsgEditValidator => ({
|
||||
}: AminoMsgEditValidator["value"]): MsgEditValidator => ({
|
||||
description: {
|
||||
moniker: description.moniker,
|
||||
identity: description.identity,
|
||||
@ -368,7 +364,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
delegatorAddress,
|
||||
validatorAddress,
|
||||
amount,
|
||||
}: MsgUndelegate): LaunchpadMsgUndelegate["value"] => {
|
||||
}: MsgUndelegate): AminoMsgUndelegate["value"] => {
|
||||
assertDefinedAndNotNull(delegatorAddress, "missing delegatorAddress");
|
||||
assertDefinedAndNotNull(validatorAddress, "missing validatorAddress");
|
||||
assertDefinedAndNotNull(amount, "missing amount");
|
||||
@ -382,7 +378,7 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
delegator_address,
|
||||
validator_address,
|
||||
amount,
|
||||
}: LaunchpadMsgUndelegate["value"]): MsgUndelegate => ({
|
||||
}: AminoMsgUndelegate["value"]): MsgUndelegate => ({
|
||||
delegatorAddress: delegator_address,
|
||||
validatorAddress: validator_address,
|
||||
amount: amount,
|
||||
|
||||
@ -2,6 +2,42 @@ export { StdFee } from "@cosmjs/amino";
|
||||
export { Coin, coin, coins, parseCoins } from "@cosmjs/proto-signing";
|
||||
|
||||
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 } from "./aminotypes";
|
||||
export { buildFeeTable, FeeTable, GasLimits, GasPrice } from "./fee";
|
||||
export * as logs from "./logs";
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention,no-bitwise */
|
||||
import { Secp256k1HdWallet } from "@cosmjs/amino";
|
||||
import { MsgDelegate as LaunchpadMsgDelegate } from "@cosmjs/launchpad";
|
||||
import { coin, coins, DirectSecp256k1HdWallet, Registry } from "@cosmjs/proto-signing";
|
||||
import { assert, sleep } from "@cosmjs/utils";
|
||||
import protobuf from "protobufjs/minimal";
|
||||
|
||||
import { AminoMsgDelegate } from "./aminomsgs";
|
||||
import { AminoTypes } from "./aminotypes";
|
||||
import { MsgSend } from "./codec/cosmos/bank/v1beta1/tx";
|
||||
import { Coin } from "./codec/cosmos/base/v1beta1/coin";
|
||||
@ -346,7 +346,7 @@ describe("SigningStargateClient", () => {
|
||||
customDelegatorAddress,
|
||||
customValidatorAddress,
|
||||
customAmount,
|
||||
}: CustomMsgDelegate): LaunchpadMsgDelegate["value"] => {
|
||||
}: CustomMsgDelegate): AminoMsgDelegate["value"] => {
|
||||
assert(customDelegatorAddress, "missing customDelegatorAddress");
|
||||
assert(customValidatorAddress, "missing validatorAddress");
|
||||
assert(customAmount, "missing amount");
|
||||
@ -365,7 +365,7 @@ describe("SigningStargateClient", () => {
|
||||
delegator_address,
|
||||
validator_address,
|
||||
amount,
|
||||
}: LaunchpadMsgDelegate["value"]): CustomMsgDelegate => ({
|
||||
}: AminoMsgDelegate["value"]): CustomMsgDelegate => ({
|
||||
customDelegatorAddress: delegator_address,
|
||||
customValidatorAddress: validator_address,
|
||||
customAmount: Coin.fromPartial(amount),
|
||||
@ -614,7 +614,7 @@ describe("SigningStargateClient", () => {
|
||||
customDelegatorAddress,
|
||||
customValidatorAddress,
|
||||
customAmount,
|
||||
}: CustomMsgDelegate): LaunchpadMsgDelegate["value"] => {
|
||||
}: CustomMsgDelegate): AminoMsgDelegate["value"] => {
|
||||
assert(customDelegatorAddress, "missing customDelegatorAddress");
|
||||
assert(customValidatorAddress, "missing validatorAddress");
|
||||
assert(customAmount, "missing amount");
|
||||
@ -633,7 +633,7 @@ describe("SigningStargateClient", () => {
|
||||
delegator_address,
|
||||
validator_address,
|
||||
amount,
|
||||
}: LaunchpadMsgDelegate["value"]): CustomMsgDelegate => ({
|
||||
}: AminoMsgDelegate["value"]): CustomMsgDelegate => ({
|
||||
customDelegatorAddress: delegator_address,
|
||||
customValidatorAddress: validator_address,
|
||||
customAmount: Coin.fromPartial(amount),
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
const { Secp256k1HdWallet } = require("@cosmjs/amino");
|
||||
const { SigningCosmWasmClient } = require("@cosmjs/cosmwasm-launchpad");
|
||||
const { Secp256k1HdWallet } = require("@cosmjs/launchpad");
|
||||
const fs = require("fs");
|
||||
|
||||
const httpUrl = "http://localhost:1317";
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
const { Secp256k1HdWallet } = require("@cosmjs/amino");
|
||||
const { SigningCosmWasmClient } = require("@cosmjs/cosmwasm-launchpad");
|
||||
const { Secp256k1HdWallet } = require("@cosmjs/launchpad");
|
||||
const fs = require("fs");
|
||||
|
||||
const httpUrl = "http://localhost:1317";
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
const { Secp256k1HdWallet } = require("@cosmjs/amino");
|
||||
const { SigningCosmWasmClient } = require("@cosmjs/cosmwasm-launchpad");
|
||||
const { Secp256k1HdWallet } = require("@cosmjs/launchpad");
|
||||
const fs = require("fs");
|
||||
|
||||
const httpUrl = "http://localhost:1317";
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
const { Secp256k1HdWallet } = require("@cosmjs/amino");
|
||||
const { SigningCosmWasmClient } = require("@cosmjs/cosmwasm-launchpad");
|
||||
const { Secp256k1HdWallet } = require("@cosmjs/launchpad");
|
||||
const fs = require("fs");
|
||||
|
||||
const httpUrl = "http://localhost:1317";
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
const { Secp256k1HdWallet } = require("@cosmjs/amino");
|
||||
const { SigningCosmWasmClient } = require("@cosmjs/cosmwasm-launchpad");
|
||||
const { Secp256k1HdWallet } = require("@cosmjs/launchpad");
|
||||
const fs = require("fs");
|
||||
|
||||
const httpUrl = "http://localhost:1317";
|
||||
|
||||
@ -1,14 +1,10 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
const { coins, Secp256k1HdWallet } = require("@cosmjs/amino");
|
||||
const { Random } = require("@cosmjs/crypto");
|
||||
const { Bech32 } = require("@cosmjs/encoding");
|
||||
const {
|
||||
coins,
|
||||
Secp256k1HdWallet,
|
||||
SigningCosmosClient,
|
||||
assertIsBroadcastTxSuccess,
|
||||
} = require("@cosmjs/launchpad");
|
||||
const { SigningCosmosClient, assertIsBroadcastTxSuccess } = require("@cosmjs/launchpad");
|
||||
|
||||
const httpUrl = "http://localhost:1317";
|
||||
const faucet = {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
const { encodeSecp256k1Pubkey, makeCosmoshubPath, Secp256k1HdWallet } = require("@cosmjs/launchpad");
|
||||
const { encodeSecp256k1Pubkey, makeCosmoshubPath, Secp256k1HdWallet } = require("@cosmjs/amino");
|
||||
|
||||
const prefix = "wasm";
|
||||
const accountsToCreate = [
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
const { coins } = require("@cosmjs/amino");
|
||||
const { Random } = require("@cosmjs/crypto");
|
||||
const { Bech32 } = require("@cosmjs/encoding");
|
||||
const { coins } = require("@cosmjs/launchpad");
|
||||
const { DirectSecp256k1HdWallet } = require("@cosmjs/proto-signing");
|
||||
const { assertIsBroadcastTxSuccess, SigningStargateClient } = require("@cosmjs/stargate");
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user