cosmwasm: Add CosmosMsg types

This commit is contained in:
willclarktech 2020-11-24 17:34:07 +00:00
parent 9580d2f895
commit 7b65945f7f
No known key found for this signature in database
GPG Key ID: 551A86E2E398ADF7
2 changed files with 133 additions and 0 deletions

View File

@ -144,3 +144,75 @@ 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;

View File

@ -117,3 +117,64 @@ 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 {};