Overview
AdapterResult<T> represents the structured output returned by the runAdapter function after successfully executing an adapter. It includes both the raw API data and all processed fields.
Type Definition
Type Parameters
The type of raw data returned by the adapter’s
fetch function. This matches the generic type parameter of the corresponding AdapterExport<T>.Properties
The raw, unprocessed data returned from the adapter’s
fetch function. Useful for debugging or accessing fields not included in the processed data object.Example:Human-readable, formatted data processed by the adapter’s Example (labelled format):
data function. All numeric values are normalized for display.Type definitions:DetailedData:{ [key: string]: string | number }LabelledDetailedData:{ [label: string]: DetailedData }
The total points value(s) processed by the adapter’s Example (labelled points):
total function. Numeric values are parsed and converted, objects have integer values.Type definition:LabelledPoints:{ [label: string]: number }
Indicates whether the points are currently claimable. This field is always present in the result, defaulting to
false if the adapter doesn’t define a claimable function.Example:The user’s rank position. Defaults to
0 if the adapter doesn’t define a rank function or if the user is unranked.Example:Unix timestamps indicating when different point categories were deprecated. Returns an empty object
{} if the adapter doesn’t define deprecation.Type definition:DeprecatedLabels:{ [label: string]: number }
Array of blockchain address types supported by this adapter.Possible values:Example (multi-chain):
"evm": Ethereum Virtual Machine addresses"svm": Solana Virtual Machine addresses
Complete Example
Result from running the Sonic adapter:Example with All Optional Fields
Result from running the DeBridge adapter:Data Processing
TherunAdapter function applies the following transformations to create the result:
- Data normalization: Converts values using
convertValuesToNormal()for display - Total conversion:
- Numbers: Parsed as float with fallback to 0
- Objects: Converted to integers using
convertValuesToInt()
- Claimable: Always converted to boolean (defaults to
false) - Rank: Converted to number (defaults to
0) - Deprecated: Converted to integer timestamps or empty object
{}
Usage
See Also
- AdapterExport - The adapter definition structure
- runAdapter - Function that produces this result type