### Initialize Node.js Project and Install monero-ts Source: https://github.com/woodser/monero-ts/blob/master/docs/developer_guide/getting_started_p1.md These commands set up a new Node.js project and install the monero-ts library as a dependency. Ensure Node.js and npm are installed beforehand. The `npm init -y` command creates a default `package.json` file, and `npm install --save monero-ts` adds the library to your project. ```bash mkdir ~/git/offline_wallet_generator && cd ~/git/offline_wallet_generator npm init -y npm install --save monero-ts ``` -------------------------------- ### Theme Setting Example Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroPruneResult.html An example of how to set the theme for the monero-ts documentation site using local storage. It defaults to 'os' if no theme is found. ```javascript document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os" ``` -------------------------------- ### Start Monero RPC Servers Source: https://github.com/woodser/monero-ts/blob/master/README.md Instructions for starting Monero daemon and wallet RPC servers, required for testing and interacting with the Monero network. Uses CLI commands. ```bash # Download and install Monero CLI # Start monerod (e.g., for testnet) ./monerod --testnet # Start monero-wallet-rpc (e.g., for testnet) ./monero-wallet-rpc --daemon-address http://localhost:38081 --testnet --rpc-bind-port 28084 --rpc-login rpc_user:abc123 --wallet-dir ./ ``` -------------------------------- ### Install monero-ts in Node.js Project Source: https://github.com/woodser/monero-ts/blob/master/README.md Installs the monero-ts library into your Node.js project and shows how to import it. Assumes Node.js environment is set up. ```bash cd your_project npm install monero-ts // In your application code: import moneroTs from "monero-ts"; // or import types individually ``` -------------------------------- ### MoneroTxQuery Constructor Example Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroTxQuery.html Demonstrates how to construct a MoneroTxQuery object to filter transactions. This example shows how to retrieve unlocked incoming transfers to a specific account. The constructor accepts an optional query object to define filtering criteria. ```typescript let txs = await wallet.getTxs({ isLocked: false, transferQuery: { isIncoming: true, accountIndex: 0 } }); ``` -------------------------------- ### Start Mining - TypeScript Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroWalletFull.html Initiates the mining process for the Monero wallet. It allows specifying the number of threads, whether to mine in the background, and if battery usage should be ignored. This function returns a Promise that resolves when mining starts. ```typescript startMining(numThreads: number, backgroundMining?: boolean, ignoreBattery?: boolean): Promise ``` -------------------------------- ### Basic monero-ts Program Structure in TypeScript Source: https://github.com/woodser/monero-ts/blob/master/docs/developer_guide/getting_started_p1.md This TypeScript code demonstrates the fundamental structure of a monero-ts application. It includes importing the library and defining an asynchronous main function, which is necessary for using awaited calls to the monero-ts library's functionalities. ```typescript import moneroTs from "monero-ts"; main(); async function main() { // to be implemented } ``` -------------------------------- ### Create Keys-Only Monero Wallet (TypeScript) Source: https://github.com/woodser/monero-ts/blob/master/docs/developer_guide/getting_started_p1.md Demonstrates the creation of a random, keys-only Monero wallet on the stagenet network using the monero-ts library. This wallet is suitable for offline use. It requires the 'monero-ts' package. ```typescript import moneroTs from "monero-ts"; main(); async function main() { // create a random keys-only (offline) stagenet wallet let walletKeys = await moneroTs.createWalletKeys({networkType: moneroTs.MoneroNetworkType.STAGENET, language: "English"}); // print wallet attributes console.log("Seed phrase: " + await walletKeys.getSeed()); console.log("Address: " + await walletKeys.getAddress(0, 0)); // get address of account 0, subaddress 0 console.log("Spend key: " + await walletKeys.getPrivateSpendKey()); console.log("View key: " + await walletKeys.getPrivateViewKey()); } ``` -------------------------------- ### startMonerodProcess Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroDaemonRpc.html Starts a Monero daemon (monerod) process with the given configuration. ```APIDOC ## startMonerodProcess ### Description Starts a Monero daemon (monerod) process with the given configuration. ### Method Static ### Endpoint N/A (Process management function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **config** (MoneroDaemonConfig) - Required - Configuration object for the Monero daemon. ### Request Example ```json { "config": { "daemonDataDir": "/path/to/data", "rpcPort": 18082 } } ``` ### Response #### Success Response (200) - **MoneroDaemonRpc**: An object representing the Monero daemon RPC interface. #### Response Example ```json { "daemon": { "rpcUrl": "http://localhost:18082" } } ``` ``` -------------------------------- ### Get Monero Start Timestamp Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroDaemonInfo.html Retrieves the start timestamp of the Monero daemon. Returns an array of numbers. ```typescript getStartTimestamp(): number[] ``` -------------------------------- ### Get Blocks by Range (TypeScript) Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroDaemonRpc.html Fetches blocks within a specified height range (inclusive). Optional start and end heights allow for flexible range queries. ```typescript getBlocksByRange(startHeight?: number, endHeight?: number): Promise ``` -------------------------------- ### Get Blocks by Hash (TypeScript) Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroDaemonRpc.html Fetches blocks based on an array of block hashes. It takes a start height and an optional prune flag. The block hash retrieval strategy involves sequential hashes followed by exponentially increasing offsets. ```typescript getBlocksByHash(blockHashes: string[], startHeight: number, prune?: boolean): Promise ``` -------------------------------- ### Start Syncing - TypeScript Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroWalletFull.html Begins background synchronization for the Monero wallet. An optional parameter allows setting a maximum period between syncs in milliseconds. The function returns a Promise that resolves upon initiating the sync. ```typescript startSyncing(syncPeriodInMs?: number): Promise ``` -------------------------------- ### Prepare Multisig Wallet Setup (TypeScript) Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroWalletFull.html Generates multisig information in hex format, intended to be shared with other participants to initiate the creation of a multisig wallet. This function returns a promise that resolves to the multisig hex string. It overrides the method in MoneroWalletKeys. ```typescript prepareMultisig(): Promise ``` -------------------------------- ### Retrieve Wallet Attributes (TypeScript) Source: https://github.com/woodser/monero-ts/blob/master/docs/developer_guide/getting_started_p1.md Shows how to retrieve and log essential attributes of a Monero wallet, including the seed phrase, primary address, private spend key, and private view key, using the monero-ts library. ```typescript console.log("Seed phrase: " + await walletKeys.getSeed()); console.log("Address: " + await walletKeys.getAddress(0, 0)); // get address of account 0, subaddress 0 console.log("Spend key: " + await walletKeys.getPrivateSpendKey()); console.log("View key: " + await walletKeys.getPrivateViewKey()); ``` -------------------------------- ### Create and Open Monero Wallet - Monero Wallet RPC Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroWalletRpc.html Creates and opens a Monero wallet on the monero-wallet-rpc server. Requires a configuration object including path, password, and optionally seed and restore height. Returns the wallet client instance. ```typescript createWallet(config: Partial): Promise[] ``` -------------------------------- ### Monero TypeScript Library Usage Example Source: https://github.com/woodser/monero-ts/blob/master/README.md Demonstrates connecting to a Monero daemon and wallet RPC, creating and synchronizing a wallet using WebAssembly bindings, sending transactions, and managing wallet resources. ```typescript import moneroTs from "monero-ts"; // connect to daemon let daemon = await moneroTs.connectToDaemonRpc("http://localhost:28081"); let height = await daemon.getHeight(); // 1523651 let txsInPool = await daemon.getTxPool(); // get transactions in the pool // create wallet from mnemonic phrase using WebAssembly bindings to monero-project let walletFull = await moneroTs.createWalletFull({ path: "sample_wallet_full", password: "supersecretpassword123", networkType: moneroTs.MoneroNetworkType.TESTNET, seed: "hefty value scenic...", restoreHeight: 573936, server: { // provide url or MoneroRpcConnection uri: "http://localhost:28081", username: "superuser", password: "abctesting123" } }); // synchronize with progress notifications await walletFull.sync(new class extends moneroTs.MoneroWalletListener { async onSyncProgress(height: number, startHeight: number, endHeight: number, percentDone: number, message: string) { // feed a progress bar? } }); // synchronize in the background every 5 seconds await walletFull.startSyncing(5000); // receive notifications when funds are received, confirmed, and unlocked let fundsReceived = false; await walletFull.addListener(new class extends moneroTs.MoneroWalletListener { async onOutputReceived(output: moneroTs.MoneroOutputWallet) { let amount = output.getAmount(); let txHash = output.getTx().getHash(); let isConfirmed = output.getTx().getIsConfirmed(); let isLocked = output.getTx().getIsLocked(); fundsReceived = true; } }); // connect to wallet RPC and open wallet let walletRpc = await moneroTs.connectToWalletRpc("http://localhost:28084", "rpc_user", "abc123"); await walletRpc.openWallet("sample_wallet_rpc", "supersecretpassword123"); let primaryAddress = await walletRpc.getPrimaryAddress(); // 555zgduFhmKd2o8rPUz... let balance = await walletRpc.getBalance(); // 533648366742 let txs = await walletRpc.getTxs(); // get transactions containing transfers to/from the wallet // send funds from RPC wallet to WebAssembly wallet let createdTx = await walletRpc.createTx({ accountIndex: 0, address: await walletFull.getAddress(1, 0), amount: 250000000000n, // send 0.25 XMR (denominated in atomic units) relay: false // create transaction and relay to the network if true }); let fee = createdTx.getFee(); // "Are you sure you want to send... ?" await walletRpc.relayTx(createdTx); // relay the transaction // recipient receives unconfirmed funds within 5 seconds await new Promise(function(resolve) { setTimeout(resolve, 5000); }); assert(fundsReceived); // save and close WebAssembly wallet await walletFull.close(true); // terminate any running resources (e.g. workers) await moneroTs.shutdown(); ``` -------------------------------- ### Monero Address Utilities in TypeScript Source: https://context7.com/woodser/monero-ts/llms.txt Provides examples of working with Monero addresses using the monero-ts library. This includes getting primary and subaddresses, creating and decoding integrated addresses, and validating addresses. Requires the monero-ts library and a running Monero RPC server. ```typescript import moneroTs from "monero-ts"; const wallet = await moneroTs.openWalletFull({ path: "./wallets/my_wallet", password: "supersecretpassword123", networkType: moneroTs.MoneroNetworkType.STAGENET, server: "http://localhost:38081" }); // Get primary address const primaryAddress = await wallet.getPrimaryAddress(); console.log(`Primary address: ${primaryAddress}`); // Get address for specific account/subaddress const address = await wallet.getAddress(0, 1); // account 0, subaddress 1 console.log(`Subaddress 0/1: ${address}`); // Get account and subaddress indices from address const addressIndex = await wallet.getAddressIndex(address); console.log(`Account: ${addressIndex.getAccountIndex()}, Subaddress: ${addressIndex.getSubaddressIndex()}`); // Create integrated address (address + payment ID) const integratedAddress = await wallet.getIntegratedAddress(); // random payment ID console.log(`Integrated address: ${integratedAddress.getIntegratedAddress()}`); console.log(`Payment ID: ${integratedAddress.getPaymentId()}`); // Create integrated address with specific payment ID const customIntegrated = await wallet.getIntegratedAddress( undefined, // use primary address "1234567890abcdef" // custom payment ID (16 hex chars) ); // Decode integrated address const decoded = await wallet.decodeIntegratedAddress(integratedAddress.getIntegratedAddress()); console.log(`Standard address: ${decoded.getStandardAddress()}`); console.log(`Decoded payment ID: ${decoded.getPaymentId()}`); // Validate address using MoneroUtils const isValid = await moneroTs.MoneroUtils.isValidAddress( primaryAddress, moneroTs.MoneroNetworkType.STAGENET ); console.log(`Address valid: ${isValid}`); // Get all subaddresses in an account const subaddresses = await wallet.getSubaddresses(0); for (const subaddress of subaddresses) { console.log(`[${subaddress.getIndex()}] ${subaddress.getAddress()} - Balance: ${subaddress.getBalance()}`); } // Close the wallet await wallet.close(true); ``` -------------------------------- ### createWallet Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroWalletRpc.html Creates and opens a new wallet on the monero-wallet-rpc server. This is the initial setup for a wallet. ```APIDOC ## POST /createWallet ### Description Creates and opens a new wallet on the monero-wallet-rpc server. This is the initial setup for a wallet. ### Method POST ### Endpoint /createWallet ### Parameters #### Request Body - **config** (Partial) - Required - Configuration object for creating the wallet. Can be a `MoneroWalletConfig` object or an equivalent JS object. ### Request Example ```json { "config": { "path": "mywallet", "password": "abc123", "seed": "coexist igloo pamphlet lagoon...", "restoreHeight": 1543218 } } ``` ### Response #### Success Response (200) - **result** (MoneroWalletRpc) - The wallet client object for the newly created and opened wallet. #### Response Example ```json { "result": { "address": "wallet_address", "daemonAddress": "http://localhost:18081" } } ``` ``` -------------------------------- ### MoneroConnectionManager Example Usage - monero-ts Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroConnectionManager.html Demonstrates how to use the MoneroConnectionManager class to manage RPC connections. It covers importing necessary components, creating a manager, adding connections with priorities, setting the current connection, checking connection status, receiving notifications, starting polling for the best connection, and clearing the manager. Dependencies include 'monero-ts'. ```typescript // imports import { MoneroRpcConnection, MoneroConnectionManager, MoneroConnectionManagerListener } from "monero-ts"; // create connection manager let connectionManager = new MoneroConnectionManager(); // add managed connections with priorities await connectionManager.addConnection({uri: "http://localhost:38081", priority: 1}); // use localhost as first priority await connectionManager.addConnection({uri: "http://example.com"}); // default priority is prioritized last // set current connection await connectionManager.setConnection({uri: "http://foo.bar", username: "admin", password: "password"}); // connection is added if new // check connection status await connectionManager.checkConnection(); console.log("Connection manager is connected: " + connectionManager.isConnected()); console.log("Connection is online: " + connectionManager.getConnection().getIsOnline()); console.log("Connection is authenticated: " + connectionManager.getConnection().getIsAuthenticated()); // receive notifications of any changes to current connection connectionManager.addListener(new class extends MoneroConnectionManagerListener { async onConnectionChanged(connection) { console.log("Connection changed to: " + connection); } }); // start polling for best connection every 10 seconds and automatically switch connectionManager.startPolling(10000); // automatically switch to best available connection if disconnected connectionManager.setAutoSwitch(true); // get best available connection in order of priority then response time let bestConnection = await connectionManager.getBestAvailableConnection(); // check status of all connections await connectionManager.checkConnections(); // get connections in order of current connection, online status from last check, priority, and name let connections = connectionManager.getConnections(); // clear connection manager connectionManager.clear(); ``` -------------------------------- ### Build and Run Browser Tests Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/index.html Instructions for setting up and running tests in a web browser. This involves starting the necessary RPC servers, building the browser test suite, and accessing the test runner via a local web server. ```bash # Start RPC servers for tests ./bin/start_wallet_rpc_test_servers.sh # Build browser tests ./bin/build_browser_tests.sh # Access tests in browser # http://localhost:8080/tests.html ``` -------------------------------- ### GET /getOutputsAux Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroWalletRpc.html Internal method to get auxiliary output information. ```APIDOC ## GET /getOutputsAux ### Description Internal method to get auxiliary output information. ### Method GET ### Endpoint /getOutputsAux ### Parameters #### Query Parameters - **query** (any) - Query parameters for auxiliary output retrieval. #### Request Body None ### Response #### Success Response (200) - **auxOutputs** (array) - An array of auxiliary output data. #### Response Example ```json { "auxOutputs": [ "any" ] } ``` ``` -------------------------------- ### Create Monero Wallet from Keys (Static) Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroWalletFull.html Creates a Monero wallet from existing keys. This static method requires a configuration object. ```typescript static async createWalletFromKeys(config: MoneroWalletConfig): Promise[] ``` -------------------------------- ### GET /getNumBlocksToUnlock Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroWalletRpc.html Gets the number of blocks until the next and last funds unlock. ```APIDOC ## GET /getNumBlocksToUnlock ### Description Gets the number of blocks until the next and last funds unlock. Ignores txs with unlock time as timestamp. ### Method GET ### Endpoint /getNumBlocksToUnlock ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **blocksToUnlock** (array) - An array containing two numbers: the blocks until the next unlock (element 0) and the last unlock (element 1). Undefined if no balance. #### Response Example ```json { "blocksToUnlock": [ 100, 50 ] } ``` ``` -------------------------------- ### GET /getOutputHistogram Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroDaemonRpc.html Gets a histogram of output amounts on the chain, optionally filtered by various parameters. ```APIDOC ## GET /getOutputHistogram ### Description Get a histogram of output amounts. For all amounts (possibly filtered by parameters), gives the number of outputs on the chain for that amount. RingCT outputs counts as 0 amount. ### Method GET ### Endpoint /getOutputHistogram ### Parameters #### Query Parameters - **amounts** (bigint[]) - Optional - Amounts of outputs to make the histogram with. - **minCount** (number) - Optional - Minimum count for histogram entries. - **maxCount** (number) - Optional - Maximum count for histogram entries. - **isUnlocked** (boolean) - Optional - Filters histogram entries by the unlocked state of outputs. - **recentCutoff** (number) - Optional - A cutoff height for recent outputs. ### Response #### Success Response (200) - **histogramEntries** ([MoneroOutputHistogramEntry](MoneroOutputHistogramEntry.html)[]) - An array of MoneroOutputHistogramEntry objects representing the histogram. #### Response Example ```json { "histogramEntries": [ { "amount": "1000000000", "totalInstances": 1000, "unlockedInstances": 950 } ] } ``` ``` -------------------------------- ### MoneroTx Constructor Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroTx.html Initializes a new MoneroTx instance. Optionally accepts a partial MoneroTx object for initialization. ```APIDOC ## new MoneroTx() ### Description Initializes a new MoneroTx instance. Optionally accepts a partial MoneroTx object for initialization. ### Method `new` ### Endpoint N/A (Constructor) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "tx": { "hash": "example_hash", "fee": 1000000 } } ``` ### Response #### Success Response (200) N/A (Constructor returns an instance) #### Response Example ```json { "instance": "MoneroTx" } ``` ``` -------------------------------- ### MoneroDestination Class Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroDestination.html Documentation for the MoneroDestination class, including its constructors, properties, and methods. ```APIDOC ## Class MoneroDestination Models an outgoing transfer destination. ### Constructors #### constructor(destinationOrAddress?, amount?) * **Description**: Constructs a destination to send funds to. * **Parameters**: * `destinationOrAddress` (string | Partial): Optional. A MoneroDestination object or a hex string to initialize from. * `amount` (bigint): Optional. The destination amount. * **Returns**: MoneroDestination ### Properties #### address * **Type**: string * **Description**: Destination address to send funds to. #### amount * **Type**: bigint * **Description**: Amount to send to the destination address. ### Methods #### copy() * **Description**: Creates a copy of the MoneroDestination object. * **Returns**: MoneroDestination #### getAddress() * **Description**: Gets the destination address. * **Returns**: string #### getAmount() * **Description**: Gets the destination amount. * **Returns**: bigint #### setAddress(address) * **Description**: Sets the destination address. * **Parameters**: * `address` (string): The address to set. * **Returns**: MoneroDestination #### setAmount(amount) * **Description**: Sets the destination amount. * **Parameters**: * `amount` (bigint): The amount to set. * **Returns**: MoneroDestination #### toJson() * **Description**: Converts the MoneroDestination object to a JSON representation. * **Returns**: any #### toString(indent?) * **Description**: Converts the MoneroDestination object to a string representation. * **Parameters**: * `indent` (number): Optional. The indentation level for the string representation. Defaults to 0. * **Returns**: string ``` -------------------------------- ### Set Daemon Start Timestamp Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroDaemonInfo.html Sets the timestamp indicating when the daemon started. ```APIDOC ## POST /daemon/setStartTimestamp ### Description Sets the timestamp indicating when the daemon started. ### Method POST ### Endpoint /daemon/setStartTimestamp ### Parameters #### Request Body - **startTimestamp** (number) - Required - The Unix timestamp of the daemon's start time. ### Request Example ```json { "startTimestamp": 1678886400 } ``` ### Response #### Success Response (200) - **MoneroDaemonInfo** (object) - The updated daemon information. #### Response Example ```json { "height": 1234567, "heightWithoutBootstrap": 1234560, "isBusySyncing": false, "isOffline": false, "isRestricted": false, "isSynchronized": true, "networkType": "mainnet", "numAltBlocks": 0, "numIncomingConnections": 8, "numOfflinePeers": 2, "numOnlinePeers": 50, "numOutgoingConnections": 4, "numRpcConnections": 1, "numTxs": 1500, "numTxsPool": 50, "startTimestamp": 1678886400 } ``` ``` -------------------------------- ### GET /getBalances Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroWalletRpc.html Retrieves both the total and unlocked balances for a specified account or subaddress in a single request. This is an efficient way to get balance information. ```APIDOC ## GET /getBalances ### Description Get the total and unlocked balances in a single request. ### Method GET ### Endpoint /getBalances ### Parameters #### Query Parameters - **accountIdx** (number) - Optional - Account index. - **subaddressIdx** (number) - Optional - Subaddress index. ### Request Example ```json { "accountIdx": 0, "subaddressIdx": 1 } ``` ### Response #### Success Response (200) - **balances** (bigint[]) - An array containing the total balance and unlocked balance, respectively. #### Response Example ```json { "balances": [ "1234567890000000000", "1100000000000000000" ] } ``` ``` -------------------------------- ### MoneroDaemonInfo Constructor Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroDaemonInfo.html Initializes a new instance of MoneroDaemonInfo. It can be optionally initialized with partial MoneroDaemonInfo data. ```typescript new MoneroDaemonInfo(info?: Partial) ``` -------------------------------- ### Create WebAssembly Wallet with Monero-TS Source: https://github.com/woodser/monero-ts/blob/master/docs/developer_guide/creating_wallets.md This example shows how to create a client-side wallet using WebAssembly bindings. This wallet communicates directly with a Monero daemon and utilizes wallet2.h for its operations. It supports specifying connection details for the daemon. ```typescript // create wallet using WebAssembly let wallet = await moneroTs.createWalletFull({ path: "./test_wallets/wallet1", // leave blank for in-memory wallet password: "supersecretpassword", networkType: moneroTs.MoneroNetworkType.STAGENET, seed: "coexist igloo pamphlet lagoon...", restoreHeight: 1543218, server: { uri: "http://localhost:38081", username: "daemon_user", password: "daemon_password_123" } }); ``` -------------------------------- ### POST /wallet/key-images/import Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroWalletKeys.html Imports signed key images and verifies their spent status. Requires key images with hex and signature. ```APIDOC ## POST /wallet/key-images/import ### Description Import signed key images and verify their spent status. ### Method POST ### Endpoint `/wallet/key-images/import` ### Parameters #### Request Body - **keyImages** (MoneroKeyImage[]) - Required - An array of key images to import and verify (requires hex and signature). ### Request Example ```json { "keyImages": [ { "keyImage": "a1b2c3d4e5f6...", "signature": "f6e5d4c3b2a1..." } ] } ``` ### Response #### Success Response (200) - **results** (MoneroKeyImageImportResult) - Results of the import operation. #### Response Example ```json { "results": { "height": 123456, "spentAmount": "1000000000", "unspentAmount": "500000000" } } ``` ``` -------------------------------- ### Wallet Creation API Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroWalletFull.html Provides static methods for creating new Monero wallets, either from scratch or from existing keys. ```APIDOC ## POST /wallets/create ### Description Create a new Monero wallet using WebAssembly bindings to monero-project. ### Method POST ### Endpoint /wallets/create ### Parameters #### Request Body - **config** (MoneroWalletConfig) - Required - MoneroWalletConfig or equivalent config object, including properties like `password`, `networkType`, and optionally `seed` or `mnemonic`. ### Request Example ```json { "password": "abc123", "networkType": "STAGENET", "seed": "coexist igloo pamphlet lagoon..." } ``` ### Response #### Success Response (200) - **wallet** (MoneroWalletFull) - The created wallet object. #### Response Example ```json { "wallet": { "address": "MoneroAddress...", "viewKey": "ViewKey...", "seed": "..." } } ``` ## POST /wallets/createFromKeys ### Description Create a Monero wallet from existing keys. ### Method POST ### Endpoint /wallets/createFromKeys ### Parameters #### Request Body - **config** (MoneroWalletConfig) - Required - MoneroWalletConfig or equivalent config object, including properties like `address`, `viewKey`, `password`, and `networkType`. ### Response #### Success Response (200) - **wallet** (MoneroWalletFull) - The created wallet object. #### Response Example ```json { "wallet": { "address": "MoneroAddress...", "viewKey": "ViewKey..." } } ``` ``` -------------------------------- ### GET /getPrimaryAddress Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroWalletRpc.html Retrieves the primary address of the wallet. ```APIDOC ## GET /getPrimaryAddress ### Description Retrieves the primary address of the wallet. ### Method GET ### Endpoint /getPrimaryAddress ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **primaryAddress** (string) - The primary address of the wallet. #### Response Example ```json { "primaryAddress": "44AFFq5kSiGBVKBMQu9n2q922222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 ``` -------------------------------- ### GET /getPath Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroWalletRpc.html Retrieves the file path of the wallet. ```APIDOC ## GET /getPath ### Description Retrieves the file path of the wallet. ### Method GET ### Endpoint /getPath ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **path** (string) - The file path of the wallet. #### Response Example ```json { "path": "/path/to/my/wallet.keys" } ``` ``` -------------------------------- ### Open Monero Wallet with MoneroWalletRpc Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroWalletRpc.html Opens an existing Monero wallet on the monero-wallet-rpc server. It can accept either a wallet path or a configuration object. The password is optional if provided in the config. This method returns a Promise that resolves to the wallet client instance. ```typescript let wallet = new MoneroWalletRpc("http://localhost:38084", "rpc_user", "abc123"); await wallet.openWallet("mywallet1", "supersecretpassword"); await wallet.openWallet({ path: "mywallet2", password: "supersecretpassword", server: "http://locahost:38081", // or object with uri, username, password, etc rejectUnauthorized: false }); ``` -------------------------------- ### MoneroPeer Class Documentation Source: https://github.com/woodser/monero-ts/blob/master/docs/typedocs/classes/MoneroPeer.html Documentation for the MoneroPeer class, covering its constructors, properties, and methods. ```APIDOC ## MoneroPeer Class Models a peer to the daemon. ### Hierarchy * MoneroPeer ### Constructors #### `new MoneroPeer(peer?)` * **Parameters** * `peer` (MoneroPeer) - Optional. An existing MoneroPeer object to initialize with. * **Returns** * MoneroPeer - A new MoneroPeer instance. ### Properties * **address** (string) - The network address of the peer. * **avgDownload** (number) - The average download speed of the peer. * **avgUpload** (number) - The average upload speed of the peer. * **currentDownload** (number) - The current download speed of the peer. * **currentUpload** (number) - The current upload speed of the peer. * **height** (number) - The current blockchain height of the peer. * **host** (string) - The hostname or IP address of the peer. * **id** (string) - The unique identifier of the peer. * **isIncoming** (boolean) - Indicates if the connection to the peer is incoming. * **isLocalHost** (boolean) - Indicates if the peer is the local host. * **isLocalIp** (boolean) - Indicates if the peer's IP address is a local IP. * **isOnline** (boolean) - Indicates if the peer is currently online. * **lastSeenTimestamp** (number) - The timestamp when the peer was last seen. * **liveTime** (number) - The duration the peer has been online. * **numReceives** (number) - The number of data packets received from the peer. * **numSends** (number) - The number of data packets sent to the peer. * **numSupportFlags** (number) - Flags indicating peer support capabilities. * **port** (number) - The network port of the peer. * **pruningSeed** (number) - The pruning seed of the peer. * **receiveIdleTime** (number) - The time the peer has been idle on receiving data. * **rpcCreditsPerHash** (number) - RPC credits per hash for the peer. * **rpcPort** (number) - The RPC port of the peer. * **sendIdleTime** (number) - The time the peer has been idle on sending data. * **state** (string) - The current state of the peer connection. * **type** (string) - The type of the peer. ### Methods * **getAddress()**: string - Gets the network address of the peer. * **getAvgDownload()**: number - Gets the average download speed of the peer. * **getAvgUpload()**: number - Gets the average upload speed of the peer. * **getCurrentDownload()**: number - Gets the current download speed of the peer. * **getCurrentUpload()**: number - Gets the current upload speed of the peer. * **getHeight()**: number - Gets the current blockchain height of the peer. * **getHost()**: string - Gets the hostname or IP address of the peer. * **getId()**: string - Gets the unique identifier of the peer. * **getIsIncoming()**: boolean - Checks if the connection to the peer is incoming. * **getIsLocalHost()**: boolean - Checks if the peer is the local host. * **getIsLocalIp()**: boolean - Checks if the peer's IP address is a local IP. * **getIsOnline()**: boolean - Checks if the peer is currently online. * **getLastSeenTimestamp()**: number - Gets the timestamp when the peer was last seen. * **getLiveTime()**: number - Gets the duration the peer has been online. * **getNumReceives()**: number - Gets the number of data packets received from the peer. * **getNumSends()**: number - Gets the number of data packets sent to the peer. * **getNumSupportFlags()**: number - Gets the peer support flags. * **getPort()**: number - Gets the network port of the peer. * **getPruningSeed()**: number - Gets the pruning seed of the peer. * **getReceiveIdleTime()**: number - Gets the time the peer has been idle on receiving data. * **getRpcCreditsPerHash()**: number - Gets the RPC credits per hash for the peer. * **getRpcPort()**: number - Gets the RPC port of the peer. * **getSendIdleTime()**: number - Gets the time the peer has been idle on sending data. * **getState()**: string - Gets the current state of the peer connection. * **getType()**: string - Gets the type of the peer. * **setAddress(address: string)**: void - Sets the network address of the peer. * **setAvgDownload(avgDownload: number)**: void - Sets the average download speed of the peer. * **setAvgUpload(avgUpload: number)**: void - Sets the average upload speed of the peer. * **setCurrentDownload(currentDownload: number)**: void - Sets the current download speed of the peer. * **setCurrentUpload(currentUpload: number)**: void - Sets the current upload speed of the peer. * **setHeight(height: number)**: void - Sets the current blockchain height of the peer. * **setHost(host: string)**: void - Sets the hostname or IP address of the peer. * **setId(id: string)**: void - Sets the unique identifier of the peer. * **setIsIncoming(isIncoming: boolean)**: void - Sets whether the connection to the peer is incoming. * **setIsLocalHost(isLocalHost: boolean)**: void - Sets whether the peer is the local host. * **setIsLocalIp(isLocalIp: boolean)**: void - Sets whether the peer's IP address is a local IP. * **setIsOnline(isOnline: boolean)**: void - Sets whether the peer is currently online. * **setLastSeenTimestamp(lastSeenTimestamp: number)**: void - Sets the timestamp when the peer was last seen. * **setLiveTime(liveTime: number)**: void - Sets the duration the peer has been online. * **setNumReceives(numReceives: number)**: void - Sets the number of data packets received from the peer. * **setNumSends(numSends: number)**: void - Sets the number of data packets sent to the peer. * **setNumSupportFlags(numSupportFlags: number)**: void - Sets the peer support flags. * **setPort(port: number)**: void - Sets the network port of the peer. * **setPruningSeed(pruningSeed: number)**: void - Sets the pruning seed of the peer. * **setReceiveIdleTime(receiveIdleTime: number)**: void - Sets the time the peer has been idle on receiving data. * **setRpcCreditsPerHash(rpcCreditsPerHash: number)**: void - Sets the RPC credits per hash for the peer. * **setRpcPort(rpcPort: number)**: void - Sets the RPC port of the peer. * **setSendIdleTime(sendIdleTime: number)**: void - Sets the time the peer has been idle on sending data. * **setState(state: string)**: void - Sets the current state of the peer connection. * **setType(type: string)**: void - Sets the type of the peer. * **toJson()**: object - Converts the MoneroPeer object to a JSON representation. ```