@alpha-arcade/sdk 0.2.4 → 0.2.5
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 +7 -7
- package/dist/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -340,7 +340,7 @@ type EscrowGlobalState = {
|
|
|
340
340
|
* });
|
|
341
341
|
*
|
|
342
342
|
* // Fetch markets
|
|
343
|
-
* const markets = await client.
|
|
343
|
+
* const markets = await client.getLiveMarkets();
|
|
344
344
|
*
|
|
345
345
|
* // Place a limit order
|
|
346
346
|
* const result = await client.createLimitOrder({
|
|
@@ -463,7 +463,7 @@ declare class AlphaClient {
|
|
|
463
463
|
*
|
|
464
464
|
* @returns Array of live markets
|
|
465
465
|
*/
|
|
466
|
-
|
|
466
|
+
getLiveMarkets(): Promise<Market[]>;
|
|
467
467
|
/**
|
|
468
468
|
* Fetches a single market by its ID.
|
|
469
469
|
*
|
|
@@ -498,7 +498,7 @@ declare class AlphaClient {
|
|
|
498
498
|
*
|
|
499
499
|
* @returns Array of live markets from the API
|
|
500
500
|
*/
|
|
501
|
-
|
|
501
|
+
getLiveMarketsFromApi(): Promise<Market[]>;
|
|
502
502
|
/**
|
|
503
503
|
* Fetches a single market by ID from the Alpha REST API (requires API key).
|
|
504
504
|
*
|
|
@@ -540,7 +540,7 @@ declare const getMarketOnChain: (config: AlphaClientConfig, marketAppId: number
|
|
|
540
540
|
* @param config - Alpha client config
|
|
541
541
|
* @returns Array of live markets
|
|
542
542
|
*/
|
|
543
|
-
declare const
|
|
543
|
+
declare const getLiveMarketsFromApi: (config: AlphaClientConfig) => Promise<Market[]>;
|
|
544
544
|
/**
|
|
545
545
|
* Fetches a single market by its ID from the Alpha REST API.
|
|
546
546
|
* Requires an API key.
|
|
@@ -629,4 +629,4 @@ declare const getEscrowGlobalState: (indexerClient: algosdk.Indexer, escrowAppId
|
|
|
629
629
|
*/
|
|
630
630
|
declare const checkAssetOptIn: (algodClient: algosdk.Algodv2, address: string, assetId: number) => Promise<boolean>;
|
|
631
631
|
|
|
632
|
-
export { type AggregatedOrderbook, type AggregatedOrderbookEntry, type AggregatedOrderbookSide, AlphaClient, type AlphaClientConfig, type CancelOrderParams, type CancelOrderResult, type ClaimParams, type ClaimResult, type CounterpartyMatch, type CreateLimitOrderParams, type CreateMarketOrderParams, type CreateMarketOrderResult, type CreateOrderResult, DEFAULT_MARKET_CREATOR_ADDRESS, type EscrowGlobalState, type Market, type MarketGlobalState, type MarketOption, type MergeSharesParams, type OpenOrder, type OrderSide, type Orderbook, type OrderbookEntry, type OrderbookSide, type Position, type ProposeMatchParams, type ProposeMatchResult, type SplitMergeResult, type SplitSharesParams, type WalletPosition, calculateFee, calculateFeeFromTotal, calculateMatchingOrders, checkAssetOptIn, decodeGlobalState, getEscrowGlobalState, getMarketFromApi, getMarketGlobalState, getMarketOnChain,
|
|
632
|
+
export { type AggregatedOrderbook, type AggregatedOrderbookEntry, type AggregatedOrderbookSide, AlphaClient, type AlphaClientConfig, type CancelOrderParams, type CancelOrderResult, type ClaimParams, type ClaimResult, type CounterpartyMatch, type CreateLimitOrderParams, type CreateMarketOrderParams, type CreateMarketOrderResult, type CreateOrderResult, DEFAULT_MARKET_CREATOR_ADDRESS, type EscrowGlobalState, type Market, type MarketGlobalState, type MarketOption, type MergeSharesParams, type OpenOrder, type OrderSide, type Orderbook, type OrderbookEntry, type OrderbookSide, type Position, type ProposeMatchParams, type ProposeMatchResult, type SplitMergeResult, type SplitSharesParams, type WalletPosition, calculateFee, calculateFeeFromTotal, calculateMatchingOrders, checkAssetOptIn, decodeGlobalState, getEscrowGlobalState, getLiveMarketsFromApi, getMarketFromApi, getMarketGlobalState, getMarketOnChain, getMarketsOnChain };
|
package/dist/index.d.ts
CHANGED
|
@@ -340,7 +340,7 @@ type EscrowGlobalState = {
|
|
|
340
340
|
* });
|
|
341
341
|
*
|
|
342
342
|
* // Fetch markets
|
|
343
|
-
* const markets = await client.
|
|
343
|
+
* const markets = await client.getLiveMarkets();
|
|
344
344
|
*
|
|
345
345
|
* // Place a limit order
|
|
346
346
|
* const result = await client.createLimitOrder({
|
|
@@ -463,7 +463,7 @@ declare class AlphaClient {
|
|
|
463
463
|
*
|
|
464
464
|
* @returns Array of live markets
|
|
465
465
|
*/
|
|
466
|
-
|
|
466
|
+
getLiveMarkets(): Promise<Market[]>;
|
|
467
467
|
/**
|
|
468
468
|
* Fetches a single market by its ID.
|
|
469
469
|
*
|
|
@@ -498,7 +498,7 @@ declare class AlphaClient {
|
|
|
498
498
|
*
|
|
499
499
|
* @returns Array of live markets from the API
|
|
500
500
|
*/
|
|
501
|
-
|
|
501
|
+
getLiveMarketsFromApi(): Promise<Market[]>;
|
|
502
502
|
/**
|
|
503
503
|
* Fetches a single market by ID from the Alpha REST API (requires API key).
|
|
504
504
|
*
|
|
@@ -540,7 +540,7 @@ declare const getMarketOnChain: (config: AlphaClientConfig, marketAppId: number
|
|
|
540
540
|
* @param config - Alpha client config
|
|
541
541
|
* @returns Array of live markets
|
|
542
542
|
*/
|
|
543
|
-
declare const
|
|
543
|
+
declare const getLiveMarketsFromApi: (config: AlphaClientConfig) => Promise<Market[]>;
|
|
544
544
|
/**
|
|
545
545
|
* Fetches a single market by its ID from the Alpha REST API.
|
|
546
546
|
* Requires an API key.
|
|
@@ -629,4 +629,4 @@ declare const getEscrowGlobalState: (indexerClient: algosdk.Indexer, escrowAppId
|
|
|
629
629
|
*/
|
|
630
630
|
declare const checkAssetOptIn: (algodClient: algosdk.Algodv2, address: string, assetId: number) => Promise<boolean>;
|
|
631
631
|
|
|
632
|
-
export { type AggregatedOrderbook, type AggregatedOrderbookEntry, type AggregatedOrderbookSide, AlphaClient, type AlphaClientConfig, type CancelOrderParams, type CancelOrderResult, type ClaimParams, type ClaimResult, type CounterpartyMatch, type CreateLimitOrderParams, type CreateMarketOrderParams, type CreateMarketOrderResult, type CreateOrderResult, DEFAULT_MARKET_CREATOR_ADDRESS, type EscrowGlobalState, type Market, type MarketGlobalState, type MarketOption, type MergeSharesParams, type OpenOrder, type OrderSide, type Orderbook, type OrderbookEntry, type OrderbookSide, type Position, type ProposeMatchParams, type ProposeMatchResult, type SplitMergeResult, type SplitSharesParams, type WalletPosition, calculateFee, calculateFeeFromTotal, calculateMatchingOrders, checkAssetOptIn, decodeGlobalState, getEscrowGlobalState, getMarketFromApi, getMarketGlobalState, getMarketOnChain,
|
|
632
|
+
export { type AggregatedOrderbook, type AggregatedOrderbookEntry, type AggregatedOrderbookSide, AlphaClient, type AlphaClientConfig, type CancelOrderParams, type CancelOrderResult, type ClaimParams, type ClaimResult, type CounterpartyMatch, type CreateLimitOrderParams, type CreateMarketOrderParams, type CreateMarketOrderResult, type CreateOrderResult, DEFAULT_MARKET_CREATOR_ADDRESS, type EscrowGlobalState, type Market, type MarketGlobalState, type MarketOption, type MergeSharesParams, type OpenOrder, type OrderSide, type Orderbook, type OrderbookEntry, type OrderbookSide, type Position, type ProposeMatchParams, type ProposeMatchResult, type SplitMergeResult, type SplitSharesParams, type WalletPosition, calculateFee, calculateFeeFromTotal, calculateMatchingOrders, checkAssetOptIn, decodeGlobalState, getEscrowGlobalState, getLiveMarketsFromApi, getMarketFromApi, getMarketGlobalState, getMarketOnChain, getMarketsOnChain };
|
package/dist/index.js
CHANGED
|
@@ -2055,7 +2055,7 @@ var getMarketOnChain = async (config, marketAppId) => {
|
|
|
2055
2055
|
return null;
|
|
2056
2056
|
}
|
|
2057
2057
|
};
|
|
2058
|
-
var
|
|
2058
|
+
var getLiveMarketsFromApi = async (config) => {
|
|
2059
2059
|
if (!config.apiKey) {
|
|
2060
2060
|
throw new Error("apiKey is required for API-based market fetching. Use getMarketsOnChain() instead, or pass an apiKey.");
|
|
2061
2061
|
}
|
|
@@ -2068,7 +2068,7 @@ var getMarketsFromApi = async (config) => {
|
|
|
2068
2068
|
if (lastEvaluatedKey) {
|
|
2069
2069
|
params.set("lastEvaluatedKey", lastEvaluatedKey);
|
|
2070
2070
|
}
|
|
2071
|
-
const url = `${baseUrl}/get-live-markets?${params.toString()}`;
|
|
2071
|
+
const url = `${baseUrl}/get-live-markets-cached?${params.toString()}`;
|
|
2072
2072
|
const response = await fetch(url, { headers: { "x-api-key": config.apiKey } });
|
|
2073
2073
|
if (!response.ok) {
|
|
2074
2074
|
throw new Error(`Alpha API error: ${response.status} ${response.statusText}`);
|
|
@@ -2111,9 +2111,9 @@ var getMarketFromApi = async (config, marketId) => {
|
|
|
2111
2111
|
}
|
|
2112
2112
|
return market;
|
|
2113
2113
|
};
|
|
2114
|
-
var
|
|
2114
|
+
var getLiveMarkets = async (config) => {
|
|
2115
2115
|
if (config.apiKey) {
|
|
2116
|
-
return
|
|
2116
|
+
return getLiveMarketsFromApi(config);
|
|
2117
2117
|
}
|
|
2118
2118
|
return getMarketsOnChain(config);
|
|
2119
2119
|
};
|
|
@@ -2279,8 +2279,8 @@ var AlphaClient = class {
|
|
|
2279
2279
|
*
|
|
2280
2280
|
* @returns Array of live markets
|
|
2281
2281
|
*/
|
|
2282
|
-
async
|
|
2283
|
-
return
|
|
2282
|
+
async getLiveMarkets() {
|
|
2283
|
+
return getLiveMarkets(this.config);
|
|
2284
2284
|
}
|
|
2285
2285
|
/**
|
|
2286
2286
|
* Fetches a single market by its ID.
|
|
@@ -2322,8 +2322,8 @@ var AlphaClient = class {
|
|
|
2322
2322
|
*
|
|
2323
2323
|
* @returns Array of live markets from the API
|
|
2324
2324
|
*/
|
|
2325
|
-
async
|
|
2326
|
-
return
|
|
2325
|
+
async getLiveMarketsFromApi() {
|
|
2326
|
+
return getLiveMarketsFromApi(this.config);
|
|
2327
2327
|
}
|
|
2328
2328
|
/**
|
|
2329
2329
|
* Fetches a single market by ID from the Alpha REST API (requires API key).
|
|
@@ -2336,6 +2336,6 @@ var AlphaClient = class {
|
|
|
2336
2336
|
}
|
|
2337
2337
|
};
|
|
2338
2338
|
|
|
2339
|
-
export { AlphaClient, DEFAULT_MARKET_CREATOR_ADDRESS, calculateFee, calculateFeeFromTotal, calculateMatchingOrders, checkAssetOptIn, decodeGlobalState, getEscrowGlobalState, getMarketFromApi, getMarketGlobalState, getMarketOnChain,
|
|
2339
|
+
export { AlphaClient, DEFAULT_MARKET_CREATOR_ADDRESS, calculateFee, calculateFeeFromTotal, calculateMatchingOrders, checkAssetOptIn, decodeGlobalState, getEscrowGlobalState, getLiveMarketsFromApi, getMarketFromApi, getMarketGlobalState, getMarketOnChain, getMarketsOnChain };
|
|
2340
2340
|
//# sourceMappingURL=index.js.map
|
|
2341
2341
|
//# sourceMappingURL=index.js.map
|