import { BlockTag } from "@ethersproject/abstract-provider"; import { Decimal } from "@mahadao/arth-base"; import { EthersProvider, EthersSigner } from "./types"; import { _ARTHContractAddresses, _ARTHContracts, _ARTHDeploymentJSON } from "./contracts"; import { _Multicall } from "./_Multicall"; declare const brand: unique symbol; /** * Information about a connection to the ARTH protocol. * * @remarks * Provided for debugging / informational purposes. * * Exposed through {@link ReadableEthersARTH.connection} and {@link EthersARTH.connection}. * * @public */ export interface EthersARTHConnection extends EthersARTHConnectionOptionalParams { /** Ethers `Provider` used for connecting to the network. */ readonly provider: EthersProvider; /** Ethers `Signer` used for sending transactions. */ readonly signer?: EthersSigner; /** Chain ID of the connected network. */ readonly chainId: number; /** Version of the ARTH contracts (Git commit hash). */ readonly version: string; /** Date when the ARTH contracts were deployed. */ readonly deploymentDate: Date; /** Number of block in which the first ARTH contract was deployed. */ readonly startBlock: number; /** Time period (in seconds) after `deploymentDate` during which redemptions are disabled. */ readonly bootstrapPeriod: number; /** Total amount of MAHA allocated for rewarding stability depositors. */ readonly totalStabilityPoolMAHAReward: Decimal; /** A mapping of ARTH contracts' names to their addresses. */ readonly addresses: Record; /** @internal */ readonly _priceFeedIsTestnet: boolean; /** @internal */ readonly _isDev: boolean; /** @internal */ readonly [brand]: unique symbol; } /** @internal */ export interface _InternalEthersARTHConnection extends EthersARTHConnection { readonly addresses: _ARTHContractAddresses; readonly _contracts: _ARTHContracts; readonly _multicall?: _Multicall; } /** @internal */ export declare const _getContracts: (connection: EthersARTHConnection) => _ARTHContracts; /** @internal */ export declare const _getBlockTimestamp: (connection: EthersARTHConnection, blockTag?: BlockTag) => Promise; /** @internal */ export declare const _requireSigner: (connection: EthersARTHConnection) => EthersSigner; /** @internal */ export declare const _getProvider: (connection: EthersARTHConnection) => EthersProvider; /** @internal */ export declare const _requireAddress: (connection: EthersARTHConnection, overrides?: { from?: string | undefined; } | undefined) => string; /** @internal */ export declare const _requireFrontendAddress: (connection: EthersARTHConnection) => string; /** @internal */ export declare const _usingStore: (connection: EthersARTHConnection) => connection is EthersARTHConnection & { useStore: EthersARTHStoreOption; }; /** * Thrown when trying to connect to a network where ARTH is not deployed. * * @remarks * Thrown by {@link ReadableEthersARTH.(connect:2)} and {@link EthersARTH.(connect:2)}. * * @public */ export declare class UnsupportedNetworkError extends Error { /** Chain ID of the unsupported network. */ readonly chainId: number; /** @internal */ constructor(chainId: number); } /** @internal */ export declare const _connectToDeployment: (deployment: _ARTHDeploymentJSON, signerOrProvider: EthersSigner | EthersProvider, optionalParams?: EthersARTHConnectionOptionalParams | undefined) => EthersARTHConnection; /** * Possible values for the optional * {@link EthersARTHConnectionOptionalParams.useStore | useStore} * connection parameter. * * @remarks * Currently, the only supported value is `"blockPolled"`, in which case a * {@link BlockPolledARTHStore} will be created. * * @public */ export declare type EthersARTHStoreOption = "blockPolled"; /** * Optional parameters of {@link ReadableEthersARTH.(connect:2)} and * {@link EthersARTH.(connect:2)}. * * @public */ export interface EthersARTHConnectionOptionalParams { /** * Address whose Trove, Stability Deposit, MAHA Stake and balances will be read by default. * * @remarks * For example {@link EthersARTH.getTrove | getTrove(address?)} will return the Trove owned by * `userAddress` when the `address` parameter is omitted. * * Should be omitted when connecting through a {@link EthersSigner | Signer}. Instead `userAddress` * will be automatically determined from the `Signer`. */ readonly userAddress?: string; /** * Address that will receive MAHA rewards from newly created Stability Deposits by default. * * @remarks * For example * {@link EthersARTH.depositARTHInStabilityPool | depositARTHInStabilityPool(amount, frontendTag?)} * will tag newly made Stability Deposits with this address when its `frontendTag` parameter is * omitted. */ readonly frontendTag?: string; /** * Create a {@link @mahadao/arth-base#ARTHStore} and expose it as the `store` property. * * @remarks * When set to one of the available {@link EthersARTHStoreOption | options}, * {@link ReadableEthersARTH.(connect:2) | ReadableEthersARTH.connect()} will return a * {@link ReadableEthersARTHWithStore}, while * {@link EthersARTH.(connect:2) | EthersARTH.connect()} will return an * {@link EthersARTHWithStore}. * * Note that the store won't start monitoring the blockchain until its * {@link @mahadao/arth-base#ARTHStore.start | start()} function is called. */ readonly useStore?: EthersARTHStoreOption; } /** @internal */ export declare function _connectByChainId(provider: EthersProvider, signer: EthersSigner | undefined, chainId: number, optionalParams: EthersARTHConnectionOptionalParams & { useStore: T; }): EthersARTHConnection & { useStore: T; }; /** @internal */ export declare function _connectByChainId(provider: EthersProvider, signer: EthersSigner | undefined, chainId: number, optionalParams?: EthersARTHConnectionOptionalParams): EthersARTHConnection; /** @internal */ export declare const _connect: (signerOrProvider: EthersSigner | EthersProvider, optionalParams?: EthersARTHConnectionOptionalParams | undefined) => Promise; export {}; //# sourceMappingURL=EthersARTHConnection.d.ts.map