import type { Signer } from '@ethersproject/abstract-signer'; import type { Observable } from 'rxjs'; import { matrixPresence } from '../transport/actions'; import type { RaidenEpicDeps } from '../types'; import { LruCache } from '../utils/lru'; import type { Last, Signed } from '../utils/types'; import { Address } from '../utils/types'; import type { pathFind } from './actions'; import type { IOU, PFS } from './types'; import { AddressMetadata } from './types'; /** * Fetch PFS info & validate for a given server address or URL * * This is a memoized function which caches by url or address, network and registry used. * * @param pfsAddrOrUrl - PFS account/address or URL * @param deps - RaidenEpicDeps needed for various parameters * @param deps.log - Logger instance * @param deps.serviceRegistryContract - ServiceRegistry contract instance * @param deps.network - Current Network * @param deps.contractsInfo - ContractsInfo mapping * @param deps.provider - Eth provider * @param deps.config$ - Config observable * @param deps.latest$ - Latest observable * @returns Promise containing PFS server info */ export declare function pfsInfo(pfsAddrOrUrl: Address | string, { log, serviceRegistryContract, network, contractsInfo, provider, config$, latest$, }: Pick): Promise; /** * Returns the address for the PFS/service with the given URL. * Result is cached and this cache is shared with [[pfsInfo]] calls. * * @param url - Url of the PFS to retrieve address for * @param deps - Epics dependencies (for pfsInfo) * @returns Promise to Address of PFS on given URL */ export declare const pfsInfoAddress: ((url: string, deps: Pick) => Promise
) & { cache: LruCache>; }; /** * Retrieve pfsInfo for these servers & return sorted PFS info * * Sort order is price then response time (rtt). * Throws if no server can be validated, meaning either there's none in the current network or * we're out-of-sync (outdated or ahead of PFS's deployment network version). * * @param pfsList - Array of PFS addresses or URLs * @param deps - RaidenEpicDeps array * @returns Observable of online, validated & sorted PFS info array */ export declare function pfsListInfo(pfsList: readonly (string | Address)[], deps: Pick & Last>): Observable; /** * Validates metadata was signed by address * * @param metadata - Peer's metadata * @param address - Peer's address * @param opts - Options * @param opts.log - Logger instance * @returns presence iff metadata is valid and was signed by address */ export declare function validateAddressMetadata(metadata: AddressMetadata | undefined, address: Address, { log }?: Partial>): matrixPresence.success | undefined; /** * @param address - Peer address to fetch presence for * @param pfsAddrOrUrl - PFS/service address to fetch presence from * @param deps - Epics dependencies subset * @param deps.serviceRegistryContract - Contract instance * @returns Observable to peer's presence or error */ export declare function getPresenceFromService$(address: Address, pfsAddrOrUrl: string, deps: Pick): Observable; /** * Pack an IOU for signing or verification * * @param iou - IOU to be packed * @returns Packed IOU as a UInt8Array */ export declare function packIOU(iou: IOU): Uint8Array; /** * Sign an IOU with signer * * @param signer - Signer instance * @param iou - IOU to be signed * @returns Signed IOU */ export declare function signIOU(signer: Signer, iou: IOU): Promise>; /** * Choose best PFS and fetch info from it * * @param pfsByAction - Override config for this call: explicit PFS, disabled or undefined * @param deps - Epics dependencies * @param sortByRtt - Whether to sort PFSs by rtt, instead of price (default) * @returns Observable to choosen PFS */ export declare function choosePfs$(pfsByAction: pathFind.request['payload']['pfs'], deps: RaidenEpicDeps, sortByRtt?: boolean): Observable;