@trust-ethos/cli 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1791 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +5 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +5 -0
- package/dist/commands/auction/active.d.ts +10 -0
- package/dist/commands/auction/active.js +39 -0
- package/dist/commands/auction/info.d.ts +16 -0
- package/dist/commands/auction/info.js +46 -0
- package/dist/commands/auction/list.d.ts +14 -0
- package/dist/commands/auction/list.js +61 -0
- package/dist/commands/broker/info.d.ts +16 -0
- package/dist/commands/broker/info.js +37 -0
- package/dist/commands/broker/list.d.ts +15 -0
- package/dist/commands/broker/list.js +62 -0
- package/dist/commands/config/get.d.ts +9 -0
- package/dist/commands/config/get.js +29 -0
- package/dist/commands/config/path.d.ts +6 -0
- package/dist/commands/config/path.js +12 -0
- package/dist/commands/config/set.d.ts +9 -0
- package/dist/commands/config/set.js +28 -0
- package/dist/commands/listing/info.d.ts +13 -0
- package/dist/commands/listing/info.js +41 -0
- package/dist/commands/listing/list.d.ts +13 -0
- package/dist/commands/listing/list.js +46 -0
- package/dist/commands/listing/voters.d.ts +19 -0
- package/dist/commands/listing/voters.js +48 -0
- package/dist/commands/market/featured.d.ts +10 -0
- package/dist/commands/market/featured.js +34 -0
- package/dist/commands/market/holders.d.ts +14 -0
- package/dist/commands/market/holders.js +46 -0
- package/dist/commands/market/info.d.ts +14 -0
- package/dist/commands/market/info.js +48 -0
- package/dist/commands/market/list.d.ts +16 -0
- package/dist/commands/market/list.js +55 -0
- package/dist/commands/nft/list.d.ts +15 -0
- package/dist/commands/nft/list.js +64 -0
- package/dist/commands/review/info.d.ts +17 -0
- package/dist/commands/review/info.js +49 -0
- package/dist/commands/review/list.d.ts +16 -0
- package/dist/commands/review/list.js +68 -0
- package/dist/commands/review/votes.d.ts +21 -0
- package/dist/commands/review/votes.js +91 -0
- package/dist/commands/score/status.d.ts +13 -0
- package/dist/commands/score/status.js +54 -0
- package/dist/commands/slash/info.d.ts +16 -0
- package/dist/commands/slash/info.js +42 -0
- package/dist/commands/slash/list.d.ts +15 -0
- package/dist/commands/slash/list.js +50 -0
- package/dist/commands/slash/votes.d.ts +21 -0
- package/dist/commands/slash/votes.js +91 -0
- package/dist/commands/user/activity.d.ts +15 -0
- package/dist/commands/user/activity.js +71 -0
- package/dist/commands/user/info.d.ts +14 -0
- package/dist/commands/user/info.js +51 -0
- package/dist/commands/user/invitations.d.ts +16 -0
- package/dist/commands/user/invitations.js +73 -0
- package/dist/commands/user/search.d.ts +15 -0
- package/dist/commands/user/search.js +59 -0
- package/dist/commands/user/summary.d.ts +14 -0
- package/dist/commands/user/summary.js +134 -0
- package/dist/commands/validator/info.d.ts +13 -0
- package/dist/commands/validator/info.js +53 -0
- package/dist/commands/validator/list.d.ts +13 -0
- package/dist/commands/validator/list.js +64 -0
- package/dist/commands/validator/sales.d.ts +12 -0
- package/dist/commands/validator/sales.js +52 -0
- package/dist/commands/vouch/info.d.ts +17 -0
- package/dist/commands/vouch/info.js +53 -0
- package/dist/commands/vouch/list.d.ts +18 -0
- package/dist/commands/vouch/list.js +89 -0
- package/dist/commands/vouch/mutual.d.ts +15 -0
- package/dist/commands/vouch/mutual.js +68 -0
- package/dist/commands/vouch/votes.d.ts +21 -0
- package/dist/commands/vouch/votes.js +91 -0
- package/dist/commands/xp/rank.d.ts +15 -0
- package/dist/commands/xp/rank.js +74 -0
- package/dist/commands/xp/seasons.d.ts +10 -0
- package/dist/commands/xp/seasons.js +42 -0
- package/dist/hooks/init.d.ts +3 -0
- package/dist/hooks/init.js +40 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/api/echo-client.d.ts +624 -0
- package/dist/lib/api/echo-client.js +408 -0
- package/dist/lib/config/index.d.ts +6 -0
- package/dist/lib/config/index.js +32 -0
- package/dist/lib/errors/cli-error.d.ts +23 -0
- package/dist/lib/errors/cli-error.js +57 -0
- package/dist/lib/formatting/colors.d.ts +13 -0
- package/dist/lib/formatting/colors.js +22 -0
- package/dist/lib/formatting/error.d.ts +1 -0
- package/dist/lib/formatting/error.js +64 -0
- package/dist/lib/formatting/output.d.ts +45 -0
- package/dist/lib/formatting/output.js +753 -0
- package/dist/lib/help.d.ts +4 -0
- package/dist/lib/help.js +28 -0
- package/dist/lib/update/index.d.ts +37 -0
- package/dist/lib/update/index.js +286 -0
- package/dist/lib/validation/userkey.d.ts +11 -0
- package/dist/lib/validation/userkey.js +81 -0
- package/oclif.manifest.json +2224 -0
- package/package.json +87 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import { EchoClient } from '../../lib/api/echo-client.js';
|
|
3
|
+
import { formatError } from '../../lib/formatting/error.js';
|
|
4
|
+
import { formatFeaturedMarkets, output } from '../../lib/formatting/output.js';
|
|
5
|
+
export default class MarketFeatured extends Command {
|
|
6
|
+
static description = 'Show top gainers and losers';
|
|
7
|
+
static examples = [
|
|
8
|
+
'<%= config.bin %> <%= command.id %>',
|
|
9
|
+
'<%= config.bin %> <%= command.id %> --json',
|
|
10
|
+
];
|
|
11
|
+
static flags = {
|
|
12
|
+
json: Flags.boolean({ char: 'j', description: 'Output as JSON' }),
|
|
13
|
+
verbose: Flags.boolean({ char: 'v', description: 'Show detailed error information' }),
|
|
14
|
+
};
|
|
15
|
+
async run() {
|
|
16
|
+
const { flags } = await this.parse(MarketFeatured);
|
|
17
|
+
const client = new EchoClient();
|
|
18
|
+
try {
|
|
19
|
+
const response = await client.getFeaturedMarkets();
|
|
20
|
+
if (flags.json) {
|
|
21
|
+
this.log(output(response));
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
this.log(formatFeaturedMarkets(response));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
if (error instanceof Error) {
|
|
29
|
+
this.log(formatError(error, flags.verbose));
|
|
30
|
+
this.exit(1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class MarketHolders extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
identifier: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { EchoClient } from '../../lib/api/echo-client.js';
|
|
3
|
+
import { formatError } from '../../lib/formatting/error.js';
|
|
4
|
+
import { formatMarketHolders, output } from '../../lib/formatting/output.js';
|
|
5
|
+
export default class MarketHolders extends Command {
|
|
6
|
+
static description = 'Show who holds trust/distrust in a user';
|
|
7
|
+
static args = {
|
|
8
|
+
identifier: Args.string({
|
|
9
|
+
description: 'Twitter username, ETH address, or ENS name',
|
|
10
|
+
required: true,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
static examples = [
|
|
14
|
+
'<%= config.bin %> <%= command.id %> sethgho',
|
|
15
|
+
'<%= config.bin %> <%= command.id %> 0xNowater --limit 20',
|
|
16
|
+
'<%= config.bin %> <%= command.id %> vitalik.eth --json',
|
|
17
|
+
];
|
|
18
|
+
static flags = {
|
|
19
|
+
json: Flags.boolean({ char: 'j', description: 'Output as JSON' }),
|
|
20
|
+
verbose: Flags.boolean({ char: 'v', description: 'Show detailed error information' }),
|
|
21
|
+
limit: Flags.integer({ char: 'l', description: 'Max results', default: 10, min: 1, max: 100 }),
|
|
22
|
+
};
|
|
23
|
+
async run() {
|
|
24
|
+
const { args, flags } = await this.parse(MarketHolders);
|
|
25
|
+
const client = new EchoClient();
|
|
26
|
+
try {
|
|
27
|
+
const user = await client.resolveUser(args.identifier);
|
|
28
|
+
if (!user.profileId) {
|
|
29
|
+
this.error('User does not have a profile ID', { exit: 1 });
|
|
30
|
+
}
|
|
31
|
+
const response = await client.getMarketHolders(user.profileId, { limit: flags.limit });
|
|
32
|
+
if (flags.json) {
|
|
33
|
+
this.log(output(response));
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.log(formatMarketHolders(response.values, response.total));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (error instanceof Error) {
|
|
41
|
+
this.log(formatError(error, flags.verbose));
|
|
42
|
+
this.exit(1);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class MarketInfo extends Command {
|
|
3
|
+
static aliases: string[];
|
|
4
|
+
static description: string;
|
|
5
|
+
static args: {
|
|
6
|
+
identifier: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static examples: string[];
|
|
9
|
+
static flags: {
|
|
10
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { EchoClient } from '../../lib/api/echo-client.js';
|
|
3
|
+
import { formatError } from '../../lib/formatting/error.js';
|
|
4
|
+
import { formatMarket, output } from '../../lib/formatting/output.js';
|
|
5
|
+
export default class MarketInfo extends Command {
|
|
6
|
+
static aliases = ['mi'];
|
|
7
|
+
static description = 'Get trust market info for a user';
|
|
8
|
+
static args = {
|
|
9
|
+
identifier: Args.string({ description: 'Profile ID or Twitter username', required: true }),
|
|
10
|
+
};
|
|
11
|
+
static examples = [
|
|
12
|
+
'<%= config.bin %> <%= command.id %> 123',
|
|
13
|
+
'<%= config.bin %> <%= command.id %> vitalik',
|
|
14
|
+
'<%= config.bin %> <%= command.id %> vitalik --json',
|
|
15
|
+
];
|
|
16
|
+
static flags = {
|
|
17
|
+
json: Flags.boolean({ char: 'j', description: 'Output as JSON' }),
|
|
18
|
+
verbose: Flags.boolean({ char: 'v', description: 'Show detailed error information' }),
|
|
19
|
+
};
|
|
20
|
+
async run() {
|
|
21
|
+
const { args, flags } = await this.parse(MarketInfo);
|
|
22
|
+
const client = new EchoClient();
|
|
23
|
+
try {
|
|
24
|
+
// Try as profileId first, then as Twitter username
|
|
25
|
+
const isNumeric = /^\d+$/.test(args.identifier);
|
|
26
|
+
let market;
|
|
27
|
+
if (isNumeric) {
|
|
28
|
+
market = await client.getMarketInfo(parseInt(args.identifier));
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
const marketUser = await client.getMarketByTwitter(args.identifier);
|
|
32
|
+
market = await client.getMarketInfo(marketUser.profileId);
|
|
33
|
+
}
|
|
34
|
+
if (flags.json) {
|
|
35
|
+
this.log(output(market));
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
this.log(formatMarket(market));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (error instanceof Error) {
|
|
43
|
+
this.log(formatError(error, flags.verbose));
|
|
44
|
+
this.exit(1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class MarketList extends Command {
|
|
3
|
+
static aliases: string[];
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static flags: {
|
|
7
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
sort: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
order: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
search: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
offset: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import { EchoClient } from '../../lib/api/echo-client.js';
|
|
3
|
+
import { formatError } from '../../lib/formatting/error.js';
|
|
4
|
+
import { formatMarkets, output } from '../../lib/formatting/output.js';
|
|
5
|
+
export default class MarketList extends Command {
|
|
6
|
+
static aliases = ['ml'];
|
|
7
|
+
static description = 'List trust markets';
|
|
8
|
+
static examples = [
|
|
9
|
+
'<%= config.bin %> <%= command.id %>',
|
|
10
|
+
'<%= config.bin %> <%= command.id %> --sort priceChange24hPercent --order desc',
|
|
11
|
+
'<%= config.bin %> <%= command.id %> --search "vitalik" --json',
|
|
12
|
+
];
|
|
13
|
+
static flags = {
|
|
14
|
+
json: Flags.boolean({ char: 'j', description: 'Output as JSON' }),
|
|
15
|
+
verbose: Flags.boolean({ char: 'v', description: 'Show detailed error information' }),
|
|
16
|
+
sort: Flags.string({
|
|
17
|
+
description: 'Sort by field',
|
|
18
|
+
options: ['marketCapWei', 'volume24hWei', 'priceChange24hPercent', 'score', 'createdAt'],
|
|
19
|
+
default: 'marketCapWei',
|
|
20
|
+
}),
|
|
21
|
+
order: Flags.string({
|
|
22
|
+
description: 'Sort direction',
|
|
23
|
+
options: ['asc', 'desc'],
|
|
24
|
+
default: 'desc',
|
|
25
|
+
}),
|
|
26
|
+
search: Flags.string({ char: 's', description: 'Search by name/username' }),
|
|
27
|
+
limit: Flags.integer({ char: 'l', description: 'Max results per request', default: 10 }),
|
|
28
|
+
offset: Flags.integer({ char: 'o', description: 'Number of results to skip', default: 0 }),
|
|
29
|
+
};
|
|
30
|
+
async run() {
|
|
31
|
+
const { flags } = await this.parse(MarketList);
|
|
32
|
+
const client = new EchoClient();
|
|
33
|
+
try {
|
|
34
|
+
const response = await client.getMarkets({
|
|
35
|
+
orderBy: flags.sort,
|
|
36
|
+
orderDirection: flags.order,
|
|
37
|
+
filterQuery: flags.search,
|
|
38
|
+
limit: flags.limit,
|
|
39
|
+
offset: flags.offset,
|
|
40
|
+
});
|
|
41
|
+
if (flags.json) {
|
|
42
|
+
this.log(output(response));
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
this.log(formatMarkets(response.values, response.total));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
if (error instanceof Error) {
|
|
50
|
+
this.log(formatError(error, flags.verbose));
|
|
51
|
+
this.exit(1);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class NftList extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
identifier: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
offset: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { EchoClient } from '../../lib/api/echo-client.js';
|
|
3
|
+
import { formatError } from '../../lib/formatting/error.js';
|
|
4
|
+
import { formatNfts, output } from '../../lib/formatting/output.js';
|
|
5
|
+
export default class NftList extends Command {
|
|
6
|
+
static description = 'List NFTs owned by a user';
|
|
7
|
+
static args = {
|
|
8
|
+
identifier: Args.string({
|
|
9
|
+
description: 'Twitter username, ETH address, or ENS name',
|
|
10
|
+
required: true,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
static examples = [
|
|
14
|
+
'<%= config.bin %> <%= command.id %> sethgho',
|
|
15
|
+
'<%= config.bin %> <%= command.id %> 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
|
|
16
|
+
'<%= config.bin %> <%= command.id %> vitalik.eth --json',
|
|
17
|
+
];
|
|
18
|
+
static flags = {
|
|
19
|
+
json: Flags.boolean({
|
|
20
|
+
char: 'j',
|
|
21
|
+
description: 'Output as JSON',
|
|
22
|
+
default: false,
|
|
23
|
+
}),
|
|
24
|
+
verbose: Flags.boolean({
|
|
25
|
+
char: 'v',
|
|
26
|
+
description: 'Show detailed error information',
|
|
27
|
+
default: false,
|
|
28
|
+
}),
|
|
29
|
+
limit: Flags.integer({
|
|
30
|
+
char: 'l',
|
|
31
|
+
description: 'Max results per request',
|
|
32
|
+
default: 10,
|
|
33
|
+
}),
|
|
34
|
+
offset: Flags.integer({
|
|
35
|
+
char: 'o',
|
|
36
|
+
description: 'Number of results to skip',
|
|
37
|
+
default: 0,
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
async run() {
|
|
41
|
+
const { args, flags } = await this.parse(NftList);
|
|
42
|
+
const client = new EchoClient();
|
|
43
|
+
try {
|
|
44
|
+
const user = await client.resolveUser(args.identifier);
|
|
45
|
+
const userkey = client.getPrimaryUserkey(user);
|
|
46
|
+
if (!userkey) {
|
|
47
|
+
throw new Error('Could not determine userkey for user');
|
|
48
|
+
}
|
|
49
|
+
const response = await client.getNftsForUser(userkey, { limit: flags.limit, offset: flags.offset });
|
|
50
|
+
if (flags.json) {
|
|
51
|
+
this.log(output(response));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
this.log(formatNfts(response.values, response.total));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
if (error instanceof Error) {
|
|
59
|
+
this.log(formatError(error, flags.verbose));
|
|
60
|
+
this.exit(1);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class ReviewInfo extends Command {
|
|
3
|
+
static aliases: string[];
|
|
4
|
+
static args: {
|
|
5
|
+
id: import("@oclif/core/interfaces").Arg<number, {
|
|
6
|
+
max?: number;
|
|
7
|
+
min?: number;
|
|
8
|
+
}>;
|
|
9
|
+
};
|
|
10
|
+
static description: string;
|
|
11
|
+
static examples: string[];
|
|
12
|
+
static flags: {
|
|
13
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
};
|
|
16
|
+
run(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { EchoClient } from '../../lib/api/echo-client.js';
|
|
3
|
+
import { formatError } from '../../lib/formatting/error.js';
|
|
4
|
+
import { formatReview, output } from '../../lib/formatting/output.js';
|
|
5
|
+
export default class ReviewInfo extends Command {
|
|
6
|
+
static aliases = ['ri'];
|
|
7
|
+
static args = {
|
|
8
|
+
id: Args.integer({
|
|
9
|
+
description: 'Review ID',
|
|
10
|
+
required: true,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
static description = 'Get details of a specific review';
|
|
14
|
+
static examples = [
|
|
15
|
+
'<%= config.bin %> <%= command.id %> 1139',
|
|
16
|
+
'<%= config.bin %> <%= command.id %> 1139 --json',
|
|
17
|
+
];
|
|
18
|
+
static flags = {
|
|
19
|
+
json: Flags.boolean({
|
|
20
|
+
char: 'j',
|
|
21
|
+
description: 'Output as JSON',
|
|
22
|
+
default: false,
|
|
23
|
+
}),
|
|
24
|
+
verbose: Flags.boolean({
|
|
25
|
+
char: 'v',
|
|
26
|
+
description: 'Show detailed error information',
|
|
27
|
+
default: false,
|
|
28
|
+
}),
|
|
29
|
+
};
|
|
30
|
+
async run() {
|
|
31
|
+
const { args, flags } = await this.parse(ReviewInfo);
|
|
32
|
+
const client = new EchoClient();
|
|
33
|
+
try {
|
|
34
|
+
const review = await client.getReview(args.id);
|
|
35
|
+
if (flags.json) {
|
|
36
|
+
this.log(output(review));
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this.log(formatReview(review));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
if (error instanceof Error) {
|
|
44
|
+
this.log(formatError(error, flags.verbose));
|
|
45
|
+
this.exit(1);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class ReviewList extends Command {
|
|
3
|
+
static aliases: string[];
|
|
4
|
+
static args: {
|
|
5
|
+
identifier: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static description: string;
|
|
8
|
+
static examples: string[];
|
|
9
|
+
static flags: {
|
|
10
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
offset: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { EchoClient } from '../../lib/api/echo-client.js';
|
|
3
|
+
import { formatError } from '../../lib/formatting/error.js';
|
|
4
|
+
import { formatReviews, output } from '../../lib/formatting/output.js';
|
|
5
|
+
export default class ReviewList extends Command {
|
|
6
|
+
static aliases = ['rl'];
|
|
7
|
+
static args = {
|
|
8
|
+
identifier: Args.string({
|
|
9
|
+
description: 'Twitter username, ETH address, or ENS name',
|
|
10
|
+
required: true,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
static description = 'List reviews for a user';
|
|
14
|
+
static examples = [
|
|
15
|
+
'<%= config.bin %> <%= command.id %> sethgho',
|
|
16
|
+
'<%= config.bin %> <%= command.id %> 0xNowater --limit 20',
|
|
17
|
+
'<%= config.bin %> <%= command.id %> vitalik.eth --json',
|
|
18
|
+
];
|
|
19
|
+
static flags = {
|
|
20
|
+
json: Flags.boolean({
|
|
21
|
+
char: 'j',
|
|
22
|
+
description: 'Output as JSON',
|
|
23
|
+
default: false,
|
|
24
|
+
}),
|
|
25
|
+
verbose: Flags.boolean({
|
|
26
|
+
char: 'v',
|
|
27
|
+
description: 'Show detailed error information',
|
|
28
|
+
default: false,
|
|
29
|
+
}),
|
|
30
|
+
limit: Flags.integer({
|
|
31
|
+
char: 'l',
|
|
32
|
+
description: 'Max results per request',
|
|
33
|
+
default: 10,
|
|
34
|
+
}),
|
|
35
|
+
offset: Flags.integer({
|
|
36
|
+
char: 'o',
|
|
37
|
+
description: 'Number of results to skip',
|
|
38
|
+
default: 0,
|
|
39
|
+
}),
|
|
40
|
+
};
|
|
41
|
+
async run() {
|
|
42
|
+
const { args, flags } = await this.parse(ReviewList);
|
|
43
|
+
const client = new EchoClient();
|
|
44
|
+
try {
|
|
45
|
+
const user = await client.resolveUser(args.identifier);
|
|
46
|
+
const userkey = client.getPrimaryUserkey(user);
|
|
47
|
+
if (!userkey) {
|
|
48
|
+
this.error('Could not determine userkey for user', { exit: 1 });
|
|
49
|
+
}
|
|
50
|
+
const reviews = await client.getReviewsForUser(userkey, {
|
|
51
|
+
limit: flags.limit,
|
|
52
|
+
offset: flags.offset,
|
|
53
|
+
});
|
|
54
|
+
if (flags.json) {
|
|
55
|
+
this.log(output(reviews));
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
this.log(formatReviews(reviews, reviews.length));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
if (error instanceof Error) {
|
|
63
|
+
this.log(formatError(error, flags.verbose));
|
|
64
|
+
this.exit(1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class ReviewVotes extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
id: import("@oclif/core/interfaces").Arg<number, {
|
|
5
|
+
max?: number;
|
|
6
|
+
min?: number;
|
|
7
|
+
}>;
|
|
8
|
+
};
|
|
9
|
+
static description: string;
|
|
10
|
+
static examples: string[];
|
|
11
|
+
static flags: {
|
|
12
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
stats: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
upvotes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
downvotes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
offset: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
};
|
|
20
|
+
run(): Promise<void>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { EchoClient } from '../../lib/api/echo-client.js';
|
|
3
|
+
import { formatError } from '../../lib/formatting/error.js';
|
|
4
|
+
import { formatVotes, formatVoteStats, output } from '../../lib/formatting/output.js';
|
|
5
|
+
export default class ReviewVotes extends Command {
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.integer({
|
|
8
|
+
description: 'Review ID',
|
|
9
|
+
required: true,
|
|
10
|
+
}),
|
|
11
|
+
};
|
|
12
|
+
static description = 'Show votes on a review';
|
|
13
|
+
static examples = [
|
|
14
|
+
'<%= config.bin %> <%= command.id %> 123',
|
|
15
|
+
'<%= config.bin %> <%= command.id %> 123 --stats',
|
|
16
|
+
'<%= config.bin %> <%= command.id %> 123 --upvotes',
|
|
17
|
+
'<%= config.bin %> <%= command.id %> 123 --json',
|
|
18
|
+
];
|
|
19
|
+
static flags = {
|
|
20
|
+
json: Flags.boolean({
|
|
21
|
+
char: 'j',
|
|
22
|
+
description: 'Output as JSON',
|
|
23
|
+
default: false,
|
|
24
|
+
}),
|
|
25
|
+
verbose: Flags.boolean({
|
|
26
|
+
char: 'v',
|
|
27
|
+
description: 'Show detailed error information',
|
|
28
|
+
default: false,
|
|
29
|
+
}),
|
|
30
|
+
stats: Flags.boolean({
|
|
31
|
+
char: 's',
|
|
32
|
+
description: 'Show vote statistics only',
|
|
33
|
+
default: false,
|
|
34
|
+
}),
|
|
35
|
+
upvotes: Flags.boolean({
|
|
36
|
+
description: 'Show only upvotes',
|
|
37
|
+
exclusive: ['downvotes'],
|
|
38
|
+
}),
|
|
39
|
+
downvotes: Flags.boolean({
|
|
40
|
+
description: 'Show only downvotes',
|
|
41
|
+
exclusive: ['upvotes'],
|
|
42
|
+
}),
|
|
43
|
+
limit: Flags.integer({
|
|
44
|
+
char: 'l',
|
|
45
|
+
description: 'Max results per request',
|
|
46
|
+
default: 10,
|
|
47
|
+
}),
|
|
48
|
+
offset: Flags.integer({
|
|
49
|
+
char: 'o',
|
|
50
|
+
description: 'Number of results to skip',
|
|
51
|
+
default: 0,
|
|
52
|
+
}),
|
|
53
|
+
};
|
|
54
|
+
async run() {
|
|
55
|
+
const { args, flags } = await this.parse(ReviewVotes);
|
|
56
|
+
const client = new EchoClient();
|
|
57
|
+
try {
|
|
58
|
+
if (flags.stats) {
|
|
59
|
+
const stats = await client.getVoteStats(args.id, 'review');
|
|
60
|
+
if (flags.json) {
|
|
61
|
+
this.log(output(stats));
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
this.log(formatVoteStats(stats, 'review', args.id));
|
|
65
|
+
}
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const params = {
|
|
69
|
+
limit: flags.limit,
|
|
70
|
+
offset: flags.offset,
|
|
71
|
+
};
|
|
72
|
+
if (flags.upvotes)
|
|
73
|
+
params.isUpvote = true;
|
|
74
|
+
if (flags.downvotes)
|
|
75
|
+
params.isUpvote = false;
|
|
76
|
+
const response = await client.getVotes(args.id, 'review', params);
|
|
77
|
+
if (flags.json) {
|
|
78
|
+
this.log(output(response));
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this.log(formatVotes(response.values, response.total, 'review'));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
if (error instanceof Error) {
|
|
86
|
+
this.log(formatError(error, flags.verbose));
|
|
87
|
+
this.exit(1);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class ScoreStatus extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
identifier: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { EchoClient } from '../../lib/api/echo-client.js';
|
|
3
|
+
import { formatError } from '../../lib/formatting/error.js';
|
|
4
|
+
import { formatScoreStatus, output } from '../../lib/formatting/output.js';
|
|
5
|
+
export default class ScoreStatus extends Command {
|
|
6
|
+
static args = {
|
|
7
|
+
identifier: Args.string({
|
|
8
|
+
description: 'Twitter username, ETH address, or ENS name',
|
|
9
|
+
required: true,
|
|
10
|
+
}),
|
|
11
|
+
};
|
|
12
|
+
static description = 'Check score calculation status for a user';
|
|
13
|
+
static examples = [
|
|
14
|
+
'<%= config.bin %> <%= command.id %> 0xNowater',
|
|
15
|
+
'<%= config.bin %> <%= command.id %> vitalik.eth',
|
|
16
|
+
'<%= config.bin %> <%= command.id %> 0xNowater --json',
|
|
17
|
+
];
|
|
18
|
+
static flags = {
|
|
19
|
+
json: Flags.boolean({
|
|
20
|
+
char: 'j',
|
|
21
|
+
description: 'Output as JSON',
|
|
22
|
+
default: false,
|
|
23
|
+
}),
|
|
24
|
+
verbose: Flags.boolean({
|
|
25
|
+
char: 'v',
|
|
26
|
+
description: 'Show detailed error information',
|
|
27
|
+
default: false,
|
|
28
|
+
}),
|
|
29
|
+
};
|
|
30
|
+
async run() {
|
|
31
|
+
const { args, flags } = await this.parse(ScoreStatus);
|
|
32
|
+
const client = new EchoClient();
|
|
33
|
+
try {
|
|
34
|
+
const user = await client.resolveUser(args.identifier);
|
|
35
|
+
const userkey = client.getPrimaryUserkey(user);
|
|
36
|
+
if (!userkey) {
|
|
37
|
+
this.error('Could not determine userkey for this user', { exit: 1 });
|
|
38
|
+
}
|
|
39
|
+
const status = await client.getScoreStatus(userkey);
|
|
40
|
+
if (flags.json) {
|
|
41
|
+
this.log(output({ ...status, identifier: args.identifier }));
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this.log(formatScoreStatus({ ...status, identifier: args.identifier }));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
if (error instanceof Error) {
|
|
49
|
+
this.log(formatError(error, flags.verbose));
|
|
50
|
+
this.exit(1);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class SlashInfo extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
id: import("@oclif/core/interfaces").Arg<number, {
|
|
6
|
+
max?: number;
|
|
7
|
+
min?: number;
|
|
8
|
+
}>;
|
|
9
|
+
};
|
|
10
|
+
static examples: string[];
|
|
11
|
+
static flags: {
|
|
12
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|