cosmwasm: Extract CosmosMsg types into separate file

This commit is contained in:
willclarktech 2020-11-26 13:09:48 +00:00
parent 55f422f16c
commit cf0c939cf5
No known key found for this signature in database
GPG Key ID: 551A86E2E398ADF7
8 changed files with 146 additions and 145 deletions

View 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;

View File

@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { BroadcastMode, GasLimits, GasPrice, OfflineSigner } from "@cosmjs/launchpad";
import { CosmosMsg } from "./cosmosmsg";
import { Account } from "./cosmwasmclient";
import { CosmosMsg } from "./msgs";
import { CosmWasmFeeTable, ExecuteResult, SigningCosmWasmClient } from "./signingcosmwasmclient";
export type Expiration =

View File

@ -1,4 +1,5 @@
export { setupWasmExtension, WasmExtension } from "./lcdapi/wasm";
export { BankMsg, CosmosMsg, CustomMsg, StakingMsg, WasmMsg } from "./cosmosmsg";
export {
Account,
Block,
@ -39,11 +40,6 @@ export {
UploadResult,
} from "./signingcosmwasmclient";
export {
BankMsg,
CosmosMsg,
CustomMsg,
StakingMsg,
WasmMsg,
isMsgClearAdmin,
isMsgExecuteContract,
isMsgInstantiateContract,

View File

@ -144,75 +144,3 @@ export interface MsgMigrateContract extends Msg {
export function isMsgMigrateContract(msg: Msg): msg is MsgMigrateContract {
return (msg as MsgMigrateContract).type === "wasm/MsgMigrateContract";
}
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;
}
export type CosmosMsg = BankMsg | CustomMsg | StakingMsg | WasmMsg;

65
packages/cosmwasm/types/cosmosmsg.d.ts vendored Normal file
View 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 {};

View File

@ -1,6 +1,6 @@
import { BroadcastMode, GasLimits, GasPrice, OfflineSigner } from "@cosmjs/launchpad";
import { CosmosMsg } from "./cosmosmsg";
import { Account } from "./cosmwasmclient";
import { CosmosMsg } from "./msgs";
import { CosmWasmFeeTable, ExecuteResult, SigningCosmWasmClient } from "./signingcosmwasmclient";
export declare type Expiration =
| {

View File

@ -1,4 +1,5 @@
export { setupWasmExtension, WasmExtension } from "./lcdapi/wasm";
export { BankMsg, CosmosMsg, CustomMsg, StakingMsg, WasmMsg } from "./cosmosmsg";
export {
Account,
Block,
@ -39,11 +40,6 @@ export {
UploadResult,
} from "./signingcosmwasmclient";
export {
BankMsg,
CosmosMsg,
CustomMsg,
StakingMsg,
WasmMsg,
isMsgClearAdmin,
isMsgExecuteContract,
isMsgInstantiateContract,

View File

@ -117,64 +117,3 @@ export interface MsgMigrateContract extends Msg {
};
}
export declare function isMsgMigrateContract(msg: Msg): msg is MsgMigrateContract;
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;
}
export declare type CosmosMsg = BankMsg | CustomMsg | StakingMsg | WasmMsg;
export {};