cosmwasm: Update for sdk38 OfflineSigner

This commit is contained in:
willclarktech 2020-07-14 12:03:17 +02:00
parent 51d431a956
commit 61a31cf1ed
No known key found for this signature in database
GPG Key ID: 551A86E2E398ADF7
6 changed files with 79 additions and 77 deletions

View File

@ -7,7 +7,7 @@ import {
LcdClient,
makeSignBytes,
MsgSend,
Secp256k1Pen,
Secp256k1OfflineWallet,
} from "@cosmjs/sdk38";
import { assert, sleep } from "@cosmjs/utils";
@ -48,10 +48,8 @@ describe("CosmWasmClient.searchTx", () => {
beforeAll(async () => {
if (wasmdEnabled()) {
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(wasmd.endpoint, alice.address0, (signBytes) =>
pen.sign(signBytes),
);
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(wasmd.endpoint, alice.address0, wallet);
{
const recipient = makeRandomAddress();
@ -107,7 +105,7 @@ describe("CosmWasmClient.searchTx", () => {
const { accountNumber, sequence } = await client.getNonce();
const chainId = await client.getChainId();
const signBytes = makeSignBytes([sendMsg], fee, chainId, memo, accountNumber, sequence);
const signature = await pen.sign(signBytes);
const signature = await wallet.sign(alice.address0, signBytes);
const tx: CosmosSdkTx = {
type: "cosmos-sdk/StdTx",
value: {

View File

@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/camelcase */
import { Sha256 } from "@cosmjs/crypto";
import { Bech32, fromHex, fromUtf8, toAscii, toBase64 } from "@cosmjs/encoding";
import { makeSignBytes, MsgSend, Secp256k1Pen, StdFee } from "@cosmjs/sdk38";
import { makeSignBytes, MsgSend, Secp256k1OfflineWallet, StdFee } from "@cosmjs/sdk38";
import { assert, sleep } from "@cosmjs/utils";
import { ReadonlyDate } from "readonly-date";
@ -204,7 +204,7 @@ describe("CosmWasmClient", () => {
describe("postTx", () => {
it("works", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const client = new CosmWasmClient(wasmd.endpoint);
const memo = "My first contract on chain";
@ -235,7 +235,7 @@ describe("CosmWasmClient", () => {
const chainId = await client.getChainId();
const { accountNumber, sequence } = await client.getNonce(alice.address0);
const signBytes = makeSignBytes([sendMsg], fee, chainId, memo, accountNumber, sequence);
const signature = await pen.sign(signBytes);
const signature = await wallet.sign(alice.address0, signBytes);
const signedTx = {
msg: [sendMsg],
fee: fee,
@ -388,10 +388,8 @@ describe("CosmWasmClient", () => {
beforeAll(async () => {
if (wasmdEnabled()) {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(wasmd.endpoint, alice.address0, (signBytes) =>
pen.sign(signBytes),
);
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(wasmd.endpoint, alice.address0, wallet);
const { codeId } = await client.upload(getHackatom().data);
const initMsg = { verifier: makeRandomAddress(), beneficiary: makeRandomAddress() };
const { contractAddress } = await client.instantiate(codeId, initMsg, "random hackatom");
@ -441,10 +439,8 @@ describe("CosmWasmClient", () => {
beforeAll(async () => {
if (wasmdEnabled()) {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(wasmd.endpoint, alice.address0, (signBytes) =>
pen.sign(signBytes),
);
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(wasmd.endpoint, alice.address0, wallet);
const { codeId } = await client.upload(getHackatom().data);
const initMsg = { verifier: makeRandomAddress(), beneficiary: makeRandomAddress() };
const { contractAddress } = await client.instantiate(codeId, initMsg, "a different hackatom");

View File

@ -8,9 +8,9 @@ import {
coins,
LcdClient,
makeSignBytes,
Pen,
OfflineSigner,
PostTxsResponse,
Secp256k1Pen,
Secp256k1OfflineWallet,
setupAuthExtension,
StdFee,
} from "@cosmjs/sdk38";
@ -47,7 +47,7 @@ function makeWasmClient(apiUrl: string): WasmClient {
async function uploadContract(
client: WasmClient,
pen: Pen,
signer: OfflineSigner,
contract: ContractUploadInstructions,
): Promise<PostTxsResponse> {
const memo = "My first contract on chain";
@ -72,14 +72,14 @@ async function uploadContract(
const { account_number, sequence } = (await client.auth.account(alice.address0)).result.value;
const signBytes = makeSignBytes([theMsg], fee, wasmd.chainId, memo, account_number, sequence);
const signature = await pen.sign(signBytes);
const signature = await signer.sign(alice.address0, signBytes);
const signedTx = makeSignedTx(theMsg, fee, memo, signature);
return client.postTx(signedTx);
}
async function instantiateContract(
client: WasmClient,
pen: Pen,
signer: OfflineSigner,
codeId: number,
beneficiaryAddress: string,
transferAmount?: readonly Coin[],
@ -110,14 +110,14 @@ async function instantiateContract(
const { account_number, sequence } = (await client.auth.account(alice.address0)).result.value;
const signBytes = makeSignBytes([theMsg], fee, wasmd.chainId, memo, account_number, sequence);
const signature = await pen.sign(signBytes);
const signature = await signer.sign(alice.address0, signBytes);
const signedTx = makeSignedTx(theMsg, fee, memo, signature);
return client.postTx(signedTx);
}
async function executeContract(
client: WasmClient,
pen: Pen,
signer: OfflineSigner,
contractAddress: string,
msg: object,
): Promise<PostTxsResponse> {
@ -138,7 +138,7 @@ async function executeContract(
const { account_number, sequence } = (await client.auth.account(alice.address0)).result.value;
const signBytes = makeSignBytes([theMsg], fee, wasmd.chainId, memo, account_number, sequence);
const signature = await pen.sign(signBytes);
const signature = await signer.sign(alice.address0, signBytes);
const signedTx = makeSignedTx(theMsg, fee, memo, signature);
return client.postTx(signedTx);
}
@ -256,7 +256,7 @@ describe("wasm", () => {
describe("postTx", () => {
it("can upload, instantiate and execute wasm", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const client = makeWasmClient(wasmd.endpoint);
const transferAmount = [coin(1234, "ucosm"), coin(321, "ustake")];
@ -267,7 +267,7 @@ describe("wasm", () => {
// upload
{
// console.log("Raw log:", result.raw_log);
const result = await uploadContract(client, pen, getHackatom());
const result = await uploadContract(client, wallet, getHackatom());
expect(result.code).toBeFalsy();
const logs = parseLogs(result.logs);
const codeIdAttr = findAttribute(logs, "message", "code_id");
@ -281,7 +281,7 @@ describe("wasm", () => {
// instantiate
{
const result = await instantiateContract(client, pen, codeId, beneficiaryAddress, transferAmount);
const result = await instantiateContract(client, wallet, codeId, beneficiaryAddress, transferAmount);
expect(result.code).toBeFalsy();
// console.log("Raw log:", result.raw_log);
const logs = parseLogs(result.logs);
@ -297,7 +297,7 @@ describe("wasm", () => {
// execute
{
const result = await executeContract(client, pen, contractAddress, { release: {} });
const result = await executeContract(client, wallet, contractAddress, { release: {} });
expect(result.data).toEqual("F00BAA");
expect(result.code).toBeFalsy();
// console.log("Raw log:", result.logs);
@ -324,7 +324,7 @@ describe("wasm", () => {
describe("query", () => {
it("can list upload code", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const client = makeWasmClient(wasmd.endpoint);
// check with contracts were here first to compare
@ -334,7 +334,7 @@ describe("wasm", () => {
// upload data
const hackatom = getHackatom();
const result = await uploadContract(client, pen, hackatom);
const result = await uploadContract(client, wallet, hackatom);
expect(result.code).toBeFalsy();
const logs = parseLogs(result.logs);
const codeIdAttr = findAttribute(logs, "message", "code_id");
@ -362,7 +362,7 @@ describe("wasm", () => {
it("can list contracts and get info", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const client = makeWasmClient(wasmd.endpoint);
const beneficiaryAddress = makeRandomAddress();
const transferAmount: readonly Coin[] = [
@ -378,7 +378,7 @@ describe("wasm", () => {
if (existingInfos.length > 0) {
codeId = existingInfos[existingInfos.length - 1].id;
} else {
const uploadResult = await uploadContract(client, pen, getHackatom());
const uploadResult = await uploadContract(client, wallet, getHackatom());
expect(uploadResult.code).toBeFalsy();
const uploadLogs = parseLogs(uploadResult.logs);
const codeIdAttr = findAttribute(uploadLogs, "message", "code_id");
@ -394,7 +394,7 @@ describe("wasm", () => {
expect(contract.label).toMatch(/^.+$/);
}
const result = await instantiateContract(client, pen, codeId, beneficiaryAddress, transferAmount);
const result = await instantiateContract(client, wallet, codeId, beneficiaryAddress, transferAmount);
expect(result.code).toBeFalsy();
const logs = parseLogs(result.logs);
const contractAddressAttr = findAttribute(logs, "message", "contract_address");
@ -438,12 +438,12 @@ describe("wasm", () => {
beforeAll(async () => {
if (wasmdEnabled()) {
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const uploadResult = await uploadContract(client, pen, getHackatom());
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const uploadResult = await uploadContract(client, wallet, getHackatom());
assert(!uploadResult.code);
const uploadLogs = parseLogs(uploadResult.logs);
const codeId = Number.parseInt(findAttribute(uploadLogs, "message", "code_id").value, 10);
const instantiateResult = await instantiateContract(client, pen, codeId, makeRandomAddress());
const instantiateResult = await instantiateContract(client, wallet, codeId, makeRandomAddress());
assert(!instantiateResult.code);
const instantiateLogs = parseLogs(instantiateResult.logs);
const contractAddressAttr = findAttribute(instantiateLogs, "message", "contract_address");

View File

@ -1,6 +1,13 @@
import { Sha256 } from "@cosmjs/crypto";
import { toHex } from "@cosmjs/encoding";
import { AuthExtension, coin, coins, LcdClient, Secp256k1Pen, setupAuthExtension } from "@cosmjs/sdk38";
import {
AuthExtension,
coin,
coins,
LcdClient,
Secp256k1OfflineWallet,
setupAuthExtension,
} from "@cosmjs/sdk38";
import { assert } from "@cosmjs/utils";
import { isPostTxFailure, PrivateCosmWasmClient } from "./cosmwasmclient";
@ -17,8 +24,8 @@ function makeWasmClient(apiUrl: string): LcdClient & AuthExtension & WasmExtensi
describe("SigningCosmWasmClient", () => {
describe("makeReadOnly", () => {
it("can be constructed", async () => {
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes));
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet);
expect(client).toBeTruthy();
});
});
@ -26,8 +33,8 @@ describe("SigningCosmWasmClient", () => {
describe("getHeight", () => {
it("always uses authAccount implementation", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes));
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet);
const openedClient = (client as unknown) as PrivateCosmWasmClient;
const blockLatestSpy = spyOn(openedClient.lcdClient, "blocksLatest").and.callThrough();
@ -44,8 +51,8 @@ describe("SigningCosmWasmClient", () => {
describe("upload", () => {
it("works", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes));
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet);
const wasm = getHackatom().data;
const {
codeId,
@ -63,8 +70,8 @@ describe("SigningCosmWasmClient", () => {
it("can set builder and source", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes));
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet);
const hackatom = getHackatom();
const meta: UploadMeta = {
@ -82,8 +89,8 @@ describe("SigningCosmWasmClient", () => {
describe("instantiate", () => {
it("works with transfer amount", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes));
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet);
const { codeId } = await client.upload(getHackatom().data);
const transferAmount = [coin(1234, "ucosm"), coin(321, "ustake")];
@ -108,8 +115,8 @@ describe("SigningCosmWasmClient", () => {
it("works with admin", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes));
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet);
const { codeId } = await client.upload(getHackatom().data);
const beneficiaryAddress = makeRandomAddress();
@ -131,8 +138,8 @@ describe("SigningCosmWasmClient", () => {
it("can instantiate one code multiple times", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes));
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet);
const { codeId } = await client.upload(getHackatom().data);
const contractAddress1 = await client.instantiate(
@ -158,8 +165,8 @@ describe("SigningCosmWasmClient", () => {
describe("updateAdmin", () => {
it("can update an admin", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes));
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet);
const { codeId } = await client.upload(getHackatom().data);
const beneficiaryAddress = makeRandomAddress();
@ -191,8 +198,8 @@ describe("SigningCosmWasmClient", () => {
describe("clearAdmin", () => {
it("can clear an admin", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes));
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet);
const { codeId } = await client.upload(getHackatom().data);
const beneficiaryAddress = makeRandomAddress();
@ -224,8 +231,8 @@ describe("SigningCosmWasmClient", () => {
describe("migrate", () => {
it("can can migrate from one code ID to another", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes));
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet);
const { codeId: codeId1 } = await client.upload(getHackatom().data);
const { codeId: codeId2 } = await client.upload(getHackatom().data);
@ -263,8 +270,8 @@ describe("SigningCosmWasmClient", () => {
describe("execute", () => {
it("works", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes));
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet);
const { codeId } = await client.upload(getHackatom().data);
// instantiate
@ -304,8 +311,8 @@ describe("SigningCosmWasmClient", () => {
describe("sendTokens", () => {
it("works", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes));
const wallet = await Secp256k1OfflineWallet.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet);
// instantiate
const transferAmount = coins(7890, "ucosm");

View File

@ -7,6 +7,7 @@ import {
coins,
makeSignBytes,
MsgSend,
OfflineSigner,
StdFee,
StdSignature,
StdTx,
@ -164,7 +165,7 @@ function createPostTxErrorMessage(result: PostTxFailure): string {
export class SigningCosmWasmClient extends CosmWasmClient {
public readonly senderAddress: string;
private readonly signCallback: SigningCallback;
private readonly signer: OfflineSigner;
private readonly fees: FeeTable;
/**
@ -175,14 +176,14 @@ export class SigningCosmWasmClient extends CosmWasmClient {
*
* @param apiUrl The URL of a Cosmos SDK light client daemon API (sometimes called REST server or REST API)
* @param senderAddress The address that will sign and send transactions using this instance
* @param signCallback An asynchonous callback to create a signature for a given transaction. This can be implemented using secure key stores that require user interaction.
* @param signer A wallet provider which can provide signatures for transactions, potentially requiring user input.
* @param customFees The fees that are paid for transactions
* @param broadcastMode Defines at which point of the transaction processing the postTx method (i.e. transaction broadcasting) returns
*/
public constructor(
apiUrl: string,
senderAddress: string,
signCallback: SigningCallback,
signer: OfflineSigner,
customFees?: Partial<FeeTable>,
broadcastMode = BroadcastMode.Block,
) {
@ -190,7 +191,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
this.anyValidAddress = senderAddress;
this.senderAddress = senderAddress;
this.signCallback = signCallback;
this.signer = signer;
this.fees = { ...defaultFees, ...(customFees || {}) };
}
@ -222,7 +223,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
const { accountNumber, sequence } = await this.getNonce();
const chainId = await this.getChainId();
const signBytes = makeSignBytes([storeCodeMsg], fee, chainId, memo, accountNumber, sequence);
const signature = await this.signCallback(signBytes);
const signature = await this.signer.sign(this.senderAddress, signBytes);
const signedTx: StdTx = {
msg: [storeCodeMsg],
fee: fee,
@ -272,7 +273,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
const chainId = await this.getChainId();
const signBytes = makeSignBytes([instantiateMsg], fee, chainId, memo, accountNumber, sequence);
const signature = await this.signCallback(signBytes);
const signature = await this.signer.sign(this.senderAddress, signBytes);
const signedTx: StdTx = {
msg: [instantiateMsg],
fee: fee,
@ -306,7 +307,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
const { accountNumber, sequence } = await this.getNonce();
const chainId = await this.getChainId();
const signBytes = makeSignBytes([updateAdminMsg], fee, chainId, memo, accountNumber, sequence);
const signature = await this.signCallback(signBytes);
const signature = await this.signer.sign(this.senderAddress, signBytes);
const signedTx: StdTx = {
msg: [updateAdminMsg],
fee: fee,
@ -336,7 +337,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
const { accountNumber, sequence } = await this.getNonce();
const chainId = await this.getChainId();
const signBytes = makeSignBytes([clearAdminMsg], fee, chainId, memo, accountNumber, sequence);
const signature = await this.signCallback(signBytes);
const signature = await this.signer.sign(this.senderAddress, signBytes);
const signedTx: StdTx = {
msg: [clearAdminMsg],
fee: fee,
@ -374,7 +375,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
const { accountNumber, sequence } = await this.getNonce();
const chainId = await this.getChainId();
const signBytes = makeSignBytes([msg], fee, chainId, memo, accountNumber, sequence);
const signature = await this.signCallback(signBytes);
const signature = await this.signer.sign(this.senderAddress, signBytes);
const signedTx: StdTx = {
msg: [msg],
fee: fee,
@ -412,7 +413,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
const { accountNumber, sequence } = await this.getNonce();
const chainId = await this.getChainId();
const signBytes = makeSignBytes([executeMsg], fee, chainId, memo, accountNumber, sequence);
const signature = await this.signCallback(signBytes);
const signature = await this.signer.sign(this.senderAddress, signBytes);
const signedTx: StdTx = {
msg: [executeMsg],
fee: fee,
@ -449,7 +450,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
const { accountNumber, sequence } = await this.getNonce();
const chainId = await this.getChainId();
const signBytes = makeSignBytes([sendMsg], fee, chainId, memo, accountNumber, sequence);
const signature = await this.signCallback(signBytes);
const signature = await this.signer.sign(this.senderAddress, signBytes);
const signedTx: StdTx = {
msg: [sendMsg],
fee: fee,

View File

@ -1,4 +1,4 @@
import { BroadcastMode, Coin, StdFee, StdSignature } from "@cosmjs/sdk38";
import { BroadcastMode, Coin, OfflineSigner, StdFee, StdSignature } from "@cosmjs/sdk38";
import { Account, CosmWasmClient, GetNonceResult, PostTxResult } from "./cosmwasmclient";
import { Log } from "./logs";
export interface SigningCallback {
@ -83,7 +83,7 @@ export interface ExecuteResult {
}
export declare class SigningCosmWasmClient extends CosmWasmClient {
readonly senderAddress: string;
private readonly signCallback;
private readonly signer;
private readonly fees;
/**
* Creates a new client with signing capability to interact with a CosmWasm blockchain. This is the bigger brother of CosmWasmClient.
@ -93,14 +93,14 @@ export declare class SigningCosmWasmClient extends CosmWasmClient {
*
* @param apiUrl The URL of a Cosmos SDK light client daemon API (sometimes called REST server or REST API)
* @param senderAddress The address that will sign and send transactions using this instance
* @param signCallback An asynchonous callback to create a signature for a given transaction. This can be implemented using secure key stores that require user interaction.
* @param signer A wallet provider which can provide signatures for transactions, potentially requiring user input.
* @param customFees The fees that are paid for transactions
* @param broadcastMode Defines at which point of the transaction processing the postTx method (i.e. transaction broadcasting) returns
*/
constructor(
apiUrl: string,
senderAddress: string,
signCallback: SigningCallback,
signer: OfflineSigner,
customFees?: Partial<FeeTable>,
broadcastMode?: BroadcastMode,
);