client.sub_accounts contains API-key-safe reads and private streams. Mutations and
member/invite administration are JWT/session-only and are not exposed.
Methods
| Method | Summary |
|---|---|
list | List subaccounts. |
get | Read a numeric subaccount ID. |
list_members / list_invites | Read members or invitations. |
list_activity | Read paginated activity. |
subscribe / subscribe_api_keys | Stream private subaccount updates. |
use polyester::proto::auth::v1::ListSubaccountsRequest;
use polyester::services::GetSubaccountOpts;
let subs = client
.sub_accounts
.list(ListSubaccountsRequest::default())
.await?;
for subaccount in subs.subaccounts {
println!(
"{} {} {}",
subaccount.subaccount_id, subaccount.label, subaccount.status
);
}
let detail = client
.sub_accounts
.get(123, GetSubaccountOpts {
include_members: true,
include_policy: true,
..Default::default()
})
.await?;get takes a non-zero subaccount ID: get(0, ..) returns Error::Validation before sending. get returns the subaccount's balances when GetSubaccountOpts.include_balances is set, as GetSubaccountResult.balances, in the shape of balances.list (None unless asked for). It needs
the READ_BALANCES action on the subaccount, or the read fails with PermissionDenied. A
root-scoped API key cannot read a subaccount's balances this way. When balances cannot be read right
now, the read fails with the retryable AUTH_TEMPORARILY_UNAVAILABLE. You can also read them with client.balances.list and a GetBalancesRequest whose subaccount_id names the subaccount.
Use Config.default_sub_account_id or method request fields to scope trading. Subaccount IDs are
canonical public base58 strings in client configuration; do not reinterpret digit-only values as
decimal. They are not the root Account ID used in private channel names. Replay activity page tokens unchanged.
Subscribe methods accept an optional argument because None falls back to Config.default_account_id; one of those two sources must provide the root Account ID.
GetSubaccountOpts intentionally lives in polyester::services; the import above matches the
public SDK.