Merge pull request #554 from cosmos/547-multisig-msg-types
CosmosMsg types for multisig client
This commit is contained in:
commit
97e3f81ab0
77
packages/cosmwasm/src/cosmosmsg.ts
Normal file
77
packages/cosmwasm/src/cosmosmsg.ts
Normal file
@ -0,0 +1,77 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { Coin } from "@cosmjs/launchpad";
|
||||
|
||||
interface BankSendMsg {
|
||||
readonly send: {
|
||||
readonly from_address: string;
|
||||
readonly to_address: string;
|
||||
readonly amount: readonly Coin[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface BankMsg {
|
||||
readonly bank: BankSendMsg;
|
||||
}
|
||||
|
||||
export interface CustomMsg {
|
||||
readonly custom: Record<string, unknown>;
|
||||
}
|
||||
|
||||
interface StakingDelegateMsg {
|
||||
readonly delegate: {
|
||||
readonly validator: string;
|
||||
readonly amount: Coin;
|
||||
};
|
||||
}
|
||||
|
||||
interface StakingRedelegateMsg {
|
||||
readonly redelgate: {
|
||||
readonly src_validator: string;
|
||||
readonly dst_validator: string;
|
||||
readonly amount: Coin;
|
||||
};
|
||||
}
|
||||
|
||||
interface StakingUndelegateMsg {
|
||||
readonly undelegate: {
|
||||
readonly validator: string;
|
||||
readonly amount: Coin;
|
||||
};
|
||||
}
|
||||
|
||||
interface StakingWithdrawMsg {
|
||||
readonly withdraw: {
|
||||
readonly validator: string;
|
||||
readonly recipient?: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface StakingMsg {
|
||||
readonly staking: StakingDelegateMsg | StakingRedelegateMsg | StakingUndelegateMsg | StakingWithdrawMsg;
|
||||
}
|
||||
|
||||
interface WasmExecuteMsg {
|
||||
readonly execute: {
|
||||
readonly contract_address: string;
|
||||
readonly msg: any;
|
||||
readonly send: readonly Coin[];
|
||||
};
|
||||
}
|
||||
|
||||
interface WasmInstantiateMsg {
|
||||
readonly instantiate: {
|
||||
readonly code_id: string;
|
||||
readonly msg: any;
|
||||
readonly send: readonly Coin[];
|
||||
readonly label?: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface WasmMsg {
|
||||
readonly wasm: WasmExecuteMsg | WasmInstantiateMsg;
|
||||
}
|
||||
|
||||
/** These definitions are derived from CosmWasm:
|
||||
* https://github.com/CosmWasm/cosmwasm/blob/v0.12.0/packages/std/src/results/cosmos_msg.rs#L10-L23
|
||||
*/
|
||||
export type CosmosMsg = BankMsg | CustomMsg | StakingMsg | WasmMsg;
|
||||
@ -1,6 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { BroadcastMode, GasLimits, GasPrice, OfflineSigner } from "@cosmjs/launchpad";
|
||||
|
||||
import { CosmosMsg } from "./cosmosmsg";
|
||||
import { Account } from "./cosmwasmclient";
|
||||
import { CosmWasmFeeTable, ExecuteResult, SigningCosmWasmClient } from "./signingcosmwasmclient";
|
||||
|
||||
@ -30,7 +31,7 @@ export interface ProposalResult {
|
||||
readonly id: number;
|
||||
readonly title: string;
|
||||
readonly description: string;
|
||||
readonly msgs: ReadonlyArray<Record<string, unknown>>;
|
||||
readonly msgs: readonly CosmosMsg[];
|
||||
readonly expires: Expiration;
|
||||
readonly status: string;
|
||||
}
|
||||
@ -163,7 +164,7 @@ export class Cw3CosmWasmClient extends SigningCosmWasmClient {
|
||||
public createMultisigProposal(
|
||||
title: string,
|
||||
description: string,
|
||||
msgs: ReadonlyArray<Record<string, unknown>>,
|
||||
msgs: readonly CosmosMsg[],
|
||||
earliest?: Expiration,
|
||||
latest?: Expiration,
|
||||
memo = "",
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
export { setupWasmExtension, WasmExtension } from "./lcdapi/wasm";
|
||||
export { BankMsg, CosmosMsg, CustomMsg, StakingMsg, WasmMsg } from "./cosmosmsg";
|
||||
export {
|
||||
Account,
|
||||
Block,
|
||||
|
||||
65
packages/cosmwasm/types/cosmosmsg.d.ts
vendored
Normal file
65
packages/cosmwasm/types/cosmosmsg.d.ts
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
import { Coin } from "@cosmjs/launchpad";
|
||||
interface BankSendMsg {
|
||||
readonly send: {
|
||||
readonly from_address: string;
|
||||
readonly to_address: string;
|
||||
readonly amount: readonly Coin[];
|
||||
};
|
||||
}
|
||||
export interface BankMsg {
|
||||
readonly bank: BankSendMsg;
|
||||
}
|
||||
export interface CustomMsg {
|
||||
readonly custom: Record<string, unknown>;
|
||||
}
|
||||
interface StakingDelegateMsg {
|
||||
readonly delegate: {
|
||||
readonly validator: string;
|
||||
readonly amount: Coin;
|
||||
};
|
||||
}
|
||||
interface StakingRedelegateMsg {
|
||||
readonly redelgate: {
|
||||
readonly src_validator: string;
|
||||
readonly dst_validator: string;
|
||||
readonly amount: Coin;
|
||||
};
|
||||
}
|
||||
interface StakingUndelegateMsg {
|
||||
readonly undelegate: {
|
||||
readonly validator: string;
|
||||
readonly amount: Coin;
|
||||
};
|
||||
}
|
||||
interface StakingWithdrawMsg {
|
||||
readonly withdraw: {
|
||||
readonly validator: string;
|
||||
readonly recipient?: string;
|
||||
};
|
||||
}
|
||||
export interface StakingMsg {
|
||||
readonly staking: StakingDelegateMsg | StakingRedelegateMsg | StakingUndelegateMsg | StakingWithdrawMsg;
|
||||
}
|
||||
interface WasmExecuteMsg {
|
||||
readonly execute: {
|
||||
readonly contract_address: string;
|
||||
readonly msg: any;
|
||||
readonly send: readonly Coin[];
|
||||
};
|
||||
}
|
||||
interface WasmInstantiateMsg {
|
||||
readonly instantiate: {
|
||||
readonly code_id: string;
|
||||
readonly msg: any;
|
||||
readonly send: readonly Coin[];
|
||||
readonly label?: string;
|
||||
};
|
||||
}
|
||||
export interface WasmMsg {
|
||||
readonly wasm: WasmExecuteMsg | WasmInstantiateMsg;
|
||||
}
|
||||
/** These definitions are derived from CosmWasm:
|
||||
* https://github.com/CosmWasm/cosmwasm/blob/v0.12.0/packages/std/src/results/cosmos_msg.rs#L10-L23
|
||||
*/
|
||||
export declare type CosmosMsg = BankMsg | CustomMsg | StakingMsg | WasmMsg;
|
||||
export {};
|
||||
@ -1,4 +1,5 @@
|
||||
import { BroadcastMode, GasLimits, GasPrice, OfflineSigner } from "@cosmjs/launchpad";
|
||||
import { CosmosMsg } from "./cosmosmsg";
|
||||
import { Account } from "./cosmwasmclient";
|
||||
import { CosmWasmFeeTable, ExecuteResult, SigningCosmWasmClient } from "./signingcosmwasmclient";
|
||||
export declare type Expiration =
|
||||
@ -24,7 +25,7 @@ export interface ProposalResult {
|
||||
readonly id: number;
|
||||
readonly title: string;
|
||||
readonly description: string;
|
||||
readonly msgs: ReadonlyArray<Record<string, unknown>>;
|
||||
readonly msgs: readonly CosmosMsg[];
|
||||
readonly expires: Expiration;
|
||||
readonly status: string;
|
||||
}
|
||||
@ -86,7 +87,7 @@ export declare class Cw3CosmWasmClient extends SigningCosmWasmClient {
|
||||
createMultisigProposal(
|
||||
title: string,
|
||||
description: string,
|
||||
msgs: ReadonlyArray<Record<string, unknown>>,
|
||||
msgs: readonly CosmosMsg[],
|
||||
earliest?: Expiration,
|
||||
latest?: Expiration,
|
||||
memo?: string,
|
||||
|
||||
1
packages/cosmwasm/types/index.d.ts
vendored
1
packages/cosmwasm/types/index.d.ts
vendored
@ -1,4 +1,5 @@
|
||||
export { setupWasmExtension, WasmExtension } from "./lcdapi/wasm";
|
||||
export { BankMsg, CosmosMsg, CustomMsg, StakingMsg, WasmMsg } from "./cosmosmsg";
|
||||
export {
|
||||
Account,
|
||||
Block,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user