From e121ea9d08e5db8e6d8f37597af88624baf2eb96 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Tue, 7 Jul 2020 10:57:48 +0200 Subject: [PATCH] Move makeSignedTx to testutils --- packages/cosmwasm/src/restclient.spec.ts | 24 ++---------------------- packages/cosmwasm/src/testutils.spec.ts | 10 ++++++++++ 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/packages/cosmwasm/src/restclient.spec.ts b/packages/cosmwasm/src/restclient.spec.ts index 3b45542a..7afcd29a 100644 --- a/packages/cosmwasm/src/restclient.spec.ts +++ b/packages/cosmwasm/src/restclient.spec.ts @@ -1,19 +1,7 @@ /* eslint-disable @typescript-eslint/camelcase */ import { Sha256 } from "@cosmjs/crypto"; import { Bech32, fromAscii, fromBase64, fromHex, toAscii, toBase64, toHex } from "@cosmjs/encoding"; -import { - Coin, - coin, - coins, - makeSignBytes, - Msg, - Pen, - PostTxsResponse, - Secp256k1Pen, - StdFee, - StdSignature, - StdTx, -} from "@cosmjs/sdk38"; +import { Coin, coin, coins, makeSignBytes, Pen, PostTxsResponse, Secp256k1Pen, StdFee } from "@cosmjs/sdk38"; import { assert } from "@cosmjs/utils"; import { findAttribute, parseLogs } from "./logs"; @@ -33,20 +21,12 @@ import { fromOneElementArray, getHackatom, makeRandomAddress, + makeSignedTx, pendingWithoutWasmd, wasmd, wasmdEnabled, } from "./testutils.spec"; -function makeSignedTx(firstMsg: Msg, fee: StdFee, memo: string, firstSignature: StdSignature): StdTx { - return { - msg: [firstMsg], - fee: fee, - memo: memo, - signatures: [firstSignature], - }; -} - async function uploadContract( client: RestClient, pen: Pen, diff --git a/packages/cosmwasm/src/testutils.spec.ts b/packages/cosmwasm/src/testutils.spec.ts index e2fb52f6..5cfe24a4 100644 --- a/packages/cosmwasm/src/testutils.spec.ts +++ b/packages/cosmwasm/src/testutils.spec.ts @@ -1,5 +1,6 @@ import { Random } from "@cosmjs/crypto"; import { Bech32, fromBase64 } from "@cosmjs/encoding"; +import { Msg, StdFee, StdSignature, StdTx } from "@cosmjs/sdk38"; import hackatom from "./testdata/contract.json"; @@ -85,3 +86,12 @@ export function fromOneElementArray(elements: ArrayLike): T { if (elements.length !== 1) throw new Error(`Expected exactly one element but got ${elements.length}`); return elements[0]; } + +export function makeSignedTx(firstMsg: Msg, fee: StdFee, memo: string, firstSignature: StdSignature): StdTx { + return { + msg: [firstMsg], + fee: fee, + memo: memo, + signatures: [firstSignature], + }; +}