Configuration
The SDK is configured through theBorrowSDKConfig object passed to the constructor.
Required Options
These options must be provided:apiKey
Your SatsTerminal API key for authentication.
| Type | Required |
|---|---|
string | Yes |
baseUrl
The SatsTerminal API endpoint.
| Type | Required | Example |
|---|---|---|
string | Yes | https://api.satsterminal.com |
chain
The EVM chain to use for borrowing.
| Type | Required | Values |
|---|---|---|
ChainType | Yes | ARBITRUM, BASE, ETHEREUM |
wallet
The wallet provider for signing operations.
| Property | Type | Required | Description |
|---|---|---|---|
address | string | Yes | Bitcoin address |
signMessage | (msg: string) => Promise<string> | Yes | Message signing function |
publicKey | string | No | Public key (hex) |
sendBitcoin | (to: string, sats: number) => Promise<string> | No | Bitcoin sending function |
Optional Options
workflowPollInterval
Interval (in milliseconds) for polling workflow status.
| Type | Default | Min |
|---|---|---|
number | 2000 | 100 |
sessionValiditySeconds
How long sessions remain valid (in seconds).
| Type | Default | Min |
|---|---|---|
number | 259200 (3 days) | 60 |
autoTrackWorkflows
Automatically track workflow status after operations.
| Type | Default |
|---|---|
boolean | true |
quoteSelector
Custom function to select a quote from available options.
| Type | Default |
|---|---|
(quotes: Quote[]) => Quote | First quote |
storage
Custom storage provider for persisting signatures.
| Type | Default |
|---|---|
StorageProvider | localStorage / MemoryStorage |
retryConfig
Configuration for automatic request retries.
| Property | Type | Default |
|---|---|---|
maxRetries | number | 3 |
retryDelay | number | 1000 |
retryableStatusCodes | number[] | [408, 429, 500, 502, 503, 504] |
logger
Custom logger for debugging.
| Type | Default |
|---|---|
Logger | console |
rpcUrl
Custom RPC URL for the selected chain.
| Type | Default |
|---|---|
string | Chain default |
bundlerUrl
Custom bundler URL for ERC-4337 operations.
| Type | Default |
|---|---|
string | Platform default |
Full Configuration Example
Environment-Based Configuration
Validation
The SDK validates configuration on initialization:Validation Rules
| Option | Rule |
|---|---|
apiKey | Non-empty string |
baseUrl | Valid URL |
chain | One of ChainType values |
wallet.address | Non-empty string |
wallet.signMessage | Function |
workflowPollInterval | >= 100 |
sessionValiditySeconds | >= 60 |