import { BigNumber } from "ethers/utils"; import { RelayFeeSchedule } from "."; declare type LogLevel = "debug" | "info" | "warn" | "error" | "silent"; export interface UnlockBlockConfig { scheduleName: RelayFeeSchedule; blocksToWait: number; } export interface ServiceConfig { hostName: string; hostPort: number; name: string; loglevel: LogLevel; } export declare enum DbKind { LEVEL = "level", DYNAMO = "dynamo" } interface DbConfigBase { kind: DbKind; } export interface DynamoDbConfig extends DbConfigBase { readonly kind: DbKind.DYNAMO; readonly endpointUrl: string; readonly region?: string; readonly accessKeyId?: string; readonly secretAccessKey?: string; } export interface LevelDbConfig extends DbConfigBase { readonly kind: DbKind.LEVEL; readonly dbDir: string; } export declare type DbConfig = LevelDbConfig | DynamoDbConfig; export declare type BlockFees = { [blockNumber: string]: { gwei: number; percent: number; }; }; export declare type FeeSettings = { [address: string]: BlockFees; }; /** * A simple class to wrap a value with a getter. Useful to allow config settings that can later be changed. */ export declare class Config { private readonly getValue; constructor(getValue: () => T); get value(): T; } export interface PaymentGatewayConfig extends ServiceConfig { jsonRpcUrl: string; db: DbConfig; lockPriceMargin: string; fees: FeeSettings; maximumReorgLimit: number; confirmationThreshold: number; unlockBlock: UnlockBlockConfig[]; pollingInterval: number; /** * The start block to use when looking for logs to initialise from */ initialisationStartBlock: number; /** * The batch size to use when fetching logs during the initialisation phase */ initialisationBatchSize: number; /** * The maximum amount of pending gas that this gateway will allow */ maximumPendingGas: number; relayGasOverhead: number; gasStatisticsMinimumPrice: number; etherscanApiKey: string; /** * Start block for the relay monitor - only register relays from this point onwards */ relayMonitorInitialisationStartBlock: number; /** * The etherchain gas price strategy to use */ etherchainStrategy: string; /** * Check whether the contracts are deployed */ doContractAndAddressChecks: boolean; /** * If a status api url is supplied it will be used to check for the * existance of transaction hashes before allowing a spend */ statusApiUrl: string; /** * Whether to start the block processor in this instance. * Instances which do not start the processor can still read processor * generated state from the db. These should be request serving instances * that allow us to upgrade the processor without user seeing downtime */ startBlockProcessor: boolean; logDbStats: boolean; /** * DynamoDB table name for persistence */ tableName: string; tableBlockProcessor: string; tableBlockItemStore: string; tableActionStore: string; } /** * Convert relevant parts of the config to Config objects * @param config */ export declare const convertPaymentConfig: (config: PaymentGatewayConfig) => { gasStatisticsMinimumPrice: Config; etherscanApiKey: Config; lockPriceMargin: Config; maximumReorgLimit: Config; unlockBlock: Config; pollingInterval: Config; maximumPendingGas: Config; confirmationThreshold: Config; etherchainStrategy: Config; fees: Config; logDbStats: Config; jsonRpcUrl: string; db: DbConfig; /** * The start block to use when looking for logs to initialise from */ initialisationStartBlock: number; /** * The batch size to use when fetching logs during the initialisation phase */ initialisationBatchSize: number; relayGasOverhead: number; /** * Start block for the relay monitor - only register relays from this point onwards */ relayMonitorInitialisationStartBlock: number; /** * Check whether the contracts are deployed */ doContractAndAddressChecks: boolean; /** * If a status api url is supplied it will be used to check for the * existance of transaction hashes before allowing a spend */ statusApiUrl: string; /** * Whether to start the block processor in this instance. * Instances which do not start the processor can still read processor * generated state from the db. These should be request serving instances * that allow us to upgrade the processor without user seeing downtime */ startBlockProcessor: boolean; /** * DynamoDB table name for persistence */ tableName: string; tableBlockProcessor: string; tableBlockItemStore: string; tableActionStore: string; hostName: string; hostPort: number; name: string; loglevel: LogLevel; }; export interface SenderConfig { scheduleName: Config; maxGasPrice: Config; linearMultiplier: Config; exponentialMultiplier: Config; constantPhaseLength: Config; linearPhaseLength: Config; exponentialPhaseLength: Config; baseMultiplier: Config; rebroadcastDelayS: Config; } export interface RelayerConfig extends ServiceConfig { jsonRpcUrl: string; db: DbConfig; receiptKeystore: string; receiptKeystorePass: string; relayersKeystore: string; relayersKeystorePass: string; broadcasterRate: number; sendDelay: number; senderTopUpFromEth: number; senderTopUpFromEmergencyEth: number; senderTopUpToEth: number; senderGasPriceMarkupGwei: number; senderGasPriceMarkupPercent: number; maximumReorgLimit: number; senders: { scheduleName: string; maxGasPrice: string; linearMultiplier: number; exponentialMultiplier: number; constantPhaseLength: number; linearPhaseLength: number; exponentialPhaseLength: number; /** * A multiplier applied by the estimator to the estimate it receives from the gas statistics cache */ baseMultiplier: number; /** * The number of seconds a transation will be left unchanged before being rebroadcast */ rebroadcastDelayS: number; }[]; confirmationThreshold: number; /** * The start block to use when looking for logs to initialise from */ initialisationStartBlock: number; /** * The batch size to use when fetching logs during the initialisation phase */ initialisationBatchSize: number; pollingInterval: number; relayGasOverhead: number; gasStatisticsMinimumPrice: number; etherchainStrategy: string; /** * If a status API url is supplied the broadcaster will push transaction * hashes to it when it broadcasts a new tx. */ statusApiUrl?: string; /** * Check whether the contracts are deployed, whether they have the correct relayers * installed and whether the relayers have enough balance */ doContractAndAddressChecks: boolean; /** * The maximum broadcast nonce is the current nonce above which we won't broadcast. We set this * because we know that nodes may eject transactions from their pool above a certain number, so * we can ensure we do go above that number by setting a maximum diff here. eg 16 */ maxBroadcastNonceDiff: number; logDbStats: boolean; tableSenderPrefix: string; tableActionStore: string; tableBlockProcessor: string; tableBlockItemStore: string; tableBlockScheduler: string; } /** * Convert relevant parts of the config to Config objects * @param config */ export declare const convertRelayerConfig: (config: RelayerConfig) => { broadcasterRate: Config; gasStatisticsMinimumPrice: Config; senderTopUpFromWei: Config; senderTopUpFromEmergencyWei: Config; senderTopUpToWei: Config; senderMinGasPriceMarkupWei: Config; senderGasPriceMarkupPercent: Config; statusApiUrl: Config | undefined; sendDelay: Config; senders: Config; confirmationThreshold: Config; pollingInterval: Config; maximumReorgLimit: Config; maxBroadcastNonceDiff: Config; etherchainStrategy: Config; logDbStats: Config; jsonRpcUrl: string; db: DbConfig; receiptKeystore: string; receiptKeystorePass: string; relayersKeystore: string; relayersKeystorePass: string; senderTopUpFromEth: number; senderTopUpFromEmergencyEth: number; senderTopUpToEth: number; senderGasPriceMarkupGwei: number; /** * The start block to use when looking for logs to initialise from */ initialisationStartBlock: number; /** * The batch size to use when fetching logs during the initialisation phase */ initialisationBatchSize: number; relayGasOverhead: number; /** * Check whether the contracts are deployed, whether they have the correct relayers * installed and whether the relayers have enough balance */ doContractAndAddressChecks: boolean; tableSenderPrefix: string; tableActionStore: string; tableBlockProcessor: string; tableBlockItemStore: string; tableBlockScheduler: string; hostName: string; hostPort: number; name: string; loglevel: LogLevel; }; export interface StatusConfig extends ServiceConfig { /** * Database configuration for this status api */ db: DbConfig; /** * The number of hours after which a transaction hash will be considered stale * After this time period a transacation hash may be removed */ staleTimeHours: number; /** * DynamoDB table name for persistence */ tableName: string; /** * The interval (s) to check for stale transaction hashes */ deletionIntervalS: number; } export declare const convertStatusConfig: (config: StatusConfig) => { staleTimeMs: Config; deletionIntervalMs: Config; /** * Database configuration for this status api */ db: DbConfig; /** * The number of hours after which a transaction hash will be considered stale * After this time period a transacation hash may be removed */ staleTimeHours: number; /** * DynamoDB table name for persistence */ tableName: string; /** * The interval (s) to check for stale transaction hashes */ deletionIntervalS: number; hostName: string; hostPort: number; name: string; loglevel: LogLevel; }; export {}; //# sourceMappingURL=config.d.ts.map