update dist

This commit is contained in:
woodser 2025-01-19 09:57:25 -05:00
parent 42656e2d63
commit 38ee63cdf4
13 changed files with 1425 additions and 1386 deletions

View File

@ -219,11 +219,11 @@ export default class HavenoClient {
*/ */
stopCheckingConnection(): Promise<void>; stopCheckingConnection(): Promise<void>;
/** /**
* Get the best available connection in order of priority then response time. * Get the best connection in order of priority then response time.
* *
* @return {UrlConnection | undefined} the best available connection in order of priority then response time, undefined if no connections available * @return {UrlConnection | undefined} the best connection in order of priority then response time, undefined if no connections
*/ */
getBestAvailableConnection(): Promise<UrlConnection | undefined>; getBestConnection(): Promise<UrlConnection | undefined>;
/** /**
* Automatically switch to the best available connection if current connection is disconnected after being checked. * Automatically switch to the best available connection if current connection is disconnected after being checked.
* *
@ -328,9 +328,9 @@ export default class HavenoClient {
* Get the current market price per 1 XMR in the given currency. * Get the current market price per 1 XMR in the given currency.
* *
* @param {string} assetCode - asset code to get the price of * @param {string} assetCode - asset code to get the price of
* @return {number} the price of the asset per 1 XMR * @return {number|undefined} the price of the asset per 1 XMR
*/ */
getPrice(assetCode: string): Promise<number>; getPrice(assetCode: string): Promise<number | undefined>;
/** /**
* Get the current market prices of all a. * Get the current market prices of all a.
* *

23
dist/HavenoClient.js vendored
View File

@ -537,13 +537,13 @@ class HavenoClient {
} }
} }
/** /**
* Get the best available connection in order of priority then response time. * Get the best connection in order of priority then response time.
* *
* @return {UrlConnection | undefined} the best available connection in order of priority then response time, undefined if no connections available * @return {UrlConnection | undefined} the best connection in order of priority then response time, undefined if no connections
*/ */
async getBestAvailableConnection() { async getBestConnection() {
try { try {
return (await this._xmrConnectionsClient.getBestAvailableConnection(new grpc_pb_1.GetBestAvailableConnectionRequest(), { password: this._password })).getConnection(); return (await this._xmrConnectionsClient.getBestConnection(new grpc_pb_1.GetBestConnectionRequest(), { password: this._password })).getConnection();
} }
catch (e) { catch (e) {
throw new HavenoError_1.default(e.message, e.code); throw new HavenoError_1.default(e.message, e.code);
@ -775,13 +775,15 @@ class HavenoClient {
* Get the current market price per 1 XMR in the given currency. * Get the current market price per 1 XMR in the given currency.
* *
* @param {string} assetCode - asset code to get the price of * @param {string} assetCode - asset code to get the price of
* @return {number} the price of the asset per 1 XMR * @return {number|undefined} the price of the asset per 1 XMR
*/ */
async getPrice(assetCode) { async getPrice(assetCode) {
try { try {
return (await this._priceClient.getMarketPrice(new grpc_pb_1.MarketPriceRequest().setCurrencyCode(assetCode), { password: this._password })).getPrice(); return (await this._priceClient.getMarketPrice(new grpc_pb_1.MarketPriceRequest().setCurrencyCode(assetCode), { password: this._password })).getPrice();
} }
catch (e) { catch (e) {
if (e.message.indexOf("not found") >= 0)
return undefined; // TODO: return unknown price server side (0?)
throw new HavenoError_1.default(e.message, e.code); throw new HavenoError_1.default(e.message, e.code);
} }
} }
@ -1305,7 +1307,16 @@ class HavenoClient {
await HavenoUtils_1.default.kill(this._process); await HavenoUtils_1.default.kill(this._process);
} }
catch (e) { catch (e) {
throw new HavenoError_1.default(e.message, e.code); console_1.default.error("Error gracefully shutting down havenod: " + e.message);
if (this._process) {
try {
await HavenoUtils_1.default.kill(this._process);
}
catch (e) {
console_1.default.error("Error terminating havenod process: " + e.message + ". Stopping forcefully");
await HavenoUtils_1.default.kill(this._process, "SIGKILL");
}
}
} }
} }
// ------------------------------- HELPERS ---------------------------------- // ------------------------------- HELPERS ----------------------------------

File diff suppressed because one or more lines are too long

View File

@ -197,9 +197,9 @@ export declare class XmrConnectionsClient {
methodDescriptorStopCheckingConnection: grpcWeb.MethodDescriptor<grpc_pb.StopCheckingConnectionRequest, grpc_pb.StopCheckingConnectionReply>; methodDescriptorStopCheckingConnection: grpcWeb.MethodDescriptor<grpc_pb.StopCheckingConnectionRequest, grpc_pb.StopCheckingConnectionReply>;
stopCheckingConnection(request: grpc_pb.StopCheckingConnectionRequest, metadata?: grpcWeb.Metadata | null): Promise<grpc_pb.StopCheckingConnectionReply>; stopCheckingConnection(request: grpc_pb.StopCheckingConnectionRequest, metadata?: grpcWeb.Metadata | null): Promise<grpc_pb.StopCheckingConnectionReply>;
stopCheckingConnection(request: grpc_pb.StopCheckingConnectionRequest, metadata: grpcWeb.Metadata | null, callback: (err: grpcWeb.RpcError, response: grpc_pb.StopCheckingConnectionReply) => void): grpcWeb.ClientReadableStream<grpc_pb.StopCheckingConnectionReply>; stopCheckingConnection(request: grpc_pb.StopCheckingConnectionRequest, metadata: grpcWeb.Metadata | null, callback: (err: grpcWeb.RpcError, response: grpc_pb.StopCheckingConnectionReply) => void): grpcWeb.ClientReadableStream<grpc_pb.StopCheckingConnectionReply>;
methodDescriptorGetBestAvailableConnection: grpcWeb.MethodDescriptor<grpc_pb.GetBestAvailableConnectionRequest, grpc_pb.GetBestAvailableConnectionReply>; methodDescriptorGetBestConnection: grpcWeb.MethodDescriptor<grpc_pb.GetBestConnectionRequest, grpc_pb.GetBestConnectionReply>;
getBestAvailableConnection(request: grpc_pb.GetBestAvailableConnectionRequest, metadata?: grpcWeb.Metadata | null): Promise<grpc_pb.GetBestAvailableConnectionReply>; getBestConnection(request: grpc_pb.GetBestConnectionRequest, metadata?: grpcWeb.Metadata | null): Promise<grpc_pb.GetBestConnectionReply>;
getBestAvailableConnection(request: grpc_pb.GetBestAvailableConnectionRequest, metadata: grpcWeb.Metadata | null, callback: (err: grpcWeb.RpcError, response: grpc_pb.GetBestAvailableConnectionReply) => void): grpcWeb.ClientReadableStream<grpc_pb.GetBestAvailableConnectionReply>; getBestConnection(request: grpc_pb.GetBestConnectionRequest, metadata: grpcWeb.Metadata | null, callback: (err: grpcWeb.RpcError, response: grpc_pb.GetBestConnectionReply) => void): grpcWeb.ClientReadableStream<grpc_pb.GetBestConnectionReply>;
methodDescriptorSetAutoSwitch: grpcWeb.MethodDescriptor<grpc_pb.SetAutoSwitchRequest, grpc_pb.SetAutoSwitchReply>; methodDescriptorSetAutoSwitch: grpcWeb.MethodDescriptor<grpc_pb.SetAutoSwitchRequest, grpc_pb.SetAutoSwitchReply>;
setAutoSwitch(request: grpc_pb.SetAutoSwitchRequest, metadata?: grpcWeb.Metadata | null): Promise<grpc_pb.SetAutoSwitchReply>; setAutoSwitch(request: grpc_pb.SetAutoSwitchRequest, metadata?: grpcWeb.Metadata | null): Promise<grpc_pb.SetAutoSwitchReply>;
setAutoSwitch(request: grpc_pb.SetAutoSwitchRequest, metadata: grpcWeb.Metadata | null, callback: (err: grpcWeb.RpcError, response: grpc_pb.SetAutoSwitchReply) => void): grpcWeb.ClientReadableStream<grpc_pb.SetAutoSwitchReply>; setAutoSwitch(request: grpc_pb.SetAutoSwitchRequest, metadata: grpcWeb.Metadata | null, callback: (err: grpcWeb.RpcError, response: grpc_pb.SetAutoSwitchReply) => void): grpcWeb.ClientReadableStream<grpc_pb.SetAutoSwitchReply>;

View File

@ -32,7 +32,7 @@ exports.WalletsClient = exports.TradesClient = exports.ShutdownServerClient = ex
// Code generated by protoc-gen-grpc-web. DO NOT EDIT. // Code generated by protoc-gen-grpc-web. DO NOT EDIT.
// versions: // versions:
// protoc-gen-grpc-web v1.5.0 // protoc-gen-grpc-web v1.5.0
// protoc v3.20.3 // protoc v5.29.3
// source: grpc.proto // source: grpc.proto
/* eslint-disable */ /* eslint-disable */
// @ts-nocheck // @ts-nocheck
@ -374,9 +374,9 @@ class XmrConnectionsClient {
this.methodDescriptorStopCheckingConnection = new grpcWeb.MethodDescriptor('/io.haveno.protobuffer.XmrConnections/StopCheckingConnection', grpcWeb.MethodType.UNARY, grpc_pb.StopCheckingConnectionRequest, grpc_pb.StopCheckingConnectionReply, (request) => { this.methodDescriptorStopCheckingConnection = new grpcWeb.MethodDescriptor('/io.haveno.protobuffer.XmrConnections/StopCheckingConnection', grpcWeb.MethodType.UNARY, grpc_pb.StopCheckingConnectionRequest, grpc_pb.StopCheckingConnectionReply, (request) => {
return request.serializeBinary(); return request.serializeBinary();
}, grpc_pb.StopCheckingConnectionReply.deserializeBinary); }, grpc_pb.StopCheckingConnectionReply.deserializeBinary);
this.methodDescriptorGetBestAvailableConnection = new grpcWeb.MethodDescriptor('/io.haveno.protobuffer.XmrConnections/GetBestAvailableConnection', grpcWeb.MethodType.UNARY, grpc_pb.GetBestAvailableConnectionRequest, grpc_pb.GetBestAvailableConnectionReply, (request) => { this.methodDescriptorGetBestConnection = new grpcWeb.MethodDescriptor('/io.haveno.protobuffer.XmrConnections/GetBestConnection', grpcWeb.MethodType.UNARY, grpc_pb.GetBestConnectionRequest, grpc_pb.GetBestConnectionReply, (request) => {
return request.serializeBinary(); return request.serializeBinary();
}, grpc_pb.GetBestAvailableConnectionReply.deserializeBinary); }, grpc_pb.GetBestConnectionReply.deserializeBinary);
this.methodDescriptorSetAutoSwitch = new grpcWeb.MethodDescriptor('/io.haveno.protobuffer.XmrConnections/SetAutoSwitch', grpcWeb.MethodType.UNARY, grpc_pb.SetAutoSwitchRequest, grpc_pb.SetAutoSwitchReply, (request) => { this.methodDescriptorSetAutoSwitch = new grpcWeb.MethodDescriptor('/io.haveno.protobuffer.XmrConnections/SetAutoSwitch', grpcWeb.MethodType.UNARY, grpc_pb.SetAutoSwitchRequest, grpc_pb.SetAutoSwitchReply, (request) => {
return request.serializeBinary(); return request.serializeBinary();
}, grpc_pb.SetAutoSwitchReply.deserializeBinary); }, grpc_pb.SetAutoSwitchReply.deserializeBinary);
@ -465,13 +465,13 @@ class XmrConnectionsClient {
return this.client_.unaryCall(this.hostname_ + return this.client_.unaryCall(this.hostname_ +
'/io.haveno.protobuffer.XmrConnections/StopCheckingConnection', request, metadata || {}, this.methodDescriptorStopCheckingConnection); '/io.haveno.protobuffer.XmrConnections/StopCheckingConnection', request, metadata || {}, this.methodDescriptorStopCheckingConnection);
} }
getBestAvailableConnection(request, metadata, callback) { getBestConnection(request, metadata, callback) {
if (callback !== undefined) { if (callback !== undefined) {
return this.client_.rpcCall(this.hostname_ + return this.client_.rpcCall(this.hostname_ +
'/io.haveno.protobuffer.XmrConnections/GetBestAvailableConnection', request, metadata || {}, this.methodDescriptorGetBestAvailableConnection, callback); '/io.haveno.protobuffer.XmrConnections/GetBestConnection', request, metadata || {}, this.methodDescriptorGetBestConnection, callback);
} }
return this.client_.unaryCall(this.hostname_ + return this.client_.unaryCall(this.hostname_ +
'/io.haveno.protobuffer.XmrConnections/GetBestAvailableConnection', request, metadata || {}, this.methodDescriptorGetBestAvailableConnection); '/io.haveno.protobuffer.XmrConnections/GetBestConnection', request, metadata || {}, this.methodDescriptorGetBestConnection);
} }
setAutoSwitch(request, metadata, callback) { setAutoSwitch(request, metadata, callback) {
if (callback !== undefined) { if (callback !== undefined) {

File diff suppressed because one or more lines are too long

View File

@ -1117,35 +1117,35 @@ export namespace StopCheckingConnectionReply {
} }
} }
export class GetBestAvailableConnectionRequest extends jspb.Message { export class GetBestConnectionRequest extends jspb.Message {
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetBestAvailableConnectionRequest.AsObject; toObject(includeInstance?: boolean): GetBestConnectionRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetBestAvailableConnectionRequest): GetBestAvailableConnectionRequest.AsObject; static toObject(includeInstance: boolean, msg: GetBestConnectionRequest): GetBestConnectionRequest.AsObject;
static serializeBinaryToWriter(message: GetBestAvailableConnectionRequest, writer: jspb.BinaryWriter): void; static serializeBinaryToWriter(message: GetBestConnectionRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetBestAvailableConnectionRequest; static deserializeBinary(bytes: Uint8Array): GetBestConnectionRequest;
static deserializeBinaryFromReader(message: GetBestAvailableConnectionRequest, reader: jspb.BinaryReader): GetBestAvailableConnectionRequest; static deserializeBinaryFromReader(message: GetBestConnectionRequest, reader: jspb.BinaryReader): GetBestConnectionRequest;
} }
export namespace GetBestAvailableConnectionRequest { export namespace GetBestConnectionRequest {
export type AsObject = { export type AsObject = {
} }
} }
export class GetBestAvailableConnectionReply extends jspb.Message { export class GetBestConnectionReply extends jspb.Message {
getConnection(): UrlConnection | undefined; getConnection(): UrlConnection | undefined;
setConnection(value?: UrlConnection): GetBestAvailableConnectionReply; setConnection(value?: UrlConnection): GetBestConnectionReply;
hasConnection(): boolean; hasConnection(): boolean;
clearConnection(): GetBestAvailableConnectionReply; clearConnection(): GetBestConnectionReply;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetBestAvailableConnectionReply.AsObject; toObject(includeInstance?: boolean): GetBestConnectionReply.AsObject;
static toObject(includeInstance: boolean, msg: GetBestAvailableConnectionReply): GetBestAvailableConnectionReply.AsObject; static toObject(includeInstance: boolean, msg: GetBestConnectionReply): GetBestConnectionReply.AsObject;
static serializeBinaryToWriter(message: GetBestAvailableConnectionReply, writer: jspb.BinaryWriter): void; static serializeBinaryToWriter(message: GetBestConnectionReply, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetBestAvailableConnectionReply; static deserializeBinary(bytes: Uint8Array): GetBestConnectionReply;
static deserializeBinaryFromReader(message: GetBestAvailableConnectionReply, reader: jspb.BinaryReader): GetBestAvailableConnectionReply; static deserializeBinaryFromReader(message: GetBestConnectionReply, reader: jspb.BinaryReader): GetBestConnectionReply;
} }
export namespace GetBestAvailableConnectionReply { export namespace GetBestConnectionReply {
export type AsObject = { export type AsObject = {
connection?: UrlConnection.AsObject, connection?: UrlConnection.AsObject,
} }

View File

@ -13,7 +13,13 @@
var jspb = require('google-protobuf'); var jspb = require('google-protobuf');
var goog = jspb; var goog = jspb;
var global = (function() { return this || window || global || self || Function('return this')(); }).call(null); var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();
var pb_pb = require('./pb_pb.js'); var pb_pb = require('./pb_pb.js');
goog.object.extend(proto, pb_pb); goog.object.extend(proto, pb_pb);
@ -62,8 +68,8 @@ goog.exportSymbol('proto.io.haveno.protobuffer.GetAutoSwitchReply', null, global
goog.exportSymbol('proto.io.haveno.protobuffer.GetAutoSwitchRequest', null, global); goog.exportSymbol('proto.io.haveno.protobuffer.GetAutoSwitchRequest', null, global);
goog.exportSymbol('proto.io.haveno.protobuffer.GetBalancesReply', null, global); goog.exportSymbol('proto.io.haveno.protobuffer.GetBalancesReply', null, global);
goog.exportSymbol('proto.io.haveno.protobuffer.GetBalancesRequest', null, global); goog.exportSymbol('proto.io.haveno.protobuffer.GetBalancesRequest', null, global);
goog.exportSymbol('proto.io.haveno.protobuffer.GetBestAvailableConnectionReply', null, global); goog.exportSymbol('proto.io.haveno.protobuffer.GetBestConnectionReply', null, global);
goog.exportSymbol('proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest', null, global); goog.exportSymbol('proto.io.haveno.protobuffer.GetBestConnectionRequest', null, global);
goog.exportSymbol('proto.io.haveno.protobuffer.GetChatMessagesReply', null, global); goog.exportSymbol('proto.io.haveno.protobuffer.GetChatMessagesReply', null, global);
goog.exportSymbol('proto.io.haveno.protobuffer.GetChatMessagesRequest', null, global); goog.exportSymbol('proto.io.haveno.protobuffer.GetChatMessagesRequest', null, global);
goog.exportSymbol('proto.io.haveno.protobuffer.GetConnectionReply', null, global); goog.exportSymbol('proto.io.haveno.protobuffer.GetConnectionReply', null, global);
@ -1486,16 +1492,16 @@ if (goog.DEBUG && !COMPILED) {
* @extends {jspb.Message} * @extends {jspb.Message}
* @constructor * @constructor
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest = function(opt_data) { proto.io.haveno.protobuffer.GetBestConnectionRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null); jspb.Message.initialize(this, opt_data, 0, -1, null, null);
}; };
goog.inherits(proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest, jspb.Message); goog.inherits(proto.io.haveno.protobuffer.GetBestConnectionRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) { if (goog.DEBUG && !COMPILED) {
/** /**
* @public * @public
* @override * @override
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest.displayName = 'proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest'; proto.io.haveno.protobuffer.GetBestConnectionRequest.displayName = 'proto.io.haveno.protobuffer.GetBestConnectionRequest';
} }
/** /**
* Generated by JsPbCodeGenerator. * Generated by JsPbCodeGenerator.
@ -1507,16 +1513,16 @@ if (goog.DEBUG && !COMPILED) {
* @extends {jspb.Message} * @extends {jspb.Message}
* @constructor * @constructor
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionReply = function(opt_data) { proto.io.haveno.protobuffer.GetBestConnectionReply = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null); jspb.Message.initialize(this, opt_data, 0, -1, null, null);
}; };
goog.inherits(proto.io.haveno.protobuffer.GetBestAvailableConnectionReply, jspb.Message); goog.inherits(proto.io.haveno.protobuffer.GetBestConnectionReply, jspb.Message);
if (goog.DEBUG && !COMPILED) { if (goog.DEBUG && !COMPILED) {
/** /**
* @public * @public
* @override * @override
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.displayName = 'proto.io.haveno.protobuffer.GetBestAvailableConnectionReply'; proto.io.haveno.protobuffer.GetBestConnectionReply.displayName = 'proto.io.haveno.protobuffer.GetBestConnectionReply';
} }
/** /**
* Generated by JsPbCodeGenerator. * Generated by JsPbCodeGenerator.
@ -11951,8 +11957,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) {
* http://goto/soy-param-migration * http://goto/soy-param-migration
* @return {!Object} * @return {!Object}
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest.prototype.toObject = function(opt_includeInstance) { proto.io.haveno.protobuffer.GetBestConnectionRequest.prototype.toObject = function(opt_includeInstance) {
return proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest.toObject(opt_includeInstance, this); return proto.io.haveno.protobuffer.GetBestConnectionRequest.toObject(opt_includeInstance, this);
}; };
@ -11961,11 +11967,11 @@ proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest.prototype.toObject
* @param {boolean|undefined} includeInstance Deprecated. Whether to include * @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support: * the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration * http://goto/soy-param-migration
* @param {!proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest} msg The msg instance to transform. * @param {!proto.io.haveno.protobuffer.GetBestConnectionRequest} msg The msg instance to transform.
* @return {!Object} * @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest.toObject = function(includeInstance, msg) { proto.io.haveno.protobuffer.GetBestConnectionRequest.toObject = function(includeInstance, msg) {
var f, obj = { var f, obj = {
}; };
@ -11981,23 +11987,23 @@ proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest.toObject = functio
/** /**
* Deserializes binary data (in protobuf wire format). * Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize. * @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest} * @return {!proto.io.haveno.protobuffer.GetBestConnectionRequest}
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest.deserializeBinary = function(bytes) { proto.io.haveno.protobuffer.GetBestConnectionRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes); var reader = new jspb.BinaryReader(bytes);
var msg = new proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest; var msg = new proto.io.haveno.protobuffer.GetBestConnectionRequest;
return proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest.deserializeBinaryFromReader(msg, reader); return proto.io.haveno.protobuffer.GetBestConnectionRequest.deserializeBinaryFromReader(msg, reader);
}; };
/** /**
* Deserializes binary data (in protobuf wire format) from the * Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object. * given reader into the given message object.
* @param {!proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest} msg The message object to deserialize into. * @param {!proto.io.haveno.protobuffer.GetBestConnectionRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use. * @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest} * @return {!proto.io.haveno.protobuffer.GetBestConnectionRequest}
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest.deserializeBinaryFromReader = function(msg, reader) { proto.io.haveno.protobuffer.GetBestConnectionRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) { while (reader.nextField()) {
if (reader.isEndGroup()) { if (reader.isEndGroup()) {
break; break;
@ -12017,9 +12023,9 @@ proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest.deserializeBinaryF
* Serializes the message to binary data (in protobuf wire format). * Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array} * @return {!Uint8Array}
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest.prototype.serializeBinary = function() { proto.io.haveno.protobuffer.GetBestConnectionRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter(); var writer = new jspb.BinaryWriter();
proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest.serializeBinaryToWriter(this, writer); proto.io.haveno.protobuffer.GetBestConnectionRequest.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer(); return writer.getResultBuffer();
}; };
@ -12027,11 +12033,11 @@ proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest.prototype.serializ
/** /**
* Serializes the given message to binary data (in protobuf wire * Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter. * format), writing to the given BinaryWriter.
* @param {!proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest} message * @param {!proto.io.haveno.protobuffer.GetBestConnectionRequest} message
* @param {!jspb.BinaryWriter} writer * @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionRequest.serializeBinaryToWriter = function(message, writer) { proto.io.haveno.protobuffer.GetBestConnectionRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined; var f = undefined;
}; };
@ -12052,8 +12058,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) {
* http://goto/soy-param-migration * http://goto/soy-param-migration
* @return {!Object} * @return {!Object}
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.prototype.toObject = function(opt_includeInstance) { proto.io.haveno.protobuffer.GetBestConnectionReply.prototype.toObject = function(opt_includeInstance) {
return proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.toObject(opt_includeInstance, this); return proto.io.haveno.protobuffer.GetBestConnectionReply.toObject(opt_includeInstance, this);
}; };
@ -12062,11 +12068,11 @@ proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.prototype.toObject =
* @param {boolean|undefined} includeInstance Deprecated. Whether to include * @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support: * the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration * http://goto/soy-param-migration
* @param {!proto.io.haveno.protobuffer.GetBestAvailableConnectionReply} msg The msg instance to transform. * @param {!proto.io.haveno.protobuffer.GetBestConnectionReply} msg The msg instance to transform.
* @return {!Object} * @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.toObject = function(includeInstance, msg) { proto.io.haveno.protobuffer.GetBestConnectionReply.toObject = function(includeInstance, msg) {
var f, obj = { var f, obj = {
connection: (f = msg.getConnection()) && proto.io.haveno.protobuffer.UrlConnection.toObject(includeInstance, f) connection: (f = msg.getConnection()) && proto.io.haveno.protobuffer.UrlConnection.toObject(includeInstance, f)
}; };
@ -12082,23 +12088,23 @@ proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.toObject = function(
/** /**
* Deserializes binary data (in protobuf wire format). * Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize. * @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.io.haveno.protobuffer.GetBestAvailableConnectionReply} * @return {!proto.io.haveno.protobuffer.GetBestConnectionReply}
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.deserializeBinary = function(bytes) { proto.io.haveno.protobuffer.GetBestConnectionReply.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes); var reader = new jspb.BinaryReader(bytes);
var msg = new proto.io.haveno.protobuffer.GetBestAvailableConnectionReply; var msg = new proto.io.haveno.protobuffer.GetBestConnectionReply;
return proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.deserializeBinaryFromReader(msg, reader); return proto.io.haveno.protobuffer.GetBestConnectionReply.deserializeBinaryFromReader(msg, reader);
}; };
/** /**
* Deserializes binary data (in protobuf wire format) from the * Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object. * given reader into the given message object.
* @param {!proto.io.haveno.protobuffer.GetBestAvailableConnectionReply} msg The message object to deserialize into. * @param {!proto.io.haveno.protobuffer.GetBestConnectionReply} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use. * @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.io.haveno.protobuffer.GetBestAvailableConnectionReply} * @return {!proto.io.haveno.protobuffer.GetBestConnectionReply}
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.deserializeBinaryFromReader = function(msg, reader) { proto.io.haveno.protobuffer.GetBestConnectionReply.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) { while (reader.nextField()) {
if (reader.isEndGroup()) { if (reader.isEndGroup()) {
break; break;
@ -12123,9 +12129,9 @@ proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.deserializeBinaryFro
* Serializes the message to binary data (in protobuf wire format). * Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array} * @return {!Uint8Array}
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.prototype.serializeBinary = function() { proto.io.haveno.protobuffer.GetBestConnectionReply.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter(); var writer = new jspb.BinaryWriter();
proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.serializeBinaryToWriter(this, writer); proto.io.haveno.protobuffer.GetBestConnectionReply.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer(); return writer.getResultBuffer();
}; };
@ -12133,11 +12139,11 @@ proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.prototype.serializeB
/** /**
* Serializes the given message to binary data (in protobuf wire * Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter. * format), writing to the given BinaryWriter.
* @param {!proto.io.haveno.protobuffer.GetBestAvailableConnectionReply} message * @param {!proto.io.haveno.protobuffer.GetBestConnectionReply} message
* @param {!jspb.BinaryWriter} writer * @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.serializeBinaryToWriter = function(message, writer) { proto.io.haveno.protobuffer.GetBestConnectionReply.serializeBinaryToWriter = function(message, writer) {
var f = undefined; var f = undefined;
f = message.getConnection(); f = message.getConnection();
if (f != null) { if (f != null) {
@ -12154,7 +12160,7 @@ proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.serializeBinaryToWri
* optional UrlConnection connection = 1; * optional UrlConnection connection = 1;
* @return {?proto.io.haveno.protobuffer.UrlConnection} * @return {?proto.io.haveno.protobuffer.UrlConnection}
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.prototype.getConnection = function() { proto.io.haveno.protobuffer.GetBestConnectionReply.prototype.getConnection = function() {
return /** @type{?proto.io.haveno.protobuffer.UrlConnection} */ ( return /** @type{?proto.io.haveno.protobuffer.UrlConnection} */ (
jspb.Message.getWrapperField(this, proto.io.haveno.protobuffer.UrlConnection, 1)); jspb.Message.getWrapperField(this, proto.io.haveno.protobuffer.UrlConnection, 1));
}; };
@ -12162,18 +12168,18 @@ proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.prototype.getConnect
/** /**
* @param {?proto.io.haveno.protobuffer.UrlConnection|undefined} value * @param {?proto.io.haveno.protobuffer.UrlConnection|undefined} value
* @return {!proto.io.haveno.protobuffer.GetBestAvailableConnectionReply} returns this * @return {!proto.io.haveno.protobuffer.GetBestConnectionReply} returns this
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.prototype.setConnection = function(value) { proto.io.haveno.protobuffer.GetBestConnectionReply.prototype.setConnection = function(value) {
return jspb.Message.setWrapperField(this, 1, value); return jspb.Message.setWrapperField(this, 1, value);
}; };
/** /**
* Clears the message field making it undefined. * Clears the message field making it undefined.
* @return {!proto.io.haveno.protobuffer.GetBestAvailableConnectionReply} returns this * @return {!proto.io.haveno.protobuffer.GetBestConnectionReply} returns this
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.prototype.clearConnection = function() { proto.io.haveno.protobuffer.GetBestConnectionReply.prototype.clearConnection = function() {
return this.setConnection(undefined); return this.setConnection(undefined);
}; };
@ -12182,7 +12188,7 @@ proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.prototype.clearConne
* Returns whether this field is set. * Returns whether this field is set.
* @return {boolean} * @return {boolean}
*/ */
proto.io.haveno.protobuffer.GetBestAvailableConnectionReply.prototype.hasConnection = function() { proto.io.haveno.protobuffer.GetBestConnectionReply.prototype.hasConnection = function() {
return jspb.Message.getField(this, 1) != null; return jspb.Message.getField(this, 1) != null;
}; };

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,13 @@
var jspb = require('google-protobuf'); var jspb = require('google-protobuf');
var goog = jspb; var goog = jspb;
var global = (function() { return this || window || global || self || Function('return this')(); }).call(null); var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();
goog.exportSymbol('proto.io.haveno.protobuffer.AccountAgeWitness', null, global); goog.exportSymbol('proto.io.haveno.protobuffer.AccountAgeWitness', null, global);
goog.exportSymbol('proto.io.haveno.protobuffer.AccountAgeWitnessStore', null, global); goog.exportSymbol('proto.io.haveno.protobuffer.AccountAgeWitnessStore', null, global);
@ -8775,7 +8781,8 @@ proto.io.haveno.protobuffer.GetInventoryResponse.prototype.getInventoryMap = fun
*/ */
proto.io.haveno.protobuffer.GetInventoryResponse.prototype.clearInventoryMap = function() { proto.io.haveno.protobuffer.GetInventoryResponse.prototype.clearInventoryMap = function() {
this.getInventoryMap().clear(); this.getInventoryMap().clear();
return this;}; return this;
};
@ -20771,7 +20778,8 @@ proto.io.haveno.protobuffer.RemovedPayloadsMap.prototype.getDateByHashesMap = fu
*/ */
proto.io.haveno.protobuffer.RemovedPayloadsMap.prototype.clearDateByHashesMap = function() { proto.io.haveno.protobuffer.RemovedPayloadsMap.prototype.clearDateByHashesMap = function() {
this.getDateByHashesMap().clear(); this.getDateByHashesMap().clear();
return this;}; return this;
};
@ -20904,7 +20912,8 @@ proto.io.haveno.protobuffer.IgnoredMailboxMap.prototype.getDataMap = function(op
*/ */
proto.io.haveno.protobuffer.IgnoredMailboxMap.prototype.clearDataMap = function() { proto.io.haveno.protobuffer.IgnoredMailboxMap.prototype.clearDataMap = function() {
this.getDataMap().clear(); this.getDataMap().clear();
return this;}; return this;
};
@ -22034,7 +22043,8 @@ proto.io.haveno.protobuffer.Alert.prototype.getExtraDataMap = function(opt_noLaz
*/ */
proto.io.haveno.protobuffer.Alert.prototype.clearExtraDataMap = function() { proto.io.haveno.protobuffer.Alert.prototype.clearExtraDataMap = function() {
this.getExtraDataMap().clear(); this.getExtraDataMap().clear();
return this;}; return this;
};
/** /**
@ -22517,7 +22527,8 @@ proto.io.haveno.protobuffer.Arbitrator.prototype.getExtraDataMap = function(opt_
*/ */
proto.io.haveno.protobuffer.Arbitrator.prototype.clearExtraDataMap = function() { proto.io.haveno.protobuffer.Arbitrator.prototype.clearExtraDataMap = function() {
this.getExtraDataMap().clear(); this.getExtraDataMap().clear();
return this;}; return this;
};
@ -22982,7 +22993,8 @@ proto.io.haveno.protobuffer.Mediator.prototype.getExtraDataMap = function(opt_no
*/ */
proto.io.haveno.protobuffer.Mediator.prototype.clearExtraDataMap = function() { proto.io.haveno.protobuffer.Mediator.prototype.clearExtraDataMap = function() {
this.getExtraDataMap().clear(); this.getExtraDataMap().clear();
return this;}; return this;
};
@ -23447,7 +23459,8 @@ proto.io.haveno.protobuffer.RefundAgent.prototype.getExtraDataMap = function(opt
*/ */
proto.io.haveno.protobuffer.RefundAgent.prototype.clearExtraDataMap = function() { proto.io.haveno.protobuffer.RefundAgent.prototype.clearExtraDataMap = function() {
this.getExtraDataMap().clear(); this.getExtraDataMap().clear();
return this;}; return this;
};
@ -24062,7 +24075,8 @@ proto.io.haveno.protobuffer.Filter.prototype.getExtraDataMap = function(opt_noLa
*/ */
proto.io.haveno.protobuffer.Filter.prototype.clearExtraDataMap = function() { proto.io.haveno.protobuffer.Filter.prototype.clearExtraDataMap = function() {
this.getExtraDataMap().clear(); this.getExtraDataMap().clear();
return this;}; return this;
};
/** /**
@ -25096,7 +25110,8 @@ proto.io.haveno.protobuffer.TradeStatistics3.prototype.getExtraDataMap = functio
*/ */
proto.io.haveno.protobuffer.TradeStatistics3.prototype.clearExtraDataMap = function() { proto.io.haveno.protobuffer.TradeStatistics3.prototype.clearExtraDataMap = function() {
this.getExtraDataMap().clear(); this.getExtraDataMap().clear();
return this;}; return this;
};
@ -25388,7 +25403,8 @@ proto.io.haveno.protobuffer.MailboxStoragePayload.prototype.getExtraDataMap = fu
*/ */
proto.io.haveno.protobuffer.MailboxStoragePayload.prototype.clearExtraDataMap = function() { proto.io.haveno.protobuffer.MailboxStoragePayload.prototype.clearExtraDataMap = function() {
this.getExtraDataMap().clear(); this.getExtraDataMap().clear();
return this;}; return this;
};
@ -26648,7 +26664,8 @@ proto.io.haveno.protobuffer.OfferPayload.prototype.getExtraDataMap = function(op
*/ */
proto.io.haveno.protobuffer.OfferPayload.prototype.clearExtraDataMap = function() { proto.io.haveno.protobuffer.OfferPayload.prototype.clearExtraDataMap = function() {
this.getExtraDataMap().clear(); this.getExtraDataMap().clear();
return this;}; return this;
};
/** /**
@ -28677,7 +28694,8 @@ proto.io.haveno.protobuffer.Dispute.prototype.getExtraDataMap = function(opt_noL
*/ */
proto.io.haveno.protobuffer.Dispute.prototype.clearExtraDataMap = function() { proto.io.haveno.protobuffer.Dispute.prototype.clearExtraDataMap = function() {
this.getExtraDataMap().clear(); this.getExtraDataMap().clear();
return this;}; return this;
};
@ -31407,7 +31425,8 @@ proto.io.haveno.protobuffer.PaymentAccountPayload.prototype.getExcludeFromJsonDa
*/ */
proto.io.haveno.protobuffer.PaymentAccountPayload.prototype.clearExcludeFromJsonDataMap = function() { proto.io.haveno.protobuffer.PaymentAccountPayload.prototype.clearExcludeFromJsonDataMap = function() {
this.getExcludeFromJsonDataMap().clear(); this.getExcludeFromJsonDataMap().clear();
return this;}; return this;
};
/** /**
@ -56593,7 +56612,8 @@ proto.io.haveno.protobuffer.PreferencesPayload.prototype.getDontShowAgainMapMap
*/ */
proto.io.haveno.protobuffer.PreferencesPayload.prototype.clearDontShowAgainMapMap = function() { proto.io.haveno.protobuffer.PreferencesPayload.prototype.clearDontShowAgainMapMap = function() {
this.getDontShowAgainMapMap().clear(); this.getDontShowAgainMapMap().clear();
return this;}; return this;
};
/** /**
@ -56904,7 +56924,8 @@ proto.io.haveno.protobuffer.PreferencesPayload.prototype.getPeerTagMapMap = func
*/ */
proto.io.haveno.protobuffer.PreferencesPayload.prototype.clearPeerTagMapMap = function() { proto.io.haveno.protobuffer.PreferencesPayload.prototype.clearPeerTagMapMap = function() {
this.getPeerTagMapMap().clear(); this.getPeerTagMapMap().clear();
return this;}; return this;
};
/** /**
@ -59182,7 +59203,8 @@ proto.io.haveno.protobuffer.UserPayload.prototype.getCookieMap = function(opt_no
*/ */
proto.io.haveno.protobuffer.UserPayload.prototype.clearCookieMap = function() { proto.io.haveno.protobuffer.UserPayload.prototype.clearCookieMap = function() {
this.getCookieMap().clear(); this.getCookieMap().clear();
return this;}; return this;
};
/** /**

File diff suppressed because one or more lines are too long

View File

@ -98,7 +98,7 @@ class HavenoUtils {
* @return {bigint} amount in atomic units * @return {bigint} amount in atomic units
*/ */
static xmrToAtomicUnits(amountXmr) { static xmrToAtomicUnits(amountXmr) {
return BigInt(new decimal_js_1.default(amountXmr).mul(HavenoUtils.AU_PER_XMR.toString()).toFixed(0)); return BigInt(new decimal_js_1.default(amountXmr).mul(HavenoUtils.AU_PER_XMR.toString()).toDecimalPlaces(0, decimal_js_1.default.ROUND_HALF_UP).toFixed(0));
} }
/** /**
* Convert atomic units to XMR. * Convert atomic units to XMR.
@ -107,7 +107,7 @@ class HavenoUtils {
* @return {number} amount in XMR * @return {number} amount in XMR
*/ */
static atomicUnitsToXmr(amountAtomicUnits) { static atomicUnitsToXmr(amountAtomicUnits) {
return new decimal_js_1.default(amountAtomicUnits.toString()).div(HavenoUtils.AU_PER_XMR.toString()).toNumber(); return new decimal_js_1.default(amountAtomicUnits.toString()).div(HavenoUtils.AU_PER_XMR.toString()).toDecimalPlaces(12, decimal_js_1.default.ROUND_HALF_UP).toNumber();
} }
/** /**
* Divide one atomic units by another. * Divide one atomic units by another.
@ -117,7 +117,7 @@ class HavenoUtils {
* @returns {number} the result * @returns {number} the result
*/ */
static divide(au1, au2) { static divide(au1, au2) {
return this.atomicUnitsToXmr(au1) / this.atomicUnitsToXmr(au2); return new decimal_js_1.default(au1.toString()).div(new decimal_js_1.default(au2.toString())).toDecimalPlaces(12, decimal_js_1.default.ROUND_HALF_UP).toNumber();
} }
/** /**
* Multiply a bigint by a number or bigint. * Multiply a bigint by a number or bigint.
@ -127,7 +127,7 @@ class HavenoUtils {
* @returns the product as a bigint * @returns the product as a bigint
*/ */
static multiply(a, b) { static multiply(a, b) {
return BigInt((new decimal_js_1.default(a.toString()).mul(new decimal_js_1.default(b.toString())).toFixed(0))); return BigInt(new decimal_js_1.default(a.toString()).mul(new decimal_js_1.default(b.toString())).toDecimalPlaces(0, decimal_js_1.default.ROUND_HALF_UP).toString());
} }
/** /**
* Calculate the difference from a first bigint to a second, as a percentage (float). * Calculate the difference from a first bigint to a second, as a percentage (float).

File diff suppressed because one or more lines are too long