aftermath-ts-sdk 0.0.142 → 0.0.144

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 (98) hide show
  1. package/dist/general/api/transactionsApiHelpers.d.ts.map +1 -1
  2. package/dist/general/api/transactionsApiHelpers.js +4 -6
  3. package/dist/general/historicalData/historicalData.d.ts +14 -0
  4. package/dist/general/historicalData/historicalData.d.ts.map +1 -0
  5. package/dist/general/historicalData/historicalData.js +41 -0
  6. package/dist/general/historicalData/historicalDataApi.d.ts +10 -0
  7. package/dist/general/historicalData/historicalDataApi.d.ts.map +1 -0
  8. package/dist/general/historicalData/historicalDataApi.js +20 -0
  9. package/dist/general/historicalData/historicalDataTypes.d.ts +10 -0
  10. package/dist/general/historicalData/historicalDataTypes.d.ts.map +1 -0
  11. package/dist/general/historicalData/historicalDataTypes.js +2 -0
  12. package/dist/general/prices/coingecko/coinGeckoApiHelpers.d.ts +17 -0
  13. package/dist/general/prices/coingecko/coinGeckoApiHelpers.d.ts.map +1 -0
  14. package/dist/general/prices/coingecko/coinGeckoApiHelpers.js +111 -0
  15. package/dist/general/prices/coingecko/coinGeckoPricesApi.d.ts +19 -0
  16. package/dist/general/prices/coingecko/coinGeckoPricesApi.d.ts.map +1 -0
  17. package/dist/general/prices/coingecko/coinGeckoPricesApi.js +63 -0
  18. package/dist/general/prices/coingecko/coinGeckoTypes.d.ts +9 -0
  19. package/dist/general/prices/coingecko/coinGeckoTypes.d.ts.map +1 -0
  20. package/dist/general/prices/coingecko/coinGeckoTypes.js +2 -0
  21. package/dist/general/prices/prices.d.ts +7 -1
  22. package/dist/general/prices/prices.d.ts.map +1 -1
  23. package/dist/general/prices/prices.js +18 -5
  24. package/dist/general/prices/pyth/pythPricesApi.d.ts +1 -2
  25. package/dist/general/prices/pyth/pythPricesApi.d.ts.map +1 -1
  26. package/dist/general/prices/pyth/pythPricesApi.js +2 -2
  27. package/dist/general/prices/pyth/pythPricesApiHelpers.d.ts +1 -3
  28. package/dist/general/prices/pyth/pythPricesApiHelpers.d.ts.map +1 -1
  29. package/dist/general/prices/pyth/pythPricesApiHelpers.js +1 -3
  30. package/dist/general/providers/aftermath.d.ts +3 -1
  31. package/dist/general/providers/aftermath.d.ts.map +1 -1
  32. package/dist/general/providers/aftermath.js +2 -0
  33. package/dist/general/providers/aftermathApi.d.ts +6 -3
  34. package/dist/general/providers/aftermathApi.d.ts.map +1 -1
  35. package/dist/general/providers/aftermathApi.js +8 -3
  36. package/dist/general/types/configTypes.d.ts +4 -0
  37. package/dist/general/types/configTypes.d.ts.map +1 -1
  38. package/dist/general/types/generalTypes.d.ts +1 -0
  39. package/dist/general/types/generalTypes.d.ts.map +1 -1
  40. package/dist/general/types/suiTypes.d.ts +1 -1
  41. package/dist/general/types/suiTypes.d.ts.map +1 -1
  42. package/dist/general/utils/caller.d.ts.map +1 -1
  43. package/dist/general/utils/caller.js +4 -2
  44. package/dist/general/utils/helpers.js +1 -1
  45. package/dist/general/wallet/walletApi.d.ts.map +1 -1
  46. package/dist/general/wallet/walletApi.js +2 -2
  47. package/dist/packages/coin/api/coinApi.d.ts +1 -0
  48. package/dist/packages/coin/api/coinApi.d.ts.map +1 -1
  49. package/dist/packages/coin/api/coinApi.js +47 -10
  50. package/dist/packages/coin/api/coinApiHelpers.d.ts +1 -10
  51. package/dist/packages/coin/api/coinApiHelpers.d.ts.map +1 -1
  52. package/dist/packages/coin/api/coinApiHelpers.js +86 -56
  53. package/dist/packages/coin/coin.d.ts +10 -7
  54. package/dist/packages/coin/coin.d.ts.map +1 -1
  55. package/dist/packages/coin/coin.js +39 -14
  56. package/dist/packages/coin/coinTypes.d.ts +7 -1
  57. package/dist/packages/coin/coinTypes.d.ts.map +1 -1
  58. package/dist/packages/external/turbos/turbosApiHelpers.d.ts.map +1 -1
  59. package/dist/packages/external/turbos/turbosApiHelpers.js +0 -1
  60. package/dist/packages/faucet/api/faucetApi.d.ts +7 -2
  61. package/dist/packages/faucet/api/faucetApi.d.ts.map +1 -1
  62. package/dist/packages/faucet/api/faucetApi.js +15 -6
  63. package/dist/packages/faucet/api/faucetApiHelpers.d.ts +99 -7
  64. package/dist/packages/faucet/api/faucetApiHelpers.d.ts.map +1 -1
  65. package/dist/packages/faucet/api/faucetApiHelpers.js +9 -17
  66. package/dist/packages/faucet/faucetTypes.d.ts +1 -1
  67. package/dist/packages/faucet/faucetTypes.d.ts.map +1 -1
  68. package/dist/packages/pools/api/poolsApi.d.ts +20 -7
  69. package/dist/packages/pools/api/poolsApi.d.ts.map +1 -1
  70. package/dist/packages/pools/api/poolsApi.js +17 -15
  71. package/dist/packages/pools/api/poolsApiHelpers.d.ts +14 -4
  72. package/dist/packages/pools/api/poolsApiHelpers.d.ts.map +1 -1
  73. package/dist/packages/pools/api/poolsApiHelpers.js +14 -17
  74. package/dist/packages/pools/pool.d.ts +6 -3
  75. package/dist/packages/pools/pool.d.ts.map +1 -1
  76. package/dist/packages/pools/pool.js +24 -12
  77. package/dist/packages/pools/pools.d.ts +3 -2
  78. package/dist/packages/pools/pools.d.ts.map +1 -1
  79. package/dist/packages/pools/pools.js +3 -2
  80. package/dist/packages/pools/poolsTypes.d.ts +2 -2
  81. package/dist/packages/pools/poolsTypes.d.ts.map +1 -1
  82. package/dist/packages/router/api/routerApi.d.ts.map +1 -1
  83. package/dist/packages/router/router.d.ts +1 -1
  84. package/dist/packages/router/router.js +1 -1
  85. package/dist/packages/router/utils/synchronous/routerGraph.d.ts.map +1 -1
  86. package/dist/packages/router/utils/synchronous/routerGraph.js +0 -1
  87. package/dist/packages/router/utils/synchronous/routerPools/aftermathRouterPool.d.ts.map +1 -1
  88. package/dist/packages/router/utils/synchronous/routerPools/aftermathRouterPool.js +5 -4
  89. package/dist/packages/staking/api/stakingApi.d.ts +7 -1
  90. package/dist/packages/staking/api/stakingApi.d.ts.map +1 -1
  91. package/dist/packages/staking/api/stakingApi.js +5 -2
  92. package/dist/packages/staking/api/stakingApiHelpers.d.ts +5 -1
  93. package/dist/packages/staking/api/stakingApiHelpers.d.ts.map +1 -1
  94. package/dist/packages/staking/api/stakingApiHelpers.js +18 -1
  95. package/dist/packages/staking/staking.d.ts +1 -0
  96. package/dist/packages/staking/staking.d.ts.map +1 -1
  97. package/dist/packages/staking/staking.js +5 -0
  98. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"transactionsApiHelpers.d.ts","sourceRoot":"","sources":["../../../src/general/api/transactionsApiHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,gCAAgC,EAChC,gBAAgB,EAChB,iBAAiB,EAIjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,qBAAa,sBAAsB;IAKtB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,YAAY;IAY5C,2BAA2B,UAC1B,gCAAgC,WAC9B,iBAAiB,UAClB,MAAM,KACZ,QAAQ,sBAAsB,CAAC,CAkBhC;IAEK,+BAA+B,OACjC,gBAAgB,KAClB,QAAQ,gBAAgB,CAAC,CAoB1B;IAEK,wCAAwC,OAC1C,gBAAgB,GAAG,QAAQ,gBAAgB,CAAC,KAC9C,QAAQ,qBAAqB,CAAC,CAI/B;IAUF,OAAc,uBAAuB,mBACpB,MAAM,eACT,MAAM,gBACL,MAAM,KAClB,GAAG,MAAM,KAAK,MAAM,KAAK,MAAM,EAAE,CACkB;IAEtD,OAAc,kBAAkB;cAErB,IAAI;;;MACyC;CACxD"}
1
+ {"version":3,"file":"transactionsApiHelpers.d.ts","sourceRoot":"","sources":["../../../src/general/api/transactionsApiHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,gCAAgC,EAChC,gBAAgB,EAChB,iBAAiB,EAIjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,qBAAa,sBAAsB;IAKtB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,YAAY;IAY5C,2BAA2B,UAC1B,gCAAgC,WAC9B,iBAAiB,UAClB,MAAM,KACZ,QAAQ,sBAAsB,CAAC,CAkBhC;IAEK,+BAA+B,OACjC,gBAAgB,KAClB,QAAQ,gBAAgB,CAAC,CAkB1B;IAEK,wCAAwC,OAC1C,gBAAgB,GAAG,QAAQ,gBAAgB,CAAC,KAC9C,QAAQ,qBAAqB,CAAC,CAI/B;IAUF,OAAc,uBAAuB,mBACpB,MAAM,eACT,MAAM,gBACL,MAAM,KAClB,GAAG,MAAM,KAAK,MAAM,KAAK,MAAM,EAAE,CACkB;IAEtD,OAAc,kBAAkB;cAErB,IAAI;;;MACyC;CACxD"}
@@ -37,13 +37,11 @@ class TransactionsApiHelpers {
37
37
  };
38
38
  });
39
39
  this.fetchSetGasBudgetForTransaction = (tx) => __awaiter(this, void 0, void 0, function* () {
40
- const sender = tx.blockData.sender;
41
- if (!sender)
42
- throw new Error("no sender set for transaction");
43
40
  const [txResponse, referenceGasPrice] = yield Promise.all([
44
- this.Provider.provider.devInspectTransactionBlock({
45
- sender,
46
- transactionBlock: tx,
41
+ this.Provider.provider.dryRunTransactionBlock({
42
+ transactionBlock: yield tx.build({
43
+ provider: this.Provider.provider,
44
+ }),
47
45
  }),
48
46
  this.Provider.provider.getReferenceGasPrice(),
49
47
  ]);
@@ -0,0 +1,14 @@
1
+ import { CoinType } from "../../packages/coin/coinTypes";
2
+ import { Caller } from "../utils/caller";
3
+ import { CoinHistoricalData } from "./historicalDataTypes";
4
+ import { CoinGeckoCoinData } from "../prices/coingecko/coinGeckoTypes";
5
+ export declare class HistoricalData extends Caller {
6
+ readonly network?: string | undefined;
7
+ constructor(network?: string | undefined);
8
+ getSupportedCoins(): Promise<CoinType[]>;
9
+ getAllCoinData(): Promise<Record<CoinType, CoinGeckoCoinData>>;
10
+ getCoinHistoricalData(inputs: {
11
+ coin: CoinType;
12
+ }): Promise<CoinHistoricalData>;
13
+ }
14
+ //# sourceMappingURL=historicalData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"historicalData.d.ts","sourceRoot":"","sources":["../../../src/general/historicalData/historicalData.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAEvE,qBAAa,cAAe,SAAQ,MAAM;aAKb,OAAO,CAAC;gBAAR,OAAO,CAAC,oBAAkB;IAQzC,iBAAiB,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAIxC,cAAc,IAAI,OAAO,CACrC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CACnC;IAIY,qBAAqB,CAAC,MAAM,EAAE;QAC1C,IAAI,EAAE,QAAQ,CAAC;KACf,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAG/B"}
@@ -0,0 +1,41 @@
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.HistoricalData = void 0;
13
+ const caller_1 = require("../utils/caller");
14
+ class HistoricalData extends caller_1.Caller {
15
+ /////////////////////////////////////////////////////////////////////
16
+ //// Constructor
17
+ /////////////////////////////////////////////////////////////////////
18
+ constructor(network) {
19
+ super(network, "historical-data");
20
+ this.network = network;
21
+ }
22
+ /////////////////////////////////////////////////////////////////////
23
+ //// Historical Data
24
+ /////////////////////////////////////////////////////////////////////
25
+ getSupportedCoins() {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ return this.fetchApi("supported-coins");
28
+ });
29
+ }
30
+ getAllCoinData() {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ return this.fetchApi("coins-data");
33
+ });
34
+ }
35
+ getCoinHistoricalData(inputs) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ return this.fetchApi(inputs.coin);
38
+ });
39
+ }
40
+ }
41
+ exports.HistoricalData = HistoricalData;
@@ -0,0 +1,10 @@
1
+ export declare class HistoricalDataApi {
2
+ private readonly coinGeckoApiKey;
3
+ constructor(coinGeckoApiKey: string);
4
+ fetchAllCoinData: () => Promise<Record<string, import("../prices/coingecko/coinGeckoTypes").CoinGeckoCoinData>>;
5
+ fetchHistoricalData: (inputs: {
6
+ coinApiId: string;
7
+ daysAgo: number;
8
+ }) => Promise<import("./historicalDataTypes").CoinHistoricalData>;
9
+ }
10
+ //# sourceMappingURL=historicalDataApi.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HistoricalDataApi = void 0;
4
+ const coinGeckoApiHelpers_1 = require("../prices/coingecko/coinGeckoApiHelpers");
5
+ class HistoricalDataApi {
6
+ /////////////////////////////////////////////////////////////////////
7
+ //// Constructor
8
+ /////////////////////////////////////////////////////////////////////
9
+ constructor(coinGeckoApiKey) {
10
+ this.coinGeckoApiKey = coinGeckoApiKey;
11
+ /////////////////////////////////////////////////////////////////////
12
+ //// Public
13
+ /////////////////////////////////////////////////////////////////////
14
+ this.fetchAllCoinData = new coinGeckoApiHelpers_1.CoinGeckoApiHelpers(this.coinGeckoApiKey)
15
+ .fetchAllCoinData;
16
+ this.fetchHistoricalData = new coinGeckoApiHelpers_1.CoinGeckoApiHelpers(this.coinGeckoApiKey)
17
+ .fetchHistoricalData;
18
+ }
19
+ }
20
+ exports.HistoricalDataApi = HistoricalDataApi;
@@ -0,0 +1,10 @@
1
+ import { OpUnitType, QUnitType } from "dayjs";
2
+ export type CoinHistoricalDataPoint = [timestamp: number, value: number];
3
+ export interface CoinHistoricalData {
4
+ prices: CoinHistoricalDataPoint[];
5
+ marketCaps: CoinHistoricalDataPoint[];
6
+ volumes24Hours: CoinHistoricalDataPoint[];
7
+ time: number;
8
+ timeUnit: QUnitType | OpUnitType;
9
+ }
10
+ //# sourceMappingURL=historicalDataTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"historicalDataTypes.d.ts","sourceRoot":"","sources":["../../../src/general/historicalData/historicalDataTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAM9C,MAAM,MAAM,uBAAuB,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAEzE,MAAM,WAAW,kBAAkB;IAClC,MAAM,EAAE,uBAAuB,EAAE,CAAC;IAClC,UAAU,EAAE,uBAAuB,EAAE,CAAC;IACtC,cAAc,EAAE,uBAAuB,EAAE,CAAC;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,GAAG,UAAU,CAAC;CACjC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ import { CoinPriceInfo, CoinType } from "../../../types";
2
+ import { CoinHistoricalData } from "../../historicalData/historicalDataTypes";
3
+ import { CoinGeckoCoinApiId, CoinGeckoCoinData } from "./coinGeckoTypes";
4
+ export declare class CoinGeckoApiHelpers {
5
+ private readonly coinGeckoApiKey;
6
+ constructor(coinGeckoApiKey: string);
7
+ fetchAllCoinData: () => Promise<Record<CoinType, CoinGeckoCoinData>>;
8
+ fetchHistoricalData: (inputs: {
9
+ coinApiId: CoinGeckoCoinApiId;
10
+ daysAgo: number;
11
+ }) => Promise<CoinHistoricalData>;
12
+ fetchCoinsToPriceInfo: (inputs: {
13
+ coinsToApiId: Record<CoinType, CoinGeckoCoinApiId>;
14
+ }) => Promise<Record<CoinType, CoinPriceInfo>>;
15
+ private callApi;
16
+ }
17
+ //# sourceMappingURL=coinGeckoApiHelpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coinGeckoApiHelpers.d.ts","sourceRoot":"","sources":["../../../../src/general/prices/coingecko/coinGeckoApiHelpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAE9E,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAEzE,qBAAa,mBAAmB;IAKnB,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,MAAM;IAU7C,gBAAgB,QAAa,QACnC,OAAO,QAAQ,EAAE,iBAAiB,CAAC,CACnC,CA2CC;IAMK,mBAAmB,WAAkB;QAC3C,SAAS,EAAE,kBAAkB,CAAC;QAC9B,OAAO,EAAE,MAAM,CAAC;KAChB,KAAG,QAAQ,kBAAkB,CAAC,CAkB7B;IAMK,qBAAqB,WAAkB;QAC7C,YAAY,EAAE,OAAO,QAAQ,EAAE,kBAAkB,CAAC,CAAC;KACnD,KAAG,QAAQ,OAAO,QAAQ,EAAE,aAAa,CAAC,CAAC,CAsC1C;IAUF,OAAO,CAAC,OAAO,CAeb;CACF"}
@@ -0,0 +1,111 @@
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.CoinGeckoApiHelpers = void 0;
13
+ const packages_1 = require("../../../packages");
14
+ const utils_1 = require("../../utils");
15
+ class CoinGeckoApiHelpers {
16
+ /////////////////////////////////////////////////////////////////////
17
+ //// Constructor
18
+ /////////////////////////////////////////////////////////////////////
19
+ constructor(coinGeckoApiKey) {
20
+ this.coinGeckoApiKey = coinGeckoApiKey;
21
+ /////////////////////////////////////////////////////////////////////
22
+ //// Public
23
+ /////////////////////////////////////////////////////////////////////
24
+ /////////////////////////////////////////////////////////////////////
25
+ //// Coin Data
26
+ /////////////////////////////////////////////////////////////////////
27
+ this.fetchAllCoinData = () => __awaiter(this, void 0, void 0, function* () {
28
+ const coinData = yield this.callApi("coins/list?include_platform=true");
29
+ const suiCoinData = coinData
30
+ .filter((data) => "sui" in data.platforms || data.id === "sui")
31
+ .map((data) => {
32
+ const coinType = data.id === "sui"
33
+ ? packages_1.Coin.constants.suiCoinType
34
+ : data.platforms.sui;
35
+ try {
36
+ if (!coinType)
37
+ throw new Error("no coin type found");
38
+ return {
39
+ apiId: data.id,
40
+ name: data.name,
41
+ symbol: data.symbol,
42
+ coinType: utils_1.Helpers.addLeadingZeroesToType(coinType),
43
+ };
44
+ }
45
+ catch (e) {
46
+ return undefined;
47
+ }
48
+ })
49
+ .filter((data) => data !== undefined);
50
+ const coinDataObject = suiCoinData.reduce((acc, data) => {
51
+ return Object.assign({ [data.coinType]: data }, acc);
52
+ }, {});
53
+ return coinDataObject;
54
+ });
55
+ /////////////////////////////////////////////////////////////////////
56
+ //// Historical Data
57
+ /////////////////////////////////////////////////////////////////////
58
+ this.fetchHistoricalData = (inputs) => __awaiter(this, void 0, void 0, function* () {
59
+ const { coinApiId, daysAgo } = inputs;
60
+ const allData = yield this.callApi(`coins/${coinApiId}/market_chart?vs_currency=USD&days=${daysAgo}`);
61
+ const formattedData = {
62
+ prices: allData.prices,
63
+ marketCaps: allData.market_caps,
64
+ volumes24Hours: allData.total_volumes,
65
+ time: inputs.daysAgo,
66
+ timeUnit: "D",
67
+ };
68
+ return formattedData;
69
+ });
70
+ /////////////////////////////////////////////////////////////////////
71
+ //// Current Prices
72
+ /////////////////////////////////////////////////////////////////////
73
+ this.fetchCoinsToPriceInfo = (inputs) => __awaiter(this, void 0, void 0, function* () {
74
+ const { coinsToApiId } = inputs;
75
+ if (Object.keys(coinsToApiId).length <= 0)
76
+ return {};
77
+ const rawCoinsInfo = yield this.callApi(`simple/price?ids=${Object.values(coinsToApiId).reduce((acc, apiId) => `${acc},${apiId}`, "")}&vs_currencies=USD&include_24hr_change=true&precision=full`);
78
+ const coinsInfo = Object.entries(coinsToApiId).reduce((acc, [coinType, coinApiId]) => {
79
+ var _a, _b;
80
+ const info = (_a = Object.entries(rawCoinsInfo).find(([id]) => id === coinApiId)) === null || _a === void 0 ? void 0 : _a[1];
81
+ if (!info)
82
+ throw new Error(`coin type: '${coinType}' not found for coingecko coin api id: '${coinApiId}'`);
83
+ return Object.assign(Object.assign({}, acc), { [coinType]: {
84
+ price: (_b = info.usd) !== null && _b !== void 0 ? _b : -1,
85
+ priceChange24HoursPercentage: info.usd_24h_change === undefined
86
+ ? 0
87
+ : info.usd_24h_change / 100,
88
+ } });
89
+ }, {});
90
+ return coinsInfo;
91
+ });
92
+ /////////////////////////////////////////////////////////////////////
93
+ //// Private
94
+ /////////////////////////////////////////////////////////////////////
95
+ /////////////////////////////////////////////////////////////////////
96
+ //// Helpers
97
+ /////////////////////////////////////////////////////////////////////
98
+ this.callApi = (endpoint) => __awaiter(this, void 0, void 0, function* () {
99
+ const someJson = yield (yield fetch("https://pro-api.coingecko.com/api/v3/" +
100
+ (endpoint[0] === "/"
101
+ ? endpoint.replace("/", "")
102
+ : endpoint) +
103
+ (this.coinGeckoApiKey === ""
104
+ ? ""
105
+ : `&x_cg_pro_api_key=${this.coinGeckoApiKey}`))).json();
106
+ const castedRes = someJson;
107
+ return castedRes;
108
+ });
109
+ }
110
+ }
111
+ exports.CoinGeckoApiHelpers = CoinGeckoApiHelpers;
@@ -0,0 +1,19 @@
1
+ import { CoinType } from "../../../types";
2
+ import { PricesApiInterface } from "../pricesApiInterface";
3
+ import { CoinGeckoApiHelpers } from "./coinGeckoApiHelpers";
4
+ import { CoinGeckoCoinApiId } from "./coinGeckoTypes";
5
+ export declare class CoinGeckoPricesApi extends CoinGeckoApiHelpers implements PricesApiInterface {
6
+ constructor(coinGeckoApiKey: string);
7
+ fetchPrice: (coin: string) => Promise<number>;
8
+ fetchCoinsToPrice: (coins: CoinType[]) => Promise<{
9
+ [x: string]: number;
10
+ }>;
11
+ fetchPriceGivenApiId: (inputs: {
12
+ coinType: CoinType;
13
+ coinApiId: CoinGeckoCoinApiId;
14
+ }) => Promise<number>;
15
+ fetchCoinsToPriceGivenApiIds: (inputs: {
16
+ coinsToApiId: Record<CoinType, CoinGeckoCoinApiId>;
17
+ }) => Promise<Record<CoinType, number>>;
18
+ }
19
+ //# sourceMappingURL=coinGeckoPricesApi.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,63 @@
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.CoinGeckoPricesApi = void 0;
13
+ const utils_1 = require("../../utils");
14
+ const coinGeckoApiHelpers_1 = require("./coinGeckoApiHelpers");
15
+ class CoinGeckoPricesApi extends coinGeckoApiHelpers_1.CoinGeckoApiHelpers {
16
+ /////////////////////////////////////////////////////////////////////
17
+ //// Constructor
18
+ /////////////////////////////////////////////////////////////////////
19
+ constructor(coinGeckoApiKey) {
20
+ super(coinGeckoApiKey);
21
+ /////////////////////////////////////////////////////////////////////
22
+ //// Fetching
23
+ /////////////////////////////////////////////////////////////////////
24
+ /////////////////////////////////////////////////////////////////////
25
+ //// Public
26
+ /////////////////////////////////////////////////////////////////////
27
+ /////////////////////////////////////////////////////////////////////
28
+ //// Interface Methods
29
+ /////////////////////////////////////////////////////////////////////
30
+ this.fetchPrice = (coin) => __awaiter(this, void 0, void 0, function* () {
31
+ return Object.values(yield this.fetchCoinsToPrice([coin]))[0];
32
+ });
33
+ this.fetchCoinsToPrice = (coins) => __awaiter(this, void 0, void 0, function* () {
34
+ const allCoinsData = yield this.fetchAllCoinData();
35
+ const onlyInputCoinsData = utils_1.Helpers.filterObject(allCoinsData, (coin) => coins
36
+ .map(utils_1.Helpers.addLeadingZeroesToType)
37
+ .includes(utils_1.Helpers.addLeadingZeroesToType(coin)));
38
+ const coinsToApiId = Object.entries(onlyInputCoinsData).reduce((acc, [coinType, data]) => (Object.assign(Object.assign({}, acc), { [coinType]: data.apiId })), {});
39
+ const coinsToPrice = yield this.fetchCoinsToPriceGivenApiIds({
40
+ coinsToApiId,
41
+ });
42
+ const missingCoinsToPrice = coins.reduce((acc, coin) => utils_1.Helpers.addLeadingZeroesToType(coin) in coinsToPrice
43
+ ? acc
44
+ : Object.assign(Object.assign({}, acc), { [utils_1.Helpers.addLeadingZeroesToType(coin)]: -1 }), {});
45
+ return Object.assign(Object.assign({}, missingCoinsToPrice), coinsToPrice);
46
+ });
47
+ /////////////////////////////////////////////////////////////////////
48
+ //// Non-Interface Methods
49
+ /////////////////////////////////////////////////////////////////////
50
+ this.fetchPriceGivenApiId = (inputs) => __awaiter(this, void 0, void 0, function* () {
51
+ const priceInfo = yield this.fetchCoinsToPriceInfo({
52
+ coinsToApiId: { [inputs.coinType]: inputs.coinApiId },
53
+ });
54
+ return Object.values(priceInfo)[0].price;
55
+ });
56
+ this.fetchCoinsToPriceGivenApiIds = (inputs) => __awaiter(this, void 0, void 0, function* () {
57
+ const coinsToPriceInfo = yield this.fetchCoinsToPriceInfo(inputs);
58
+ const coinsToPrice = Object.entries(coinsToPriceInfo).reduce((acc, [coinType, info]) => (Object.assign(Object.assign({}, acc), { [coinType]: info.price })), {});
59
+ return coinsToPrice;
60
+ });
61
+ }
62
+ }
63
+ exports.CoinGeckoPricesApi = CoinGeckoPricesApi;
@@ -0,0 +1,9 @@
1
+ import { CoinSymbol, CoinType } from "../../../types";
2
+ export type CoinGeckoCoinApiId = string;
3
+ export interface CoinGeckoCoinData {
4
+ apiId: CoinGeckoCoinApiId;
5
+ name: string;
6
+ symbol: CoinSymbol;
7
+ coinType: CoinType;
8
+ }
9
+ //# sourceMappingURL=coinGeckoTypes.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +1,14 @@
1
- import { CoinType, CoinsToPrice } from "../../packages/coin/coinTypes";
1
+ import { CoinPriceInfo, CoinType, CoinsToPrice, CoinsToPriceInfo } from "../../packages/coin/coinTypes";
2
2
  import { Caller } from "../utils/caller";
3
3
  export declare class Prices extends Caller {
4
4
  readonly network?: string | undefined;
5
5
  constructor(network?: string | undefined);
6
+ getCoinPriceInfo(inputs: {
7
+ coin: CoinType;
8
+ }): Promise<CoinPriceInfo>;
9
+ getCoinsToPriceInfo(inputs: {
10
+ coins: CoinType[];
11
+ }): Promise<CoinsToPriceInfo>;
6
12
  getCoinPrice(inputs: {
7
13
  coin: CoinType;
8
14
  }): Promise<number>;
@@ -1 +1 @@
1
- {"version":3,"file":"prices.d.ts","sourceRoot":"","sources":["../../../src/general/prices/prices.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC,qBAAa,MAAO,SAAQ,MAAM;aAKL,OAAO,CAAC;gBAAR,OAAO,CAAC,oBAAkB;IAQzC,YAAY,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAOzD,eAAe,CAAC,MAAM,EAAE;QACpC,KAAK,EAAE,QAAQ,EAAE,CAAC;KAClB,GAAG,OAAO,CAAC,YAAY,CAAC;CAGzB"}
1
+ {"version":3,"file":"prices.d.ts","sourceRoot":"","sources":["../../../src/general/prices/prices.ts"],"names":[],"mappings":"AACA,OAAO,EACN,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC,qBAAa,MAAO,SAAQ,MAAM;aAKL,OAAO,CAAC;gBAAR,OAAO,CAAC,oBAAkB;IAQzC,gBAAgB,CAAC,MAAM,EAAE;QACrC,IAAI,EAAE,QAAQ,CAAC;KACf,GAAG,OAAO,CAAC,aAAa,CAAC;IAOb,mBAAmB,CAAC,MAAM,EAAE;QACxC,KAAK,EAAE,QAAQ,EAAE,CAAC;KAClB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIhB,YAAY,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAKzD,eAAe,CAAC,MAAM,EAAE;QACpC,KAAK,EAAE,QAAQ,EAAE,CAAC;KAClB,GAAG,OAAO,CAAC,YAAY,CAAC;CAazB"}
@@ -16,24 +16,37 @@ class Prices extends caller_1.Caller {
16
16
  //// Constructor
17
17
  /////////////////////////////////////////////////////////////////////
18
18
  constructor(network) {
19
- super(network, "prices");
19
+ super(network, "price-info");
20
20
  this.network = network;
21
21
  }
22
22
  /////////////////////////////////////////////////////////////////////
23
23
  //// Prices
24
24
  /////////////////////////////////////////////////////////////////////
25
- getCoinPrice(inputs) {
25
+ getCoinPriceInfo(inputs) {
26
26
  return __awaiter(this, void 0, void 0, function* () {
27
- const coinsToPrice = yield this.getCoinsToPrice({
27
+ const coinsToPriceInfo = yield this.getCoinsToPriceInfo({
28
28
  coins: [inputs.coin],
29
29
  });
30
- return Object.values(coinsToPrice)[0];
30
+ return Object.values(coinsToPriceInfo)[0];
31
31
  });
32
32
  }
33
- getCoinsToPrice(inputs) {
33
+ getCoinsToPriceInfo(inputs) {
34
34
  return __awaiter(this, void 0, void 0, function* () {
35
35
  return this.fetchApi(JSON.stringify(inputs.coins));
36
36
  });
37
37
  }
38
+ getCoinPrice(inputs) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ const priceInfo = yield this.getCoinPriceInfo(inputs);
41
+ return priceInfo.price;
42
+ });
43
+ }
44
+ getCoinsToPrice(inputs) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ const coinsToPriceInfo = yield this.getCoinsToPriceInfo(inputs);
47
+ const coinsToPrice = Object.entries(coinsToPriceInfo).reduce((acc, [coinType, info]) => (Object.assign(Object.assign({}, acc), { [coinType]: info.price })), {});
48
+ return coinsToPrice;
49
+ });
50
+ }
38
51
  }
39
52
  exports.Prices = Prices;
@@ -1,9 +1,8 @@
1
1
  import { CoinSymbolToCoinTypes, CoinType } from "../../../types";
2
- import { AftermathApi } from "../../providers/aftermathApi";
3
2
  import { PricesApiInterface } from "../pricesApiInterface";
4
3
  import { PythPricesApiHelpers } from "./pythPricesApiHelpers";
5
4
  export declare class PythPricesApi extends PythPricesApiHelpers implements PricesApiInterface {
6
- constructor(Provider: AftermathApi, coinSymbolToCoinTypes: CoinSymbolToCoinTypes);
5
+ constructor(coinSymbolToCoinTypes: CoinSymbolToCoinTypes);
7
6
  fetchPrice: (coin: CoinType) => Promise<number>;
8
7
  fetchCoinsToPrice: (coins: CoinType[]) => Promise<Record<string, number>>;
9
8
  private fetchPrices;
@@ -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,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,qBAAa,aACZ,SAAQ,oBACR,YAAW,kBAAkB;gBAO5B,QAAQ,EAAE,YAAY,EACtB,qBAAqB,EAAE,qBAAqB;IAatC,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":"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"}
@@ -15,8 +15,8 @@ class PythPricesApi extends pythPricesApiHelpers_1.PythPricesApiHelpers {
15
15
  /////////////////////////////////////////////////////////////////////
16
16
  //// Constructor
17
17
  /////////////////////////////////////////////////////////////////////
18
- constructor(Provider, coinSymbolToCoinTypes) {
19
- super(Provider, coinSymbolToCoinTypes);
18
+ constructor(coinSymbolToCoinTypes) {
19
+ super(coinSymbolToCoinTypes);
20
20
  /////////////////////////////////////////////////////////////////////
21
21
  //// Fetching
22
22
  /////////////////////////////////////////////////////////////////////
@@ -1,15 +1,13 @@
1
- import { AftermathApi } from "../../providers/aftermathApi";
2
1
  import { CoinSymbol, CoinSymbolToCoinTypes, CoinType, UniqueId, Url } from "../../../types";
3
2
  import { EvmPriceServiceConnection } from "@pythnetwork/pyth-evm-js";
4
3
  export declare class PythPricesApiHelpers {
5
- private readonly Provider;
6
4
  private readonly coinSymbolToCoinTypes;
7
5
  static readonly constants: {
8
6
  priceFeedsEndpoint: Url;
9
7
  priceFeedIds: Record<CoinSymbol, UniqueId>;
10
8
  };
11
9
  protected readonly connection: EvmPriceServiceConnection;
12
- constructor(Provider: AftermathApi, coinSymbolToCoinTypes: CoinSymbolToCoinTypes);
10
+ constructor(coinSymbolToCoinTypes: CoinSymbolToCoinTypes);
13
11
  protected fetchPriceFeeds: (coins: CoinType[]) => Promise<(import("@pythnetwork/price-service-sdk").Price | undefined)[]>;
14
12
  }
15
13
  //# sourceMappingURL=pythPricesApiHelpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pythPricesApiHelpers.d.ts","sourceRoot":"","sources":["../../../../src/general/prices/pyth/pythPricesApiHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EACN,UAAU,EACV,qBAAqB,EACrB,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAIrE,qBAAa,oBAAoB;IAqC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IAjCvC,gBAAuB,SAAS,EAAE;QACjC,kBAAkB,EAAE,GAAG,CAAC;QACxB,YAAY,EAAE,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;KAC3C,CAgBC;IAMF,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,yBAAyB,CAAC;gBAOvC,QAAQ,EAAE,YAAY,EACtB,qBAAqB,EAAE,qBAAqB;IAkB9D,SAAS,CAAC,eAAe,UAAiB,QAAQ,EAAE,6EAmClD;CACF"}
1
+ {"version":3,"file":"pythPricesApiHelpers.d.ts","sourceRoot":"","sources":["../../../../src/general/prices/pyth/pythPricesApiHelpers.ts"],"names":[],"mappings":"AACA,OAAO,EACN,UAAU,EACV,qBAAqB,EACrB,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAIrE,qBAAa,oBAAoB;IAoCpB,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IA/BlD,gBAAuB,SAAS,EAAE;QACjC,kBAAkB,EAAE,GAAG,CAAC;QACxB,YAAY,EAAE,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;KAC3C,CAgBC;IAMF,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,yBAAyB,CAAC;gBAM5B,qBAAqB,EAAE,qBAAqB;IAgBzE,SAAS,CAAC,eAAe,UAAiB,QAAQ,EAAE,6EAmClD;CACF"}
@@ -16,8 +16,7 @@ class PythPricesApiHelpers {
16
16
  /////////////////////////////////////////////////////////////////////
17
17
  //// Constructor
18
18
  /////////////////////////////////////////////////////////////////////
19
- constructor(Provider, coinSymbolToCoinTypes) {
20
- this.Provider = Provider;
19
+ constructor(coinSymbolToCoinTypes) {
21
20
  this.coinSymbolToCoinTypes = coinSymbolToCoinTypes;
22
21
  /////////////////////////////////////////////////////////////////////
23
22
  //// Protected Methods
@@ -48,7 +47,6 @@ class PythPricesApiHelpers {
48
47
  });
49
48
  return priceFeeds;
50
49
  });
51
- this.Provider = Provider;
52
50
  this.coinSymbolToCoinTypes = coinSymbolToCoinTypes;
53
51
  this.connection = new pyth_evm_js_1.EvmPriceServiceConnection(PythPricesApiHelpers.constants.priceFeedsEndpoint);
54
52
  }
@@ -11,6 +11,7 @@ import { Casting } from "../utils/casting";
11
11
  import { Caller } from "../utils/caller";
12
12
  import { Prices } from "../prices/prices";
13
13
  import { NftAmm, ReferralVault, Router, Sui } from "../../packages";
14
+ import { HistoricalData } from "../historicalData/historicalData";
14
15
  /**
15
16
  * @class Aftermath Provider
16
17
  *
@@ -45,7 +46,8 @@ export declare class Aftermath extends Caller {
45
46
  Sui: () => Sui;
46
47
  Prices: () => Prices;
47
48
  Wallet: (address: SuiAddress) => Wallet;
48
- Coin: (coinType: CoinType) => Coin;
49
+ Coin: (coinType?: CoinType) => Coin;
50
+ HistoricalData: () => HistoricalData;
49
51
  static helpers: typeof Helpers;
50
52
  static casting: typeof Casting;
51
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"aftermath.d.ts","sourceRoot":"","sources":["../../../src/general/providers/aftermath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAEpE;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,SAAU,SAAQ,MAAM;IAKpC;;;;;OAKG;gBACS,OAAO,CAAC,EAAE,UAAU,GAAG,GAAG;IAgB/B,KAAK,cAAiC;IACtC,OAAO,gBAAmC;IAC1C,KAAK,cAAiC;IACtC,MAAM,eAAkC;IACxC,MAAM,eAAkC;IACxC,MAAM,eAAkC;IACxC,aAAa,sBAAyC;IAMtD,GAAG,YAA+B;IAClC,MAAM,eAAkC;IACxC,MAAM,YAAa,UAAU,YAAuC;IACpE,IAAI,aAAc,QAAQ,UAAsC;IAMvE,OAAc,OAAO,iBAAW;IAChC,OAAc,OAAO,iBAAW;CAChC"}
1
+ {"version":3,"file":"aftermath.d.ts","sourceRoot":"","sources":["../../../src/general/providers/aftermath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAElE;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,SAAU,SAAQ,MAAM;IAKpC;;;;;OAKG;gBACS,OAAO,CAAC,EAAE,UAAU,GAAG,GAAG;IAgB/B,KAAK,cAAiC;IACtC,OAAO,gBAAmC;IAC1C,KAAK,cAAiC;IACtC,MAAM,eAAkC;IACxC,MAAM,eAAkC;IACxC,MAAM,eAAkC;IACxC,aAAa,sBAAyC;IAMtD,GAAG,YAA+B;IAClC,MAAM,eAAkC;IACxC,MAAM,YAAa,UAAU,YAAuC;IACpE,IAAI,cAAe,QAAQ,UAAsC;IACjE,cAAc,uBAA0C;IAM/D,OAAc,OAAO,iBAAW;IAChC,OAAc,OAAO,iBAAW;CAChC"}
@@ -12,6 +12,7 @@ const casting_1 = require("../utils/casting");
12
12
  const caller_1 = require("../utils/caller");
13
13
  const prices_1 = require("../prices/prices");
14
14
  const packages_1 = require("../../packages");
15
+ const historicalData_1 = require("../historicalData/historicalData");
15
16
  /**
16
17
  * @class Aftermath Provider
17
18
  *
@@ -63,6 +64,7 @@ class Aftermath extends caller_1.Caller {
63
64
  this.Prices = () => new prices_1.Prices(this.network);
64
65
  this.Wallet = (address) => new wallet_1.Wallet(address, this.network);
65
66
  this.Coin = (coinType) => new coin_1.Coin(coinType, this.network);
67
+ this.HistoricalData = () => new historicalData_1.HistoricalData(this.network);
66
68
  }
67
69
  }
68
70
  exports.Aftermath = Aftermath;