Upgrade prettier to version 2

This commit is contained in:
Simon Warta 2020-04-17 08:35:55 +02:00
parent 5733fe9d37
commit ab2f737b9f
20 changed files with 85 additions and 83 deletions

View File

@ -50,7 +50,7 @@
"karma-jasmine": "^3",
"karma-jasmine-html-reporter": "^1.4",
"lerna": "^3.20.2",
"prettier": "^1.19.1",
"prettier": "^2",
"shx": "^0.3.2",
"source-map-support": "^0.5.6",
"typescript": "~3.7",

View File

@ -1,4 +1,4 @@
module.exports = function(config) {
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: ".",

View File

@ -278,7 +278,7 @@ describe("CosmWasmConnection", () => {
});
describe("watchAccount", () => {
it("can watch account by address", done => {
it("can watch account by address", (done) => {
pendingWithoutWasmd();
const recipient = makeRandomAddress();
const events = new Array<Account | undefined>();
@ -286,7 +286,7 @@ describe("CosmWasmConnection", () => {
(async () => {
const connection = await CosmWasmConnection.establish(httpUrl, defaultAddressPrefix, defaultConfig);
const subscription = connection.watchAccount({ address: recipient }).subscribe({
next: event => {
next: (event) => {
events.push(event);
if (events.length === 3) {
@ -335,7 +335,7 @@ describe("CosmWasmConnection", () => {
const nonce = await connection.getNonce({ address: senderAddress });
const signedTransaction = await profile.signTransaction(sender, sendTx, connection.codec, nonce);
const result = await connection.postTx(connection.codec.bytesToPost(signedTransaction));
await result.blockInfo.waitFor(info => !isBlockInfoPending(info));
await result.blockInfo.waitFor((info) => !isBlockInfoPending(info));
}
})().catch(done.fail);
});
@ -367,7 +367,7 @@ describe("CosmWasmConnection", () => {
const postableBytes = connection.codec.bytesToPost(signed);
const response = await connection.postTx(postableBytes);
const { transactionId } = response;
await response.blockInfo.waitFor(info => isBlockInfoSucceeded(info));
await response.blockInfo.waitFor((info) => isBlockInfoSucceeded(info));
const getResponse = await connection.getTx(transactionId);
expect(getResponse.transactionId).toEqual(transactionId);
@ -418,7 +418,7 @@ describe("CosmWasmConnection", () => {
const postableBytes = connection.codec.bytesToPost(signed);
const response = await connection.postTx(postableBytes);
const { transactionId } = response;
await response.blockInfo.waitFor(info => isBlockInfoSucceeded(info));
await response.blockInfo.waitFor((info) => isBlockInfoSucceeded(info));
const getResponse = await connection.getTx(transactionId);
expect(getResponse.transactionId).toEqual(transactionId);
@ -491,7 +491,7 @@ describe("CosmWasmConnection", () => {
const nonExistentId = "0000000000000000000000000000000000000000000000000000000000000000" as TransactionId;
await connection.getTx(nonExistentId).then(
() => fail("this must not succeed"),
error => expect(error).toMatch(/transaction does not exist/i),
(error) => expect(error).toMatch(/transaction does not exist/i),
);
connection.disconnect();
@ -524,7 +524,7 @@ describe("CosmWasmConnection", () => {
const postableBytes = connection.codec.bytesToPost(signed);
const response = await connection.postTx(postableBytes);
const { transactionId } = response;
const blockInfo = await response.blockInfo.waitFor(info => !isBlockInfoPending(info));
const blockInfo = await response.blockInfo.waitFor((info) => !isBlockInfoPending(info));
expect(blockInfo.state).toEqual(TransactionState.Succeeded);
// search by id
@ -615,7 +615,7 @@ describe("CosmWasmConnection", () => {
const postableBytes = connection.codec.bytesToPost(signed);
const response = await connection.postTx(postableBytes);
const { transactionId } = response;
const blockInfo = await response.blockInfo.waitFor(info => !isBlockInfoPending(info));
const blockInfo = await response.blockInfo.waitFor((info) => !isBlockInfoPending(info));
expect(blockInfo.state).toEqual(TransactionState.Succeeded);
// search by id
@ -733,7 +733,7 @@ describe("CosmWasmConnection", () => {
const postableBytes = connection.codec.bytesToPost(signed);
const response = await connection.postTx(postableBytes);
const { transactionId } = response;
const blockInfo = await response.blockInfo.waitFor(info => !isBlockInfoPending(info));
const blockInfo = await response.blockInfo.waitFor((info) => !isBlockInfoPending(info));
assert(isBlockInfoSucceeded(blockInfo));
const { height } = blockInfo;
@ -916,7 +916,7 @@ describe("CosmWasmConnection", () => {
});
describe("liveTx", () => {
it("can listen to transactions by recipient address (transactions in history and updates)", done => {
it("can listen to transactions by recipient address (transactions in history and updates)", (done) => {
pendingWithoutWasmd();
(async () => {
@ -969,14 +969,14 @@ describe("CosmWasmConnection", () => {
// Post A and B. Unfortunately the REST server API does not support sending them in parallel because the sequence check fails.
const postResultA = await connection.postTx(bytesToPostA);
await postResultA.blockInfo.waitFor(info => !isBlockInfoPending(info));
await postResultA.blockInfo.waitFor((info) => !isBlockInfoPending(info));
const postResultB = await connection.postTx(bytesToPostB);
await postResultB.blockInfo.waitFor(info => !isBlockInfoPending(info));
await postResultB.blockInfo.waitFor((info) => !isBlockInfoPending(info));
// setup listener after A and B are in block
const events = new Array<ConfirmedTransaction<UnsignedTransaction>>();
const subscription = connection.liveTx({ sentFromOrTo: recipientAddress }).subscribe({
next: event => {
next: (event) => {
assert(isConfirmedTransaction(event), "Confirmed transaction expected");
events.push(event);
@ -999,7 +999,7 @@ describe("CosmWasmConnection", () => {
})().catch(done.fail);
});
it("can listen to transactions by ID (transaction in history)", done => {
it("can listen to transactions by ID (transaction in history)", (done) => {
pendingWithoutWasmd();
(async () => {
@ -1028,12 +1028,12 @@ describe("CosmWasmConnection", () => {
const transactionId = postResult.transactionId;
// Wait for a block
await postResult.blockInfo.waitFor(info => !isBlockInfoPending(info));
await postResult.blockInfo.waitFor((info) => !isBlockInfoPending(info));
// setup listener after transaction is in block
const events = new Array<ConfirmedTransaction<UnsignedTransaction>>();
const subscription = connection.liveTx({ id: transactionId }).subscribe({
next: event => {
next: (event) => {
assert(isConfirmedTransaction(event), "Confirmed transaction expected");
events.push(event);
@ -1049,7 +1049,7 @@ describe("CosmWasmConnection", () => {
})().catch(done.fail);
});
it("can listen to transactions by ID (transaction in updates)", done => {
it("can listen to transactions by ID (transaction in updates)", (done) => {
pendingWithoutWasmd();
(async () => {
@ -1082,7 +1082,7 @@ describe("CosmWasmConnection", () => {
// setup listener before transaction is in block
const events = new Array<ConfirmedTransaction<UnsignedTransaction>>();
const subscription = connection.liveTx({ id: transactionId }).subscribe({
next: event => {
next: (event) => {
assert(isConfirmedTransaction(event), "Confirmed transaction expected");
events.push(event);

View File

@ -62,7 +62,7 @@ function isDefined<X>(value: X | undefined): value is X {
function deduplicate<T>(input: ReadonlyArray<T>, comparator: (a: T, b: T) => number): Array<T> {
const out = new Array<T>();
for (const element of input) {
if (!out.find(o => comparator(o, element) === 0)) {
if (!out.find((o) => comparator(o, element) === 0)) {
out.push(element);
}
}
@ -125,7 +125,7 @@ export class CosmWasmConnection implements BlockchainConnection {
const erc20Tokens = tokens.erc20Tokens || [];
this.erc20Tokens = erc20Tokens;
this.supportedTokens = [...tokens.bankTokens, ...erc20Tokens]
.map(info => ({
.map((info) => ({
tokenTicker: info.ticker as TokenTicker,
tokenName: info.name,
fractionalDigits: info.fractionalDigits,
@ -164,7 +164,7 @@ export class CosmWasmConnection implements BlockchainConnection {
const bankAccount = await this.cosmWasmClient.getAccount(address);
const supportedBankCoins = (bankAccount?.balance || []).filter(({ denom }) =>
this.bankTokens.find(token => token.denom === denom),
this.bankTokens.find((token) => token.denom === denom),
);
const erc20Amounts = await Promise.all(
this.erc20Tokens.map(
@ -181,13 +181,13 @@ export class CosmWasmConnection implements BlockchainConnection {
},
),
);
const nonZeroErc20Amounts = erc20Amounts.filter(amount => amount.quantity !== "0");
const nonZeroErc20Amounts = erc20Amounts.filter((amount) => amount.quantity !== "0");
if (!bankAccount && nonZeroErc20Amounts.length === 0) {
return undefined;
} else {
const balance = [
...supportedBankCoins.map(coin => decodeAmount(this.bankTokens, coin)),
...supportedBankCoins.map((coin) => decodeAmount(this.bankTokens, coin)),
...nonZeroErc20Amounts,
].sort((a, b) => a.tokenTicker.localeCompare(b.tokenTicker));
const pubkey = bankAccount?.pubkey ? decodePubkey(bankAccount.pubkey) : undefined;
@ -203,7 +203,7 @@ export class CosmWasmConnection implements BlockchainConnection {
let lastEvent: LastWatchAccountEvent = "no_event_fired_yet";
let pollInternal: NodeJS.Timeout | undefined;
const producer: Producer<Account | undefined> = {
start: async listener => {
start: async (listener) => {
const poll = async (): Promise<void> => {
try {
const event = await this.getAccount(query);
@ -343,7 +343,7 @@ export class CosmWasmConnection implements BlockchainConnection {
} else if (sentFromOrTo) {
const pendingRequests = new Array<Promise<readonly IndexedTx[]>>();
pendingRequests.push(this.cosmWasmClient.searchTx({ sentFromOrTo: sentFromOrTo }, filter));
for (const contract of this.erc20Tokens.map(token => token.contractAddress)) {
for (const contract of this.erc20Tokens.map((token) => token.contractAddress)) {
const searchBySender = [
{
key: "wasm.contract_address",
@ -374,7 +374,7 @@ export class CosmWasmConnection implements BlockchainConnection {
throw new Error("Unsupported query");
}
return txs.map(tx => this.parseAndPopulateTxResponseUnsigned(tx));
return txs.map((tx) => this.parseAndPopulateTxResponseUnsigned(tx));
}
public listenTx(
@ -400,7 +400,7 @@ export class CosmWasmConnection implements BlockchainConnection {
} else if (query.sentFromOrTo) {
let pollInternal: NodeJS.Timeout | undefined;
const producer: Producer<ConfirmedTransaction<UnsignedTransaction> | FailedTransaction> = {
start: async listener => {
start: async (listener) => {
let minHeight = query.minHeight || 0;
const maxHeight = query.maxHeight || Number.MAX_SAFE_INTEGER;
@ -514,7 +514,7 @@ export class CosmWasmConnection implements BlockchainConnection {
): Stream<ConfirmedTransaction<UnsignedTransaction> | FailedTransaction> {
let pollInternal: NodeJS.Timeout | undefined;
const producer: Producer<ConfirmedTransaction<UnsignedTransaction> | FailedTransaction> = {
start: listener => {
start: (listener) => {
setInterval(async () => {
try {
const results = await this.searchTx({ id: id });

View File

@ -93,7 +93,7 @@ export function parseMsg(
};
return send;
} else if (types.isMsgExecuteContract(msg)) {
const matchingTokenContract = erc20Tokens.find(t => t.contractAddress === msg.value.contract);
const matchingTokenContract = erc20Tokens.find((t) => t.contractAddress === msg.value.contract);
if (!matchingTokenContract) {
return {
chainId: chainId,
@ -170,7 +170,7 @@ export function parseSignedTx(
tokens: BankTokens,
erc20Tokens: readonly Erc20Token[],
): SignedTransaction {
const [primarySignature] = txValue.signatures.map(signature => decodeFullSignature(signature, nonce));
const [primarySignature] = txValue.signatures.map((signature) => decodeFullSignature(signature, nonce));
return {
transaction: parseUnsignedTx(txValue, chainId, tokens, erc20Tokens),
signatures: [primarySignature],

View File

@ -41,7 +41,7 @@ export function toErc20Amount(amount: Amount, erc20Token: Erc20Token): string {
}
export function toBankCoin(amount: Amount, tokens: BankTokens): types.Coin {
const match = tokens.find(token => token.ticker === amount.tokenTicker);
const match = tokens.find((token) => token.ticker === amount.tokenTicker);
if (!match) throw Error(`unknown ticker: ${amount.tokenTicker}`);
if (match.fractionalDigits !== amount.fractionalDigits) {
throw new Error(
@ -88,8 +88,8 @@ export function buildUnsignedTx(
throw new Error("Received transaction of unsupported kind");
}
const matchingBankToken = bankTokens.find(t => t.ticker === tx.amount.tokenTicker);
const matchingErc20Token = erc20Tokens.find(t => t.ticker === tx.amount.tokenTicker);
const matchingBankToken = bankTokens.find((t) => t.ticker === tx.amount.tokenTicker);
const matchingErc20Token = erc20Tokens.find((t) => t.ticker === tx.amount.tokenTicker);
if (!tx.fee) throw new Error("Transaction fee must be set");

View File

@ -22,7 +22,7 @@ export class Webserver {
this.api.use(cors());
this.api.use(bodyParser());
this.api.use(async context => {
this.api.use(async (context) => {
switch (context.path) {
case "/":
case "/healthz":

View File

@ -11,7 +11,7 @@ export function main(args: ReadonlyArray<string>): void {
switch (action) {
case "generate":
generate(restArgs).catch(error => {
generate(restArgs).catch((error) => {
console.error(error);
process.exit(1);
});
@ -20,13 +20,13 @@ export function main(args: ReadonlyArray<string>): void {
help();
break;
case "version":
version().catch(error => {
version().catch((error) => {
console.error(error);
process.exit(1);
});
break;
case "start":
start(restArgs).catch(error => {
start(restArgs).catch((error) => {
console.error(error);
process.exit(1);
});

View File

@ -27,7 +27,7 @@ export function logAccountsState(accounts: ReadonlyArray<Account>): void {
const holder = accounts[0];
const distributors = accounts.slice(1);
console.info("Holder:\n" + ` ${debugAccount(holder)}`);
console.info("Distributors:\n" + distributors.map(r => ` ${debugAccount(r)}`).join("\n"));
console.info("Distributors:\n" + distributors.map((r) => ` ${debugAccount(r)}`).join("\n"));
}
export function logSendJob(job: SendJob): void {

View File

@ -66,7 +66,7 @@ export class Faucet {
const signed = await this.profile.signTransaction(job.sender, sendWithFee, this.codec, nonce);
const post = await this.connection.postTx(this.codec.bytesToPost(signed));
const blockInfo = await post.blockInfo.waitFor(info => !isBlockInfoPending(info));
const blockInfo = await post.blockInfo.waitFor((info) => !isBlockInfoPending(info));
if (isBlockInfoFailed(blockInfo)) {
throw new Error(`Sending tokens failed. Code: ${blockInfo.code}, message: ${blockInfo.message}`);
}
@ -86,11 +86,11 @@ export class Faucet {
}
public async loadTokenTickers(): Promise<ReadonlyArray<TokenTicker>> {
return (await this.connection.getAllTokens()).map(token => token.tokenTicker);
return (await this.connection.getAllTokens()).map((token) => token.tokenTicker);
}
public async loadAccounts(): Promise<ReadonlyArray<Pick<Account, "address" | "balance">>> {
const addresses = identitiesOfFirstWallet(this.profile).map(identity => identityToAddress(identity));
const addresses = identitiesOfFirstWallet(this.profile).map((identity) => identityToAddress(identity));
const out: Account[] = [];
for (const address of addresses) {
@ -126,14 +126,16 @@ export class Faucet {
const jobs: SendJob[] = [];
for (const token of availableTokens) {
const refillDistibutors = distributorAccounts.filter(account =>
const refillDistibutors = distributorAccounts.filter((account) =>
this.tokenManager.needsRefill(account, token),
);
if (this.logging) {
console.info(`Refilling ${token} of:`);
console.info(
refillDistibutors.length ? refillDistibutors.map(r => ` ${debugAccount(r)}`).join("\n") : " none",
refillDistibutors.length
? refillDistibutors.map((r) => ` ${debugAccount(r)}`).join("\n")
: " none",
);
}
for (const refillDistibutor of refillDistibutors) {

View File

@ -7,5 +7,5 @@ export function identitiesOfFirstWallet(profile: UserProfile): ReadonlyArray<Ide
}
export function availableTokensFromHolder(holderAccount: Account): ReadonlyArray<TokenTicker> {
return holderAccount.balance.map(coin => coin.tokenTicker);
return holderAccount.balance.map((coin) => coin.tokenTicker);
}

View File

@ -43,7 +43,7 @@ export class TokenManager {
/** true iff the distributor account needs a refill */
public needsRefill(account: Account, token: TokenTicker): boolean {
const balanceAmount = account.balance.find(b => b.tokenTicker === token);
const balanceAmount = account.balance.find((b) => b.tokenTicker === token);
const balance = balanceAmount
? Decimal.fromAtomics(balanceAmount.quantity, balanceAmount.fractionalDigits)
@ -59,7 +59,7 @@ export class TokenManager {
private getFractionalDigits(ticker: TokenTicker): number {
const match = [...this.config.bankTokens, ...(this.config.erc20Tokens || [])].find(
token => token.ticker === ticker,
(token) => token.ticker === ticker,
);
if (!match) throw new Error(`No token found for ticker symbol: ${ticker}`);
return match.fractionalDigits;

View File

@ -1,4 +1,4 @@
module.exports = function(config) {
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: ".",

View File

@ -56,7 +56,7 @@ describe("CosmWasmClient.searchTx", () => {
beforeAll(async () => {
if (wasmdEnabled()) {
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(wasmd.endpoint, faucet.address, signBytes =>
const client = new SigningCosmWasmClient(wasmd.endpoint, faucet.address, (signBytes) =>
pen.sign(signBytes),
);

View File

@ -124,7 +124,7 @@ describe("CosmWasmClient", () => {
const missing = makeRandomAddress();
await client.getNonce(missing).then(
() => fail("this must not succeed"),
error => expect(error).toMatch(/account does not exist on chain/i),
(error) => expect(error).toMatch(/account does not exist on chain/i),
);
});
});
@ -373,7 +373,7 @@ describe("CosmWasmClient", () => {
if (wasmdEnabled()) {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(wasmd.endpoint, faucet.address, signBytes =>
const client = new SigningCosmWasmClient(wasmd.endpoint, faucet.address, (signBytes) =>
pen.sign(signBytes),
);
const { codeId } = await client.upload(getHackatom());
@ -414,7 +414,7 @@ describe("CosmWasmClient", () => {
const client = new CosmWasmClient(wasmd.endpoint);
await client.queryContractRaw(nonExistentAddress, configKey).then(
() => fail("must not succeed"),
error => expect(error).toMatch(`No contract found at address "${nonExistentAddress}"`),
(error) => expect(error).toMatch(`No contract found at address "${nonExistentAddress}"`),
);
});
});
@ -426,7 +426,7 @@ describe("CosmWasmClient", () => {
if (wasmdEnabled()) {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(wasmd.endpoint, faucet.address, signBytes =>
const client = new SigningCosmWasmClient(wasmd.endpoint, faucet.address, (signBytes) =>
pen.sign(signBytes),
);
const { codeId } = await client.upload(getHackatom());
@ -452,7 +452,7 @@ describe("CosmWasmClient", () => {
const client = new CosmWasmClient(wasmd.endpoint);
await client.queryContractSmart(contract.address, { broken: {} }).then(
() => fail("must not succeed"),
error => expect(error).toMatch(/Error parsing QueryMsg/i),
(error) => expect(error).toMatch(/Error parsing QueryMsg/i),
);
});
@ -463,7 +463,7 @@ describe("CosmWasmClient", () => {
const client = new CosmWasmClient(wasmd.endpoint);
await client.queryContractSmart(nonExistentAddress, { verifier: {} }).then(
() => fail("must not succeed"),
error => expect(error).toMatch(`No contract found at address "${nonExistentAddress}"`),
(error) => expect(error).toMatch(`No contract found at address "${nonExistentAddress}"`),
);
});
});

View File

@ -252,7 +252,7 @@ export class CosmWasmClient {
height: parseInt(response.block.header.height, 10),
chainId: response.block.header.chain_id,
},
txs: (response.block.data.txs || []).map(encoded => Encoding.fromBase64(encoded)),
txs: (response.block.data.txs || []).map((encoded) => Encoding.fromBase64(encoded)),
};
}
@ -283,17 +283,17 @@ export class CosmWasmClient {
const sent = await this.txsQuery(sentQuery);
const received = await this.txsQuery(receivedQuery);
const sentHashes = sent.map(t => t.hash);
txs = [...sent, ...received.filter(t => !sentHashes.includes(t.hash))];
const sentHashes = sent.map((t) => t.hash);
txs = [...sent, ...received.filter((t) => !sentHashes.includes(t.hash))];
} else if (isSearchByTagsQuery(query)) {
const rawQuery = withFilters(query.tags.map(t => `${t.key}=${t.value}`).join("&"));
const rawQuery = withFilters(query.tags.map((t) => `${t.key}=${t.value}`).join("&"));
txs = await this.txsQuery(rawQuery);
} else {
throw new Error("Unknown query type");
}
// backend sometimes messes up with min/max height filtering
const filtered = txs.filter(tx => tx.height >= minHeight && tx.height <= maxHeight);
const filtered = txs.filter((tx) => tx.height >= minHeight && tx.height <= maxHeight);
return filtered;
}

View File

@ -75,8 +75,8 @@ export function findAttribute(
): Attribute {
const firstLogs = logs.find(() => true);
const out = firstLogs?.events
.find(event => event.type === eventType)
?.attributes.find(attr => attr.key === attrKey);
.find((event) => event.type === eventType)
?.attributes.find((attr) => attr.key === attrKey);
if (!out) {
throw new Error(
`Could not find attribute '${attrKey}' in first event of type '${eventType}' in first log.`,

View File

@ -344,7 +344,7 @@ describe("RestClient", () => {
beforeAll(async () => {
if (wasmdEnabled()) {
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(wasmd.endpoint, faucet.address, signBytes =>
const client = new SigningCosmWasmClient(wasmd.endpoint, faucet.address, (signBytes) =>
pen.sign(signBytes),
);
@ -482,7 +482,7 @@ describe("RestClient", () => {
beforeAll(async () => {
if (wasmdEnabled()) {
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(wasmd.endpoint, faucet.address, signBytes =>
const client = new SigningCosmWasmClient(wasmd.endpoint, faucet.address, (signBytes) =>
pen.sign(signBytes),
);
@ -655,7 +655,7 @@ describe("RestClient", () => {
expect(parseInt(result.count, 10)).toBeGreaterThanOrEqual(4);
// Check first 4 results
const [store, hash, isa, jade] = result.txs.map(tx => fromOneElementArray(tx.tx.value.msg));
const [store, hash, isa, jade] = result.txs.map((tx) => fromOneElementArray(tx.tx.value.msg));
assert(isMsgStoreCode(store));
assert(isMsgInstantiateContract(hash));
assert(isMsgInstantiateContract(isa));
@ -719,7 +719,7 @@ describe("RestClient", () => {
`message.module=wasm&message.code_id=${deployedErc20.codeId}&message.action=instantiate`,
);
expect(parseInt(instantiations.count, 10)).toBeGreaterThanOrEqual(3);
const [hash, isa, jade] = instantiations.txs.map(tx => fromOneElementArray(tx.tx.value.msg));
const [hash, isa, jade] = instantiations.txs.map((tx) => fromOneElementArray(tx.tx.value.msg));
assert(isMsgInstantiateContract(hash));
assert(isMsgInstantiateContract(isa));
assert(isMsgInstantiateContract(jade));
@ -861,7 +861,7 @@ describe("RestClient", () => {
expect(result.code).toBeFalsy();
// console.log("Raw log:", result.logs);
const logs = parseLogs(result.logs);
const wasmEvent = logs.find(() => true)?.events.find(e => e.type === "wasm");
const wasmEvent = logs.find(() => true)?.events.find((e) => e.type === "wasm");
assert(wasmEvent, "Event of type wasm expected");
expect(wasmEvent.attributes).toContain({ key: "action", value: "release" });
expect(wasmEvent.attributes).toContain({
@ -1051,13 +1051,13 @@ describe("RestClient", () => {
// invalid query syntax throws an error
await client.queryContractSmart(contractAddress!, { nosuchkey: {} }).then(
() => fail("shouldn't succeed"),
error => expect(error).toMatch("Error parsing QueryMsg"),
(error) => expect(error).toMatch("Error parsing QueryMsg"),
);
// invalid address throws an error
await client.queryContractSmart(noContract, { verifier: {} }).then(
() => fail("shouldn't succeed"),
error => expect(error).toMatch("not found"),
(error) => expect(error).toMatch("not found"),
);
});
});

View File

@ -27,7 +27,7 @@ describe("SigningCosmWasmClient", () => {
describe("makeReadOnly", () => {
it("can be constructed", async () => {
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));
const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes));
expect(client).toBeTruthy();
});
});
@ -36,7 +36,7 @@ describe("SigningCosmWasmClient", () => {
it("always uses authAccount implementation", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));
const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes));
const openedClient = (client as unknown) as PrivateCosmWasmClient;
const blockLatestSpy = spyOn(openedClient.restClient, "blocksLatest").and.callThrough();
@ -54,7 +54,7 @@ describe("SigningCosmWasmClient", () => {
it("works", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));
const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes));
const wasm = getHackatom();
const {
codeId,
@ -73,7 +73,7 @@ describe("SigningCosmWasmClient", () => {
it("can set builder and source", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));
const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes));
const wasm = getHackatom();
const meta: UploadMeta = {
@ -92,7 +92,7 @@ describe("SigningCosmWasmClient", () => {
it("works with transfer amount", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));
const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes));
const { codeId } = await client.upload(getHackatom());
const transferAmount: readonly Coin[] = [
@ -125,7 +125,7 @@ describe("SigningCosmWasmClient", () => {
it("can instantiate one code multiple times", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));
const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes));
const { codeId } = await client.upload(getHackatom());
const contractAddress1 = await client.instantiate(
@ -152,7 +152,7 @@ describe("SigningCosmWasmClient", () => {
it("works", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));
const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes));
const { codeId } = await client.upload(getHackatom());
// instantiate
@ -180,7 +180,7 @@ describe("SigningCosmWasmClient", () => {
// execute
const result = await client.execute(contractAddress, { release: {} }, undefined);
const wasmEvent = result.logs.find(() => true)?.events.find(e => e.type === "wasm");
const wasmEvent = result.logs.find(() => true)?.events.find((e) => e.type === "wasm");
assert(wasmEvent, "Event of type wasm expected");
expect(wasmEvent.attributes).toContain({ key: "action", value: "release" });
expect(wasmEvent.attributes).toContain({
@ -201,7 +201,7 @@ describe("SigningCosmWasmClient", () => {
it("works", async () => {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));
const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes));
// instantiate
const transferAmount: readonly Coin[] = [

View File

@ -6246,10 +6246,10 @@ prettier-linter-helpers@^1.0.0:
dependencies:
fast-diff "^1.1.2"
prettier@^1.19.1:
version "1.19.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
prettier@^2:
version "2.0.4"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.4.tgz#2d1bae173e355996ee355ec9830a7a1ee05457ef"
integrity sha512-SVJIQ51spzFDvh4fIbCLvciiDMCrRhlN3mbZvv/+ycjvmF5E73bKdGfU8QDLNmjYJf+lsGnDBC4UUnvTe5OO0w==
private@^0.1.8:
version "0.1.8"