*/
28 |
29 | /** @preserve
30 | * Counter block mode compatible with Dr Brian Gladman fileenc.c
31 | * derived from CryptoJS.mode.CTR
32 | * Jan Hruby jhruby.web@gmail.com
33 | */
34 |
35 | /** @preserve
36 | (c) 2012 by Cédric Mesnil. All rights reserved.
37 |
38 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
39 |
40 | - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
41 | - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
42 |
43 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44 | */
45 |
--------------------------------------------------------------------------------
/dist/src/main/ts/common/Filter.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Base filter.
3 | *
4 | * @private
5 | */
6 | export default class Filter {
7 | /**
8 | * Indicates if the given value meets the criteria of this filter.
9 | *
10 | * @param val is the value to test
11 | * @return true if the value meets the criteria of this filter, false otherwise
12 | */
13 | meetsCriteria(val: any): boolean;
14 | /**
15 | * Returns a new array comprised of elements from the given array that meet
16 | * the filter's criteria.
17 | *
18 | * @param filter implements meetsCriteria(elem) to filter the given array
19 | * @param array is the array to apply the filter to
20 | * @return the new array of filtered elements
21 | */
22 | static apply(filter: Filter, array: any[]): any[];
23 | }
24 |
--------------------------------------------------------------------------------
/dist/src/main/ts/common/Filter.js:
--------------------------------------------------------------------------------
1 | "use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
2 | * Base filter.
3 | *
4 | * @private
5 | */
6 | class Filter {
7 |
8 | /**
9 | * Indicates if the given value meets the criteria of this filter.
10 | *
11 | * @param val is the value to test
12 | * @return true if the value meets the criteria of this filter, false otherwise
13 | */
14 | meetsCriteria(val) {
15 | throw new Error("Subclass must implement");
16 | }
17 |
18 | /**
19 | * Returns a new array comprised of elements from the given array that meet
20 | * the filter's criteria.
21 | *
22 | * @param filter implements meetsCriteria(elem) to filter the given array
23 | * @param array is the array to apply the filter to
24 | * @return the new array of filtered elements
25 | */
26 | static apply(filter, array) {
27 | return array.filter((elem) => !filter || filter.meetsCriteria(elem));
28 | }
29 | }exports.default = Filter;
30 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJGaWx0ZXIiLCJtZWV0c0NyaXRlcmlhIiwidmFsIiwiRXJyb3IiLCJhcHBseSIsImZpbHRlciIsImFycmF5IiwiZWxlbSIsImV4cG9ydHMiLCJkZWZhdWx0Il0sInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vc3JjL21haW4vdHMvY29tbW9uL0ZpbHRlci50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEJhc2UgZmlsdGVyLlxuICogXG4gKiBAcHJpdmF0ZVxuICovXG5leHBvcnQgZGVmYXVsdCBjbGFzcyBGaWx0ZXIge1xuICBcbiAgLyoqXG4gICAqIEluZGljYXRlcyBpZiB0aGUgZ2l2ZW4gdmFsdWUgbWVldHMgdGhlIG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UFDQTtFQUNFQyxhQUFhQSxDQUFDQyxHQUFRLEVBQVc7SUFDL0IsTUFBTSxJQUFJQyxLQUFLLENBQUMseUJBQXlCLENBQUM7RUFDNUM7O0VBRUE7QUFDRjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtFQUNFLE9BQU9DLEtBQUtBLENBQUNDLE1BQWMsRUFBRUMsS0FBWSxFQUFTO0lBQ2hELE9BQU9BLEtBQUssQ0FBQ0QsTUFBTSxDQUFDLENBQUFFLElBQUksS0FBSSxDQUFDRixNQUFNLElBQUlBLE1BQU0sQ0FBQ0osYUFBYSxDQUFDTSxJQUFJLENBQUMsQ0FBQztFQUNwRTtBQUNGLENBQUNDLE9BQUEsQ0FBQUMsT0FBQSxHQUFBVCxNQUFBIn0=
--------------------------------------------------------------------------------
/dist/src/main/ts/common/HttpClient.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Handle HTTP requests with a uniform interface.
3 | */
4 | export default class HttpClient {
5 | static MAX_REQUESTS_PER_SECOND: number;
6 | protected static DEFAULT_REQUEST: {
7 | method: string;
8 | resolveWithFullResponse: boolean;
9 | rejectUnauthorized: boolean;
10 | };
11 | protected static PROMISE_THROTTLES: any[];
12 | protected static TASK_QUEUES: any[];
13 | protected static DEFAULT_TIMEOUT: number;
14 | static MAX_TIMEOUT: number;
15 | protected static HTTP_AGENT: any;
16 | protected static HTTPS_AGENT: any;
17 | /**
18 | * Make a HTTP request.
19 | *
20 | * @param {object} request - configures the request to make
21 | * @param {string} request.method - HTTP method ("GET", "PUT", "POST", "DELETE", etc)
22 | * @param {string} request.uri - uri to request
23 | * @param {string|Uint8Array|object} request.body - request body
24 | * @param {string} [request.username] - username to authenticate the request (optional)
25 | * @param {string} [request.password] - password to authenticate the request (optional)
26 | * @param {object} [request.headers] - headers to add to the request (optional)
27 | * @param {boolean} [request.resolveWithFullResponse] - return full response if true, else body only (default false)
28 | * @param {boolean} [request.rejectUnauthorized] - whether or not to reject self-signed certificates (default true)
29 | * @param {number} request.timeout - maximum time allowed in milliseconds
30 | * @param {number} request.proxyToWorker - proxy request to worker thread
31 | * @return {object} response - the response object
32 | * @return {string|Uint8Array|object} response.body - the response body
33 | * @return {number} response.statusCode - the response code
34 | * @return {String} response.statusText - the response message
35 | * @return {object} response.headers - the response headers
36 | */
37 | static request(request: any): Promise;
38 | /**
39 | * Get a singleton instance of an HTTP client to share.
40 | *
41 | * @return {http.Agent} a shared agent for network requests among library instances
42 | */
43 | protected static getHttpAgent(): any;
44 | /**
45 | * Get a singleton instance of an HTTPS client to share.
46 | *
47 | * @return {https.Agent} a shared agent for network requests among library instances
48 | */
49 | protected static getHttpsAgent(): any;
50 | protected static requestAxios(req: any): Promise;
51 | protected static axiosDigestAuthRequest: (method: any, url: any, username: any, password: any, body: any) => Promise>;
52 | }
53 |
--------------------------------------------------------------------------------
/dist/src/main/ts/common/MoneroConnectionManagerListener.d.ts:
--------------------------------------------------------------------------------
1 | import MoneroRpcConnection from "./MoneroRpcConnection";
2 | /**
3 | * Default connection manager listener which takes no action on notifications.
4 | */
5 | export default class MoneroConnectionManagerListener {
6 | /**
7 | * Notified on connection change events.
8 | *
9 | * @param {MoneroRpcConnection | undefined} connection - the connection manager's current connection
10 | * @return {Promise}
11 | */
12 | onConnectionChanged(connection: MoneroRpcConnection | undefined): Promise;
13 | }
14 |
--------------------------------------------------------------------------------
/dist/src/main/ts/common/MoneroConnectionManagerListener.js:
--------------------------------------------------------------------------------
1 | "use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;
2 |
3 | /**
4 | * Default connection manager listener which takes no action on notifications.
5 | */
6 | class MoneroConnectionManagerListener {
7 |
8 | /**
9 | * Notified on connection change events.
10 | *
11 | * @param {MoneroRpcConnection | undefined} connection - the connection manager's current connection
12 | * @return {Promise}
13 | */
14 | async onConnectionChanged(connection) {}
15 | }exports.default = MoneroConnectionManagerListener;
16 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9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VBQ0UsTUFBTUMsbUJBQW1CQSxDQUFDQyxVQUEyQyxFQUFpQixDQUFFO0FBQzFGLENBQUNDLE9BQUEsQ0FBQUMsT0FBQSxHQUFBSiwrQkFBQSJ9
--------------------------------------------------------------------------------
/dist/src/main/ts/common/MoneroError.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Exception when interacting with a Monero wallet or daemon.
3 | */
4 | export default class MoneroError extends Error {
5 | code: number;
6 | /**
7 | * Constructs the error.
8 | *
9 | * @param {string} message is a human-readable message of the error
10 | * @param {number} [code] is the error code (optional)
11 | */
12 | constructor(message: any, code?: any);
13 | getCode(): number;
14 | toString(): string;
15 | }
16 |
--------------------------------------------------------------------------------
/dist/src/main/ts/common/MoneroError.js:
--------------------------------------------------------------------------------
1 | "use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
2 | * Exception when interacting with a Monero wallet or daemon.
3 | */
4 | class MoneroError extends Error {
5 |
6 |
7 |
8 | /**
9 | * Constructs the error.
10 | *
11 | * @param {string} message is a human-readable message of the error
12 | * @param {number} [code] is the error code (optional)
13 | */
14 | constructor(message, code) {
15 | super(message);
16 | this.code = code;
17 | }
18 |
19 | getCode() {
20 | return this.code;
21 | }
22 |
23 | toString() {
24 | if (this.message === undefined && this.getCode() === undefined) return super.message;
25 | let str = "";
26 | if (this.getCode() !== undefined) str += this.getCode() + ": ";
27 | str += this.message;
28 | return str;
29 | }
30 | }exports.default = MoneroError;
31 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJNb25lcm9FcnJvciIsIkVycm9yIiwiY29uc3RydWN0b3IiLCJtZXNzYWdlIiwiY29kZSIsImdldENvZGUiLCJ0b1N0cmluZyIsInVuZGVmaW5lZCIsInN0ciIsImV4cG9ydHMiLCJkZWZhdWx0Il0sInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vc3JjL21haW4vdHMvY29tbW9uL01vbmVyb0Vycm9yLnR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NBO0FBQ0E7QUFDQTtBQUNBO0VBQ0VDLFdBQVdBLENBQUNDLE9BQU8sRUFBRUMsSUFBSyxFQUFFO0lBQzFCLEtBQUssQ0FBQ0QsT0FBTyxDQUFDO0lBQ2QsSUFBSSxDQUFDQyxJQUFJLEdBQUdBLElBQUk7RUFDbEI7O0VBRUFDLE9BQU9BLENBQUEsRUFBRztJQUNSLE9BQU8sSUFBSSxDQUFDRCxJQUFJO0VBQ2xCOztFQUVBRSxRQUFRQSxDQUFBLEVBQUc7SUFDVCxJQUFJLElBQUksQ0FBQ0gsT0FBTyxLQUFLSSxTQUFTLElBQUksSUFBSSxDQUFDRixPQUFPLENBQUMsQ0FBQyxLQUFLRSxTQUFTLEVBQUUsT0FBTyxLQUFLLENBQUNKLE9BQU87SUFDcEYsSUFBSUssR0FBRyxHQUFHLEVBQUU7SUFDWixJQUFJLElBQUksQ0FBQ0gsT0FBTyxDQUFDLENBQUMsS0FBS0UsU0FBUyxFQUFFQyxHQUFHLElBQUksSUFBSSxDQUFDSCxPQUFPLENBQUMsQ0FBQyxHQUFHLElBQUk7SUFDOURHLEdBQUcsSUFBSSxJQUFJLENBQUNMLE9BQU87SUFDbkIsT0FBT0ssR0FBRztFQUNaO0FBQ0YsQ0FBQ0MsT0FBQSxDQUFBQyxPQUFBLEdBQUFWLFdBQUEifQ==
--------------------------------------------------------------------------------
/dist/src/main/ts/common/MoneroRpcError.d.ts:
--------------------------------------------------------------------------------
1 | import MoneroError from "./MoneroError";
2 | /**
3 | * Error when interacting with Monero RPC.
4 | */
5 | export default class MoneroRpcError extends MoneroError {
6 | protected rpcMethod: any;
7 | protected rpcParams: any;
8 | /**
9 | * Constructs the error.
10 | *
11 | * @param {string} rpcDescription is a description of the error from rpc
12 | * @param {number} rpcCode is the error code from rpc
13 | * @param {string} [rpcMethod] is the rpc method invoked
14 | * @param {object} [rpcParams] are parameters sent with the rpc request
15 | */
16 | constructor(rpcDescription: any, rpcCode: any, rpcMethod?: any, rpcParams?: any);
17 | getRpcMethod(): any;
18 | getRpcParams(): any;
19 | toString(): string;
20 | }
21 |
--------------------------------------------------------------------------------
/dist/src/main/ts/common/MoneroWebWorker.d.ts:
--------------------------------------------------------------------------------
1 | export {};
2 |
--------------------------------------------------------------------------------
/dist/src/main/ts/common/SslOptions.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * SSL options for remote endpoints.
3 | */
4 | export default class SslOptions {
5 | privateKeyPath: string;
6 | certificatePath: string;
7 | certificateAuthorityFile: string;
8 | allowedFingerprints: string[];
9 | allowAnyCert: boolean;
10 | constructor(options?: Partial);
11 | getPrivateKeyPath(): string;
12 | setPrivateKeyPath(privateKeyPath: any): this;
13 | getCertificatePath(): string;
14 | setCertificatePath(certificatePath: any): this;
15 | getCertificateAuthorityFile(): string;
16 | setCertificateAuthorityFile(certificateAuthorityFile: any): this;
17 | getAllowedFingerprints(): string[];
18 | setAllowedFingerprints(allowedFingerprints: any): this;
19 | getAllowAnyCert(): boolean;
20 | setAllowAnyCert(allowAnyCert: any): this;
21 | }
22 |
--------------------------------------------------------------------------------
/dist/src/main/ts/common/TaskLooper.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | /**
3 | * Run a task in a fixed period loop.
4 | */
5 | export default class TaskLooper {
6 | _fn: () => Promise;
7 | _isStarted: boolean;
8 | _isLooping: boolean;
9 | _periodInMs: number;
10 | _timeout: NodeJS.Timeout | undefined;
11 | /**
12 | * Build the looper with a function to invoke on a fixed period loop.
13 | *
14 | * @param {function} fn - the async function to invoke
15 | */
16 | constructor(fn: () => Promise);
17 | /**
18 | * Get the task function to invoke on a fixed period loop.
19 | *
20 | * @return {function} the task function
21 | */
22 | getTask(): () => Promise;
23 | /**
24 | * Start the task loop.
25 | *
26 | * @param {number} periodInMs the loop period in milliseconds
27 | * @param {boolean} targetFixedPeriod specifies if the task should target a fixed period by accounting for run time (default false)
28 | * @return {TaskLooper} this instance for chaining
29 | */
30 | start(periodInMs: number, targetFixedPeriod?: boolean): void;
31 | /**
32 | * Indicates if looping.
33 | *
34 | * @return {boolean} true if looping, false otherwise
35 | */
36 | isStarted(): boolean;
37 | /**
38 | * Stop the task loop.
39 | */
40 | stop(): void;
41 | /**
42 | * Set the loop period in milliseconds.
43 | *
44 | * @param {number} periodInMs the loop period in milliseconds
45 | */
46 | setPeriodInMs(periodInMs: any): void;
47 | _runLoop(targetFixedPeriod: boolean): Promise;
48 | }
49 |
--------------------------------------------------------------------------------
/dist/src/main/ts/common/ThreadPool.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Simple thread pool using the async library.
3 | */
4 | export default class ThreadPool {
5 | protected taskQueue: any;
6 | protected drainListeners: any;
7 | /**
8 | * Construct the thread pool.
9 | *
10 | * @param {number} [maxConcurrency] - maximum number of threads in the pool (default 1)
11 | */
12 | constructor(maxConcurrency: any);
13 | /**
14 | * Submit an asynchronous function to run using the thread pool.
15 | *
16 | * @param {function} asyncFn - asynchronous function to run with the thread pool
17 | * @return {Promise} resolves when the function completes execution
18 | */
19 | submit(asyncFn: any): Promise;
20 | /**
21 | * Await all functions to complete.
22 | *
23 | * @return {Promise} resolves when all functions complete
24 | */
25 | awaitAll(): Promise;
26 | }
27 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/ConnectionType.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Enumerates connection types.
3 | *
4 | * Based on enums.h in monero-project.
5 | */
6 | declare enum ConnectionType {
7 | /**
8 | * Invalid connection type (value=0).
9 | */
10 | INVALID = 0,
11 | /**
12 | * IPV4 connection type (value=1).
13 | */
14 | IPV4 = 1,
15 | /**
16 | * IPV6 connection type (value=2).
17 | */
18 | IPV6 = 2,
19 | /**
20 | * TOR connection type (value=3).
21 | */
22 | TOR = 3,
23 | /**
24 | * I2P connection type (value=4).
25 | */
26 | I2P = 4
27 | }
28 | export default ConnectionType;
29 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/ConnectionType.js:
--------------------------------------------------------------------------------
1 | "use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;
2 |
3 | /**
4 | * Enumerates connection types.
5 | *
6 | * Based on enums.h in monero-project.
7 | */var
8 | ConnectionType = /*#__PURE__*/function (ConnectionType) {ConnectionType[ConnectionType["INVALID"] = 0] = "INVALID";ConnectionType[ConnectionType["IPV4"] = 1] = "IPV4";ConnectionType[ConnectionType["IPV6"] = 2] = "IPV6";ConnectionType[ConnectionType["TOR"] = 3] = "TOR";ConnectionType[ConnectionType["I2P"] = 4] = "I2P";return ConnectionType;}(ConnectionType || {});var _default = exports.default =
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | ConnectionType;
37 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJDb25uZWN0aW9uVHlwZSIsIl9kZWZhdWx0IiwiZXhwb3J0cyIsImRlZmF1bHQiXSwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWFpbi90cy9kYWVtb24vbW9kZWwvQ29ubmVjdGlvblR5cGUudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IGFzc2VydCBmcm9tIFwiYXNzZXJ0XCI7XG5cbi8qKlxuICogRW51bWVyYXRlcyBjb25uZWN0aW9uIHR5cGVzLlxuICogXG4gKiBCYXNlZCBvbiBlbnVtcy5oIGluIG1vbmVyby1wcm9qZWN0LlxuICovXG5lbnVtIENvbm5lY3Rpb25UeXBlIHtcblxuICAvKipcbiAgICogSW52YWxpZCBjb25uZWN0aW9uIHR5cGUgKHZhbHVlPTApLlxuICAgKi9cbiAgSU5WQUxJRCA9IDAsXG5cbiAgLyoqXG4gICAqIElQVjQgY29ubmVjdGlvbiB0eXBlICh2YWx1ZT0xKS5cbiAgICovXG4gIElQVjQgPSAxLFxuXG4gIC8qKlxuICAgKiBJUFY2IGNvbm5lY3Rpb24gdHlwZSAodmFsdWU9MikuXG4gICAqL1xuICBJUFY2ID0gMixcblxuICAvKipcbiAgICogVE9SIGNvbm5lY3Rpb24gdHlwZSAodmFsdWU9MykuXG4gICAqL1xuICBUT1IgPSAzLFxuXG4gIC8qKlxuICAgKiBJMlAgY29ubmVjdGlvbiB0eXBlICh2YWx1ZT00KS5cbiAgICovXG4gIEkyUCA9IDRcbn1cblxuZXhwb3J0IGRlZmF1bHQgQ29ubmVjdGlvblR5cGU7Il0sIm1hcHBpbmdzIjoiOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsR0FKQTtBQUtLQSxjQUFjLDBCQUFkQSxjQUFjLEdBQWRBLGNBQWMsQ0FBZEEsY0FBYyw2QkFBZEEsY0FBYyxDQUFkQSxjQUFjLHVCQUFkQSxjQUFjLENBQWRBLGNBQWMsdUJBQWRBLGNBQWMsQ0FBZEEsY0FBYyxxQkFBZEEsY0FBYyxDQUFkQSxjQUFjLDRCQUFkQSxjQUFjLEdBQWRBLGNBQWMsWUFBQUMsUUFBQSxHQUFBQyxPQUFBLENBQUFDLE9BQUE7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUE0QkpILGNBQWMifQ==
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroAltChain.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models an alternative chain seen by the node.
3 | */
4 | export default class MoneroAltChain {
5 | blockHashes: string[];
6 | difficulty: bigint;
7 | height: number;
8 | length: number;
9 | mainChainParentBlockHash: string;
10 | constructor(altChain?: Partial);
11 | toJson(): any;
12 | getBlockHashes(): string[];
13 | setBlockHashes(blockHashes: string[]): MoneroAltChain;
14 | getDifficulty(): bigint;
15 | setDifficulty(difficulty: bigint): MoneroAltChain;
16 | getHeight(): number;
17 | setHeight(height: number): MoneroAltChain;
18 | getLength(): number;
19 | setLength(length: number): MoneroAltChain;
20 | getMainChainParentBlockHash(): string;
21 | setMainChainParentBlockHash(mainChainParentBlockHash: string): MoneroAltChain;
22 | }
23 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroBan.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Monero banhammer.
3 | */
4 | export default class MoneroBan {
5 | host: string;
6 | ip: string;
7 | isBanned: boolean;
8 | seconds: number;
9 | constructor(ban?: Partial);
10 | toJson(): any;
11 | getHost(): string;
12 | setHost(host: string): MoneroBan;
13 | getIp(): string;
14 | setIp(ip: string): MoneroBan;
15 | getIsBanned(): boolean;
16 | setIsBanned(isBanned: boolean): MoneroBan;
17 | getSeconds(): number;
18 | setSeconds(seconds: number): MoneroBan;
19 | }
20 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroBlock.d.ts:
--------------------------------------------------------------------------------
1 | import MoneroBlockHeader from "./MoneroBlockHeader";
2 | import MoneroTx from "./MoneroTx";
3 | /**
4 | * Enumerates types to deserialize to.
5 | */
6 | declare enum DeserializationType {
7 | TX = 0,
8 | TX_WALLET = 1,
9 | TX_QUERY = 2
10 | }
11 | /**
12 | * Models a Monero block in the blockchain.
13 | */
14 | export default class MoneroBlock extends MoneroBlockHeader {
15 | static DeserializationType: typeof DeserializationType;
16 | hex: string;
17 | minerTx: MoneroTx;
18 | txs: MoneroTx[];
19 | txHashes: string[];
20 | constructor(block?: Partial, txType?: DeserializationType);
21 | getHex(): string;
22 | setHex(hex: string): MoneroBlock;
23 | getMinerTx(): MoneroTx;
24 | setMinerTx(minerTx: MoneroTx): MoneroBlock;
25 | getTxs(): MoneroTx[];
26 | setTxs(txs: MoneroTx[]): MoneroBlock;
27 | getTxHashes(): string[];
28 | setTxHashes(txHashes: string[]): MoneroBlock;
29 | copy(): MoneroBlock;
30 | toJson(): any;
31 | merge(block: MoneroBlock): MoneroBlock;
32 | toString(indent?: number): string;
33 | protected static mergeTx(txs: any, tx: any): void;
34 | setHeight(height: number): MoneroBlock;
35 | setTimestamp(timestamp: number): MoneroBlock;
36 | setSize(size: number): MoneroBlock;
37 | setWeight(weight: number): MoneroBlock;
38 | setLongTermWeight(longTermWeight: number): MoneroBlock;
39 | setDepth(depth: number): MoneroBlock;
40 | setDifficulty(difficulty: bigint): MoneroBlock;
41 | setCumulativeDifficulty(cumulativeDifficulty: bigint): MoneroBlock;
42 | setMajorVersion(majorVersion: number): MoneroBlock;
43 | setMinorVersion(minorVersion: number): MoneroBlock;
44 | setNonce(nonce: number): MoneroBlock;
45 | setMinerTxHash(minerTxHash: string): MoneroBlock;
46 | setNumTxs(numTxs: number): MoneroBlock;
47 | setOrphanStatus(orphanStatus: boolean): MoneroBlock;
48 | setPrevHash(prevHash: string): MoneroBlock;
49 | setReward(reward: bigint): MoneroBlock;
50 | setPowHash(powHash: string): MoneroBlock;
51 | protected deserializeTx(tx: any, txType?: DeserializationType): MoneroTx;
52 | }
53 | export {};
54 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroBlockHeader.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models a Monero block header which contains information about the block.
3 | */
4 | export default class MoneroBlockHeader {
5 | hash: string;
6 | height: number;
7 | timestamp: number;
8 | size: number;
9 | weight: number;
10 | longTermWeight: number;
11 | depth: number;
12 | difficulty: bigint;
13 | cumulativeDifficulty: bigint;
14 | majorVersion: number;
15 | minorVersion: number;
16 | nonce: number;
17 | minerTxHash: string;
18 | numTxs: number;
19 | orphanStatus: boolean;
20 | prevHash: string;
21 | reward: bigint;
22 | powHash: string;
23 | constructor(header?: Partial);
24 | copy(): MoneroBlockHeader;
25 | toJson(): any;
26 | getHash(): string;
27 | setHash(hash: string): this;
28 | /**
29 | * Return the block's height which is the total number of blocks that have occurred before.
30 | *
31 | * @return {number} the block's height
32 | */
33 | getHeight(): number;
34 | /**
35 | * Set the block's height which is the total number of blocks that have occurred before.
36 | *
37 | * @param {number} height is the block's height to set
38 | * @return {MoneroBlockHeader} a reference to this header for chaining
39 | */
40 | setHeight(height: number): MoneroBlockHeader;
41 | getTimestamp(): number;
42 | setTimestamp(timestamp: any): MoneroBlockHeader;
43 | getSize(): number;
44 | setSize(size: number): MoneroBlockHeader;
45 | getWeight(): number;
46 | setWeight(weight: number): MoneroBlockHeader;
47 | getLongTermWeight(): number;
48 | setLongTermWeight(longTermWeight: number): MoneroBlockHeader;
49 | getDepth(): number;
50 | setDepth(depth: number): MoneroBlockHeader;
51 | getDifficulty(): bigint;
52 | setDifficulty(difficulty: bigint): MoneroBlockHeader;
53 | getCumulativeDifficulty(): bigint;
54 | setCumulativeDifficulty(cumulativeDifficulty: bigint): MoneroBlockHeader;
55 | getMajorVersion(): number;
56 | setMajorVersion(majorVersion: number): MoneroBlockHeader;
57 | getMinorVersion(): number;
58 | setMinorVersion(minorVersion: number): MoneroBlockHeader;
59 | getNonce(): number;
60 | setNonce(nonce: number): MoneroBlockHeader;
61 | getMinerTxHash(): string;
62 | setMinerTxHash(minerTxHash: string): MoneroBlockHeader;
63 | getNumTxs(): number;
64 | setNumTxs(numTxs: number): MoneroBlockHeader;
65 | getOrphanStatus(): boolean;
66 | setOrphanStatus(orphanStatus: boolean): MoneroBlockHeader;
67 | getPrevHash(): string;
68 | setPrevHash(prevHash: string): MoneroBlockHeader;
69 | getReward(): bigint;
70 | setReward(reward: bigint): MoneroBlockHeader;
71 | getPowHash(): string;
72 | setPowHash(powHash: string): MoneroBlockHeader;
73 | merge(header: MoneroBlockHeader): MoneroBlockHeader;
74 | toString(indent?: number): string;
75 | }
76 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroBlockTemplate.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Monero block template to mine.
3 | */
4 | export default class MoneroBlockTemplate {
5 | blockTemplateBlob: string;
6 | blockHashingBlob: string;
7 | difficulty: bigint;
8 | expectedReward: bigint;
9 | height: number;
10 | prevId: string;
11 | reservedOffset: number;
12 | seedHeight: number;
13 | seedHash: string;
14 | nextSeedHash: string;
15 | constructor(template?: Partial);
16 | toJson(): any;
17 | getBlockTemplateBlob(): string;
18 | setBlockTemplateBlob(blockTemplateBlob: string): MoneroBlockTemplate;
19 | getBlockHashingBlob(): string;
20 | setBlockHashingBlob(blockHashingBlob: string): MoneroBlockTemplate;
21 | getDifficulty(): bigint;
22 | setDifficulty(difficulty: bigint): MoneroBlockTemplate;
23 | getExpectedReward(): bigint;
24 | setExpectedReward(expectedReward: bigint): MoneroBlockTemplate;
25 | getHeight(): number;
26 | setHeight(height: number): MoneroBlockTemplate;
27 | getPrevHash(): string;
28 | setPrevHash(prevId: string): MoneroBlockTemplate;
29 | getReservedOffset(): number;
30 | setReservedOffset(reservedOffset: number): MoneroBlockTemplate;
31 | getSeedHeight(): number;
32 | setSeedHeight(seedHeight: number): MoneroBlockTemplate;
33 | getSeedHash(): string;
34 | setSeedHash(seedHash: string): MoneroBlockTemplate;
35 | getNextSeedHash(): string;
36 | setNextSeedHash(nextSeedHash: string): MoneroBlockTemplate;
37 | }
38 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroConnectionSpan.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Monero daemon connection span.
3 | */
4 | export default class MoneroConnectionSpan {
5 | connectionId: string;
6 | numBlocks: number;
7 | remoteAddress: string;
8 | rate: number;
9 | speed: number;
10 | size: number;
11 | startHeight: number;
12 | constructor(span?: any);
13 | toJson(): any;
14 | getConnectionId(): string;
15 | setConnectionId(connectionId: string): MoneroConnectionSpan;
16 | getNumBlocks(): number;
17 | setNumBlocks(numBlocks: number): MoneroConnectionSpan;
18 | getRemoteAddress(): string;
19 | setRemoteAddress(remoteAddress: string): MoneroConnectionSpan;
20 | getRate(): number;
21 | setRate(rate: number): MoneroConnectionSpan;
22 | getSpeed(): number;
23 | setSpeed(speed: number): MoneroConnectionSpan;
24 | getSize(): number;
25 | setSize(size: number): MoneroConnectionSpan;
26 | getStartHeight(): number;
27 | setStartHeight(startHeight: number): MoneroConnectionSpan;
28 | }
29 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroDaemonConfig.d.ts:
--------------------------------------------------------------------------------
1 | import MoneroRpcConnection from "../../common/MoneroRpcConnection";
2 | /**
3 | * Configuration to connect to monerod.
4 | */
5 | export default class MoneroDaemonConfig {
6 | /** Server config to monerod. */
7 | server: string | Partial;
8 | /** Proxy requests to monerod to a worker (default true). */
9 | proxyToWorker: boolean;
10 | /** Command to start monerod as a child process. */
11 | cmd: string[];
12 | /** Interval in milliseconds to poll the daemon for updates (default 20000). */
13 | pollInterval: number;
14 | /**
15 | * Construct a configuration to open or create a wallet.
16 | *
17 | * @param {Partial} [config] - MoneroDaemonConfig to construct from (optional)
18 | * @param {string|Partial} [config.server] - uri or MoneroRpcConnection to the daemon (optional)
19 | * @param {boolean} [config.proxyToWorker] - proxy daemon requests to a worker (default true)
20 | * @param {string[]} [config.cmd] - command to start monerod (optional)
21 | * @param {number} [config.pollInterval] - interval in milliseconds to poll the daemon for updates (default 20000)
22 | */
23 | constructor(config?: Partial);
24 | copy(): MoneroDaemonConfig;
25 | toJson(): any;
26 | getServer(): MoneroRpcConnection;
27 | setServer(server: Partial | string): MoneroDaemonConfig;
28 | getProxyToWorker(): boolean;
29 | setProxyToWorker(proxyToWorker: boolean): MoneroDaemonConfig;
30 | getCmd(): string[];
31 | setCmd(cmd: string[]): MoneroDaemonConfig;
32 | getPollInterval(): number;
33 | setPollInterval(pollInterval: number): MoneroDaemonConfig;
34 | }
35 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroDaemonListener.d.ts:
--------------------------------------------------------------------------------
1 | import MoneroBlockHeader from "./MoneroBlockHeader";
2 | /**
3 | * Receives notifications as a daemon is updated.
4 | */
5 | export default class MoneroDaemonListener {
6 | protected lastHeader: MoneroBlockHeader;
7 | /**
8 | * Called when a new block is added to the chain.
9 | *
10 | * @param {MoneroBlockHeader} header - the header of the block added to the chain
11 | */
12 | onBlockHeader(header: MoneroBlockHeader): Promise;
13 | /**
14 | * Get the last notified block header.
15 | *
16 | * @return {MoneroBlockHeader} the last notified block header
17 | */
18 | getLastBlockHeader(): MoneroBlockHeader;
19 | }
20 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroDaemonListener.js:
--------------------------------------------------------------------------------
1 | "use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;
2 |
3 | /**
4 | * Receives notifications as a daemon is updated.
5 | */
6 | class MoneroDaemonListener {
7 |
8 |
9 |
10 | /**
11 | * Called when a new block is added to the chain.
12 | *
13 | * @param {MoneroBlockHeader} header - the header of the block added to the chain
14 | */
15 | async onBlockHeader(header) {
16 | this.lastHeader = header;
17 | }
18 |
19 | /**
20 | * Get the last notified block header.
21 | *
22 | * @return {MoneroBlockHeader} the last notified block header
23 | */
24 | getLastBlockHeader() {
25 | return this.lastHeader;
26 | }
27 | }exports.default = MoneroDaemonListener;
28 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJNb25lcm9EYWVtb25MaXN0ZW5lciIsIm9uQmxvY2tIZWFkZXIiLCJoZWFkZXIiLCJsYXN0SGVhZGVyIiwiZ2V0TGFzdEJsb2NrSGVhZGVyIiwiZXhwb3J0cyIsImRlZmF1bHQiXSwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWFpbi90cy9kYWVtb24vbW9kZWwvTW9uZXJvRGFlbW9uTGlzdGVuZXIudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IE1vbmVyb0Jsb2NrSGVhZGVyIGZyb20gXCIuL01vbmVyb0Jsb2NrSGVhZGVyXCI7XG5cbi8qKlxuICogUmVjZWl2ZXMgbm90aWZpY2F0aW9ucyBhcyBhIGRhZW1vbiBpcyB1cGRhdGVkLlxuICovXG5leHBvcnQgZGVmYXVsdCBjbGFzcyBNb25lcm9EYWVtb25MaXN0ZW5lciB7XG5cbiAgcHJvdGVjdGVkIGxhc3RIZWFkZXI6IE1vbmVyb0Jsb2NrSGVhZGVyO1xuICBcbiAgLyoqXG4gICAqIENhbGxlZCB3aGVuIGEgbmV3IGJsb2NrIGlzIGFkZGVkIHRvIHRoZSBjaGFpbi5cbiAgICogXG4gICAqIEBwYXJhbSB7TW9uZXJvQmxvY2tIZWFkZXJ9IGhlYWRlciAtIHRoZSBoZWFkZXIgb2YgdGhlIGJsb2NrIGFkZGVkIHRvIHRoZSBjaGFpblxuICAgKi9cbiAgYXN5bmMgb25CbG9ja0hlYWRlcihoZWFkZXI6IE1vbmVyb0Jsb2NrSGVhZGVyKSB7XG4gICAgdGhpcy5sYXN0SGVhZGVyID0gaGVhZGVyO1xuICB9XG4gIFxuICAvKipcbiAgICogR2V0IHRoZSBsYXN0IG5vdGlmaWVkIGJsb2NrIGhlYWRlci5cbiAgICogXG4gICAqIEByZXR1cm4ge01vbmVyb0Jsb2NrSGVhZGVyfSB0aGUgbGFzdCBub3RpZmllZCBibG9jayBoZWFkZXJcbiAgICovXG4gIGdldExhc3RCbG9ja0hlYWRlcigpOiBNb25lcm9CbG9ja0hlYWRlciB7XG4gICAgcmV0dXJuIHRoaXMubGFzdEhlYWRlcjtcbiAgfVxufVxuIl0sIm1hcHBpbmdzIjoiOztBQUVBO0FBQ0E7QUFDQTtBQUNlLE1BQU1BLG9CQUFvQixDQUFDOzs7O0VBSXhDO0FBQ0Y7QUFDQTtBQUNBO0FBQ0E7RUFDRSxNQUFNQyxhQUFhQSxDQUFDQyxNQUF5QixFQUFFO0lBQzdDLElBQUksQ0FBQ0MsVUFBVSxHQUFHRCxNQUFNO0VBQzFCOztFQUVBO0FBQ0Y7QUFDQTtBQUNBO0FBQ0E7RUFDRUUsa0JBQWtCQSxDQUFBLEVBQXNCO0lBQ3RDLE9BQU8sSUFBSSxDQUFDRCxVQUFVO0VBQ3hCO0FBQ0YsQ0FBQ0UsT0FBQSxDQUFBQyxPQUFBLEdBQUFOLG9CQUFBIn0=
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroDaemonSyncInfo.d.ts:
--------------------------------------------------------------------------------
1 | import MoneroConnectionSpan from "./MoneroConnectionSpan";
2 | import MoneroPeer from "./MoneroPeer";
3 | /**
4 | * Models daemon synchronization information.
5 | */
6 | export default class MoneroDaemonSyncInfo {
7 | height: number;
8 | peers: MoneroPeer[];
9 | spans: MoneroConnectionSpan[];
10 | targetHeight: number;
11 | nextNeededPruningSeed: number;
12 | overview: string;
13 | credits: bigint;
14 | topBlockHash: string;
15 | constructor(info?: Partial);
16 | toJson(): any;
17 | getHeight(): number;
18 | setHeight(height: number): MoneroDaemonSyncInfo;
19 | getPeers(): MoneroPeer[];
20 | setPeers(peers: MoneroPeer[]): MoneroDaemonSyncInfo;
21 | getSpans(): MoneroConnectionSpan[];
22 | setSpans(spans: MoneroConnectionSpan[]): MoneroDaemonSyncInfo;
23 | getTargetHeight(): number;
24 | setTargetHeight(targetHeight: number): MoneroDaemonSyncInfo;
25 | getNextNeededPruningSeed(): number;
26 | setNextNeededPruningSeed(nextNeededPruningSeed: number): MoneroDaemonSyncInfo;
27 | getOverview(): string;
28 | setOverview(overview: string): MoneroDaemonSyncInfo;
29 | getCredits(): bigint;
30 | setCredits(credits: bigint): MoneroDaemonSyncInfo;
31 | getTopBlockHash(): string;
32 | setTopBlockHash(topBlockHash: string): MoneroDaemonSyncInfo;
33 | }
34 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroDaemonUpdateCheckResult.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models the result of checking for a daemon update.
3 | */
4 | export default class MoneroDaemonUpdateCheckResult {
5 | isUpdateAvailable: boolean;
6 | version: string;
7 | hash: string;
8 | autoUri: string;
9 | userUri: string;
10 | constructor(result?: MoneroDaemonUpdateCheckResult);
11 | /**
12 | * Indicates if an update is available.
13 | *
14 | * @return {boolean} true if an update is available, false otherwise
15 | */
16 | getIsUpdateAvailable(): boolean;
17 | setIsUpdateAvailable(isUpdateAvailable: boolean): MoneroDaemonUpdateCheckResult;
18 | /**
19 | * Get the update's version.
20 | *
21 | * @return {string} is the update's version
22 | */
23 | getVersion(): string;
24 | setVersion(version: string): MoneroDaemonUpdateCheckResult;
25 | /**
26 | * Get the update's hash.
27 | *
28 | * @return {string} is the update's hash
29 | */
30 | getHash(): string;
31 | setHash(hash: string): MoneroDaemonUpdateCheckResult;
32 | /**
33 | * Get the uri to automatically download the update.
34 | *
35 | * @return {string} is the uri to automatically download the update
36 | */
37 | getAutoUri(): string;
38 | setAutoUri(autoUri: string): MoneroDaemonUpdateCheckResult;
39 | /**
40 | * Get the uri to manually download the update.
41 | *
42 | * @return {string} is the uri to manually download the update
43 | */
44 | getUserUri(): string;
45 | setUserUri(userUri: string): MoneroDaemonUpdateCheckResult;
46 | }
47 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroDaemonUpdateDownloadResult.d.ts:
--------------------------------------------------------------------------------
1 | import MoneroDaemonUpdateCheckResult from "./MoneroDaemonUpdateCheckResult";
2 | /**
3 | * Models the result of downloading an update.
4 | */
5 | export default class MoneroDaemonUpdateDownloadResult extends MoneroDaemonUpdateCheckResult {
6 | downloadPath: string;
7 | constructor(state: MoneroDaemonUpdateDownloadResult);
8 | /**
9 | * Get the path the update was downloaded to.
10 | *
11 | * @return {string} is the path the update was downloaded to
12 | */
13 | getDownloadPath(): string;
14 | setDownloadPath(downloadPath: string): MoneroDaemonUpdateDownloadResult;
15 | }
16 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroDaemonUpdateDownloadResult.js:
--------------------------------------------------------------------------------
1 | "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _MoneroDaemonUpdateCheckResult = _interopRequireDefault(require("./MoneroDaemonUpdateCheckResult"));
2 |
3 | /**
4 | * Models the result of downloading an update.
5 | */
6 | class MoneroDaemonUpdateDownloadResult extends _MoneroDaemonUpdateCheckResult.default {
7 |
8 |
9 |
10 | constructor(state) {
11 | super(state);
12 | }
13 |
14 | /**
15 | * Get the path the update was downloaded to.
16 | *
17 | * @return {string} is the path the update was downloaded to
18 | */
19 | getDownloadPath() {
20 | return this.downloadPath;
21 | }
22 |
23 | setDownloadPath(downloadPath) {
24 | this.downloadPath = downloadPath;
25 | return this;
26 | }
27 | }exports.default = MoneroDaemonUpdateDownloadResult;
28 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfTW9uZXJvRGFlbW9uVXBkYXRlQ2hlY2tSZXN1bHQiLCJfaW50ZXJvcFJlcXVpcmVEZWZhdWx0IiwicmVxdWlyZSIsIk1vbmVyb0RhZW1vblVwZGF0ZURvd25sb2FkUmVzdWx0IiwiTW9uZXJvRGFlbW9uVXBkYXRlQ2hlY2tSZXN1bHQiLCJjb25zdHJ1Y3RvciIsInN0YXRlIiwiZ2V0RG93bmxvYWRQYXRoIiwiZG93bmxvYWRQYXRoIiwic2V0RG93bmxvYWRQYXRoIiwiZXhwb3J0cyIsImRlZmF1bHQiXSwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWFpbi90cy9kYWVtb24vbW9kZWwvTW9uZXJvRGFlbW9uVXBkYXRlRG93bmxvYWRSZXN1bHQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IE1vbmVyb0RhZW1vblVwZGF0ZUNoZWNrUmVzdWx0IGZyb20gXCIuL01vbmVyb0RhZW1vblVwZGF0ZUNoZWNrUmVzdWx0XCI7XG5cbi8qKlxuICogTW9kZWxzIHRoZSByZXN1bHQgb2YgZG93bmxvYWRpbmcgYW4gdXBkYXRlLlxuICovXG5leHBvcnQgZGVmYXVsdCBjbGFzcyBNb25lcm9EYWVtb25VcGRhdGVEb3dubG9hZFJlc3VsdCBleHRlbmRzIE1vbmVyb0RhZW1vblVwZGF0ZUNoZWNrUmVzdWx0IHtcblxuICBkb3dubG9hZFBhdGg6IHN0cm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xDQUFBQyxPQUFBLEdBQUFSLGdDQUFBIn0=
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroFeeEstimate.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models a Monero fee estimate.
3 | */
4 | export default class MoneroFeeEstimate {
5 | fee: bigint;
6 | fees: bigint[];
7 | quantizationMask: bigint;
8 | constructor(feeEstimate?: Partial);
9 | getFee(): bigint;
10 | setFee(fee: bigint): MoneroFeeEstimate;
11 | getFees(): bigint[];
12 | setFees(fees: any): this;
13 | getQuantizationMask(): bigint;
14 | setQuantizationMask(quantizationMask: any): MoneroFeeEstimate;
15 | copy(): MoneroFeeEstimate;
16 | toJson(): any;
17 | toString(indent?: number): string;
18 | }
19 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroHardForkInfo.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Monero hard fork info.
3 | */
4 | export default class MoneroHardForkInfo {
5 | earliestHeight: number;
6 | isEnabled: boolean;
7 | state: string;
8 | threshold: number;
9 | version: number;
10 | numVotes: number;
11 | window: number;
12 | voting: number;
13 | credits: bigint;
14 | topBlockHash: string;
15 | constructor(info?: Partial);
16 | toJson(): any;
17 | getEarliestHeight(): number;
18 | setEarliestHeight(earliestHeight: number): MoneroHardForkInfo;
19 | getIsEnabled(): boolean;
20 | setIsEnabled(isEnabled: boolean): MoneroHardForkInfo;
21 | getState(): string;
22 | setState(state: string): MoneroHardForkInfo;
23 | getThreshold(): number;
24 | setThreshold(threshold: number): MoneroHardForkInfo;
25 | getVersion(): number;
26 | setVersion(version: number): MoneroHardForkInfo;
27 | getNumVotes(): number;
28 | setNumVotes(numVotes: number): MoneroHardForkInfo;
29 | getWindow(): number;
30 | setWindow(window: number): MoneroHardForkInfo;
31 | getVoting(): number;
32 | setVoting(voting: number): MoneroHardForkInfo;
33 | getCredits(): bigint;
34 | setCredits(credits: bigint): MoneroHardForkInfo;
35 | getTopBlockHash(): string;
36 | setTopBlockHash(topBlockHash: string): MoneroHardForkInfo;
37 | }
38 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroKeyImage.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models a Monero key image.
3 | */
4 | export default class MoneroKeyImage {
5 | hex: string;
6 | signature: string;
7 | /**
8 | * Construct the model.
9 | *
10 | * @param {string|Partial} [keyImageOrHex] is a MoneroKeyImage or hex string to initialize from (optional)
11 | * @param {string} [signature] is the key image's signature
12 | */
13 | constructor(hexOrKeyImage?: string | Partial, signature?: string);
14 | getHex(): string;
15 | setHex(hex: string): MoneroKeyImage;
16 | getSignature(): string;
17 | setSignature(signature: string): MoneroKeyImage;
18 | copy(): MoneroKeyImage;
19 | toJson(): {} & this;
20 | merge(keyImage: MoneroKeyImage): MoneroKeyImage;
21 | toString(indent?: number): string;
22 | }
23 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroKeyImageSpentStatus.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Enumerates connection types.
3 | *
4 | * Based on enums.h in monero-project.
5 | */
6 | declare enum MoneroKeyImageSpentStatus {
7 | /**
8 | * Key image is not spent (value=0).
9 | */
10 | NOT_SPENT = 0,
11 | /**
12 | * Key image is confirmed (value=1).
13 | */
14 | CONFIRMED = 1,
15 | /**
16 | * Key image is in the pool (value=2).
17 | */
18 | TX_POOL = 2
19 | }
20 | export default MoneroKeyImageSpentStatus;
21 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroKeyImageSpentStatus.js:
--------------------------------------------------------------------------------
1 | "use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
2 | * Enumerates connection types.
3 | *
4 | * Based on enums.h in monero-project.
5 | */var
6 | MoneroKeyImageSpentStatus = /*#__PURE__*/function (MoneroKeyImageSpentStatus) {MoneroKeyImageSpentStatus[MoneroKeyImageSpentStatus["NOT_SPENT"] = 0] = "NOT_SPENT";MoneroKeyImageSpentStatus[MoneroKeyImageSpentStatus["CONFIRMED"] = 1] = "CONFIRMED";MoneroKeyImageSpentStatus[MoneroKeyImageSpentStatus["TX_POOL"] = 2] = "TX_POOL";return MoneroKeyImageSpentStatus;}(MoneroKeyImageSpentStatus || {});var _default = exports.default =
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | MoneroKeyImageSpentStatus;
25 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJNb25lcm9LZXlJbWFnZVNwZW50U3RhdHVzIiwiX2RlZmF1bHQiLCJleHBvcnRzIiwiZGVmYXVsdCJdLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYWluL3RzL2RhZW1vbi9tb2RlbC9Nb25lcm9LZXlJbWFnZVNwZW50U3RhdHVzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRW51bWVyYXRlcyBjb25uZWN0aW9uIHR5cGVzLlxuICogXG4gKiBCYXNlZCBvbiBlbnVtcy5oIGluIG1vbmVyby1wcm9qZWN0LlxuICovXG5lbnVtIE1vbmVyb0tleUltYWdlU3BlbnRTdGF0dXMge1xuXG4gICAgLyoqXG4gICAgICogS2V5IGltYWdlIGlzIG5vdCBzcGVudCAodmFsdWU9MCkuXG4gICAgICovXG4gICAgTk9UX1NQRU5UID0gMCxcblxuICAgIC8qKlxuICAgICAqIEtleSBpbWFnZSBpcyBjb25maXJtZWQgKHZhbHVlPTEpLlxuICAgICAqL1xuICAgIENPTkZJUk1FRCA9IDEsXG5cbiAgICAvKipcbiAgICAgKiBLZXkgaW1hZ2UgaXMgaW4gdGhlIHBvb2wgKHZhbHVlPTIpLlxuICAgICAqL1xuICAgIFRYX1BPT0wgPSAyXG4gIH1cbiAgXG4gIGV4cG9ydCBkZWZhdWx0IE1vbmVyb0tleUltYWdlU3BlbnRTdGF0dXM7Il0sIm1hcHBpbmdzIjoicUdBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQSxHQUpBO0FBS0tBLHlCQUF5QiwwQkFBekJBLHlCQUF5QixHQUF6QkEseUJBQXlCLENBQXpCQSx5QkFBeUIsaUNBQXpCQSx5QkFBeUIsQ0FBekJBLHlCQUF5QixpQ0FBekJBLHlCQUF5QixDQUF6QkEseUJBQXlCLG9DQUF6QkEseUJBQXlCLEdBQXpCQSx5QkFBeUIsWUFBQUMsUUFBQSxHQUFBQyxPQUFBLENBQUFDLE9BQUE7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQWtCYkgseUJBQXlCIn0=
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroMinerTxSum.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Model for the summation of miner emissions and fees.
3 | */
4 | export default class MoneroMinerTxSum {
5 | emissionSum: bigint;
6 | feeSum: bigint;
7 | constructor(txSum?: Partial);
8 | toJson(): any;
9 | getEmissionSum(): bigint;
10 | setEmissionSum(emissionSum: bigint): MoneroMinerTxSum;
11 | getFeeSum(): bigint;
12 | setFeeSum(feeSum: bigint): MoneroMinerTxSum;
13 | }
14 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroMiningStatus.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models daemon mining status.
3 | */
4 | export default class MoneroMiningStatus {
5 | isActive: boolean;
6 | address: string;
7 | speed: number;
8 | numThreads: number;
9 | isBackground: boolean;
10 | constructor(status?: Partial);
11 | toJson(): {} & this;
12 | getIsActive(): boolean;
13 | setIsActive(isActive: boolean): MoneroMiningStatus;
14 | getAddress(): string;
15 | setAddress(address: string): MoneroMiningStatus;
16 | getSpeed(): number;
17 | setSpeed(speed: number): MoneroMiningStatus;
18 | getNumThreads(): number;
19 | setNumThreads(numThreads: number): MoneroMiningStatus;
20 | getIsBackground(): boolean;
21 | setIsBackground(isBackground: boolean): MoneroMiningStatus;
22 | }
23 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroNetworkType.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Defines the Monero network types (mainnet, testnet, and stagenet).
3 | */
4 | export default class MoneroNetworkType {
5 | /**
6 | * Mainnet (value=0).
7 | */
8 | static readonly MAINNET = 0;
9 | /**
10 | * Testnet (value=1).
11 | */
12 | static readonly TESTNET = 1;
13 | /**
14 | * Stagnet (value=2).
15 | */
16 | static readonly STAGENET = 2;
17 | /**
18 | * Validate and normalize the given network type.
19 | *
20 | * @param {MoneroNetworkType | number | string} networkType - the network type to validate and normalize
21 | * @return {MoneroNetworkType} the given network type
22 | */
23 | static from(networkType: MoneroNetworkType | number | string): MoneroNetworkType;
24 | /**
25 | * Validate the given network type.
26 | *
27 | * @param {MoneroNetworkType} networkType - the network type to validate as a numeric
28 | */
29 | static validate(networkType: MoneroNetworkType | number | string): void;
30 | /**
31 | * Indicates if the given network type is valid or not.
32 | *
33 | * @param {MoneroNetworkType | number} networkType - the network type to validate as a numeric
34 | * @return {boolean} true if the network type is valid, false otherwise
35 | */
36 | static isValid(networkType: MoneroNetworkType | number | string): boolean;
37 | /**
38 | * Parse the given string as a network type.
39 | *
40 | * @param {string} networkTypeStr - "mainnet", "testnet", or "stagenet" (case insensitive)
41 | * @return {MoneroNetworkType} the network type as a numeric
42 | */
43 | static parse(networkTypeStr: string): MoneroNetworkType;
44 | /**
45 | * Get the network type in human-readable form.
46 | *
47 | * @return {string} the network type in human-readable form
48 | */
49 | static toString(networkType: MoneroNetworkType | number): string;
50 | }
51 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroOutput.d.ts:
--------------------------------------------------------------------------------
1 | import MoneroKeyImage from "./MoneroKeyImage";
2 | import MoneroTx from "./MoneroTx";
3 | /**
4 | * Models a Monero transaction output.
5 | */
6 | export default class MoneroOutput {
7 | tx: MoneroTx;
8 | keyImage: Partial;
9 | amount: bigint;
10 | index: number;
11 | ringOutputIndices: number[];
12 | stealthPublicKey: string;
13 | /**
14 | * Construct the model.
15 | *
16 | * @param {MoneroOutput} [output] is existing state to initialize from (optional)
17 | */
18 | constructor(output?: Partial);
19 | getTx(): MoneroTx;
20 | setTx(tx: MoneroTx): MoneroOutput;
21 | getKeyImage(): MoneroKeyImage;
22 | setKeyImage(keyImage: MoneroKeyImage): MoneroOutput;
23 | getAmount(): bigint;
24 | setAmount(amount: bigint): MoneroOutput;
25 | getIndex(): number;
26 | setIndex(index: number): MoneroOutput;
27 | getRingOutputIndices(): number[];
28 | setRingOutputIndices(ringOutputIndices: number[]): MoneroOutput;
29 | getStealthPublicKey(): string;
30 | setStealthPublicKey(stealthPublicKey: string): MoneroOutput;
31 | copy(): MoneroOutput;
32 | toJson(): any;
33 | merge(output: MoneroOutput): MoneroOutput;
34 | toString(indent?: number): string;
35 | }
36 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroOutputHistogramEntry.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Entry in a Monero output histogram (see get_output_histogram of Daemon RPC documentation).
3 | */
4 | export default class MoneroOutputHistogramEntry {
5 | amount: bigint;
6 | numInstances: number;
7 | numUnlockedInstances: number;
8 | numRecentInstances: number;
9 | constructor(entry?: MoneroOutputHistogramEntry);
10 | toJson(): any;
11 | getAmount(): bigint;
12 | setAmount(amount: bigint): MoneroOutputHistogramEntry;
13 | getNumInstances(): number;
14 | setNumInstances(numInstances: number): MoneroOutputHistogramEntry;
15 | getNumUnlockedInstances(): number;
16 | setNumUnlockedInstances(numUnlockedInstances: number): this;
17 | getNumRecentInstances(): number;
18 | setNumRecentInstances(numRecentInstances: number): MoneroOutputHistogramEntry;
19 | }
20 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroPruneResult.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Result of pruning the blockchain.
3 | */
4 | export default class MoneroPruneResult {
5 | isPruned: boolean;
6 | pruningSeed: number;
7 | constructor(result?: Partial);
8 | toJson(): any;
9 | getIsPruned(): boolean;
10 | setIsPruned(isPruned: boolean): MoneroPruneResult;
11 | getPruningSeed(): number;
12 | setPruningSeed(pruningSeed: number): MoneroPruneResult;
13 | }
14 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroSubmitTxResult.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models the result from submitting a tx to a daemon.
3 | */
4 | export default class MoneroSubmitTxResult {
5 | isGood: boolean;
6 | isRelayed: boolean;
7 | isDoubleSpendSeen: boolean;
8 | isFeeTooLow: boolean;
9 | isMixinTooLow: boolean;
10 | hasInvalidInput: boolean;
11 | hasInvalidOutput: boolean;
12 | hasTooFewOutputs: boolean;
13 | isOverspend: boolean;
14 | reason: string;
15 | isTooBig: boolean;
16 | sanityCheckFailed: boolean;
17 | credits: bigint;
18 | topBlockHash: string;
19 | isTxExtraTooBig: boolean;
20 | isNonzeroUnlockTime: boolean;
21 | constructor(result?: Partial);
22 | toJson(): any;
23 | getIsGood(): boolean;
24 | setIsGood(isGood: boolean): MoneroSubmitTxResult;
25 | getIsRelayed(): boolean;
26 | setIsRelayed(isRelayed: boolean): this;
27 | getIsDoubleSpendSeen(): boolean;
28 | setIsDoubleSpendSeen(isDoubleSpendSeen: boolean): MoneroSubmitTxResult;
29 | getIsFeeTooLow(): boolean;
30 | setIsFeeTooLow(isFeeTooLow: boolean): MoneroSubmitTxResult;
31 | getIsMixinTooLow(): boolean;
32 | setIsMixinTooLow(isMixinTooLow: boolean): MoneroSubmitTxResult;
33 | getHasInvalidInput(): boolean;
34 | setHasInvalidInput(hasInvalidInput: boolean): MoneroSubmitTxResult;
35 | getHasInvalidOutput(): boolean;
36 | setHasInvalidOutput(hasInvalidOutput: boolean): MoneroSubmitTxResult;
37 | getHasTooFewOutputs(): boolean;
38 | setHasTooFewOutputs(hasTooFewOutputs: boolean): MoneroSubmitTxResult;
39 | getIsOverspend(): boolean;
40 | setIsOverspend(isOverspend: boolean): MoneroSubmitTxResult;
41 | getReason(): string;
42 | setReason(reason: any): MoneroSubmitTxResult;
43 | getIsTooBig(): boolean;
44 | setIsTooBig(isTooBig: boolean): this;
45 | getSanityCheckFailed(): boolean;
46 | setSanityCheckFailed(sanityCheckFailed: any): MoneroSubmitTxResult;
47 | getCredits(): bigint;
48 | setCredits(credits: any): MoneroSubmitTxResult;
49 | getTopBlockHash(): string;
50 | setTopBlockHash(topBlockHash: string): MoneroSubmitTxResult;
51 | getIsTxExtraTooBig(): boolean;
52 | setIsTxExtraTooBig(isTxExtraTooBig: boolean): MoneroSubmitTxResult;
53 | getIsNonzeroUnlockTime(): boolean;
54 | setIsNonzeroUnlockTime(isNonzeroUnlockTime: boolean): MoneroSubmitTxResult;
55 | }
56 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroTxPoolStats.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models transaction pool statistics.
3 | */
4 | export default class MoneroTxPoolStats {
5 | numTxs: number;
6 | numNotRelayed: number;
7 | numFailing: number;
8 | numDoubleSpends: number;
9 | num10m: number;
10 | feeTotal: bigint;
11 | bytesMax: number;
12 | bytesMed: number;
13 | bytesMin: number;
14 | bytesTotal: number;
15 | histo: Map;
16 | histo98pc: number;
17 | oldestTimestamp: number;
18 | constructor(stats?: Partial);
19 | toJson(): any;
20 | getNumTxs(): number;
21 | setNumTxs(numTxs: number): MoneroTxPoolStats;
22 | getNumNotRelayed(): number;
23 | setNumNotRelayed(numNotRelayed: number): MoneroTxPoolStats;
24 | getNumFailing(): number;
25 | setNumFailing(numFailing: number): MoneroTxPoolStats;
26 | getNumDoubleSpends(): number;
27 | setNumDoubleSpends(numDoubleSpends: number): MoneroTxPoolStats;
28 | getNum10m(): number;
29 | setNum10m(num10m: any): MoneroTxPoolStats;
30 | getFeeTotal(): bigint;
31 | setFeeTotal(feeTotal: bigint): MoneroTxPoolStats;
32 | getBytesMax(): number;
33 | setBytesMax(bytesMax: number): MoneroTxPoolStats;
34 | getBytesMed(): number;
35 | setBytesMed(bytesMed: number): MoneroTxPoolStats;
36 | getBytesMin(): number;
37 | setBytesMin(bytesMin: number): MoneroTxPoolStats;
38 | getBytesTotal(): number;
39 | setBytesTotal(bytesTotal: number): MoneroTxPoolStats;
40 | getHisto(): Map;
41 | setHisto(histo: Map): MoneroTxPoolStats;
42 | getHisto98pc(): number;
43 | setHisto98pc(histo98pc: number): MoneroTxPoolStats;
44 | getOldestTimestamp(): number;
45 | setOldestTimestamp(oldestTimestamp: number): MoneroTxPoolStats;
46 | }
47 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroVersion.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models a Monero version.
3 | */
4 | export default class MoneroVersion {
5 | number: number;
6 | isRelease: boolean;
7 | constructor(number: number, isRelease: boolean);
8 | getNumber(): number;
9 | setNumber(number: number): MoneroVersion;
10 | getIsRelease(): boolean;
11 | setIsRelease(isRelease: boolean): MoneroVersion;
12 | copy(): MoneroVersion;
13 | toJson(): any;
14 | }
15 |
--------------------------------------------------------------------------------
/dist/src/main/ts/daemon/model/MoneroVersion.js:
--------------------------------------------------------------------------------
1 | "use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
2 | * Models a Monero version.
3 | */
4 | class MoneroVersion {
5 |
6 |
7 |
8 |
9 | constructor(number, isRelease) {
10 | this.number = number;
11 | this.isRelease = isRelease;
12 | }
13 |
14 | getNumber() {
15 | return this.number;
16 | }
17 |
18 | setNumber(number) {
19 | this.number = number;
20 | return this;
21 | }
22 |
23 | getIsRelease() {
24 | return this.isRelease;
25 | }
26 |
27 | setIsRelease(isRelease) {
28 | this.isRelease = isRelease;
29 | return this;
30 | }
31 |
32 | copy() {
33 | return new MoneroVersion(this.number, this.isRelease);
34 | }
35 |
36 | toJson() {
37 | return Object.assign({}, this);
38 | }
39 | }exports.default = MoneroVersion;
40 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJNb25lcm9WZXJzaW9uIiw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M7RUFDaEM7QUFDRixDQUFDQyxPQUFBLENBQUFDLE9BQUEsR0FBQWIsYUFBQSJ9
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroAccount.d.ts:
--------------------------------------------------------------------------------
1 | import MoneroSubaddress from "./MoneroSubaddress";
2 | /**
3 | * Monero account model.
4 | */
5 | export default class MoneroAccount {
6 | index: number;
7 | primaryAddress: string;
8 | balance: bigint;
9 | unlockedBalance: bigint;
10 | label: string;
11 | tag: string;
12 | subaddresses: MoneroSubaddress[];
13 | constructor(account?: Partial);
14 | toJson(): any;
15 | getIndex(): number;
16 | setIndex(index: number): MoneroAccount;
17 | getPrimaryAddress(): string;
18 | setPrimaryAddress(primaryAddress: string): MoneroAccount;
19 | getBalance(): bigint;
20 | setBalance(balance: bigint): MoneroAccount;
21 | getUnlockedBalance(): bigint;
22 | setUnlockedBalance(unlockedBalance: bigint): MoneroAccount;
23 | getLabel(): string;
24 | setLabel(label: string): MoneroAccount;
25 | getTag(): string;
26 | setTag(tag: string): MoneroAccount;
27 | getSubaddresses(): MoneroSubaddress[];
28 | setSubaddresses(subaddresses: MoneroSubaddress[]): MoneroAccount;
29 | toString(indent?: number): string;
30 | }
31 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroAccountTag.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Represents an account tag.
3 | */
4 | export default class MoneroAccountTag {
5 | tag: string;
6 | label: string;
7 | accountIndices: number[];
8 | constructor(accountTag?: Partial);
9 | getTag(): string;
10 | setTag(tag: string): MoneroAccountTag;
11 | getLabel(): string;
12 | setLabel(label: string): MoneroAccountTag;
13 | getAccountIndices(): number[];
14 | setAccountIndices(accountIndices: number[]): MoneroAccountTag;
15 | }
16 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroAccountTag.js:
--------------------------------------------------------------------------------
1 | "use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
2 | * Represents an account tag.
3 | */
4 | class MoneroAccountTag {
5 |
6 |
7 |
8 |
9 |
10 | constructor(accountTag) {
11 | Object.assign(this, accountTag);
12 | }
13 |
14 | getTag() {
15 | return this.tag;
16 | }
17 |
18 | setTag(tag) {
19 | this.tag = tag;
20 | return this;
21 | }
22 |
23 | getLabel() {
24 | return this.label;
25 | }
26 |
27 | setLabel(label) {
28 | this.label = label;
29 | return this;
30 | }
31 |
32 | getAccountIndices() {
33 | return this.accountIndices;
34 | }
35 |
36 | setAccountIndices(accountIndices) {
37 | this.accountIndices = accountIndices;
38 | return this;
39 | }
40 | }exports.default = MoneroAccountTag;
41 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJNb25lcm9BY2NvdW50VGFnIiwiY29uc3RydWN0b3IiLCJhY2NvdW50VGFnIiwiT2JqZWN0IiwiYXNzaWduIiwiZ2V0VGFnIiwidGFnIiwic2V0VGFnIiwiZ2V0TGFiZWwiLCJsYWJlbCIsInNldExhYmVsIiwiZ2V0QWNjb3VudEluZGljZXMiLCJhY2NvdW50SW5kaWNlcyIsInNldEFjY291bnRJbmRpY2VzIiwiZXhwb3J0cyIsImRlZmF1bHQiXSwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWFpbi90cy93YWxsZXQvbW9kZWwvTW9uZXJvQWNjb3VudFRhZy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIFJlcHJlc2VudHMgYW4gYWNjb3VudCB0YWcuXG4gKi9cbmV4cG9ydCBkZWZhdWx0IGNsYXNzIE1vbmVyb0FjY291bnRUYWcge1xuXG4gIHRhZzogc3RyaW5nO1xuICBsYWJlbDogc3RyaW5nO1xuICBhY2NvdW50SW5kaWNlczogbnVtYmVyW107XG4gIFxuICBjb25zdHJ1Y3RvcihhY2NvdW50VGFnPzogUGFydGlhbDxNb25lcm9BY2NvdW50VGFnPikge1xuICAgIE9iamVjdC5hc3NpZ24odGhpcywgYWNjb3V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FDYjs7RUFFQUUsUUFBUUEsQ0FBQSxFQUFXO0lBQ2pCLE9BQU8sSUFBSSxDQUFDQyxLQUFLO0VBQ25COztFQUVBQyxRQUFRQSxDQUFDRCxLQUFhLEVBQW9CO0lBQ3hDLElBQUksQ0FBQ0EsS0FBSyxHQUFHQSxLQUFLO0lBQ2xCLE9BQU8sSUFBSTtFQUNiOztFQUVBRSxpQkFBaUJBLENBQUEsRUFBYTtJQUM1QixPQUFPLElBQUksQ0FBQ0MsY0FBYztFQUM1Qjs7RUFFQUMsaUJBQWlCQSxDQUFDRCxjQUF3QixFQUFvQjtJQUM1RCxJQUFJLENBQUNBLGNBQWMsR0FBR0EsY0FBYztJQUNwQyxPQUFPLElBQUk7RUFDYjtBQUNGLENBQUNFLE9BQUEsQ0FBQUMsT0FBQSxHQUFBZixnQkFBQSJ9
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroAddressBookEntry.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Monero address book entry model
3 | */
4 | export default class MoneroAddressBookEntry {
5 | index: number;
6 | address: string;
7 | description: string;
8 | paymentId: string;
9 | constructor(entry?: Partial);
10 | toJson(): any;
11 | getIndex(): number;
12 | setIndex(index: number): MoneroAddressBookEntry;
13 | getAddress(): string;
14 | setAddress(address: string): MoneroAddressBookEntry;
15 | getDescription(): string;
16 | setDescription(description: string): MoneroAddressBookEntry;
17 | getPaymentId(): string;
18 | setPaymentId(paymentId: string): MoneroAddressBookEntry;
19 | }
20 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroCheck.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Base class for results from checking a transaction or reserve proof.
3 | */
4 | export default class MoneroCheck {
5 | isGood?: boolean;
6 | constructor(check?: Partial);
7 | getIsGood(): boolean;
8 | setIsGood(isGood: boolean): MoneroCheck;
9 | }
10 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroCheck.js:
--------------------------------------------------------------------------------
1 | "use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
2 | * Base class for results from checking a transaction or reserve proof.
3 | */
4 | class MoneroCheck {
5 |
6 |
7 |
8 | constructor(check) {
9 | Object.assign(this, check);
10 | }
11 |
12 | getIsGood() {
13 | return this.isGood;
14 | }
15 |
16 | setIsGood(isGood) {
17 | this.isGood = isGood;
18 | return this;
19 | }
20 | }exports.default = MoneroCheck;
21 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJNb25lcm9DaGVjayIsImNvbnN0cnVjdG9yIiwiY2hlY2siLCJPYmplY3QiLCJhc3NpZ24iLCJnZXRJc0dvb2QiLCJpc0dvb2QiLCJzZXRJc0dvb2QiLCJleHBvcnRzIiwiZGVmYXVsdCJdLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYWluL3RzL3dhbGxldC9tb2RlbC9Nb25lcm9DaGVjay50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEJhc2UgY2xhc3MgZm9yIHJlc3VsdHMgZnJvbSBjaGVja2luZyBhIHRyYW5zYWN0aW9uIG9yIHJlc2VydmUgcHJvb2YuXG4gKi9cbmV4cG9ydCBkZWZhdWx0IGNsYXNzIE1vbmVyb0NoZWNrIHtcblxuICBpc0dvb2Q/OiBib29sZWFuO1xuICBcbiAgY29uc3RydWN0b3IoY2hlY2s/OiBQYXJ0aWFsPE1vbmVyb0NoZWNrPikge1xuICAgIE9iamVjdC5hc3NpZ24odGhpcywgY2hlY2spO1xuICB9XG5cbiAgZ2V0SXNHb29kKCk6IGJvb2xlYW4ge1xuICAgIHJldHVybiB0aGlzLmlzR29vZDtcbiAgfVxuXG4gIHNldElzR29vZChpc0dvb2Q6IGJvb2xlYW4pOiBNb25lcm9DaGVjayB7XG4gICAgdGhpcy5pc0dvb2QgPSBpc0dvb2Q7XG4gICAgcmV0dXJuIHRoaXM7XG4gIH1cbn1cbiJdLCJtYXBwaW5ncyI6InFHQUFBO0FBQ0E7QUFDQTtBQUNlLE1BQU1BLFdBQVcsQ0FBQzs7OztFQUkvQkMsV0FBV0EsQ0FBQ0MsS0FBNEIsRUFBRTtJQUN4Q0MsTUFBTSxDQUFDQyxNQUFNLENBQUMsSUFBSSxFQUFFRixLQUFLLENBQUM7RUFDNUI7O0VBRUFHLFNBQVNBLENBQUEsRUFBWTtJQUNuQixPQUFPLElBQUksQ0FBQ0MsTUFBTTtFQUNwQjs7RUFFQUMsU0FBU0EsQ0FBQ0QsTUFBZSxFQUFlO0lBQ3RDLElBQUksQ0FBQ0EsTUFBTSxHQUFHQSxNQUFNO0lBQ3BCLE9BQU8sSUFBSTtFQUNiO0FBQ0YsQ0FBQ0UsT0FBQSxDQUFBQyxPQUFBLEdBQUFULFdBQUEifQ==
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroCheckReserve.d.ts:
--------------------------------------------------------------------------------
1 | import MoneroCheck from "./MoneroCheck";
2 | /**
3 | * Results from checking a reserve proof.
4 | */
5 | export default class MoneroCheckReserve extends MoneroCheck {
6 | totalAmount: bigint;
7 | unconfirmedSpentAmount: bigint;
8 | constructor(check?: Partial);
9 | toJson(): any;
10 | getTotalAmount(): bigint;
11 | setTotalAmount(totalAmount: bigint): MoneroCheckReserve;
12 | getUnconfirmedSpentAmount(): bigint;
13 | setUnconfirmedSpentAmount(unconfirmedSpentAmount: bigint): MoneroCheckReserve;
14 | }
15 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroCheckTx.d.ts:
--------------------------------------------------------------------------------
1 | import MoneroCheck from "./MoneroCheck";
2 | /**
3 | * Results from checking a transaction key.
4 | */
5 | export default class MoneroCheckTx extends MoneroCheck {
6 | inTxPool: boolean;
7 | numConfirmations: number;
8 | receivedAmount: bigint;
9 | constructor(check?: Partial);
10 | toJson(): any;
11 | getInTxPool(): boolean;
12 | setInTxPool(inTxPool: boolean): MoneroCheckTx;
13 | getNumConfirmations(): number;
14 | setNumConfirmations(numConfirmations: number): MoneroCheckTx;
15 | getReceivedAmount(): bigint;
16 | setReceivedAmount(receivedAmount: bigint): MoneroCheckTx;
17 | }
18 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroDestination.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models an outgoing transfer destination.
3 | */
4 | export default class MoneroDestination {
5 | /** Destination address to send funds to. */
6 | address: string;
7 | /** Amount to send to destination address. */
8 | amount: bigint;
9 | /**
10 | * Construct a destination to send funds to.
11 | *
12 | * @param {Partial|string} destinationOrAddress is a MoneroDestination or hex string to initialize from (optional)
13 | * @param {bigint} [amount] - the destination amount
14 | */
15 | constructor(destinationOrAddress?: Partial | string, amount?: bigint);
16 | getAddress(): string;
17 | setAddress(address: string | undefined): MoneroDestination;
18 | getAmount(): bigint;
19 | setAmount(amount: bigint): MoneroDestination;
20 | copy(): MoneroDestination;
21 | toJson(): any;
22 | toString(indent?: number): string;
23 | }
24 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroIncomingTransfer.d.ts:
--------------------------------------------------------------------------------
1 | import MoneroTransfer from "./MoneroTransfer";
2 | import MoneroTxWallet from "./MoneroTxWallet";
3 | /**
4 | * Models an incoming transfer of funds to the wallet.
5 | */
6 | export default class MoneroIncomingTransfer extends MoneroTransfer {
7 | subaddressIndex: number;
8 | address: string;
9 | numSuggestedConfirmations: number;
10 | /**
11 | * Construct the transfer.
12 | *
13 | * @param {MoneroTransfer} [transfer] is existing state to initialize from (optional)
14 | */
15 | constructor(transfer?: Partial);
16 | getIsIncoming(): boolean;
17 | getSubaddressIndex(): number;
18 | setSubaddressIndex(subaddressIndex: number): MoneroIncomingTransfer;
19 | getAddress(): string;
20 | setAddress(address: string): MoneroIncomingTransfer;
21 | /**
22 | * Return how many confirmations till it's not economically worth re-writing the chain.
23 | * That is, the number of confirmations before the transaction is highly unlikely to be
24 | * double spent or overwritten and may be considered settled, e.g. for a merchant to trust
25 | * as finalized.
26 | *
27 | * @return {number} is the number of confirmations before it's not worth rewriting the chain
28 | */
29 | getNumSuggestedConfirmations(): number;
30 | setNumSuggestedConfirmations(numSuggestedConfirmations: number): MoneroIncomingTransfer;
31 | copy(): MoneroIncomingTransfer;
32 | /**
33 | * Updates this transaction by merging the latest information from the given
34 | * transaction.
35 | *
36 | * Merging can modify or build references to the transfer given so it
37 | * should not be re-used or it should be copied before calling this method.
38 | *
39 | * @param {MoneroIncomingTransfer} transfer is the transfer to merge into this one
40 | * @return {MoneroIncomingTransfer}
41 | */
42 | merge(transfer: MoneroIncomingTransfer): MoneroIncomingTransfer;
43 | toString(indent?: number): string;
44 | setTx(tx: MoneroTxWallet): MoneroIncomingTransfer;
45 | setAmount(amount: bigint): MoneroIncomingTransfer;
46 | setAccountIndex(accountIndex: number): MoneroIncomingTransfer;
47 | }
48 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroIntegratedAddress.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Monero integrated address model.
3 | */
4 | export default class MoneroIntegratedAddress {
5 | standardAddress: string;
6 | paymentId: string;
7 | integratedAddress: string;
8 | constructor(integratedAddress?: Partial);
9 | toJson(): any;
10 | getStandardAddress(): string;
11 | setStandardAddress(standardAddress: string): MoneroIntegratedAddress;
12 | getPaymentId(): string;
13 | setPaymentId(paymentId: string): MoneroIntegratedAddress;
14 | getIntegratedAddress(): string;
15 | setIntegratedAddress(integratedAddress: string): MoneroIntegratedAddress;
16 | toString(): string;
17 | }
18 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroKeyImageImportResult.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models results from importing key images.
3 | */
4 | export default class MoneroKeyImageImportResult {
5 | height: number;
6 | spentAmount: bigint;
7 | unspentAmount: bigint;
8 | constructor(result?: Partial);
9 | toJson(): any;
10 | getHeight(): number;
11 | setHeight(height: number): MoneroKeyImageImportResult;
12 | getSpentAmount(): bigint;
13 | setSpentAmount(spentAmount: bigint): MoneroKeyImageImportResult;
14 | getUnspentAmount(): bigint;
15 | setUnspentAmount(unspentAmount: bigint): MoneroKeyImageImportResult;
16 | }
17 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroMessageSignatureResult.d.ts:
--------------------------------------------------------------------------------
1 | import MoneroMessageSignatureType from "./MoneroMessageSignatureType";
2 | /**
3 | * Message signature verification result.
4 | */
5 | export default class MoneroMessageSignatureResult {
6 | isGood: boolean;
7 | isOld: boolean;
8 | signatureType: MoneroMessageSignatureType;
9 | version: number;
10 | constructor(result?: Partial);
11 | toJson(): any;
12 | getIsGood(): boolean;
13 | setIsGood(isGood: boolean): MoneroMessageSignatureResult;
14 | getIsOld(): boolean;
15 | setIsOld(isOld: boolean): MoneroMessageSignatureResult;
16 | getSignatureType(): MoneroMessageSignatureType;
17 | setSignatureType(signatureType: MoneroMessageSignatureType): MoneroMessageSignatureResult;
18 | getVersion(): number;
19 | setVersion(version: number): MoneroMessageSignatureResult;
20 | }
21 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroMessageSignatureType.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Enumerate message signature types.
3 | */
4 | declare enum MoneroMessageSignatureType {
5 | /**
6 | * Sign with spend key (value=0).
7 | */
8 | SIGN_WITH_SPEND_KEY = 0,
9 | /**
10 | * Sign with the view key (value=1).
11 | */
12 | SIGN_WITH_VIEW_KEY = 1
13 | }
14 | export default MoneroMessageSignatureType;
15 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroMessageSignatureType.js:
--------------------------------------------------------------------------------
1 | "use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
2 | * Enumerate message signature types.
3 | */var
4 | MoneroMessageSignatureType = /*#__PURE__*/function (MoneroMessageSignatureType) {MoneroMessageSignatureType[MoneroMessageSignatureType["SIGN_WITH_SPEND_KEY"] = 0] = "SIGN_WITH_SPEND_KEY";MoneroMessageSignatureType[MoneroMessageSignatureType["SIGN_WITH_VIEW_KEY"] = 1] = "SIGN_WITH_VIEW_KEY";return MoneroMessageSignatureType;}(MoneroMessageSignatureType || {});var _default = exports.default =
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | MoneroMessageSignatureType;
18 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJNb25lcm9NZXNzYWdlU2lnbmF0dXJlVHlwZSIsIl9kZWZhdWx0IiwiZXhwb3J0cyIsImRlZmF1bHQiXSwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWFpbi90cy93YWxsZXQvbW9kZWwvTW9uZXJvTWVzc2FnZVNpZ25hdHVyZVR5cGUudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFbnVtZXJhdGUgbWVzc2FnZSBzaWduYXR1cmUgdHlwZXMuXG4gKi9cbmVudW0gTW9uZXJvTWVzc2FnZVNpZ25hdHVyZVR5cGUge1xuXG4gICAgLyoqXG4gICAgICogU2lnbiB3aXRoIHNwZW5kIGtleSAodmFsdWU9MCkuXG4gICAgICovXG4gICAgU0lHTl9XSVRIX1NQRU5EX0tFWSA9IDAsXG5cbiAgICAvKipcbiAgICAgKiBTaWduIHdpdGggdGhlIHZpZXcga2V5ICh2YWx1ZT0xKS5cbiAgICAgKi9cbiAgICBTSUdOX1dJVEhfVklFV19LRVkgPSAxXG59XG4gIFxuZXhwb3J0IGRlZmF1bHQgTW9uZXJvTWVzc2FnZVNpZ25hdHVyZVR5cGU7Il0sIm1hcHBpbmdzIjoicUdBQUE7QUFDQTtBQUNBLEdBRkE7QUFHS0EsMEJBQTBCLDBCQUExQkEsMEJBQTBCLEdBQTFCQSwwQkFBMEIsQ0FBMUJBLDBCQUEwQixxREFBMUJBLDBCQUEwQixDQUExQkEsMEJBQTBCLDBEQUExQkEsMEJBQTBCLEdBQTFCQSwwQkFBMEIsWUFBQUMsUUFBQSxHQUFBQyxPQUFBLENBQUFDLE9BQUE7Ozs7Ozs7Ozs7Ozs7QUFhaEJILDBCQUEwQiJ9
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroMultisigInfo.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models information about a multisig wallet.
3 | */
4 | export default class MoneroMultisigInfo {
5 | isMultisig: boolean;
6 | isReady: boolean;
7 | threshold: number;
8 | numParticipants: number;
9 | constructor(multisigInfo?: Partial);
10 | toJson(): any;
11 | getIsMultisig(): boolean;
12 | setIsMultisig(isMultisig: boolean): MoneroMultisigInfo;
13 | getIsReady(): boolean;
14 | setIsReady(isReady: boolean): MoneroMultisigInfo;
15 | getThreshold(): number;
16 | setThreshold(threshold: number): MoneroMultisigInfo;
17 | getNumParticipants(): number;
18 | setNumParticipants(numParticipants: number): MoneroMultisigInfo;
19 | }
20 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroMultisigInitResult.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models the result of initializing a multisig wallet which results in the
3 | * multisig wallet's address xor another multisig hex to share with
4 | * participants to create the wallet.
5 | */
6 | export default class MoneroMultisigInitResult {
7 | address: string;
8 | multisigHex: string;
9 | constructor(result?: Partial);
10 | toJson(): any;
11 | getAddress(): string;
12 | setAddress(address: string): MoneroMultisigInitResult;
13 | getMultisigHex(): string;
14 | setMultisigHex(multisigHex: string): MoneroMultisigInitResult;
15 | }
16 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroMultisigInitResult.js:
--------------------------------------------------------------------------------
1 | "use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
2 | * Models the result of initializing a multisig wallet which results in the
3 | * multisig wallet's address xor another multisig hex to share with
4 | * participants to create the wallet.
5 | */
6 | class MoneroMultisigInitResult {
7 |
8 |
9 |
10 |
11 | constructor(result) {
12 | Object.assign(this, result);
13 | }
14 |
15 | toJson() {
16 | return Object.assign({}, this);
17 | }
18 |
19 | getAddress() {
20 | return this.address;
21 | }
22 |
23 | setAddress(address) {
24 | this.address = address;
25 | return this;
26 | }
27 |
28 | getMultisigHex() {
29 | return this.multisigHex;
30 | }
31 |
32 | setMultisigHex(multisigHex) {
33 | this.multisigHex = multisigHex;
34 | return this;
35 | }
36 | }exports.default = MoneroMultisigInitResult;
37 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJNb25lcm9NdWx0aXNpZ0luaXRSZXN1bHQiLCJjb25zdHJ1Y3RvciIsInJlc3VsdCIsIk9iamVjdCIsImFzc2lnbiIsInRvSnNvbiIsImdldEFkZHJlc3MiLCJhZGRyZXNzIiwic2V0QWRkcmVzcyIsImdldE11bHRpc2lnSGV4IiwibXVsdGlzaWdIZXgiLCJzZXRNdWx0aXNpZ0hleCIsImV4cG9ydHMiLCJkZWZhdWx0Il0sInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21haW4vdHMvd2FsbGV0L21vZGVsL01vbmVyb011bHRpc2lnSW5pdFJlc3VsdC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIE1vZGVscyB0aGUgcmVzdWx0IG9mIGluaXRpYWxpemluZyBhIG11bHRpc2lnIHdhbGxldCB3aGljaCByZXN1bHRzIGluIHRoZVxuICogbXVsdGlzaWcgd2FsbGV0J3MgYWRkcmVzcyB4b3IgYW5vdGhlciBtdWx0aXNpZyBoZXggdG8gc2hhcmUgd2l0aFxuICogcGFydGljaXBhbnRzIHRvIGNyZWF0ZSB0aGUgd2FsbGV0LlxuICovXG5leHBvcnQgZGVmYXVsdCBjbGFzcyBNb25lcm9NdWx0aXNpZ0luaXRSZXN1bHQge1xuXG4gIGFkZHJlc3M6IHN0cmluZztcbiAgbXVsdGlzaWdIZXg6IHN0cmluZztcblxuICBjb25zdHJ1Y3RvcihyZXN1bHQ/OiBQYXJ0aWFsP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yQjs7RUFFQUMsVUFBVUEsQ0FBQ0QsT0FBZSxFQUE0QjtJQUNwRCxJQUFJLENBQUNBLE9BQU8sR0FBR0EsT0FBTztJQUN0QixPQUFPLElBQUk7RUFDYjs7RUFFQUUsY0FBY0EsQ0FBQSxFQUFXO0lBQ3ZCLE9BQU8sSUFBSSxDQUFDQyxXQUFXO0VBQ3pCOztFQUVBQyxjQUFjQSxDQUFDRCxXQUFtQixFQUE0QjtJQUM1RCxJQUFJLENBQUNBLFdBQVcsR0FBR0EsV0FBVztJQUM5QixPQUFPLElBQUk7RUFDYjtBQUNGLENBQUNFLE9BQUEsQ0FBQUMsT0FBQSxHQUFBYix3QkFBQSJ9
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroMultisigSignResult.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models the result of signing multisig tx hex.
3 | */
4 | export default class MoneroMultisigSignResult {
5 | signedMultisigTxHex: string;
6 | txHashes: string[];
7 | constructor(result?: Partial);
8 | toJson(): any;
9 | getSignedMultisigTxHex(): string;
10 | setSignedMultisigTxHex(signedTxMultisigHex: string): MoneroMultisigSignResult;
11 | getTxHashes(): string[];
12 | setTxHashes(txHashes: string[]): MoneroMultisigSignResult;
13 | }
14 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroMultisigSignResult.js:
--------------------------------------------------------------------------------
1 | "use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
2 | * Models the result of signing multisig tx hex.
3 | */
4 | class MoneroMultisigSignResult {
5 |
6 |
7 |
8 |
9 | constructor(result) {
10 | Object.assign(this, result);
11 | }
12 |
13 | toJson() {
14 | return Object.assign({}, this);
15 | }
16 |
17 | getSignedMultisigTxHex() {
18 | return this.signedMultisigTxHex;
19 | }
20 |
21 | setSignedMultisigTxHex(signedTxMultisigHex) {
22 | this.signedMultisigTxHex = signedTxMultisigHex;
23 | return this;
24 | }
25 |
26 | getTxHashes() {
27 | return this.txHashes;
28 | }
29 |
30 | setTxHashes(txHashes) {
31 | this.txHashes = txHashes;
32 | return this;
33 | }
34 | }exports.default = MoneroMultisigSignResult;
35 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJNb25lcm9NdWx0aXNpZ1NpZ25SZXN1bHQiLCJjb25zdHJ1Y3RvciIsInJlc3VsdCIsIk9iamVjdCIsImFzc2lnbiIsInRvSnNvbiIsImdldFNpZ25lZE11bHRpc2lnVHhIZXgiLCJzaWduZWRNdWx0aXNpZ1R4SGV4Iiwic2V0U2lnbmVkTXVsdGlzaWdUeEhleCIsInNpZ25lZFR4TXVsdGlzaWdIZXgiLCJnZXRUeEhhc2hlcyIsInR4SGFzaGVzIiwic2V0VHhIYXNoZXMiLCJleHBvcnRzIiwiZGVmYXVsdCJdLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYWluL3RzL3dhbGxldC9tb2RlbC9Nb25lcm9NdWx0aXNpZ1NpZ25SZXN1bHQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBNb2RlbHMgdGhlIHJlc3VsdCBvZiBzaWduaW5nIG11bHRpc2lnIHR4IGhleC5cbiAqL1xuZXhwb3J0IGRlZmF1bHQgY2xhc3MgTW9uZXJvTXVsdGlzaWdTaWduUmVzdWx0IHtcblxuICBzaWduZWRNdWx0aXNpZ1R4SGV4OiBzdHJpbmc7XG4gIHR4SGFzaGVzOiBzdHJpbmdbXTtcbiAgXG4gIGNvbnN0cnVjdG9yKHJlc3VsdD86IFBhcnRpYWw8TW9uZXJvTXVsdGlzaWdTaWduUmVzdWx0Pikge1xuICAgIE9iamVjdC5hc3NpZ24odGhpcywgcmVzdWx0KTtcbiAgfVxuICBcbiAgdG9Kc29uKCk6IGFueSB7XG4gICAgcmV0dXJuIE9iamVjdC5hc3NpZ24oe30sIHRoaXMpO1xuICB9XG4gIFxuICBnZXRTaWduZWRNdWx0aXNpZ1R4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QUFXQSxDQUFBLEVBQWE7SUFDdEIsT0FBTyxJQUFJLENBQUNDLFFBQVE7RUFDdEI7O0VBRUFDLFdBQVdBLENBQUNELFFBQWtCLEVBQTRCO0lBQ3hELElBQUksQ0FBQ0EsUUFBUSxHQUFHQSxRQUFRO0lBQ3hCLE9BQU8sSUFBSTtFQUNiO0FBQ0YsQ0FBQ0UsT0FBQSxDQUFBQyxPQUFBLEdBQUFkLHdCQUFBIn0=
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroOutgoingTransfer.d.ts:
--------------------------------------------------------------------------------
1 | import MoneroDestination from "./MoneroDestination";
2 | import MoneroTransfer from "./MoneroTransfer";
3 | import MoneroTxWallet from "./MoneroTxWallet";
4 | /**
5 | * Models an outgoing transfer of funds from the wallet.
6 | */
7 | export default class MoneroOutgoingTransfer extends MoneroTransfer {
8 | subaddressIndices: number[];
9 | addresses: string[];
10 | destinations: MoneroDestination[];
11 | /**
12 | * Construct the model.
13 | *
14 | * @param {MoneroOutgoingTranser [transfer] existing state to initialize from (optional)
15 | */
16 | constructor(transfer?: Partial);
17 | getIsIncoming(): boolean;
18 | getSubaddressIndices(): number[];
19 | setSubaddressIndices(subaddressIndices: number[]): MoneroOutgoingTransfer;
20 | getAddresses(): string[];
21 | setAddresses(addresses: string[]): MoneroOutgoingTransfer;
22 | getDestinations(): MoneroDestination[];
23 | setDestinations(destinations: MoneroDestination[]): MoneroOutgoingTransfer;
24 | copy(): MoneroOutgoingTransfer;
25 | toJson(): any;
26 | /**
27 | * Updates this transaction by merging the latest information from the given
28 | * transaction.
29 | *
30 | * Merging can modify or build references to the transfer given so it
31 | * should not be re-used or it should be copied before calling this method.
32 | *
33 | * @param transfer is the transfer to merge into this one
34 | */
35 | merge(transfer: MoneroOutgoingTransfer): MoneroOutgoingTransfer;
36 | toString(indent?: number): string;
37 | setTx(tx: MoneroTxWallet): MoneroOutgoingTransfer;
38 | setAmount(amount: bigint): MoneroOutgoingTransfer;
39 | setAccountIndex(accountIndex: number): MoneroOutgoingTransfer;
40 | }
41 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroOutputWallet.d.ts:
--------------------------------------------------------------------------------
1 | import MoneroKeyImage from "../../daemon/model/MoneroKeyImage";
2 | import MoneroOutput from "../../daemon/model/MoneroOutput";
3 | import MoneroTx from "../../daemon/model/MoneroTx";
4 | import MoneroTxWallet from "./MoneroTxWallet";
5 | /**
6 | * Models a Monero output with wallet extensions.
7 | */
8 | export default class MoneroOutputWallet extends MoneroOutput {
9 | accountIndex: number;
10 | subaddressIndex: number;
11 | isSpent: boolean;
12 | isFrozen: boolean;
13 | isLocked: boolean;
14 | /**
15 | * Construct the model.
16 | *
17 | * @param {MoneroOutputWallet} [output] is existing state to initialize from (optional)
18 | */
19 | constructor(output?: Partial);
20 | getTx(): MoneroTxWallet;
21 | setTx(tx: MoneroTx): MoneroOutputWallet;
22 | getAccountIndex(): number;
23 | setAccountIndex(accountIndex: number): MoneroOutputWallet;
24 | getSubaddressIndex(): number;
25 | setSubaddressIndex(subaddressIndex: number): MoneroOutputWallet;
26 | getIsSpent(): boolean;
27 | setIsSpent(isSpent: boolean): MoneroOutputWallet;
28 | /**
29 | * Indicates if this output has been deemed 'malicious' and will therefore
30 | * not be spent by the wallet.
31 | *
32 | * @return Boolean is whether or not this output is frozen
33 | */
34 | getIsFrozen(): boolean;
35 | setIsFrozen(isFrozen: boolean): MoneroOutputWallet;
36 | getIsLocked(): boolean;
37 | copy(): MoneroOutputWallet;
38 | toJson(): any;
39 | /**
40 | * Updates this output by merging the latest information from the given
41 | * output.
42 | *
43 | * Merging can modify or build references to the output given so it
44 | * should not be re-used or it should be copied before calling this method.
45 | *
46 | * @param output is the output to merge into this one
47 | */
48 | merge(output: MoneroOutputWallet): MoneroOutputWallet;
49 | toString(indent?: number): string;
50 | setKeyImage(keyImage: MoneroKeyImage): MoneroOutputWallet;
51 | setAmount(amount: bigint): MoneroOutputWallet;
52 | setIndex(index: number): MoneroOutputWallet;
53 | setRingOutputIndices(ringOutputIndices: number[]): MoneroOutputWallet;
54 | setStealthPublicKey(stealthPublicKey: string): MoneroOutputWallet;
55 | }
56 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroSubaddress.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Monero subaddress model.
3 | */
4 | export default class MoneroSubaddress {
5 | accountIndex: number;
6 | index: number;
7 | address: string;
8 | label: string;
9 | balance: bigint;
10 | unlockedBalance: bigint;
11 | numUnspentOutputs: number;
12 | isUsed: boolean;
13 | numBlocksToUnlock: number;
14 | constructor(subaddress?: Partial);
15 | toJson(): any;
16 | getAccountIndex(): number;
17 | setAccountIndex(accountIndex: number): MoneroSubaddress;
18 | getIndex(): number;
19 | setIndex(index: number): MoneroSubaddress;
20 | getAddress(): string;
21 | setAddress(address: string): MoneroSubaddress;
22 | getLabel(): string;
23 | setLabel(label: string): MoneroSubaddress;
24 | getBalance(): bigint;
25 | setBalance(balance: bigint): MoneroSubaddress;
26 | getUnlockedBalance(): bigint;
27 | setUnlockedBalance(unlockedBalance: bigint): MoneroSubaddress;
28 | getNumUnspentOutputs(): number;
29 | setNumUnspentOutputs(numUnspentOutputs: number): MoneroSubaddress;
30 | getIsUsed(): boolean;
31 | setIsUsed(isUsed: boolean): MoneroSubaddress;
32 | getNumBlocksToUnlock(): number;
33 | setNumBlocksToUnlock(numBlocksToUnlock: number): MoneroSubaddress;
34 | toString(indent?: number): string;
35 | }
36 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroSyncResult.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Result from syncing a Monero wallet.
3 | */
4 | export default class MoneroSyncResult {
5 | numBlocksFetched: number;
6 | receivedMoney: bigint;
7 | constructor(numBlocksFetched: number, receivedMoney: bigint);
8 | getNumBlocksFetched(): number;
9 | setNumBlocksFetched(numBlocksFetched: number): MoneroSyncResult;
10 | getReceivedMoney(): bigint;
11 | setReceivedMoney(receivedMoney: bigint): MoneroSyncResult;
12 | }
13 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroSyncResult.js:
--------------------------------------------------------------------------------
1 | "use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
2 | * Result from syncing a Monero wallet.
3 | */
4 | class MoneroSyncResult {
5 |
6 |
7 |
8 |
9 | constructor(numBlocksFetched, receivedMoney) {
10 | this.setNumBlocksFetched(numBlocksFetched);
11 | this.setReceivedMoney(receivedMoney);
12 | }
13 |
14 | getNumBlocksFetched() {
15 | return this.numBlocksFetched;
16 | }
17 |
18 | setNumBlocksFetched(numBlocksFetched) {
19 | this.numBlocksFetched = numBlocksFetched;
20 | return this;
21 | }
22 |
23 | getReceivedMoney() {
24 | return this.receivedMoney;
25 | }
26 |
27 | setReceivedMoney(receivedMoney) {
28 | this.receivedMoney = receivedMoney;
29 | return this;
30 | }
31 | }exports.default = MoneroSyncResult;
32 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJNb25lcm9TeW5jUmVzdWx0IiwiY29uc3RydWN0b3IiLCJudW1CbG9ja3NGZXRjaGVkIiwicmVjZWl2ZWRNb25leSIsInNldE51bUJsb2Nrc0ZldGNoZWQiLCJzZXRSZWNlaXZlZE1vbmV5IiwiZ2V0TnVtQmxvY2tzRmV0Y2hlZCIsImdldFJlY2VpdmVkTW9uZXkiLCJleHBvcnRzIiwiZGVmYXVsdCJdLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYWluL3RzL3dhbGxldC9tb2RlbC9Nb25lcm9TeW5jUmVzdWx0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogUmVzdWx0IGZyb20gc3luY2luZyBhIE1vbmVybyB3YWxsZXQuXG4gKi9cbmV4cG9ydCBkZWZhdWx0IGNsYXNzIE1vbmVyb1N5bmNSZXN1bHQge1xuXG4gIG51bUJsb2Nrc0ZldGNo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BQUNGLGFBQWEsQ0FBQztFQUN0Qzs7RUFFQUcsbUJBQW1CQSxDQUFBLEVBQVc7SUFDNUIsT0FBTyxJQUFJLENBQUNKLGdCQUFnQjtFQUM5Qjs7RUFFQUUsbUJBQW1CQSxDQUFDRixnQkFBd0IsRUFBb0I7SUFDOUQsSUFBSSxDQUFDQSxnQkFBZ0IsR0FBR0EsZ0JBQWdCO0lBQ3hDLE9BQU8sSUFBSTtFQUNiOztFQUVBSyxnQkFBZ0JBLENBQUEsRUFBVztJQUN6QixPQUFPLElBQUksQ0FBQ0osYUFBYTtFQUMzQjs7RUFFQUUsZ0JBQWdCQSxDQUFDRixhQUFxQixFQUFvQjtJQUN4RCxJQUFJLENBQUNBLGFBQWEsR0FBR0EsYUFBYTtJQUNsQyxPQUFPLElBQUk7RUFDYjtBQUNGLENBQUNLLE9BQUEsQ0FBQUMsT0FBQSxHQUFBVCxnQkFBQSJ9
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroTransfer.d.ts:
--------------------------------------------------------------------------------
1 | import MoneroTxWallet from "./MoneroTxWallet";
2 | /**
3 | * Models a base transfer of funds to or from the wallet.
4 | */
5 | export default class MoneroTransfer {
6 | tx: MoneroTxWallet;
7 | accountIndex: number;
8 | amount: bigint;
9 | /**
10 | * Construct the transfer.
11 | *
12 | * @param {Partial} transfer existing state to initialize from (optional)
13 | */
14 | constructor(transfer: Partial);
15 | copy(): MoneroTransfer;
16 | toJson(): any;
17 | getTx(): MoneroTxWallet;
18 | setTx(tx: MoneroTxWallet): MoneroTransfer;
19 | getIsOutgoing(): boolean;
20 | getIsIncoming(): boolean;
21 | getAccountIndex(): number;
22 | setAccountIndex(accountIndex: number): MoneroTransfer;
23 | getAmount(): bigint;
24 | setAmount(amount: bigint): MoneroTransfer;
25 | /**
26 | * Updates this transaction by merging the latest information from the given
27 | * transaction.
28 | *
29 | * Merging can modify or build references to the transfer given so it
30 | * should not be re-used or it should be copied before calling this method.
31 | *
32 | * @param transfer is the transfer to merge into this one
33 | * @return {MoneroTransfer} the merged transfer
34 | */
35 | merge(transfer: MoneroTransfer): MoneroTransfer;
36 | toString(indent?: number): string;
37 | protected validate(): void;
38 | }
39 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroTxPriority.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Enumerates send priorities.
3 | */
4 | declare enum MoneroTxPriority {
5 | /**
6 | * Default priority (i.e. normal) (value=0).
7 | */
8 | DEFAULT = 0,
9 | /**
10 | * Unimportant priority (value=1).
11 | */
12 | UNIMPORTANT = 1,
13 | /**
14 | * Normal priority (value=2).
15 | */
16 | NORMAL = 2,
17 | /**
18 | * Elevated priority (value=3).
19 | */
20 | ELEVATED = 3
21 | }
22 | export default MoneroTxPriority;
23 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroTxPriority.js:
--------------------------------------------------------------------------------
1 | "use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
2 | * Enumerates send priorities.
3 | */var
4 | MoneroTxPriority = /*#__PURE__*/function (MoneroTxPriority) {MoneroTxPriority[MoneroTxPriority["DEFAULT"] = 0] = "DEFAULT";MoneroTxPriority[MoneroTxPriority["UNIMPORTANT"] = 1] = "UNIMPORTANT";MoneroTxPriority[MoneroTxPriority["NORMAL"] = 2] = "NORMAL";MoneroTxPriority[MoneroTxPriority["ELEVATED"] = 3] = "ELEVATED";return MoneroTxPriority;}(MoneroTxPriority || {});var _default = exports.default =
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | MoneroTxPriority;
28 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJNb25lcm9UeFByaW9yaXR5IiwiX2RlZmF1bHQiLCJleHBvcnRzIiwiZGVmYXVsdCJdLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYWluL3RzL3dhbGxldC9tb2RlbC9Nb25lcm9UeFByaW9yaXR5LnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRW51bWVyYXRlcyBzZW5kIHByaW9yaXRpZXMuXG4gKi9cbmVudW0gTW9uZXJvVHhQcmlvcml0eSB7XG5cbiAgICAvKipcbiAgICAgKiBEZWZhdWx0IHByaW9yaXR5IChpLmUuIG5vcm1hbCkgKHZhbHVlPTApLlxuICAgICAqL1xuICAgREVGQVVMVCA9IDAsXG5cbiAgICAvKipcbiAgICAgKiBVbmltcG9ydGFudCBwcmlvcml0eSAodmFsdWU9MSkuXG4gICAgICovXG4gICAgVU5JTVBPUlRBTlQgPSAxLFxuXG4gICAgLyoqXG4gICAgICogTm9ybWFsIHByaW9yaXR5ICh2YWx1ZT0yKS5cbiAgICAgKi9cbiAgICBOT1JNQUwgPSAyLFxuXG4gICAgLyoqXG4gICAgICogRWxldmF0ZWQgcHJpb3JpdHkgKHZhbHVlPTMpLlxuICAgICAqL1xuICAgIEVMRVZBVEVEID0gM1xufVxuXG5leHBvcnQgZGVmYXVsdCBNb25lcm9UeFByaW9yaXR5OyJdLCJtYXBwaW5ncyI6InFHQUFBO0FBQ0E7QUFDQSxHQUZBO0FBR0tBLGdCQUFnQiwwQkFBaEJBLGdCQUFnQixHQUFoQkEsZ0JBQWdCLENBQWhCQSxnQkFBZ0IsNkJBQWhCQSxnQkFBZ0IsQ0FBaEJBLGdCQUFnQixxQ0FBaEJBLGdCQUFnQixDQUFoQkEsZ0JBQWdCLDJCQUFoQkEsZ0JBQWdCLENBQWhCQSxnQkFBZ0Isc0NBQWhCQSxnQkFBZ0IsR0FBaEJBLGdCQUFnQixZQUFBQyxRQUFBLEdBQUFDLE9BQUEsQ0FBQUMsT0FBQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUF1Qk5ILGdCQUFnQiJ9
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroTxSet.d.ts:
--------------------------------------------------------------------------------
1 | import MoneroTxWallet from "./MoneroTxWallet";
2 | /**
3 | * Groups transactions who share common hex data which is needed in order to
4 | * sign and submit the transactions.
5 | *
6 | * For example, multisig transactions created from createTxs() share a common
7 | * hex string which is needed in order to sign and submit the multisig
8 | * transactions.
9 | */
10 | export default class MoneroTxSet {
11 | txs: MoneroTxWallet[];
12 | multisigTxHex: string;
13 | unsignedTxHex: string;
14 | signedTxHex: string;
15 | constructor(txSet?: Partial);
16 | toJson(): {} & this;
17 | getTxs(): MoneroTxWallet[];
18 | setTxs(txs: any): this;
19 | getMultisigTxHex(): string;
20 | setMultisigTxHex(multisigTxHex: any): this;
21 | getUnsignedTxHex(): string;
22 | setUnsignedTxHex(unsignedTxHex: any): this;
23 | getSignedTxHex(): string;
24 | setSignedTxHex(signedTxHex: any): this;
25 | merge(txSet: any): this;
26 | toString(indent?: number): string;
27 | }
28 |
--------------------------------------------------------------------------------
/dist/src/main/ts/wallet/model/MoneroWalletListener.d.ts:
--------------------------------------------------------------------------------
1 | import MoneroOutputWallet from "./MoneroOutputWallet";
2 | /**
3 | * Default wallet listener which takes no action on notifications.
4 | */
5 | export default class MoneroWalletListener {
6 | /**
7 | * Invoked as the wallet is synchronized.
8 | *
9 | * @param {number} height - height of the synced block
10 | * @param {number} startHeight - starting height of the sync request
11 | * @param {number} endHeight - ending height of the sync request
12 | * @param {number} percentDone - sync progress as a percentage
13 | * @param {string} message - human-readable description of the current progress
14 | * @return {Promise}
15 | */
16 | onSyncProgress(height: number, startHeight: number, endHeight: number, percentDone: number, message: string): Promise;
17 | /**
18 | * Invoked when a new block is added to the chain.
19 | *
20 | * @param {number} height - the height of the new block (i.e. the number of blocks before it).
21 | * @return {Promise}
22 | */
23 | onNewBlock(height: number): Promise;
24 | /**
25 | * Invoked when the wallet's balances change.
26 | *
27 | * @param {bigint} newBalance - new wallet balance
28 | * @param {bigint} newUnlockedBalance - new unlocked wallet balance
29 | * @return {Promise}
30 | */
31 | onBalancesChanged(newBalance: bigint, newUnlockedBalance: bigint): Promise;
32 | /**
33 | * Invoked 3 times per received output: once when unconfirmed, once when confirmed, and
34 | * once when unlocked.
35 | *
36 | * The notified output includes basic fields only, so the output or its transaction should be fetched to get all available fields.
37 | *
38 | * @param {MoneroOutputWallet} output - the received output
39 | * @return {Promise}
40 | */
41 | onOutputReceived(output: MoneroOutputWallet): Promise;
42 | /**
43 | * Invoked twice per spent output: once when confirmed and once when unlocked.
44 | *
45 | * The notified output includes basic fields only, so the output or its transaction should be fetched to get all available fields.
46 | *
47 | * @param {MoneroOutputWallet} output - the spent output
48 | * @return {Promise}
49 | */
50 | onOutputSpent(output: any): Promise;
51 | }
52 |
--------------------------------------------------------------------------------
/docs/bounties.md:
--------------------------------------------------------------------------------
1 | ## Bounties
2 |
3 | Bounties are used to incentivize development and reward contributors.
4 |
5 | To receive a bounty, you agree to these conditions:
6 |
7 | - Your changes must follow the existing coding conventions.
8 | - Bounties will be set and awarded in XMR.
9 | - The issues eligible for a bounty are labelled '💰bounty' and have the amount of the bounty specified in the title in this form: `[$200]` if in dollars or `[1 XMR]` if in Monero.
10 | - An issue is considered resolved when the patch(es) proposed by the contributor is/are merged in the appropriate repository according to terms of the issue. Pull requests to monero-project must be merged into the release branch to be considered final.
11 | - The first person who resolves an issue in its entirety will receive the entire amount of the bounty.
12 | - If the issue is resolved collaboratively by more than one person, the reward will be distributed among the contributors at our discretion.
13 | - Let the Maintainers know if you intend to work on a bounty, so that the issue can be assigned to you. Being assigned to an issue doesn't make that issue resolvable only by the assignee. It's meant to avoid duplication of efforts and not to discourage collective works.
14 | - After the issue is resolved, contact the maintainers and claim your bounty (remember to provide them with a Monero address).
15 | - If the bounty is in dollars, the contributor will receive the amount in Monero according to the value of XMR at the moment the issue was practically resolved, so in the moment the maintainers accept the last patch resolving the issue.
16 |
17 | We want to keep the system simple and flexible, but we will add new rules or edit existing ones if necessary.
18 |
--------------------------------------------------------------------------------
/docs/developer_guide/connection_manager.md:
--------------------------------------------------------------------------------
1 | # Connection Manager
2 |
3 | Wallets can connect to a single Monero daemon or use a connection manager to automatically select the best connection among multiple daemons. Using a connection manager, wallets can automatically switch to a better connection if the current connection becomes disconnected or slow.
4 |
5 | The following code demonstrates how to use monero-ts's connection manager to manage daemon or wallet RPC connections.
6 |
7 | See [MoneroConnectionManager](https://woodser.github.io/monero-ts/typedocs/classes/MoneroConnectionManager.html) or [TestMoneroConnectionManager.ts](https://github.com/woodser/monero-ts/blob/master/src/test/TestMoneroConnectionManager.ts) for more detail.
8 |
9 | ```typescript
10 | // import monero-ts (or import types individually)
11 | import moneroTs from "monero-ts";
12 |
13 | // create connection manager
14 | let connectionManager = new moneroTs.MoneroConnectionManager();
15 |
16 | // add managed connections with priorities
17 | await connectionManager.addConnection({uri: "http://localhost:28081", priority: 1}); // use localhost as first priority
18 | await connectionManager.addConnection("http://example.com"); // default priority is prioritized last
19 |
20 | // set current connection
21 | await connectionManager.setConnection({uri: "http://foo.bar", username: "admin", password: "password"}); // connection is added if new
22 |
23 | // create or open wallet governed by connection manager
24 | let walletFull = await moneroTs.createWalletFull({
25 | path: "sample_wallet_full",
26 | password: "supersecretpassword123",
27 | networkType: moneroTs.MoneroNetworkType.TESTNET,
28 | seed: "hefty value scenic...",
29 | restoreHeight: 573936,
30 | connectionManager: connectionManager
31 | });
32 |
33 | // check connection status
34 | await connectionManager.checkConnection();
35 |
36 | // receive notifications of any changes to current connection
37 | connectionManager.addListener(new class extends moneroTs.MoneroConnectionManagerListener {
38 | async onConnectionChanged(connection: moneroTs.MoneroRpcConnection) {
39 | console.log("Connection changed to: " + connection);
40 | }
41 | });
42 |
43 | // check connections every 10 seconds (in order of priority) and switch to the best
44 | connectionManager.startPolling(10000);
45 |
46 | // get best available connection in order of priority then response time
47 | let bestConnection = await connectionManager.getBestAvailableConnection();
48 |
49 | // check status of all connections
50 | await connectionManager.checkConnections();
51 |
52 | // get connections in order of current connection, online status from last check, priority, and name
53 | let connections = connectionManager.getConnections();
54 |
55 | // clear connection manager
56 | await connectionManager.clear();
57 | ```
--------------------------------------------------------------------------------
/docs/developer_guide/creating_wallets.md:
--------------------------------------------------------------------------------
1 | # Creating wallets
2 |
3 | Three types of wallets can be created:
4 |
5 | * [RPC wallet](#rpc-wallet) - client connected to a monero-wallet-rpc server.
6 | * [WebAssembly wallet](#webassembly-wallet) - client-side wallet which communicates directly with a daemon.
7 | * [Keys-only wallet](#keys-only-wallet) - client-side wallet which supports only basic key management.
8 |
9 | ## RPC wallet
10 |
11 | This example creates a client connected to monero-wallet-rpc then creates a wallet.
12 |
13 | See [MoneroWalletRpc.createWallet()](https://woodser.github.io/monero-ts/typedocs/classes/MoneroWalletRpc.html#createWallet) for all options.
14 |
15 | ```typescript
16 | // create a client connected to monero-wallet-rpc
17 | let walletRpc = await moneroTs.connectToWalletRpc("http://localhost:38081", "superuser", "abctesting123");
18 |
19 | // create a wallet on monero-wallet-rpc
20 | await walletRpc.createWallet({
21 | path: "mywallet",
22 | password: "supersecretpassword",
23 | seed: "coexist igloo pamphlet lagoon...",
24 | restoreHeight: 1543218
25 | });
26 | ```
27 |
28 | ## WebAssembly wallet
29 |
30 | This example creates a wallet using WebAssembly bindings to [wallet2.h](https://github.com/monero-project/monero/blob/master/src/wallet/wallet2.h).
31 |
32 | See [MoneroWalletFull.createWallet()](https://woodser.github.io/monero-ts/typedocs/classes/MoneroWalletFull.html#createWallet) for all options.
33 |
34 | ```typescript
35 | // create wallet using WebAssembly
36 | let wallet = await moneroTs.createWalletFull({
37 | path: "./test_wallets/wallet1", // leave blank for in-memory wallet
38 | password: "supersecretpassword",
39 | networkType: moneroTs.MoneroNetworkType.STAGENET
40 | seed: "coexist igloo pamphlet lagoon...",
41 | restoreHeight: 1543218,
42 | server: {
43 | uri: "http://localhost:38081",
44 | username: "daemon_user",
45 | password: "daemon_password_123"
46 | }
47 | });
48 | ```
49 |
50 | ## Keys-only wallet
51 |
52 | This example creates a keys-only wallet using WebAssembly bindings to monero-project/monero.
53 |
54 | See [MoneroWalletKeys.createWallet()](https://woodser.github.io/monero-ts/typedocs/classes/MoneroWalletKeys.html#createWallet) for all options.
55 |
56 | ```typescript
57 | // create keys-only wallet
58 | let wallet = await moneroTs.createWalletKeys({
59 | password: "abc123",
60 | networkType: moneroTs.MoneroNetworkType.STAGENET,
61 | seed: "coexist igloo pamphlet lagoon..."
62 | });
63 | ```
--------------------------------------------------------------------------------
/docs/developer_guide/https_and_self_signed_certificates.md:
--------------------------------------------------------------------------------
1 | # HTTPS and self-signed certificates
2 |
3 | ## Enable Daemon and Wallet RPC SSL
4 |
5 | 1. `cd /path/to/monero_cli`
6 | 2. Generate certificates for daemon RPC (set password, use defaults except common name "localhost"): `openssl req -x509 -newkey rsa:4096 -keyout daemon-rpc-key.pem -out daemon-rpc-cert.pem -days 365`
7 | 3. Generate certificates for wallet RPC (set password, use defaults except common name "localhost"): `openssl req -x509 -newkey rsa:4096 -keyout wallet-rpc-key.pem -out wallet-rpc-cert.pem -days 365`
8 | 4. Start daemon RPC with SSL and enter password, e.g.: `./monerod --stagenet --rpc-login superuser:abctesting123 --rpc-access-control-origins https://localhost:9100 --rpc-ssl enabled --rpc-ssl-private-key daemon-rpc-key.pem --rpc-ssl-certificate daemon-rpc-cert.pem`
9 | 5. Start wallet RPC with SSL and enter password, e.g.: `./monero-wallet-rpc --daemon-address https://localhost:38081 --daemon-login superuser:abctesting123 --stagenet --rpc-bind-port 38083 --rpc-login rpc_user:abc123 --wallet-dir ./ --rpc-access-control-origins https://localhost:9100 --rpc-ssl enabled --rpc-ssl-private-key wallet-rpc-key.pem --rpc-ssl-certificate wallet-rpc-cert.pem`
10 |
11 | ## Enable SSL in Node.js
12 | 1. Change RPC URIs to "https://..."
13 | 2. Construct `MoneroWalletRpc` and `MoneroDaemonRpc` with `rejectUnauthorized: false` if using self-signed certificates
14 |
15 | ## Enable SSL in web application
16 | 1. Change RPC URIs to "https://..."
17 | 2. Generate certificates for localhost web app (set password, use defaults except common name "localhost"), e.g.: `openssl req -x509 -newkey rsa:4096 -keyout localhost-key.pem -out localhost-cert.pem -days 365`
18 | Note: dev certificates are already committed to src/test/browser with password `abctesting123`
19 | 3. Modify run_server.py to use generated certificates by uncommenting commented lines
20 | 4. Run ./bin/start_browser_test_server.sh and enter certificate password
21 | 5. Test in Chrome: chrome://flags/#allow-insecure-localhost, set "Allow invalid certificates for resources loaded from localhost." to "Enabled"
22 | 6. Test in Firefox: authenticate with https://localhost:38081/json_rpc and https://localhost:38083/json_rpc first, then access https://localhost:9100/
--------------------------------------------------------------------------------
/docs/developer_guide/installing_prerequisites.md:
--------------------------------------------------------------------------------
1 | # Installing prerequisites
2 |
3 | ## Node.js and npm
4 |
5 | JavaScript is designed to run client-side in web browsers, so JavaScript programs cannot run as standalone or server-side applications out of the box. Node.js solves this limitation by providing a runtime environment, allowing JavaScript programs to execute outside of a web browser.
6 |
7 | [Part 1 of the monero-ts "getting started" guide](getting_started_p1.md) illustrates the use of Node.js to run a monero-ts program in a unix terminal, so you need to install it to follow the guide.
8 |
9 | In addition, Node.js includes the Node Package Manger (npm). npm installs Node modules including the monero-ts module, which is required to use the monero-ts library.
10 |
11 | To install Node.js and npm:
12 | ### Debian/Ubuntu:
13 |
14 | 1. Install node.js by typing `$ sudo apt-get install nodejs`.
15 | 2. Install npm by typing `$ sudo apt-get install npm`.
16 |
17 | ### Fedora:
18 |
19 | 1. Install node.js:
20 | `$ sudo dnf install nodejs`
21 | 2. Install npm:
22 | `$ sudo dnf install npm`
23 |
24 | ## Monero CLI tools
25 |
26 | Download and install for your platform: https://web.getmonero.org/downloads/
27 |
28 | ## Python
29 |
30 | The starter web application uses a Python command to run its server, so you need to install Python before running the application.
31 |
32 | To install Python:
33 |
34 | 1. Open a terminal.
35 | 2. Use a package manager to download and install Python 3:
36 | ### Debian/Ubuntu:
37 |
38 | `$ sudo apt-get install python3`
39 | ### Fedora:
40 |
41 | `$ sudo dnf install python3`
42 |
--------------------------------------------------------------------------------
/docs/developer_guide/multisig_wallets.md:
--------------------------------------------------------------------------------
1 | # Multisig wallets
2 |
3 | The following is an example of creating multisig wallets.
4 |
5 | For a full example of creating and sending funds from multisig wallets, see "Supports multisig wallets" in [TestMoneroWalletCommon.ts](https://github.com/woodser/monero-ts/blob/master/src/test/TestMoneroWalletCommon.ts).
6 |
7 | ```typescript
8 | import moneroTs from "monero-ts";
9 |
10 | // create multisig wallets which require 3 out of 5 participants to send funds
11 | let M = 3;
12 | let N = 5;
13 |
14 | // create participating wallets using RPC or WebAssembly
15 | let wallets = []
16 | for (let i = 0; i < N; i++) {
17 | wallets.push(await moneroTs.createWalletFull({
18 | path: "./test_wallets/multisig_participant_" + (i + 1),
19 | password: "supersecretpassword123",
20 | networkType: moneroTs.MoneroNetworkType.STAGENET
21 | }));
22 | }
23 |
24 | // prepare and collect multisig hex from each participant
25 | let preparedMultisigHexes = []
26 | for (let wallet of wallets) preparedMultisigHexes.push(await wallet.prepareMultisig());
27 |
28 | // make each wallet multisig and collect results
29 | let madeMultisigHexes = [];
30 | for (let i = 0; i < wallets.length; i++) {
31 |
32 | // collect prepared multisig hexes from wallet's peers
33 | let peerMultisigHexes = [];
34 | for (let j = 0; j < wallets.length; j++) if (j !== i) peerMultisigHexes.push(preparedMultisigHexes[j]);
35 |
36 | // make wallet multisig and collect result hex
37 | let multisigHex = await wallets[i].makeMultisig(peerMultisigHexes, M, TestUtils.WALLET_PASSWORD);
38 | madeMultisigHexes.push(multisigHex);
39 | }
40 |
41 | // exchange multisig keys N - M + 1 times
42 | let multisigHexes = madeMultisigHexes;
43 | for (let i = 0; i < N - M + 1; i++) {
44 |
45 | // exchange multisig keys among participants and collect results for next round if applicable
46 | let resultMultisigHexes = [];
47 | for (let wallet of wallets) {
48 |
49 | // import the multisig hex of other participants and collect results
50 | let result = await wallet.exchangeMultisigKeys(multisigHexes, TestUtils.WALLET_PASSWORD);
51 | resultMultisigHexes.push(result.getMultisigHex());
52 | }
53 |
54 | // use resulting multisig hex for next round of exchange if applicable
55 | multisigHexes = resultMultisigHexes;
56 | }
57 |
58 | // wallets are now multisig
59 | for (let wallet of wallets) {
60 | let primaryAddress = await wallet.getAddress(0, 0);
61 | await MoneroUtils.validateAddress(primaryAddress, await wallet.getNetworkType());
62 | let info = await wallet.getMultisigInfo();
63 | assert(info.isMultisig());
64 | assert(info.isReady());
65 | assert.equal(info.getThreshold(), M);
66 | assert.equal(info.getNumParticipants(), N);
67 | await wallet.close(true);
68 | }
69 | ```
--------------------------------------------------------------------------------
/docs/developer_guide/query_data_model.md:
--------------------------------------------------------------------------------
1 | # Getting transactions, transfers, and outputs
2 |
3 | Wallet [transactions, transfers, and outputs](data_model.md) can be queried by their properties using query objects.
4 |
5 | ## Getting transactions with queries
6 |
7 | See [MoneroWallet.getTxs()](https://woodser.github.io/monero-ts/typedocs/classes/MoneroWallet.html#getTxs) for all query options.
8 |
9 | ```typescript
10 | // get a transaction by hash
11 | let tx = await wallet.getTx("48db7afb1e9eecb11303d4f49c955ffdee2ffc2fa513b8f05da35ff537744096");
12 | ```
13 |
14 | ```typescript
15 | // get unconfirmed transactions
16 | let txs = await wallet.getTxs({
17 | isConfirmed: false
18 | });
19 | ```
20 |
21 | ```typescript
22 | // get transactions since height 582106 with incoming transfers to
23 | // account 0, subaddress 0
24 | let txs = await wallet.getTxs({
25 | minHeight: 582106,
26 | transferQuery: {
27 | isIncoming: true,
28 | accountIndex: 0,
29 | subaddressIndex: 1
30 | }
31 | });
32 | ```
33 |
34 | ```typescript
35 | // get transactions with available outputs
36 | let txs = await wallet.getTxs({
37 | isLocked: false,
38 | outputQuery: {
39 | isSpent: false,
40 | }
41 | });
42 | ```
43 |
44 | ## Getting transfers with queries
45 |
46 | See [MoneroWallet.getTransfers()](https://woodser.github.io/monero-ts/typedocs/classes/MoneroWallet.html#getTransfers) for all query options.
47 |
48 | ```typescript
49 | // get all transfers
50 | let transfers = await wallet.getTransfers();
51 | ```
52 |
53 | ```typescript
54 | // get incoming transfers to account 0, subaddress 1
55 | let transfers = await wallet.getTransfers({
56 | isIncoming: true,
57 | accountIndex: 0,
58 | subaddressIndex: 1
59 | });
60 | ```
61 |
62 | ```typescript
63 | // get transfers in the tx pool
64 | let transfers = await wallet.getTransfers({
65 | txQuery: {
66 | inTxPool: true
67 | }
68 | });
69 | ```
70 |
71 | ```typescript
72 | // get confirmed outgoing transfers since a block height
73 | let transfers = await wallet.getTransfers({
74 | isIncoming: false,
75 | txQuery: {
76 | isConfirmed: true,
77 | minHeight: 582106,
78 | }
79 | });
80 | ```
81 |
82 | ## Getting outputs with queries
83 |
84 | See [MoneroWallet.getOutputs()](https://woodser.github.io/monero-ts/typedocs/classes/MoneroWallet.html#getOutputs) for all query options.
85 |
86 | ```typescript
87 | // get all outputs
88 | let outputs = await wallet.getOutputs();
89 | ```
90 |
91 | ```typescript
92 | // get outputs available to be spent
93 | let outputs = await wallet.getOutputs({
94 | isSpent: false,
95 | txQuery: {
96 | isLocked: false
97 | }
98 | });
99 | ```
100 |
101 | ```typescript
102 | // get outputs by amount
103 | outputs = await wallet.getOutputs({
104 | amount: 250000000000n
105 | });
106 | ```
107 |
108 | ```typescript
109 | // get outputs received to a specific subaddress
110 | let outputs = await wallet.getOutputs({
111 | accountIndex: 0,
112 | subaddressIndex: 1
113 | });
114 | ```
115 |
116 | ```typescript
117 | // get outputs by their key image hex
118 | let keyImage = outputs[0].getKeyImage().getHex();
119 | outputs = await wallet.getOutputs({
120 | keyImage: keyImage
121 | });
122 | ```
--------------------------------------------------------------------------------
/docs/developer_guide/sending_funds.md:
--------------------------------------------------------------------------------
1 | # Sending funds
2 |
3 | The following are examples of sending funds using monero-ts. See [MoneroTxConfig](https://woodser.github.io/monero-ts/typedocs/classes/MoneroTxConfig.html) for all options.
4 |
5 | ```typescript
6 | // create a transaction to send funds to an address, but do not relay
7 | let tx = await wallet.createTx({
8 | accountIndex: 0, // source account to send funds from
9 | address: "55bcxMRhBWea6xxsot8moF1rdPprjJR2x4mfnNnTGgBJFgXa4gWXmWAYdUBKiRcJxy9AUAGJEg28DejvWdJU2VgUDrUvCHG",
10 | amount: 1000000000000n // send 1 XMR (denominated in atomic units)
11 | });
12 |
13 | // can confirm with the user
14 | let fee = tx.getFee(); // "Are you sure you want to send... ?"
15 |
16 | // relay the transaction
17 | let hash = await wallet.relayTx(tx);
18 | ```
19 |
20 | ```typescript
21 | // send funds to a single destination
22 | let tx = await wallet.createTx({
23 | accountIndex: 0, // source account to send funds from
24 | address: "55bcxMRhBWea6xxsot8moF1rdPprjJR2x4mfnNnTGgBJFgXa4gWXmWAYdUBKiRcJxy9AUAGJEg28DejvWdJU2VgUDrUvCHG",
25 | amount: 1000000000000n, // send 1 XMR (denominated in atomic units)
26 | relay: true // relay the transaction to the network
27 | });
28 | ```
29 |
30 | ```typescript
31 | // send funds from a specific subaddress to multiple destinations,
32 | // allowing transfers to be split across multiple transactions if needed
33 | let txs = await wallet.createTxs({
34 | accountIndex: 0, // source account to send funds from
35 | subaddressIndex: 1, // source subaddress to send funds from
36 | destinations: [{
37 | address: "55bcxMRhBWea6xxsot8moF1rdPprjJR2x4mfnNnTGgBJFgXa4gWXmWAYdUBKiRcJxy9AUAGJEg28DejvWdJU2VgUDrUvCHG",
38 | amount: 500000000000n, // send 0.5 XMR (denominated in atomic units)
39 | }, {
40 | address: "52f7hei1UMrbvYUNtDMKZJMQjcfVyufYnezER8wVK271VmGbzE2kN7cMMG6qFjrb6Ub6qPkNt815a98kJmo874qG9GYZKD5",
41 | amount: 500000000000n, // send 0.5 XMR (denominated in atomic units)
42 | }],
43 | priority: MoneroTxPriority.IMPORTANT,
44 | relay: true // relay the transaction to the network
45 | });
46 | ```
47 |
48 | ```typescript
49 | // sweep an output
50 | let tx = await wallet.sweepOutput({
51 | address: "55bcxMRhBWea6xxsot8moF1rdPprjJR2x4mfnNnTGgBJFgXa4gWXmWAYdUBKiRcJxy9AUAGJEg28DejvWdJU2VgUDrUvCHG",
52 | keyImage: "b7afd6afbb1615c98b1c0350b81c98a77d6d4fc0ab92020d25fd76aca0914f1e",
53 | relay: true
54 | });
55 | ```
56 |
57 | ```typescript
58 | // sweep all unlocked funds in a wallet
59 | let txs = await wallet.sweepUnlocked({
60 | address: "55bcxMRhBWea6xxsot8moF1rdPprjJR2x4mfnNnTGgBJFgXa4gWXmWAYdUBKiRcJxy9AUAGJEg28DejvWdJU2VgUDrUvCHG",
61 | relay: true
62 | });
63 | ```
64 |
65 | ```typescript
66 | // sweep unlocked funds in an account
67 | let txs = await wallet.sweepUnlocked({
68 | accountIndex: 0,
69 | address: "55bcxMRhBWea6xxsot8moF1rdPprjJR2x4mfnNnTGgBJFgXa4gWXmWAYdUBKiRcJxy9AUAGJEg28DejvWdJU2VgUDrUvCHG",
70 | relay: true
71 | });
72 | ```
73 |
74 | ```typescript
75 | // sweep unlocked funds in a subaddress
76 | let txs = await wallet.sweepUnlocked({
77 | accountIndex: 0,
78 | subaddressIndex: 0,
79 | address: "55bcxMRhBWea6xxsot8moF1rdPprjJR2x4mfnNnTGgBJFgXa4gWXmWAYdUBKiRcJxy9AUAGJEg28DejvWdJU2VgUDrUvCHG",
80 | relay: true
81 | });
82 | ```
--------------------------------------------------------------------------------
/docs/img/architecture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/woodser/monero-ts/ace7986beb888450e6e1e6c52e6371998a997c48/docs/img/architecture.png
--------------------------------------------------------------------------------
/docs/img/data_model.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/woodser/monero-ts/ace7986beb888450e6e1e6c52e6371998a997c48/docs/img/data_model.png
--------------------------------------------------------------------------------
/docs/typedocs/.nojekyll:
--------------------------------------------------------------------------------
1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
--------------------------------------------------------------------------------
/docs/typedocs/assets/highlight.css:
--------------------------------------------------------------------------------
1 | :root {
2 | --light-hl-0: #008000;
3 | --dark-hl-0: #6A9955;
4 | --light-hl-1: #AF00DB;
5 | --dark-hl-1: #C586C0;
6 | --light-hl-2: #000000;
7 | --dark-hl-2: #D4D4D4;
8 | --light-hl-3: #001080;
9 | --dark-hl-3: #9CDCFE;
10 | --light-hl-4: #A31515;
11 | --dark-hl-4: #CE9178;
12 | --light-hl-5: #0000FF;
13 | --dark-hl-5: #569CD6;
14 | --light-hl-6: #795E26;
15 | --dark-hl-6: #DCDCAA;
16 | --light-hl-7: #0070C1;
17 | --dark-hl-7: #4FC1FF;
18 | --light-hl-8: #098658;
19 | --dark-hl-8: #B5CEA8;
20 | --light-hl-9: #267F99;
21 | --dark-hl-9: #4EC9B0;
22 | --light-code-background: #FFFFFF;
23 | --dark-code-background: #1E1E1E;
24 | }
25 |
26 | @media (prefers-color-scheme: light) { :root {
27 | --hl-0: var(--light-hl-0);
28 | --hl-1: var(--light-hl-1);
29 | --hl-2: var(--light-hl-2);
30 | --hl-3: var(--light-hl-3);
31 | --hl-4: var(--light-hl-4);
32 | --hl-5: var(--light-hl-5);
33 | --hl-6: var(--light-hl-6);
34 | --hl-7: var(--light-hl-7);
35 | --hl-8: var(--light-hl-8);
36 | --hl-9: var(--light-hl-9);
37 | --code-background: var(--light-code-background);
38 | } }
39 |
40 | @media (prefers-color-scheme: dark) { :root {
41 | --hl-0: var(--dark-hl-0);
42 | --hl-1: var(--dark-hl-1);
43 | --hl-2: var(--dark-hl-2);
44 | --hl-3: var(--dark-hl-3);
45 | --hl-4: var(--dark-hl-4);
46 | --hl-5: var(--dark-hl-5);
47 | --hl-6: var(--dark-hl-6);
48 | --hl-7: var(--dark-hl-7);
49 | --hl-8: var(--dark-hl-8);
50 | --hl-9: var(--dark-hl-9);
51 | --code-background: var(--dark-code-background);
52 | } }
53 |
54 | :root[data-theme='light'] {
55 | --hl-0: var(--light-hl-0);
56 | --hl-1: var(--light-hl-1);
57 | --hl-2: var(--light-hl-2);
58 | --hl-3: var(--light-hl-3);
59 | --hl-4: var(--light-hl-4);
60 | --hl-5: var(--light-hl-5);
61 | --hl-6: var(--light-hl-6);
62 | --hl-7: var(--light-hl-7);
63 | --hl-8: var(--light-hl-8);
64 | --hl-9: var(--light-hl-9);
65 | --code-background: var(--light-code-background);
66 | }
67 |
68 | :root[data-theme='dark'] {
69 | --hl-0: var(--dark-hl-0);
70 | --hl-1: var(--dark-hl-1);
71 | --hl-2: var(--dark-hl-2);
72 | --hl-3: var(--dark-hl-3);
73 | --hl-4: var(--dark-hl-4);
74 | --hl-5: var(--dark-hl-5);
75 | --hl-6: var(--dark-hl-6);
76 | --hl-7: var(--dark-hl-7);
77 | --hl-8: var(--dark-hl-8);
78 | --hl-9: var(--dark-hl-9);
79 | --code-background: var(--dark-code-background);
80 | }
81 |
82 | .hl-0 { color: var(--hl-0); }
83 | .hl-1 { color: var(--hl-1); }
84 | .hl-2 { color: var(--hl-2); }
85 | .hl-3 { color: var(--hl-3); }
86 | .hl-4 { color: var(--hl-4); }
87 | .hl-5 { color: var(--hl-5); }
88 | .hl-6 { color: var(--hl-6); }
89 | .hl-7 { color: var(--hl-7); }
90 | .hl-8 { color: var(--hl-8); }
91 | .hl-9 { color: var(--hl-9); }
92 | pre, code { background: var(--code-background); }
93 |
--------------------------------------------------------------------------------
/docs/typedocs/assets/navigation.js:
--------------------------------------------------------------------------------
1 | window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE52YT2/TMBiHv0vPExMDIbQb6zZasbGxBDggDl7yNrWa2JHtbKkQ3x2nbZo4iV+/5bLDfo8fx//t/vozM1Cb2eVsLoWAxHAp4m0Js7NZycza/h9EVehzN32zNkVukQ0X6ezy49+zo+VeClDyC2yXBcsgKkGYyDBT6aHQC4bc96B1U4JnwuIKpr7WT4bscf2ouFTcbKedXe43fQbx3fC81+QkZ1qDPm8Tt+zbi37phTHlPOe2P8bluwwz3PFnxdTW8w39FLPs2/spSWQ19SlOTPbELAuoLEGwpamyg3sl5eZGGLX1OgccwZyb+Zpx4TUe8rDpinklNiKUz2Wy8RqakOhYAEtBoaY9QvTFUJQ5M4AaWyjsnK/B385dSHQ8gQb14v2sPkM0xjUqi2uC57hv3jNhNyPvOIzA/3DfcW1AnFBHW+CUuqLSP7FdKmy9ZlBIr22fUi227hX37i59hmpcipXEfQ1BtYUGx6Wo1qcywYUWoLqirUjCbW4pqvV7mdp9oF19Ve49Szz4afVcy1eRS5bSq3JLEGoDbbi9UHBk4nZI2HejlPROil0YdtwC3NgqC2RX7iFh34Kp9FaqDTYb+kzYuBSJLLjIYsWEXvlXwZCjmA1kyjYrPZz2fvUADLvb66lP2eZ007IopTL47JxiwzUMb7t4HdM0oRZu/8Z1VBVe85Eg2exYDx8II9+RIRhtK7jmGTZz+8wpRh4YtzFJtzcDQbN3ZNj+FcyrXaLuE8nV9pCw76EymSSs4iFHMpeVt+37lGpZ2DNU2pVeoG+DKZZaw7cKQuIdQvX9ZHkOgdbvmbDxEfzj0mQEg6pEYPvoIWGfvYJ0F0Of0YFITvTgbPOwKaqeGX5wdATJVnAT13j3uRTBau9cAeORCNtCq5e+alsSXQ8ORHB6H12U91Zc4++ANqeYHqXMm3PHOzF6CMWH91JN7p/Iv1XsQooD33HaPGzy/MjUC8OOH6A0sjMc4rAHbxO1RXsOn0V9hmq8rfIc9zUE1WbviN5u7wiqLfQ2dSmqFXmbHgHMFen8oWyOg4mWdhlmiJne3ElZTrWsy1DDWgFLm2U+YThmmCGFFXM27hemOHvOreAQuaXfXfQKJ/sjMZ567a8qsTss9fmYcpUf3k8pJwZpQukZKVdp+8HA1DTvCQcMUefO82ndeKY7ugzMaIfpRF2KKOwsEXjzXGKk+v0Pstaum2gZAAA="
--------------------------------------------------------------------------------
/donate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/woodser/monero-ts/ace7986beb888450e6e1e6c52e6371998a997c48/donate.png
--------------------------------------------------------------------------------
/src/main/ts/common/Filter.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Base filter.
3 | *
4 | * @private
5 | */
6 | export default class Filter {
7 |
8 | /**
9 | * Indicates if the given value meets the criteria of this filter.
10 | *
11 | * @param val is the value to test
12 | * @return true if the value meets the criteria of this filter, false otherwise
13 | */
14 | meetsCriteria(val: any): boolean {
15 | throw new Error("Subclass must implement");
16 | }
17 |
18 | /**
19 | * Returns a new array comprised of elements from the given array that meet
20 | * the filter's criteria.
21 | *
22 | * @param filter implements meetsCriteria(elem) to filter the given array
23 | * @param array is the array to apply the filter to
24 | * @return the new array of filtered elements
25 | */
26 | static apply(filter: Filter, array: any[]): any[] {
27 | return array.filter(elem => !filter || filter.meetsCriteria(elem));
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/ts/common/MoneroConnectionManagerListener.ts:
--------------------------------------------------------------------------------
1 | import MoneroRpcConnection from "./MoneroRpcConnection";
2 |
3 | /**
4 | * Default connection manager listener which takes no action on notifications.
5 | */
6 | export default class MoneroConnectionManagerListener {
7 |
8 | /**
9 | * Notified on connection change events.
10 | *
11 | * @param {MoneroRpcConnection | undefined} connection - the connection manager's current connection
12 | * @return {Promise}
13 | */
14 | async onConnectionChanged(connection: MoneroRpcConnection | undefined): Promise { }
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/ts/common/MoneroError.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Exception when interacting with a Monero wallet or daemon.
3 | */
4 | export default class MoneroError extends Error {
5 |
6 | code: number;
7 |
8 | /**
9 | * Constructs the error.
10 | *
11 | * @param {string} message is a human-readable message of the error
12 | * @param {number} [code] is the error code (optional)
13 | */
14 | constructor(message, code?) {
15 | super(message);
16 | this.code = code;
17 | }
18 |
19 | getCode() {
20 | return this.code;
21 | }
22 |
23 | toString() {
24 | if (this.message === undefined && this.getCode() === undefined) return super.message;
25 | let str = "";
26 | if (this.getCode() !== undefined) str += this.getCode() + ": ";
27 | str += this.message;
28 | return str;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/ts/common/MoneroRpcError.ts:
--------------------------------------------------------------------------------
1 | import MoneroError from "./MoneroError";
2 |
3 | /**
4 | * Error when interacting with Monero RPC.
5 | */
6 | export default class MoneroRpcError extends MoneroError {
7 |
8 | // instance variables
9 | protected rpcMethod: any;
10 | protected rpcParams: any;
11 |
12 | /**
13 | * Constructs the error.
14 | *
15 | * @param {string} rpcDescription is a description of the error from rpc
16 | * @param {number} rpcCode is the error code from rpc
17 | * @param {string} [rpcMethod] is the rpc method invoked
18 | * @param {object} [rpcParams] are parameters sent with the rpc request
19 | */
20 | constructor(rpcDescription, rpcCode, rpcMethod?, rpcParams?) {
21 | super(rpcDescription, rpcCode);
22 | this.rpcMethod = rpcMethod;
23 | this.rpcParams = rpcParams;
24 | }
25 |
26 | getRpcMethod() {
27 | return this.rpcMethod;
28 | }
29 |
30 | getRpcParams() {
31 | return this.rpcParams;
32 | }
33 |
34 | toString() {
35 | let str = super.toString();
36 | if (this.rpcMethod || this.rpcParams) str += "\nRequest: '" + this.rpcMethod + "' with params: " + (typeof this.rpcParams === "object" ? JSON.stringify(this.rpcParams) : this.rpcParams);
37 | return str;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/ts/common/SslOptions.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * SSL options for remote endpoints.
3 | */
4 | export default class SslOptions {
5 |
6 | privateKeyPath: string;
7 | certificatePath: string;
8 | certificateAuthorityFile: string;
9 | allowedFingerprints: string[];
10 | allowAnyCert: boolean;
11 |
12 | constructor(options?: Partial) {
13 | Object.assign(this, options);
14 | }
15 |
16 | getPrivateKeyPath() {
17 | return this.privateKeyPath;
18 | }
19 |
20 | setPrivateKeyPath(privateKeyPath) {
21 | this.privateKeyPath = privateKeyPath;
22 | return this;
23 | }
24 |
25 | getCertificatePath() {
26 | return this.certificatePath;
27 | }
28 |
29 | setCertificatePath(certificatePath) {
30 | this.certificatePath = certificatePath;
31 | return this;
32 | }
33 |
34 | getCertificateAuthorityFile() {
35 | return this.certificateAuthorityFile;
36 | }
37 |
38 | setCertificateAuthorityFile(certificateAuthorityFile) {
39 | this.certificateAuthorityFile = certificateAuthorityFile;
40 | return this;
41 | }
42 |
43 | getAllowedFingerprints() {
44 | return this.allowedFingerprints;
45 | }
46 |
47 | setAllowedFingerprints(allowedFingerprints) {
48 | this.allowedFingerprints = allowedFingerprints;
49 | return this;
50 | }
51 |
52 | getAllowAnyCert() {
53 | return this.allowAnyCert;
54 | }
55 |
56 | setAllowAnyCert(allowAnyCert) {
57 | this.allowAnyCert = allowAnyCert;
58 | return this;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/ts/common/TaskLooper.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Run a task in a fixed period loop.
3 | */
4 | export default class TaskLooper {
5 |
6 | _fn: () => Promise;
7 | _isStarted: boolean;
8 | _isLooping: boolean;
9 | _periodInMs: number;
10 | _timeout: NodeJS.Timeout | undefined;
11 |
12 | /**
13 | * Build the looper with a function to invoke on a fixed period loop.
14 | *
15 | * @param {function} fn - the async function to invoke
16 | */
17 | constructor(fn: () => Promise) {
18 | this._fn = fn;
19 | this._isStarted = false;
20 | this._isLooping = false;
21 | }
22 |
23 | /**
24 | * Get the task function to invoke on a fixed period loop.
25 | *
26 | * @return {function} the task function
27 | */
28 | getTask() {
29 | return this._fn;
30 | }
31 |
32 | /**
33 | * Start the task loop.
34 | *
35 | * @param {number} periodInMs the loop period in milliseconds
36 | * @param {boolean} targetFixedPeriod specifies if the task should target a fixed period by accounting for run time (default false)
37 | * @return {TaskLooper} this instance for chaining
38 | */
39 | start(periodInMs: number, targetFixedPeriod?: boolean) {
40 | if (periodInMs <= 0) throw new Error("Looper period must be greater than 0 ms");
41 | this.setPeriodInMs(periodInMs);
42 | if (this._isStarted) return;
43 | this._isStarted = true;
44 | this._runLoop(targetFixedPeriod);
45 | }
46 |
47 | /**
48 | * Indicates if looping.
49 | *
50 | * @return {boolean} true if looping, false otherwise
51 | */
52 | isStarted() {
53 | return this._isStarted;
54 | }
55 |
56 | /**
57 | * Stop the task loop.
58 | */
59 | stop() {
60 | this._isStarted = false;
61 | clearTimeout(this._timeout!);
62 | this._timeout = undefined;
63 | }
64 |
65 | /**
66 | * Set the loop period in milliseconds.
67 | *
68 | * @param {number} periodInMs the loop period in milliseconds
69 | */
70 | setPeriodInMs(periodInMs) {
71 | if (periodInMs <= 0) throw new Error("Looper period must be greater than 0 ms");
72 | this._periodInMs = periodInMs;
73 | }
74 |
75 | async _runLoop(targetFixedPeriod: boolean) {
76 | this._isLooping = true;
77 | while (this._isStarted) {
78 | const startTime = Date.now();
79 | await this._fn();
80 | let that = this;
81 | if (this._isStarted) await new Promise((resolve) => { this._timeout = setTimeout(resolve, that._periodInMs - (targetFixedPeriod ? (Date.now() - startTime) : 0)); });
82 | }
83 | this._isLooping = false;
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/main/ts/common/ThreadPool.ts:
--------------------------------------------------------------------------------
1 | import GenUtils from "./GenUtils";
2 | import async from "async";
3 |
4 | /**
5 | * Simple thread pool using the async library.
6 | */
7 | export default class ThreadPool {
8 |
9 | protected taskQueue: any;
10 | protected drainListeners: any;
11 |
12 | /**
13 | * Construct the thread pool.
14 | *
15 | * @param {number} [maxConcurrency] - maximum number of threads in the pool (default 1)
16 | */
17 | constructor(maxConcurrency) {
18 | if (maxConcurrency === undefined) maxConcurrency = 1;
19 | if (maxConcurrency < 1) throw new Error("Max concurrency must be greater than or equal to 1");
20 |
21 | // manager concurrency with async queue
22 | //import async from "async";
23 | this.taskQueue = async.queue((asyncFn, callback) => {
24 | if (asyncFn.then) asyncFn.then(resp => { callback(resp); }).catch(err => { callback(undefined, err); });
25 | else asyncFn().then(resp => { callback(resp); }).catch(err => { callback(undefined, err); });
26 | }, maxConcurrency);
27 |
28 | // use drain listeners to support await all
29 | this.drainListeners = [];
30 | this.taskQueue.drain = () => {
31 | for (let listener of this.drainListeners) listener();
32 | }
33 | }
34 |
35 | /**
36 | * Submit an asynchronous function to run using the thread pool.
37 | *
38 | * @param {function} asyncFn - asynchronous function to run with the thread pool
39 | * @return {Promise} resolves when the function completes execution
40 | */
41 | async submit(asyncFn): Promise {
42 | return new Promise((resolve, reject) => {
43 | this.taskQueue.push(asyncFn, (resp, err) => {
44 | if (err !== undefined) reject(err);
45 | else resolve(resp);
46 | });
47 | });
48 | }
49 |
50 | /**
51 | * Await all functions to complete.
52 | *
53 | * @return {Promise} resolves when all functions complete
54 | */
55 | async awaitAll(): Promise {
56 | if (this.taskQueue.length === 0) return;
57 | return new Promise((resolve) => {
58 | this.drainListeners.push(() => {
59 | GenUtils.remove(this.drainListeners, this);
60 | resolve();
61 | })
62 | });
63 | }
64 | }
65 |
66 |
--------------------------------------------------------------------------------
/src/main/ts/daemon/model/ConnectionType.ts:
--------------------------------------------------------------------------------
1 | import assert from "assert";
2 |
3 | /**
4 | * Enumerates connection types.
5 | *
6 | * Based on enums.h in monero-project.
7 | */
8 | enum ConnectionType {
9 |
10 | /**
11 | * Invalid connection type (value=0).
12 | */
13 | INVALID = 0,
14 |
15 | /**
16 | * IPV4 connection type (value=1).
17 | */
18 | IPV4 = 1,
19 |
20 | /**
21 | * IPV6 connection type (value=2).
22 | */
23 | IPV6 = 2,
24 |
25 | /**
26 | * TOR connection type (value=3).
27 | */
28 | TOR = 3,
29 |
30 | /**
31 | * I2P connection type (value=4).
32 | */
33 | I2P = 4
34 | }
35 |
36 | export default ConnectionType;
--------------------------------------------------------------------------------
/src/main/ts/daemon/model/MoneroAltChain.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models an alternative chain seen by the node.
3 | */
4 | export default class MoneroAltChain {
5 |
6 | blockHashes: string[];
7 | difficulty: bigint;
8 | height: number;
9 | length: number;
10 | mainChainParentBlockHash: string;
11 |
12 | constructor(altChain?: Partial) {
13 | Object.assign(this, altChain);
14 | if (this.difficulty !== undefined && typeof this.difficulty !== "bigint") this.difficulty = BigInt(this.difficulty);
15 | }
16 |
17 | toJson(): any {
18 | let json: any = Object.assign({}, this);
19 | if (this.getDifficulty() !== undefined) json.difficulty = this.getDifficulty().toString();
20 | return json;
21 | }
22 |
23 | getBlockHashes(): string[] {
24 | return this.blockHashes;
25 | }
26 |
27 | setBlockHashes(blockHashes: string[]): MoneroAltChain {
28 | this.blockHashes = blockHashes;
29 | return this;
30 | }
31 |
32 | getDifficulty(): bigint {
33 | return this.difficulty;
34 | }
35 |
36 | setDifficulty(difficulty: bigint): MoneroAltChain {
37 | this.difficulty = difficulty;
38 | return this;
39 | }
40 |
41 | getHeight(): number {
42 | return this.height;
43 | }
44 |
45 | setHeight(height: number): MoneroAltChain {
46 | this.height = height;
47 | return this;
48 | }
49 |
50 | getLength(): number {
51 | return this.length;
52 | }
53 |
54 | setLength(length: number): MoneroAltChain {
55 | this.length = length;
56 | return this;
57 | }
58 |
59 | getMainChainParentBlockHash(): string {
60 | return this.mainChainParentBlockHash;
61 | }
62 |
63 | setMainChainParentBlockHash(mainChainParentBlockHash: string): MoneroAltChain {
64 | this.mainChainParentBlockHash = mainChainParentBlockHash;
65 | return this;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/ts/daemon/model/MoneroBan.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Monero banhammer.
3 | */
4 | export default class MoneroBan {
5 |
6 | host: string;
7 | ip: string;
8 | isBanned: boolean;
9 | seconds: number;
10 |
11 | constructor(ban?: Partial) {
12 | Object.assign(this, ban);
13 | }
14 |
15 | toJson(): any {
16 | return Object.assign({}, this);
17 | }
18 |
19 | getHost(): string {
20 | return this.host;
21 | }
22 |
23 | setHost(host: string): MoneroBan {
24 | this.host = host;
25 | return this;
26 | }
27 |
28 | getIp(): string {
29 | return this.ip;
30 | }
31 |
32 | setIp(ip: string): MoneroBan {
33 | this.ip = ip;
34 | return this;
35 | }
36 |
37 | getIsBanned(): boolean {
38 | return this.isBanned;
39 | }
40 |
41 | setIsBanned(isBanned: boolean): MoneroBan {
42 | this.isBanned = isBanned;
43 | return this;
44 | }
45 |
46 | getSeconds(): number {
47 | return this.seconds;
48 | }
49 |
50 | setSeconds(seconds: number): MoneroBan {
51 | this.seconds = seconds;
52 | return this;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/ts/daemon/model/MoneroConnectionSpan.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Monero daemon connection span.
3 | */
4 | export default class MoneroConnectionSpan {
5 |
6 | connectionId: string;
7 | numBlocks: number;
8 | remoteAddress: string;
9 | rate: number;
10 | speed: number;
11 | size: number;
12 | startHeight: number;
13 |
14 | constructor(span?: any) {
15 | Object.assign(this, span);
16 | }
17 |
18 | toJson(): any {
19 | return Object.assign({}, this);
20 | }
21 |
22 | getConnectionId(): string {
23 | return this.connectionId;
24 | }
25 |
26 | setConnectionId(connectionId: string): MoneroConnectionSpan {
27 | this.connectionId = connectionId;
28 | return this;
29 | }
30 |
31 | getNumBlocks(): number {
32 | return this.numBlocks;
33 | }
34 |
35 | setNumBlocks(numBlocks: number): MoneroConnectionSpan {
36 | this.numBlocks = numBlocks;
37 | return this;
38 | }
39 |
40 | getRemoteAddress(): string {
41 | return this.remoteAddress;
42 | }
43 |
44 | setRemoteAddress(remoteAddress: string): MoneroConnectionSpan {
45 | this.remoteAddress = remoteAddress;
46 | return this;
47 | }
48 |
49 | getRate(): number {
50 | return this.rate;
51 | }
52 |
53 | setRate(rate: number): MoneroConnectionSpan {
54 | this.rate = rate;
55 | return this;
56 | }
57 |
58 | getSpeed(): number {
59 | return this.speed;
60 | }
61 |
62 | setSpeed(speed: number): MoneroConnectionSpan {
63 | this.speed = speed;
64 | return this;
65 | }
66 |
67 | getSize(): number {
68 | return this.size;
69 | }
70 |
71 | setSize(size: number): MoneroConnectionSpan {
72 | this.size = size;
73 | return this;
74 | }
75 |
76 | getStartHeight(): number {
77 | return this.startHeight;
78 | }
79 |
80 | setStartHeight(startHeight: number): MoneroConnectionSpan {
81 | this.startHeight = startHeight;
82 | return this;
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/src/main/ts/daemon/model/MoneroDaemonConfig.ts:
--------------------------------------------------------------------------------
1 | import MoneroRpcConnection from "../../common/MoneroRpcConnection";
2 |
3 | /**
4 | * Configuration to connect to monerod.
5 | */
6 | export default class MoneroDaemonConfig {
7 |
8 | /** Server config to monerod. */
9 | server: string | Partial;
10 |
11 | /** Proxy requests to monerod to a worker (default true). */
12 | proxyToWorker: boolean;
13 |
14 | /** Command to start monerod as a child process. */
15 | cmd: string[];
16 |
17 | /** Interval in milliseconds to poll the daemon for updates (default 20000). */
18 | pollInterval: number;
19 |
20 | /**
21 | * Construct a configuration to open or create a wallet.
22 | *
23 | * @param {Partial} [config] - MoneroDaemonConfig to construct from (optional)
24 | * @param {string|Partial} [config.server] - uri or MoneroRpcConnection to the daemon (optional)
25 | * @param {boolean} [config.proxyToWorker] - proxy daemon requests to a worker (default true)
26 | * @param {string[]} [config.cmd] - command to start monerod (optional)
27 | * @param {number} [config.pollInterval] - interval in milliseconds to poll the daemon for updates (default 20000)
28 | */
29 | constructor(config?: Partial) {
30 | Object.assign(this, config);
31 | if (this.server) this.setServer(this.server);
32 | this.setProxyToWorker(this.proxyToWorker);
33 | }
34 |
35 | copy(): MoneroDaemonConfig {
36 | return new MoneroDaemonConfig(this);
37 | }
38 |
39 | toJson(): any {
40 | let json: any = Object.assign({}, this);
41 | if (json.server) json.server = json.server.toJson();
42 | return json;
43 | }
44 |
45 | getServer(): MoneroRpcConnection {
46 | return this.server as MoneroRpcConnection;
47 | }
48 |
49 | setServer(server: Partial | string): MoneroDaemonConfig {
50 | if (server && !(server instanceof MoneroRpcConnection)) server = new MoneroRpcConnection(server);
51 | this.server = server as MoneroRpcConnection;
52 | return this;
53 | }
54 |
55 | getProxyToWorker(): boolean {
56 | return this.proxyToWorker;
57 | }
58 |
59 | setProxyToWorker(proxyToWorker: boolean): MoneroDaemonConfig {
60 | this.proxyToWorker = proxyToWorker;
61 | return this;
62 | }
63 |
64 | getCmd(): string[] {
65 | return this.cmd;
66 | }
67 |
68 | setCmd(cmd: string[]): MoneroDaemonConfig {
69 | this.cmd = cmd;
70 | return this;
71 | }
72 |
73 | getPollInterval(): number {
74 | return this.pollInterval;
75 | }
76 |
77 | setPollInterval(pollInterval: number): MoneroDaemonConfig {
78 | this.pollInterval = pollInterval;
79 | return this;
80 | }
81 | }
--------------------------------------------------------------------------------
/src/main/ts/daemon/model/MoneroDaemonListener.ts:
--------------------------------------------------------------------------------
1 | import MoneroBlockHeader from "./MoneroBlockHeader";
2 |
3 | /**
4 | * Receives notifications as a daemon is updated.
5 | */
6 | export default class MoneroDaemonListener {
7 |
8 | protected lastHeader: MoneroBlockHeader;
9 |
10 | /**
11 | * Called when a new block is added to the chain.
12 | *
13 | * @param {MoneroBlockHeader} header - the header of the block added to the chain
14 | */
15 | async onBlockHeader(header: MoneroBlockHeader) {
16 | this.lastHeader = header;
17 | }
18 |
19 | /**
20 | * Get the last notified block header.
21 | *
22 | * @return {MoneroBlockHeader} the last notified block header
23 | */
24 | getLastBlockHeader(): MoneroBlockHeader {
25 | return this.lastHeader;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/ts/daemon/model/MoneroDaemonUpdateCheckResult.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models the result of checking for a daemon update.
3 | */
4 | export default class MoneroDaemonUpdateCheckResult {
5 |
6 | isUpdateAvailable: boolean;
7 | version: string;
8 | hash: string;
9 | autoUri: string;
10 | userUri: string;
11 |
12 | constructor(result?: MoneroDaemonUpdateCheckResult) {
13 | Object.assign(this, result);
14 | }
15 |
16 | /**
17 | * Indicates if an update is available.
18 | *
19 | * @return {boolean} true if an update is available, false otherwise
20 | */
21 | getIsUpdateAvailable(): boolean {
22 | return this.isUpdateAvailable;
23 | }
24 |
25 | setIsUpdateAvailable(isUpdateAvailable: boolean): MoneroDaemonUpdateCheckResult {
26 | this.isUpdateAvailable = isUpdateAvailable;
27 | return this;
28 | }
29 |
30 | /**
31 | * Get the update's version.
32 | *
33 | * @return {string} is the update's version
34 | */
35 | getVersion(): string {
36 | return this.version;
37 | }
38 |
39 | setVersion(version: string): MoneroDaemonUpdateCheckResult {
40 | this.version = version;
41 | return this;
42 | }
43 |
44 | /**
45 | * Get the update's hash.
46 | *
47 | * @return {string} is the update's hash
48 | */
49 | getHash(): string {
50 | return this.hash;
51 | }
52 |
53 | setHash(hash: string): MoneroDaemonUpdateCheckResult {
54 | this.hash = hash;
55 | return this;
56 | }
57 |
58 | /**
59 | * Get the uri to automatically download the update.
60 | *
61 | * @return {string} is the uri to automatically download the update
62 | */
63 | getAutoUri(): string {
64 | return this.autoUri;
65 | }
66 |
67 | setAutoUri(autoUri: string): MoneroDaemonUpdateCheckResult {
68 | this.autoUri = autoUri;
69 | return this;
70 | }
71 |
72 | /**
73 | * Get the uri to manually download the update.
74 | *
75 | * @return {string} is the uri to manually download the update
76 | */
77 | getUserUri(): string {
78 | return this.userUri;
79 | }
80 |
81 | setUserUri(userUri: string): MoneroDaemonUpdateCheckResult {
82 | this.userUri = userUri;
83 | return this;
84 | }
85 | }
--------------------------------------------------------------------------------
/src/main/ts/daemon/model/MoneroDaemonUpdateDownloadResult.ts:
--------------------------------------------------------------------------------
1 | import MoneroDaemonUpdateCheckResult from "./MoneroDaemonUpdateCheckResult";
2 |
3 | /**
4 | * Models the result of downloading an update.
5 | */
6 | export default class MoneroDaemonUpdateDownloadResult extends MoneroDaemonUpdateCheckResult {
7 |
8 | downloadPath: string;
9 |
10 | constructor(state: MoneroDaemonUpdateDownloadResult) {
11 | super(state);
12 | }
13 |
14 | /**
15 | * Get the path the update was downloaded to.
16 | *
17 | * @return {string} is the path the update was downloaded to
18 | */
19 | getDownloadPath(): string {
20 | return this.downloadPath;
21 | }
22 |
23 | setDownloadPath(downloadPath: string): MoneroDaemonUpdateDownloadResult {
24 | this.downloadPath = downloadPath;
25 | return this;
26 | }
27 | }
--------------------------------------------------------------------------------
/src/main/ts/daemon/model/MoneroFeeEstimate.ts:
--------------------------------------------------------------------------------
1 | import GenUtils from "../../common/GenUtils";
2 |
3 | /**
4 | * Models a Monero fee estimate.
5 | */
6 | export default class MoneroFeeEstimate {
7 |
8 | fee: bigint;
9 | fees: bigint[];
10 | quantizationMask: bigint;
11 |
12 | constructor(feeEstimate?: Partial) {
13 | Object.assign(this, feeEstimate);
14 |
15 | // deserialize
16 | if (this.fee !== undefined && typeof this.fee !== "bigint") this.fee = BigInt(this.fee);
17 | if (this.fees !== undefined) {
18 | for (let i = 0; i < this.fees.length; i++) {
19 | if (typeof this.fees[i] !== "bigint") this.fees[i] = BigInt(this.fees[i]);
20 | }
21 | }
22 | if (this.quantizationMask !== undefined && typeof this.quantizationMask !== "bigint") this.quantizationMask = BigInt(this.quantizationMask);
23 | }
24 |
25 | getFee(): bigint {
26 | return this.fee;
27 | }
28 |
29 | setFee(fee: bigint): MoneroFeeEstimate {
30 | this.fee = fee;
31 | return this;
32 | }
33 |
34 | getFees(): bigint[] {
35 | return this.fees;
36 | }
37 |
38 | setFees(fees) {
39 | this.fees = fees;
40 | return this;
41 | }
42 |
43 | getQuantizationMask(): bigint {
44 | return this.quantizationMask;
45 | }
46 |
47 | setQuantizationMask(quantizationMask): MoneroFeeEstimate {
48 | this.quantizationMask = quantizationMask;
49 | return this;
50 | }
51 |
52 | copy(): MoneroFeeEstimate {
53 | return new MoneroFeeEstimate(this);
54 | }
55 |
56 | toJson(): any {
57 | let json: any = Object.assign({}, this);
58 | if (this.getFee()) json.fee = this.getFee().toString();
59 | if (this.getFees()) for (let i = 0; i < this.getFees().length; i++) json.fees[i] = this.getFees()[i].toString();
60 | if (this.getQuantizationMask()) json.quantizationMask = this.getQuantizationMask().toString();
61 | return json;
62 | }
63 |
64 | toString(indent = 0) {
65 | let str = "";
66 | let json = this.toJson();
67 | str += GenUtils.kvLine("Fee", json.fee, indent);
68 | str += GenUtils.kvLine("Fees", json.fees, indent);
69 | str += GenUtils.kvLine("Quantization mask", json.quantizationMask, indent);
70 | return str.slice(0, str.length - 1); // strip last newline
71 | }
72 | }
--------------------------------------------------------------------------------
/src/main/ts/daemon/model/MoneroHardForkInfo.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Monero hard fork info.
3 | */
4 | export default class MoneroHardForkInfo {
5 |
6 | earliestHeight: number;
7 | isEnabled: boolean;
8 | state: string;
9 | threshold: number;
10 | version: number;
11 | numVotes: number;
12 | window: number;
13 | voting: number;
14 | credits: bigint;
15 | topBlockHash: string;
16 |
17 | constructor(info?: Partial) {
18 | Object.assign(this, info);
19 | if (this.credits !== undefined && typeof this.credits !== "bigint") this.credits = BigInt(this.credits);
20 | }
21 |
22 | toJson(): any {
23 | let json: any = Object.assign({}, this);
24 | if (json.credits !== undefined) json.credits = json.credits.toString();
25 | return json;
26 | }
27 |
28 | getEarliestHeight(): number {
29 | return this.earliestHeight;
30 | }
31 |
32 | setEarliestHeight(earliestHeight: number): MoneroHardForkInfo {
33 | this.earliestHeight = earliestHeight;
34 | return this;
35 | }
36 |
37 | getIsEnabled(): boolean {
38 | return this.isEnabled;
39 | }
40 |
41 | setIsEnabled(isEnabled: boolean): MoneroHardForkInfo {
42 | this.isEnabled = isEnabled;
43 | return this;
44 | }
45 |
46 | getState(): string {
47 | return this.state;
48 | }
49 |
50 | setState(state: string): MoneroHardForkInfo {
51 | this.state = state;
52 | return this;
53 | }
54 |
55 | getThreshold(): number {
56 | return this.threshold;
57 | }
58 |
59 | setThreshold(threshold: number): MoneroHardForkInfo {
60 | this.threshold = threshold;
61 | return this;
62 | }
63 |
64 | getVersion(): number {
65 | return this.version;
66 | }
67 |
68 | setVersion(version: number): MoneroHardForkInfo {
69 | this.version = version;
70 | return this;
71 | }
72 |
73 | getNumVotes(): number {
74 | return this.numVotes;
75 | }
76 |
77 | setNumVotes(numVotes: number): MoneroHardForkInfo {
78 | this.numVotes = numVotes;
79 | return this;
80 | }
81 |
82 | getWindow(): number {
83 | return this.window;
84 | }
85 |
86 | setWindow(window: number): MoneroHardForkInfo {
87 | this.window = window;
88 | return this;
89 | }
90 |
91 | getVoting(): number {
92 | return this.voting;
93 | }
94 |
95 | setVoting(voting: number): MoneroHardForkInfo {
96 | this.voting = voting;
97 | return this;
98 | }
99 |
100 | getCredits(): bigint{
101 | return this.credits;
102 | }
103 |
104 | setCredits(credits: bigint): MoneroHardForkInfo {
105 | this.credits = credits;
106 | return this;
107 | }
108 |
109 | getTopBlockHash(): string {
110 | return this.topBlockHash;
111 | }
112 |
113 | setTopBlockHash(topBlockHash: string): MoneroHardForkInfo {
114 | this.topBlockHash = topBlockHash;
115 | return this;
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/src/main/ts/daemon/model/MoneroKeyImage.ts:
--------------------------------------------------------------------------------
1 | import assert from "assert";
2 | import GenUtils from "../../common/GenUtils";
3 | import MoneroError from "../../common/MoneroError";
4 |
5 | /**
6 | * Models a Monero key image.
7 | */
8 | export default class MoneroKeyImage {
9 |
10 | hex: string;
11 | signature: string;
12 |
13 | /**
14 | * Construct the model.
15 | *
16 | * @param {string|Partial} [keyImageOrHex] is a MoneroKeyImage or hex string to initialize from (optional)
17 | * @param {string} [signature] is the key image's signature
18 | */
19 | constructor(hexOrKeyImage?: string | Partial, signature?: string) {
20 | if (typeof hexOrKeyImage === "string") {
21 | this.setHex(hexOrKeyImage);
22 | this.setSignature(signature);
23 | } else {
24 | Object.assign(this, hexOrKeyImage);
25 | }
26 | }
27 |
28 | getHex(): string {
29 | return this.hex;
30 | }
31 |
32 | setHex(hex: string): MoneroKeyImage {
33 | this.hex = hex;
34 | return this;
35 | }
36 |
37 | getSignature(): string {
38 | return this.signature;
39 | }
40 |
41 | setSignature(signature: string): MoneroKeyImage {
42 | this.signature = signature;
43 | return this;
44 | }
45 |
46 | copy(): MoneroKeyImage {
47 | return new MoneroKeyImage(this);
48 | }
49 |
50 | toJson() {
51 | return Object.assign({}, this);
52 | }
53 |
54 | merge(keyImage: MoneroKeyImage): MoneroKeyImage {
55 | assert(keyImage instanceof MoneroKeyImage);
56 | if (keyImage === this) return this;
57 | this.setHex(GenUtils.reconcile(this.getHex(), keyImage.getHex()));
58 | this.setSignature(GenUtils.reconcile(this.getSignature(), keyImage.getSignature()));
59 | return this;
60 | }
61 |
62 | toString(indent = 0): string {
63 | let str = "";
64 | str += GenUtils.kvLine("Hex", this.getHex(), indent);
65 | str += GenUtils.kvLine("Signature", this.getSignature(), indent);
66 | return str.slice(0, str.length - 1); // strip last newline
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/ts/daemon/model/MoneroKeyImageSpentStatus.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Enumerates connection types.
3 | *
4 | * Based on enums.h in monero-project.
5 | */
6 | enum MoneroKeyImageSpentStatus {
7 |
8 | /**
9 | * Key image is not spent (value=0).
10 | */
11 | NOT_SPENT = 0,
12 |
13 | /**
14 | * Key image is confirmed (value=1).
15 | */
16 | CONFIRMED = 1,
17 |
18 | /**
19 | * Key image is in the pool (value=2).
20 | */
21 | TX_POOL = 2
22 | }
23 |
24 | export default MoneroKeyImageSpentStatus;
--------------------------------------------------------------------------------
/src/main/ts/daemon/model/MoneroMinerTxSum.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Model for the summation of miner emissions and fees.
3 | */
4 | export default class MoneroMinerTxSum {
5 |
6 | emissionSum: bigint;
7 | feeSum: bigint;
8 |
9 | constructor(txSum?: Partial) {
10 | Object.assign(this, txSum);
11 |
12 | // deserialize bigints
13 | if (this.emissionSum !== undefined && typeof this.emissionSum !== "bigint") this.emissionSum = BigInt(this.emissionSum);
14 | if (this.feeSum !== undefined && typeof this.feeSum !== "bigint") this.feeSum = BigInt(this.feeSum);
15 | }
16 |
17 | toJson(): any {
18 | let json: any = Object.assign({}, this);
19 | if (this.getEmissionSum() !== undefined) json.emissionSum = this.getEmissionSum().toString();
20 | if (this.getFeeSum() !== undefined) json.feeSum = this.getFeeSum().toString();
21 | return json;
22 | }
23 |
24 | getEmissionSum(): bigint {
25 | return this.emissionSum;
26 | }
27 |
28 | setEmissionSum(emissionSum: bigint): MoneroMinerTxSum {
29 | this.emissionSum = emissionSum;
30 | return this;
31 | }
32 |
33 | getFeeSum(): bigint {
34 | return this.feeSum;
35 | }
36 |
37 | setFeeSum(feeSum: bigint): MoneroMinerTxSum {
38 | this.feeSum = feeSum;
39 | return this;
40 | }
41 | }
--------------------------------------------------------------------------------
/src/main/ts/daemon/model/MoneroMiningStatus.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models daemon mining status.
3 | */
4 | export default class MoneroMiningStatus {
5 |
6 | isActive: boolean;
7 | address: string;
8 | speed: number;
9 | numThreads: number;
10 | isBackground: boolean;
11 |
12 | constructor(status?: Partial) {
13 | Object.assign(this, status);
14 | }
15 |
16 | toJson() {
17 | return Object.assign({}, this);
18 | }
19 |
20 | getIsActive(): boolean {
21 | return this.isActive;
22 | }
23 |
24 | setIsActive(isActive: boolean): MoneroMiningStatus {
25 | this.isActive = isActive;
26 | return this;
27 | }
28 |
29 | getAddress(): string {
30 | return this.address;
31 | }
32 |
33 | setAddress(address: string): MoneroMiningStatus {
34 | this.address = address;
35 | return this;
36 | }
37 |
38 | getSpeed(): number {
39 | return this.speed;
40 | }
41 |
42 | setSpeed(speed: number): MoneroMiningStatus {
43 | this.speed = speed;
44 | return this;
45 | }
46 |
47 | getNumThreads(): number {
48 | return this.numThreads;
49 | }
50 |
51 | setNumThreads(numThreads: number): MoneroMiningStatus {
52 | this.numThreads = numThreads;
53 | return this;
54 | }
55 |
56 | getIsBackground(): boolean {
57 | return this.isBackground;
58 | }
59 |
60 | setIsBackground(isBackground: boolean): MoneroMiningStatus {
61 | this.isBackground = isBackground;
62 | return this;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/ts/daemon/model/MoneroNetworkType.ts:
--------------------------------------------------------------------------------
1 | import MoneroError from "../../common/MoneroError";
2 |
3 | /**
4 | * Defines the Monero network types (mainnet, testnet, and stagenet).
5 | */
6 | export default class MoneroNetworkType {
7 |
8 | /**
9 | * Mainnet (value=0).
10 | */
11 | static readonly MAINNET = 0;
12 |
13 | /**
14 | * Testnet (value=1).
15 | */
16 | static readonly TESTNET = 1;
17 |
18 | /**
19 | * Stagnet (value=2).
20 | */
21 | static readonly STAGENET = 2;
22 |
23 | /**
24 | * Validate and normalize the given network type.
25 | *
26 | * @param {MoneroNetworkType | number | string} networkType - the network type to validate and normalize
27 | * @return {MoneroNetworkType} the given network type
28 | */
29 | static from(networkType: MoneroNetworkType | number | string): MoneroNetworkType {
30 | if (typeof networkType === "string") return MoneroNetworkType.parse(networkType);
31 | MoneroNetworkType.validate(networkType);
32 | return networkType;
33 | }
34 |
35 | /**
36 | * Validate the given network type.
37 | *
38 | * @param {MoneroNetworkType} networkType - the network type to validate as a numeric
39 | */
40 | static validate(networkType: MoneroNetworkType | number | string) {
41 | if (typeof networkType === "string") MoneroNetworkType.parse(networkType);
42 | else if (networkType !== 0 && networkType !== 1 && networkType !== 2) throw new MoneroError("Network type is invalid: " + networkType);
43 | }
44 |
45 | /**
46 | * Indicates if the given network type is valid or not.
47 | *
48 | * @param {MoneroNetworkType | number} networkType - the network type to validate as a numeric
49 | * @return {boolean} true if the network type is valid, false otherwise
50 | */
51 | static isValid(networkType: MoneroNetworkType | number | string): boolean {
52 | try {
53 | MoneroNetworkType.validate(networkType);
54 | return true;
55 | } catch(err) {
56 | return false;
57 | }
58 | }
59 |
60 | /**
61 | * Parse the given string as a network type.
62 | *
63 | * @param {string} networkTypeStr - "mainnet", "testnet", or "stagenet" (case insensitive)
64 | * @return {MoneroNetworkType} the network type as a numeric
65 | */
66 | static parse(networkTypeStr: string): MoneroNetworkType {
67 | let str = ("" + networkTypeStr).toLowerCase();
68 | switch (str) {
69 | case "mainnet": return MoneroNetworkType.MAINNET;
70 | case "testnet": return MoneroNetworkType.TESTNET;
71 | case "stagenet": return MoneroNetworkType.STAGENET;
72 | default: throw new MoneroError("Invalid network type to parse: '" + networkTypeStr + "'");
73 | }
74 | }
75 |
76 | /**
77 | * Get the network type in human-readable form.
78 | *
79 | * @return {string} the network type in human-readable form
80 | */
81 | static toString(networkType: MoneroNetworkType | number): string {
82 | if (networkType === 0) return "mainnet";
83 | if (networkType === 1) return "testnet";
84 | if (networkType === 2) return "stagenet";
85 | throw new MoneroError("Invalid network type: " + networkType);
86 | }
87 | }
--------------------------------------------------------------------------------
/src/main/ts/daemon/model/MoneroOutputHistogramEntry.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Entry in a Monero output histogram (see get_output_histogram of Daemon RPC documentation).
3 | */
4 | export default class MoneroOutputHistogramEntry {
5 |
6 | amount: bigint;
7 | numInstances: number;
8 | numUnlockedInstances: number;
9 | numRecentInstances: number;
10 |
11 | constructor(entry?: MoneroOutputHistogramEntry) {
12 | Object.assign(this, entry);
13 | if (this.amount !== undefined && typeof this.amount !== "bigint") this.amount = BigInt(this.amount);
14 | }
15 |
16 | toJson(): any {
17 | let json: any = Object.assign({}, this);
18 | if (json.amount !== undefined) json.amount = json.amount.toString();
19 | return json;
20 | }
21 |
22 | getAmount(): bigint {
23 | return this.amount;
24 | }
25 |
26 | setAmount(amount: bigint): MoneroOutputHistogramEntry {
27 | this.amount = amount;
28 | return this;
29 | }
30 |
31 | getNumInstances(): number {
32 | return this.numInstances;
33 | }
34 |
35 | setNumInstances(numInstances: number): MoneroOutputHistogramEntry {
36 | this.numInstances = numInstances;
37 | return this;
38 | }
39 |
40 | getNumUnlockedInstances(): number {
41 | return this.numUnlockedInstances;
42 | }
43 |
44 | setNumUnlockedInstances(numUnlockedInstances: number) {
45 | this.numUnlockedInstances = numUnlockedInstances;
46 | return this;
47 | }
48 |
49 | getNumRecentInstances(): number {
50 | return this.numRecentInstances;
51 | }
52 |
53 | setNumRecentInstances(numRecentInstances: number): MoneroOutputHistogramEntry {
54 | this.numRecentInstances = numRecentInstances;
55 | return this;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/ts/daemon/model/MoneroPruneResult.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Result of pruning the blockchain.
3 | */
4 | export default class MoneroPruneResult {
5 |
6 | isPruned: boolean;
7 | pruningSeed: number;
8 |
9 | constructor(result?: Partial) {
10 | Object.assign(this, result);
11 | }
12 |
13 | toJson(): any {
14 | let json = Object.assign({}, this);
15 | if (this.getIsPruned()) json.isPruned = this.getIsPruned();
16 | if (this.getPruningSeed()) json.pruningSeed = this.getPruningSeed();
17 | return json;
18 | }
19 |
20 | getIsPruned(): boolean {
21 | return this.isPruned;
22 | }
23 |
24 | setIsPruned(isPruned: boolean): MoneroPruneResult {
25 | this.isPruned = isPruned;
26 | return this;
27 | }
28 |
29 | getPruningSeed(): number {
30 | return this.pruningSeed;
31 | }
32 |
33 | setPruningSeed(pruningSeed: number): MoneroPruneResult {
34 | this.pruningSeed = pruningSeed;
35 | return this;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/ts/daemon/model/MoneroVersion.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models a Monero version.
3 | */
4 | export default class MoneroVersion {
5 |
6 | number: number;
7 | isRelease: boolean;
8 |
9 | constructor(number: number, isRelease: boolean) {
10 | this.number = number;
11 | this.isRelease = isRelease;
12 | }
13 |
14 | getNumber(): number {
15 | return this.number;
16 | }
17 |
18 | setNumber(number: number): MoneroVersion {
19 | this.number = number;
20 | return this;
21 | }
22 |
23 | getIsRelease(): boolean {
24 | return this.isRelease;
25 | }
26 |
27 | setIsRelease(isRelease: boolean): MoneroVersion {
28 | this.isRelease = isRelease;
29 | return this;
30 | }
31 |
32 | copy(): MoneroVersion {
33 | return new MoneroVersion(this.number, this.isRelease);
34 | }
35 |
36 | toJson(): any {
37 | return Object.assign({}, this);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/ts/wallet/model/MoneroAccountTag.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Represents an account tag.
3 | */
4 | export default class MoneroAccountTag {
5 |
6 | tag: string;
7 | label: string;
8 | accountIndices: number[];
9 |
10 | constructor(accountTag?: Partial) {
11 | Object.assign(this, accountTag);
12 | }
13 |
14 | getTag(): string {
15 | return this.tag;
16 | }
17 |
18 | setTag(tag: string): MoneroAccountTag {
19 | this.tag = tag;
20 | return this;
21 | }
22 |
23 | getLabel(): string {
24 | return this.label;
25 | }
26 |
27 | setLabel(label: string): MoneroAccountTag {
28 | this.label = label;
29 | return this;
30 | }
31 |
32 | getAccountIndices(): number[] {
33 | return this.accountIndices;
34 | }
35 |
36 | setAccountIndices(accountIndices: number[]): MoneroAccountTag {
37 | this.accountIndices = accountIndices;
38 | return this;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/ts/wallet/model/MoneroAddressBookEntry.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Monero address book entry model
3 | */
4 | export default class MoneroAddressBookEntry {
5 |
6 | index: number;
7 | address: string;
8 | description: string;
9 | paymentId: string;
10 |
11 | constructor(entry?: Partial) {
12 | Object.assign(this, entry);
13 | }
14 |
15 | toJson(): any {
16 | return Object.assign({}, this);
17 | }
18 |
19 | getIndex(): number {
20 | return this.index;
21 | }
22 |
23 | setIndex(index: number): MoneroAddressBookEntry {
24 | this.index = index;
25 | return this;
26 | }
27 |
28 | getAddress(): string {
29 | return this.address;
30 | }
31 |
32 | setAddress(address: string): MoneroAddressBookEntry {
33 | this.address = address;
34 | return this;
35 | }
36 |
37 | getDescription(): string {
38 | return this.description;
39 | }
40 |
41 | setDescription(description: string): MoneroAddressBookEntry {
42 | this.description = description;
43 | return this;
44 | }
45 |
46 | getPaymentId(): string {
47 | return this.paymentId;
48 | }
49 |
50 | setPaymentId(paymentId: string): MoneroAddressBookEntry {
51 | this.paymentId = paymentId;
52 | return this;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/ts/wallet/model/MoneroCheck.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Base class for results from checking a transaction or reserve proof.
3 | */
4 | export default class MoneroCheck {
5 |
6 | isGood?: boolean;
7 |
8 | constructor(check?: Partial) {
9 | Object.assign(this, check);
10 | }
11 |
12 | getIsGood(): boolean {
13 | return this.isGood;
14 | }
15 |
16 | setIsGood(isGood: boolean): MoneroCheck {
17 | this.isGood = isGood;
18 | return this;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/ts/wallet/model/MoneroCheckReserve.ts:
--------------------------------------------------------------------------------
1 | import MoneroCheck from "./MoneroCheck";
2 |
3 | /**
4 | * Results from checking a reserve proof.
5 | */
6 | export default class MoneroCheckReserve extends MoneroCheck {
7 |
8 | totalAmount: bigint;
9 | unconfirmedSpentAmount: bigint;
10 |
11 | constructor(check?: Partial) {
12 | super(check);
13 | if (this.totalAmount !== undefined && typeof this.totalAmount !== "bigint") this.totalAmount = BigInt(this.totalAmount);
14 | if (this.unconfirmedSpentAmount !== undefined && typeof this.unconfirmedSpentAmount !== "bigint") this.unconfirmedSpentAmount = BigInt(this.unconfirmedSpentAmount);
15 | }
16 |
17 | toJson(): any {
18 | let json: any = Object.assign({}, this);
19 | if (this.getTotalAmount() !== undefined) json.totalAmount = this.getTotalAmount().toString();
20 | if (this.getUnconfirmedSpentAmount() !== undefined) json.unconfirmedSpentAmount = this.getUnconfirmedSpentAmount().toString();
21 | return json;
22 | }
23 |
24 | getTotalAmount(): bigint {
25 | return this.totalAmount;
26 | }
27 |
28 | setTotalAmount(totalAmount: bigint): MoneroCheckReserve {
29 | this.totalAmount = totalAmount;
30 | return this;
31 | }
32 |
33 | getUnconfirmedSpentAmount(): bigint {
34 | return this.unconfirmedSpentAmount;
35 | }
36 |
37 | setUnconfirmedSpentAmount(unconfirmedSpentAmount: bigint): MoneroCheckReserve {
38 | this.unconfirmedSpentAmount = unconfirmedSpentAmount;
39 | return this;
40 | }
41 | }
--------------------------------------------------------------------------------
/src/main/ts/wallet/model/MoneroCheckTx.ts:
--------------------------------------------------------------------------------
1 | import MoneroCheck from "./MoneroCheck";
2 |
3 | /**
4 | * Results from checking a transaction key.
5 | */
6 | export default class MoneroCheckTx extends MoneroCheck {
7 |
8 | inTxPool: boolean;
9 | numConfirmations: number;
10 | receivedAmount: bigint;
11 |
12 | constructor(check?: Partial) {
13 | super(check);
14 | if (this.receivedAmount !== undefined && typeof this.receivedAmount !== "bigint") this.receivedAmount = BigInt(this.receivedAmount);
15 | }
16 |
17 | toJson(): any {
18 | let json: any = Object.assign({}, this);
19 | if (this.getReceivedAmount() !== undefined) json.receivedAmount = this.getReceivedAmount().toString();
20 | return json;
21 | }
22 |
23 | getInTxPool(): boolean {
24 | return this.inTxPool;
25 | }
26 |
27 | setInTxPool(inTxPool: boolean): MoneroCheckTx {
28 | this.inTxPool = inTxPool;
29 | return this;
30 | }
31 |
32 | getNumConfirmations(): number {
33 | return this.numConfirmations;
34 | }
35 |
36 | setNumConfirmations(numConfirmations: number): MoneroCheckTx {
37 | this.numConfirmations = numConfirmations;
38 | return this;
39 | }
40 |
41 | getReceivedAmount(): bigint {
42 | return this.receivedAmount;
43 | }
44 |
45 | setReceivedAmount(receivedAmount: bigint): MoneroCheckTx {
46 | this.receivedAmount = receivedAmount;
47 | return this;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/ts/wallet/model/MoneroDestination.ts:
--------------------------------------------------------------------------------
1 | import GenUtils from "../../common/GenUtils";
2 | import MoneroError from "../../common/MoneroError";
3 |
4 | /**
5 | * Models an outgoing transfer destination.
6 | */
7 | export default class MoneroDestination {
8 |
9 | /** Destination address to send funds to. */
10 | address: string;
11 |
12 | /** Amount to send to destination address. */
13 | amount: bigint;
14 |
15 | /**
16 | * Construct a destination to send funds to.
17 | *
18 | * @param {Partial|string} destinationOrAddress is a MoneroDestination or hex string to initialize from (optional)
19 | * @param {bigint} [amount] - the destination amount
20 | */
21 | constructor(destinationOrAddress?: Partial | string, amount?: bigint) {
22 | if (typeof destinationOrAddress === "string") {
23 | this.setAddress(destinationOrAddress);
24 | this.setAmount(amount);
25 | } else {
26 | if (amount !== undefined) throw new Error("Amount parameter must be undefined when initializing a MoneroDestination from a MoneroDestination")
27 | Object.assign(this, destinationOrAddress);
28 | if (this.amount && typeof this.amount !== "bigint") this.amount = BigInt(this.amount);
29 | }
30 | }
31 |
32 | getAddress(): string {
33 | return this.address;
34 | }
35 |
36 | setAddress(address: string | undefined): MoneroDestination {
37 | this.address = address;
38 | return this;
39 | }
40 |
41 | getAmount(): bigint {
42 | return this.amount;
43 | }
44 |
45 | setAmount(amount: bigint): MoneroDestination {
46 | if (amount !== undefined && typeof amount !== "bigint") {
47 | if (typeof amount === "number") throw new MoneroError("Destination amount must be BigInt or string");
48 | try { amount = BigInt(amount); }
49 | catch (err) { throw new MoneroError("Invalid destination amount: " + amount); }
50 | }
51 | this.amount = amount;
52 | return this;
53 | }
54 |
55 | copy(): MoneroDestination {
56 | return new MoneroDestination(this);
57 | }
58 |
59 | toJson(): any {
60 | let json: any = Object.assign({}, this);
61 | if (this.getAmount() !== undefined) json.amount = this.getAmount().toString();
62 | return json;
63 | }
64 |
65 | toString(indent = 0): string {
66 | let str = GenUtils.kvLine("Address", this.getAddress(), indent);
67 | str += GenUtils.kvLine("Amount", this.getAmount() ? this.getAmount().toString() : undefined, indent);
68 | return str.slice(0, str.length - 1); // strip last newline
69 | }
70 | }
--------------------------------------------------------------------------------
/src/main/ts/wallet/model/MoneroIntegratedAddress.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Monero integrated address model.
3 | */
4 | export default class MoneroIntegratedAddress {
5 |
6 | standardAddress: string;
7 | paymentId: string;
8 | integratedAddress: string;
9 |
10 | constructor(integratedAddress?: Partial) {
11 | Object.assign(this, integratedAddress);
12 | }
13 |
14 | toJson(): any {
15 | return Object.assign({}, this);
16 | }
17 |
18 | getStandardAddress(): string {
19 | return this.standardAddress;
20 | }
21 |
22 | setStandardAddress(standardAddress: string): MoneroIntegratedAddress {
23 | this.standardAddress = standardAddress;
24 | return this;
25 | }
26 |
27 | getPaymentId(): string {
28 | return this.paymentId;
29 | }
30 |
31 | setPaymentId(paymentId: string): MoneroIntegratedAddress {
32 | this.paymentId = paymentId;
33 | return this;
34 | }
35 |
36 | getIntegratedAddress(): string {
37 | return this.integratedAddress;
38 | }
39 |
40 | setIntegratedAddress(integratedAddress: string): MoneroIntegratedAddress {
41 | this.integratedAddress = integratedAddress;
42 | return this;
43 | }
44 |
45 | toString(): string {
46 | return this.integratedAddress;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/ts/wallet/model/MoneroKeyImageImportResult.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models results from importing key images.
3 | */
4 | export default class MoneroKeyImageImportResult {
5 |
6 | height: number;
7 | spentAmount: bigint;
8 | unspentAmount: bigint;
9 |
10 | constructor(result?: Partial) {
11 | Object.assign(this, result);
12 | if (this.spentAmount !== undefined && typeof this.spentAmount !== "bigint") this.spentAmount = BigInt(this.spentAmount);
13 | if (this.unspentAmount !== undefined && typeof this.unspentAmount !== "bigint") this.unspentAmount = BigInt(this.unspentAmount);
14 | }
15 |
16 | toJson(): any {
17 | let json: any = Object.assign({}, this);
18 | if (this.getSpentAmount() !== undefined) json.spentAmount = this.getSpentAmount().toString();
19 | if (this.getUnspentAmount() !== undefined) json.unspentAmount = this.getUnspentAmount().toString();
20 | return json;
21 | }
22 |
23 | getHeight(): number {
24 | return this.height;
25 | }
26 |
27 | setHeight(height: number): MoneroKeyImageImportResult {
28 | this.height = height;
29 | return this;
30 | }
31 |
32 | getSpentAmount(): bigint {
33 | return this.spentAmount;
34 | }
35 |
36 | setSpentAmount(spentAmount: bigint): MoneroKeyImageImportResult {
37 | this.spentAmount = spentAmount;
38 | return this;
39 | }
40 |
41 | getUnspentAmount(): bigint {
42 | return this.unspentAmount;
43 | }
44 |
45 | setUnspentAmount(unspentAmount: bigint): MoneroKeyImageImportResult {
46 | this.unspentAmount = unspentAmount;
47 | return this;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/ts/wallet/model/MoneroMessageSignatureResult.ts:
--------------------------------------------------------------------------------
1 | import MoneroMessageSignatureType from "./MoneroMessageSignatureType";
2 |
3 | /**
4 | * Message signature verification result.
5 | */
6 | export default class MoneroMessageSignatureResult {
7 |
8 | isGood: boolean;
9 | isOld: boolean;
10 | signatureType: MoneroMessageSignatureType;
11 | version: number;
12 |
13 | constructor(result?: Partial) {
14 | Object.assign(this, result);
15 | }
16 |
17 | toJson(): any {
18 | return Object.assign({}, this);
19 | }
20 |
21 | getIsGood(): boolean {
22 | return this.isGood;
23 | }
24 |
25 | setIsGood(isGood: boolean): MoneroMessageSignatureResult {
26 | this.isGood = isGood;
27 | return this;
28 | }
29 |
30 | getIsOld(): boolean {
31 | return this.isOld;
32 | }
33 |
34 | setIsOld(isOld: boolean): MoneroMessageSignatureResult {
35 | this.isOld = isOld;
36 | return this;
37 | }
38 |
39 | getSignatureType(): MoneroMessageSignatureType {
40 | return this.signatureType;
41 | }
42 |
43 | setSignatureType(signatureType: MoneroMessageSignatureType): MoneroMessageSignatureResult {
44 | this.signatureType = signatureType;
45 | return this;
46 | }
47 |
48 | getVersion(): number {
49 | return this.version;
50 | }
51 |
52 | setVersion(version: number): MoneroMessageSignatureResult {
53 | this.version = version;
54 | return this;
55 | }
56 |
57 | }
--------------------------------------------------------------------------------
/src/main/ts/wallet/model/MoneroMessageSignatureType.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Enumerate message signature types.
3 | */
4 | enum MoneroMessageSignatureType {
5 |
6 | /**
7 | * Sign with spend key (value=0).
8 | */
9 | SIGN_WITH_SPEND_KEY = 0,
10 |
11 | /**
12 | * Sign with the view key (value=1).
13 | */
14 | SIGN_WITH_VIEW_KEY = 1
15 | }
16 |
17 | export default MoneroMessageSignatureType;
--------------------------------------------------------------------------------
/src/main/ts/wallet/model/MoneroMultisigInfo.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models information about a multisig wallet.
3 | */
4 | export default class MoneroMultisigInfo {
5 |
6 | isMultisig: boolean;
7 | isReady: boolean;
8 | threshold: number;
9 | numParticipants: number;
10 |
11 | constructor(multisigInfo?: Partial) {
12 | Object.assign(this, multisigInfo);
13 | }
14 |
15 | toJson(): any {
16 | return Object.assign({}, this);
17 | }
18 |
19 | getIsMultisig(): boolean {
20 | return this.isMultisig;
21 | }
22 |
23 | setIsMultisig(isMultisig: boolean): MoneroMultisigInfo {
24 | this.isMultisig = isMultisig;
25 | return this;
26 | }
27 |
28 | getIsReady(): boolean {
29 | return this.isReady;
30 | }
31 |
32 | setIsReady(isReady: boolean): MoneroMultisigInfo {
33 | this.isReady = isReady;
34 | return this;
35 | }
36 |
37 | getThreshold(): number {
38 | return this.threshold;
39 | }
40 |
41 | setThreshold(threshold: number): MoneroMultisigInfo {
42 | this.threshold = threshold;
43 | return this;
44 | }
45 |
46 | getNumParticipants(): number {
47 | return this.numParticipants;
48 | }
49 |
50 | setNumParticipants(numParticipants: number): MoneroMultisigInfo {
51 | this.numParticipants = numParticipants;
52 | return this;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/ts/wallet/model/MoneroMultisigInitResult.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models the result of initializing a multisig wallet which results in the
3 | * multisig wallet's address xor another multisig hex to share with
4 | * participants to create the wallet.
5 | */
6 | export default class MoneroMultisigInitResult {
7 |
8 | address: string;
9 | multisigHex: string;
10 |
11 | constructor(result?: Partial) {
12 | Object.assign(this, result);
13 | }
14 |
15 | toJson(): any {
16 | return Object.assign({}, this);
17 | }
18 |
19 | getAddress(): string {
20 | return this.address;
21 | }
22 |
23 | setAddress(address: string): MoneroMultisigInitResult {
24 | this.address = address;
25 | return this;
26 | }
27 |
28 | getMultisigHex(): string {
29 | return this.multisigHex;
30 | }
31 |
32 | setMultisigHex(multisigHex: string): MoneroMultisigInitResult {
33 | this.multisigHex = multisigHex;
34 | return this;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/ts/wallet/model/MoneroMultisigSignResult.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Models the result of signing multisig tx hex.
3 | */
4 | export default class MoneroMultisigSignResult {
5 |
6 | signedMultisigTxHex: string;
7 | txHashes: string[];
8 |
9 | constructor(result?: Partial) {
10 | Object.assign(this, result);
11 | }
12 |
13 | toJson(): any {
14 | return Object.assign({}, this);
15 | }
16 |
17 | getSignedMultisigTxHex(): string {
18 | return this.signedMultisigTxHex;
19 | }
20 |
21 | setSignedMultisigTxHex(signedTxMultisigHex: string): MoneroMultisigSignResult {
22 | this.signedMultisigTxHex = signedTxMultisigHex;
23 | return this;
24 | }
25 |
26 | getTxHashes(): string[] {
27 | return this.txHashes;
28 | }
29 |
30 | setTxHashes(txHashes: string[]): MoneroMultisigSignResult {
31 | this.txHashes = txHashes;
32 | return this;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/ts/wallet/model/MoneroSyncResult.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Result from syncing a Monero wallet.
3 | */
4 | export default class MoneroSyncResult {
5 |
6 | numBlocksFetched: number;
7 | receivedMoney: bigint;
8 |
9 | constructor(numBlocksFetched: number, receivedMoney: bigint) {
10 | this.setNumBlocksFetched(numBlocksFetched);
11 | this.setReceivedMoney(receivedMoney);
12 | }
13 |
14 | getNumBlocksFetched(): number {
15 | return this.numBlocksFetched;
16 | }
17 |
18 | setNumBlocksFetched(numBlocksFetched: number): MoneroSyncResult {
19 | this.numBlocksFetched = numBlocksFetched;
20 | return this;
21 | }
22 |
23 | getReceivedMoney(): bigint {
24 | return this.receivedMoney;
25 | }
26 |
27 | setReceivedMoney(receivedMoney: bigint): MoneroSyncResult {
28 | this.receivedMoney = receivedMoney;
29 | return this;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/ts/wallet/model/MoneroTxPriority.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Enumerates send priorities.
3 | */
4 | enum MoneroTxPriority {
5 |
6 | /**
7 | * Default priority (i.e. normal) (value=0).
8 | */
9 | DEFAULT = 0,
10 |
11 | /**
12 | * Unimportant priority (value=1).
13 | */
14 | UNIMPORTANT = 1,
15 |
16 | /**
17 | * Normal priority (value=2).
18 | */
19 | NORMAL = 2,
20 |
21 | /**
22 | * Elevated priority (value=3).
23 | */
24 | ELEVATED = 3
25 | }
26 |
27 | export default MoneroTxPriority;
--------------------------------------------------------------------------------
/src/main/ts/wallet/model/MoneroWalletListener.ts:
--------------------------------------------------------------------------------
1 | import MoneroOutputWallet from "./MoneroOutputWallet";
2 |
3 | /**
4 | * Default wallet listener which takes no action on notifications.
5 | */
6 | export default class MoneroWalletListener {
7 |
8 | /**
9 | * Invoked as the wallet is synchronized.
10 | *
11 | * @param {number} height - height of the synced block
12 | * @param {number} startHeight - starting height of the sync request
13 | * @param {number} endHeight - ending height of the sync request
14 | * @param {number} percentDone - sync progress as a percentage
15 | * @param {string} message - human-readable description of the current progress
16 | * @return {Promise}
17 | */
18 | async onSyncProgress(height: number, startHeight: number, endHeight: number, percentDone: number, message: string) { }
19 |
20 | /**
21 | * Invoked when a new block is added to the chain.
22 | *
23 | * @param {number} height - the height of the new block (i.e. the number of blocks before it).
24 | * @return {Promise}
25 | */
26 | async onNewBlock(height: number): Promise { }
27 |
28 | /**
29 | * Invoked when the wallet's balances change.
30 | *
31 | * @param {bigint} newBalance - new wallet balance
32 | * @param {bigint} newUnlockedBalance - new unlocked wallet balance
33 | * @return {Promise}
34 | */
35 | async onBalancesChanged(newBalance: bigint, newUnlockedBalance: bigint): Promise { }
36 |
37 | /**
38 | * Invoked 3 times per received output: once when unconfirmed, once when confirmed, and
39 | * once when unlocked.
40 | *
41 | * The notified output includes basic fields only, so the output or its transaction should be fetched to get all available fields.
42 | *
43 | * @param {MoneroOutputWallet} output - the received output
44 | * @return {Promise}
45 | */
46 | async onOutputReceived(output: MoneroOutputWallet): Promise { }
47 |
48 | /**
49 | * Invoked twice per spent output: once when confirmed and once when unlocked.
50 | *
51 | * The notified output includes basic fields only, so the output or its transaction should be fetched to get all available fields.
52 | *
53 | * @param {MoneroOutputWallet} output - the spent output
54 | * @return {Promise}
55 | */
56 | async onOutputSpent(output): Promise { }
57 | }
58 |
--------------------------------------------------------------------------------
/src/test/Scratchpad.ts:
--------------------------------------------------------------------------------
1 | import TestUtils from "./utils/TestUtils";
2 | import WalletSyncPrinter from "./utils/WalletSyncPrinter";
3 | import {connectToDaemonRpc,
4 | connectToWalletRpc,
5 | createWalletFull,
6 | MoneroNetworkType} from "../../index";
7 |
8 | describe("Scratchpad", function() {
9 |
10 | it("Can be scripted easily", async function() {
11 |
12 | // let daemon = await TestUtils.getDaemonRpc();
13 | // let walletRpc = await TestUtils.getWalletRpc();
14 | // let walletFull = await TestUtils.getWalletFull();
15 |
16 | // initialize daemon rpc client
17 | let daemon = await connectToDaemonRpc({
18 | uri: "http://localhost:28081",
19 | username: "superuser",
20 | password: "abctesting123",
21 | proxyToWorker: TestUtils.PROXY_TO_WORKER,
22 | rejectUnauthorized: false
23 | });
24 | console.log("Daemon height: " + await daemon.getHeight());
25 |
26 | // initialize wallet rpc client
27 | let walletRpc = await connectToWalletRpc({
28 | uri: "http://localhost:28084",
29 | username: "rpc_user",
30 | password: "abc123",
31 | rejectUnauthorized: false
32 | });
33 | await walletRpc.openWallet("test_wallet_1", "supersecretpassword123");
34 | console.log("RPC wallet seed: " + await walletRpc.getSeed());
35 |
36 | // create in-memory wallet with mnemonic
37 | let walletFull = await createWalletFull({
38 | //path: "./test_wallets/" + GenUtils.getUUID(), // in-memory wallet if not given
39 | password: "supersecretpassword123",
40 | networkType: MoneroNetworkType.TESTNET,
41 | server: {
42 | uri: "http://localhost:28081",
43 | username: "superuser",
44 | password: "abctesting123",
45 | rejectUnauthorized: false
46 | },
47 | seed: "silk mocked cucumber lettuce hope adrenalin aching lush roles fuel revamp baptism wrist long tender teardrop midst pastry pigment equip frying inbound pinched ravine frying",
48 | restoreHeight: 0,
49 | proxyToWorker: TestUtils.PROXY_TO_WORKER,
50 | });
51 | await walletFull.sync(new WalletSyncPrinter());
52 | console.log("Full wallet daemon height: " + await walletFull.getDaemonHeight());
53 | console.log("Full wallet seed: " + await walletFull.getSeed());
54 | console.log("Wallet balance: " + (await walletFull.getUnlockedBalance()).toString())
55 | await walletFull.close();
56 | });
57 | });
58 |
--------------------------------------------------------------------------------
/src/test/TestAll.ts:
--------------------------------------------------------------------------------
1 | // import test types
2 | import {LibraryUtils} from "../../index";
3 | import TestSampleCode from "./TestSampleCode";
4 | import TestMoneroUtils from "./TestMoneroUtils";
5 | import TestMoneroDaemonRpc from "./TestMoneroDaemonRpc";
6 | import TestMoneroWalletKeys from "./TestMoneroWalletKeys";
7 | import TestMoneroWalletFull from "./TestMoneroWalletFull";
8 | import TestMoneroWalletRpc from "./TestMoneroWalletRpc";
9 | import TestMoneroConnectionManager from "./TestMoneroConnectionManager";
10 |
11 | // set log level
12 | LibraryUtils.setLogLevel(1); // no need for await before worker used
13 |
14 | // test sample code for readme
15 | new TestSampleCode().runTests();
16 |
17 | // test utilitiles
18 | new TestMoneroUtils().runTests();
19 |
20 | // test daemon rpc
21 | new TestMoneroDaemonRpc({
22 | liteMode: false, // skip lengthy but thorough tests if true
23 | testNonRelays: true,
24 | testRelays: true, // creates and relays outgoing txs
25 | testNotifications: true
26 | }).runTests();
27 |
28 | // test keys-only wallet
29 | new TestMoneroWalletKeys({
30 | liteMode: false,
31 | testNonRelays: true,
32 | testRelays: false,
33 | testNotifications: false,
34 | testResets: false
35 | }).runTests();
36 |
37 | // test full wallet
38 | new TestMoneroWalletFull({
39 | liteMode: false,
40 | testNonRelays: true,
41 | testRelays: true,
42 | testNotifications: true,
43 | testResets: false
44 | }).runTests();
45 |
46 | // test wallet rpc
47 | new TestMoneroWalletRpc({
48 | liteMode: false,
49 | testNonRelays: true,
50 | testRelays: true,
51 | testNotifications: true,
52 | testResets: false
53 | }).runTests();
54 |
55 | // test connection manager
56 | new TestMoneroConnectionManager().runTests();
57 |
58 | // test scratchpad
59 | require("./Scratchpad");
60 |
--------------------------------------------------------------------------------
/src/test/browser/localhost-cert.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIFCTCCAvGgAwIBAgIUaGspSGZItzXX0eupxf5iVy6c34swDQYJKoZIhvcNAQEL
3 | BQAwFDESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTIwMDQxMjE0NDcxMFoXDTI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4J0SvuWcp5
20 | LQogzcuh7jE4gYZC9NFb1rXR6EcWJo5FU9s6DlXyZmhaSgyGYH2RpLIofmh201eQ
21 | smCgpfSo3qvKZMXJXumQfnppdZ+ciS27Yy/DBjupAK49SGidtLQp4kKe4RZqaPZX
22 | KFWZXA+I3O8x4k+Z6M0J8RoMdceQ4wofffCxijAwVN3ga6ZpZQV5FJiCEBNAO6/G
23 | fygtbCTsYT2Uk/JwpE32RFjSeUVx1YGGC1SG+q7ywdtNHluE9BqPpzY76dEjE1N6
24 | wyoTiyrp2UgKjMtloW+7lo8tZ5KRV7oT+tec5cx75gHOVJFPqfHOinfjt1ufgvvp
25 | N8tOktxxchl8iyc3cbCgdgFLPWtkmB4QxzRf2qvtGOw/qdcyWctnN4ngPsUyUYFO
26 | O+GR05+g31vde4qR2D8UAyK7F3aADKn6qEqT3hvmsNeHw2fTigaw+Ahi3W5BBe+6
27 | JB7qkAXTV97p+tQ6d7C5HtnQfu7ZQRlePFdtpjid7/WM9xNGvdxXzY5bSYYmIKJU
28 | VgMHfldwSkIcu2sKX3r/NEwI0QR1u1R/tle/3MNYg6X/6XC2DK8vSe0I5zqE
29 | -----END CERTIFICATE-----
30 |
--------------------------------------------------------------------------------
/src/test/browser/tests.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Mocha Tests
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/test/browser/tests.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Run tests when document ready.
3 | */
4 | document.addEventListener("DOMContentLoaded", function() {
5 | runTests();
6 | });
7 |
8 | /**
9 | * Run Monero tests.
10 | */
11 | function runTests() {
12 |
13 | // mocha setup
14 | mocha.setup({
15 | ui: 'bdd',
16 | timeout: 3000000
17 | });
18 | mocha.checkLeaks();
19 |
20 | // override default to run daemon and wallets on main thread
21 | //TestUtils.PROXY_TO_WORKER = false;
22 |
23 | // run tests
24 | require("../TestAll");
25 | mocha.run();
26 | }
27 |
--------------------------------------------------------------------------------
/src/test/utils/RunWalletRpcTestServers.ts:
--------------------------------------------------------------------------------
1 | import TestUtils from "./TestUtils";
2 | import { MoneroWalletRpc } from "../../../index";
3 |
4 | /**
5 | * Utility class to run monero-wallet-rpc test servers until terminated.
6 | */
7 | export default class RunWalletRpcTestServers {
8 |
9 | static async run() {
10 |
11 | // start monero-wallet-rpc servers
12 | console.log("Starting monero-wallet-rpc servers...");
13 | let numProcesses = 10;
14 | let processPromises: Promise[] = [];
15 | for (let i = 0; i < numProcesses; i++) {
16 | processPromises.push(TestUtils.startWalletRpcProcess());
17 | }
18 | let wallets = await Promise.all(processPromises);
19 | console.log("Done starting monero-wallet-rpc servers");
20 |
21 | // close wallets and servers on ctrl+c
22 | process.on("SIGINT", async function() {
23 | console.log("Stopping monero-wallet-rpc servers...");
24 | for (let wallet of wallets) await TestUtils.stopWalletRpcProcess(wallet);
25 | console.log("Stopped monero-wallet-rpc servers");
26 | process.exit(0);
27 | });
28 | }
29 | }
30 |
31 | // run until termination
32 | RunWalletRpcTestServers.run();
33 |
--------------------------------------------------------------------------------
/src/test/utils/StartMining.ts:
--------------------------------------------------------------------------------
1 | import TestUtils from "./TestUtils";
2 |
3 | /**
4 | * Utility class to start mining.
5 | */
6 | export default class StartMining {
7 |
8 | static async startMining(numThreads?: number) {
9 | if (!numThreads) numThreads = 1;
10 | //TestUtils.getWalletRpc().startMining(numThreads, false, true);
11 | let daemon = await TestUtils.getDaemonRpc();
12 | await daemon.startMining("9tsUiG9bwcU7oTbAdBwBk2PzxFtysge5qcEsHEpetmEKgerHQa1fDqH7a4FiquZmms7yM22jdifVAD7jAb2e63GSJMuhY75", numThreads, false, false); // random subaddress
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/test/utils/WalletSyncPrinter.ts:
--------------------------------------------------------------------------------
1 | import { MoneroWalletListener } from "../../../index";
2 |
3 | /**
4 | * Print sync progress every X blocks.
5 | */
6 | export default class WalletSyncPrinter extends MoneroWalletListener {
7 |
8 | nextIncrement: number;
9 | syncResolution: number;
10 |
11 | constructor(syncResolution?: number) {
12 | super();
13 | this.nextIncrement = 0;
14 | this.syncResolution = syncResolution ? syncResolution : .05;
15 | }
16 |
17 | async onSyncProgress(height, startHeight, endHeight, percentDone, message) {
18 | if (percentDone === 1 || percentDone >= this.nextIncrement) {
19 | console.log("onSyncProgress(" + height + ", " + startHeight + ", " + endHeight + ", " + percentDone + ", " + message + ")");
20 | this.nextIncrement += this.syncResolution;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "declaration": true,
4 | "module": "es2022",
5 | "target": "es2021",
6 | "allowJs": true,
7 | "outDir": "dist",
8 | "skipLibCheck": true,
9 | "types": [
10 | "mocha",
11 | "node",
12 | "jquery"
13 | ],
14 | "esModuleInterop": true,
15 | "forceConsistentCasingInFileNames": true,
16 | "strict": true,
17 | "noImplicitAny": false,
18 | "noImplicitThis": false,
19 | "strictNullChecks": false,
20 | "moduleResolution": "node",
21 | "resolveJsonModule": true
22 | },
23 | "include": ["index.ts", "src/**/*"],
24 | "exclude": ["node_modules", "dist/*", "types"]
25 | }
--------------------------------------------------------------------------------
/webpack.base.js:
--------------------------------------------------------------------------------
1 | "use strict"
2 |
3 | const path = require("path");
4 | const webpack = require('webpack')
5 |
6 | let configBase = {
7 | mode: 'production',
8 | module: {
9 | rules: [
10 | {
11 | test: /\.ts?$/,
12 | loader: 'ts-loader',
13 | exclude: /node_modules/
14 | },
15 | {
16 | test: /\.js$/,
17 | exclude: path.join(__dirname, 'node_modules'),
18 | type: "javascript/auto",
19 | use: [
20 | {
21 | loader: 'babel-loader',
22 | options: {
23 | cacheDirectory: false
24 | }
25 | }
26 | ]
27 | }
28 | ]
29 | },
30 | devtool: 'source-map',
31 | externals: ['worker_threads', 'ws', 'perf_hooks', 'child_process', 'web-worker'], // exclude nodejs dependencies
32 | plugins: [
33 | new webpack.ProvidePlugin({
34 | process: 'process/browser',
35 | Buffer: ['buffer', 'Buffer']
36 | }),
37 | ],
38 | resolve: {
39 | extensions: ['.js', '.ts'],
40 | alias: {
41 | "fs": "memfs",
42 | },
43 | extensions: ['.js', '.jsx', '.css', '.json', 'otf', 'ttf', 'eot', 'svg', '.ts', '.tsx'],
44 | modules: [
45 | 'node_modules',
46 | ],
47 | fallback: { // browser polyfills
48 | assert: require.resolve('assert'),
49 | //buffer: require.resolve('buffer'),
50 | //console: require.resolve('console-browserify'),
51 | //constants: require.resolve('constants-browserify'),
52 | crypto: require.resolve('crypto-browserify'),
53 | //domain: require.resolve('domain-browser'),
54 | //events: require.resolve('events'),
55 | http: require.resolve('stream-http'),
56 | https: require.resolve('https-browserify'),
57 | os: require.resolve('os-browserify/browser'),
58 | path: require.resolve('path-browserify'),
59 | //punycode: require.resolve('punycode'),
60 | 'process/browser': require.resolve('process/browser'),
61 | querystring: require.resolve('querystring-es3'),
62 | stream: require.resolve('stream-browserify'),
63 | //string_decoder: require.resolve('string_decoder'),
64 | //sys: require.resolve('util'),
65 | //timers: require.resolve('timers-browserify'),
66 | //tty: require.resolve('tty-browserify'),
67 | url: require.resolve('url'),
68 | util: require.resolve('util'),
69 | //vm: require.resolve('vm-browserify'),
70 | zlib: require.resolve('browserify-zlib')
71 | }
72 | },
73 | cache: true,
74 | context: __dirname
75 | };
76 |
77 | module.exports = configBase;
--------------------------------------------------------------------------------
/webpack.tests.js:
--------------------------------------------------------------------------------
1 | "use strict"
2 |
3 | const path = require("path");
4 | const configBase = require("./webpack.base.js");
5 |
6 | let configBrowserTest = Object.assign({}, configBase, {
7 | name: "Browser tests config",
8 | entry: "./dist/src/test/browser/tests.js",
9 | output: {
10 | path: path.resolve(__dirname, "browser_build"),
11 | filename: "monero.tests.js"
12 | },
13 | });
14 |
15 | module.exports = configBrowserTest;
--------------------------------------------------------------------------------
/webpack.worker.js:
--------------------------------------------------------------------------------
1 | "use strict"
2 |
3 | const path = require("path");
4 | const configBase = require("./webpack.base.js");
5 |
6 | let configMoneroWebWorker = Object.assign({}, configBase, {
7 | name: "Monero web worker config",
8 | entry: "./src/main/ts/common/MoneroWebWorker.ts",
9 | output: {
10 | path: path.resolve(__dirname, "dist"),
11 | filename: "monero.worker.js"
12 | },
13 | });
14 |
15 | module.exports = configMoneroWebWorker;
--------------------------------------------------------------------------------