Methods
connectToDaemonRpc(uriOrConfig, username, password, rejectUnauthorized, pollInterval, proxyToWorker) → {MoneroDaemonRpc}
Create a client connected to monero-daemon-rpc.
Examples:
let daemon = await monerojs.connectToDaemonRpc("http://localhost:38081", "superuser", "abctesting123");
let daemon = await monerojs.connectToDaemonRpc({
uri: "http://localhost:38081",
username: "superuser",
password: "abctesting123"
});
Parameters:
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
uriOrConfig |
string | object | MoneroRpcConnection | uri of monero-daemon-rpc or JS config object or MoneroRpcConnection
Properties
|
|||||||||||||||||||||
username |
string | username to authenticate with monero-daemon-rpc (optional) | |||||||||||||||||||||
password |
string | password to authenticate with monero-daemon-rpc (optional) | |||||||||||||||||||||
rejectUnauthorized |
boolean | rejects self-signed certificates if true (default true) | |||||||||||||||||||||
pollInterval |
number | poll interval to query for updates in ms (default 5000) | |||||||||||||||||||||
proxyToWorker |
boolean | runs the daemon client in a web worker if true (default true) |
Returns:
- Type
- MoneroDaemonRpc
connectToWalletRpc(uriOrConfig, username, password, rejectUnauthorized) → {MoneroWalletRpc}
Create a client connected to monero-wallet-rpc.
Examples:
let walletRpc = await monerojs.connectToWalletRpc("http://localhost:38081", "superuser", "abctesting123");
let walletRpc = await monerojs.connectToWalletRpc({
uri: "http://localhost:38081",
username: "superuser",
password: "abctesting123",
rejectUnauthorized: false // e.g. local development
});
// connect to monero-wallet-rpc running as internal process
let walletRpc = await monerojs.connectToWalletRpc([
"/path/to/monero-wallet-rpc",
"--stagenet",
"--daemon-address", "http://localhost:38081",
"--daemon-login", "superuser:abctesting123",
"--rpc-bind-port", "38085",
"--rpc-login", "rpc_user:abc123",
"--wallet-dir", "/path/to/wallets", // defaults to monero-wallet-rpc directory
"--rpc-access-control-origins", "http://localhost:8080"
]);
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
uriOrConfig |
string | Array.<string> | object | MoneroRpcConnection | uri of monero-wallet-rpc or terminal parameters or JS config object or MoneroRpcConnection
Properties
|
|||||||||||||||
username |
string | username to authenticate with monero-wallet-rpc (optional) | |||||||||||||||
password |
string | password to authenticate with monero-wallet-rpc (optional) | |||||||||||||||
rejectUnauthorized |
boolean | rejects self-signed certificates if true (default true) |
Returns:
- Type
- MoneroWalletRpc
createWalletFull(config) → {MoneroWalletFull}
Create a Monero wallet using fully client-side WebAssembly bindings to monero-project's wallet2 in C++.
Example:
let wallet = await monerojs.createWalletFull({
path: "./test_wallets/wallet1", // leave blank for in-memory wallet
password: "supersecretpassword",
networkType: MoneroNetworkType.STAGENET,
mnemonic: "coexist igloo pamphlet lagoon...",
restoreHeight: 1543218,
server: new monerojs.MoneroRpcConnection("http://localhost:38081", "daemon_user", "daemon_password_123"),
});
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
object | MoneroWalletConfig | MoneroWalletConfig or equivalent config object
Properties
|
Returns:
- Type
- MoneroWalletFull
createWalletKeys(config) → {MoneroWalletKeys}
Create a wallet using WebAssembly bindings to monero-project.
Example:
let wallet = await monerojs.createWalletKeys({
password: "abc123",
networkType: MoneroNetworkType.STAGENET,
mnemonic: "coexist igloo pamphlet lagoon..."
});
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
MoneroWalletConfig | object | MoneroWalletConfig or equivalent config object
Properties
|
Returns:
- Type
- MoneroWalletKeys
getVersion() → {string}
Get the version of the monero-javascript library.
Returns:
- Type
- string
openWalletFull(configOrPath, password, networkType, daemonUriOrConnection, proxyToWorker, fs) → {MoneroWalletFull}
Open an existing Monero wallet using fully client-side WebAssembly bindings to monero-project's wallet2 in C++.
Examples:
let wallet1 = await monerojs.openWalletFull(
"./wallets/wallet1",
"supersecretpassword",
MoneroNetworkType.STAGENET,
"http://localhost:38081" // daemon uri
);
let wallet2 = await monerojs.openWalletFull({
path: "./wallets/wallet2",
password: "supersecretpassword",
networkType: MoneroNetworkType.STAGENET,
serverUri: "http://localhost:38081", // daemon configuration
serverUsername: "superuser",
serverPassword: "abctesting123"
});
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
configOrPath |
MoneroWalletConfig | object | string | MoneroWalletConfig or equivalent config object or a path to a wallet to open
Properties
|
|||||||||||||||||||||||||||||||||||||||
password |
string | password of the wallet to open | |||||||||||||||||||||||||||||||||||||||
networkType |
string | number | network type of the wallet to open | |||||||||||||||||||||||||||||||||||||||
daemonUriOrConnection |
string | MoneroRpcConnection | daemon URI or MoneroRpcConnection | |||||||||||||||||||||||||||||||||||||||
proxyToWorker |
boolean | proxies wallet operations to a web worker in order to not block the main thread (default true) | |||||||||||||||||||||||||||||||||||||||
fs |
fs | Node.js compatible file system to use (defaults to disk or in-memory FS if browser) |
Returns:
- Type
- MoneroWalletFull