@alpha-arcade/sdk 0.2.7 → 0.2.9
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 +58 -3
- package/dist/index.cjs +19 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +19 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -46,6 +46,13 @@ type Market = {
|
|
|
46
46
|
featured?: boolean;
|
|
47
47
|
options?: MarketOption[];
|
|
48
48
|
feeBase?: number;
|
|
49
|
+
/** Liquidty Rewards Info */
|
|
50
|
+
totalRewards?: number;
|
|
51
|
+
rewardsPaidOut?: number;
|
|
52
|
+
rewardsSpreadDistance?: number;
|
|
53
|
+
rewardsMinContracts?: number;
|
|
54
|
+
lastRewardAmount?: number;
|
|
55
|
+
lastRewardTs?: number;
|
|
49
56
|
/** Data source: 'onchain' or 'api' */
|
|
50
57
|
source?: 'onchain' | 'api';
|
|
51
58
|
[key: string]: unknown;
|
|
@@ -503,6 +510,12 @@ declare class AlphaClient {
|
|
|
503
510
|
* @returns Array of live markets from the API
|
|
504
511
|
*/
|
|
505
512
|
getLiveMarketsFromApi(): Promise<Market[]>;
|
|
513
|
+
/**
|
|
514
|
+
* Fetches the reward markets from the Alpha REST API (requires API key).
|
|
515
|
+
*
|
|
516
|
+
* @returns Array of reward markets
|
|
517
|
+
*/
|
|
518
|
+
getRewardMarkets(): Promise<Market[]>;
|
|
506
519
|
/**
|
|
507
520
|
* Fetches a single market by ID from the Alpha REST API (requires API key).
|
|
508
521
|
*
|
|
@@ -553,7 +566,7 @@ declare const getLiveMarketsFromApi: (config: AlphaClientConfig) => Promise<Mark
|
|
|
553
566
|
*/
|
|
554
567
|
declare const getMarketFromApi: (config: AlphaClientConfig, marketId: string) => Promise<Market | null>;
|
|
555
568
|
|
|
556
|
-
declare const DEFAULT_API_BASE_URL = "https://
|
|
569
|
+
declare const DEFAULT_API_BASE_URL = "https://platform.alphaarcade.com/api";
|
|
557
570
|
declare const DEFAULT_MARKET_CREATOR_ADDRESS = "5P5Y6HTWUNG2E3VXBQDZN3ENZD3JPAIR5PKT3LOYJAPAUKOLFD6KANYTRY";
|
|
558
571
|
|
|
559
572
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -46,6 +46,13 @@ type Market = {
|
|
|
46
46
|
featured?: boolean;
|
|
47
47
|
options?: MarketOption[];
|
|
48
48
|
feeBase?: number;
|
|
49
|
+
/** Liquidty Rewards Info */
|
|
50
|
+
totalRewards?: number;
|
|
51
|
+
rewardsPaidOut?: number;
|
|
52
|
+
rewardsSpreadDistance?: number;
|
|
53
|
+
rewardsMinContracts?: number;
|
|
54
|
+
lastRewardAmount?: number;
|
|
55
|
+
lastRewardTs?: number;
|
|
49
56
|
/** Data source: 'onchain' or 'api' */
|
|
50
57
|
source?: 'onchain' | 'api';
|
|
51
58
|
[key: string]: unknown;
|
|
@@ -503,6 +510,12 @@ declare class AlphaClient {
|
|
|
503
510
|
* @returns Array of live markets from the API
|
|
504
511
|
*/
|
|
505
512
|
getLiveMarketsFromApi(): Promise<Market[]>;
|
|
513
|
+
/**
|
|
514
|
+
* Fetches the reward markets from the Alpha REST API (requires API key).
|
|
515
|
+
*
|
|
516
|
+
* @returns Array of reward markets
|
|
517
|
+
*/
|
|
518
|
+
getRewardMarkets(): Promise<Market[]>;
|
|
506
519
|
/**
|
|
507
520
|
* Fetches a single market by ID from the Alpha REST API (requires API key).
|
|
508
521
|
*
|
|
@@ -553,7 +566,7 @@ declare const getLiveMarketsFromApi: (config: AlphaClientConfig) => Promise<Mark
|
|
|
553
566
|
*/
|
|
554
567
|
declare const getMarketFromApi: (config: AlphaClientConfig, marketId: string) => Promise<Market | null>;
|
|
555
568
|
|
|
556
|
-
declare const DEFAULT_API_BASE_URL = "https://
|
|
569
|
+
declare const DEFAULT_API_BASE_URL = "https://platform.alphaarcade.com/api";
|
|
557
570
|
declare const DEFAULT_MARKET_CREATOR_ADDRESS = "5P5Y6HTWUNG2E3VXBQDZN3ENZD3JPAIR5PKT3LOYJAPAUKOLFD6KANYTRY";
|
|
558
571
|
|
|
559
572
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1404,7 +1404,7 @@ var calculateMatchingOrders = (orderbook, isBuying, isYes, quantity, price, slip
|
|
|
1404
1404
|
};
|
|
1405
1405
|
|
|
1406
1406
|
// src/constants.ts
|
|
1407
|
-
var DEFAULT_API_BASE_URL = "https://
|
|
1407
|
+
var DEFAULT_API_BASE_URL = "https://platform.alphaarcade.com/api";
|
|
1408
1408
|
var DEFAULT_MARKET_CREATOR_ADDRESS = "5P5Y6HTWUNG2E3VXBQDZN3ENZD3JPAIR5PKT3LOYJAPAUKOLFD6KANYTRY";
|
|
1409
1409
|
|
|
1410
1410
|
// src/modules/orderbook.ts
|
|
@@ -1514,7 +1514,7 @@ var normalizeApiOrder = (raw) => ({
|
|
|
1514
1514
|
});
|
|
1515
1515
|
var getWalletOrdersFromApi = async (config, walletAddress) => {
|
|
1516
1516
|
if (!config.apiKey) {
|
|
1517
|
-
throw new Error("apiKey is required for API-based market fetching.");
|
|
1517
|
+
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.");
|
|
1518
1518
|
}
|
|
1519
1519
|
const baseUrl = config.apiBaseUrl ?? DEFAULT_API_BASE_URL;
|
|
1520
1520
|
const allOrders = [];
|
|
@@ -2118,7 +2118,7 @@ var getMarketOnChain = async (config, marketAppId) => {
|
|
|
2118
2118
|
};
|
|
2119
2119
|
var getLiveMarketsFromApi = async (config) => {
|
|
2120
2120
|
if (!config.apiKey) {
|
|
2121
|
-
throw new Error("apiKey is required for API-based market fetching. Use getMarketsOnChain() instead, or
|
|
2121
|
+
throw new Error("apiKey is required for API-based market fetching. Use getMarketsOnChain() instead, or retrieve an API key from the Alpha Arcade platform via the Account page and pass it to the client.");
|
|
2122
2122
|
}
|
|
2123
2123
|
const baseUrl = config.apiBaseUrl ?? DEFAULT_API_BASE_URL;
|
|
2124
2124
|
const allMarkets = [];
|
|
@@ -2155,7 +2155,7 @@ var getLiveMarketsFromApi = async (config) => {
|
|
|
2155
2155
|
};
|
|
2156
2156
|
var getMarketFromApi = async (config, marketId) => {
|
|
2157
2157
|
if (!config.apiKey) {
|
|
2158
|
-
throw new Error("apiKey is required for API-based market fetching. Use getMarketOnChain() instead, or
|
|
2158
|
+
throw new Error("apiKey is required for API-based market fetching. Use getMarketOnChain() instead, or retrieve an API key from the Alpha Arcade platform via the Account page and pass it to the client.");
|
|
2159
2159
|
}
|
|
2160
2160
|
const baseUrl = config.apiBaseUrl ?? DEFAULT_API_BASE_URL;
|
|
2161
2161
|
const url = `${baseUrl}/get-market?marketId=${encodeURIComponent(marketId)}`;
|
|
@@ -2172,6 +2172,13 @@ var getMarketFromApi = async (config, marketId) => {
|
|
|
2172
2172
|
}
|
|
2173
2173
|
return market;
|
|
2174
2174
|
};
|
|
2175
|
+
var getRewardMarkets = async (config) => {
|
|
2176
|
+
if (!config.apiKey) {
|
|
2177
|
+
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.");
|
|
2178
|
+
}
|
|
2179
|
+
const markets = await getLiveMarketsFromApi(config);
|
|
2180
|
+
return markets.filter((m) => m.totalRewards && m.totalRewards > 0);
|
|
2181
|
+
};
|
|
2175
2182
|
var getLiveMarkets = async (config) => {
|
|
2176
2183
|
if (config.apiKey) {
|
|
2177
2184
|
return getLiveMarketsFromApi(config);
|
|
@@ -2395,6 +2402,14 @@ var AlphaClient = class {
|
|
|
2395
2402
|
async getLiveMarketsFromApi() {
|
|
2396
2403
|
return getLiveMarketsFromApi(this.config);
|
|
2397
2404
|
}
|
|
2405
|
+
/**
|
|
2406
|
+
* Fetches the reward markets from the Alpha REST API (requires API key).
|
|
2407
|
+
*
|
|
2408
|
+
* @returns Array of reward markets
|
|
2409
|
+
*/
|
|
2410
|
+
async getRewardMarkets() {
|
|
2411
|
+
return getRewardMarkets(this.config);
|
|
2412
|
+
}
|
|
2398
2413
|
/**
|
|
2399
2414
|
* Fetches a single market by ID from the Alpha REST API (requires API key).
|
|
2400
2415
|
*
|