From 5ef77185a1c1722598127f5ce002c69525ddd236 Mon Sep 17 00:00:00 2001 From: Dave Hrycyszyn Date: Fri, 19 Mar 2021 16:35:46 +0000 Subject: [PATCH] Feature/hook up url in validator client (#535) * Exporting Coin struct, needed for wallet * Passing the url through instead of using local options. This gives us the ability to hook up to the new validator --- clients/validator/src/index.ts | 2 +- clients/validator/src/net-client.ts | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/clients/validator/src/index.ts b/clients/validator/src/index.ts index dcfd905963..6d616d7ad4 100644 --- a/clients/validator/src/index.ts +++ b/clients/validator/src/index.ts @@ -39,7 +39,7 @@ export default class ValidatorClient { static async connect(contractAddress: string, mnemonic: string, url: string): Promise { const wallet = await ValidatorClient.buildWallet(mnemonic); const [{ address }] = await wallet.getAccounts(); - const netClient = await NetClient.connect(contractAddress, wallet, url); + const netClient = await NetClient.connect(wallet, url); return new ValidatorClient(url, netClient, wallet, address, contractAddress); } diff --git a/clients/validator/src/net-client.ts b/clients/validator/src/net-client.ts index 204c74f3cc..a294f44c80 100644 --- a/clients/validator/src/net-client.ts +++ b/clients/validator/src/net-client.ts @@ -1,10 +1,10 @@ -import {SigningCosmWasmClient, SigningCosmWasmClientOptions} from "@cosmjs/cosmwasm-stargate"; -import {GatewayBond, MixNodeBond} from "./types" -import {DirectSecp256k1HdWallet} from "@cosmjs/proto-signing"; -import {Coin, GasPrice} from "@cosmjs/launchpad"; -import {BroadcastTxResponse} from "@cosmjs/stargate/types" -import {defaultOptions, nymGasLimits, Options} from "./stargate-helper" -import {ExecuteResult, InstantiateOptions, InstantiateResult, UploadMeta, UploadResult} from "@cosmjs/cosmwasm"; +import { SigningCosmWasmClient, SigningCosmWasmClientOptions } from "@cosmjs/cosmwasm-stargate"; +import { GatewayBond, MixNodeBond } from "./types" +import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; +import { Coin, GasPrice } from "@cosmjs/launchpad"; +import { BroadcastTxResponse } from "@cosmjs/stargate/types" +import { defaultOptions, nymGasLimits, Options } from "./stargate-helper" +import { ExecuteResult, InstantiateOptions, InstantiateResult, UploadMeta, UploadResult } from "@cosmjs/cosmwasm"; export interface INetClient { getBalance(address: string): Promise; @@ -33,15 +33,13 @@ export default class NetClient implements INetClient { this.cosmClient = cosmClient; } - public static async connect(contractAddress: string, wallet: DirectSecp256k1HdWallet, url?: string, opts?: Partial): Promise { - const options: Options = { ...defaultOptions, ...opts } + public static async connect(wallet: DirectSecp256k1HdWallet, url: string, opts?: Partial): Promise { const [{ address }] = await wallet.getAccounts(); const signerOptions: SigningCosmWasmClientOptions = { gasPrice: GasPrice.fromString("0.025unym"), gasLimits: nymGasLimits, }; - const client = await SigningCosmWasmClient.connectWithSigner(options.httpUrl, wallet, signerOptions); - + const client = await SigningCosmWasmClient.connectWithSigner(url, wallet, signerOptions); return new NetClient(address, client); }