diff --git a/packages/faucet/src/constants.ts b/packages/faucet/src/constants.ts index 48d04beaa9..5377661c89 100644 --- a/packages/faucet/src/constants.ts +++ b/packages/faucet/src/constants.ts @@ -1,4 +1,4 @@ -import { TokenConfiguration } from "./types"; +import { TokenConfiguration } from "./tokenmanager"; export const binaryName = "cosmwasm-faucet"; export const concurrency: number = Number.parseInt(process.env.FAUCET_CONCURRENCY || "", 10) || 5; diff --git a/packages/faucet/src/debugging.ts b/packages/faucet/src/debugging.ts index fce36e0bad..9f6bec7db6 100644 --- a/packages/faucet/src/debugging.ts +++ b/packages/faucet/src/debugging.ts @@ -1,7 +1,8 @@ import { Coin } from "@cosmjs/launchpad"; import { Decimal } from "@cosmjs/math"; -import { MinimalAccount, SendJob, TokenConfiguration } from "./types"; +import { TokenConfiguration } from "./tokenmanager"; +import { MinimalAccount, SendJob } from "./types"; /** A string representation of a coin in a human-readable format that can change at any time */ function debugCoin(coin: Coin, tokens: TokenConfiguration): string { diff --git a/packages/faucet/src/faucet.spec.ts b/packages/faucet/src/faucet.spec.ts index 51732b15ce..5f664c48ad 100644 --- a/packages/faucet/src/faucet.spec.ts +++ b/packages/faucet/src/faucet.spec.ts @@ -4,7 +4,7 @@ import { CosmosClient } from "@cosmjs/launchpad"; import { assert } from "@cosmjs/utils"; import { Faucet } from "./faucet"; -import { TokenConfiguration } from "./types"; +import { TokenConfiguration } from "./tokenmanager"; function pendingWithoutWasmd(): void { if (!process.env.WASMD_ENABLED) { diff --git a/packages/faucet/src/faucet.ts b/packages/faucet/src/faucet.ts index 4f7289e7c0..6db469f203 100644 --- a/packages/faucet/src/faucet.ts +++ b/packages/faucet/src/faucet.ts @@ -3,8 +3,8 @@ import { sleep } from "@cosmjs/utils"; import { debugAccount, logAccountsState, logSendJob } from "./debugging"; import { createWallets } from "./profile"; -import { TokenManager } from "./tokenmanager"; -import { MinimalAccount, SendJob, TokenConfiguration } from "./types"; +import { TokenConfiguration, TokenManager } from "./tokenmanager"; +import { MinimalAccount, SendJob } from "./types"; function isDefined(value: X | undefined): value is X { return value !== undefined; diff --git a/packages/faucet/src/tokenmanager.spec.ts b/packages/faucet/src/tokenmanager.spec.ts index 35ade7a71e..43683ebac0 100644 --- a/packages/faucet/src/tokenmanager.spec.ts +++ b/packages/faucet/src/tokenmanager.spec.ts @@ -1,5 +1,5 @@ -import { TokenManager } from "./tokenmanager"; -import { MinimalAccount, TokenConfiguration } from "./types"; +import { TokenConfiguration, TokenManager } from "./tokenmanager"; +import { MinimalAccount } from "./types"; const dummyConfig: TokenConfiguration = { bankTokens: [ diff --git a/packages/faucet/src/tokenmanager.ts b/packages/faucet/src/tokenmanager.ts index 4022fcc455..cb4c826230 100644 --- a/packages/faucet/src/tokenmanager.ts +++ b/packages/faucet/src/tokenmanager.ts @@ -1,7 +1,8 @@ import { Coin } from "@cosmjs/launchpad"; import { Decimal, Uint53 } from "@cosmjs/math"; -import { BankTokenMeta, MinimalAccount, TokenConfiguration } from "./types"; +import { BankTokenMeta } from "./tokens"; +import { MinimalAccount } from "./types"; /** Send `factor` times credit amount on refilling */ const defaultRefillFactor = 20; @@ -9,6 +10,11 @@ const defaultRefillFactor = 20; /** refill when balance gets below `factor` times credit amount */ const defaultRefillThresholdFactor = 8; +export interface TokenConfiguration { + /** Supported tokens of the Cosmos SDK bank module */ + readonly bankTokens: readonly BankTokenMeta[]; +} + export class TokenManager { private readonly config: TokenConfiguration; diff --git a/packages/faucet/src/tokens.ts b/packages/faucet/src/tokens.ts new file mode 100644 index 0000000000..c2d88a722d --- /dev/null +++ b/packages/faucet/src/tokens.ts @@ -0,0 +1,17 @@ +export interface BankTokenMeta { + readonly denom: string; + /** + * The token ticker symbol, e.g. ATOM or ETH. + */ + readonly tickerSymbol: string; + /** + * The number of fractional digits the token supports. + * + * A quantity is expressed as atomic units. 10^fractionalDigits of those + * atomic units make up 1 token. + * + * E.g. in Ethereum 10^18 wei are 1 ETH and from the quantity 123000000000000000000 + * the last 18 digits are the fractional part and the rest the wole part. + */ + readonly fractionalDigits: number; +} diff --git a/packages/faucet/src/types.ts b/packages/faucet/src/types.ts index b5c68ac6de..9241c57261 100644 --- a/packages/faucet/src/types.ts +++ b/packages/faucet/src/types.ts @@ -6,27 +6,4 @@ export interface SendJob { readonly amount: Coin; } -export interface BankTokenMeta { - readonly denom: string; - /** - * The token ticker symbol, e.g. ATOM or ETH. - */ - readonly tickerSymbol: string; - /** - * The number of fractional digits the token supports. - * - * A quantity is expressed as atomic units. 10^fractionalDigits of those - * atomic units make up 1 token. - * - * E.g. in Ethereum 10^18 wei are 1 ETH and from the quantity 123000000000000000000 - * the last 18 digits are the fractional part and the rest the wole part. - */ - readonly fractionalDigits: number; -} - -export interface TokenConfiguration { - /** Supported tokens of the Cosmos SDK bank module */ - readonly bankTokens: readonly BankTokenMeta[]; -} - export type MinimalAccount = Pick;