The `Account` active model represents a financial account within the Quicksilver Engine. It provides a fluent interface for interacting with account data and performing various account-related operati
The Account active model represents a financial account within the Quicksilver Engine. It provides a fluent interface for interacting with account data and performing various account-related operations directly on the object.
Accountconstructor(data: AccountData, http: HttpClient)Initializes a new Account instance.
data: AccountData - The raw account data retrieved from the API.http: HttpClient - An instance of the HTTP client for making API requests.id: stringstring // The unique identifier for the account.
name: stringstring // The name of the account.
accountType: stringstring // The type of account (e.g., 'Human', 'AgentMain', 'AgentDelegated').
parentId: string | nullstring | null // The ID of the parent account if this is a delegated account.
meta: Record<string, any>Record<string, any> // Custom metadata associated with the account.
limits: { daily?: number | null; per_transaction?: number | null; total?: number | null }{ daily?: number | null; per_transaction?: number | null; total?: number | null } // Transaction limits for the account (daily, per transaction, total).
createdAt: stringstring // The ISO 8601 timestamp when the account was created.
updatedAt: stringstring // The ISO 8601 timestamp when the account was last updated.
children: string[]string[] // An array of IDs of direct child accounts.
delegate(options: { name: string, limits: { daily: number } }): Promise<Account>Promise<Account> // Delegates a new sub-agent account from this account.
options: { name: string, limits: { daily: number } } - Options for the new sub-agent, including name and daily transaction limits.transaction(details: Omit<TransactionData, 'from' | 'id' | 'state' | 'created_at' | 'updated_at' | 'children'>): TransactionTransaction // Creates a new transaction originating from this account. Returns a fluent Transaction object.
details: Omit<TransactionData, 'from' | 'id' | 'state' | 'created_at' | 'updated_at' | 'children'> - The details for the new transaction, excluding auto-populated fields.purchase(product: Product, options: { [key: string]: any }): Promise<Transaction>Promise<Transaction> // Purchases a programmable product using this account as the payer.
product: Product - The Product object to purchase.options: { [key: string]: any } - Additional options related to the purchase.refresh(): Promise<this>Promise<this> // Refreshes the account's data from the server, updating the current instance.
getChildren(): Promise<Account[]>Promise<Account[]> // Retrieves all direct child accounts (delegated sub-agents) of this account.
updateLimits(limits: { daily?: number; per_transaction?: number; total?: number }): Promise<this>Promise<this> // Updates the transaction limits for this account.
limits: { daily?: number; per_transaction?: number; total?: number } - An object containing the limits to update.getBalance(): Promise<{ amount: number; currency: string }>Promise<{ amount: number; currency: string }> // Retrieves the current balance of the account.
isVerified(): booleanboolean // Checks if the account has been verified.
isRootAccount(): booleanboolean // Checks if the account is a root account (i.e., has no parent account).
submitKYC(kycData: { document_type: string; document_number: string; document_file?: File | Blob; }): Promise<this>Promise<this> // Submits Know Your Customer (KYC) verification documents for the account.
kycData: { document_type: string; document_number: string; document_file?: File | Blob; } - The KYC information and optional document file.verify(verifiedBy: string): Promise<this>Promise<this> // Marks the account as verified (typically an administrative action).
verifiedBy: string - The identifier of the user or system that performed the verification.rejectVerification(reason: string): Promise<this>Promise<this> // Rejects the account's verification status (typically an administrative action).
reason: string - The reason for rejecting the verification.getVerificationStatus(): { status: 'unverified' | 'pending' | 'verified' | 'rejected'; verified_at?: string | null; kyc_data?: { document_type?: string; document_number?: string; verified_by?: string; } | null; }{ status: 'unverified' | 'pending' | 'verified' | 'rejected'; verified_at?: string | null; kyc_data?: { document_type?: string; document_number?: string; verified_by?: string; } | null; } // Retrieves the current verification status and related details for the account.
canTransact(): booleanboolean // Checks if the account is authorized to perform transactions (typically requires verification).
canDelegate(): booleanboolean // Checks if the account is authorized to delegate sub-agents (typically requires verification).