-
Notifications
You must be signed in to change notification settings - Fork 12
/
best.ts
43 lines (40 loc) · 1.1 KB
/
best.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { Command } from "@oclif/command";
import { cancelled } from "../lib/prompt";
import * as requests from "../lib/requests";
import * as utils from "../lib/utils";
import { getWallet } from "../lib/wallet";
export default class Best extends Command {
public static description = "compare order pricing from servers";
public async run() {
try {
const wallet = await getWallet(this);
const chainId = (await wallet.provider.getNetwork()).chainId;
const metadata = await utils.getMetadata(this, chainId);
const gasPrice = await utils.getGasPrice(this);
utils.displayDescription(this, Best.description, chainId);
const request = await requests.getRequest(wallet, metadata, "Order");
this.log();
requests.multiPeerCall(
wallet,
request.method,
request.params,
request.senderToken.address,
request.signerToken.address,
(order: any, results: any, errors: any) => {
utils.handleResponse(
request,
wallet,
metadata,
chainId,
gasPrice,
this,
order,
errors,
);
},
);
} catch (e) {
cancelled(e);
}
}
}