diff --git a/packages/faucet/README.md b/packages/faucet/README.md index eda63418..c191adbf 100644 --- a/packages/faucet/README.md +++ b/packages/faucet/README.md @@ -47,9 +47,9 @@ 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_FEE Fee for send transactions as a comma separated list, - e.g. "200ushell,30ureef". Defaults to "2000ucosm". -FAUCET_GAS Gas for send transactions. Defaults to 80000. +FAUCET_GAS_PRICE Gas price for transactions as a comma separated list. + Defaults to "0.025ucosm". +FAUCET_GAS_LIMIT Gas limit for send transactions. Defaults to 80000. 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 466c96c6..1c6a73b7 100644 --- a/packages/faucet/src/actions/help.ts +++ b/packages/faucet/src/actions/help.ts @@ -20,9 +20,9 @@ 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_FEE Fee for send transactions as a comma separated list, - e.g. "200ushell,30ureef". Defaults to "2000ucosm". -FAUCET_GAS Gas for send transactions. Defaults to 80000. +FAUCET_GAS_PRICE Gas price for transactions as a comma separated list. + Defaults to "0.025ucosm". +FAUCET_GAS_LIMIT Gas limit for send transactions. Defaults to 80000. 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 b20ef9af..32822e70 100644 --- a/packages/faucet/src/constants.ts +++ b/packages/faucet/src/constants.ts @@ -1,12 +1,14 @@ -import { Coin, parseCoins } from "@cosmjs/launchpad"; +import { CosmosFeeTable, GasLimits, GasPrice } from "@cosmjs/launchpad"; import { TokenConfiguration } from "./tokenmanager"; import { parseBankTokens } from "./tokens"; export const binaryName = "cosmos-faucet"; export const memo: string | undefined = process.env.FAUCET_MEMO; -export const fee: readonly Coin[] = parseCoins(process.env.FAUCET_FEE || "2000ucosm"); -export const gas: string = process.env.FAUCET_GAS || "80000"; +export const gasPrice = GasPrice.fromString(process.env.FAUCET_GAS_PRICE || "0.025ucosm"); +export const gasLimits: GasLimits = { + send: parseInt(process.env.FAUCET_GAS_LIMIT || "80000", 10), +}; 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 c091ce5a..910b6569 100644 --- a/packages/faucet/src/faucet.ts +++ b/packages/faucet/src/faucet.ts @@ -1,7 +1,6 @@ import { assertIsBroadcastTxSuccess, CosmosClient, - FeeTable, OfflineSigner, SigningCosmosClient, } from "@cosmjs/launchpad"; @@ -57,17 +56,16 @@ export class Faucet { this.holderAddress = wallets[0][0]; this.distributorAddresses = wallets.slice(1).map((pair) => pair[0]); - const fees: Partial = { - send: { - amount: constants.fee, - gas: constants.gas, - }, - }; - // we need one client per sender const clients: { [senderAddress: string]: SigningCosmosClient } = {}; for (const [senderAddress, wallet] of wallets) { - clients[senderAddress] = new SigningCosmosClient(apiUrl, senderAddress, wallet, fees); + clients[senderAddress] = new SigningCosmosClient( + apiUrl, + senderAddress, + wallet, + constants.gasPrice, + constants.gasLimits, + ); } this.clients = clients; this.logging = logging;