faucet: Update for fee table changes

This commit is contained in:
willclarktech 2020-08-18 17:24:02 +01:00
parent 53b413d96b
commit a71e8f3502
No known key found for this signature in database
GPG Key ID: 551A86E2E398ADF7
4 changed files with 18 additions and 18 deletions

View File

@ -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".

View File

@ -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".

View File

@ -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<CosmosFeeTable> = {
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;

View File

@ -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<FeeTable> = {
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;