Pull out makeSignedTx
This commit is contained in:
parent
4d28701930
commit
855ce0bb4a
@ -7,7 +7,7 @@ import { isPostTxFailure } from "./cosmosclient";
|
||||
import { makeSignBytes } from "./encoding";
|
||||
import { LcdApiArray, LcdClient, normalizeArray } from "./lcdclient";
|
||||
import { parseLogs } from "./logs";
|
||||
import { Msg, MsgSend } from "./msgs";
|
||||
import { MsgSend } from "./msgs";
|
||||
import { makeCosmoshubPath, Secp256k1Pen } from "./pen";
|
||||
import { BroadcastMode, TxsResponse } from "./restclient";
|
||||
import { SigningCosmosClient } from "./signingcosmosclient";
|
||||
@ -15,13 +15,14 @@ import cosmoshub from "./testdata/cosmoshub.json";
|
||||
import {
|
||||
faucet,
|
||||
makeRandomAddress,
|
||||
makeSignedTx,
|
||||
nonNegativeIntegerMatcher,
|
||||
pendingWithoutWasmd,
|
||||
tendermintIdMatcher,
|
||||
wasmd,
|
||||
wasmdEnabled,
|
||||
} from "./testutils.spec";
|
||||
import { StdFee, StdSignature, StdTx } from "./types";
|
||||
import { StdFee } from "./types";
|
||||
|
||||
/** Deployed as part of scripts/wasmd/init.sh */
|
||||
export const deployedErc20 = {
|
||||
@ -36,15 +37,6 @@ export const deployedErc20 = {
|
||||
],
|
||||
};
|
||||
|
||||
function makeSignedTx(firstMsg: Msg, fee: StdFee, memo: string, firstSignature: StdSignature): StdTx {
|
||||
return {
|
||||
msg: [firstMsg],
|
||||
fee: fee,
|
||||
memo: memo,
|
||||
signatures: [firstSignature],
|
||||
};
|
||||
}
|
||||
|
||||
describe("LcdClient", () => {
|
||||
const defaultRecipientAddress = makeRandomAddress();
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ import { rawSecp256k1PubkeyToAddress } from "./address";
|
||||
import { isPostTxFailure } from "./cosmosclient";
|
||||
import { makeSignBytes } from "./encoding";
|
||||
import { parseLogs } from "./logs";
|
||||
import { Msg, MsgSend } from "./msgs";
|
||||
import { MsgSend } from "./msgs";
|
||||
import { makeCosmoshubPath, Secp256k1Pen } from "./pen";
|
||||
import { encodeBech32Pubkey } from "./pubkey";
|
||||
import { RestClient, TxsResponse } from "./restclient";
|
||||
@ -15,6 +15,7 @@ import cosmoshub from "./testdata/cosmoshub.json";
|
||||
import {
|
||||
faucet,
|
||||
makeRandomAddress,
|
||||
makeSignedTx,
|
||||
nonNegativeIntegerMatcher,
|
||||
pendingWithoutWasmd,
|
||||
semverMatcher,
|
||||
@ -26,16 +27,7 @@ import {
|
||||
wasmd,
|
||||
wasmdEnabled,
|
||||
} from "./testutils.spec";
|
||||
import { StdFee, StdSignature, StdTx } from "./types";
|
||||
|
||||
function makeSignedTx(firstMsg: Msg, fee: StdFee, memo: string, firstSignature: StdSignature): StdTx {
|
||||
return {
|
||||
msg: [firstMsg],
|
||||
fee: fee,
|
||||
memo: memo,
|
||||
signatures: [firstSignature],
|
||||
};
|
||||
}
|
||||
import { StdFee } from "./types";
|
||||
|
||||
describe("RestClient", () => {
|
||||
const defaultRecipientAddress = makeRandomAddress();
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
import { Random } from "@cosmjs/crypto";
|
||||
import { Bech32 } from "@cosmjs/encoding";
|
||||
|
||||
import { Msg } from "./msgs";
|
||||
import { StdFee, StdSignature, StdTx } from "./types";
|
||||
|
||||
export function makeRandomAddress(): string {
|
||||
return Bech32.encode("cosmos", Random.getBytes(20));
|
||||
}
|
||||
@ -56,3 +59,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],
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user