/// import { Multiaddr } from '@multiformats/multiaddr'; import type { PeerId } from '@libp2p/interface-peer-id'; import { ChainWrapper, createChainWrapper, Receipt } from './ethereum.js'; import { AcknowledgedTicket, Balance, Address, NativeBalance, HoprDB, Hash, type ChannelEntry, type DeferType, PublicKey, AccountEntry } from '@hoprnet/hopr-utils'; import Indexer from './indexer/index.js'; import { EventEmitter } from 'events'; import { initializeCommitment, findCommitmentPreImage, bumpCommitment, ChannelCommitmentInfo } from './commitment.js'; import type { IndexerEvents } from './indexer/types.js'; import { DeploymentExtract } from './utils/utils.js'; export type RedeemTicketResponse = { status: 'SUCCESS'; receipt: string; ackTicket: AcknowledgedTicket; } | { status: 'FAILURE'; message: string; } | { status: 'ERROR'; error: Error | string; }; export type ChainOptions = { provider: string; maxConfirmations?: number; chainId: number; maxFeePerGas: string; maxPriorityFeePerGas: string; network: string; environment: string; }; export default class HoprCoreEthereum extends EventEmitter { private db; private publicKey; private privateKey; private options; private automaticChainCreation; private static _instance; indexer: Indexer; private chain; private started; private redeemingAll; private ticketRedemtionInChannelOperations; private constructor(); static createInstance(db: HoprDB, publicKey: PublicKey, privateKey: Uint8Array, options: ChainOptions, automaticChainCreation?: boolean): HoprCoreEthereum; static getInstance(): HoprCoreEthereum; initializeChainWrapper(deploymentAddresses: DeploymentExtract): Promise; private createChain; start(): Promise; readonly CHAIN_NAME = "HOPR on Ethereum"; /** * Stops the connector. */ stop(): Promise; announce(multiaddr: Multiaddr): Promise; withdraw(currency: 'NATIVE' | 'HOPR', recipient: string, amount: string): Promise; setTxHandler(evt: IndexerEvents, tx: string): DeferType; getOpenChannelsFrom(p: PublicKey): Promise; getAccount(addr: Address): Promise; getPublicKeyOf(addr: Address): Promise; getRandomOpenChannel(): Promise; /** * Retrieves HOPR balance, optionally uses the indexer. * The difference from the two methods is that the latter relys on * the coming events which require 8 blocks to be confirmed. * @returns HOPR balance */ getBalance(useIndexer?: boolean): Promise; getPublicKey(): PublicKey; /** * Retrieves ETH balance, optionally uses the cache. * @returns ETH balance */ private uncachedGetNativeBalance; private cachedGetNativeBalance; getNativeBalance(useCache?: boolean): Promise; smartContractInfo(): { network: string; hoprTokenAddress: string; hoprChannelsAddress: string; hoprNetworkRegistryAddress: string; channelClosureSecs: number; }; waitForPublicNodes(): Promise<{ id: PeerId; multiaddrs: Multiaddr[]; }[]>; commitToChannel(c: ChannelEntry): Promise; redeemAllTickets(): Promise; private redeemAllTicketsInternalLoop; redeemTicketsInChannelByCounterparty(counterparty: PublicKey): Promise; redeemTicketsInChannel(channel: ChannelEntry): Promise; private redeemTicketsInChannelLoop; redeemTicket(counterparty: PublicKey, channelId: Hash, ackTicket: AcknowledgedTicket): Promise; initializeClosure(src: PublicKey, dest: PublicKey): Promise; finalizeClosure(src: PublicKey, dest: PublicKey): Promise; openChannel(dest: PublicKey, amount: Balance): Promise<{ channelId: Hash; receipt: Receipt; }>; fundChannel(dest: PublicKey, myFund: Balance, counterpartyFund: Balance): Promise; /** * Checks whether a given `hoprNode` is allowed access. * When the register is disabled, a `hoprNode` is seen as `registered`, * when the register is enabled, a `hoprNode` needs to also be `eligible`. * @param hoprNode the public key of the account we want to check if it's registered * @returns true if registered */ isAllowedAccessToNetwork(hoprNode: PublicKey): Promise; static createMockInstance(peer: PeerId): HoprCoreEthereum; } export { useFixtures } from './indexer/index.mock.js'; export { sampleChainOptions } from './ethereum.mock.js'; export { ChannelEntry, ChannelCommitmentInfo, Indexer, ChainWrapper, createChainWrapper, initializeCommitment, findCommitmentPreImage, bumpCommitment }; //# sourceMappingURL=index.d.ts.map