Skip to content

Commit

Permalink
Merge pull request #1604 from ExchangeUnion/update-dependencies
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
erkarl committed Jun 5, 2020
2 parents 141bcc5 + 0d17c23 commit 55876ae
Show file tree
Hide file tree
Showing 15 changed files with 7,083 additions and 3,583 deletions.
4 changes: 2 additions & 2 deletions lib/connextclient/ConnextClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ class ConnextClient extends SwapClient {
assetId: tokenAddress,
timelock: deal.takerCltvDelta.toString(),
lockHash: `0x${deal.rHash}`,
recipient: deal.destination!,
recipient: deal.destination,
});
// @ts-ignore
const [executeTransferResponse, preimage] = await Promise.all([
Expand All @@ -338,7 +338,7 @@ class ConnextClient extends SwapClient {
assetId: tokenAddress,
timelock: lockTimeout.toString(),
lockHash: `0x${deal.rHash}`,
recipient: deal.destination!,
recipient: deal.destination,
});
await executeTransfer;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/lndclient/LndClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,19 +567,19 @@ class LndClient extends SwapClient {
assert(deal.destination, 'swap deal as taker must have a destination');
request = this.buildSendRequest({
rHash: deal.rHash,
destination: deal.destination!,
destination: deal.destination,
amount: deal.makerAmount,
// Using the agreed upon makerCltvDelta. Maker won't accept
// our payment if we provide a smaller value.
finalCltvDelta: deal.makerCltvDelta!,
finalCltvDelta: deal.makerCltvDelta,
});
} else {
// we are the maker paying the taker
assert(deal.takerPubKey, 'swap deal as maker must have a takerPubKey');
assert(deal.takerCltvDelta, 'swap deal as maker must have a takerCltvDelta');
request = this.buildSendRequest({
rHash: deal.rHash,
destination: deal.takerPubKey!,
destination: deal.takerPubKey,
amount: deal.takerAmount,
finalCltvDelta: deal.takerCltvDelta,
// Enforcing the maximum duration/length of the payment by specifying
Expand Down
4 changes: 2 additions & 2 deletions lib/orderbook/OrderBook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -939,9 +939,9 @@ class OrderBook extends EventEmitter {
private handleSwapRequest = async (requestPacket: SwapRequestPacket, peer: Peer) => {
assert(requestPacket.body, 'SwapRequestPacket does not contain a body');
assert(this.swaps, 'swaps module is disabled');
const { rHash, proposedQuantity, orderId, pairId } = requestPacket.body!;
const { rHash, proposedQuantity, orderId, pairId } = requestPacket.body;

if (!Swaps.validateSwapRequest(requestPacket.body!)) {
if (!Swaps.validateSwapRequest(requestPacket.body)) {
// TODO: penalize peer for invalid swap request
await peer.sendPacket(new SwapFailedPacket({
rHash,
Expand Down
2 changes: 1 addition & 1 deletion lib/orderbook/TradingPair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ class TradingPair {
assert(isOwnOrder(makerOrder));

assert(queue.poll() === makerOrder);
queueRemovedOrdersWithHold.push(makerOrder as OwnOrder);
queueRemovedOrdersWithHold.push(makerOrder);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions lib/p2p/Peer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -724,11 +724,11 @@ class Peer extends EventEmitter {
private bindSocket = () => {
assert(this.socket);

this.socket!.once('error', (err) => {
this.socket.once('error', (err) => {
this.logger.error(`Peer (${this.label}) error`, err);
});

this.socket!.once('close', async (hadError) => {
this.socket.once('close', async (hadError) => {
// emitted once the socket is fully closed
if (this.nodePubKey === undefined) {
this.logger.info(`Socket closed prior to handshake with ${this.label}`);
Expand All @@ -740,9 +740,9 @@ class Peer extends EventEmitter {
await this.close();
});

this.socket!.on('data', this.parser.feed);
this.socket.on('data', this.parser.feed);

this.socket!.setNoDelay(true);
this.socket.setNoDelay(true);
}

private bindParser = (parser: Parser): void => {
Expand Down Expand Up @@ -924,7 +924,7 @@ class Peer extends EventEmitter {
if (!this.inbound) {
// outbound handshake
assert(this.expectedNodePubKey);
await this.initSession(ownNodeState, ownNodeKey, ownVersion, this.expectedNodePubKey!);
await this.initSession(ownNodeState, ownNodeKey, ownVersion, this.expectedNodePubKey);
sessionInit = await this.waitSessionInit();
await this.authenticateSessionInit(sessionInit, ownNodeKey.pubKey, this.expectedNodePubKey);
} else {
Expand Down
2 changes: 1 addition & 1 deletion lib/p2p/Pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ class Pool extends EventEmitter {
/** Validates a peer. If a check fails, closes the peer and throws a p2p error. */
private validatePeer = async (peer: Peer): Promise<void> => {
assert(peer.nodePubKey);
const peerPubKey = peer.nodePubKey!;
const peerPubKey = peer.nodePubKey;

if (peerPubKey === this.nodePubKey) {
await peer.close(DisconnectionReason.ConnectedToSelf);
Expand Down
2 changes: 1 addition & 1 deletion lib/raidenclient/RaidenClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class RaidenClient extends SwapClient {
amount,
lock_timeout,
token_address: tokenAddress,
target_address: deal.destination!,
target_address: deal.destination,
secret_hash: deal.rHash,
});
return this.sanitizeTokenPaymentResponse(tokenPaymentResponse);
Expand Down
6 changes: 3 additions & 3 deletions lib/swaps/Swaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ class Swaps extends EventEmitter {
*/
private handleSwapAccepted = async (responsePacket: packets.SwapAcceptedPacket, peer: Peer) => {
assert(responsePacket.body, 'SwapAcceptedPacket does not contain a body');
const { quantity, rHash, makerCltvDelta } = responsePacket.body!;
const { quantity, rHash, makerCltvDelta } = responsePacket.body;
const deal = this.getDeal(rHash);
if (!deal) {
this.logger.warn(`received swap accepted for unrecognized deal: ${rHash}`);
Expand Down Expand Up @@ -992,7 +992,7 @@ class Swaps extends EventEmitter {
assert(htlcCurrency === undefined || htlcCurrency === deal.takerCurrency, 'incoming htlc does not match expected deal currency');
this.logger.debug('Executing taker code to resolve hash');

return deal.rPreimage!;
return deal.rPreimage;
}
}

Expand Down Expand Up @@ -1208,7 +1208,7 @@ class Swaps extends EventEmitter {

deal.phase = newPhase;

if (deal.phase !== SwapPhase.SwapCreated && deal.phase !== SwapPhase.SwapRequested) {
if (deal.phase !== SwapPhase.SwapRequested) {
// once a deal is accepted, we persist its state to the database on every phase update
await this.persistDeal(deal);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/addressUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const addressUtils = {
const { remoteAddress, remotePort } = socket;
assert(remoteAddress, 'socket must have a remoteAddress value');
assert(remotePort, 'socket must have a remotePort value');
return { host: remoteAddress!, port: remotePort! };
return { host: remoteAddress, port: remotePort };
},

/**
Expand Down

0 comments on commit 55876ae

Please sign in to comment.