Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update NPM dependencies #1289

Merged
merged 1 commit into from
Oct 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/api.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class Config {
deepMerge(this, args);
}

if (!Object.values(Level).includes(this.loglevel)) {
if (!Object.values(<any>Level).includes(this.loglevel)) {
this.loglevel = this.getDefaultLogLevel();
}

Expand Down
4 changes: 2 additions & 2 deletions lib/cli/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import { getDefaultCertPath } from './utils';
* A generic function to instantiate an XU client.
* @param argv the command line arguments
*/
export const loadXudClient = (argv: Arguments) => {
export const loadXudClient = (argv: Arguments<any>) => {
const certPath = argv.tlscertpath || getDefaultCertPath();
const cert = fs.readFileSync(certPath);
const credentials = grpc.credentials.createSsl(cert);

return new XudClient(`${argv.rpchost}:${argv.rpcport}`, credentials);
};

export const loadXudInitClient = (argv: Arguments) => {
export const loadXudInitClient = (argv: Arguments<any>) => {
const certPath = argv.tlscertpath || getDefaultCertPath();
const cert = fs.readFileSync(certPath);
const credentials = grpc.credentials.createSsl(cert);
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/commands/addcurrency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const builder = {
},
};

export const handler = (argv: Arguments) => {
export const handler = (argv: Arguments<any>) => {
const request = new Currency();
request.setCurrency(argv.currency.toUpperCase());
request.setSwapClient(Number(SwapClientType[argv.swap_client]));
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/commands/addpair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const builder = {
},
};

export const handler = (argv: Arguments) => {
export const handler = (argv: Arguments<any>) => {
const request = new AddPairRequest();
request.setBaseCurrency(argv.base_currency.toUpperCase());
request.setQuoteCurrency(argv.quote_currency.toUpperCase());
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/commands/ban.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const builder = {
},
};

export const handler = (argv: Arguments) => {
export const handler = (argv: Arguments<any>) => {
const request = new BanRequest();
request.setNodePubKey(argv.node_key);
loadXudClient(argv).ban(request, callback(argv));
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/commands/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const builder = {
},
};

export const handler = (argv: Arguments) => {
export const handler = (argv: Arguments<any>) => {
const request = new ConnectRequest();
request.setNodeUri(argv.node_uri);
loadXudClient(argv).connect(request, callback(argv));
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ somewhere safe, it is your ONLY backup in case of data loss.
}
};

export const handler = (argv: Arguments) => {
export const handler = (argv: Arguments<any>) => {
const rl = readline.createInterface({
input: process.stdin,
terminal: true,
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/commands/discovernodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const builder = {
},
};

export const handler = (argv: Arguments) => {
export const handler = (argv: Arguments<any>) => {
const request = new DiscoverNodesRequest();
request.setPeerPubKey(argv.node_key);
loadXudClient(argv).discoverNodes(request, callback(argv));
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/commands/executeswap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const builder = {
},
};

export const handler = (argv: Arguments) => {
export const handler = (argv: Arguments<any>) => {
const request = new ExecuteSwapRequest();
request.setOrderId(argv.order_id);
request.setPairId(argv.pair_id);
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/commands/getbalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const builder = {
},
};

export const handler = (argv: Arguments) => {
export const handler = (argv: Arguments<any>) => {
const request = new GetBalanceRequest();
if (argv.currency) {
request.setCurrency(argv.currency.toUpperCase());
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/commands/getnodeinfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const builder = {
},
};

export const handler = (argv: Arguments) => {
export const handler = (argv: Arguments<any>) => {
const request = new GetNodeInfoRequest();
request.setNodePubKey(argv.node_key);
loadXudClient(argv).getNodeInfo(request, callback(argv, displayNodeInfo));
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/commands/listorders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const builder = {
},
};

export const handler = (argv: Arguments) => {
export const handler = (argv: Arguments<any>) => {
const request = new ListOrdersRequest();
const pairId = argv.pair_id ? argv.pair_id.toUpperCase() : undefined;
request.setPairId(pairId);
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/commands/listtrades.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const builder = {
},
};

export const handler = (argv: Arguments) => {
export const handler = (argv: Arguments<any>) => {
const request = new ListTradesRequest();
request.setLimit(argv.limit);
loadXudClient(argv).listTrades(request, callback(argv, displayTrades));
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/commands/openchannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const builder = {
},
};

export const handler = (argv: Arguments) => {
export const handler = (argv: Arguments<any>) => {
const request = new OpenChannelRequest();
request.setNodePubKey(argv.node_key);
request.setCurrency(argv.currency.toUpperCase());
Expand Down
6 changes: 3 additions & 3 deletions lib/cli/commands/orderbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const displayOrderbook = (orderbook: FormattedOrderbook) => {
console.log(table.toString());
};

const displayTables = (orders: ListOrdersResponse.AsObject, argv: Arguments) => {
const displayTables = (orders: ListOrdersResponse.AsObject, argv: Arguments<any>) => {
createOrderbook(orders, argv.precision).forEach(displayOrderbook);
};

Expand Down Expand Up @@ -156,7 +156,7 @@ export const builder = {
},
};

const displayJson = (orders: ListOrdersResponse.AsObject, argv: Arguments) => {
const displayJson = (orders: ListOrdersResponse.AsObject, argv: Arguments<any>) => {
const jsonOrderbooks: OrderbookJson[] = [];
const quantityInSatoshisPerCoin = (bucket: Bucket) => {
bucket.quantity = parseFloat(
Expand All @@ -177,7 +177,7 @@ const displayJson = (orders: ListOrdersResponse.AsObject, argv: Arguments) => {
console.log(JSON.stringify(jsonOrderbooks, undefined, 2));
};

export const handler = (argv: Arguments) => {
export const handler = (argv: Arguments<any>) => {
const request = new ListOrdersRequest();
const pairId = argv.pair_id ? argv.pair_id.toUpperCase() : undefined;
request.setPairId(pairId);
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/commands/removecurrency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const builder = {
},
};

export const handler = (argv: Arguments) => {
export const handler = (argv: Arguments<any>) => {
const request = new RemoveCurrencyRequest();
request.setCurrency(argv.currency.toUpperCase());
loadXudClient(argv).removeCurrency(request, callback(argv));
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/commands/removeorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const builder = {
},
};

export const handler = (argv: Arguments) => {
export const handler = (argv: Arguments<any>) => {
const request = new RemoveOrderRequest();
request.setOrderId(argv.order_id);
if (argv.quantity) {
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/commands/removepair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const builder = {
},
};

export const handler = (argv: Arguments) => {
export const handler = (argv: Arguments<any>) => {
const request = new RemovePairRequest();
request.setPairId(argv.pair_id.toUpperCase());
loadXudClient(argv).removePair(request, callback(argv));
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/commands/streamorders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const ensureConnection = (argv: Arguments, printError?: boolean) => {
});
};

const streamOrders = (argv: Arguments) => {
const streamOrders = (argv: Arguments<any>) => {
const xudClient = loadXudClient(argv);
const ordersReqeust = new xudrpc.SubscribeOrdersRequest();
ordersReqeust.setExisting(argv.existing);
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/commands/unban.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const builder = {
},
};

export const handler = (argv: Arguments) => {
export const handler = (argv: Arguments<any>) => {
const request = new UnbanRequest();
request.setNodePubKey(argv.node_key);
request.setReconnect(argv.reconnect);
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/placeorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const placeOrderBuilder = (argv: Argv, side: OrderSide) => {
.example(`$0 ${command} 10 ZRX/GNT market`, `place a market order to ${command} 10 ZRX for GNT`);
};

export const placeOrderHandler = (argv: Arguments, side: OrderSide) => {
export const placeOrderHandler = (argv: Arguments<any>, side: OrderSide) => {
const request = new PlaceOrderRequest();

const numericPrice = Number(argv.price);
Expand Down
30 changes: 15 additions & 15 deletions lib/p2p/Framer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class Framer {
const msg = Buffer.allocUnsafe(Framer.ENCRYPTED_MSG_PAYLOAD_HEADER_LENGTH + packetRaw.length);

// length
msg.writeUInt32LE(packetRaw.length, 0, true);
msg.writeUInt32LE(packetRaw.length, 0);

// type
msg.writeUInt32LE(packet.type, 4, true);
msg.writeUInt32LE(packet.type, 4);

// packet
packetRaw.copy(msg, 8);
Expand All @@ -51,7 +51,7 @@ class Framer {
const encryptedMsg = Buffer.allocUnsafe(Framer.ENCRYPTED_MSG_HEADER_LENGTH + ciphertext.length);

// length
encryptedMsg.writeUInt32LE(ciphertext.length, 0, true);
encryptedMsg.writeUInt32LE(ciphertext.length, 0);

// ciphertext
ciphertext.copy(encryptedMsg, 4);
Expand All @@ -61,13 +61,13 @@ class Framer {
const msg = Buffer.allocUnsafe(Framer.MSG_HEADER_LENGTH + packetRaw.length);

// network magic value
msg.writeUInt32LE(this.network.magic, 0, true);
msg.writeUInt32LE(this.network.magic, 0);

// length
msg.writeUInt32LE(packetRaw.length, 4, true);
msg.writeUInt32LE(packetRaw.length, 4);

// type
msg.writeUInt32LE(packet.type, 8, true);
msg.writeUInt32LE(packet.type, 8);

// checksum
msg.writeUInt32LE(packet.checksum(), 12);
Expand All @@ -85,7 +85,7 @@ class Framer {
public unframe = (msg: Buffer, encryptionKey?: Buffer): WireMsg => {
let wireMsg: WireMsg;
if (encryptionKey) {
const length = msg.readUInt32LE(0, true);
const length = msg.readUInt32LE(0);
const ciphertext = msg.slice(Framer.ENCRYPTED_MSG_HEADER_LENGTH);

if (length !== ciphertext.length) {
Expand Down Expand Up @@ -116,7 +116,7 @@ class Framer {
* Parse the length of a wire msg or an encrypted wire msg
*/
public parseLength = (data: Buffer, encrypted: boolean): number => {
const value = data.readUInt32LE(0, true);
const value = data.readUInt32LE(0);

if (encrypted) {
if (value === this.network.magic) {
Expand All @@ -134,7 +134,7 @@ class Framer {
}
}

return data.readUInt32LE(4, true);
return data.readUInt32LE(4);
}

/**
Expand All @@ -145,26 +145,26 @@ class Framer {
assert(msg.length >= Framer.ENCRYPTED_MSG_PAYLOAD_HEADER_LENGTH, 'invalid msg header length: data is missing');

// length
const length = msg.readUInt32LE(0, true);
const length = msg.readUInt32LE(0);

// type
const type = msg.readUInt32LE(4, true);
const type = msg.readUInt32LE(4);

return { length, type };
} else {
assert(msg.length >= Framer.MSG_HEADER_LENGTH, 'invalid msg header length: data is missing');

// network magic value
const magic = msg.readUInt32LE(0, true);
const magic = msg.readUInt32LE(0);

// length
const length = msg.readUInt32LE(4, true);
const length = msg.readUInt32LE(4);

// type
const type = msg.readUInt32LE(8, true);
const type = msg.readUInt32LE(8);

// checksum
const checksum = msg.readUInt32LE(12, true);
const checksum = msg.readUInt32LE(12);

return { magic, type, length, checksum };
}
Expand Down
2 changes: 1 addition & 1 deletion lib/p2p/packets/Packet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ abstract class Packet<T = any> implements PacketInterface {
return createHash('sha256')
.update(this.toJSON())
.digest()
.readUInt32LE(0, true);
.readUInt32LE(0);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/proto/annotations_grpc_pb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion lib/proto/annotations_pb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading