mirror of
https://github.com/haveno-dex/haveno-ts.git
synced 2025-01-28 15:27:10 -05:00
update dist
This commit is contained in:
parent
42656e2d63
commit
38ee63cdf4
10
dist/HavenoClient.d.ts
vendored
10
dist/HavenoClient.d.ts
vendored
@ -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
23
dist/HavenoClient.js
vendored
@ -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 ----------------------------------
|
||||||
|
2
dist/HavenoClient.js.map
vendored
2
dist/HavenoClient.js.map
vendored
File diff suppressed because one or more lines are too long
6
dist/protobuf/GrpcServiceClientPb.d.ts
vendored
6
dist/protobuf/GrpcServiceClientPb.d.ts
vendored
@ -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>;
|
||||||
|
12
dist/protobuf/GrpcServiceClientPb.js
vendored
12
dist/protobuf/GrpcServiceClientPb.js
vendored
@ -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) {
|
||||||
|
2
dist/protobuf/GrpcServiceClientPb.js.map
vendored
2
dist/protobuf/GrpcServiceClientPb.js.map
vendored
File diff suppressed because one or more lines are too long
32
dist/protobuf/grpc_pb.d.ts
vendored
32
dist/protobuf/grpc_pb.d.ts
vendored
@ -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,
|
||||||
}
|
}
|
||||||
|
654
dist/protobuf/grpc_pb.js
vendored
654
dist/protobuf/grpc_pb.js
vendored
File diff suppressed because it is too large
Load Diff
2
dist/protobuf/grpc_pb.js.map
vendored
2
dist/protobuf/grpc_pb.js.map
vendored
File diff suppressed because one or more lines are too long
2056
dist/protobuf/pb_pb.js
vendored
2056
dist/protobuf/pb_pb.js
vendored
File diff suppressed because it is too large
Load Diff
2
dist/protobuf/pb_pb.js.map
vendored
2
dist/protobuf/pb_pb.js.map
vendored
File diff suppressed because one or more lines are too long
8
dist/utils/HavenoUtils.js
vendored
8
dist/utils/HavenoUtils.js
vendored
@ -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).
|
||||||
|
2
dist/utils/HavenoUtils.js.map
vendored
2
dist/utils/HavenoUtils.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user