diff --git a/packages/sdk/src/types.ts b/packages/sdk/src/types.ts index 5c3f1d60..23fdca3b 100644 --- a/packages/sdk/src/types.ts +++ b/packages/sdk/src/types.ts @@ -27,48 +27,53 @@ interface MsgTemplate { readonly value: object; } -export interface ValueSend { - /** Bech32 account address */ - readonly from_address: string; - /** Bech32 account address */ - readonly to_address: string; - readonly amount: ReadonlyArray; -} - +/** A Cosmos SDK token transfer message */ export interface MsgSend extends MsgTemplate { readonly type: "cosmos-sdk/MsgSend"; - readonly value: ValueSend; -} - -export interface ValueStoreCode { - /** Bech32 account address */ - readonly sender: string; - /** Base64 encoded Wasm */ - readonly wasm_byte_code: string; - /** A valid URI reference to the contract's source code, optional */ - readonly source?: string; - /** A docker tag, optional */ - readonly builder?: string; + readonly value: { + /** Bech32 account address */ + readonly from_address: string; + /** Bech32 account address */ + readonly to_address: string; + readonly amount: ReadonlyArray; + }; } +/** + * Uploads Wam code to the chain + * + * @see https://github.com/cosmwasm/wasmd/blob/9842678d89/x/wasm/internal/types/msg.go#L17 + */ export interface MsgStoreCode extends MsgTemplate { readonly type: "wasm/store-code"; - readonly value: ValueStoreCode; -} - -export interface ValueInstantiateContract { - /** Bech32 account address */ - readonly sender: string; - /** ID of the Wasm code that was uploaded before */ - readonly code_id: string; - /** Init message as JavaScript object */ - readonly init_msg: object; - readonly init_funds: ReadonlyArray; + readonly value: { + /** Bech32 account address */ + readonly sender: string; + /** Base64 encoded Wasm */ + readonly wasm_byte_code: string; + /** A valid URI reference to the contract's source code, optional */ + readonly source?: string; + /** A docker tag, optional */ + readonly builder?: string; + }; } +/** + * Creates an instance of contract that was uploaded before. + * + * @see https://github.com/cosmwasm/wasmd/blob/9842678d89/x/wasm/internal/types/msg.go#L73 + */ export interface MsgInstantiateContract extends MsgTemplate { readonly type: "wasm/instantiate"; - readonly value: ValueInstantiateContract; + readonly value: { + /** Bech32 account address */ + readonly sender: string; + /** ID of the Wasm code that was uploaded before */ + readonly code_id: string; + /** Init message as JavaScript object */ + readonly init_msg: object; + readonly init_funds: ReadonlyArray; + }; } export type Msg = MsgSend | MsgStoreCode | MsgInstantiateContract | MsgTemplate; diff --git a/packages/sdk/types/types.d.ts b/packages/sdk/types/types.d.ts index 81880b03..cbb86dec 100644 --- a/packages/sdk/types/types.d.ts +++ b/packages/sdk/types/types.d.ts @@ -16,43 +16,51 @@ interface MsgTemplate { readonly type: string; readonly value: object; } -export interface ValueSend { - /** Bech32 account address */ - readonly from_address: string; - /** Bech32 account address */ - readonly to_address: string; - readonly amount: ReadonlyArray; -} +/** A Cosmos SDK token transfer message */ export interface MsgSend extends MsgTemplate { readonly type: "cosmos-sdk/MsgSend"; - readonly value: ValueSend; -} -export interface ValueStoreCode { - /** Bech32 account address */ - readonly sender: string; - /** Base64 encoded Wasm */ - readonly wasm_byte_code: string; - /** A valid URI reference to the contract's source code, optional */ - readonly source?: string; - /** A docker tag, optional */ - readonly builder?: string; + readonly value: { + /** Bech32 account address */ + readonly from_address: string; + /** Bech32 account address */ + readonly to_address: string; + readonly amount: ReadonlyArray; + }; } +/** + * Uploads Wam code to the chain + * + * @see https://github.com/cosmwasm/wasmd/blob/9842678d89/x/wasm/internal/types/msg.go#L17 + */ export interface MsgStoreCode extends MsgTemplate { readonly type: "wasm/store-code"; - readonly value: ValueStoreCode; -} -export interface ValueInstantiateContract { - /** Bech32 account address */ - readonly sender: string; - /** ID of the Wasm code that was uploaded before */ - readonly code_id: string; - /** Init message as JavaScript object */ - readonly init_msg: object; - readonly init_funds: ReadonlyArray; + readonly value: { + /** Bech32 account address */ + readonly sender: string; + /** Base64 encoded Wasm */ + readonly wasm_byte_code: string; + /** A valid URI reference to the contract's source code, optional */ + readonly source?: string; + /** A docker tag, optional */ + readonly builder?: string; + }; } +/** + * Creates an instance of contract that was uploaded before. + * + * @see https://github.com/cosmwasm/wasmd/blob/9842678d89/x/wasm/internal/types/msg.go#L73 + */ export interface MsgInstantiateContract extends MsgTemplate { readonly type: "wasm/instantiate"; - readonly value: ValueInstantiateContract; + readonly value: { + /** Bech32 account address */ + readonly sender: string; + /** ID of the Wasm code that was uploaded before */ + readonly code_id: string; + /** Init message as JavaScript object */ + readonly init_msg: object; + readonly init_funds: ReadonlyArray; + }; } export declare type Msg = MsgSend | MsgStoreCode | MsgInstantiateContract | MsgTemplate; export declare function isMsgSend(msg: Msg): msg is MsgSend;