Overview
AdapterExport<T> is the primary interface for creating a points adapter. It defines the structure that each adapter must export to integrate with the SDK.
Type Definition
Type Parameters
The type of data returned by the
fetch function. This represents the raw API response from the points provider.Properties
Fetches raw data from the points provider’s API for a given address.Parameters:
address(string): User’s wallet address (EVM or SVM format)
TExample:Transforms raw API data into a human-readable format for display.Parameters:
data(T): Raw data returned from thefetchfunction
DetailedData: Object with string/number values ({ [key: string]: string | number })LabelledDetailedData: Nested object for categorized data ({ [label: string]: DetailedData })
Calculates the total points for the address.Parameters:Example (labelled points):
data(T): Raw data returned from thefetchfunction
number: Single total points valueLabelledPoints: Object with multiple point categories ({ [label: string]: number })
Determines if points are currently claimable as rewards.Parameters:
data(T): Raw data returned from thefetchfunction
Extracts the user’s rank from the data.Parameters:
data(T): Raw data returned from thefetchfunction
Specifies deprecation timestamps for different point categories. Used to indicate when a points program has ended.Parameters:
data(T): Raw data returned from thefetchfunction
{ [label: string]: number })Example:Array of supported blockchain address types.Possible values:Example (multi-chain):
"evm": Ethereum Virtual Machine addresses (0x…)"svm": Solana Virtual Machine addresses (base58)
Complete Example
Here’s a complete adapter implementation fromsonic.ts:
Advanced Example with All Optional Fields
Fromdebridge.ts, showing an adapter with all optional fields:
Related Types
DetailedData:{ [key: string]: string | number }LabelledDetailedData:{ [label: string]: DetailedData }LabelledPoints:{ [label: string]: number }DeprecatedLabels:{ [label: string]: number }AddressType:"evm" | "svm"
See Also
- AdapterResult - The result type returned after running an adapter
- runAdapter - Function to execute an adapter