launchpad: Adjust secp256k1wallet for new OfflineSigner
This commit is contained in:
parent
17baf1565c
commit
27d518898b
@ -30,7 +30,7 @@ describe("Secp256k1Wallet", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("sign", () => {
|
||||
describe("signAmino", () => {
|
||||
it("resolves to valid signature", async () => {
|
||||
const signer = await Secp256k1Wallet.fromKey(defaultPrivkey);
|
||||
const signDoc: StdSignDoc = {
|
||||
@ -41,7 +41,7 @@ describe("Secp256k1Wallet", () => {
|
||||
account_number: "7",
|
||||
sequence: "54",
|
||||
};
|
||||
const { signed, signature } = await signer.sign(defaultAddress, signDoc);
|
||||
const { signed, signature } = await signer.signAmino(defaultAddress, signDoc);
|
||||
expect(signed).toEqual(signDoc);
|
||||
const valid = await Secp256k1.verifySignature(
|
||||
Secp256k1Signature.fromFixedLength(fromBase64(signature.signature)),
|
||||
|
||||
@ -3,7 +3,7 @@ import { Secp256k1, Sha256 } from "@cosmjs/crypto";
|
||||
import { rawSecp256k1PubkeyToAddress } from "./address";
|
||||
import { serializeSignDoc, StdSignDoc } from "./encoding";
|
||||
import { encodeSecp256k1Signature } from "./signature";
|
||||
import { AccountData, OfflineSigner, SignResponse } from "./signer";
|
||||
import { AccountData, AminoSignResponse, OfflineSigner } from "./signer";
|
||||
|
||||
/**
|
||||
* A wallet that holds a single secp256k1 keypair.
|
||||
@ -46,7 +46,7 @@ export class Secp256k1Wallet implements OfflineSigner {
|
||||
];
|
||||
}
|
||||
|
||||
public async sign(signerAddress: string, signDoc: StdSignDoc): Promise<SignResponse> {
|
||||
public async signAmino(signerAddress: string, signDoc: StdSignDoc): Promise<AminoSignResponse> {
|
||||
if (signerAddress !== this.address) {
|
||||
throw new Error(`Address ${signerAddress} not found in wallet`);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { StdSignDoc } from "./encoding";
|
||||
import { AccountData, OfflineSigner, SignResponse } from "./signer";
|
||||
import { AccountData, OfflineSigner, AminoSignResponse } from "./signer";
|
||||
/**
|
||||
* A wallet that holds a single secp256k1 keypair.
|
||||
*
|
||||
@ -19,5 +19,5 @@ export declare class Secp256k1Wallet implements OfflineSigner {
|
||||
private constructor();
|
||||
private get address();
|
||||
getAccounts(): Promise<readonly AccountData[]>;
|
||||
sign(signerAddress: string, signDoc: StdSignDoc): Promise<SignResponse>;
|
||||
signAmino(signerAddress: string, signDoc: StdSignDoc): Promise<AminoSignResponse>;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user