mirror of
https://github.com/haveno-dex/haveno-ts.git
synced 2024-12-26 15:59:30 -05:00
mark private members with @private to exclude from documentation
This commit is contained in:
parent
7b447022e6
commit
b8d494da81
@ -12,7 +12,7 @@
|
|||||||
"test": "jest",
|
"test": "jest",
|
||||||
"eslint": "eslint .",
|
"eslint": "eslint .",
|
||||||
"eslintfix": "eslint src/* --fix",
|
"eslintfix": "eslint src/* --fix",
|
||||||
"typedoc": "typedoc ./src/index.ts --entryPointStrategy expand src/ --exclude **/*.test.ts"
|
"typedoc": "typedoc ./src/index.ts --entryPointStrategy expand src/ --exclude **/*.test.ts --excludePrivate"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"testPathIgnorePatterns": ["<rootDir>/dist/", "/node_modules/"]
|
"testPathIgnorePatterns": ["<rootDir>/dist/", "/node_modules/"]
|
||||||
|
@ -1249,7 +1249,7 @@ test("Can complete trades at the same time", async () => {
|
|||||||
test("Can complete all trade combinations", async () => {
|
test("Can complete all trade combinations", async () => {
|
||||||
|
|
||||||
// generate trade context for each combination (buyer/seller, maker/taker, dispute(s), dispute winner)
|
// generate trade context for each combination (buyer/seller, maker/taker, dispute(s), dispute winner)
|
||||||
let ctxs: TradeContext[] = [];
|
const ctxs: TradeContext[] = [];
|
||||||
const MAKER_OPTS = [TradeRole.MAKER, TradeRole.TAKER];
|
const MAKER_OPTS = [TradeRole.MAKER, TradeRole.TAKER];
|
||||||
const DIRECTION_OPTS = ["BUY", "SELL"];
|
const DIRECTION_OPTS = ["BUY", "SELL"];
|
||||||
const BUYER_DISPUTE_OPTS = [DisputeContext.NONE, DisputeContext.OPEN_AFTER_DEPOSITS_UNLOCK, DisputeContext.OPEN_AFTER_PAYMENT_SENT];
|
const BUYER_DISPUTE_OPTS = [DisputeContext.NONE, DisputeContext.OPEN_AFTER_DEPOSITS_UNLOCK, DisputeContext.OPEN_AFTER_PAYMENT_SENT];
|
||||||
@ -2056,7 +2056,7 @@ async function makeOffer(ctx?: TradeContext): Promise<OfferInfo> {
|
|||||||
if (!ctx.makerPaymentAccountId) ctx.makerPaymentAccountId = (await createPaymentAccount(ctx.maker!, ctx.assetCode!)).getId();
|
if (!ctx.makerPaymentAccountId) ctx.makerPaymentAccountId = (await createPaymentAccount(ctx.maker!, ctx.assetCode!)).getId();
|
||||||
|
|
||||||
// get unlocked balance before reserving offer
|
// get unlocked balance before reserving offer
|
||||||
let unlockedBalanceBefore = BigInt((await ctx.maker!.getBalances()).getAvailableBalance());
|
const unlockedBalanceBefore = BigInt((await ctx.maker!.getBalances()).getAvailableBalance());
|
||||||
|
|
||||||
// post offer
|
// post offer
|
||||||
const offer: OfferInfo = await ctx.maker!.postOffer(
|
const offer: OfferInfo = await ctx.maker!.postOffer(
|
||||||
@ -2121,7 +2121,7 @@ async function takeOffer(ctx: TradeContext): Promise<TradeInfo> {
|
|||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
HavenoUtils.log(1, "Taking offer " + ctx.offerId);
|
HavenoUtils.log(1, "Taking offer " + ctx.offerId);
|
||||||
const trade = await ctx.taker!.takeOffer(ctx.offerId, ctx.takerPaymentAccountId!);
|
const trade = await ctx.taker!.takeOffer(ctx.offerId, ctx.takerPaymentAccountId!);
|
||||||
HavenoUtils.log(1, "Done taking offer in " + (Date.now() - startTime) + " ms");
|
HavenoUtils.log(1, "Done taking offer " + ctx.offerId + " in " + (Date.now() - startTime) + " ms");
|
||||||
|
|
||||||
// test taker's balances after taking trade
|
// test taker's balances after taking trade
|
||||||
if (!ctx.concurrentTrades) {
|
if (!ctx.concurrentTrades) {
|
||||||
|
@ -13,42 +13,37 @@ import { PaymentMethod, PaymentAccountForm, PaymentAccountFormField, PaymentAcco
|
|||||||
export default class HavenoClient {
|
export default class HavenoClient {
|
||||||
|
|
||||||
// grpc clients
|
// grpc clients
|
||||||
_appName: string | undefined;
|
/** @private */ _appName: string | undefined;
|
||||||
_getVersionClient: GetVersionClient;
|
/** @private */ _getVersionClient: GetVersionClient;
|
||||||
_disputeAgentsClient: DisputeAgentsClient;
|
/** @private */ _disputeAgentsClient: DisputeAgentsClient;
|
||||||
_disputesClient: DisputesClient;
|
/** @private */ _disputesClient: DisputesClient;
|
||||||
_notificationsClient: NotificationsClient;
|
/** @private */ _notificationsClient: NotificationsClient;
|
||||||
_notificationStream: grpcWeb.ClientReadableStream<NotificationMessage> | undefined;
|
/** @private */ _notificationStream: grpcWeb.ClientReadableStream<NotificationMessage> | undefined;
|
||||||
_moneroConnectionsClient: MoneroConnectionsClient;
|
/** @private */ _moneroConnectionsClient: MoneroConnectionsClient;
|
||||||
_moneroNodeClient: MoneroNodeClient;
|
/** @private */ _moneroNodeClient: MoneroNodeClient;
|
||||||
_walletsClient: WalletsClient;
|
/** @private */ _walletsClient: WalletsClient;
|
||||||
_priceClient: PriceClient;
|
/** @private */ _priceClient: PriceClient;
|
||||||
_paymentAccountsClient: PaymentAccountsClient;
|
/** @private */ _paymentAccountsClient: PaymentAccountsClient;
|
||||||
_offersClient: OffersClient;
|
/** @private */ _offersClient: OffersClient;
|
||||||
_tradesClient: TradesClient;
|
/** @private */ _tradesClient: TradesClient;
|
||||||
_accountClient: AccountClient;
|
/** @private */ _accountClient: AccountClient;
|
||||||
_shutdownServerClient: ShutdownServerClient;
|
/** @private */ _shutdownServerClient: ShutdownServerClient;
|
||||||
|
|
||||||
// state variables
|
// state variables
|
||||||
_url: string;
|
/** @private */ _url: string;
|
||||||
_password: string;
|
/** @private */ _password: string;
|
||||||
_process: any;
|
/** @private */ _process: any;
|
||||||
_processLogging = false;
|
/** @private */ _processLogging = false;
|
||||||
_walletRpcPort: number | undefined;
|
/** @private */ _walletRpcPort: number | undefined;
|
||||||
_notificationListeners: ((_notification: NotificationMessage) => void)[] = [];
|
/** @private */ _notificationListeners: ((_notification: NotificationMessage) => void)[] = [];
|
||||||
_registerNotificationListenerCalled = false;
|
/** @private */ _registerNotificationListenerCalled = false;
|
||||||
_keepAliveLooper: any;
|
/** @private */ _keepAliveLooper: any;
|
||||||
_keepAlivePeriodMs = 60000;
|
/** @private */ _keepAlivePeriodMs = 60000;
|
||||||
_paymentMethods: PaymentMethod[] | undefined; // cached for performance
|
/** @private */ _paymentMethods: PaymentMethod[] | undefined; // cached for performance
|
||||||
|
|
||||||
// constants
|
// constants
|
||||||
static readonly _fullyInitializedMessage = "Application fully initialized";
|
/** @private */ static readonly _fullyInitializedMessage = "Application fully initialized";
|
||||||
static readonly _loginRequiredMessage = "Interactive login required";
|
/** @private */ static readonly _loginRequiredMessage = "Interactive login required";
|
||||||
onData = (data: any) => { // callback for grpc notifications
|
|
||||||
if (data instanceof NotificationMessage) {
|
|
||||||
for (const listener of this._notificationListeners) listener(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a client connected to a Haveno daemon.
|
* Construct a client connected to a Haveno daemon.
|
||||||
@ -1559,7 +1554,7 @@ export default class HavenoClient {
|
|||||||
* havenod.isHavenoConnectionInitialized() and havenod.awaitHavenoConnectionInitialized().
|
* havenod.isHavenoConnectionInitialized() and havenod.awaitHavenoConnectionInitialized().
|
||||||
* Independently, gRPC createAccount() and openAccount() return after all account setup and reading from disk.
|
* Independently, gRPC createAccount() and openAccount() return after all account setup and reading from disk.
|
||||||
*
|
*
|
||||||
* @hidden
|
* @private
|
||||||
*/
|
*/
|
||||||
async _awaitAppInitialized(): Promise<void> {
|
async _awaitAppInitialized(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
@ -1583,7 +1578,7 @@ export default class HavenoClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @hidden
|
/** @private */
|
||||||
async _isAppInitialized(): Promise<boolean> {
|
async _isAppInitialized(): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
return await new Promise((resolve, reject) => {
|
return await new Promise((resolve, reject) => {
|
||||||
@ -1597,10 +1592,23 @@ export default class HavenoClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for grpc notifications.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_onNotification = (data: any) => {
|
||||||
|
if (data instanceof NotificationMessage) {
|
||||||
|
for (const listener of this._notificationListeners) listener(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update notification listener registration.
|
* Update notification listener registration.
|
||||||
* Due to the nature of grpc streaming, this method returns a promise
|
* Due to the nature of grpc streaming, this method returns a promise
|
||||||
* which may be resolved before the listener is actually registered.
|
* which may be resolved before the listener is actually registered.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
async _updateNotificationListenerRegistration(): Promise<void> {
|
async _updateNotificationListenerRegistration(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
@ -1611,7 +1619,7 @@ export default class HavenoClient {
|
|||||||
|
|
||||||
// send request to register client listener
|
// send request to register client listener
|
||||||
this._notificationStream = this._notificationsClient.registerNotificationListener(new RegisterNotificationListenerRequest(), {password: this._password})
|
this._notificationStream = this._notificationsClient.registerNotificationListener(new RegisterNotificationListenerRequest(), {password: this._password})
|
||||||
.on('data', this.onData);
|
.on('data', this._onNotification);
|
||||||
|
|
||||||
// periodically send keep alive requests // TODO (woodser): better way to keep notification stream alive?
|
// periodically send keep alive requests // TODO (woodser): better way to keep notification stream alive?
|
||||||
let firstRequest = true;
|
let firstRequest = true;
|
||||||
@ -1629,7 +1637,7 @@ export default class HavenoClient {
|
|||||||
setTimeout(resolve, 1000); // TODO: call returns before listener registered
|
setTimeout(resolve, 1000); // TODO: call returns before listener registered
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this._notificationStream!.removeListener('data', this.onData);
|
this._notificationStream!.removeListener('data', this._onNotification);
|
||||||
this._keepAliveLooper.stop();
|
this._keepAliveLooper.stop();
|
||||||
this._notificationStream!.cancel();
|
this._notificationStream!.cancel();
|
||||||
this._notificationStream = undefined;
|
this._notificationStream = undefined;
|
||||||
@ -1642,7 +1650,7 @@ export default class HavenoClient {
|
|||||||
/**
|
/**
|
||||||
* Send a notification.
|
* Send a notification.
|
||||||
*
|
*
|
||||||
* @hidden
|
* @private
|
||||||
* @param {NotificationMessage} notification - notification to send
|
* @param {NotificationMessage} notification - notification to send
|
||||||
*/
|
*/
|
||||||
async _sendNotification(notification: NotificationMessage): Promise<void> {
|
async _sendNotification(notification: NotificationMessage): Promise<void> {
|
||||||
@ -1661,7 +1669,7 @@ export default class HavenoClient {
|
|||||||
/**
|
/**
|
||||||
* Restore an account chunk from zip bytes.
|
* Restore an account chunk from zip bytes.
|
||||||
*
|
*
|
||||||
* @hidden
|
* @private
|
||||||
*/
|
*/
|
||||||
async _restoreAccountChunk(zipBytes: Uint8Array, offset: number, totalLength: number, hasMore: boolean): Promise<void> {
|
async _restoreAccountChunk(zipBytes: Uint8Array, offset: number, totalLength: number, hasMore: boolean): Promise<void> {
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user