Avoid innecessary Value* types; Add docs
This commit is contained in:
parent
6083c3f7ea
commit
68670fc8a1
@ -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<Coin>;
|
||||
}
|
||||
|
||||
/** 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<Coin>;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<Coin>;
|
||||
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<Coin>;
|
||||
};
|
||||
}
|
||||
|
||||
export type Msg = MsgSend | MsgStoreCode | MsgInstantiateContract | MsgTemplate;
|
||||
|
||||
66
packages/sdk/types/types.d.ts
vendored
66
packages/sdk/types/types.d.ts
vendored
@ -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<Coin>;
|
||||
}
|
||||
/** 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<Coin>;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* 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<Coin>;
|
||||
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<Coin>;
|
||||
};
|
||||
}
|
||||
export declare type Msg = MsgSend | MsgStoreCode | MsgInstantiateContract | MsgTemplate;
|
||||
export declare function isMsgSend(msg: Msg): msg is MsgSend;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user