import TaskLooper from "../common/TaskLooper"; import MoneroAccount from "./model/MoneroAccount"; import MoneroAccountTag from "./model/MoneroAccountTag"; import MoneroAddressBookEntry from "./model/MoneroAddressBookEntry"; import MoneroCheckTx from "./model/MoneroCheckTx"; import MoneroCheckReserve from "./model/MoneroCheckReserve"; import MoneroIncomingTransfer from "./model/MoneroIncomingTransfer"; import MoneroIntegratedAddress from "./model/MoneroIntegratedAddress"; import MoneroKeyImage from "../daemon/model/MoneroKeyImage"; import MoneroKeyImageImportResult from "./model/MoneroKeyImageImportResult"; import MoneroMultisigInfo from "./model/MoneroMultisigInfo"; import MoneroMultisigInitResult from "./model/MoneroMultisigInitResult"; import MoneroMultisigSignResult from "./model/MoneroMultisigSignResult"; import MoneroNetworkType from "../daemon/model/MoneroNetworkType"; import MoneroOutputQuery from "./model/MoneroOutputQuery"; import MoneroOutputWallet from "./model/MoneroOutputWallet"; import MoneroRpcConnection from "../common/MoneroRpcConnection"; import MoneroSubaddress from "./model/MoneroSubaddress"; import MoneroSyncResult from "./model/MoneroSyncResult"; import MoneroTransfer from "./model/MoneroTransfer"; import MoneroTransferQuery from "./model/MoneroTransferQuery"; import MoneroTxConfig from "./model/MoneroTxConfig"; import MoneroTxPriority from "./model/MoneroTxPriority"; import MoneroTxQuery from "./model/MoneroTxQuery"; import MoneroTxSet from "./model/MoneroTxSet"; import MoneroTxWallet from "./model/MoneroTxWallet"; import MoneroWallet from "./MoneroWallet"; import MoneroWalletConfig from "./model/MoneroWalletConfig"; import { MoneroWalletKeys, MoneroWalletKeysProxy } from "./MoneroWalletKeys"; import MoneroWalletListener from "./model/MoneroWalletListener"; import MoneroMessageSignatureType from "./model/MoneroMessageSignatureType"; import MoneroMessageSignatureResult from "./model/MoneroMessageSignatureResult"; import MoneroVersion from "../daemon/model/MoneroVersion"; /** * Implements a Monero wallet using client-side WebAssembly bindings to monero-project's wallet2 in C++. */ export default class MoneroWalletFull extends MoneroWalletKeys { protected static readonly DEFAULT_SYNC_PERIOD_IN_MS = 20000; protected static FS: any; protected path: string; protected password: string; protected listeners: MoneroWalletListener[]; protected fs: any; protected wasmListener: WalletWasmListener; protected wasmListenerHandle: number; protected rejectUnauthorized: boolean; protected rejectUnauthorizedConfigId: string; protected syncPeriodInMs: number; protected syncLooper: TaskLooper; protected browserMainPath: string; /** * Internal constructor which is given the memory address of a C++ wallet instance. * * This constructor should be called through static wallet creation utilities in this class. * * @param {number} cppAddress - address of the wallet instance in C++ * @param {string} path - path of the wallet instance * @param {string} password - password of the wallet instance * @param {FileSystem} fs - node.js-compatible file system to read/write wallet files * @param {boolean} rejectUnauthorized - specifies if unauthorized requests (e.g. self-signed certificates) should be rejected * @param {string} rejectUnauthorizedFnId - unique identifier for http_client_wasm to query rejectUnauthorized * @param {MoneroWalletFullProxy} walletProxy - proxy to invoke wallet operations in a web worker * * @private */ constructor(cppAddress: any, path: any, password: any, fs: any, rejectUnauthorized: any, rejectUnauthorizedFnId: any, walletProxy?: MoneroWalletFullProxy); /** * Check if a wallet exists at a given path. * * @param {string} path - path of the wallet on the file system * @param {any} fs - file system compatible with Node.js `fs.promises` API (defaults to disk or in-memory FS if browser) * @return {boolean} true if a wallet exists at the given path, false otherwise */ static walletExists(path: any, fs: any): Promise; static openWallet(config: Partial): Promise; static createWallet(config: MoneroWalletConfig): Promise; protected static createWalletFromSeed(config: MoneroWalletConfig): Promise; protected static createWalletFromKeys(config: MoneroWalletConfig): Promise; protected static createWalletRandom(config: MoneroWalletConfig): Promise; static getSeedLanguages(): Promise; static getFs(): any; /** * Get the maximum height of the peers the wallet's daemon is connected to. * * @return {Promise} the maximum height of the peers the wallet's daemon is connected to */ getDaemonMaxPeerHeight(): Promise; /** * Indicates if the wallet's daemon is synced with the network. * * @return {Promise} true if the daemon is synced with the network, false otherwise */ isDaemonSynced(): Promise; /** * Indicates if the wallet is synced with the daemon. * * @return {Promise} true if the wallet is synced with the daemon, false otherwise */ isSynced(): Promise; /** * Get the wallet's network type (mainnet, testnet, or stagenet). * * @return {Promise} the wallet's network type */ getNetworkType(): Promise; /** * Get the height of the first block that the wallet scans. * * @return {Promise} the height of the first block that the wallet scans */ getRestoreHeight(): Promise; /** * Set the height of the first block that the wallet scans. * * @param {number} restoreHeight - height of the first block that the wallet scans * @return {Promise} */ setRestoreHeight(restoreHeight: number): Promise; /** * Move the wallet from its current path to the given path. * * @param {string} path - the wallet's destination path * @return {Promise} */ moveTo(path: string): Promise; addListener(listener: MoneroWalletListener): Promise; removeListener(listener: any): Promise; getListeners(): MoneroWalletListener[]; setDaemonConnection(uriOrConnection?: Partial | string): Promise; getDaemonConnection(): Promise; isConnectedToDaemon(): Promise; getVersion(): Promise; getPath(): Promise; getIntegratedAddress(standardAddress?: string, paymentId?: string): Promise; decodeIntegratedAddress(integratedAddress: string): Promise; getHeight(): Promise; getDaemonHeight(): Promise; getHeightByDate(year: number, month: number, day: number): Promise; /** * Synchronize the wallet with the daemon as a one-time synchronous process. * * @param {MoneroWalletListener|number} [listenerOrStartHeight] - listener xor start height (defaults to no sync listener, the last synced block) * @param {number} [startHeight] - startHeight if not given in first arg (defaults to last synced block) * @param {boolean} [allowConcurrentCalls] - allow other wallet methods to be processed simultaneously during sync (default false)

WARNING: enabling this option will crash wallet execution if another call makes a simultaneous network request. TODO: possible to sync wasm network requests in http_client_wasm.cpp? */ sync(listenerOrStartHeight?: MoneroWalletListener | number, startHeight?: number, allowConcurrentCalls?: boolean): Promise; startSyncing(syncPeriodInMs?: number): Promise; stopSyncing(): Promise; scanTxs(txHashes: string[]): Promise; rescanSpent(): Promise; rescanBlockchain(): Promise; getBalance(accountIdx?: number, subaddressIdx?: number): Promise; getUnlockedBalance(accountIdx?: number, subaddressIdx?: number): Promise; getAccounts(includeSubaddresses?: boolean, tag?: string): Promise; getAccount(accountIdx: number, includeSubaddresses?: boolean): Promise; createAccount(label?: string): Promise; getSubaddresses(accountIdx: number, subaddressIndices?: number[]): Promise; createSubaddress(accountIdx: number, label?: string): Promise; setSubaddressLabel(accountIdx: number, subaddressIdx: number, label: string): Promise; getTxs(query?: string[] | Partial): Promise; getTransfers(query?: Partial): Promise; getOutputs(query?: Partial): Promise; exportOutputs(all?: boolean): Promise; importOutputs(outputsHex: string): Promise; exportKeyImages(all?: boolean): Promise; importKeyImages(keyImages: MoneroKeyImage[]): Promise; getNewKeyImagesFromLastImport(): Promise; freezeOutput(keyImage: string): Promise; thawOutput(keyImage: string): Promise; isOutputFrozen(keyImage: string): Promise; getDefaultFeePriority(): Promise; createTxs(config: Partial): Promise; sweepOutput(config: Partial): Promise; sweepUnlocked(config: Partial): Promise; sweepDust(relay?: boolean): Promise; relayTxs(txsOrMetadatas: (MoneroTxWallet | string)[]): Promise; describeTxSet(txSet: MoneroTxSet): Promise; signTxs(unsignedTxHex: string): Promise; submitTxs(signedTxHex: string): Promise; signMessage(message: string, signatureType?: MoneroMessageSignatureType, accountIdx?: number, subaddressIdx?: number): Promise; verifyMessage(message: string, address: string, signature: string): Promise; getTxKey(txHash: string): Promise; checkTxKey(txHash: string, txKey: string, address: string): Promise; getTxProof(txHash: string, address: string, message?: string): Promise; checkTxProof(txHash: string, address: string, message: string | undefined, signature: string): Promise; getSpendProof(txHash: string, message?: string): Promise; checkSpendProof(txHash: string, message: string | undefined, signature: string): Promise; getReserveProofWallet(message?: string): Promise; getReserveProofAccount(accountIdx: number, amount: bigint, message?: string): Promise; checkReserveProof(address: string, message: string | undefined, signature: string): Promise; getTxNotes(txHashes: string[]): Promise; setTxNotes(txHashes: string[], notes: string[]): Promise; getAddressBookEntries(entryIndices?: number[]): Promise; addAddressBookEntry(address: string, description?: string): Promise; editAddressBookEntry(index: number, setAddress: boolean, address: string | undefined, setDescription: boolean, description: string | undefined): Promise; deleteAddressBookEntry(entryIdx: number): Promise; tagAccounts(tag: string, accountIndices: number[]): Promise; untagAccounts(accountIndices: number[]): Promise; getAccountTags(): Promise; setAccountTagLabel(tag: string, label: string): Promise; getPaymentUri(config: MoneroTxConfig): Promise; parsePaymentUri(uri: string): Promise; getAttribute(key: string): Promise; setAttribute(key: string, val: string): Promise; startMining(numThreads: number, backgroundMining?: boolean, ignoreBattery?: boolean): Promise; stopMining(): Promise; isMultisigImportNeeded(): Promise; isMultisig(): Promise; getMultisigInfo(): Promise; prepareMultisig(): Promise; makeMultisig(multisigHexes: string[], threshold: number, password: string): Promise; exchangeMultisigKeys(multisigHexes: string[], password: string): Promise; exportMultisigHex(): Promise; importMultisigHex(multisigHexes: string[]): Promise; signMultisigTxHex(multisigTxHex: string): Promise; submitMultisigTxHex(signedMultisigTxHex: string): Promise; /** * Get the wallet's keys and cache data. * * @return {Promise} is the keys and cache data, respectively */ getData(): Promise; changePassword(oldPassword: string, newPassword: string): Promise; save(): Promise; close(save?: boolean): Promise; getNumBlocksToUnlock(): Promise; getTx(txHash: string): Promise; getIncomingTransfers(query: Partial): Promise; getOutgoingTransfers(query: Partial): Promise; createTx(config: Partial): Promise; relayTx(txOrMetadata: MoneroTxWallet | string): Promise; getTxNote(txHash: string): Promise; setTxNote(txHash: string, note: string): Promise; protected static openWalletData(config: Partial): Promise; protected getWalletProxy(): MoneroWalletFullProxy; protected backgroundSync(): Promise; protected refreshListening(): Promise; static sanitizeBlock(block: any): any; static sanitizeTxWallet(tx: any): MoneroTxWallet; static sanitizeAccount(account: any): any; static deserializeBlocks(blocksJsonStr: any): any; static deserializeTxs(query: any, blocksJsonStr: any): any[]; static deserializeTransfers(query: any, blocksJsonStr: any): any[]; static deserializeOutputs(query: any, blocksJsonStr: any): any[]; /** * Set the path of the wallet on the browser main thread if run as a worker. * * @param {string} browserMainPath - path of the wallet on the browser main thread */ protected setBrowserMainPath(browserMainPath: any): void; static moveTo(path: any, wallet: any): Promise; static save(wallet: any): Promise; } /** * Implements a MoneroWallet by proxying requests to a worker which runs a full wallet. * * @private */ declare class MoneroWalletFullProxy extends MoneroWalletKeysProxy { protected path: any; protected fs: any; protected wrappedListeners: any; static openWalletData(config: Partial): Promise; static createWallet(config: any): Promise; /** * Internal constructor which is given a worker to communicate with via messages. * * This method should not be called externally but should be called through * static wallet creation utilities in this class. * * @param {string} walletId - identifies the wallet with the worker * @param {Worker} worker - worker to communicate with via messages */ constructor(walletId: any, worker: any, path: any, fs: any); getPath(): any; getNetworkType(): Promise; setSubaddressLabel(accountIdx: any, subaddressIdx: any, label: any): Promise; setDaemonConnection(uriOrRpcConnection: any): Promise; getDaemonConnection(): Promise; isConnectedToDaemon(): Promise; getRestoreHeight(): Promise; setRestoreHeight(restoreHeight: any): Promise; getDaemonHeight(): Promise; getDaemonMaxPeerHeight(): Promise; getHeightByDate(year: any, month: any, day: any): Promise; isDaemonSynced(): Promise; getHeight(): Promise; addListener(listener: any): Promise; removeListener(listener: any): Promise; getListeners(): any[]; isSynced(): Promise; sync(listenerOrStartHeight?: MoneroWalletListener | number, startHeight?: number, allowConcurrentCalls?: boolean): Promise; startSyncing(syncPeriodInMs: any): Promise; stopSyncing(): Promise; scanTxs(txHashes: any): Promise; rescanSpent(): Promise; rescanBlockchain(): Promise; getBalance(accountIdx: any, subaddressIdx: any): Promise; getUnlockedBalance(accountIdx: any, subaddressIdx: any): Promise; getAccounts(includeSubaddresses: any, tag: any): Promise; getAccount(accountIdx: any, includeSubaddresses: any): Promise; createAccount(label: any): Promise; getSubaddresses(accountIdx: any, subaddressIndices: any): Promise; createSubaddress(accountIdx: any, label: any): Promise; getTxs(query: any): Promise; getTransfers(query: any): Promise; getOutputs(query: any): Promise; exportOutputs(all: any): Promise; importOutputs(outputsHex: any): Promise; exportKeyImages(all: any): Promise; importKeyImages(keyImages: any): Promise; getNewKeyImagesFromLastImport(): Promise; freezeOutput(keyImage: any): Promise; thawOutput(keyImage: any): Promise; isOutputFrozen(keyImage: any): Promise; getDefaultFeePriority(): Promise; createTxs(config: any): Promise; sweepOutput(config: any): Promise; sweepUnlocked(config: any): Promise; sweepDust(relay: any): Promise; relayTxs(txsOrMetadatas: any): Promise; describeTxSet(txSet: any): Promise; signTxs(unsignedTxHex: any): Promise; submitTxs(signedTxHex: any): Promise; signMessage(message: any, signatureType: any, accountIdx: any, subaddressIdx: any): Promise; verifyMessage(message: any, address: any, signature: any): Promise; getTxKey(txHash: any): Promise; checkTxKey(txHash: any, txKey: any, address: any): Promise; getTxProof(txHash: any, address: any, message: any): Promise; checkTxProof(txHash: any, address: any, message: any, signature: any): Promise; getSpendProof(txHash: any, message: any): Promise; checkSpendProof(txHash: any, message: any, signature: any): Promise; getReserveProofWallet(message: any): Promise; getReserveProofAccount(accountIdx: any, amount: any, message: any): Promise; checkReserveProof(address: any, message: any, signature: any): Promise; getTxNotes(txHashes: any): Promise; setTxNotes(txHashes: any, notes: any): Promise; getAddressBookEntries(entryIndices: any): Promise; addAddressBookEntry(address: any, description: any): Promise; editAddressBookEntry(index: any, setAddress: any, address: any, setDescription: any, description: any): Promise; deleteAddressBookEntry(entryIdx: any): Promise; tagAccounts(tag: any, accountIndices: any): Promise; untagAccounts(accountIndices: any): Promise; getAccountTags(): Promise; setAccountTagLabel(tag: any, label: any): Promise; getPaymentUri(config: any): Promise; parsePaymentUri(uri: any): Promise; getAttribute(key: any): Promise; setAttribute(key: any, val: any): Promise; startMining(numThreads: any, backgroundMining: any, ignoreBattery: any): Promise; stopMining(): Promise; isMultisigImportNeeded(): Promise; isMultisig(): Promise; getMultisigInfo(): Promise; prepareMultisig(): Promise; makeMultisig(multisigHexes: any, threshold: any, password: any): Promise; exchangeMultisigKeys(multisigHexes: any, password: any): Promise; exportMultisigHex(): Promise; importMultisigHex(multisigHexes: any): Promise; signMultisigTxHex(multisigTxHex: any): Promise; submitMultisigTxHex(signedMultisigTxHex: any): Promise; getData(): Promise; moveTo(path: any): Promise; changePassword(oldPassword: any, newPassword: any): Promise; save(): Promise; close(save: any): Promise; } /** * Receives notifications directly from wasm c++. * * @private */ declare class WalletWasmListener { protected wallet: MoneroWallet; constructor(wallet: any); onSyncProgress(height: any, startHeight: any, endHeight: any, percentDone: any, message: any): Promise; onNewBlock(height: any): Promise; onBalancesChanged(newBalanceStr: any, newUnlockedBalanceStr: any): Promise; onOutputReceived(height: any, txHash: any, amountStr: any, accountIdx: any, subaddressIdx: any, version: any, unlockTime: any, isLocked: any): Promise; onOutputSpent(height: any, txHash: any, amountStr: any, accountIdxStr: any, subaddressIdxStr: any, version: any, unlockTime: any, isLocked: any): Promise; } export {};