@alpha-arcade/sdk 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/index.cjs +7 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -344,12 +344,13 @@ const market = await client.getMarketFromApi('uuid-here');
|
|
|
344
344
|
|
|
345
345
|
#### `getRewardMarkets()`
|
|
346
346
|
|
|
347
|
-
Fetches markets that have liquidity rewards from the Alpha REST API. Requires `apiKey`. Returns the same `Market[]` shape with reward fields populated: `totalRewards`, `rewardsPaidOut`, `rewardsSpreadDistance`, `rewardsMinContracts`, `lastRewardAmount`, `lastRewardTs`.
|
|
347
|
+
Fetches markets that have liquidity rewards from the Alpha REST API. Requires `apiKey`. Returns the same `Market[]` shape with reward fields populated: `totalRewards`, `totalPregameRewards`, `rewardsPaidOut`, `rewardsSpreadDistance`, `rewardsMinContracts`, `lastRewardAmount`, `lastRewardTs`. For sports markets, pregame liquidity rewards may be exposed via `totalPregameRewards`.
|
|
348
348
|
|
|
349
349
|
```typescript
|
|
350
350
|
const rewardMarkets = await client.getRewardMarkets();
|
|
351
351
|
for (const m of rewardMarkets) {
|
|
352
|
-
|
|
352
|
+
const rewardTotal = m.totalRewards ?? m.totalPregameRewards ?? 0;
|
|
353
|
+
console.log(`${m.title}: $${rewardTotal / 1e6} total rewards`);
|
|
353
354
|
}
|
|
354
355
|
```
|
|
355
356
|
|
package/dist/index.cjs
CHANGED
|
@@ -3102,12 +3102,18 @@ var getMarketFromApi = async (config, marketId) => {
|
|
|
3102
3102
|
}
|
|
3103
3103
|
return market;
|
|
3104
3104
|
};
|
|
3105
|
+
var hasRewardLiquidity = (market) => {
|
|
3106
|
+
if ((market.totalRewards ?? 0) > 0 || (market.totalPregameRewards ?? 0) > 0) {
|
|
3107
|
+
return true;
|
|
3108
|
+
}
|
|
3109
|
+
return (market.options ?? []).some((option) => (option.totalRewards ?? 0) > 0 || (option.totalPregameRewards ?? 0) > 0);
|
|
3110
|
+
};
|
|
3105
3111
|
var getRewardMarkets = async (config) => {
|
|
3106
3112
|
if (!config.apiKey) {
|
|
3107
3113
|
throw new Error("apiKey is required for API-based market fetching. Retrieve an API key from the Alpha Arcade platform via the Account page and pass it to the client.");
|
|
3108
3114
|
}
|
|
3109
3115
|
const markets = await getLiveMarketsFromApi(config);
|
|
3110
|
-
return markets.filter((
|
|
3116
|
+
return markets.filter((market) => hasRewardLiquidity(market));
|
|
3111
3117
|
};
|
|
3112
3118
|
var getLiveMarkets = async (config) => {
|
|
3113
3119
|
if (config.apiKey) {
|