diff --git a/CHANGELOG.md b/CHANGELOG.md index 112dbb0e..65c13f16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,7 +48,8 @@ - @cosmjs/launchpad: Export `StdSignDoc` and create helpers to make and serialize a `StdSignDoc`: `makeStdSignDoc` and `serializeSignDoc`. - @cosmjs/launchpad: Let `OfflineSigner.sign` take an `StdSignDoc` instead of an - encoded message. + 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`. diff --git a/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts b/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts index bf6ae681..66a7eb2c 100644 --- a/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts +++ b/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts @@ -104,7 +104,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 signature = await wallet.sign(alice.address0, signDoc); + const { signature } = await wallet.sign(alice.address0, signDoc); const tx: CosmosSdkTx = { type: "cosmos-sdk/StdTx", value: { diff --git a/packages/cosmwasm/src/cosmwasmclient.spec.ts b/packages/cosmwasm/src/cosmwasmclient.spec.ts index fcdf8e6d..5a464b19 100644 --- a/packages/cosmwasm/src/cosmwasmclient.spec.ts +++ b/packages/cosmwasm/src/cosmwasmclient.spec.ts @@ -7,6 +7,7 @@ import { MsgSend, Secp256k1Wallet, StdFee, + StdTx, } from "@cosmjs/launchpad"; import { assert, sleep } from "@cosmjs/utils"; import { ReadonlyDate } from "readonly-date"; @@ -237,8 +238,8 @@ 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 signature = await wallet.sign(alice.address0, signDoc); - const signedTx = { + const { signature } = await wallet.sign(alice.address0, signDoc); + const signedTx: StdTx = { msg: [sendMsg], fee: fee, memo: memo, diff --git a/packages/cosmwasm/src/lcdapi/wasm.spec.ts b/packages/cosmwasm/src/lcdapi/wasm.spec.ts index 83790e1a..69f712cf 100644 --- a/packages/cosmwasm/src/lcdapi/wasm.spec.ts +++ b/packages/cosmwasm/src/lcdapi/wasm.spec.ts @@ -126,7 +126,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 signature = await signer.sign(alice.address0, signDoc); + const { signature } = await signer.sign(alice.address0, signDoc); const signedTx = makeSignedTx(theMsg, fee, memo, signature); return client.broadcastTx(signedTx); } diff --git a/packages/cosmwasm/src/signingcosmwasmclient.ts b/packages/cosmwasm/src/signingcosmwasmclient.ts index 0b27a2c3..6b008d2d 100644 --- a/packages/cosmwasm/src/signingcosmwasmclient.ts +++ b/packages/cosmwasm/src/signingcosmwasmclient.ts @@ -361,7 +361,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { const { accountNumber, sequence } = await this.getSequence(); const chainId = await this.getChainId(); const signDoc = makeStdSignDoc(msgs, fee, chainId, memo, accountNumber, sequence); - const signature = await this.signer.sign(this.senderAddress, signDoc); + const { signature } = await this.signer.sign(this.senderAddress, signDoc); const signedTx: StdTx = { msg: msgs, fee: fee, diff --git a/packages/launchpad-ledger/src/demo/node.ts b/packages/launchpad-ledger/src/demo/node.ts index 6cd967e2..c4cff2a6 100644 --- a/packages/launchpad-ledger/src/demo/node.ts +++ b/packages/launchpad-ledger/src/demo/node.ts @@ -56,5 +56,6 @@ export async function sign( accountNumber, defaultSequence, ); - return signer.sign(fromAddress, signDoc); + const { signature } = await signer.sign(fromAddress, signDoc); + return signature; } diff --git a/packages/launchpad-ledger/src/ledgersigner.ts b/packages/launchpad-ledger/src/ledgersigner.ts index c09fc03b..0e00d132 100644 --- a/packages/launchpad-ledger/src/ledgersigner.ts +++ b/packages/launchpad-ledger/src/ledgersigner.ts @@ -4,10 +4,9 @@ import { encodeSecp256k1Signature, makeCosmoshubPath, OfflineSigner, - StdSignature, StdSignDoc, } from "@cosmjs/launchpad"; -import { serializeSignDoc } from "@cosmjs/launchpad"; +import { serializeSignDoc, SignResponse } from "@cosmjs/launchpad"; import { LaunchpadLedger, LaunchpadLedgerOptions } from "./launchpadledger"; @@ -36,7 +35,7 @@ export class LedgerSigner implements OfflineSigner { return this.accounts; } - public async sign(signerAddress: string, signDoc: StdSignDoc): Promise { + public async sign(signerAddress: string, signDoc: StdSignDoc): Promise { const accounts = this.accounts || (await this.getAccounts()); const accountIndex = accounts.findIndex((account) => account.address === signerAddress); @@ -48,6 +47,9 @@ export class LedgerSigner implements OfflineSigner { const accountForAddress = accounts[accountIndex]; const hdPath = this.hdPaths[accountIndex]; const signature = await this.ledger.sign(message, hdPath); - return encodeSecp256k1Signature(accountForAddress.pubkey, signature); + return { + signedDoc: signDoc, + signature: encodeSecp256k1Signature(accountForAddress.pubkey, signature), + }; } } diff --git a/packages/launchpad-ledger/types/ledgersigner.d.ts b/packages/launchpad-ledger/types/ledgersigner.d.ts index ffc9a609..6ddfee8b 100644 --- a/packages/launchpad-ledger/types/ledgersigner.d.ts +++ b/packages/launchpad-ledger/types/ledgersigner.d.ts @@ -1,4 +1,5 @@ -import { AccountData, OfflineSigner, StdSignature, StdSignDoc } from "@cosmjs/launchpad"; +import { AccountData, OfflineSigner, StdSignDoc } from "@cosmjs/launchpad"; +import { SignResponse } from "@cosmjs/launchpad"; import { LaunchpadLedgerOptions } from "./launchpadledger"; export declare class LedgerSigner implements OfflineSigner { private readonly ledger; @@ -6,5 +7,5 @@ export declare class LedgerSigner implements OfflineSigner { private accounts?; constructor(options?: LaunchpadLedgerOptions); getAccounts(): Promise; - sign(signerAddress: string, signDoc: StdSignDoc): Promise; + sign(signerAddress: string, signDoc: StdSignDoc): Promise; } diff --git a/packages/launchpad/src/cosmosclient.searchtx.spec.ts b/packages/launchpad/src/cosmosclient.searchtx.spec.ts index 8d247634..0a99909a 100644 --- a/packages/launchpad/src/cosmosclient.searchtx.spec.ts +++ b/packages/launchpad/src/cosmosclient.searchtx.spec.ts @@ -56,7 +56,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 signature = await wallet.sign(walletAddress, signDoc); + const { signature } = await wallet.sign(walletAddress, signDoc); const tx: CosmosSdkTx = { type: "cosmos-sdk/StdTx", value: { diff --git a/packages/launchpad/src/cosmosclient.spec.ts b/packages/launchpad/src/cosmosclient.spec.ts index 47368a87..bf6571b6 100644 --- a/packages/launchpad/src/cosmosclient.spec.ts +++ b/packages/launchpad/src/cosmosclient.spec.ts @@ -16,7 +16,7 @@ import { unused, wasmd, } from "./testutils.spec"; -import { StdFee } from "./types"; +import { StdFee, StdTx } from "./types"; const blockTime = 1_000; // ms @@ -230,8 +230,8 @@ 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 signature = await wallet.sign(walletAddress, signDoc); - const signedTx = { + const { signature } = await wallet.sign(walletAddress, signDoc); + const signedTx: StdTx = { msg: [sendMsg], fee: fee, memo: memo, diff --git a/packages/launchpad/src/index.ts b/packages/launchpad/src/index.ts index 9fd6d7d0..7220683d 100644 --- a/packages/launchpad/src/index.ts +++ b/packages/launchpad/src/index.ts @@ -98,7 +98,7 @@ export { } from "./pubkey"; export { findSequenceForSignedTx } from "./sequence"; export { encodeSecp256k1Signature, decodeSignature } from "./signature"; -export { AccountData, Algo, OfflineSigner } from "./signer"; +export { AccountData, Algo, OfflineSigner, SignResponse } from "./signer"; export { CosmosFeeTable, SigningCosmosClient } from "./signingcosmosclient"; export { isStdTx, pubkeyType, CosmosSdkTx, PubKey, StdFee, StdSignature, StdTx } from "./types"; export { makeCosmoshubPath, executeKdf, KdfConfiguration } from "./wallet"; diff --git a/packages/launchpad/src/lcdapi/distribution.spec.ts b/packages/launchpad/src/lcdapi/distribution.spec.ts index bc68176e..6e5f3647 100644 --- a/packages/launchpad/src/lcdapi/distribution.spec.ts +++ b/packages/launchpad/src/lcdapi/distribution.spec.ts @@ -46,7 +46,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 signature = await wallet.sign(faucet.address, signDoc); + const { signature } = await wallet.sign(faucet.address, signDoc); const tx = { msg: [msg], fee: defaultFee, diff --git a/packages/launchpad/src/lcdapi/gov.spec.ts b/packages/launchpad/src/lcdapi/gov.spec.ts index 0af73b64..231253b7 100644 --- a/packages/launchpad/src/lcdapi/gov.spec.ts +++ b/packages/launchpad/src/lcdapi/gov.spec.ts @@ -58,7 +58,7 @@ describe("GovExtension", () => { proposalAccountNumber, proposalSequence, ); - const proposalSignature = await wallet.sign(faucet.address, proposalSignDoc); + const { signature: proposalSignature } = await wallet.sign(faucet.address, proposalSignDoc); const proposalTx = { msg: [proposalMsg], fee: defaultFee, @@ -90,7 +90,7 @@ describe("GovExtension", () => { voteAccountNumber, voteSequence, ); - const voteSignature = await wallet.sign(faucet.address, voteSignDoc); + const { signature: voteSignature } = await wallet.sign(faucet.address, voteSignDoc); const voteTx = { msg: [voteMsg], fee: defaultFee, diff --git a/packages/launchpad/src/lcdapi/lcdclient.spec.ts b/packages/launchpad/src/lcdapi/lcdclient.spec.ts index a1043d4a..f2147e25 100644 --- a/packages/launchpad/src/lcdapi/lcdclient.spec.ts +++ b/packages/launchpad/src/lcdapi/lcdclient.spec.ts @@ -20,7 +20,7 @@ import { wasmd, wasmdEnabled, } from "../testutils.spec"; -import { StdFee } from "../types"; +import { StdFee, StdTx } from "../types"; import { makeCosmoshubPath } from "../wallet"; import { setupAuthExtension } from "./auth"; import { TxsResponse } from "./base"; @@ -240,8 +240,8 @@ describe("LcdClient", () => { const { accountNumber, sequence } = await client.getSequence(); const chainId = await client.getChainId(); const signDoc = makeStdSignDoc([sendMsg], fee, chainId, memo, accountNumber, sequence); - const signature = await wallet.sign(walletAddress, signDoc); - const signedTx = { + const { signature } = await wallet.sign(walletAddress, signDoc); + const signedTx: StdTx = { msg: [sendMsg], fee: fee, memo: memo, @@ -538,7 +538,7 @@ describe("LcdClient", () => { const { account_number, sequence } = (await client.auth.account(faucet.address)).result.value; const signDoc = makeStdSignDoc([theMsg], fee, wasmd.chainId, memo, account_number, sequence); - const signature = await wallet.sign(walletAddress, signDoc); + const { signature } = await wallet.sign(walletAddress, signDoc); const signedTx = makeSignedTx(theMsg, fee, memo, signature); const result = await client.broadcastTx(signedTx); expect(result.code).toBeUndefined(); @@ -597,10 +597,10 @@ describe("LcdClient", () => { 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 signature1 = await account1.sign(address1, signDoc1); - const signature2 = await account2.sign(address2, signDoc2); - const signature3 = await account3.sign(address3, signDoc3); - const signedTx = { + const { signature: signature1 } = await account1.sign(address1, signDoc1); + const { signature: signature2 } = await account2.sign(address2, signDoc2); + const { signature: signature3 } = await account3.sign(address3, signDoc3); + const signedTx: StdTx = { msg: [theMsg], fee: fee, memo: memo, @@ -659,8 +659,8 @@ describe("LcdClient", () => { const { account_number, sequence } = (await client.auth.account(walletAddress)).result.value; const signDoc = makeStdSignDoc([msg1, msg2], fee, wasmd.chainId, memo, account_number, sequence); - const signature = await wallet.sign(walletAddress, signDoc); - const signedTx = { + const { signature } = await wallet.sign(walletAddress, signDoc); + const signedTx: StdTx = { msg: [msg1, msg2], fee: fee, memo: memo, @@ -724,9 +724,9 @@ describe("LcdClient", () => { const signDoc1 = makeStdSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an1, sequence1); const signDoc2 = makeStdSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an2, sequence2); - const signature1 = await account1.sign(address1, signDoc1); - const signature2 = await account2.sign(address2, signDoc2); - const signedTx = { + const { signature: signature1 } = await account1.sign(address1, signDoc1); + const { signature: signature2 } = await account2.sign(address2, signDoc2); + const signedTx: StdTx = { msg: [msg2, msg1], fee: fee, memo: memo, @@ -795,9 +795,9 @@ describe("LcdClient", () => { const signDoc1 = makeStdSignDoc([msg1, msg2], fee, wasmd.chainId, memo, an1, sequence1); const signDoc2 = makeStdSignDoc([msg1, msg2], fee, wasmd.chainId, memo, an2, sequence2); - const signature1 = await account1.sign(address1, signDoc1); - const signature2 = await account2.sign(address2, signDoc2); - const signedTx = { + const { signature: signature1 } = await account1.sign(address1, signDoc1); + const { signature: signature2 } = await account2.sign(address2, signDoc2); + const signedTx: StdTx = { msg: [msg1, msg2], fee: fee, memo: memo, @@ -861,9 +861,9 @@ describe("LcdClient", () => { const signDoc1 = makeStdSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an1, sequence1); const signDoc2 = makeStdSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an2, sequence2); - const signature1 = await account1.sign(address1, signDoc1); - const signature2 = await account2.sign(address2, signDoc2); - const signedTx = { + const { signature: signature1 } = await account1.sign(address1, signDoc1); + const { signature: signature2 } = await account2.sign(address2, signDoc2); + const signedTx: StdTx = { msg: [msg2, msg1], fee: fee, memo: memo, diff --git a/packages/launchpad/src/lcdapi/staking.spec.ts b/packages/launchpad/src/lcdapi/staking.spec.ts index 5efcff6c..1f1809a9 100644 --- a/packages/launchpad/src/lcdapi/staking.spec.ts +++ b/packages/launchpad/src/lcdapi/staking.spec.ts @@ -47,7 +47,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 signature = await wallet.sign(faucet.address, signDoc); + const { signature } = await wallet.sign(faucet.address, signDoc); const tx = { msg: [msg], fee: defaultFee, @@ -70,7 +70,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 signature = await wallet.sign(faucet.address, signDoc); + const { signature } = await wallet.sign(faucet.address, signDoc); const tx = { msg: [msg], fee: defaultFee, diff --git a/packages/launchpad/src/secp256k1wallet.spec.ts b/packages/launchpad/src/secp256k1wallet.spec.ts index d2080321..87d6c7a9 100644 --- a/packages/launchpad/src/secp256k1wallet.spec.ts +++ b/packages/launchpad/src/secp256k1wallet.spec.ts @@ -120,7 +120,7 @@ describe("Secp256k1Wallet", () => { account_number: "7", sequence: "54", }; - const signature = await wallet.sign(defaultAddress, signDoc); + const { signature } = await wallet.sign(defaultAddress, signDoc); const valid = await Secp256k1.verifySignature( Secp256k1Signature.fromFixedLength(fromBase64(signature.signature)), new Sha256(serializeSignDoc(signDoc)).digest(), diff --git a/packages/launchpad/src/secp256k1wallet.ts b/packages/launchpad/src/secp256k1wallet.ts index 6ffab6fa..dbba6b95 100644 --- a/packages/launchpad/src/secp256k1wallet.ts +++ b/packages/launchpad/src/secp256k1wallet.ts @@ -16,8 +16,7 @@ import { assert, isNonNullObject } from "@cosmjs/utils"; import { rawSecp256k1PubkeyToAddress } from "./address"; import { serializeSignDoc, StdSignDoc } from "./encoding"; import { encodeSecp256k1Signature } from "./signature"; -import { AccountData, OfflineSigner } from "./signer"; -import { StdSignature } from "./types"; +import { AccountData, OfflineSigner, SignResponse } from "./signer"; import { decrypt, encrypt, @@ -256,14 +255,17 @@ export class Secp256k1Wallet implements OfflineSigner { ]; } - public async sign(signerAddress: string, signDoc: StdSignDoc): Promise { + public async sign(signerAddress: string, signDoc: StdSignDoc): Promise { if (signerAddress !== this.address) { throw new Error(`Address ${signerAddress} not found in wallet`); } const message = new Sha256(serializeSignDoc(signDoc)).digest(); const signature = await Secp256k1.createSignature(message, this.privkey); const signatureBytes = new Uint8Array([...signature.r(32), ...signature.s(32)]); - return encodeSecp256k1Signature(this.pubkey, signatureBytes); + return { + signedDoc: signDoc, + signature: encodeSecp256k1Signature(this.pubkey, signatureBytes), + }; } /** diff --git a/packages/launchpad/src/signer.ts b/packages/launchpad/src/signer.ts index e2eb4868..6eff4d13 100644 --- a/packages/launchpad/src/signer.ts +++ b/packages/launchpad/src/signer.ts @@ -10,6 +10,15 @@ export interface AccountData { readonly pubkey: Uint8Array; } +export interface SignResponse { + /** + * The sign doc that was signed. + * This may be different from the input signDoc when the signer modifies it as part of the signing process. + */ + readonly signedDoc: StdSignDoc; + readonly signature: StdSignature; +} + export interface OfflineSigner { /** * Get AccountData array from wallet. Rejects if not enabled. @@ -19,8 +28,11 @@ export interface OfflineSigner { /** * Request signature from whichever key corresponds to provided bech32-encoded address. Rejects if not enabled. * + * The signer implementation may offer the user the ability to override parts of the signDoc. It must + * return the doc that was signed in the response. + * * @param signerAddress The address of the account that should sign the transaction * @param signDoc The content that should be signed */ - readonly sign: (signerAddress: string, signDoc: StdSignDoc) => Promise; + readonly sign: (signerAddress: string, signDoc: StdSignDoc) => Promise; } diff --git a/packages/launchpad/src/signingcosmosclient.ts b/packages/launchpad/src/signingcosmosclient.ts index fa9ba345..a8599fe5 100644 --- a/packages/launchpad/src/signingcosmosclient.ts +++ b/packages/launchpad/src/signingcosmosclient.ts @@ -89,7 +89,7 @@ export class SigningCosmosClient extends CosmosClient { const { accountNumber, sequence } = await this.getSequence(); const chainId = await this.getChainId(); const signDoc = makeStdSignDoc(msgs, fee, chainId, memo, accountNumber, sequence); - const signature = await this.signer.sign(this.senderAddress, signDoc); + const { signature } = await this.signer.sign(this.senderAddress, signDoc); const signedTx: StdTx = { msg: msgs, fee: fee, diff --git a/packages/launchpad/types/index.d.ts b/packages/launchpad/types/index.d.ts index de247a1e..a767b1ef 100644 --- a/packages/launchpad/types/index.d.ts +++ b/packages/launchpad/types/index.d.ts @@ -96,7 +96,7 @@ export { } from "./pubkey"; export { findSequenceForSignedTx } from "./sequence"; export { encodeSecp256k1Signature, decodeSignature } from "./signature"; -export { AccountData, Algo, OfflineSigner } from "./signer"; +export { AccountData, Algo, OfflineSigner, SignResponse } from "./signer"; export { CosmosFeeTable, SigningCosmosClient } from "./signingcosmosclient"; export { isStdTx, pubkeyType, CosmosSdkTx, PubKey, StdFee, StdSignature, StdTx } from "./types"; export { makeCosmoshubPath, executeKdf, KdfConfiguration } from "./wallet"; diff --git a/packages/launchpad/types/secp256k1wallet.d.ts b/packages/launchpad/types/secp256k1wallet.d.ts index aa241a86..29c7b63d 100644 --- a/packages/launchpad/types/secp256k1wallet.d.ts +++ b/packages/launchpad/types/secp256k1wallet.d.ts @@ -1,7 +1,6 @@ import { HdPath } from "@cosmjs/crypto"; import { StdSignDoc } from "./encoding"; -import { AccountData, OfflineSigner } from "./signer"; -import { StdSignature } from "./types"; +import { AccountData, OfflineSigner, SignResponse } from "./signer"; import { EncryptionConfiguration, KdfConfiguration } from "./wallet"; /** * This interface describes a JSON object holding the encrypted wallet and the meta data. @@ -87,7 +86,7 @@ export declare class Secp256k1Wallet implements OfflineSigner { get mnemonic(): string; private get address(); getAccounts(): Promise; - sign(signerAddress: string, signDoc: StdSignDoc): Promise; + sign(signerAddress: string, signDoc: StdSignDoc): Promise; /** * Generates an encrypted serialization of this wallet. * diff --git a/packages/launchpad/types/signer.d.ts b/packages/launchpad/types/signer.d.ts index 3a2e17e3..60d4aad9 100644 --- a/packages/launchpad/types/signer.d.ts +++ b/packages/launchpad/types/signer.d.ts @@ -7,6 +7,14 @@ export interface AccountData { readonly algo: Algo; readonly pubkey: Uint8Array; } +export interface SignResponse { + /** + * The sign doc that was signed. + * This may be different from the input signDoc when the signer modifies it as part of the signing process. + */ + readonly signedDoc: StdSignDoc; + readonly signature: StdSignature; +} export interface OfflineSigner { /** * Get AccountData array from wallet. Rejects if not enabled. @@ -15,8 +23,11 @@ export interface OfflineSigner { /** * Request signature from whichever key corresponds to provided bech32-encoded address. Rejects if not enabled. * + * The signer implementation may offer the user the ability to override parts of the signDoc. It must + * return the doc that was signed in the response. + * * @param signerAddress The address of the account that should sign the transaction * @param signDoc The content that should be signed */ - readonly sign: (signerAddress: string, signDoc: StdSignDoc) => Promise; + readonly sign: (signerAddress: string, signDoc: StdSignDoc) => Promise; }