Accounts(账户)
Account 资源用于查询你在 GStable 下的账户详情。
访问账户 API
在 GStableClient 实例上通过 client.account 调用账户相关方法。
只读资源
SDK 中的 Account 资源为只读。若要创建或修改账户设置,请使用 GStable 控制台(Dashboard)。
TypeScript 类型
账户相关类型可从包根路径导入:
import type { Account, AccountStatus, AccountType } from 'gstable-js';
list
单次响应返回当前 API 密钥可见的全部账户(服务端无分页)。
client.account.list()
参数
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
| — | — | — | 无参数。 |
返回值
Promise<Account[]> — 账户对象数组(accountId、accountName、accountAddress、accountType、settlementCurrencies、version、status,以及可选 createAt / updateAt)。
示例
import { GStableClient } from 'gstable-js';
const client = new GStableClient({ apiKey: process.env.GSTABLE_API_KEY! });
const accounts = await client.account.list();
console.log(accounts.map((a) => a.accountId));
detail
按 id 加载单个账户。
client.account.detail(accountId)
参数
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
accountId | string | 是 | 账户标识符。 |
返回值
Promise<Account> — 单条 Account。
示例
import { GStableClient } from 'gstable-js';
const client = new GStableClient({ apiKey: process.env.GSTABLE_API_KEY! });
const account = await client.account.detail('acc_xxxxxxxx');
console.log(account.settlementCurrencies);