-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaccounts.ts
More file actions
25 lines (22 loc) · 835 Bytes
/
accounts.ts
File metadata and controls
25 lines (22 loc) · 835 Bytes
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
import { Command } from "commander"
import type { OpenSeaClient } from "../client.js"
import type { OutputFilterOptions, OutputFormat } from "../output.js"
import { formatOutput } from "../output.js"
import type { Account } from "../types/index.js"
export function accountsCommand(
getClient: () => OpenSeaClient,
getFormat: () => OutputFormat,
getFilters?: () => OutputFilterOptions,
): Command {
const cmd = new Command("accounts").description("Query accounts")
cmd
.command("get")
.description("Get an account by address")
.argument("<address>", "Wallet address")
.action(async (address: string) => {
const client = getClient()
const result = await client.get<Account>(`/api/v2/accounts/${address}`)
console.log(formatOutput(result, getFormat(), getFilters?.()))
})
return cmd
}