Node.js library for interacting with Monero API.
yarn add moneyro
Wallet
needs a running monero-wallet-rpc
, while Daemon
connects to monerod
.
Head to https://getmonero.org/downloads/ and download Command-Line tools for your platform.
- Start your daemon:
./monerod --testnet
- Start wallet RPC client
./monero-wallet-rpc \
--testnet --rpc-bind-port 18082 \
--wallet-dir <folder-for-your-wallets> \
--disable-rpc-login \
--log-level 4
And that's it, you're ready to use moneyro
.
import { Wallet } from 'moneyro';
const wallet = new Wallet();
(async () => {
try {
await wallet.create('test-wallet', 'strongpassword');
const response = await wallet.getAddress();
console.log(response); // { address: '...', addresses: [ ... ] }
} catch (err) {
console.error(err);
}
})();
import { Daemon } from 'moneyro';
const daemon = new Daemon({
hostname: 'testnet.xmrchain.net',
});
(async () => {
try {
const response = await daemon.getBlockCount();
console.log(response); // { count: 1098883, status: 'OK' }
} catch (err) {
console.error(err);
}
})();
Type: Object
Type: string
Default: '127.0.0.1'
Type: int
Default: 18082
Type: string
Type: string
Creates a new wallet. You need to have set the argument "–wallet-dir" when launching monero-wallet-rpc to make this work.
Type: string
Type: string
Type: string
Default: 'English'
Opens a wallet. You need to have set the argument "–wallet-dir" when launching monero-wallet-rpc to make this work.
Type: string
Type: string
Type: uint
Type: uint
Transfers monero to specified recipient(s).
Type: Object
Type: array<{ amount: uint, address: string }>
Type: uint
Number of outpouts from the blockchain to mix with (0 means no mixing).
Type: uint
Number of blocks before the monero can be spent (0 to not add a lock).
Type: uint
Options:
0
1
2
3
Type: boolean
Type: string
Default: ''
Random 32-byte/64-character hex string to identify a transaction.
Type: boolean
Default: false
Type: boolean
Default: false