From 11ea9d30a1bea3b225458dcf55dff2d94b5bedf0 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Tue, 1 Jun 2021 09:07:53 +0200 Subject: [PATCH] Upgrade prettier to 2.3.0 --- packages/amino/src/signature.ts | 7 ++-- packages/amino/src/testutils.spec.ts | 3 +- packages/cli/README.md | 5 +-- .../src/cosmwasmclient.spec.ts | 8 ++-- .../cosmwasm-launchpad/src/cosmwasmclient.ts | 22 +++++----- .../src/signingcosmwasmclient.spec.ts | 11 ++--- .../cosmwasm-launchpad/src/testutils.spec.ts | 3 +- .../src/cosmwasmclient.spec.ts | 4 +- .../cosmwasm-stargate/src/cosmwasmclient.ts | 40 +++++++++---------- .../src/signingcosmwasmclient.spec.ts | 9 +---- .../cosmwasm-stargate/src/testutils.spec.ts | 3 +- packages/encoding/src/rfc3339.ts | 3 +- packages/launchpad/README.md | 10 ++--- packages/launchpad/src/cosmosclient.spec.ts | 6 +-- packages/launchpad/src/lcdapi/lcdclient.ts | 8 ++-- .../launchpad/src/signingcosmosclient.spec.ts | 10 ++--- packages/launchpad/src/testutils.spec.ts | 3 +- packages/ledger-amino/src/demo/node.ts | 4 +- packages/proto-signing/src/registry.spec.ts | 4 +- packages/proto-signing/src/testutils.spec.ts | 3 +- packages/stargate/src/fee.spec.ts | 11 ++--- packages/stargate/src/queries/ibc.spec.ts | 24 +++++------ packages/stargate/src/queries/queryclient.ts | 28 ++++++------- .../src/signingstargateclient.spec.ts | 10 ++--- packages/stargate/src/stargateclient.spec.ts | 2 +- .../tendermint-rpc/src/legacy/encodings.ts | 2 +- .../src/tendermint34/encodings.ts | 2 +- yarn.lock | 6 +-- 28 files changed, 117 insertions(+), 134 deletions(-) diff --git a/packages/amino/src/signature.ts b/packages/amino/src/signature.ts index 280653a2..cea95b01 100644 --- a/packages/amino/src/signature.ts +++ b/packages/amino/src/signature.ts @@ -28,9 +28,10 @@ export function encodeSecp256k1Signature(pubkey: Uint8Array, signature: Uint8Arr }; } -export function decodeSignature( - signature: StdSignature, -): { readonly pubkey: Uint8Array; readonly signature: Uint8Array } { +export function decodeSignature(signature: StdSignature): { + readonly pubkey: Uint8Array; + readonly signature: Uint8Array; +} { switch (signature.pub_key.type) { // Note: please don't add cases here without writing additional unit tests case pubkeyType.secp256k1: diff --git a/packages/amino/src/testutils.spec.ts b/packages/amino/src/testutils.spec.ts index 18c5f57b..9b7085aa 100644 --- a/packages/amino/src/testutils.spec.ts +++ b/packages/amino/src/testutils.spec.ts @@ -1,7 +1,8 @@ import { decodeBech32Pubkey } from "./encoding"; import { MultisigThresholdPubkey } from "./pubkeys"; -export const base64Matcher = /^(?:[a-zA-Z0-9+/]{4})*(?:|(?:[a-zA-Z0-9+/]{3}=)|(?:[a-zA-Z0-9+/]{2}==)|(?:[a-zA-Z0-9+/]{1}===))$/; +export const base64Matcher = + /^(?:[a-zA-Z0-9+/]{4})*(?:|(?:[a-zA-Z0-9+/]{3}=)|(?:[a-zA-Z0-9+/]{2}==)|(?:[a-zA-Z0-9+/]{1}===))$/; // ./build/wasmd keys add test1 // ./build/wasmd keys add test2 diff --git a/packages/cli/README.md b/packages/cli/README.md index 2671c734..274d0b63 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -45,9 +45,8 @@ $ cosmwasm-cli ```ts // Get account information -const { account_number, sequence } = ( - await client.authAccounts(faucetAddress) -).result.value; +const { account_number, sequence } = (await client.authAccounts(faucetAddress)) + .result.value; // Craft a send transaction const emptyAddress = Bech32.encode("cosmos", Random.getBytes(20)); diff --git a/packages/cosmwasm-launchpad/src/cosmwasmclient.spec.ts b/packages/cosmwasm-launchpad/src/cosmwasmclient.spec.ts index ef84dcbb..860f4cc1 100644 --- a/packages/cosmwasm-launchpad/src/cosmwasmclient.spec.ts +++ b/packages/cosmwasm-launchpad/src/cosmwasmclient.spec.ts @@ -57,7 +57,7 @@ describe("CosmWasmClient", () => { it("caches chain ID", async () => { pendingWithoutLaunchpad(); const client = new CosmWasmClient(launchpad.endpoint); - const openedClient = (client as unknown) as PrivateCosmWasmClient; + const openedClient = client as unknown as PrivateCosmWasmClient; const getCodeSpy = spyOn(openedClient.lcdClient, "nodeInfo").and.callThrough(); expect(await client.getChainId()).toEqual(launchpad.chainId); // from network @@ -71,7 +71,7 @@ describe("CosmWasmClient", () => { it("gets height via last block", async () => { pendingWithoutLaunchpad(); const client = new CosmWasmClient(launchpad.endpoint); - const openedClient = (client as unknown) as PrivateCosmWasmClient; + const openedClient = client as unknown as PrivateCosmWasmClient; const blockLatestSpy = spyOn(openedClient.lcdClient, "blocksLatest").and.callThrough(); const height1 = await client.getHeight(); @@ -88,7 +88,7 @@ describe("CosmWasmClient", () => { pendingWithoutLaunchpad(); const client = new CosmWasmClient(launchpad.endpoint); - const openedClient = (client as unknown) as PrivateCosmWasmClient; + const openedClient = client as unknown as PrivateCosmWasmClient; const blockLatestSpy = spyOn(openedClient.lcdClient, "blocksLatest").and.callThrough(); const authAccountsSpy = spyOn(openedClient.lcdClient.auth, "account").and.callThrough(); @@ -290,7 +290,7 @@ describe("CosmWasmClient", () => { it("caches downloads", async () => { pendingWithoutLaunchpad(); const client = new CosmWasmClient(launchpad.endpoint); - const openedClient = (client as unknown) as PrivateCosmWasmClient; + const openedClient = client as unknown as PrivateCosmWasmClient; const getCodeSpy = spyOn(openedClient.lcdClient.wasm, "getCode").and.callThrough(); const result1 = await client.getCodeDetails(deployedHackatom.codeId); // from network diff --git a/packages/cosmwasm-launchpad/src/cosmwasmclient.ts b/packages/cosmwasm-launchpad/src/cosmwasmclient.ts index 28c9d43c..1f7324e1 100644 --- a/packages/cosmwasm-launchpad/src/cosmwasmclient.ts +++ b/packages/cosmwasm-launchpad/src/cosmwasmclient.ts @@ -339,18 +339,16 @@ export class CosmWasmClient { public async getCodes(): Promise { const result = await this.lcdClient.wasm.listCodeInfo(); - return result.map( - (entry): Code => { - this.anyValidAddress = entry.creator; - return { - id: entry.id, - creator: entry.creator, - checksum: toHex(fromHex(entry.data_hash)), - source: entry.source || undefined, - builder: entry.builder || undefined, - }; - }, - ); + return result.map((entry): Code => { + this.anyValidAddress = entry.creator; + return { + id: entry.id, + creator: entry.creator, + checksum: toHex(fromHex(entry.data_hash)), + source: entry.source || undefined, + builder: entry.builder || undefined, + }; + }); } public async getCodeDetails(codeId: number): Promise { diff --git a/packages/cosmwasm-launchpad/src/signingcosmwasmclient.spec.ts b/packages/cosmwasm-launchpad/src/signingcosmwasmclient.spec.ts index 2cd5c49a..a8e47b2f 100644 --- a/packages/cosmwasm-launchpad/src/signingcosmwasmclient.spec.ts +++ b/packages/cosmwasm-launchpad/src/signingcosmwasmclient.spec.ts @@ -248,7 +248,7 @@ describe("SigningCosmWasmClient", () => { const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); const client = new SigningCosmWasmClient(launchpad.endpoint, alice.address0, wallet); - const openedClient = (client as unknown) as PrivateCosmWasmClient; + const openedClient = client as unknown as PrivateCosmWasmClient; const blockLatestSpy = spyOn(openedClient.lcdClient, "blocksLatest").and.callThrough(); const authAccountsSpy = spyOn(openedClient.lcdClient.auth, "account").and.callThrough(); @@ -266,13 +266,8 @@ describe("SigningCosmWasmClient", () => { const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic); const client = new SigningCosmWasmClient(launchpad.endpoint, alice.address0, wallet); const wasm = getHackatom().data; - const { - codeId, - originalChecksum, - originalSize, - compressedChecksum, - compressedSize, - } = await client.upload(wasm); + const { codeId, originalChecksum, originalSize, compressedChecksum, compressedSize } = + await client.upload(wasm); expect(originalChecksum).toEqual(toHex(sha256(wasm))); expect(originalSize).toEqual(wasm.length); expect(compressedChecksum).toMatch(/^[0-9a-f]{64}$/); diff --git a/packages/cosmwasm-launchpad/src/testutils.spec.ts b/packages/cosmwasm-launchpad/src/testutils.spec.ts index 5b2202b8..562b9ee0 100644 --- a/packages/cosmwasm-launchpad/src/testutils.spec.ts +++ b/packages/cosmwasm-launchpad/src/testutils.spec.ts @@ -25,7 +25,8 @@ export function makeRandomAddress(): string { export const tendermintIdMatcher = /^[0-9A-F]{64}$/; /** @see https://rgxdb.com/r/1NUN74O6 */ -export const base64Matcher = /^(?:[a-zA-Z0-9+/]{4})*(?:|(?:[a-zA-Z0-9+/]{3}=)|(?:[a-zA-Z0-9+/]{2}==)|(?:[a-zA-Z0-9+/]{1}===))$/; +export const base64Matcher = + /^(?:[a-zA-Z0-9+/]{4})*(?:|(?:[a-zA-Z0-9+/]{3}=)|(?:[a-zA-Z0-9+/]{2}==)|(?:[a-zA-Z0-9+/]{1}===))$/; // https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32 export const bech32AddressMatcher = /^[\x21-\x7e]{1,83}1[02-9ac-hj-np-z]{38}$/; diff --git a/packages/cosmwasm-stargate/src/cosmwasmclient.spec.ts b/packages/cosmwasm-stargate/src/cosmwasmclient.spec.ts index e0437dba..46dd0b20 100644 --- a/packages/cosmwasm-stargate/src/cosmwasmclient.spec.ts +++ b/packages/cosmwasm-stargate/src/cosmwasmclient.spec.ts @@ -57,7 +57,7 @@ describe("CosmWasmClient", () => { it("caches chain ID", async () => { pendingWithoutWasmd(); const client = await CosmWasmClient.connect(wasmd.endpoint); - const openedClient = (client as unknown) as PrivateCosmWasmClient; + const openedClient = client as unknown as PrivateCosmWasmClient; const getCodeSpy = spyOn(openedClient.tmClient!, "status").and.callThrough(); expect(await client.getChainId()).toEqual(wasmd.chainId); // from network @@ -258,7 +258,7 @@ describe("CosmWasmClient", () => { it("caches downloads", async () => { pendingWithoutWasmd(); const client = await CosmWasmClient.connect(wasmd.endpoint); - const openedClient = (client as unknown) as PrivateCosmWasmClient; + const openedClient = client as unknown as PrivateCosmWasmClient; const getCodeSpy = spyOn(openedClient.queryClient!.wasm, "getCode").and.callThrough(); const result1 = await client.getCodeDetails(deployedHackatom.codeId); // from network diff --git a/packages/cosmwasm-stargate/src/cosmwasmclient.ts b/packages/cosmwasm-stargate/src/cosmwasmclient.ts index 619b08b4..fbb9c014 100644 --- a/packages/cosmwasm-stargate/src/cosmwasmclient.ts +++ b/packages/cosmwasm-stargate/src/cosmwasmclient.ts @@ -274,18 +274,16 @@ export class CosmWasmClient { public async getCodes(): Promise { const { codeInfos } = await this.forceGetQueryClient().wasm.listCodeInfo(); - return (codeInfos || []).map( - (entry: CodeInfoResponse): Code => { - assert(entry.creator && entry.codeId && entry.dataHash, "entry incomplete"); - return { - id: entry.codeId.toNumber(), - creator: entry.creator, - checksum: toHex(entry.dataHash), - source: entry.source || undefined, - builder: entry.builder || undefined, - }; - }, - ); + return (codeInfos || []).map((entry: CodeInfoResponse): Code => { + assert(entry.creator && entry.codeId && entry.dataHash, "entry incomplete"); + return { + id: entry.codeId.toNumber(), + creator: entry.creator, + checksum: toHex(entry.dataHash), + source: entry.source || undefined, + builder: entry.builder || undefined, + }; + }); } public async getCodeDetails(codeId: number): Promise { @@ -345,16 +343,14 @@ export class CosmWasmClient { [ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS]: "Genesis", [ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE]: "Migrate", }; - return (result.entries || []).map( - (entry): ContractCodeHistoryEntry => { - assert(entry.operation && entry.codeId && entry.msg); - return { - operation: operations[entry.operation], - codeId: entry.codeId.toNumber(), - msg: JSON.parse(fromAscii(entry.msg)), - }; - }, - ); + return (result.entries || []).map((entry): ContractCodeHistoryEntry => { + assert(entry.operation && entry.codeId && entry.msg); + return { + operation: operations[entry.operation], + codeId: entry.codeId.toNumber(), + msg: JSON.parse(fromAscii(entry.msg)), + }; + }); } /** diff --git a/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts b/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts index ff14f70d..fe254e1e 100644 --- a/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts +++ b/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts @@ -228,13 +228,8 @@ describe("SigningCosmWasmClient", () => { const options = { prefix: wasmd.prefix }; const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, options); const wasm = getHackatom().data; - const { - codeId, - originalChecksum, - originalSize, - compressedChecksum, - compressedSize, - } = await client.upload(alice.address0, wasm); + const { codeId, originalChecksum, originalSize, compressedChecksum, compressedSize } = + await client.upload(alice.address0, wasm); expect(originalChecksum).toEqual(toHex(sha256(wasm))); expect(originalSize).toEqual(wasm.length); expect(compressedChecksum).toMatch(/^[0-9a-f]{64}$/); diff --git a/packages/cosmwasm-stargate/src/testutils.spec.ts b/packages/cosmwasm-stargate/src/testutils.spec.ts index e88c6843..8afc8ca1 100644 --- a/packages/cosmwasm-stargate/src/testutils.spec.ts +++ b/packages/cosmwasm-stargate/src/testutils.spec.ts @@ -55,7 +55,8 @@ export function makeRandomAddress(): string { export const tendermintIdMatcher = /^[0-9A-F]{64}$/; /** @see https://rgxdb.com/r/1NUN74O6 */ -export const base64Matcher = /^(?:[a-zA-Z0-9+/]{4})*(?:|(?:[a-zA-Z0-9+/]{3}=)|(?:[a-zA-Z0-9+/]{2}==)|(?:[a-zA-Z0-9+/]{1}===))$/; +export const base64Matcher = + /^(?:[a-zA-Z0-9+/]{4})*(?:|(?:[a-zA-Z0-9+/]{3}=)|(?:[a-zA-Z0-9+/]{2}==)|(?:[a-zA-Z0-9+/]{1}===))$/; // https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32 export const bech32AddressMatcher = /^[\x21-\x7e]{1,83}1[02-9ac-hj-np-z]{38}$/; diff --git a/packages/encoding/src/rfc3339.ts b/packages/encoding/src/rfc3339.ts index 180ee995..b5939f30 100644 --- a/packages/encoding/src/rfc3339.ts +++ b/packages/encoding/src/rfc3339.ts @@ -1,6 +1,7 @@ import { ReadonlyDate } from "readonly-date"; -const rfc3339Matcher = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?((?:[+-]\d{2}:\d{2})|Z)$/; +const rfc3339Matcher = + /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?((?:[+-]\d{2}:\d{2})|Z)$/; function padded(integer: number, length = 2): string { const filled = "00000" + integer.toString(); diff --git a/packages/launchpad/README.md b/packages/launchpad/README.md index f1ebf825..822375d0 100644 --- a/packages/launchpad/README.md +++ b/packages/launchpad/README.md @@ -255,9 +255,8 @@ transactions, you need to setup the auth extension with: import { LcdClient, setupAuthExtension } from "@cosmjs/launchpad"; const client = LcdClient.withExtensions({ apiUrl }, setupAuthExtension); -const { account_number, sequence } = ( - await client.auth.account(myAddress) -).result.value; +const { account_number, sequence } = (await client.auth.account(myAddress)) + .result.value; ``` A full client can use all of the following extensions: @@ -424,9 +423,8 @@ const fee: StdFee = { gas: "89000000", }; const memo = "Time for action"; -const { account_number, sequence } = ( - await client.auth.account(myAddress) -).result.value; +const { account_number, sequence } = (await client.auth.account(myAddress)) + .result.value; const signDoc = makeSignDoc([msg], fee, apiUrl, memo, account_number, sequence); const { signed, signature } = await signer.sign(myAddress, signDoc); const signedTx = makeStdTx(signed, signature); diff --git a/packages/launchpad/src/cosmosclient.spec.ts b/packages/launchpad/src/cosmosclient.spec.ts index 84a4e110..e19b848f 100644 --- a/packages/launchpad/src/cosmosclient.spec.ts +++ b/packages/launchpad/src/cosmosclient.spec.ts @@ -41,7 +41,7 @@ describe("CosmosClient", () => { it("caches chain ID", async () => { pendingWithoutLaunchpad(); const client = new CosmosClient(launchpad.endpoint); - const openedClient = (client as unknown) as PrivateCosmosClient; + const openedClient = client as unknown as PrivateCosmosClient; const getCodeSpy = spyOn(openedClient.lcdClient, "nodeInfo").and.callThrough(); expect(await client.getChainId()).toEqual(launchpad.chainId); // from network @@ -55,7 +55,7 @@ describe("CosmosClient", () => { it("gets height via last block", async () => { pendingWithoutLaunchpad(); const client = new CosmosClient(launchpad.endpoint); - const openedClient = (client as unknown) as PrivateCosmosClient; + const openedClient = client as unknown as PrivateCosmosClient; const blockLatestSpy = spyOn(openedClient.lcdClient, "blocksLatest").and.callThrough(); const height1 = await client.getHeight(); @@ -72,7 +72,7 @@ describe("CosmosClient", () => { pendingWithoutLaunchpad(); const client = new CosmosClient(launchpad.endpoint); - const openedClient = (client as unknown) as PrivateCosmosClient; + const openedClient = client as unknown as PrivateCosmosClient; const blockLatestSpy = spyOn(openedClient.lcdClient, "blocksLatest").and.callThrough(); const authAccountsSpy = spyOn(openedClient.lcdClient.auth, "account").and.callThrough(); diff --git a/packages/launchpad/src/lcdapi/lcdclient.ts b/packages/launchpad/src/lcdapi/lcdclient.ts index 02afc4cc..0ed7f40e 100644 --- a/packages/launchpad/src/lcdapi/lcdclient.ts +++ b/packages/launchpad/src/lcdapi/lcdclient.ts @@ -101,7 +101,7 @@ export class LcdClient { B extends object, C extends object, D extends object, - E extends object + E extends object, >( options: LcdClientBaseOptions, setupExtensionA: LcdExtensionSetup, @@ -118,7 +118,7 @@ export class LcdClient { C extends object, D extends object, E extends object, - F extends object + F extends object, >( options: LcdClientBaseOptions, setupExtensionA: LcdExtensionSetup, @@ -137,7 +137,7 @@ export class LcdClient { D extends object, E extends object, F extends object, - G extends object + G extends object, >( options: LcdClientBaseOptions, setupExtensionA: LcdExtensionSetup, @@ -158,7 +158,7 @@ export class LcdClient { E extends object, F extends object, G extends object, - H extends object + H extends object, >( options: LcdClientBaseOptions, setupExtensionA: LcdExtensionSetup, diff --git a/packages/launchpad/src/signingcosmosclient.spec.ts b/packages/launchpad/src/signingcosmosclient.spec.ts index 5878700c..a5a6f471 100644 --- a/packages/launchpad/src/signingcosmosclient.spec.ts +++ b/packages/launchpad/src/signingcosmosclient.spec.ts @@ -19,7 +19,7 @@ describe("SigningCosmosClient", () => { it("can be constructed with default fees", async () => { const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = new SigningCosmosClient(launchpad.endpoint, faucet.address0, wallet); - const openedClient = (client as unknown) as PrivateSigningCosmosClient; + const openedClient = client as unknown as PrivateSigningCosmosClient; expect(openedClient.fees).toEqual({ send: { amount: [ @@ -37,7 +37,7 @@ describe("SigningCosmosClient", () => { const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const gasPrice = GasPrice.fromString("3.14utest"); const client = new SigningCosmosClient(launchpad.endpoint, faucet.address0, wallet, gasPrice); - const openedClient = (client as unknown) as PrivateSigningCosmosClient; + const openedClient = client as unknown as PrivateSigningCosmosClient; expect(openedClient.fees).toEqual({ send: { amount: [ @@ -63,7 +63,7 @@ describe("SigningCosmosClient", () => { undefined, gasLimits, ); - const openedClient = (client as unknown) as PrivateSigningCosmosClient; + const openedClient = client as unknown as PrivateSigningCosmosClient; expect(openedClient.fees).toEqual({ send: { amount: [ @@ -90,7 +90,7 @@ describe("SigningCosmosClient", () => { gasPrice, gasLimits, ); - const openedClient = (client as unknown) as PrivateSigningCosmosClient; + const openedClient = client as unknown as PrivateSigningCosmosClient; expect(openedClient.fees).toEqual({ send: { amount: [ @@ -111,7 +111,7 @@ describe("SigningCosmosClient", () => { const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = new SigningCosmosClient(launchpad.endpoint, faucet.address0, wallet); - const openedClient = (client as unknown) as PrivateCosmosClient; + const openedClient = client as unknown as PrivateCosmosClient; const blockLatestSpy = spyOn(openedClient.lcdClient, "blocksLatest").and.callThrough(); const authAccountsSpy = spyOn(openedClient.lcdClient.auth, "account").and.callThrough(); diff --git a/packages/launchpad/src/testutils.spec.ts b/packages/launchpad/src/testutils.spec.ts index 57bea7d1..41bd378f 100644 --- a/packages/launchpad/src/testutils.spec.ts +++ b/packages/launchpad/src/testutils.spec.ts @@ -17,7 +17,8 @@ export const tendermintShortHashMatcher = /^[0-9a-f]{40}$/; export const dateTimeStampMatcher = /^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\.[0-9]+)?Z$/; export const semverMatcher = /^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/; /** @see https://rgxdb.com/r/1NUN74O6 */ -export const base64Matcher = /^(?:[a-zA-Z0-9+/]{4})*(?:|(?:[a-zA-Z0-9+/]{3}=)|(?:[a-zA-Z0-9+/]{2}==)|(?:[a-zA-Z0-9+/]{1}===))$/; +export const base64Matcher = + /^(?:[a-zA-Z0-9+/]{4})*(?:|(?:[a-zA-Z0-9+/]{3}=)|(?:[a-zA-Z0-9+/]{2}==)|(?:[a-zA-Z0-9+/]{1}===))$/; export const hexMatcher = /^([0-9a-fA-F][0-9a-fA-F])*$/; // https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32 diff --git a/packages/ledger-amino/src/demo/node.ts b/packages/ledger-amino/src/demo/node.ts index 7ab4a689..33ab7176 100644 --- a/packages/ledger-amino/src/demo/node.ts +++ b/packages/ledger-amino/src/demo/node.ts @@ -22,9 +22,7 @@ export async function createSigner(): Promise { }); } -export async function getAccounts( - signer: LedgerSigner, -): Promise< +export async function getAccounts(signer: LedgerSigner): Promise< ReadonlyArray<{ readonly algo: string; readonly address: string; diff --git a/packages/proto-signing/src/registry.spec.ts b/packages/proto-signing/src/registry.spec.ts index 274dac87..d4622092 100644 --- a/packages/proto-signing/src/registry.spec.ts +++ b/packages/proto-signing/src/registry.spec.ts @@ -23,11 +23,11 @@ describe("registry demo", () => { denom: "ucosm", amount: "1234567890", }); - const msgSend = (MsgSend.fromPartial({ + const msgSend = MsgSend.fromPartial({ fromAddress: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", toAddress: "cosmos1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu", amount: [coin], - }) as unknown) as IMsgSend; + }) as unknown as IMsgSend; const msgSendBytes = MsgSend.encode(msgSend).finish(); const msgSendWrapped = Any.fromPartial({ typeUrl: "/cosmos.bank.v1beta1.MsgSend", diff --git a/packages/proto-signing/src/testutils.spec.ts b/packages/proto-signing/src/testutils.spec.ts index 1e3c2350..1c1c4a3e 100644 --- a/packages/proto-signing/src/testutils.spec.ts +++ b/packages/proto-signing/src/testutils.spec.ts @@ -1,5 +1,6 @@ /** @see https://rgxdb.com/r/1NUN74O6 */ -export const base64Matcher = /^(?:[a-zA-Z0-9+/]{4})*(?:|(?:[a-zA-Z0-9+/]{3}=)|(?:[a-zA-Z0-9+/]{2}==)|(?:[a-zA-Z0-9+/]{1}===))$/; +export const base64Matcher = + /^(?:[a-zA-Z0-9+/]{4})*(?:|(?:[a-zA-Z0-9+/]{3}=)|(?:[a-zA-Z0-9+/]{2}==)|(?:[a-zA-Z0-9+/]{1}===))$/; export const faucet = { mnemonic: diff --git a/packages/stargate/src/fee.spec.ts b/packages/stargate/src/fee.spec.ts index e92b5fa8..1407ea65 100644 --- a/packages/stargate/src/fee.spec.ts +++ b/packages/stargate/src/fee.spec.ts @@ -21,11 +21,12 @@ describe("GasPrice", () => { "0.14utest": { amount: "0.14", denom: "utest" }, // Test denoms "0.14sht": { amount: "0.14", denom: "sht" }, - "0.14testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest": { - amount: "0.14", - denom: - "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest", - }, + "0.14testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest": + { + amount: "0.14", + denom: + "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest", + }, "0.14ucoin2": { amount: "0.14", denom: "ucoin2" }, // eslint-disable-next-line @typescript-eslint/naming-convention "0.14FOOBAR": { amount: "0.14", denom: "FOOBAR" }, diff --git a/packages/stargate/src/queries/ibc.spec.ts b/packages/stargate/src/queries/ibc.spec.ts index 3547f2bd..3cbd832b 100644 --- a/packages/stargate/src/queries/ibc.spec.ts +++ b/packages/stargate/src/queries/ibc.spec.ts @@ -228,11 +228,11 @@ describe("IbcExtension", () => { pendingWithoutSimapp(); const [client, tmClient] = await makeClientWithIbc(simapp.tendermintUrl); - const response = await client.ibc.channel.unreceivedPackets(ibcTest.portId, ibcTest.channelId, [ - 1, - 2, - 3, - ]); + const response = await client.ibc.channel.unreceivedPackets( + ibcTest.portId, + ibcTest.channelId, + [1, 2, 3], + ); expect(response.sequences).toEqual([1, 2, 3].map((n) => Long.fromInt(n, true))); expect(response.height).toBeDefined(); @@ -245,15 +245,11 @@ describe("IbcExtension", () => { pendingWithoutSimapp(); const [client, tmClient] = await makeClientWithIbc(simapp.tendermintUrl); - const response = await client.ibc.channel.unreceivedAcks(ibcTest.portId, ibcTest.channelId, [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - ]); + const response = await client.ibc.channel.unreceivedAcks( + ibcTest.portId, + ibcTest.channelId, + [1, 2, 3, 4, 5, 6, 7], + ); expect(response.sequences).toEqual([Long.fromInt(ibcTest.commitment.sequence, true)]); expect(response.height).toBeDefined(); diff --git a/packages/stargate/src/queries/queryclient.ts b/packages/stargate/src/queries/queryclient.ts index 834bc65c..f22e1d9b 100644 --- a/packages/stargate/src/queries/queryclient.ts +++ b/packages/stargate/src/queries/queryclient.ts @@ -67,7 +67,7 @@ export class QueryClient { B extends object, C extends object, D extends object, - E extends object + E extends object, >( tmClient: Tendermint34Client, setupExtensionA: QueryExtensionSetup, @@ -84,7 +84,7 @@ export class QueryClient { C extends object, D extends object, E extends object, - F extends object + F extends object, >( tmClient: Tendermint34Client, setupExtensionA: QueryExtensionSetup, @@ -103,7 +103,7 @@ export class QueryClient { D extends object, E extends object, F extends object, - G extends object + G extends object, >( tmClient: Tendermint34Client, setupExtensionA: QueryExtensionSetup, @@ -124,7 +124,7 @@ export class QueryClient { E extends object, F extends object, G extends object, - H extends object + H extends object, >( tmClient: Tendermint34Client, setupExtensionA: QueryExtensionSetup, @@ -147,7 +147,7 @@ export class QueryClient { F extends object, G extends object, H extends object, - I extends object + I extends object, >( tmClient: Tendermint34Client, setupExtensionA: QueryExtensionSetup, @@ -172,7 +172,7 @@ export class QueryClient { G extends object, H extends object, I extends object, - J extends object + J extends object, >( tmClient: Tendermint34Client, setupExtensionA: QueryExtensionSetup, @@ -199,7 +199,7 @@ export class QueryClient { H extends object, I extends object, J extends object, - K extends object + K extends object, >( tmClient: Tendermint34Client, setupExtensionA: QueryExtensionSetup, @@ -228,7 +228,7 @@ export class QueryClient { I extends object, J extends object, K extends object, - L extends object + L extends object, >( tmClient: Tendermint34Client, setupExtensionA: QueryExtensionSetup, @@ -259,7 +259,7 @@ export class QueryClient { J extends object, K extends object, L extends object, - M extends object + M extends object, >( tmClient: Tendermint34Client, setupExtensionA: QueryExtensionSetup, @@ -292,7 +292,7 @@ export class QueryClient { K extends object, L extends object, M extends object, - N extends object + N extends object, >( tmClient: Tendermint34Client, setupExtensionA: QueryExtensionSetup, @@ -327,7 +327,7 @@ export class QueryClient { L extends object, M extends object, N extends object, - O extends object + O extends object, >( tmClient: Tendermint34Client, setupExtensionA: QueryExtensionSetup, @@ -364,7 +364,7 @@ export class QueryClient { M extends object, N extends object, O extends object, - P extends object + P extends object, >( tmClient: Tendermint34Client, setupExtensionA: QueryExtensionSetup, @@ -403,7 +403,7 @@ export class QueryClient { N extends object, O extends object, P extends object, - Q extends object + Q extends object, >( tmClient: Tendermint34Client, setupExtensionA: QueryExtensionSetup, @@ -444,7 +444,7 @@ export class QueryClient { O extends object, P extends object, Q extends object, - R extends object + R extends object, >( tmClient: Tendermint34Client, setupExtensionA: QueryExtensionSetup, diff --git a/packages/stargate/src/signingstargateclient.spec.ts b/packages/stargate/src/signingstargateclient.spec.ts index f882f8cc..c547f26b 100644 --- a/packages/stargate/src/signingstargateclient.spec.ts +++ b/packages/stargate/src/signingstargateclient.spec.ts @@ -31,7 +31,7 @@ describe("SigningStargateClient", () => { pendingWithoutSimapp(); const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner(simapp.tendermintUrl, wallet); - const openedClient = (client as unknown) as PrivateSigningStargateClient; + const openedClient = client as unknown as PrivateSigningStargateClient; expect(openedClient.fees).toEqual({ send: { amount: [ @@ -88,7 +88,7 @@ describe("SigningStargateClient", () => { registry.register("/custom.MsgCustom", MsgSend); const options = { registry: registry }; const client = await SigningStargateClient.connectWithSigner(simapp.tendermintUrl, wallet, options); - const openedClient = (client as unknown) as PrivateSigningStargateClient; + const openedClient = client as unknown as PrivateSigningStargateClient; expect(openedClient.registry.lookupType("/custom.MsgCustom")).toEqual(MsgSend); }); @@ -98,7 +98,7 @@ describe("SigningStargateClient", () => { const gasPrice = GasPrice.fromString("3.14utest"); const options = { gasPrice: gasPrice }; const client = await SigningStargateClient.connectWithSigner(simapp.tendermintUrl, wallet, options); - const openedClient = (client as unknown) as PrivateSigningStargateClient; + const openedClient = client as unknown as PrivateSigningStargateClient; expect(openedClient.fees).toEqual({ send: { amount: [ @@ -157,7 +157,7 @@ describe("SigningStargateClient", () => { }; const options = { gasLimits: gasLimits }; const client = await SigningStargateClient.connectWithSigner(simapp.tendermintUrl, wallet, options); - const openedClient = (client as unknown) as PrivateSigningStargateClient; + const openedClient = client as unknown as PrivateSigningStargateClient; expect(openedClient.fees).toEqual({ send: { amount: [ @@ -216,7 +216,7 @@ describe("SigningStargateClient", () => { }; const options = { gasPrice: gasPrice, gasLimits: gasLimits }; const client = await SigningStargateClient.connectWithSigner(simapp.tendermintUrl, wallet, options); - const openedClient = (client as unknown) as PrivateSigningStargateClient; + const openedClient = client as unknown as PrivateSigningStargateClient; expect(openedClient.fees).toEqual({ send: { amount: [ diff --git a/packages/stargate/src/stargateclient.spec.ts b/packages/stargate/src/stargateclient.spec.ts index ca2d2b7c..36056986 100644 --- a/packages/stargate/src/stargateclient.spec.ts +++ b/packages/stargate/src/stargateclient.spec.ts @@ -53,7 +53,7 @@ describe("StargateClient", () => { it("caches chain ID", async () => { pendingWithoutSimapp(); const client = await StargateClient.connect(simapp.tendermintUrl); - const openedClient = (client as unknown) as PrivateStargateClient; + const openedClient = client as unknown as PrivateStargateClient; const getCodeSpy = spyOn(openedClient.tmClient!, "status").and.callThrough(); expect(await client.getChainId()).toEqual(simapp.chainId); // from network diff --git a/packages/tendermint-rpc/src/legacy/encodings.ts b/packages/tendermint-rpc/src/legacy/encodings.ts index f950fd17..bbdcfc2a 100644 --- a/packages/tendermint-rpc/src/legacy/encodings.ts +++ b/packages/tendermint-rpc/src/legacy/encodings.ts @@ -117,7 +117,7 @@ export function assertNotEmpty(value: T): T { if (typeof value === "number" && value === 0) { throw new Error("must provide a non-zero value"); - } else if (((value as any) as Lengther).length === 0) { + } else if ((value as any as Lengther).length === 0) { throw new Error("must provide a non-empty value"); } return value; diff --git a/packages/tendermint-rpc/src/tendermint34/encodings.ts b/packages/tendermint-rpc/src/tendermint34/encodings.ts index f950fd17..bbdcfc2a 100644 --- a/packages/tendermint-rpc/src/tendermint34/encodings.ts +++ b/packages/tendermint-rpc/src/tendermint34/encodings.ts @@ -117,7 +117,7 @@ export function assertNotEmpty(value: T): T { if (typeof value === "number" && value === 0) { throw new Error("must provide a non-zero value"); - } else if (((value as any) as Lengther).length === 0) { + } else if ((value as any as Lengther).length === 0) { throw new Error("must provide a non-empty value"); } return value; diff --git a/yarn.lock b/yarn.lock index 0dc47276..537b2800 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6418,9 +6418,9 @@ prettier-linter-helpers@^1.0.0: fast-diff "^1.1.2" prettier@^2.0.2, prettier@^2.0.5: - version "2.2.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" - integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== + version "2.3.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.0.tgz#b6a5bf1284026ae640f17f7ff5658a7567fc0d18" + integrity sha512-kXtO4s0Lz/DW/IJ9QdWhAf7/NmPWQXkFr/r/WkR3vyI+0v8amTDxiaQSLzs8NBlytfLWX/7uQUMIW677yLKl4w== process-nextick-args@~2.0.0: version "2.0.1"