Add config variable FAUCET_MEMO

This commit is contained in:
Simon Warta 2020-08-11 11:54:34 +02:00
parent 5218c1697f
commit 98e4c7b958
5 changed files with 7 additions and 2 deletions

View File

@ -3,6 +3,7 @@
## 0.22.2 (2020-08-11) ## 0.22.2 (2020-08-11)
- @cosmjs/faucet: Log errors for failed send transactions. - @cosmjs/faucet: Log errors for failed send transactions.
- @cosmjs/faucet: Add config variable `FAUCET_MEMO`.
## 0.22.1 (2020-08-11) ## 0.22.1 (2020-08-11)

View File

@ -46,6 +46,7 @@ Environment variables
FAUCET_CONCURRENCY Number of distributor accounts. Defaults to 5. FAUCET_CONCURRENCY Number of distributor accounts. Defaults to 5.
FAUCET_PORT Port of the webserver. Defaults to 8000. 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_MNEMONIC Secret mnemonic that serves as the base secret for the
faucet HD accounts faucet HD accounts
FAUCET_ADDRESS_PREFIX The bech32 address prefix. Defaults to "cosmos". FAUCET_ADDRESS_PREFIX The bech32 address prefix. Defaults to "cosmos".

View File

@ -19,6 +19,7 @@ Environment variables
FAUCET_CONCURRENCY Number of distributor accounts. Defaults to 5. FAUCET_CONCURRENCY Number of distributor accounts. Defaults to 5.
FAUCET_PORT Port of the webserver. Defaults to 8000. 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_MNEMONIC Secret mnemonic that serves as the base secret for the
faucet HD accounts faucet HD accounts
FAUCET_ADDRESS_PREFIX The bech32 address prefix. Defaults to "cosmos". FAUCET_ADDRESS_PREFIX The bech32 address prefix. Defaults to "cosmos".

View File

@ -2,6 +2,7 @@ import { TokenConfiguration } from "./tokenmanager";
import { parseBankTokens } from "./tokens"; import { parseBankTokens } from "./tokens";
export const binaryName = "cosmwasm-faucet"; 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 concurrency: number = Number.parseInt(process.env.FAUCET_CONCURRENCY || "", 10) || 5;
export const port: number = Number.parseInt(process.env.FAUCET_PORT || "", 10) || 8000; export const port: number = Number.parseInt(process.env.FAUCET_PORT || "", 10) || 8000;
export const mnemonic: string | undefined = process.env.FAUCET_MNEMONIC; export const mnemonic: string | undefined = process.env.FAUCET_MNEMONIC;

View File

@ -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 { sleep } from "@cosmjs/utils";
import * as constants from "./constants";
import { debugAccount, logAccountsState, logSendJob } from "./debugging"; import { debugAccount, logAccountsState, logSendJob } from "./debugging";
import { createWallets } from "./profile"; import { createWallets } from "./profile";
import { TokenConfiguration, TokenManager } from "./tokenmanager"; import { TokenConfiguration, TokenManager } from "./tokenmanager";
@ -78,7 +79,7 @@ export class Faucet {
* Throws an error if the transaction failed. * Throws an error if the transaction failed.
*/ */
public async send(job: SendJob): Promise<void> { public async send(job: SendJob): Promise<void> {
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); assertIsPostTxSuccess(result);
} }