Move makeSignedTx to testutils

This commit is contained in:
Simon Warta 2020-07-07 10:57:48 +02:00
parent 21898bc8bd
commit e121ea9d08
2 changed files with 12 additions and 22 deletions

View File

@ -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,

View File

@ -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<T>(elements: ArrayLike<T>): 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],
};
}