aftermath-ts-sdk 1.1.85 → 1.1.87-bridge.0

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.
Files changed (36) hide show
  1. package/dist/general/historicalData/historicalDataApi.d.ts +1 -3
  2. package/dist/general/historicalData/historicalDataApi.d.ts.map +1 -1
  3. package/dist/general/historicalData/historicalDataApi.js +2 -2
  4. package/dist/general/historicalData/historicalDataApiInterface.d.ts +4 -2
  5. package/dist/general/historicalData/historicalDataApiInterface.d.ts.map +1 -1
  6. package/dist/general/historicalData/placeholderHistoricalDataApi.d.ts +4 -2
  7. package/dist/general/historicalData/placeholderHistoricalDataApi.d.ts.map +1 -1
  8. package/dist/general/historicalData/placeholderHistoricalDataApi.js +6 -1
  9. package/dist/general/prices/coingecko/coinGeckoApiHelpers.d.ts +11 -6
  10. package/dist/general/prices/coingecko/coinGeckoApiHelpers.d.ts.map +1 -1
  11. package/dist/general/prices/coingecko/coinGeckoApiHelpers.js +113 -53
  12. package/dist/general/prices/coingecko/coinGeckoPricesApi.d.ts +2 -3
  13. package/dist/general/prices/coingecko/coinGeckoPricesApi.d.ts.map +1 -1
  14. package/dist/general/prices/coingecko/coinGeckoPricesApi.js +180 -49
  15. package/dist/general/prices/coingecko/coinGeckoTypes.d.ts +2 -0
  16. package/dist/general/prices/coingecko/coinGeckoTypes.d.ts.map +1 -1
  17. package/dist/general/providers/aftermathApi.d.ts +9 -5
  18. package/dist/general/providers/aftermathApi.d.ts.map +1 -1
  19. package/dist/general/providers/aftermathApi.js +20 -15
  20. package/dist/general/types/index.d.ts +1 -0
  21. package/dist/general/types/index.d.ts.map +1 -1
  22. package/dist/general/types/index.js +1 -0
  23. package/dist/general/utils/helpers.d.ts +6 -1
  24. package/dist/general/utils/helpers.d.ts.map +1 -1
  25. package/dist/general/utils/helpers.js +31 -3
  26. package/dist/packages/coin/api/coinApi.d.ts +4 -1
  27. package/dist/packages/coin/api/coinApi.d.ts.map +1 -1
  28. package/dist/packages/coin/api/coinApi.js +163 -31
  29. package/dist/packages/coin/coin.d.ts +5 -0
  30. package/dist/packages/coin/coin.d.ts.map +1 -1
  31. package/dist/packages/coin/coin.js +6 -1
  32. package/dist/packages/dca/api/dcaApiCasting.d.ts.map +1 -1
  33. package/dist/packages/dca/api/dcaApiCasting.js +1 -3
  34. package/dist/packages/dca/dcaTypes.d.ts +1 -1
  35. package/dist/packages/dca/dcaTypes.d.ts.map +1 -1
  36. package/package.json +1 -1
@@ -1,9 +1,7 @@
1
- import { CoinType } from "../../types";
2
1
  import { CoinGeckoApiHelpers } from "../prices/coingecko/coinGeckoApiHelpers";
3
- import { CoinGeckoCoinApiId } from "../prices/coingecko/coinGeckoTypes";
4
2
  import { AftermathApi } from "../providers";
5
3
  import { HistoricalDataApiInterface } from "./historicalDataApiInterface";
6
4
  export declare class HistoricalDataApi extends CoinGeckoApiHelpers implements HistoricalDataApiInterface {
7
- constructor(Provider: AftermathApi, coinGeckoApiKey: string, coinApiIdsToCoinTypes: Record<CoinGeckoCoinApiId, CoinType[]>);
5
+ constructor(Provider: AftermathApi, coinGeckoApiKey: string);
8
6
  }
9
7
  //# sourceMappingURL=historicalDataApi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"historicalDataApi.d.ts","sourceRoot":"","sources":["../../../src/general/historicalData/historicalDataApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,qBAAa,iBACZ,SAAQ,mBACR,YAAW,0BAA0B;gBAOpC,QAAQ,EAAE,YAAY,EACtB,eAAe,EAAE,MAAM,EACvB,qBAAqB,EAAE,MAAM,CAAC,kBAAkB,EAAE,QAAQ,EAAE,CAAC;CAI9D"}
1
+ {"version":3,"file":"historicalDataApi.d.ts","sourceRoot":"","sources":["../../../src/general/historicalData/historicalDataApi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,qBAAa,iBACZ,SAAQ,mBACR,YAAW,0BAA0B;gBAMzB,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM;CAG3D"}
@@ -6,8 +6,8 @@ class HistoricalDataApi extends coinGeckoApiHelpers_1.CoinGeckoApiHelpers {
6
6
  // =========================================================================
7
7
  // Constructor
8
8
  // =========================================================================
9
- constructor(Provider, coinGeckoApiKey, coinApiIdsToCoinTypes) {
10
- super(Provider, coinGeckoApiKey, coinApiIdsToCoinTypes);
9
+ constructor(Provider, coinGeckoApiKey) {
10
+ super(Provider, coinGeckoApiKey);
11
11
  }
12
12
  }
13
13
  exports.HistoricalDataApi = HistoricalDataApi;
@@ -1,8 +1,10 @@
1
1
  import { CoinSymbol, CoinType } from "../../types";
2
- import { CoinGeckoCoinData, CoinGeckoCoinSymbolData } from "../prices/coingecko/coinGeckoTypes";
2
+ import { CoinGeckoChain, CoinGeckoCoinData, CoinGeckoCoinSymbolData } from "../prices/coingecko/coinGeckoTypes";
3
3
  import { CoinHistoricalData } from "./historicalDataTypes";
4
4
  export interface HistoricalDataApiInterface {
5
- fetchAllSuiCoinData: () => Promise<Record<CoinType, CoinGeckoCoinData>>;
5
+ fetchAllCoinDataForChains: (inputs: {
6
+ chains: CoinGeckoChain[];
7
+ }) => Promise<Partial<Record<"ethereum" | "arbitrum" | "bsc" | "solana" | "sui", Record<CoinType, CoinGeckoCoinData>>>>;
6
8
  fetchAllCoinData: () => Promise<Record<CoinSymbol, CoinGeckoCoinSymbolData>>;
7
9
  fetchHistoricalData: (inputs: {
8
10
  coinApiId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"historicalDataApiInterface.d.ts","sourceRoot":"","sources":["../../../src/general/historicalData/historicalDataApiInterface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACN,iBAAiB,EACjB,uBAAuB,EACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,MAAM,WAAW,0BAA0B;IAC1C,mBAAmB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAExE,gBAAgB,EAAE,MAAM,OAAO,CAC9B,MAAM,CAAC,UAAU,EAAE,uBAAuB,CAAC,CAC3C,CAAC;IAEF,mBAAmB,EAAE,CAAC,MAAM,EAAE;QAC7B,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KAChB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAClC"}
1
+ {"version":3,"file":"historicalDataApiInterface.d.ts","sourceRoot":"","sources":["../../../src/general/historicalData/historicalDataApiInterface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACN,cAAc,EACd,iBAAiB,EACjB,uBAAuB,EACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,MAAM,WAAW,0BAA0B;IAG1C,yBAAyB,EAAE,CAAC,MAAM,EAAE;QACnC,MAAM,EAAE,cAAc,EAAE,CAAC;KACzB,KAAK,OAAO,CACZ,OAAO,CACN,MAAM,CACL,UAAU,GAAG,UAAU,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,EAClD,MAAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CACnC,CACD,CACD,CAAC;IAEF,gBAAgB,EAAE,MAAM,OAAO,CAC9B,MAAM,CAAC,UAAU,EAAE,uBAAuB,CAAC,CAC3C,CAAC;IAEF,mBAAmB,EAAE,CAAC,MAAM,EAAE;QAC7B,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KAChB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAClC"}
@@ -1,9 +1,11 @@
1
1
  import { CoinType } from "../../types";
2
- import { CoinGeckoCoinData } from "../prices/coingecko/coinGeckoTypes";
2
+ import { CoinGeckoChain, CoinGeckoCoinData } from "../prices/coingecko/coinGeckoTypes";
3
3
  import { HistoricalDataApiInterface } from "./historicalDataApiInterface";
4
4
  import { CoinHistoricalData } from "./historicalDataTypes";
5
5
  export declare class PlaceholderHistoricalDataApi implements HistoricalDataApiInterface {
6
- fetchAllSuiCoinData: () => Promise<Record<CoinType, CoinGeckoCoinData>>;
6
+ fetchAllCoinDataForChains: (inputs: {
7
+ chains: CoinGeckoChain[];
8
+ }) => Promise<Partial<Record<"ethereum" | "arbitrum" | "bsc" | "solana" | "sui", Record<CoinType, CoinGeckoCoinData>>>>;
7
9
  fetchAllCoinData: () => Promise<Record<CoinType, CoinGeckoCoinData>>;
8
10
  fetchHistoricalData: (inputs: {
9
11
  coinApiId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"placeholderHistoricalDataApi.d.ts","sourceRoot":"","sources":["../../../src/general/historicalData/placeholderHistoricalDataApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACN,iBAAiB,EAEjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,qBAAa,4BACZ,YAAW,0BAA0B;IAE9B,mBAAmB,QAAa,QACtC,OAAO,QAAQ,EAAE,iBAAiB,CAAC,CACnC,CAEC;IAEK,gBAAgB,QAAa,QACnC,OAAO,QAAQ,EAAE,iBAAiB,CAAC,CACnC,CAEC;IAEK,mBAAmB,WAAkB;QAC3C,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KAChB,KAAG,QAAQ,kBAAkB,CAAC,CAE7B;CACF"}
1
+ {"version":3,"file":"placeholderHistoricalDataApi.d.ts","sourceRoot":"","sources":["../../../src/general/historicalData/placeholderHistoricalDataApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACN,cAAc,EACd,iBAAiB,EAEjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,qBAAa,4BACZ,YAAW,0BAA0B;IAQ9B,yBAAyB,WAAkB;QACjD,MAAM,EAAE,cAAc,EAAE,CAAC;KACzB,KAAG,QACH,QACC,OACC,UAAU,GAAG,UAAU,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,EAClD,OAAO,QAAQ,EAAE,iBAAiB,CAAC,CACnC,CACD,CACD,CAEC;IAEK,gBAAgB,QAAa,QACnC,OAAO,QAAQ,EAAE,iBAAiB,CAAC,CACnC,CAEC;IAEK,mBAAmB,WAAkB;QAC3C,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KAChB,KAAG,QAAQ,kBAAkB,CAAC,CAE7B;CACF"}
@@ -12,7 +12,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.PlaceholderHistoricalDataApi = void 0;
13
13
  class PlaceholderHistoricalDataApi {
14
14
  constructor() {
15
- this.fetchAllSuiCoinData = () => __awaiter(this, void 0, void 0, function* () {
15
+ // public fetchAllSuiCoinData = async (): Promise<
16
+ // Record<CoinType, CoinGeckoCoinData>
17
+ // > => {
18
+ // return {};
19
+ // };
20
+ this.fetchAllCoinDataForChains = (inputs) => __awaiter(this, void 0, void 0, function* () {
16
21
  return {};
17
22
  });
18
23
  this.fetchAllCoinData = () => __awaiter(this, void 0, void 0, function* () {
@@ -1,14 +1,19 @@
1
- import { CoinPriceInfo, CoinSymbol, CoinType } from "../../../types";
1
+ import { CoinMetadaWithInfo, CoinPriceInfo, CoinType } from "../../../types";
2
2
  import { CoinHistoricalData } from "../../historicalData/historicalDataTypes";
3
3
  import { AftermathApi } from "../../providers";
4
- import { CoinGeckoCoinApiId, CoinGeckoCoinData, CoinGeckoCoinSymbolData } from "./coinGeckoTypes";
4
+ import { CoinGeckoChain, CoinGeckoCoinApiId, CoinGeckoCoinData, CoinGeckoCoinSymbolData } from "./coinGeckoTypes";
5
5
  export declare class CoinGeckoApiHelpers {
6
6
  protected readonly Provider: AftermathApi;
7
7
  private readonly coinGeckoApiKey;
8
- private readonly coinApiIdsToCoinTypes;
9
- constructor(Provider: AftermathApi, coinGeckoApiKey: string, coinApiIdsToCoinTypes: Record<CoinGeckoCoinApiId, CoinType[]>);
10
- fetchAllSuiCoinData: () => Promise<Record<CoinType, CoinGeckoCoinData>>;
11
- fetchAllCoinData: () => Promise<Record<CoinSymbol, CoinGeckoCoinSymbolData>>;
8
+ constructor(Provider: AftermathApi, coinGeckoApiKey: string);
9
+ fetchAllCoinDataForChains: (...inputs: {
10
+ chains: CoinGeckoChain[];
11
+ }[]) => Promise<Partial<Record<"ethereum" | "arbitrum" | "bsc" | "solana" | "sui", Record<string, CoinGeckoCoinData>>>>;
12
+ fetchAllCoinData: (...inputs: never[]) => Promise<Record<string, CoinGeckoCoinSymbolData>>;
13
+ fetchCoinMetadata: (...inputs: {
14
+ coinType: CoinType;
15
+ chain: CoinGeckoChain;
16
+ }[]) => Promise<CoinMetadaWithInfo | undefined>;
12
17
  fetchHistoricalData: (...inputs: {
13
18
  coinApiId: CoinGeckoCoinApiId;
14
19
  daysAgo: number;
@@ -1 +1 @@
1
- {"version":3,"file":"coinGeckoApiHelpers.d.ts","sourceRoot":"","sources":["../../../../src/general/prices/coingecko/coinGeckoApiHelpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EACN,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,mBAAmB;IAM9B,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,YAAY;IACzC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,qBAAqB;gBAFnB,QAAQ,EAAE,YAAY,EACxB,eAAe,EAAE,MAAM,EACvB,qBAAqB,EAAE,MAAM,CAC7C,kBAAkB,EAClB,QAAQ,EAAE,CACV;IAWK,mBAAmB,QAAa,QACtC,OAAO,QAAQ,EAAE,iBAAiB,CAAC,CACnC,CAsEC;IAEK,gBAAgB,QAAa,QACnC,OAAO,UAAU,EAAE,uBAAuB,CAAC,CAC3C,CAYC;IAMK,mBAAmB;mBAIb,kBAAkB;iBACpB,MAAM;wCA2Bd;IAMI,6BAA6B;sBAIpB,OAAO,QAAQ,EAAE,kBAAkB,CAAC;mDAmFjD;IAUH,OAAO,CAAC,OAAO,CAeb;IAEF,OAAO,CAAC,gBAAgB,CAerB;CACH"}
1
+ {"version":3,"file":"coinGeckoApiHelpers.d.ts","sourceRoot":"","sources":["../../../../src/general/prices/coingecko/coinGeckoApiHelpers.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,kBAAkB,EAClB,aAAa,EAEb,QAAQ,EAER,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EACN,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,mBAAmB;IAM9B,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,YAAY;IACzC,OAAO,CAAC,QAAQ,CAAC,eAAe;gBADb,QAAQ,EAAE,YAAY,EACxB,eAAe,EAAE,MAAM;IAYlC,yBAAyB;gBAItB,cAAc,EAAE;4HAyGvB;IAEI,gBAAgB,2EAkBpB;IAGI,iBAAiB;kBAIZ,QAAQ;eACX,cAAc;oDAiDpB;IAMI,mBAAmB;mBAIb,kBAAkB;iBACpB,MAAM;wCA2Bd;IAMI,6BAA6B;sBAIpB,OAAO,QAAQ,EAAE,kBAAkB,CAAC;mDAmFjD;IAUH,OAAO,CAAC,OAAO,CAeb;IAEF,OAAO,CAAC,gBAAgB,CAarB;CACH"}
@@ -16,73 +16,133 @@ class CoinGeckoApiHelpers {
16
16
  // =========================================================================
17
17
  // Constructor
18
18
  // =========================================================================
19
- constructor(Provider, coinGeckoApiKey, coinApiIdsToCoinTypes) {
19
+ constructor(Provider, coinGeckoApiKey) {
20
20
  this.Provider = Provider;
21
21
  this.coinGeckoApiKey = coinGeckoApiKey;
22
- this.coinApiIdsToCoinTypes = coinApiIdsToCoinTypes;
23
22
  // =========================================================================
24
23
  // Public
25
24
  // =========================================================================
26
25
  // =========================================================================
27
26
  // Coin Data
28
27
  // =========================================================================
29
- this.fetchAllSuiCoinData = () => __awaiter(this, void 0, void 0, function* () {
30
- const coinData = yield this.fetchRawCoinData();
31
- const suiCoinData = coinData
32
- .filter((data) => "sui" in data.platforms || data.id === "sui")
33
- .map((data) => {
34
- const coinType = data.id === "sui"
35
- ? packages_1.Coin.constants.suiCoinType
36
- : data.platforms.sui;
37
- try {
28
+ // TODO: add cache by chain as well
29
+ this.fetchAllCoinDataForChains = this.Provider.withCache({
30
+ key: "coinGeckoApiHelpers.fetchAllCoinDataForChains",
31
+ expirationSeconds: 604800,
32
+ callback: (inputs) => __awaiter(this, void 0, void 0, function* () {
33
+ const { chains } = inputs;
34
+ if (chains.length <= 0)
35
+ return {};
36
+ const coinData = yield this.fetchRawCoinData();
37
+ const chainsCoinData = coinData
38
+ .filter((data) => chains.some((chain) => chain in data.platforms) ||
39
+ chains.some((chain) => chain === data.id))
40
+ .map((data) => chains.map((chain) => {
41
+ const coinType = chain === "sui" && data.id === "sui"
42
+ ? packages_1.Coin.constants.suiCoinType
43
+ : data.platforms[chain];
38
44
  if (!coinType)
39
- throw new Error("no coin type found");
45
+ return undefined;
40
46
  return {
47
+ chain,
41
48
  apiId: data.id,
42
49
  name: data.name,
43
50
  symbol: data.symbol,
44
- coinType: utils_1.Helpers.addLeadingZeroesToType(coinType),
45
- };
46
- }
47
- catch (e) {
48
- return undefined;
49
- }
50
- })
51
- .filter((data) => data !== undefined);
52
- const partialCoinDataObject = suiCoinData.reduce((acc, data) => {
53
- return Object.assign({ [data.coinType]: data }, acc);
54
- }, {});
55
- const coinDataObject = Object.entries(this.coinApiIdsToCoinTypes).reduce((acc, [coinApiId, coinTypes]) => {
56
- const foundSuiData = Object.values(partialCoinDataObject).find((data) => data.apiId === coinApiId);
57
- let foundData = foundSuiData;
58
- if (!foundData) {
59
- const foundCoinData = coinData.find((data) => data.id === coinApiId);
60
- if (!foundCoinData)
61
- return acc;
62
- foundData = {
63
- apiId: coinApiId,
64
- name: foundCoinData.name,
65
- symbol: foundCoinData.symbol,
66
- coinType: "",
51
+ coinType: chain === "sui"
52
+ ? utils_1.Helpers.addLeadingZeroesToType(coinType)
53
+ : coinType,
67
54
  };
68
- }
69
- if (!foundData)
70
- return acc;
71
- const dataToDuplicate = foundData;
72
- const newData = coinTypes.reduce((acc, coinType) => (Object.assign({ [coinType]: Object.assign(Object.assign({}, dataToDuplicate), { coinType }) }, acc)), acc);
73
- return newData;
74
- }, partialCoinDataObject);
75
- return coinDataObject;
55
+ }))
56
+ .reduce((acc, data) => [...acc, ...data], [])
57
+ .filter((data) => data !== undefined);
58
+ // const partialCoinDataObject: Record<CoinType, CoinGeckoCoinData> =
59
+ const coinDataObject = chainsCoinData.reduce((acc, data) => {
60
+ return Object.assign({ [data.coinType]: data }, acc);
61
+ }, {});
62
+ // const coinDataObject = Object.entries(
63
+ // this.coinApiIdsToCoinTypes
64
+ // ).reduce((acc, [coinApiId, coinTypes]) => {
65
+ // const foundChainData = Object.values(
66
+ // partialCoinDataObject
67
+ // ).find((data) => data.apiId === coinApiId);
68
+ // let foundData = foundChainData;
69
+ // if (!foundData) {
70
+ // const foundCoinData = coinData.find(
71
+ // (data) => data.id === coinApiId
72
+ // );
73
+ // if (!foundCoinData) return acc;
74
+ // foundData = {
75
+ // apiId: coinApiId,
76
+ // name: foundCoinData.name,
77
+ // symbol: foundCoinData.symbol,
78
+ // coinType: "",
79
+ // chain: "",
80
+ // };
81
+ // }
82
+ // if (!foundData) return acc;
83
+ // const dataToDuplicate = foundData;
84
+ // const newData = coinTypes.reduce((acc, coinType) => {
85
+ // const chain: CoinGeckoChain = Helpers.isValidType(coinType)
86
+ // ? "sui"
87
+ // : Helpers.splitNonSuiCoinType(coinType).chain;
88
+ // return {
89
+ // [coinType]: {
90
+ // ...dataToDuplicate,
91
+ // coinType,
92
+ // chain,
93
+ // },
94
+ // ...acc,
95
+ // };
96
+ // }, acc);
97
+ // return newData;
98
+ // }, partialCoinDataObject);
99
+ return Object.entries(coinDataObject).reduce((acc, [coinType, data]) => {
100
+ var _a;
101
+ return data.chain === ""
102
+ ? {}
103
+ : Object.assign(Object.assign({}, acc), { [data.chain]: Object.assign(Object.assign({}, ((_a = acc[data.chain]) !== null && _a !== void 0 ? _a : {})), { [coinType]: data }) });
104
+ }, {});
105
+ }),
76
106
  });
77
- this.fetchAllCoinData = () => __awaiter(this, void 0, void 0, function* () {
78
- const coinData = yield this.fetchRawCoinData();
79
- return coinData.reduce((acc, data) => {
80
- return Object.assign({ [data.symbol.toLowerCase()]: {
81
- apiId: data.id,
82
- name: data.name,
83
- symbol: data.symbol.toLowerCase(),
84
- } }, acc);
85
- }, {});
107
+ this.fetchAllCoinData = this.Provider.withCache({
108
+ key: "coinGeckoApiHelpers.fetchAllCoinData",
109
+ expirationSeconds: 604800,
110
+ callback: () => __awaiter(this, void 0, void 0, function* () {
111
+ const coinData = yield this.fetchRawCoinData();
112
+ return coinData.reduce((acc, data) => {
113
+ return Object.assign({ [data.symbol.toLowerCase()]: {
114
+ apiId: data.id,
115
+ name: data.name,
116
+ symbol: data.symbol.toLowerCase(),
117
+ } }, acc);
118
+ }, {});
119
+ }),
120
+ });
121
+ // TODO: handle multiple
122
+ this.fetchCoinMetadata = this.Provider.withCache({
123
+ key: "coinGeckoApiHelpers.fetchCoinMetadata",
124
+ expirationSeconds: -1,
125
+ callback: (inputs) => __awaiter(this, void 0, void 0, function* () {
126
+ var _a, _b;
127
+ const { coinType, chain } = inputs;
128
+ // Fetch the list of coins and filter by token address
129
+ const coins = yield this.fetchRawCoinData();
130
+ const coin = coins.find((c) => { var _a; return ((_a = c.platforms[chain]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === coinType.toLowerCase(); });
131
+ if (!coin)
132
+ return undefined;
133
+ // Fetch detailed coin metadata
134
+ const coinDetails = yield this.callApi(`coins/${coin.id}?tickers=false&market_data=false&community_data=false&developer_data=false&sparkline=false`);
135
+ const { detail_platforms, name, symbol, description, image } = coinDetails;
136
+ return {
137
+ id: null,
138
+ name,
139
+ symbol: symbol.toUpperCase(),
140
+ description: description.en,
141
+ iconUrl: image.small,
142
+ decimals: (_b = (_a = detail_platforms[inputs.chain]) === null || _a === void 0 ? void 0 : _a.decimal_place) !== null && _b !== void 0 ? _b : -1,
143
+ isGenerated: false,
144
+ };
145
+ }),
86
146
  });
87
147
  // =========================================================================
88
148
  // Historical Data
@@ -168,7 +228,7 @@ class CoinGeckoApiHelpers {
168
228
  return castedRes;
169
229
  });
170
230
  this.fetchRawCoinData = this.Provider.withCache({
171
- key: "coinGeckoApiHelpers.fetchAllSuiCoinData",
231
+ key: "coinGeckoApiHelpers.fetchRawCoinData",
172
232
  expirationSeconds: 86400,
173
233
  callback: () => {
174
234
  return this.callApi("coins/list?include_platform=true");
@@ -4,15 +4,14 @@ import { PricesApiInterface } from "../pricesApiInterface";
4
4
  import { CoinGeckoApiHelpers } from "./coinGeckoApiHelpers";
5
5
  import { CoinGeckoCoinApiId } from "./coinGeckoTypes";
6
6
  export declare class CoinGeckoPricesApi extends CoinGeckoApiHelpers implements PricesApiInterface {
7
+ private readonly coinApiIdsToCoinTypes;
7
8
  constructor(Provider: AftermathApi, coinGeckoApiKey: string, coinApiIdsToCoinTypes: Record<CoinGeckoCoinApiId, CoinType[]>);
8
9
  fetchPrice: (inputs: {
9
10
  coin: CoinType;
10
11
  }) => Promise<number>;
11
12
  fetchCoinsToPrice: (...inputs: {
12
13
  coins: CoinType[];
13
- }[]) => Promise<{
14
- [x: string]: number;
15
- }>;
14
+ }[]) => Promise<Record<string, number>>;
16
15
  fetchCoinsToPriceInfo: (...inputs: {
17
16
  coins: CoinType[];
18
17
  }[]) => Promise<Record<string, CoinPriceInfo>>;
@@ -1 +1 @@
1
- {"version":3,"file":"coinGeckoPricesApi.d.ts","sourceRoot":"","sources":["../../../../src/general/prices/coingecko/coinGeckoPricesApi.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,aAAa,EAGb,QAAQ,EAGR,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAA2B,MAAM,kBAAkB,CAAC;AAE/E,qBAAa,kBACZ,SAAQ,mBACR,YAAW,kBAAkB;gBAO5B,QAAQ,EAAE,YAAY,EACtB,eAAe,EAAE,MAAM,EACvB,qBAAqB,EAAE,MAAM,CAAC,kBAAkB,EAAE,QAAQ,EAAE,CAAC;IAiBvD,UAAU,WAAkB;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,KAAG,QAAQ,MAAM,CAAC,CAMrE;IAGK,iBAAiB;eAGW,QAAQ,EAAE;;;OAqD1C;IAGI,qBAAqB;eAInB,QAAQ,EAAE;mDAuEhB;IAMI,4BAA4B,WAAkB;QACpD,YAAY,EAAE,OAAO,QAAQ,EAAE,kBAAkB,CAAC,CAAC;KACnD,KAAG,QAAQ,OAAO,QAAQ,EAAE,MAAM,CAAC,CAAC,CAcnC;CACF"}
1
+ {"version":3,"file":"coinGeckoPricesApi.d.ts","sourceRoot":"","sources":["../../../../src/general/prices/coingecko/coinGeckoPricesApi.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,aAAa,EAGb,QAAQ,EAGR,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAEN,kBAAkB,EAGlB,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,kBACZ,SAAQ,mBACR,YAAW,kBAAkB;IAS5B,OAAO,CAAC,QAAQ,CAAC,qBAAqB;gBAFtC,QAAQ,EAAE,YAAY,EACtB,eAAe,EAAE,MAAM,EACN,qBAAqB,EAAE,MAAM,CAC7C,kBAAkB,EAClB,QAAQ,EAAE,CACV;IAiBK,UAAU,WAAkB;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,KAAG,QAAQ,MAAM,CAAC,CAMrE;IAGK,iBAAiB;eAIf,QAAQ,EAAE;4CAkJhB;IAGI,qBAAqB;eAInB,QAAQ,EAAE;mDAwMhB;IAMI,4BAA4B,WAAkB;QACpD,YAAY,EAAE,OAAO,QAAQ,EAAE,kBAAkB,CAAC,CAAC;KACnD,KAAG,QAAQ,OAAO,QAAQ,EAAE,MAAM,CAAC,CAAC,CAcnC;CACF"}
@@ -18,7 +18,8 @@ class CoinGeckoPricesApi extends coinGeckoApiHelpers_1.CoinGeckoApiHelpers {
18
18
  // Constructor
19
19
  // =========================================================================
20
20
  constructor(Provider, coinGeckoApiKey, coinApiIdsToCoinTypes) {
21
- super(Provider, coinGeckoApiKey, coinApiIdsToCoinTypes);
21
+ super(Provider, coinGeckoApiKey);
22
+ this.coinApiIdsToCoinTypes = coinApiIdsToCoinTypes;
22
23
  // =========================================================================
23
24
  // Fetching
24
25
  // =========================================================================
@@ -39,29 +40,86 @@ class CoinGeckoPricesApi extends coinGeckoApiHelpers_1.CoinGeckoApiHelpers {
39
40
  expirationSeconds: 300,
40
41
  callback: (inputs) => __awaiter(this, void 0, void 0, function* () {
41
42
  const { coins } = inputs;
42
- // filter regular vs LP coins
43
- const [lpCoins, regularCoins] = yield utils_1.Helpers.bifilterAsync(coins, (coin) => __awaiter(this, void 0, void 0, function* () {
44
- return this.Provider.Pools().fetchIsLpCoinType({
45
- lpCoinType: coin,
46
- });
47
- }));
48
- const allSuiCoinData = yield this.fetchAllSuiCoinData();
49
- const neededCoinData = utils_1.Helpers.filterObject(allSuiCoinData, (coin) => regularCoins
50
- .map(utils_1.Helpers.addLeadingZeroesToType)
51
- .includes(utils_1.Helpers.addLeadingZeroesToType(coin)));
52
- const coinsToApiId = Object.entries(neededCoinData).reduce((acc, [coin, data]) => (Object.assign(Object.assign({}, acc), { [coin]: data.apiId })), {});
53
- const [coinsToPrice, lpCoinsToPrice, missingCoinsToPrice] = yield Promise.all([
54
- this.fetchCoinsToPriceGivenApiIds({
55
- coinsToApiId,
56
- }),
57
- this.Provider.Pools().fetchLpCoinsToPrice({ lpCoins }),
58
- new routerPricesApi_1.RouterPricesApi(this.Provider).fetchCoinsToPrice({
59
- coins: coins.filter((coin) => !Object.keys(neededCoinData)
60
- .map(utils_1.Helpers.addLeadingZeroesToType)
61
- .includes(utils_1.Helpers.addLeadingZeroesToType(coin))),
43
+ const [suiCoins, nonSuiCoins] = yield utils_1.Helpers.bifilter(coins, (coin) => utils_1.Helpers.isValidType(coin));
44
+ const [suiCoinsToPrice, nonSuiCoinsToPrice] = yield Promise.all([
45
+ (() => __awaiter(this, void 0, void 0, function* () {
46
+ if (suiCoins.length <= 0)
47
+ return {};
48
+ // filter regular vs LP coins
49
+ const [lpCoins, regularCoins] = yield utils_1.Helpers.bifilterAsync(suiCoins, (coin) => __awaiter(this, void 0, void 0, function* () {
50
+ return this.Provider.Pools().fetchIsLpCoinType({
51
+ lpCoinType: coin,
52
+ });
53
+ }));
54
+ // const allSuiCoinData: Record<
55
+ // CoinSymbol,
56
+ // CoinGeckoCoinSymbolData
57
+ // > =
58
+ // (
59
+ // await this.fetchAllCoinDataForChains({
60
+ // chains: ["sui"],
61
+ // })
62
+ // )["sui"] ?? {};
63
+ // const neededCoinData = Helpers.filterObject(
64
+ // allSuiCoinData,
65
+ // (coin) =>
66
+ // regularCoins
67
+ // .map(Helpers.addLeadingZeroesToType)
68
+ // .includes(Helpers.addLeadingZeroesToType(coin))
69
+ // );
70
+ // const coinsToApiId: Record<CoinType, CoinGeckoCoinApiId> =
71
+ // Object.entries(neededCoinData).reduce(
72
+ // (acc, [coin, data]) => ({
73
+ // ...acc,
74
+ // [coin]: data.apiId,
75
+ // }),
76
+ // {}
77
+ // );
78
+ const [
79
+ // coinsToPrice,
80
+ lpCoinsToPrice,
81
+ // missingCoinsToPrice,
82
+ coinsToPrice,] = yield Promise.all([
83
+ // this.fetchCoinsToPriceGivenApiIds({
84
+ // coinsToApiId,
85
+ // }),
86
+ this.Provider.Pools().fetchLpCoinsToPrice({
87
+ lpCoins,
88
+ }),
89
+ new routerPricesApi_1.RouterPricesApi(this.Provider).fetchCoinsToPrice({
90
+ coins: suiCoins.filter((coin) =>
91
+ // !Object.keys(neededCoinData)
92
+ regularCoins
93
+ .map(utils_1.Helpers.addLeadingZeroesToType)
94
+ .includes(utils_1.Helpers.addLeadingZeroesToType(coin))),
95
+ }),
96
+ ]);
97
+ return Object.assign(Object.assign({}, coinsToPrice), lpCoinsToPrice);
98
+ }))(),
99
+ () => __awaiter(this, void 0, void 0, function* () {
100
+ var _a;
101
+ if (nonSuiCoins.length <= 0)
102
+ return {};
103
+ const chains = utils_1.Helpers.uniqueArray(nonSuiCoins.map((coin) => utils_1.Helpers.splitNonSuiCoinType(coin).chain));
104
+ const allNonSuiCoinData = (_a = (yield this.fetchAllCoinDataForChains({
105
+ // TODO: handle other chains
106
+ chains,
107
+ }))) !== null && _a !== void 0 ? _a : {};
108
+ const neededCoinData = Object.entries(allNonSuiCoinData)
109
+ .map(([chain, data]) => utils_1.Helpers.filterObject(Object.entries(data)
110
+ .map(([coinType, filteredData]) => ({
111
+ [coinType]: filteredData,
112
+ }))
113
+ .reduce((acc, curr) => (Object.assign(Object.assign({}, acc), curr)), {}), (coin) => nonSuiCoins.some((aCoin) => aCoin.toLowerCase() ===
114
+ coin.toLowerCase())))
115
+ .reduce((acc, curr) => (Object.assign(Object.assign({}, acc), curr)), {});
116
+ const coinsToApiId = Object.entries(neededCoinData).reduce((acc, [coin, data]) => (Object.assign(Object.assign({}, acc), { [coin]: data.apiId })), {});
117
+ return this.fetchCoinsToPriceGivenApiIds({
118
+ coinsToApiId,
119
+ });
62
120
  }),
63
121
  ]);
64
- return Object.assign(Object.assign(Object.assign({}, coinsToPrice), lpCoinsToPrice), missingCoinsToPrice);
122
+ return Object.assign(Object.assign({}, suiCoinsToPrice), nonSuiCoinsToPrice);
65
123
  }),
66
124
  });
67
125
  // TODO: add single cache by coin type ?
@@ -70,34 +128,107 @@ class CoinGeckoPricesApi extends coinGeckoApiHelpers_1.CoinGeckoApiHelpers {
70
128
  expirationSeconds: 300,
71
129
  callback: (inputs) => __awaiter(this, void 0, void 0, function* () {
72
130
  const { coins } = inputs;
73
- // filter regular vs LP coins
74
- const [lpCoins, regularCoins] = yield utils_1.Helpers.bifilterAsync(coins, (coin) => __awaiter(this, void 0, void 0, function* () {
75
- return this.Provider.Pools().fetchIsLpCoinType({
76
- lpCoinType: coin,
77
- });
78
- }));
79
- const allSuiCoinData = yield this.fetchAllSuiCoinData();
80
- const neededCoinData = utils_1.Helpers.filterObject(allSuiCoinData, (coin) => regularCoins
81
- .map(utils_1.Helpers.addLeadingZeroesToType)
82
- .includes(utils_1.Helpers.addLeadingZeroesToType(coin)));
83
- const coinsToApiId = Object.entries(neededCoinData).reduce((acc, [coin, data]) => (Object.assign(Object.assign({}, acc), { [coin]: data.apiId })), {});
84
- // get coin price info for regular coins and calc info for LP coins
85
- const [regularCoinsToPriceInfo, lpCoinsToPrice, missingRegularCoins,] = yield Promise.all([
86
- this.fetchCoinsToPriceInfoInternal({ coinsToApiId }),
87
- this.Provider.Pools().fetchLpCoinsToPrice({ lpCoins }),
88
- new routerPricesApi_1.RouterPricesApi(this.Provider).fetchCoinsToPriceInfo({
89
- coins: coins.filter((coin) => !Object.keys(neededCoinData)
90
- .map(utils_1.Helpers.addLeadingZeroesToType)
91
- .includes(utils_1.Helpers.addLeadingZeroesToType(coin))),
92
- }),
131
+ const [suiCoins, nonSuiCoins] = yield utils_1.Helpers.bifilter(coins, (coin) => utils_1.Helpers.isValidType(coin));
132
+ const [suiCoinsPriceInfo, nonSuiCoinsPriceInfo] = yield Promise.all([
133
+ (() => __awaiter(this, void 0, void 0, function* () {
134
+ if (suiCoins.length <= 0)
135
+ return {};
136
+ // filter regular vs LP coins
137
+ const [lpCoins, regularCoins] = yield utils_1.Helpers.bifilterAsync(suiCoins, (coin) => __awaiter(this, void 0, void 0, function* () {
138
+ return this.Provider.Pools().fetchIsLpCoinType({
139
+ lpCoinType: coin,
140
+ });
141
+ }));
142
+ // const allSuiCoinData: Record<
143
+ // CoinType,
144
+ // CoinGeckoCoinSymbolData
145
+ // > =
146
+ // (
147
+ // await this.fetchAllCoinDataForChains({
148
+ // chains: ["sui"],
149
+ // })
150
+ // )["sui"] ?? {};
151
+ // const neededCoinData = Helpers.filterObject(
152
+ // allSuiCoinData,
153
+ // (coin) =>
154
+ // regularCoins
155
+ // .map(Helpers.addLeadingZeroesToType)
156
+ // .includes(
157
+ // Helpers.addLeadingZeroesToType(coin)
158
+ // )
159
+ // );
160
+ // const coinsToApiId: Record<
161
+ // CoinType,
162
+ // CoinGeckoCoinApiId
163
+ // > = Object.entries(neededCoinData).reduce(
164
+ // (acc, [coin, data]) => ({
165
+ // ...acc,
166
+ // [coin]: data.apiId,
167
+ // }),
168
+ // {}
169
+ // );
170
+ // get coin price info for regular coins and calc info for LP coins
171
+ const [
172
+ // regularCoinsToPriceInfo,
173
+ lpCoinsToPrice,
174
+ // missingRegularCoins,
175
+ regularCoinsToPriceInfo,] = yield Promise.all([
176
+ // this.fetchCoinsToPriceInfoInternal({
177
+ // coinsToApiId,
178
+ // }),
179
+ this.Provider.Pools().fetchLpCoinsToPrice({
180
+ lpCoins,
181
+ }),
182
+ new routerPricesApi_1.RouterPricesApi(this.Provider).fetchCoinsToPriceInfo({
183
+ coins: suiCoins.filter((coin) =>
184
+ // !Object.keys(neededCoinData)
185
+ regularCoins
186
+ .map(utils_1.Helpers.addLeadingZeroesToType)
187
+ .includes(utils_1.Helpers.addLeadingZeroesToType(coin))),
188
+ }),
189
+ ]);
190
+ const lpCoinsToPriceInfo = Object.entries(lpCoinsToPrice).reduce((acc, [coin, price]) => (Object.assign(Object.assign({}, acc), { [coin]: {
191
+ price,
192
+ priceChange24HoursPercentage: 0,
193
+ } })), {});
194
+ // merge all collected data
195
+ const allInfo = Object.assign(Object.assign({}, lpCoinsToPriceInfo), regularCoinsToPriceInfo);
196
+ return allInfo;
197
+ }))(),
198
+ (() => __awaiter(this, void 0, void 0, function* () {
199
+ var _b;
200
+ if (nonSuiCoins.length <= 0)
201
+ return {};
202
+ if (nonSuiCoins.every((coin) => Object.values(this.coinApiIdsToCoinTypes)
203
+ .reduce((acc, coinTypes) => [
204
+ ...acc,
205
+ ...coinTypes,
206
+ ], [])
207
+ .includes(coin))) {
208
+ return this.fetchCoinsToPriceInfoInternal({
209
+ coinsToApiId: nonSuiCoins.reduce((acc, coin) => (Object.assign(Object.assign({}, acc), { [coin]: Object.entries(this.coinApiIdsToCoinTypes).find(([, coinTypes]) => coinTypes.includes(coin))[0] })), {}),
210
+ });
211
+ }
212
+ const chains = utils_1.Helpers.uniqueArray(nonSuiCoins.map((coin) => utils_1.Helpers.splitNonSuiCoinType(coin).chain));
213
+ const allNonSuiCoinData = (_b = (yield this.fetchAllCoinDataForChains({
214
+ // TODO: handle other chains
215
+ chains,
216
+ }))) !== null && _b !== void 0 ? _b : {};
217
+ const neededCoinData = Object.entries(allNonSuiCoinData)
218
+ .map(([chain, data]) => utils_1.Helpers.filterObject(Object.entries(data)
219
+ .map(([coinType, filteredData]) => ({
220
+ [coinType]: filteredData,
221
+ }))
222
+ .reduce((acc, curr) => (Object.assign(Object.assign({}, acc), curr)), {}), (coin) => nonSuiCoins.some((aCoin) => aCoin.toLowerCase() ===
223
+ coin.toLowerCase())))
224
+ .reduce((acc, curr) => (Object.assign(Object.assign({}, acc), curr)), {});
225
+ const coinsToApiId = Object.entries(neededCoinData).reduce((acc, [coin, data]) => (Object.assign(Object.assign({}, acc), { [coin]: data.apiId })), {});
226
+ return this.fetchCoinsToPriceInfoInternal({
227
+ coinsToApiId,
228
+ });
229
+ }))(),
93
230
  ]);
94
- const lpCoinsToPriceInfo = Object.entries(lpCoinsToPrice).reduce((acc, [coin, price]) => (Object.assign(Object.assign({}, acc), { [coin]: {
95
- price,
96
- priceChange24HoursPercentage: 0,
97
- } })), {});
98
- // merge all collected data
99
- const allInfo = Object.assign(Object.assign(Object.assign({}, missingRegularCoins), lpCoinsToPriceInfo), regularCoinsToPriceInfo);
100
- return allInfo;
231
+ return Object.assign(Object.assign({}, suiCoinsPriceInfo), nonSuiCoinsPriceInfo);
101
232
  }),
102
233
  });
103
234
  // =========================================================================
@@ -1,6 +1,8 @@
1
1
  import { CoinSymbol, CoinType } from "../../../types";
2
+ export type CoinGeckoChain = Lowercase<"Ethereum" | "Arbitrum" | "Bsc" | "Solana" | "Sui">;
2
3
  export type CoinGeckoCoinApiId = string;
3
4
  export interface CoinGeckoCoinData {
5
+ chain: CoinGeckoChain | "";
4
6
  apiId: CoinGeckoCoinApiId;
5
7
  name: string;
6
8
  symbol: CoinSymbol;
@@ -1 +1 @@
1
- {"version":3,"file":"coinGeckoTypes.d.ts","sourceRoot":"","sources":["../../../../src/general/prices/coingecko/coinGeckoTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAc,MAAM,gBAAgB,CAAC;AAUlE,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAMxC,MAAM,WAAW,iBAAiB;IACjC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACvC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;CACnB"}
1
+ {"version":3,"file":"coinGeckoTypes.d.ts","sourceRoot":"","sources":["../../../../src/general/prices/coingecko/coinGeckoTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAc,MAAM,gBAAgB,CAAC;AAOlE,MAAM,MAAM,cAAc,GAAG,SAAS,CACrC,UAAU,GAAG,UAAU,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,CAoDlD,CAAC;AAMF,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAMxC,MAAM,WAAW,iBAAiB;IACjC,KAAK,EAAE,cAAc,GAAG,EAAE,CAAC;IAC3B,KAAK,EAAE,kBAAkB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACvC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;CACnB"}