Rename method to parseSignedTx
This commit is contained in:
parent
0bfb5d28c1
commit
769e6ce9d3
@ -23,7 +23,7 @@ import {
|
||||
|
||||
import { pubkeyToAddress } from "./address";
|
||||
import { Caip5 } from "./caip5";
|
||||
import { parseTx } from "./decode";
|
||||
import { parseSignedTx } from "./decode";
|
||||
import { buildSignedTx, buildUnsignedTx } from "./encode";
|
||||
import { BankTokens, Erc20Token, nonceToAccountNumber, nonceToSequence } from "./types";
|
||||
|
||||
@ -81,7 +81,7 @@ export class CosmWasmCodec implements TxCodec {
|
||||
throw new Error("Nonce is required");
|
||||
}
|
||||
const parsed = unmarshalTx(bytes);
|
||||
return parseTx(parsed, chainId, nonce, this.bankTokens);
|
||||
return parseSignedTx(parsed, chainId, nonce, this.bankTokens);
|
||||
}
|
||||
|
||||
public identityToAddress(identity: Identity): Address {
|
||||
|
||||
@ -10,7 +10,7 @@ import {
|
||||
decodeSignature,
|
||||
parseFee,
|
||||
parseMsg,
|
||||
parseTx,
|
||||
parseSignedTx,
|
||||
parseTxsResponse,
|
||||
} from "./decode";
|
||||
import { chainId, nonce, signedTxJson, txId } from "./testdata.spec";
|
||||
@ -155,9 +155,9 @@ describe("decode", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("parseTx", () => {
|
||||
describe("parseSignedTx", () => {
|
||||
it("works", () => {
|
||||
expect(parseTx(data.tx.value, chainId, nonce, defaultTokens)).toEqual(signedTxJson);
|
||||
expect(parseSignedTx(data.tx.value, chainId, nonce, defaultTokens)).toEqual(signedTxJson);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ export function parseFee(fee: types.StdFee, tokens: BankTokens): Fee {
|
||||
};
|
||||
}
|
||||
|
||||
export function parseTx(
|
||||
export function parseSignedTx(
|
||||
txValue: types.StdTx,
|
||||
chainId: ChainId,
|
||||
nonce: Nonce,
|
||||
@ -142,7 +142,7 @@ export function parseTxsResponse(
|
||||
): ConfirmedAndSignedTransaction<UnsignedTransaction> {
|
||||
const height = parseInt(response.height, 10);
|
||||
return {
|
||||
...parseTx(response.tx.value, chainId, nonce, tokens),
|
||||
...parseSignedTx(response.tx.value, chainId, nonce, tokens),
|
||||
height: height,
|
||||
confirmations: currentHeight - height + 1,
|
||||
transactionId: response.txhash as TransactionId,
|
||||
|
||||
2
packages/bcp/types/decode.d.ts
vendored
2
packages/bcp/types/decode.d.ts
vendored
@ -20,7 +20,7 @@ export declare function coinToDecimal(tokens: BankTokens, coin: types.Coin): rea
|
||||
export declare function decodeAmount(tokens: BankTokens, coin: types.Coin): Amount;
|
||||
export declare function parseMsg(msg: types.Msg, chainId: ChainId, tokens: BankTokens): UnsignedTransaction;
|
||||
export declare function parseFee(fee: types.StdFee, tokens: BankTokens): Fee;
|
||||
export declare function parseTx(
|
||||
export declare function parseSignedTx(
|
||||
txValue: types.StdTx,
|
||||
chainId: ChainId,
|
||||
nonce: Nonce,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user