/** * @dev Assortment of helper methods */ import { BigNumber, Event, Overrides, StaticJsonRpcProvider } from '../ethers'; import { EthersProvider, GraphFilterOverride, ChainConfig, SubgraphStealthKeyChangedEvent, ScanOverrides } from '../types'; export declare const lengths: { address: number; txHash: number; privateKey: number; publicKey: number; }; export declare const invalidStealthAddresses: string[]; /** * @notice Given a transaction hash, return the public key of the transaction's sender * @dev See https://github.com/ethers-io/ethers.js/issues/700 for an example of * recovering public key from a transaction with ethers * @param txHash Transaction hash to recover public key from * @param provider ethers provider instance */ export declare function recoverPublicKeyFromTransaction(txHash: string, provider: EthersProvider): Promise; /** * @notice Returns the transaction hash of the first transaction sent by an address, or * undefined if none was found * @param address Address to lookup * @param provider ethers provider instance */ export declare function getSentTransaction(address: string, ethersProvider: EthersProvider): Promise; export declare function toAddress(name: string, provider: EthersProvider): Promise; /** * @notice Returns public keys from the recipientId * @dev When providing a public key, transaction hash, or address with advanced mode, the spending and viewing * public keys will be the same. Only keys retrieved from the StealthKeyRegistry (or the subgraph) will have different spending * and viewing keys. Additionally, the block number when the user registered will be returned. * @param id Recipient identifier, must be an ENS name, CNS name, address, transaction hash, or public key * @param provider ethers provider to use * @param options Object containing lookup options: * advanced: looks for public keys in StealthKeyRegistry when false, recovers them from on-chain transaction when true * supportPubKey: default false, when true allows a public key to be provided directly * supportTxHash: default false, when true allows public key to be recovered from the specified transaction hash */ export declare function lookupRecipient(id: string, provider: EthersProvider, options?: { advanced?: boolean; supportPubKey?: boolean; supportTxHash?: boolean; }): Promise<{ spendingPublicKey: string; viewingPublicKey: string; block?: undefined; } | { spendingPublicKey: string; viewingPublicKey: string; block: string; }>; export declare function getBlockNumberUserRegistered(address: string, provider: StaticJsonRpcProvider, chainConfig: ChainConfig): Promise; export declare function getMostRecentSubgraphStealthKeyChangedEventFromAddress(address: string, chainConfig: ChainConfig, overrides?: ScanOverrides): Promise; /** * @notice Generic method to recursively grab every 'page' of results * @dev NOTE: the query MUST return the ID field * @dev Modifies from: https://github.com/dcgtc/dgrants/blob/f5a783524d0b56eea12c127b2146fba8fb9273b4/app/src/utils/utils.ts#L443 * @dev Relevant docs: https://thegraph.com/docs/developer/graphql-api#example-3 * @dev Lives outside of the class instance because user's should not need access to this method * @dev TODO support node.js by replacing reliance on browser's fetch module with https://github.com/paulmillr/micro-ftch * @param url the url we will recursively fetch from * @param key the key in the response object which holds results * @param query a function which will return the query string (with the page in place) * @param before the current array of objects */ export declare function recursiveGraphFetch(url: string, key: string, query: (filter: string) => string, before?: any[], overrides?: GraphFilterOverride): AsyncGenerator; export declare function sortStealthKeyLogs(stealthKeyLogs: Event[]): Event[]; /** * @notice Throws if provided public key is not on the secp256k1 curve * @param point Uncompressed public key as hex string */ export declare function assertValidPoint(point: string): void; /** * @notice Throws if provided private key is not valid. * @param point Private key as hex string */ export declare function assertValidPrivateKey(key: string): void; /** * @notice Returns the public keys associated with the provided name, using the legacy lookup approach. * @param name Name or domain to test * @param provider ethers provider instance */ export declare function getPublicKeysLegacy(name: string, provider: EthersProvider): Promise<{ spendingPublicKey: string; viewingPublicKey: string; }>; /** * @notice Returns true if the provided name is a valid domain, without the protocol identifier such as https:// * @param name Name or domain to test */ export declare function isDomain(name: string): boolean; /** * @notice Given a from address, to address, and provider, return parameters needed to sweep all ETH * @dev The intent of this method is to facilitate sweeping ETH from a stealth address (EOA) to another * account. As a result, we don't consider the chance of the sender being a contract wallet that * results in extra gas costs. * @param from Address sending ETH * @param to Address receiving ETH * @param provider Provider to use for querying data * @param overrides Optional overrides for gasLimit and gasPrice */ export declare function getEthSweepGasInfo(from: string, to: string, provider: EthersProvider, overrides?: Overrides): Promise<{ gasPrice: BigNumber; gasLimit: BigNumber; txCost: BigNumber; fromBalance: BigNumber; ethToSend: BigNumber; chainId: number; }>; export declare function assertSupportedAddress(recipientId: string): Promise; export declare function checkSupportedAddresses(recipientIds: string[]): Promise; //# sourceMappingURL=utils.d.ts.map