aftermath-ts-sdk 0.0.147 → 0.0.149

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.
@@ -1,4 +1,5 @@
1
- export declare class HistoricalDataApi {
1
+ import { HistoricalDataApiInterface } from "./historicalDataApiInterface";
2
+ export declare class HistoricalDataApi implements HistoricalDataApiInterface {
2
3
  private readonly coinGeckoApiKey;
3
4
  constructor(coinGeckoApiKey: string);
4
5
  fetchAllCoinData: () => Promise<Record<string, import("../prices/coingecko/coinGeckoTypes").CoinGeckoCoinData>>;
@@ -1 +1 @@
1
- {"version":3,"file":"historicalDataApi.d.ts","sourceRoot":"","sources":["../../../src/general/historicalData/historicalDataApi.ts"],"names":[],"mappings":"AAEA,qBAAa,iBAAiB;IAKjB,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,MAAM;IAM7C,gBAAgB,gGACJ;IAEZ,mBAAmB;;;sEACJ;CACtB"}
1
+ {"version":3,"file":"historicalDataApi.d.ts","sourceRoot":"","sources":["../../../src/general/historicalData/historicalDataApi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,qBAAa,iBAAkB,YAAW,0BAA0B;IAKvD,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,MAAM;IAM7C,gBAAgB,gGACJ;IAEZ,mBAAmB;;;sEACJ;CACtB"}
@@ -0,0 +1,10 @@
1
+ import { CoinGeckoCoinData } from "../prices/coingecko/coinGeckoTypes";
2
+ import { CoinHistoricalData } from "./historicalDataTypes";
3
+ export interface HistoricalDataApiInterface {
4
+ fetchAllCoinData: () => Promise<Record<string, CoinGeckoCoinData>>;
5
+ fetchHistoricalData: (inputs: {
6
+ coinApiId: string;
7
+ daysAgo: number;
8
+ }) => Promise<CoinHistoricalData>;
9
+ }
10
+ //# sourceMappingURL=historicalDataApiInterface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"historicalDataApiInterface.d.ts","sourceRoot":"","sources":["../../../src/general/historicalData/historicalDataApiInterface.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,MAAM,WAAW,0BAA0B;IAC1C,gBAAgB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC;IACnE,mBAAmB,EAAE,CAAC,MAAM,EAAE;QAC7B,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KAChB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAClC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { HistoricalDataApiInterface } from "./historicalDataApiInterface";
2
+ import { CoinHistoricalData } from "./historicalDataTypes";
3
+ export declare class PlaceholderHistoricalDataApi implements HistoricalDataApiInterface {
4
+ fetchAllCoinData: () => Promise<{}>;
5
+ fetchHistoricalData: (inputs: {
6
+ coinApiId: string;
7
+ daysAgo: number;
8
+ }) => Promise<CoinHistoricalData>;
9
+ }
10
+ //# sourceMappingURL=placeholderHistoricalDataApi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeholderHistoricalDataApi.d.ts","sourceRoot":"","sources":["../../../src/general/historicalData/placeholderHistoricalDataApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,qBAAa,4BACZ,YAAW,0BAA0B;IAE9B,gBAAgB,oBAErB;IAEK,mBAAmB,WAAkB;QAC3C,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KAChB,KAAG,QAAQ,kBAAkB,CAAC,CAE7B;CACF"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PlaceholderHistoricalDataApi = void 0;
13
+ class PlaceholderHistoricalDataApi {
14
+ constructor() {
15
+ this.fetchAllCoinData = () => __awaiter(this, void 0, void 0, function* () {
16
+ return {};
17
+ });
18
+ this.fetchHistoricalData = (inputs) => __awaiter(this, void 0, void 0, function* () {
19
+ throw new Error("no placeholder historical data");
20
+ });
21
+ }
22
+ }
23
+ exports.PlaceholderHistoricalDataApi = PlaceholderHistoricalDataApi;
@@ -1 +1 @@
1
- {"version":3,"file":"coinGeckoPricesApi.d.ts","sourceRoot":"","sources":["../../../../src/general/prices/coingecko/coinGeckoPricesApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAkC,MAAM,gBAAgB,CAAC;AAE1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,qBAAa,kBACZ,SAAQ,mBACR,YAAW,kBAAkB;gBAMjB,eAAe,EAAE,MAAM;IAgB5B,UAAU,SAAgB,MAAM,KAAG,QAAQ,MAAM,CAAC,CAEvD;IAEK,iBAAiB,UAAiB,QAAQ,EAAE;;OAkCjD;IAMK,oBAAoB,WAAkB;QAC5C,QAAQ,EAAE,QAAQ,CAAC;QACnB,SAAS,EAAE,kBAAkB,CAAC;KAC9B,KAAG,QAAQ,MAAM,CAAC,CAKjB;IAEK,4BAA4B,WAAkB;QACpD,YAAY,EAAE,OAAO,QAAQ,EAAE,kBAAkB,CAAC,CAAC;KACnD,KAAG,QAAQ,OAAO,QAAQ,EAAE,MAAM,CAAC,CAAC,CAYnC;CACF"}
1
+ {"version":3,"file":"coinGeckoPricesApi.d.ts","sourceRoot":"","sources":["../../../../src/general/prices/coingecko/coinGeckoPricesApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAgB,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,qBAAa,kBACZ,SAAQ,mBACR,YAAW,kBAAkB;gBAMjB,eAAe,EAAE,MAAM;IAgB5B,UAAU,SAAgB,MAAM,KAAG,QAAQ,MAAM,CAAC,CAEvD;IAEK,iBAAiB,UAAiB,QAAQ,EAAE;;OAkCjD;IAEK,oBAAoB,WAAkB;QAC5C,QAAQ,EAAE,QAAQ,CAAC;QACnB,SAAS,EAAE,kBAAkB,CAAC;KAC9B,KAAG,QAAQ,MAAM,CAAC,CAKjB;IAEK,4BAA4B,WAAkB;QACpD,YAAY,EAAE,OAAO,QAAQ,EAAE,kBAAkB,CAAC,CAAC;KACnD,KAAG,QAAQ,OAAO,QAAQ,EAAE,MAAM,CAAC,CAAC,CAYnC;CACF"}
@@ -44,9 +44,6 @@ class CoinGeckoPricesApi extends coinGeckoApiHelpers_1.CoinGeckoApiHelpers {
44
44
  : Object.assign(Object.assign({}, acc), { [utils_1.Helpers.addLeadingZeroesToType(coin)]: -1 }), {});
45
45
  return Object.assign(Object.assign({}, missingCoinsToPrice), coinsToPrice);
46
46
  });
47
- /////////////////////////////////////////////////////////////////////
48
- //// Non-Interface Methods
49
- /////////////////////////////////////////////////////////////////////
50
47
  this.fetchPriceGivenApiId = (inputs) => __awaiter(this, void 0, void 0, function* () {
51
48
  const priceInfo = yield this.fetchCoinsToPriceInfo({
52
49
  coinsToApiId: { [inputs.coinType]: inputs.coinApiId },
@@ -1,11 +1,17 @@
1
1
  import { CoinType } from "../../../types";
2
- import { AftermathApi } from "../../providers/aftermathApi";
2
+ import { CoinGeckoCoinApiId } from "../coingecko/coinGeckoTypes";
3
3
  import { PricesApiInterface } from "../pricesApiInterface";
4
4
  export declare class PlaceholderPricesApi implements PricesApiInterface {
5
5
  private static readonly constants;
6
- constructor(_: AftermathApi);
7
6
  fetchPrice: (coin: CoinType) => Promise<number>;
8
7
  fetchCoinsToPrice: (coins: CoinType[]) => Promise<Record<string, number>>;
8
+ fetchPriceGivenApiId: (inputs: {
9
+ coinType: CoinType;
10
+ coinApiId: CoinGeckoCoinApiId;
11
+ }) => Promise<number>;
12
+ fetchCoinsToPriceGivenApiIds: (inputs: {
13
+ coinsToApiId: Record<CoinType, CoinGeckoCoinApiId>;
14
+ }) => Promise<Record<CoinType, number>>;
9
15
  private fetchPrices;
10
16
  }
11
17
  //# sourceMappingURL=placeholderPricesApi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"placeholderPricesApi.d.ts","sourceRoot":"","sources":["../../../../src/general/prices/placeholder/placeholderPricesApi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,qBAAa,oBAAqB,YAAW,kBAAkB;IAK9D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAkB/B;gBAMU,CAAC,EAAE,YAAY;IAUpB,UAAU,SAAgB,QAAQ,qBAEvC;IAEK,iBAAiB,UAAiB,QAAQ,EAAE,qCAajD;IAMF,OAAO,CAAC,WAAW,CAYjB;CACF"}
1
+ {"version":3,"file":"placeholderPricesApi.d.ts","sourceRoot":"","sources":["../../../../src/general/prices/placeholder/placeholderPricesApi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAgB,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,qBAAa,oBAAqB,YAAW,kBAAkB;IAK9D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAkB/B;IAcK,UAAU,SAAgB,QAAQ,qBAEvC;IAEK,iBAAiB,UAAiB,QAAQ,EAAE,qCAajD;IAEK,oBAAoB,WAAkB;QAC5C,QAAQ,EAAE,QAAQ,CAAC;QACnB,SAAS,EAAE,kBAAkB,CAAC;KAC9B,KAAG,QAAQ,MAAM,CAAC,CAGjB;IAEK,4BAA4B,WAAkB;QACpD,YAAY,EAAE,OAAO,QAAQ,EAAE,kBAAkB,CAAC,CAAC;KACnD,KAAG,QAAQ,OAAO,QAAQ,EAAE,MAAM,CAAC,CAAC,CAKnC;IAMF,OAAO,CAAC,WAAW,CAYjB;CACF"}
@@ -12,16 +12,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.PlaceholderPricesApi = void 0;
13
13
  const coin_1 = require("../../../packages/coin/coin");
14
14
  class PlaceholderPricesApi {
15
- /////////////////////////////////////////////////////////////////////
16
- //// Constructor
17
- /////////////////////////////////////////////////////////////////////
18
- constructor(_) {
15
+ constructor() {
16
+ /////////////////////////////////////////////////////////////////////
17
+ //// Constants
18
+ /////////////////////////////////////////////////////////////////////
19
19
  /////////////////////////////////////////////////////////////////////
20
20
  //// Fetching
21
21
  /////////////////////////////////////////////////////////////////////
22
22
  /////////////////////////////////////////////////////////////////////
23
23
  //// Public
24
24
  /////////////////////////////////////////////////////////////////////
25
+ /////////////////////////////////////////////////////////////////////
26
+ //// Interface Methods
27
+ /////////////////////////////////////////////////////////////////////
25
28
  this.fetchPrice = (coin) => __awaiter(this, void 0, void 0, function* () {
26
29
  return (yield this.fetchPrices([coin]))[0];
27
30
  });
@@ -32,6 +35,14 @@ class PlaceholderPricesApi {
32
35
  }, {});
33
36
  return coinsToPrice;
34
37
  });
38
+ this.fetchPriceGivenApiId = (inputs) => __awaiter(this, void 0, void 0, function* () {
39
+ const charCode = inputs.coinType.charCodeAt(0);
40
+ return isNaN(charCode) ? 0 : charCode;
41
+ });
42
+ this.fetchCoinsToPriceGivenApiIds = (inputs) => __awaiter(this, void 0, void 0, function* () {
43
+ const coinsToPrice = yield this.fetchCoinsToPrice(Object.keys(inputs.coinsToApiId));
44
+ return coinsToPrice;
45
+ });
35
46
  /////////////////////////////////////////////////////////////////////
36
47
  //// Private
37
48
  /////////////////////////////////////////////////////////////////////
@@ -45,9 +56,6 @@ class PlaceholderPricesApi {
45
56
  }
46
57
  }
47
58
  exports.PlaceholderPricesApi = PlaceholderPricesApi;
48
- /////////////////////////////////////////////////////////////////////
49
- //// Constants
50
- /////////////////////////////////////////////////////////////////////
51
59
  PlaceholderPricesApi.constants = {
52
60
  prices: {
53
61
  usdc: 1,
@@ -1,6 +1,14 @@
1
1
  import { CoinType } from "../../types";
2
+ import { CoinGeckoCoinApiId } from "./coingecko/coinGeckoTypes";
2
3
  export interface PricesApiInterface {
3
4
  fetchPrice: (coin: CoinType) => Promise<number>;
4
5
  fetchCoinsToPrice: (coins: CoinType[]) => Promise<Record<CoinType, number>>;
6
+ fetchPriceGivenApiId: (inputs: {
7
+ coinType: CoinType;
8
+ coinApiId: CoinGeckoCoinApiId;
9
+ }) => Promise<number>;
10
+ fetchCoinsToPriceGivenApiIds: (inputs: {
11
+ coinsToApiId: Record<CoinType, CoinGeckoCoinApiId>;
12
+ }) => Promise<Record<CoinType, number>>;
5
13
  }
6
14
  //# sourceMappingURL=pricesApiInterface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pricesApiInterface.d.ts","sourceRoot":"","sources":["../../../src/general/prices/pricesApiInterface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,WAAW,kBAAkB;IAClC,UAAU,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,iBAAiB,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;CAC5E"}
1
+ {"version":3,"file":"pricesApiInterface.d.ts","sourceRoot":"","sources":["../../../src/general/prices/pricesApiInterface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,kBAAkB;IAClC,UAAU,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,iBAAiB,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IAE5E,oBAAoB,EAAE,CAAC,MAAM,EAAE;QAC9B,QAAQ,EAAE,QAAQ,CAAC;QACnB,SAAS,EAAE,kBAAkB,CAAC;KAC9B,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACtB,4BAA4B,EAAE,CAAC,MAAM,EAAE;QACtC,YAAY,EAAE,MAAM,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;KACnD,KAAK,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;CACxC"}
@@ -1,10 +1,2 @@
1
- import { CoinSymbolToCoinTypes, CoinType } from "../../../types";
2
- import { PricesApiInterface } from "../pricesApiInterface";
3
- import { PythPricesApiHelpers } from "./pythPricesApiHelpers";
4
- export declare class PythPricesApi extends PythPricesApiHelpers implements PricesApiInterface {
5
- constructor(coinSymbolToCoinTypes: CoinSymbolToCoinTypes);
6
- fetchPrice: (coin: CoinType) => Promise<number>;
7
- fetchCoinsToPrice: (coins: CoinType[]) => Promise<Record<string, number>>;
8
- private fetchPrices;
9
- }
1
+ export {};
10
2
  //# sourceMappingURL=pythPricesApi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pythPricesApi.d.ts","sourceRoot":"","sources":["../../../../src/general/prices/pyth/pythPricesApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,qBAAa,aACZ,SAAQ,oBACR,YAAW,kBAAkB;gBAMjB,qBAAqB,EAAE,qBAAqB;IAYjD,UAAU,SAAgB,QAAQ,qBAEvC;IAEK,iBAAiB,UAAiB,QAAQ,EAAE,qCAYjD;IAMF,OAAO,CAAC,WAAW,CAajB;CACF"}
1
+ {"version":3,"file":"pythPricesApi.d.ts","sourceRoot":"","sources":["../../../../src/general/prices/pyth/pythPricesApi.ts"],"names":[],"mappings":""}
@@ -1,54 +1,52 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
2
+ // import { CoinSymbolToCoinTypes, CoinType } from "../../../types";
3
+ // import { PricesApiInterface } from "../pricesApiInterface";
4
+ // import { PythPricesApiHelpers } from "./pythPricesApiHelpers";
11
5
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.PythPricesApi = void 0;
13
- const pythPricesApiHelpers_1 = require("./pythPricesApiHelpers");
14
- class PythPricesApi extends pythPricesApiHelpers_1.PythPricesApiHelpers {
15
- /////////////////////////////////////////////////////////////////////
16
- //// Constructor
17
- /////////////////////////////////////////////////////////////////////
18
- constructor(coinSymbolToCoinTypes) {
19
- super(coinSymbolToCoinTypes);
20
- /////////////////////////////////////////////////////////////////////
21
- //// Fetching
22
- /////////////////////////////////////////////////////////////////////
23
- /////////////////////////////////////////////////////////////////////
24
- //// Public
25
- /////////////////////////////////////////////////////////////////////
26
- this.fetchPrice = (coin) => __awaiter(this, void 0, void 0, function* () {
27
- return (yield this.fetchPrices([coin]))[0];
28
- });
29
- this.fetchCoinsToPrice = (coins) => __awaiter(this, void 0, void 0, function* () {
30
- const prices = yield this.fetchPrices(coins);
31
- const coinsToPrice = coins.reduce((acc, coin, index) => {
32
- return Object.assign(Object.assign({}, acc), { [coin]: prices[index] });
33
- }, {});
34
- return coinsToPrice;
35
- });
36
- /////////////////////////////////////////////////////////////////////
37
- //// Private
38
- /////////////////////////////////////////////////////////////////////
39
- this.fetchPrices = (coins) => __awaiter(this, void 0, void 0, function* () {
40
- const priceFeeds = yield this.fetchPriceFeeds(coins);
41
- const prices = priceFeeds.map((priceFeed) => {
42
- // TODO: handle this differently ? - will cause breaking changes in FE
43
- if (priceFeed === undefined)
44
- return -1;
45
- const price = priceFeed.getPriceAsNumberUnchecked();
46
- if (price <= 0)
47
- return -1;
48
- return price;
49
- });
50
- return prices;
51
- });
52
- }
53
- }
54
- exports.PythPricesApi = PythPricesApi;
6
+ // export class PythPricesApi
7
+ // extends PythPricesApiHelpers
8
+ // implements PricesApiInterface
9
+ // {
10
+ // /////////////////////////////////////////////////////////////////////
11
+ // //// Constructor
12
+ // /////////////////////////////////////////////////////////////////////
13
+ // constructor(coinSymbolToCoinTypes: CoinSymbolToCoinTypes) {
14
+ // super(coinSymbolToCoinTypes);
15
+ // }
16
+ // /////////////////////////////////////////////////////////////////////
17
+ // //// Fetching
18
+ // /////////////////////////////////////////////////////////////////////
19
+ // /////////////////////////////////////////////////////////////////////
20
+ // //// Public
21
+ // /////////////////////////////////////////////////////////////////////
22
+ // public fetchPrice = async (coin: CoinType) => {
23
+ // return (await this.fetchPrices([coin]))[0];
24
+ // };
25
+ // public fetchCoinsToPrice = async (coins: CoinType[]) => {
26
+ // const prices = await this.fetchPrices(coins);
27
+ // const coinsToPrice: Record<CoinType, number> = coins.reduce(
28
+ // (acc, coin, index) => {
29
+ // return {
30
+ // ...acc,
31
+ // [coin]: prices[index],
32
+ // };
33
+ // },
34
+ // {}
35
+ // );
36
+ // return coinsToPrice;
37
+ // };
38
+ // /////////////////////////////////////////////////////////////////////
39
+ // //// Private
40
+ // /////////////////////////////////////////////////////////////////////
41
+ // private fetchPrices = async (coins: CoinType[]) => {
42
+ // const priceFeeds = await this.fetchPriceFeeds(coins);
43
+ // const prices = priceFeeds.map((priceFeed) => {
44
+ // // TODO: handle this differently ? - will cause breaking changes in FE
45
+ // if (priceFeed === undefined) return -1;
46
+ // const price = priceFeed.getPriceAsNumberUnchecked();
47
+ // if (price <= 0) return -1;
48
+ // return price;
49
+ // });
50
+ // return prices;
51
+ // };
52
+ // }
@@ -12,6 +12,7 @@ import { TransactionsApiHelpers } from "../api/transactionsApiHelpers";
12
12
  import { SuiApi } from "../../packages/sui/api/suiApi";
13
13
  import { WalletApi } from "../wallet/walletApi";
14
14
  import { RouterApi } from "../../packages/router/api/routerApi";
15
+ import { PlaceholderPricesApi } from "../prices/placeholder/placeholderPricesApi";
15
16
  import { CapysApi } from "../../packages/capys/api/capysApi";
16
17
  import { StakingApi } from "../../packages/staking/api/stakingApi";
17
18
  import { NftAmmApi } from "../../packages/nftAmm/api/nftAmmApi";
@@ -19,10 +20,11 @@ import { ReferralVaultApi } from "../../packages/referralVault/api/referralVault
19
20
  import { RouterProtocolName } from "../../types";
20
21
  import { HistoricalDataApi } from "../historicalData/historicalDataApi";
21
22
  import { CoinGeckoPricesApi } from "../prices/coingecko/coinGeckoPricesApi";
23
+ import { PlaceholderHistoricalDataApi } from "../historicalData/placeholderHistoricalDataApi";
22
24
  export declare class AftermathApi {
23
25
  readonly provider: JsonRpcProvider;
24
26
  readonly addresses: ConfigAddresses;
25
- private readonly coinGeckoApiKey;
27
+ private readonly coinGeckoApiKey?;
26
28
  static helpers: {
27
29
  dynamicFields: typeof DynamicFieldsApiHelpers;
28
30
  events: typeof EventsApiHelpers;
@@ -34,7 +36,7 @@ export declare class AftermathApi {
34
36
  coin: typeof CoinApi;
35
37
  sui: typeof SuiApi;
36
38
  };
37
- constructor(provider: JsonRpcProvider, addresses: ConfigAddresses, coinGeckoApiKey: string);
39
+ constructor(provider: JsonRpcProvider, addresses: ConfigAddresses, coinGeckoApiKey?: string | undefined);
38
40
  DynamicFields: () => DynamicFieldsApiHelpers;
39
41
  Events: () => EventsApiHelpers;
40
42
  Inspections: () => InspectionsApiHelpers;
@@ -42,8 +44,8 @@ export declare class AftermathApi {
42
44
  Transactions: () => TransactionsApiHelpers;
43
45
  Rpc: () => RpcApiHelpers;
44
46
  Wallet: () => WalletApi;
45
- Prices: () => CoinGeckoPricesApi;
46
- HistoricalData: () => HistoricalDataApi;
47
+ Prices: () => PlaceholderPricesApi | CoinGeckoPricesApi;
48
+ HistoricalData: () => HistoricalDataApi | PlaceholderHistoricalDataApi;
47
49
  Coin: () => CoinApi;
48
50
  Sui: () => SuiApi;
49
51
  Pools: () => PoolsApi;
@@ -1 +1 @@
1
- {"version":3,"file":"aftermathApi.d.ts","sourceRoot":"","sources":["../../../src/general/providers/aftermathApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,M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
14
14
  const walletApi_1 = require("../wallet/walletApi");
15
15
  const routerApi_1 = require("../../packages/router/api/routerApi");
16
+ const placeholderPricesApi_1 = require("../prices/placeholder/placeholderPricesApi");
16
17
  const capysApi_1 = require("../../packages/capys/api/capysApi");
17
18
  const stakingApi_1 = require("../../packages/staking/api/stakingApi");
18
19
  const nftAmmApi_1 = require("../../packages/nftAmm/api/nftAmmApi");
19
20
  const referralVaultApi_1 = require("../../packages/referralVault/api/referralVaultApi");
20
21
  const historicalDataApi_1 = require("../historicalData/historicalDataApi");
21
22
  const coinGeckoPricesApi_1 = require("../prices/coingecko/coinGeckoPricesApi");
23
+ const placeholderHistoricalDataApi_1 = require("../historicalData/placeholderHistoricalDataApi");
22
24
  class AftermathApi {
23
25
  /////////////////////////////////////////////////////////////////////
24
26
  //// Constructor
@@ -43,9 +45,12 @@ class AftermathApi {
43
45
  //// Utils
44
46
  /////////////////////////////////////////////////////////////////////
45
47
  this.Wallet = () => new walletApi_1.WalletApi(this);
46
- // public Prices = () => new PlaceholderPricesApi(this);
47
- this.Prices = () => new coinGeckoPricesApi_1.CoinGeckoPricesApi(this.coinGeckoApiKey);
48
- this.HistoricalData = () => new historicalDataApi_1.HistoricalDataApi(this.coinGeckoApiKey);
48
+ this.Prices = () => this.coinGeckoApiKey
49
+ ? new coinGeckoPricesApi_1.CoinGeckoPricesApi(this.coinGeckoApiKey)
50
+ : new placeholderPricesApi_1.PlaceholderPricesApi();
51
+ this.HistoricalData = () => this.coinGeckoApiKey
52
+ ? new historicalDataApi_1.HistoricalDataApi(this.coinGeckoApiKey)
53
+ : new placeholderHistoricalDataApi_1.PlaceholderHistoricalDataApi();
49
54
  /////////////////////////////////////////////////////////////////////
50
55
  //// General Packages
51
56
  /////////////////////////////////////////////////////////////////////
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aftermath-ts-sdk",
3
- "version": "0.0.147",
3
+ "version": "0.0.149",
4
4
  "description": "Aftermath TypeScript SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",