///
The `Account` model in the Quicksilver SDK transforms raw account data into an "active record" object, encapsulating both data and behavior. Instead of merely being a data structure, an `Account` obje
69 views
~69 views from guests
Guest views are estimated from total page views. These include anonymous visitors and users who weren't logged in when they viewed the page.
The Account model in the Quicksilver SDK transforms raw account data into an "active record" object, encapsulating both data and behavior. Instead of merely being a data structure, an Account object provides fluent methods to interact with the Quicksilver Engine, enabling operations like delegating sub-accounts, initiating transactions, managing limits, and handling KYC verification directly on the object. This design promotes a more intuitive, type-safe, and object-oriented approach to building agent commerce applications.
Account Classnew Account(data, http)data: AccountData - The raw data representing an account as returned by the API.http: HttpClient - The HTTP client instance used for API requests.Description: Initializes a new Account instance. This constructor is typically called internally by the QuicksilverClient or AccountsResource when fetching or creating an account.
Account objects expose their underlying data through convenient getters, ensuring type safety and encapsulation.
id: stringname: stringaccountType: stringparentId: string | nullnull.meta: Record<string, any>limits: { daily?: number | null; per_transaction?: number | null; total?: number | null }createdAt: stringupdatedAt: stringchildren: string[]Account objects provide methods that reflect the real-world actions and queries one might perform on an account.
refresh(): Promise<this>Account object's data by fetching the latest information from the Quicksilver Engine.Promise<this> - A promise that resolves with the refreshed Account instance.getChildren(): Promise<Account[]>Promise<Account[]> - A promise that resolves to an array of Account objects representing the children.updateLimits(limits): Promise<this>limits: { daily?: number; per_transaction?: number; total?: number } - An object specifying the new daily, per-transaction, or total limits for the account.Promise<this> - A promise that resolves with the updated Account instance.getBalance(): Promise<{ amount: number; currency: string }>Promise<{ amount: number; currency: string }> - A promise that resolves to an object containing the account's balance amount and currency.delegate(options): Promise<Account>options: { name: string, limits: { daily: number } } - Options for the new delegated sub-agent, including its name and daily transaction limits.Promise<Account> - A promise that resolves to the newly created and delegated Account object.transaction(details): Transactiondetails: Omit<TransactionData, 'from' | 'id' | 'state' | 'created_at' | 'updated_at' | 'children'> - The details for the new transaction, excluding the from field (which is implicitly this account's ID) and system-generated fields.Transaction object in a 'Draft' state, allowing for further fluent configuration before execution.Transaction - A new Transaction object configured with this account as the sender.purchase(product, options): Promise<Transaction>product: Product - The programmable product to purchase. This should be an instance of ProductBuilder configured with the product's details.options: Record<string, any> - Additional options or context specific to the purchase, such as quantity, specific configurations, or dynamic parameters.Promise<Transaction> - A promise that resolves to the Transaction object created for the purchase.isVerified(): booleanboolean - true if the account is verified, false otherwise.isRootAccount(): booleanboolean - true if it's a root account, false otherwise.canTransact(): booleanboolean - true if the account can transact, false otherwise.canDelegate(): booleanboolean - true if the account can delegate, false otherwise.submitKYC(kycData): Promise<this>kycData: { document_type: string; document_number: string; document_file?: File | Blob; } - An object containing details for KYC document submission, including document type, number, and an optional file.Promise<this> - A promise that resolves with the updated Account instance.verify(verifiedBy: string): Promise<this>verifiedBy: string - The identifier of the user or system performing the verification (e.g., 'admin_user_id').Promise<this> - A promise that resolves with the updated Account instance.rejectVerification(reason: string): Promise<this>reason: string - A detailed reason for rejecting the KYC verification.Promise<this> - A promise that resolves with the updated Account instance.getVerificationStatus(): { status: 'unverified' | 'pending' | 'verified' | 'rejected'; verified_at?: string | null; kyc_data?: { document_type?: string; document_number?: string; verified_by?: string; } | null; }object - An object containing the verification status, verified_at timestamp, and kyc_data (if available).