Simplify name to makeSignDoc
This commit is contained in:
parent
14c285748a
commit
1b0eec8ed3
@ -46,14 +46,14 @@
|
||||
- @cosmjs/launchpad: Change type of `TxsResponse.logs` and
|
||||
`BroadcastTxsResponse.logs` to `unknown[]`.
|
||||
- @cosmjs/launchpad: Export `StdSignDoc` and create helpers to make and
|
||||
serialize a `StdSignDoc`: `makeStdSignDoc` and `serializeSignDoc`.
|
||||
serialize a `StdSignDoc`: `makeSignDoc` and `serializeSignDoc`.
|
||||
- @cosmjs/launchpad: Let `OfflineSigner.sign` take an `StdSignDoc` instead of an
|
||||
encoded message and return a `SignResponse` that includes the document which
|
||||
was signed.
|
||||
- @cosmjs/launchpad: Remove `PrehashType` and the prehash type argument in
|
||||
`OfflineSigner.sign` because the signer now needs to know how to serialize an
|
||||
`StdSignDoc`.
|
||||
- @cosmjs/launchpad: Remove `makeSignBytes` in favour of `makeStdSignDoc` and
|
||||
- @cosmjs/launchpad: Remove `makeSignBytes` in favour of `makeSignDoc` and
|
||||
`serializeSignDoc`.
|
||||
- @cosmjs/launchpad-ledger: Add package supporting Ledger device integration for
|
||||
Launchpad. Two new classes are provided: `LedgerSigner` (for most use cases)
|
||||
|
||||
@ -66,7 +66,7 @@ const sendTokensMsg: MsgSend = {
|
||||
},
|
||||
};
|
||||
|
||||
const signDoc = makeStdSignDoc(
|
||||
const signDoc = makeSignDoc(
|
||||
[sendTokensMsg],
|
||||
defaultFee,
|
||||
defaultNetworkId,
|
||||
|
||||
@ -27,7 +27,7 @@ console.log("Connected to chain:", chainId);
|
||||
const { accountNumber, sequence } = await client.getSequence(senderAddress);
|
||||
console.log("Account/sequence:", accountNumber, sequence);
|
||||
|
||||
const signDoc = makeStdSignDoc([msg], fee, chainId, memo, accountNumber, sequence);
|
||||
const signDoc = makeSignDoc([msg], fee, chainId, memo, accountNumber, sequence);
|
||||
const { signature } = await wallet.sign(senderAddress, signDoc);
|
||||
const signedTx: StdTx = {
|
||||
msg: [msg],
|
||||
|
||||
@ -98,7 +98,7 @@ export async function main(originalArgs: readonly string[]): Promise<void> {
|
||||
"encodeSecp256k1Signature",
|
||||
"logs",
|
||||
"makeCosmoshubPath",
|
||||
"makeStdSignDoc",
|
||||
"makeSignDoc",
|
||||
"IndexedTx",
|
||||
"BroadcastTxResult",
|
||||
"Coin",
|
||||
@ -166,7 +166,7 @@ export async function main(originalArgs: readonly string[]): Promise<void> {
|
||||
amount: coins(5000000, "ucosm"),
|
||||
gas: "89000000",
|
||||
};
|
||||
const signDoc = makeStdSignDoc([], fee, "chain-xyz", "hello, world", 1, 2);
|
||||
const signDoc = makeSignDoc([], fee, "chain-xyz", "hello, world", 1, 2);
|
||||
const { signed, signature } = await wallet.sign(address, signDoc);
|
||||
assert(signed.memo === "hello, world");
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ import {
|
||||
isBroadcastTxFailure,
|
||||
isMsgSend,
|
||||
LcdClient,
|
||||
makeStdSignDoc,
|
||||
makeSignDoc,
|
||||
MsgSend,
|
||||
Secp256k1Wallet,
|
||||
} from "@cosmjs/launchpad";
|
||||
@ -103,7 +103,7 @@ describe("CosmWasmClient.searchTx", () => {
|
||||
};
|
||||
const { accountNumber, sequence } = await client.getSequence();
|
||||
const chainId = await client.getChainId();
|
||||
const signDoc = makeStdSignDoc([sendMsg], fee, chainId, memo, accountNumber, sequence);
|
||||
const signDoc = makeSignDoc([sendMsg], fee, chainId, memo, accountNumber, sequence);
|
||||
const { signature } = await wallet.sign(alice.address0, signDoc);
|
||||
const tx: CosmosSdkTx = {
|
||||
type: "cosmos-sdk/StdTx",
|
||||
|
||||
@ -3,7 +3,7 @@ import { Sha256 } from "@cosmjs/crypto";
|
||||
import { Bech32, fromHex, fromUtf8, toAscii, toBase64 } from "@cosmjs/encoding";
|
||||
import {
|
||||
assertIsBroadcastTxSuccess,
|
||||
makeStdSignDoc,
|
||||
makeSignDoc,
|
||||
MsgSend,
|
||||
Secp256k1Wallet,
|
||||
StdFee,
|
||||
@ -237,7 +237,7 @@ describe("CosmWasmClient", () => {
|
||||
|
||||
const chainId = await client.getChainId();
|
||||
const { accountNumber, sequence } = await client.getSequence(alice.address0);
|
||||
const signDoc = makeStdSignDoc([sendMsg], fee, chainId, memo, accountNumber, sequence);
|
||||
const signDoc = makeSignDoc([sendMsg], fee, chainId, memo, accountNumber, sequence);
|
||||
const { signature } = await wallet.sign(alice.address0, signDoc);
|
||||
const signedTx: StdTx = {
|
||||
msg: [sendMsg],
|
||||
|
||||
@ -10,7 +10,7 @@ import {
|
||||
coin,
|
||||
coins,
|
||||
LcdClient,
|
||||
makeStdSignDoc,
|
||||
makeSignDoc,
|
||||
OfflineSigner,
|
||||
Secp256k1Wallet,
|
||||
setupAuthExtension,
|
||||
@ -125,7 +125,7 @@ async function executeContract(
|
||||
};
|
||||
|
||||
const { account_number, sequence } = (await client.auth.account(alice.address0)).result.value;
|
||||
const signDoc = makeStdSignDoc([theMsg], fee, wasmd.chainId, memo, account_number, sequence);
|
||||
const signDoc = makeSignDoc([theMsg], fee, wasmd.chainId, memo, account_number, sequence);
|
||||
const { signature } = await signer.sign(alice.address0, signDoc);
|
||||
const signedTx = makeSignedTx(theMsg, fee, memo, signature);
|
||||
return client.broadcastTx(signedTx);
|
||||
|
||||
@ -11,7 +11,7 @@ import {
|
||||
GasLimits,
|
||||
GasPrice,
|
||||
isBroadcastTxFailure,
|
||||
makeStdSignDoc,
|
||||
makeSignDoc,
|
||||
Msg,
|
||||
MsgSend,
|
||||
OfflineSigner,
|
||||
@ -360,7 +360,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
|
||||
public async signAndBroadcast(msgs: readonly Msg[], fee: StdFee, memo = ""): Promise<BroadcastTxResult> {
|
||||
const { accountNumber, sequence } = await this.getSequence();
|
||||
const chainId = await this.getChainId();
|
||||
const signDoc = makeStdSignDoc(msgs, fee, chainId, memo, accountNumber, sequence);
|
||||
const signDoc = makeSignDoc(msgs, fee, chainId, memo, accountNumber, sequence);
|
||||
const { signature } = await this.signer.sign(this.senderAddress, signDoc);
|
||||
const signedTx: StdTx = {
|
||||
msg: msgs,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { toBase64 } from "@cosmjs/encoding";
|
||||
import { makeCosmoshubPath, makeStdSignDoc, StdFee, StdSignature } from "@cosmjs/launchpad";
|
||||
import { makeCosmoshubPath, makeSignDoc, StdFee, StdSignature } from "@cosmjs/launchpad";
|
||||
|
||||
import { LedgerSigner } from "../ledgersigner";
|
||||
|
||||
@ -48,14 +48,7 @@ export async function sign(
|
||||
},
|
||||
},
|
||||
];
|
||||
const signDoc = makeStdSignDoc(
|
||||
msgs,
|
||||
defaultFee,
|
||||
defaultChainId,
|
||||
defaultMemo,
|
||||
accountNumber,
|
||||
defaultSequence,
|
||||
);
|
||||
const signDoc = makeSignDoc(msgs, defaultFee, defaultChainId, defaultMemo, accountNumber, defaultSequence);
|
||||
const { signature } = await signer.sign(fromAddress, signDoc);
|
||||
return signature;
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ import { MsgExecuteContract, setupWasmExtension } from "@cosmjs/cosmwasm";
|
||||
import {
|
||||
assertIsPostTxSuccess,
|
||||
LcdClient,
|
||||
makeStdSignDoc,
|
||||
makeSignDoc,
|
||||
setupAuthExtension,
|
||||
StdFee,
|
||||
StdTx,
|
||||
@ -205,7 +205,7 @@ const memo = "Time for action";
|
||||
const { account_number, sequence } = (
|
||||
await client.auth.account(myAddress)
|
||||
).result.value;
|
||||
const signDoc = makeStdSignDoc(
|
||||
const signDoc = makeSignDoc(
|
||||
[msg],
|
||||
fee,
|
||||
apiUrl,
|
||||
|
||||
@ -3,7 +3,7 @@ import { assert, sleep } from "@cosmjs/utils";
|
||||
|
||||
import { coins } from "./coins";
|
||||
import { CosmosClient, isBroadcastTxFailure } from "./cosmosclient";
|
||||
import { makeStdSignDoc } from "./encoding";
|
||||
import { makeSignDoc } from "./encoding";
|
||||
import { LcdClient } from "./lcdapi";
|
||||
import { isMsgSend, MsgSend } from "./msgs";
|
||||
import { Secp256k1Wallet } from "./secp256k1wallet";
|
||||
@ -55,7 +55,7 @@ describe("CosmosClient.searchTx", () => {
|
||||
};
|
||||
const { accountNumber, sequence } = await client.getSequence();
|
||||
const chainId = await client.getChainId();
|
||||
const signDoc = makeStdSignDoc([sendMsg], fee, chainId, memo, accountNumber, sequence);
|
||||
const signDoc = makeSignDoc([sendMsg], fee, chainId, memo, accountNumber, sequence);
|
||||
const { signature } = await wallet.sign(walletAddress, signDoc);
|
||||
const tx: CosmosSdkTx = {
|
||||
type: "cosmos-sdk/StdTx",
|
||||
|
||||
@ -3,7 +3,7 @@ import { sleep } from "@cosmjs/utils";
|
||||
import { ReadonlyDate } from "readonly-date";
|
||||
|
||||
import { assertIsBroadcastTxSuccess, CosmosClient, PrivateCosmosClient } from "./cosmosclient";
|
||||
import { makeStdSignDoc } from "./encoding";
|
||||
import { makeSignDoc } from "./encoding";
|
||||
import { findAttribute } from "./logs";
|
||||
import { MsgSend } from "./msgs";
|
||||
import { Secp256k1Wallet } from "./secp256k1wallet";
|
||||
@ -229,7 +229,7 @@ describe("CosmosClient", () => {
|
||||
|
||||
const chainId = await client.getChainId();
|
||||
const { accountNumber, sequence } = await client.getSequence(faucet.address);
|
||||
const signDoc = makeStdSignDoc([sendMsg], fee, chainId, memo, accountNumber, sequence);
|
||||
const signDoc = makeSignDoc([sendMsg], fee, chainId, memo, accountNumber, sequence);
|
||||
const { signature } = await wallet.sign(walletAddress, signDoc);
|
||||
const signedTx: StdTx = {
|
||||
msg: [sendMsg],
|
||||
|
||||
@ -37,7 +37,7 @@ export interface StdSignDoc {
|
||||
readonly memo: string;
|
||||
}
|
||||
|
||||
export function makeStdSignDoc(
|
||||
export function makeSignDoc(
|
||||
msgs: readonly Msg[],
|
||||
fee: StdFee,
|
||||
chainId: string,
|
||||
|
||||
@ -28,7 +28,7 @@ export {
|
||||
isSearchBySentFromOrToQuery,
|
||||
isSearchByTagsQuery,
|
||||
} from "./cosmosclient";
|
||||
export { makeStdSignDoc, serializeSignDoc, StdSignDoc } from "./encoding";
|
||||
export { makeSignDoc, serializeSignDoc, StdSignDoc } from "./encoding";
|
||||
export { buildFeeTable, FeeTable, GasLimits, GasPrice } from "./gas";
|
||||
export {
|
||||
AuthAccountsResponse,
|
||||
|
||||
@ -4,7 +4,7 @@ import { sleep } from "@cosmjs/utils";
|
||||
|
||||
import { coin, coins } from "../coins";
|
||||
import { assertIsBroadcastTxSuccess } from "../cosmosclient";
|
||||
import { makeStdSignDoc } from "../encoding";
|
||||
import { makeSignDoc } from "../encoding";
|
||||
import { MsgDelegate } from "../msgs";
|
||||
import { Secp256k1Wallet } from "../secp256k1wallet";
|
||||
import { SigningCosmosClient } from "../signingcosmosclient";
|
||||
@ -45,7 +45,7 @@ describe("DistributionExtension", () => {
|
||||
};
|
||||
const memo = "Test delegation for wasmd";
|
||||
const { accountNumber, sequence } = await client.getSequence();
|
||||
const signDoc = makeStdSignDoc([msg], defaultFee, chainId, memo, accountNumber, sequence);
|
||||
const signDoc = makeSignDoc([msg], defaultFee, chainId, memo, accountNumber, sequence);
|
||||
const { signature } = await wallet.sign(faucet.address, signDoc);
|
||||
const tx = {
|
||||
msg: [msg],
|
||||
|
||||
@ -3,7 +3,7 @@ import { sleep } from "@cosmjs/utils";
|
||||
|
||||
import { coins } from "../coins";
|
||||
import { assertIsBroadcastTxSuccess } from "../cosmosclient";
|
||||
import { makeStdSignDoc } from "../encoding";
|
||||
import { makeSignDoc } from "../encoding";
|
||||
import { Secp256k1Wallet } from "../secp256k1wallet";
|
||||
import { SigningCosmosClient } from "../signingcosmosclient";
|
||||
import {
|
||||
@ -50,7 +50,7 @@ describe("GovExtension", () => {
|
||||
};
|
||||
const proposalMemo = "Test proposal for wasmd";
|
||||
const { accountNumber: proposalAccountNumber, sequence: proposalSequence } = await client.getSequence();
|
||||
const proposalSignDoc = makeStdSignDoc(
|
||||
const proposalSignDoc = makeSignDoc(
|
||||
[proposalMsg],
|
||||
defaultFee,
|
||||
chainId,
|
||||
@ -82,7 +82,7 @@ describe("GovExtension", () => {
|
||||
};
|
||||
const voteMemo = "Test vote for wasmd";
|
||||
const { accountNumber: voteAccountNumber, sequence: voteSequence } = await client.getSequence();
|
||||
const voteSignDoc = makeStdSignDoc(
|
||||
const voteSignDoc = makeSignDoc(
|
||||
[voteMsg],
|
||||
defaultFee,
|
||||
chainId,
|
||||
|
||||
@ -3,7 +3,7 @@ import { assert, sleep } from "@cosmjs/utils";
|
||||
|
||||
import { Coin } from "../coins";
|
||||
import { isBroadcastTxFailure } from "../cosmosclient";
|
||||
import { makeStdSignDoc } from "../encoding";
|
||||
import { makeSignDoc } from "../encoding";
|
||||
import { parseLogs } from "../logs";
|
||||
import { MsgSend } from "../msgs";
|
||||
import { Secp256k1Wallet } from "../secp256k1wallet";
|
||||
@ -239,7 +239,7 @@ describe("LcdClient", () => {
|
||||
};
|
||||
const { accountNumber, sequence } = await client.getSequence();
|
||||
const chainId = await client.getChainId();
|
||||
const signDoc = makeStdSignDoc([sendMsg], fee, chainId, memo, accountNumber, sequence);
|
||||
const signDoc = makeSignDoc([sendMsg], fee, chainId, memo, accountNumber, sequence);
|
||||
const { signature } = await wallet.sign(walletAddress, signDoc);
|
||||
const signedTx: StdTx = {
|
||||
msg: [sendMsg],
|
||||
@ -537,7 +537,7 @@ describe("LcdClient", () => {
|
||||
const client = LcdClient.withExtensions({ apiUrl: wasmd.endpoint }, setupAuthExtension);
|
||||
const { account_number, sequence } = (await client.auth.account(faucet.address)).result.value;
|
||||
|
||||
const signDoc = makeStdSignDoc([theMsg], fee, wasmd.chainId, memo, account_number, sequence);
|
||||
const signDoc = makeSignDoc([theMsg], fee, wasmd.chainId, memo, account_number, sequence);
|
||||
const { signature } = await wallet.sign(walletAddress, signDoc);
|
||||
const signedTx = makeSignedTx(theMsg, fee, memo, signature);
|
||||
const result = await client.broadcastTx(signedTx);
|
||||
@ -594,9 +594,9 @@ describe("LcdClient", () => {
|
||||
const { account_number: an2, sequence: sequence2 } = (await client.auth.account(address2)).result.value;
|
||||
const { account_number: an3, sequence: sequence3 } = (await client.auth.account(address3)).result.value;
|
||||
|
||||
const signDoc1 = makeStdSignDoc([theMsg], fee, wasmd.chainId, memo, an1, sequence1);
|
||||
const signDoc2 = makeStdSignDoc([theMsg], fee, wasmd.chainId, memo, an2, sequence2);
|
||||
const signDoc3 = makeStdSignDoc([theMsg], fee, wasmd.chainId, memo, an3, sequence3);
|
||||
const signDoc1 = makeSignDoc([theMsg], fee, wasmd.chainId, memo, an1, sequence1);
|
||||
const signDoc2 = makeSignDoc([theMsg], fee, wasmd.chainId, memo, an2, sequence2);
|
||||
const signDoc3 = makeSignDoc([theMsg], fee, wasmd.chainId, memo, an3, sequence3);
|
||||
const { signature: signature1 } = await account1.sign(address1, signDoc1);
|
||||
const { signature: signature2 } = await account2.sign(address2, signDoc2);
|
||||
const { signature: signature3 } = await account3.sign(address3, signDoc3);
|
||||
@ -658,7 +658,7 @@ describe("LcdClient", () => {
|
||||
const client = LcdClient.withExtensions({ apiUrl: wasmd.endpoint }, setupAuthExtension);
|
||||
const { account_number, sequence } = (await client.auth.account(walletAddress)).result.value;
|
||||
|
||||
const signDoc = makeStdSignDoc([msg1, msg2], fee, wasmd.chainId, memo, account_number, sequence);
|
||||
const signDoc = makeSignDoc([msg1, msg2], fee, wasmd.chainId, memo, account_number, sequence);
|
||||
const { signature } = await wallet.sign(walletAddress, signDoc);
|
||||
const signedTx: StdTx = {
|
||||
msg: [msg1, msg2],
|
||||
@ -722,8 +722,8 @@ describe("LcdClient", () => {
|
||||
const { account_number: an1, sequence: sequence1 } = (await client.auth.account(address1)).result.value;
|
||||
const { account_number: an2, sequence: sequence2 } = (await client.auth.account(address2)).result.value;
|
||||
|
||||
const signDoc1 = makeStdSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an1, sequence1);
|
||||
const signDoc2 = makeStdSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an2, sequence2);
|
||||
const signDoc1 = makeSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an1, sequence1);
|
||||
const signDoc2 = makeSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an2, sequence2);
|
||||
const { signature: signature1 } = await account1.sign(address1, signDoc1);
|
||||
const { signature: signature2 } = await account2.sign(address2, signDoc2);
|
||||
const signedTx: StdTx = {
|
||||
@ -793,8 +793,8 @@ describe("LcdClient", () => {
|
||||
const { account_number: an1, sequence: sequence1 } = (await client.auth.account(address1)).result.value;
|
||||
const { account_number: an2, sequence: sequence2 } = (await client.auth.account(address2)).result.value;
|
||||
|
||||
const signDoc1 = makeStdSignDoc([msg1, msg2], fee, wasmd.chainId, memo, an1, sequence1);
|
||||
const signDoc2 = makeStdSignDoc([msg1, msg2], fee, wasmd.chainId, memo, an2, sequence2);
|
||||
const signDoc1 = makeSignDoc([msg1, msg2], fee, wasmd.chainId, memo, an1, sequence1);
|
||||
const signDoc2 = makeSignDoc([msg1, msg2], fee, wasmd.chainId, memo, an2, sequence2);
|
||||
const { signature: signature1 } = await account1.sign(address1, signDoc1);
|
||||
const { signature: signature2 } = await account2.sign(address2, signDoc2);
|
||||
const signedTx: StdTx = {
|
||||
@ -859,8 +859,8 @@ describe("LcdClient", () => {
|
||||
const { account_number: an1, sequence: sequence1 } = (await client.auth.account(address1)).result.value;
|
||||
const { account_number: an2, sequence: sequence2 } = (await client.auth.account(address2)).result.value;
|
||||
|
||||
const signDoc1 = makeStdSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an1, sequence1);
|
||||
const signDoc2 = makeStdSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an2, sequence2);
|
||||
const signDoc1 = makeSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an1, sequence1);
|
||||
const signDoc2 = makeSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an2, sequence2);
|
||||
const { signature: signature1 } = await account1.sign(address1, signDoc1);
|
||||
const { signature: signature2 } = await account2.sign(address2, signDoc2);
|
||||
const signedTx: StdTx = {
|
||||
|
||||
@ -3,7 +3,7 @@ import { assert, sleep } from "@cosmjs/utils";
|
||||
|
||||
import { coin, coins } from "../coins";
|
||||
import { assertIsBroadcastTxSuccess } from "../cosmosclient";
|
||||
import { makeStdSignDoc } from "../encoding";
|
||||
import { makeSignDoc } from "../encoding";
|
||||
import { MsgDelegate, MsgUndelegate } from "../msgs";
|
||||
import { Secp256k1Wallet } from "../secp256k1wallet";
|
||||
import { SigningCosmosClient } from "../signingcosmosclient";
|
||||
@ -46,7 +46,7 @@ describe("StakingExtension", () => {
|
||||
};
|
||||
const memo = "Test delegation for wasmd";
|
||||
const { accountNumber, sequence } = await client.getSequence();
|
||||
const signDoc = makeStdSignDoc([msg], defaultFee, chainId, memo, accountNumber, sequence);
|
||||
const signDoc = makeSignDoc([msg], defaultFee, chainId, memo, accountNumber, sequence);
|
||||
const { signature } = await wallet.sign(faucet.address, signDoc);
|
||||
const tx = {
|
||||
msg: [msg],
|
||||
@ -69,7 +69,7 @@ describe("StakingExtension", () => {
|
||||
};
|
||||
const memo = "Test undelegation for wasmd";
|
||||
const { accountNumber, sequence } = await client.getSequence();
|
||||
const signDoc = makeStdSignDoc([msg], defaultFee, chainId, memo, accountNumber, sequence);
|
||||
const signDoc = makeSignDoc([msg], defaultFee, chainId, memo, accountNumber, sequence);
|
||||
const { signature } = await wallet.sign(faucet.address, signDoc);
|
||||
const tx = {
|
||||
msg: [msg],
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Secp256k1, Secp256k1Signature, Sha256 } from "@cosmjs/crypto";
|
||||
|
||||
import { makeStdSignDoc, serializeSignDoc } from "./encoding";
|
||||
import { makeSignDoc, serializeSignDoc } from "./encoding";
|
||||
import { decodeSignature } from "./signature";
|
||||
import { CosmosSdkTx } from "./types";
|
||||
|
||||
@ -31,7 +31,7 @@ export async function findSequenceForSignedTx(
|
||||
for (let s = min; s < upperBound; s++) {
|
||||
// console.log(`Trying sequence ${s}`);
|
||||
const signBytes = serializeSignDoc(
|
||||
makeStdSignDoc(tx.value.msg, tx.value.fee, chainId, tx.value.memo || "", accountNumber, s),
|
||||
makeSignDoc(tx.value.msg, tx.value.fee, chainId, tx.value.memo || "", accountNumber, s),
|
||||
);
|
||||
const prehashed = new Sha256(signBytes).digest();
|
||||
const valid = await Secp256k1.verifySignature(secp256keSignature, prehashed, pubkey);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { Coin } from "./coins";
|
||||
import { Account, BroadcastTxResult, CosmosClient, GetSequenceResult } from "./cosmosclient";
|
||||
import { makeStdSignDoc } from "./encoding";
|
||||
import { makeSignDoc } from "./encoding";
|
||||
import { buildFeeTable, FeeTable, GasLimits, GasPrice } from "./gas";
|
||||
import { BroadcastMode } from "./lcdapi";
|
||||
import { Msg, MsgSend } from "./msgs";
|
||||
@ -88,7 +88,7 @@ export class SigningCosmosClient extends CosmosClient {
|
||||
public async signAndBroadcast(msgs: readonly Msg[], fee: StdFee, memo = ""): Promise<BroadcastTxResult> {
|
||||
const { accountNumber, sequence } = await this.getSequence();
|
||||
const chainId = await this.getChainId();
|
||||
const signDoc = makeStdSignDoc(msgs, fee, chainId, memo, accountNumber, sequence);
|
||||
const signDoc = makeSignDoc(msgs, fee, chainId, memo, accountNumber, sequence);
|
||||
const { signature } = await this.signer.sign(this.senderAddress, signDoc);
|
||||
const signedTx: StdTx = {
|
||||
msg: msgs,
|
||||
|
||||
2
packages/launchpad/types/encoding.d.ts
vendored
2
packages/launchpad/types/encoding.d.ts
vendored
@ -13,7 +13,7 @@ export interface StdSignDoc {
|
||||
readonly msgs: readonly Msg[];
|
||||
readonly memo: string;
|
||||
}
|
||||
export declare function makeStdSignDoc(
|
||||
export declare function makeSignDoc(
|
||||
msgs: readonly Msg[],
|
||||
fee: StdFee,
|
||||
chainId: string,
|
||||
|
||||
2
packages/launchpad/types/index.d.ts
vendored
2
packages/launchpad/types/index.d.ts
vendored
@ -26,7 +26,7 @@ export {
|
||||
isSearchBySentFromOrToQuery,
|
||||
isSearchByTagsQuery,
|
||||
} from "./cosmosclient";
|
||||
export { makeStdSignDoc, serializeSignDoc, StdSignDoc } from "./encoding";
|
||||
export { makeSignDoc, serializeSignDoc, StdSignDoc } from "./encoding";
|
||||
export { buildFeeTable, FeeTable, GasLimits, GasPrice } from "./gas";
|
||||
export {
|
||||
AuthAccountsResponse,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user