From c6bbd5b60d9ec2038675f8889f765be4ee01c211 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 30 Mar 2021 10:44:26 +0200 Subject: [PATCH 1/5] stargate: Remove coinFromProto --- packages/stargate/src/aminotypes.ts | 17 ++++++++--------- packages/stargate/src/index.ts | 1 - packages/stargate/src/stargateclient.ts | 15 ++------------- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/packages/stargate/src/aminotypes.ts b/packages/stargate/src/aminotypes.ts index da7db5ff..811c4e3e 100644 --- a/packages/stargate/src/aminotypes.ts +++ b/packages/stargate/src/aminotypes.ts @@ -31,7 +31,6 @@ import { MsgEditValidator, MsgUndelegate, } from "./codec/cosmos/staking/v1beta1/tx"; -import { coinFromProto } from "./stargateclient"; export interface AminoConverter { readonly aminoType: string; @@ -50,7 +49,7 @@ function createDefaultTypes(prefix: string): Record { return { from_address: fromAddress, to_address: toAddress, - amount: amount.map(coinFromProto), + amount: amount, }; }, fromAmino: ({ from_address, to_address, amount }: AminoMsgSend["value"]): MsgSend => ({ @@ -70,7 +69,7 @@ function createDefaultTypes(prefix: string): Record { assertDefinedAndNotNull(input.coins, "missing input.amount"); return { address: input.address, - coins: input.coins.map(coinFromProto), + coins: input.coins, }; }), outputs: outputs.map((output) => { @@ -78,7 +77,7 @@ function createDefaultTypes(prefix: string): Record { assertDefinedAndNotNull(output.coins, "missing output.coins"); return { address: output.address, - coins: output.coins.map(coinFromProto), + coins: output.coins, }; }), }; @@ -100,7 +99,7 @@ function createDefaultTypes(prefix: string): Record { assertDefinedAndNotNull(amount); assertDefinedAndNotNull(depositor); return { - amount: amount.map(coinFromProto), + amount: amount, depositor: depositor, }; }, @@ -183,7 +182,7 @@ function createDefaultTypes(prefix: string): Record { delegator_address: delegatorAddress, validator_src_address: validatorSrcAddress, validator_dst_address: validatorDstAddress, - amount: coinFromProto(amount), + amount: amount, }; }, fromAmino: ({ @@ -248,7 +247,7 @@ function createDefaultTypes(prefix: string): Record { }, prefix, ), - value: coinFromProto(value), + value: value, }; }, fromAmino: ({ @@ -297,7 +296,7 @@ function createDefaultTypes(prefix: string): Record { return { delegator_address: delegatorAddress, validator_address: validatorAddress, - amount: coinFromProto(amount), + amount: amount, }; }, fromAmino: ({ @@ -371,7 +370,7 @@ function createDefaultTypes(prefix: string): Record { return { delegator_address: delegatorAddress, validator_address: validatorAddress, - amount: coinFromProto(amount), + amount: amount, }; }, fromAmino: ({ diff --git a/packages/stargate/src/index.ts b/packages/stargate/src/index.ts index 729bdac7..76357e07 100644 --- a/packages/stargate/src/index.ts +++ b/packages/stargate/src/index.ts @@ -75,7 +75,6 @@ export { BroadcastTxFailure, BroadcastTxResponse, BroadcastTxSuccess, - coinFromProto, IndexedTx, isBroadcastTxFailure, isBroadcastTxSuccess, diff --git a/packages/stargate/src/stargateclient.ts b/packages/stargate/src/stargateclient.ts index 2869a0b4..591ee5e3 100644 --- a/packages/stargate/src/stargateclient.ts +++ b/packages/stargate/src/stargateclient.ts @@ -99,15 +99,6 @@ export function assertIsBroadcastTxSuccess( } } -export function coinFromProto(input: Coin): Coin { - assertDefinedAndNotNull(input.amount); - assertDefinedAndNotNull(input.denom); - return { - amount: input.amount, - denom: input.denom, - }; -} - /** Use for testing only */ export interface PrivateStargateClient { readonly tmClient: Tendermint34Client | undefined; @@ -213,8 +204,7 @@ export class StargateClient { } public async getBalance(address: string, searchDenom: string): Promise { - const balance = await this.forceGetQueryClient().bank.balance(address, searchDenom); - return balance ? coinFromProto(balance) : null; + return this.forceGetQueryClient().bank.balance(address, searchDenom); } /** @@ -224,8 +214,7 @@ export class StargateClient { * proofs from such a method. */ public async getAllBalancesUnverified(address: string): Promise { - const balances = await this.forceGetQueryClient().bank.unverified.allBalances(address); - return balances.map(coinFromProto); + return this.forceGetQueryClient().bank.unverified.allBalances(address); } public async getTx(id: string): Promise { From 08647312bac7bd2f109b314aaabffce7150b7b69 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 30 Mar 2021 10:44:42 +0200 Subject: [PATCH 2/5] cosmwasm-stargate: Update for removed coinFromProto --- packages/cosmwasm-stargate/src/aminotypes.ts | 6 +++--- packages/cosmwasm-stargate/src/cosmwasmclient.ts | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/cosmwasm-stargate/src/aminotypes.ts b/packages/cosmwasm-stargate/src/aminotypes.ts index ce4bff4e..b79a478c 100644 --- a/packages/cosmwasm-stargate/src/aminotypes.ts +++ b/packages/cosmwasm-stargate/src/aminotypes.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/naming-convention */ import { fromBase64, fromUtf8, toBase64, toUtf8 } from "@cosmjs/encoding"; -import { AminoConverter, Coin, coinFromProto } from "@cosmjs/stargate"; +import { AminoConverter, Coin } from "@cosmjs/stargate"; import { assertDefinedAndNotNull } from "@cosmjs/utils"; import Long from "long"; @@ -167,7 +167,7 @@ export const cosmWasmTypes: Record = { code_id: codeId.toString(), label: label, init_msg: JSON.parse(fromUtf8(initMsg)), - funds: funds.map(coinFromProto), + funds: funds, admin: admin ?? undefined, }; }, @@ -231,7 +231,7 @@ export const cosmWasmTypes: Record = { sender: sender, contract: contract, msg: JSON.parse(fromUtf8(msg)), - funds: funds.map(coinFromProto), + funds: funds, }; }, fromAmino: ({ sender, contract, msg, funds }: AminoMsgExecuteContract["value"]): MsgExecuteContract => ({ diff --git a/packages/cosmwasm-stargate/src/cosmwasmclient.ts b/packages/cosmwasm-stargate/src/cosmwasmclient.ts index e0d1aca0..80ee8fd5 100644 --- a/packages/cosmwasm-stargate/src/cosmwasmclient.ts +++ b/packages/cosmwasm-stargate/src/cosmwasmclient.ts @@ -16,7 +16,6 @@ import { Block, BroadcastTxResponse, Coin, - coinFromProto, IndexedTx, isSearchByHeightQuery, isSearchBySentFromOrToQuery, @@ -144,8 +143,7 @@ export class CosmWasmClient { } public async getBalance(address: string, searchDenom: string): Promise { - const balance = await this.forceGetQueryClient().bank.balance(address, searchDenom); - return balance ? coinFromProto(balance) : null; + return this.forceGetQueryClient().bank.balance(address, searchDenom); } public async getTx(id: string): Promise { From 8fcda85e48ab99783ae6f6076a53d01360027a26 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 30 Mar 2021 10:44:59 +0200 Subject: [PATCH 3/5] Update CHANGELOG for removed coinFromProto --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ee56bfa..4674a624 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,6 +84,11 @@ and this project adheres to do not need a Tendermint RPC client and Stargate applications should use `Tendermint34Client`. +### Removed + +- @cosmjs/stargate: `coinFromProto` helper has been removed as it is no longer + needed after the `ts-proto` migration. + ## [0.24.0] - 2021-03-11 - @cosmjs/cosmwasm: This package is now deprecated. The same functionality is From d002d458de78b8cc1f68aa53e8728c7b2ef3c03a Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 30 Mar 2021 10:51:59 +0200 Subject: [PATCH 4/5] stargate: Simplify amino types checks --- packages/stargate/src/aminotypes.ts | 119 ++++++------------------ packages/stargate/src/stargateclient.ts | 1 - 2 files changed, 30 insertions(+), 90 deletions(-) diff --git a/packages/stargate/src/aminotypes.ts b/packages/stargate/src/aminotypes.ts index 811c4e3e..d4b31872 100644 --- a/packages/stargate/src/aminotypes.ts +++ b/packages/stargate/src/aminotypes.ts @@ -42,16 +42,11 @@ function createDefaultTypes(prefix: string): Record { return { "/cosmos.bank.v1beta1.MsgSend": { aminoType: "cosmos-sdk/MsgSend", - toAmino: ({ fromAddress, toAddress, amount }: MsgSend): AminoMsgSend["value"] => { - assertDefinedAndNotNull(fromAddress, "missing fromAddress"); - assertDefinedAndNotNull(toAddress, "missing toAddress"); - assertDefinedAndNotNull(amount, "missing amount"); - return { - from_address: fromAddress, - to_address: toAddress, - amount: amount, - }; - }, + toAmino: ({ fromAddress, toAddress, amount }: MsgSend): AminoMsgSend["value"] => ({ + from_address: fromAddress, + to_address: toAddress, + amount: [...amount], + }), fromAmino: ({ from_address, to_address, amount }: AminoMsgSend["value"]): MsgSend => ({ fromAddress: from_address, toAddress: to_address, @@ -60,28 +55,16 @@ function createDefaultTypes(prefix: string): Record { }, "/cosmos.bank.v1beta1.MsgMultiSend": { aminoType: "cosmos-sdk/MsgMultiSend", - toAmino: ({ inputs, outputs }: MsgMultiSend): AminoMsgMultiSend["value"] => { - assertDefinedAndNotNull(inputs, "missing inputs"); - assertDefinedAndNotNull(outputs, "missing outputs"); - return { - inputs: inputs.map((input) => { - assertDefinedAndNotNull(input.address, "missing input.address"); - assertDefinedAndNotNull(input.coins, "missing input.amount"); - return { - address: input.address, - coins: input.coins, - }; - }), - outputs: outputs.map((output) => { - assertDefinedAndNotNull(output.address, "missing output.address"); - assertDefinedAndNotNull(output.coins, "missing output.coins"); - return { - address: output.address, - coins: output.coins, - }; - }), - }; - }, + toAmino: ({ inputs, outputs }: MsgMultiSend): AminoMsgMultiSend["value"] => ({ + inputs: inputs.map((input) => ({ + address: input.address, + coins: [...input.coins], + })), + outputs: outputs.map((output) => ({ + address: output.address, + coins: [...output.coins], + })), + }), fromAmino: ({ inputs, outputs }: AminoMsgMultiSend["value"]): MsgMultiSend => ({ inputs: inputs.map((input) => ({ address: input.address, @@ -95,14 +78,10 @@ function createDefaultTypes(prefix: string): Record { }, "/cosmos.distribution.v1beta1.MsgFundCommunityPool": { aminoType: "cosmos-sdk/MsgFundCommunityPool", - toAmino: ({ amount, depositor }: MsgFundCommunityPool): AminoMsgFundCommunityPool["value"] => { - assertDefinedAndNotNull(amount); - assertDefinedAndNotNull(depositor); - return { - amount: amount, - depositor: depositor, - }; - }, + toAmino: ({ amount, depositor }: MsgFundCommunityPool): AminoMsgFundCommunityPool["value"] => ({ + amount: [...amount], + depositor: depositor, + }), fromAmino: ({ amount, depositor }: AminoMsgFundCommunityPool["value"]): MsgFundCommunityPool => ({ amount: [...amount], depositor: depositor, @@ -113,14 +92,10 @@ function createDefaultTypes(prefix: string): Record { toAmino: ({ delegatorAddress, withdrawAddress, - }: MsgSetWithdrawAddress): AminoMsgSetWithdrawAddress["value"] => { - assertDefinedAndNotNull(delegatorAddress); - assertDefinedAndNotNull(withdrawAddress); - return { - delegator_address: delegatorAddress, - withdraw_address: withdrawAddress, - }; - }, + }: MsgSetWithdrawAddress): AminoMsgSetWithdrawAddress["value"] => ({ + delegator_address: delegatorAddress, + withdraw_address: withdrawAddress, + }), fromAmino: ({ delegator_address, withdraw_address, @@ -134,14 +109,10 @@ function createDefaultTypes(prefix: string): Record { toAmino: ({ delegatorAddress, validatorAddress, - }: MsgWithdrawDelegatorReward): AminoMsgWithdrawDelegatorReward["value"] => { - assertDefinedAndNotNull(delegatorAddress); - assertDefinedAndNotNull(validatorAddress); - return { - delegator_address: delegatorAddress, - validator_address: validatorAddress, - }; - }, + }: MsgWithdrawDelegatorReward): AminoMsgWithdrawDelegatorReward["value"] => ({ + delegator_address: delegatorAddress, + validator_address: validatorAddress, + }), fromAmino: ({ delegator_address, validator_address, @@ -154,12 +125,9 @@ function createDefaultTypes(prefix: string): Record { aminoType: "cosmos-sdk/MsgWithdrawValidatorCommission", toAmino: ({ validatorAddress, - }: MsgWithdrawValidatorCommission): AminoMsgWithdrawValidatorCommission["value"] => { - assertDefinedAndNotNull(validatorAddress); - return { - validator_address: validatorAddress, - }; - }, + }: MsgWithdrawValidatorCommission): AminoMsgWithdrawValidatorCommission["value"] => ({ + validator_address: validatorAddress, + }), fromAmino: ({ validator_address, }: AminoMsgWithdrawValidatorCommission["value"]): MsgWithdrawValidatorCommission => ({ @@ -174,9 +142,6 @@ function createDefaultTypes(prefix: string): Record { validatorDstAddress, amount, }: MsgBeginRedelegate): AminoMsgBeginRedelegate["value"] => { - assertDefinedAndNotNull(delegatorAddress, "missing delegatorAddress"); - assertDefinedAndNotNull(validatorSrcAddress, "missing validatorSrcAddress"); - assertDefinedAndNotNull(validatorDstAddress, "missing validatorDstAddress"); assertDefinedAndNotNull(amount, "missing amount"); return { delegator_address: delegatorAddress, @@ -209,20 +174,8 @@ function createDefaultTypes(prefix: string): Record { value, }: MsgCreateValidator): AminoMsgCreateValidator["value"] => { assertDefinedAndNotNull(description, "missing description"); - assertDefinedAndNotNull(description.moniker, "missing description.moniker"); - assertDefinedAndNotNull(description.identity, "missing description.identity"); - assertDefinedAndNotNull(description.website, "missing description.website"); - assertDefinedAndNotNull(description.securityContact, "missing description.securityContact"); - assertDefinedAndNotNull(description.details, "missing description.details"); assertDefinedAndNotNull(commission, "missing commission"); - assertDefinedAndNotNull(commission.rate, "missing commission.rate"); - assertDefinedAndNotNull(commission.maxRate, "missing commission.maxRate"); - assertDefinedAndNotNull(commission.maxChangeRate, "missing commission.maxChangeRate"); - assertDefinedAndNotNull(minSelfDelegation, "missing minSelfDelegation"); - assertDefinedAndNotNull(delegatorAddress, "missing delegatorAddress"); - assertDefinedAndNotNull(validatorAddress, "missing validatorAddress"); assertDefinedAndNotNull(pubkey, "missing pubkey"); - assertDefinedAndNotNull(pubkey.value, "missing pubkey.value"); assertDefinedAndNotNull(value, "missing value"); return { description: { @@ -290,8 +243,6 @@ function createDefaultTypes(prefix: string): Record { "/cosmos.staking.v1beta1.MsgDelegate": { aminoType: "cosmos-sdk/MsgDelegate", toAmino: ({ delegatorAddress, validatorAddress, amount }: MsgDelegate): AminoMsgDelegate["value"] => { - assertDefinedAndNotNull(delegatorAddress, "missing delegatorAddress"); - assertDefinedAndNotNull(validatorAddress, "missing validatorAddress"); assertDefinedAndNotNull(amount, "missing amount"); return { delegator_address: delegatorAddress, @@ -318,14 +269,6 @@ function createDefaultTypes(prefix: string): Record { validatorAddress, }: MsgEditValidator): AminoMsgEditValidator["value"] => { assertDefinedAndNotNull(description, "missing description"); - assertDefinedAndNotNull(description.moniker, "missing description.moniker"); - assertDefinedAndNotNull(description.identity, "missing description.identity"); - assertDefinedAndNotNull(description.website, "missing description.website"); - assertDefinedAndNotNull(description.securityContact, "missing description.securityContact"); - assertDefinedAndNotNull(description.details, "missing description.details"); - assertDefinedAndNotNull(commissionRate, "missing commissionRate"); - assertDefinedAndNotNull(minSelfDelegation, "missing minSelfDelegation"); - assertDefinedAndNotNull(validatorAddress, "missing validatorAddress"); return { description: { moniker: description.moniker, @@ -364,8 +307,6 @@ function createDefaultTypes(prefix: string): Record { validatorAddress, amount, }: MsgUndelegate): AminoMsgUndelegate["value"] => { - assertDefinedAndNotNull(delegatorAddress, "missing delegatorAddress"); - assertDefinedAndNotNull(validatorAddress, "missing validatorAddress"); assertDefinedAndNotNull(amount, "missing amount"); return { delegator_address: delegatorAddress, diff --git a/packages/stargate/src/stargateclient.ts b/packages/stargate/src/stargateclient.ts index 591ee5e3..a97c7e46 100644 --- a/packages/stargate/src/stargateclient.ts +++ b/packages/stargate/src/stargateclient.ts @@ -6,7 +6,6 @@ import { Tendermint34Client, toRfc3339WithNanoseconds, } from "@cosmjs/tendermint-rpc"; -import { assertDefinedAndNotNull } from "@cosmjs/utils"; import { Account, accountFromAny } from "./accounts"; import { MsgData, TxMsgData } from "./codec/cosmos/base/abci/v1beta1/abci"; From 45b09344e0a351b4c2aea81bb932489620774739 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 30 Mar 2021 10:54:20 +0200 Subject: [PATCH 5/5] cosmwasm-stargate: Simplify amino types checks --- packages/cosmwasm-stargate/src/aminotypes.ts | 105 +++++++------------ 1 file changed, 35 insertions(+), 70 deletions(-) diff --git a/packages/cosmwasm-stargate/src/aminotypes.ts b/packages/cosmwasm-stargate/src/aminotypes.ts index b79a478c..3a990468 100644 --- a/packages/cosmwasm-stargate/src/aminotypes.ts +++ b/packages/cosmwasm-stargate/src/aminotypes.ts @@ -1,7 +1,6 @@ /* eslint-disable @typescript-eslint/naming-convention */ import { fromBase64, fromUtf8, toBase64, toUtf8 } from "@cosmjs/encoding"; import { AminoConverter, Coin } from "@cosmjs/stargate"; -import { assertDefinedAndNotNull } from "@cosmjs/utils"; import Long from "long"; import { @@ -127,18 +126,12 @@ export interface AminoMsgClearAdmin { export const cosmWasmTypes: Record = { "/cosmwasm.wasm.v1beta1.MsgStoreCode": { aminoType: "wasm/MsgStoreCode", - toAmino: ({ sender, wasmByteCode, source, builder }: MsgStoreCode): AminoMsgStoreCode["value"] => { - assertDefinedAndNotNull(sender, "missing sender"); - assertDefinedAndNotNull(wasmByteCode, "missing wasmByteCode"); - assertDefinedAndNotNull(source, "missing source"); - assertDefinedAndNotNull(builder, "missing builder"); - return { - sender: sender, - wasm_byte_code: toBase64(wasmByteCode), - source: source, - builder: builder, - }; - }, + toAmino: ({ sender, wasmByteCode, source, builder }: MsgStoreCode): AminoMsgStoreCode["value"] => ({ + sender: sender, + wasm_byte_code: toBase64(wasmByteCode), + source: source, + builder: builder, + }), fromAmino: ({ sender, wasm_byte_code, source, builder }: AminoMsgStoreCode["value"]): MsgStoreCode => ({ sender: sender, wasmByteCode: fromBase64(wasm_byte_code), @@ -156,21 +149,14 @@ export const cosmWasmTypes: Record = { initMsg, funds, admin, - }: MsgInstantiateContract): AminoMsgInstantiateContract["value"] => { - assertDefinedAndNotNull(sender, "missing sender"); - assertDefinedAndNotNull(codeId, "missing codeId"); - assertDefinedAndNotNull(label, "missing label"); - assertDefinedAndNotNull(initMsg, "missing initMsg"); - assertDefinedAndNotNull(funds, "missing funds"); - return { - sender: sender, - code_id: codeId.toString(), - label: label, - init_msg: JSON.parse(fromUtf8(initMsg)), - funds: funds, - admin: admin ?? undefined, - }; - }, + }: MsgInstantiateContract): AminoMsgInstantiateContract["value"] => ({ + sender: sender, + code_id: codeId.toString(), + label: label, + init_msg: JSON.parse(fromUtf8(initMsg)), + funds: funds, + admin: admin ?? undefined, + }), fromAmino: ({ sender, code_id, @@ -189,16 +175,11 @@ export const cosmWasmTypes: Record = { }, "/cosmwasm.wasm.v1beta1.MsgUpdateAdmin": { aminoType: "wasm/MsgUpdateAdmin", - toAmino: ({ sender, newAdmin, contract }: MsgUpdateAdmin): AminoMsgUpdateAdmin["value"] => { - assertDefinedAndNotNull(sender, "missing sender"); - assertDefinedAndNotNull(newAdmin, "missing newAdmin"); - assertDefinedAndNotNull(contract, "missing contract"); - return { - sender: sender, - new_admin: newAdmin, - contract: contract, - }; - }, + toAmino: ({ sender, newAdmin, contract }: MsgUpdateAdmin): AminoMsgUpdateAdmin["value"] => ({ + sender: sender, + new_admin: newAdmin, + contract: contract, + }), fromAmino: ({ sender, new_admin, contract }: AminoMsgUpdateAdmin["value"]): MsgUpdateAdmin => ({ sender: sender, newAdmin: new_admin, @@ -207,14 +188,10 @@ export const cosmWasmTypes: Record = { }, "/cosmwasm.wasm.v1beta1.MsgClearAdmin": { aminoType: "wasm/MsgClearAdmin", - toAmino: ({ sender, contract }: MsgClearAdmin): AminoMsgClearAdmin["value"] => { - assertDefinedAndNotNull(sender, "missing sender"); - assertDefinedAndNotNull(contract, "missing contract"); - return { - sender: sender, - contract: contract, - }; - }, + toAmino: ({ sender, contract }: MsgClearAdmin): AminoMsgClearAdmin["value"] => ({ + sender: sender, + contract: contract, + }), fromAmino: ({ sender, contract }: AminoMsgClearAdmin["value"]): MsgClearAdmin => ({ sender: sender, contract: contract, @@ -222,18 +199,12 @@ export const cosmWasmTypes: Record = { }, "/cosmwasm.wasm.v1beta1.MsgExecuteContract": { aminoType: "wasm/MsgExecuteContract", - toAmino: ({ sender, contract, msg, funds }: MsgExecuteContract): AminoMsgExecuteContract["value"] => { - assertDefinedAndNotNull(sender, "missing sender"); - assertDefinedAndNotNull(contract, "missing contract"); - assertDefinedAndNotNull(msg, "missing msg"); - assertDefinedAndNotNull(funds, "missing funds"); - return { - sender: sender, - contract: contract, - msg: JSON.parse(fromUtf8(msg)), - funds: funds, - }; - }, + toAmino: ({ sender, contract, msg, funds }: MsgExecuteContract): AminoMsgExecuteContract["value"] => ({ + sender: sender, + contract: contract, + msg: JSON.parse(fromUtf8(msg)), + funds: funds, + }), fromAmino: ({ sender, contract, msg, funds }: AminoMsgExecuteContract["value"]): MsgExecuteContract => ({ sender: sender, contract: contract, @@ -248,18 +219,12 @@ export const cosmWasmTypes: Record = { contract, codeId, migrateMsg, - }: MsgMigrateContract): AminoMsgMigrateContract["value"] => { - assertDefinedAndNotNull(sender, "missing sender"); - assertDefinedAndNotNull(contract, "missing contract"); - assertDefinedAndNotNull(codeId, "missing codeId"); - assertDefinedAndNotNull(migrateMsg, "missing migrateMsg"); - return { - sender: sender, - contract: contract, - code_id: codeId.toString(), - msg: JSON.parse(fromUtf8(migrateMsg)), - }; - }, + }: MsgMigrateContract): AminoMsgMigrateContract["value"] => ({ + sender: sender, + contract: contract, + code_id: codeId.toString(), + msg: JSON.parse(fromUtf8(migrateMsg)), + }), fromAmino: ({ sender, contract,