diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c9ba115a8..46e9e4c8e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 0.22.2 (2020-08-11) - @cosmjs/faucet: Log errors for failed send transactions. +- @cosmjs/faucet: Add config variable `FAUCET_MEMO`. ## 0.22.1 (2020-08-11) diff --git a/packages/faucet/README.md b/packages/faucet/README.md index 54981b72ae..2c65e27acb 100644 --- a/packages/faucet/README.md +++ b/packages/faucet/README.md @@ -46,6 +46,7 @@ Environment variables FAUCET_CONCURRENCY Number of distributor accounts. Defaults to 5. FAUCET_PORT Port of the webserver. Defaults to 8000. +FAUCET_MEMO Memo for send transactions. Defaults to unset. FAUCET_MNEMONIC Secret mnemonic that serves as the base secret for the faucet HD accounts FAUCET_ADDRESS_PREFIX The bech32 address prefix. Defaults to "cosmos". diff --git a/packages/faucet/src/actions/help.ts b/packages/faucet/src/actions/help.ts index c7bdea2067..1dd0d047c3 100644 --- a/packages/faucet/src/actions/help.ts +++ b/packages/faucet/src/actions/help.ts @@ -19,6 +19,7 @@ Environment variables FAUCET_CONCURRENCY Number of distributor accounts. Defaults to 5. FAUCET_PORT Port of the webserver. Defaults to 8000. +FAUCET_MEMO Memo for send transactions. Defaults to unset. FAUCET_MNEMONIC Secret mnemonic that serves as the base secret for the faucet HD accounts FAUCET_ADDRESS_PREFIX The bech32 address prefix. Defaults to "cosmos". diff --git a/packages/faucet/src/constants.ts b/packages/faucet/src/constants.ts index 53bf0b837d..ed385085ff 100644 --- a/packages/faucet/src/constants.ts +++ b/packages/faucet/src/constants.ts @@ -2,6 +2,7 @@ import { TokenConfiguration } from "./tokenmanager"; import { parseBankTokens } from "./tokens"; export const binaryName = "cosmwasm-faucet"; +export const memo: string | undefined = process.env.FAUCET_MEMO; export const concurrency: number = Number.parseInt(process.env.FAUCET_CONCURRENCY || "", 10) || 5; export const port: number = Number.parseInt(process.env.FAUCET_PORT || "", 10) || 8000; export const mnemonic: string | undefined = process.env.FAUCET_MNEMONIC; diff --git a/packages/faucet/src/faucet.ts b/packages/faucet/src/faucet.ts index 768432e2ca..78aeeac36a 100644 --- a/packages/faucet/src/faucet.ts +++ b/packages/faucet/src/faucet.ts @@ -1,6 +1,7 @@ -import { CosmosClient, OfflineSigner, SigningCosmosClient, assertIsPostTxSuccess } from "@cosmjs/launchpad"; +import { assertIsPostTxSuccess, CosmosClient, OfflineSigner, SigningCosmosClient } from "@cosmjs/launchpad"; import { sleep } from "@cosmjs/utils"; +import * as constants from "./constants"; import { debugAccount, logAccountsState, logSendJob } from "./debugging"; import { createWallets } from "./profile"; import { TokenConfiguration, TokenManager } from "./tokenmanager"; @@ -78,7 +79,7 @@ export class Faucet { * Throws an error if the transaction failed. */ public async send(job: SendJob): Promise { - const result = await this.clients[job.sender].sendTokens(job.recipient, [job.amount], "Make love, not war"); + const result = await this.clients[job.sender].sendTokens(job.recipient, [job.amount], constants.memo); assertIsPostTxSuccess(result); }