mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-11 14:09:15 +00:00
cosmwasm: Add CosmosMsg types
This commit is contained in:
parent
9580d2f895
commit
7b65945f7f
@ -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;
|
||||
|
61
packages/cosmwasm/types/msgs.d.ts
vendored
61
packages/cosmwasm/types/msgs.d.ts
vendored
@ -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 {};
|
||||
|
Loading…
x
Reference in New Issue
Block a user