Overview
runAdapter is the core function that executes a points adapter. It validates the address, fetches data from the provider’s API, processes the response, and returns a standardized result.
Function Signature
Parameters
The adapter export object containing the fetch, data, total functions, and configuration.Must include:
fetch: Function to retrieve raw datadata: Function to format data for displaytotal: Function to calculate total pointssupportedAddressTypes: Array of supported address types
The wallet address to query. Must be a valid EVM (0x…) or SVM (base58) address.Valid formats:
- EVM:
0xfollowed by 40 hexadecimal characters - SVM: Base58 string between 32-44 characters
Return Value
Returns a promise that resolves to an
AdapterResult object containing:__data: Raw API response datadata: Formatted, human-readable datatotal: Total points (number or labelled object)claimable: Whether points are claimable (boolean)rank: User’s rank position (number)deprecated: Deprecation timestamps (object)supportedAddressTypes: Supported address types (array)
Address Validation
The function performs two levels of address validation:1. Format Validation
Validates that the address matches either EVM or SVM format:2. Adapter Compatibility
Checks if the adapter supports the detected address type:Data Processing Pipeline
The function processes data through the following steps:1. Fetch Raw Data
2. Build Base Result
3. Add Optional Fields
4. Normalize Values
Usage Examples
Basic Usage
With Error Handling
Multi-Chain Adapter
Accessing Raw Data
Checking Deprecation Status
Error Cases
Invalid Address Format
Unsupported Address Type
Network/API Errors
Network errors from the adapter’sfetch function are not caught by runAdapter and will propagate to the caller:
Performance Considerations
- The function is async and waits for the adapter’s
fetchcall to complete - Network latency depends on the third-party API being queried
- Data processing (normalization, conversion) is synchronous and fast
- No caching is implemented at the
runAdapterlevel
Type Safety
See Also
- AdapterExport - Type definition for adapters
- AdapterResult - Type definition for results
- Address Detection - Address type validation utilities