///
The `QuicksilverClient` is the primary entry point for interacting with the Quicksilver Engine API. It provides a fluent Domain-Specific Language (DSL) for programmable money, allowing developers to b
74 views
~74 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 QuicksilverClient is the primary entry point for interacting with the Quicksilver Engine API. It provides a fluent Domain-Specific Language (DSL) for programmable money, allowing developers to build sophisticated economic interactions with type-safe code.
new QuicksilverClient(apiKey, options?)apiKey: string - Your Quicksilver API key.options: ClientOptions (optional) - Configuration options for the client.
env: 'production' | 'sandbox' - The API environment to use. Defaults to production.baseURL: string - Overrides the default base URL for the API.timeout: number - Request timeout in milliseconds. Defaults to 30000 (30 seconds).Description: Initializes a new instance of the QuicksilverClient with the provided API key and options. The env option allows switching between production and sandbox environments easily.
These methods are the core of the SDK's fluent DSL, enabling expressive and type-safe definition of complex financial logic and products.
condition(): ConditionBuilderConditionBuilderDescription: Creates a new ConditionBuilder instance. This is the entry point for defining sophisticated conditional logic, such as when(event).then(action).otherwise(fallbackAction). It transforms complex JSON structures into readable, chainable methods.
Usage:
product(id: string): ProductBuilderid: string - A unique identifier for the product.ProductBuilderDescription: Creates a new ProductBuilder instance. This is the entry point for defining programmable products and services, allowing you to encapsulate pricing, guarantees, and multi-agent workflows.
Usage:
These methods allow you to instantiate active model objects from raw API data, enabling object-oriented interaction with your financial primitives.
createAccount(data: any): Accountdata: any - The raw data representing an account as returned by the API.AccountDescription: Creates an Account object from raw account data. This method is useful when you retrieve account data from a list or webhook and want to transform it into an active model with fluent methods for further operations.
Usage:
createTransaction(data: any): Transactiondata: any - The raw data representing a transaction as returned by the API.TransactionDescription: Creates a Transaction object from raw transaction data. Similar to createAccount, this method enables you to work with transaction data using the active Transaction model's fluent interface after fetching it directly from the API.
Usage:
The client provides direct access to resource objects (client.accounts, client.transactions, etc.) which handle the underlying REST API calls for their respective domains. While the SDK promotes using fluent DSL builders and active models (like Account.transaction()), these resource objects offer a lower-level interface for direct CRUD operations.
client.accounts: AccountsResource: Provides methods for creating, retrieving, listing, updating, and deleting accounts. Methods like client.accounts.create() directly return an Account model, bridging the gap to the fluent API.client.transactions: TransactionsResource: Provides methods for creating, retrieving, listing, updating, and deleting transactions. Methods like client.transactions.create() directly return a Transaction model.client.streams: StreamsResource: Provides methods for managing streaming transactions and subscribing to real-time events.client.admin: AdminResource: Provides administrative operations (e.g., getting system stats, listing all accounts/transactions). These typically require elevated privileges.client.gateways: GatewaysResource: Provides methods related to integrating and interacting with payment gateways.client.kyc: KycResource: Provides methods for initiating and managing Know Your Customer (KYC) verification processes.Usage:
getApiKey(): stringstring - The API key used by the client, partially masked for security.Description: Retrieves the API key currently configured for the client, with the middle portion masked.
getBaseURL(): stringstring - The base URL being used for API requests.Description: Retrieves the base URL (e.g., https://api.quicksilver.com or http://localhost:3000 for sandbox) that the client is configured to connect to.
ping(): Promise<{ pong: boolean; timestamp: string }>Promise<{ pong: boolean; timestamp: string }> - A promise that resolves with a pong response object.Description: Sends a simple request to the API to check if the service is alive and responsive.
health(): Promise<{ status: string; version: string; timestamp: string }>Promise<{ status: string; version: string; timestamp: string }> - A promise that resolves with the health status of the API.Description: Retrieves detailed health information about the Quicksilver Engine, including its status, version, and current timestamp.
getOpenApiSpec(): Promise<any>Promise<any> - A promise that resolves with the OpenAPI specification JSON.Description: Fetches the OpenAPI specification (formerly Swagger) for the Quicksilver Engine API, providing a machine-readable description of all available endpoints and data models.