Use any instead of object, which allows accessing members unknown to the type system

This commit is contained in:
Simon Warta 2020-03-06 11:03:48 +01:00
parent fae28ab0e4
commit a1f487ebb4
3 changed files with 8 additions and 8 deletions

View File

@ -101,10 +101,10 @@ export function parseMsg(
};
}
const recipient: string | undefined = (msg.value.msg as any).transfer?.recipient;
const recipient: string | undefined = msg.value.msg.transfer?.recipient;
if (!recipient) throw new Error("Could not read recipient");
const amount: string | undefined = (msg.value.msg as any).transfer?.amount;
const amount: string | undefined = msg.value.msg.transfer?.amount;
if (!amount) throw new Error("Could not read recipient");
const send: SendTransaction = {

View File

@ -24,7 +24,7 @@ export interface CosmosSdkTx {
interface MsgTemplate {
readonly type: string;
readonly value: object;
readonly value: any;
}
/** A Cosmos SDK token transfer message */
@ -73,7 +73,7 @@ export interface MsgInstantiateContract extends MsgTemplate {
/** Human-readable label for this contract */
readonly label: string;
/** Init message as JavaScript object */
readonly init_msg: object;
readonly init_msg: any;
readonly init_funds: ReadonlyArray<Coin>;
};
}
@ -91,7 +91,7 @@ export interface MsgExecuteContract extends MsgTemplate {
/** Bech32 account address */
readonly contract: string;
/** Handle message as JavaScript object */
readonly msg: object;
readonly msg: any;
readonly sent_funds: ReadonlyArray<Coin>;
};
}

View File

@ -12,7 +12,7 @@ export interface CosmosSdkTx {
}
interface MsgTemplate {
readonly type: string;
readonly value: object;
readonly value: any;
}
/** A Cosmos SDK token transfer message */
export interface MsgSend extends MsgTemplate {
@ -58,7 +58,7 @@ export interface MsgInstantiateContract extends MsgTemplate {
/** Human-readable label for this contract */
readonly label: string;
/** Init message as JavaScript object */
readonly init_msg: object;
readonly init_msg: any;
readonly init_funds: ReadonlyArray<Coin>;
};
}
@ -75,7 +75,7 @@ export interface MsgExecuteContract extends MsgTemplate {
/** Bech32 account address */
readonly contract: string;
/** Handle message as JavaScript object */
readonly msg: object;
readonly msg: any;
readonly sent_funds: ReadonlyArray<Coin>;
};
}