@sentio/sdk 1.30.0 → 1.30.1

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.
@@ -26,15 +26,16 @@ module.exports = {
26
26
  mode: 'production',
27
27
  externals: [
28
28
  {
29
+ protobufjs: 'commonjs2 protobufjs',
29
30
  aptos: 'commonjs2 aptos-sdk',
30
31
  ethers: 'commonjs2 ethers',
31
32
  bs58: 'commonjs2 bs58',
32
33
  "bignumber.js": 'commonjs2 bignumber.js',
33
34
  'bn.js': 'commonjs2 bn.js',
34
- 'csv-parse': 'commonjs2 csv-parse'
35
+ 'csv-parse': 'commonjs2 csv-parse',
35
36
  },
36
37
  function ({ context, request }, callback) {
37
- if (/^@(ethersproject|solana|project-serum).*$/.test(request)) {
38
+ if (/^@(ethersproject|solana|project-serum|nice-grpc).*$/.test(request)) {
38
39
  return callback(null, 'commonjs ' + request)
39
40
  }
40
41
  if (request.startsWith("@sentio/sdk")) {
@@ -1,5 +1,42 @@
1
- import { PriceServiceClient } from '../gen/service/price/protos/price';
2
- export declare function getPriceClient(address?: string): PriceServiceClient;
1
+ import { RetryOptions } from 'nice-grpc-client-middleware-retry';
2
+ export declare function getPriceClient(address?: string): import("nice-grpc").RawClient<import("nice-grpc/lib/service-definitions/ts-proto").FromTsProtoServiceDefinition<{
3
+ readonly name: "PriceService";
4
+ readonly fullName: "price_service.PriceService";
5
+ readonly methods: {
6
+ readonly getPrice: {
7
+ readonly name: "GetPrice";
8
+ readonly requestType: {
9
+ encode(message: import("../gen/service/price/protos/price").GetPriceRequest, writer?: import("protobufjs").Writer): import("protobufjs").Writer;
10
+ decode(input: Uint8Array | import("protobufjs").Reader, length?: number | undefined): import("../gen/service/price/protos/price").GetPriceRequest;
11
+ fromJSON(object: any): import("../gen/service/price/protos/price").GetPriceRequest;
12
+ toJSON(message: import("../gen/service/price/protos/price").GetPriceRequest): unknown;
13
+ fromPartial(object: {
14
+ timestamp?: Date | undefined;
15
+ coinId?: {
16
+ symbol?: string | undefined;
17
+ address?: {
18
+ address?: string | undefined;
19
+ chain?: string | undefined;
20
+ } | undefined;
21
+ } | undefined;
22
+ }): import("../gen/service/price/protos/price").GetPriceRequest;
23
+ };
24
+ readonly requestStream: false;
25
+ readonly responseType: {
26
+ encode(message: import("../gen/service/price/protos/price").GetPriceResponse, writer?: import("protobufjs").Writer): import("protobufjs").Writer;
27
+ decode(input: Uint8Array | import("protobufjs").Reader, length?: number | undefined): import("../gen/service/price/protos/price").GetPriceResponse;
28
+ fromJSON(object: any): import("../gen/service/price/protos/price").GetPriceResponse;
29
+ toJSON(message: import("../gen/service/price/protos/price").GetPriceResponse): unknown;
30
+ fromPartial(object: {
31
+ price?: number | undefined;
32
+ timestamp?: Date | undefined;
33
+ }): import("../gen/service/price/protos/price").GetPriceResponse;
34
+ };
35
+ readonly responseStream: false;
36
+ readonly options: {};
37
+ };
38
+ };
39
+ }>, RetryOptions>;
3
40
  /**
4
41
  *
5
42
  * @param chainId chain id refers to CHAIN_MAP
@@ -7,4 +44,9 @@ export declare function getPriceClient(address?: string): PriceServiceClient;
7
44
  * @param date
8
45
  */
9
46
  export declare function getPriceByType(chainId: string, coinType: string, date: Date): Promise<number>;
10
- export declare function delay(ms: number): Promise<unknown>;
47
+ /**
48
+ *
49
+ * @param symbol token symbol like BTC, etc
50
+ * @param date
51
+ */
52
+ export declare function getPriceBySymbol(symbol: string, date: Date): Promise<number>;
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.delay = exports.getPriceByType = exports.getPriceClient = void 0;
3
+ exports.getPriceBySymbol = exports.getPriceByType = exports.getPriceClient = void 0;
4
4
  const price_1 = require("../gen/service/price/protos/price");
5
5
  const nice_grpc_1 = require("nice-grpc");
6
+ const nice_grpc_client_middleware_retry_1 = require("nice-grpc-client-middleware-retry");
6
7
  function getPriceClient(address) {
7
8
  if (!address) {
8
9
  address = global.ENDPOINTS.priceFeedAPI;
9
10
  }
10
11
  const channel = (0, nice_grpc_1.createChannel)(address);
11
- return (0, nice_grpc_1.createClient)(price_1.PriceServiceDefinition, channel);
12
+ return (0, nice_grpc_1.createClientFactory)().use(nice_grpc_client_middleware_retry_1.retryMiddleware).create(price_1.PriceServiceDefinition, channel);
12
13
  }
13
14
  exports.getPriceClient = getPriceClient;
14
15
  const priceMap = new Map();
@@ -25,35 +26,54 @@ async function getPriceByType(chainId, coinType, date) {
25
26
  }
26
27
  const dateStr = [date.getUTCDate(), date.getUTCMonth() + 1, date.getUTCFullYear()].join('-');
27
28
  const key = `${coinType}-${dateStr}`;
28
- const price = priceMap.get(key);
29
+ let price = priceMap.get(key);
29
30
  if (price) {
30
31
  return price;
31
32
  }
32
- /*eslint no-constant-condition: ["error", { "checkLoops": false }]*/
33
- while (true) {
34
- try {
35
- const response = await priceClient.getPrice({
36
- timestamp: date,
37
- coinId: {
38
- address: {
39
- chain: chainId,
40
- address: coinType,
41
- },
42
- },
43
- });
44
- const price = response.price;
45
- priceMap.set(key, price);
46
- return price;
47
- }
48
- catch (e) {
49
- console.log('error getting price', e, dateStr, coinType);
50
- await delay(1000);
51
- }
52
- }
33
+ const response = await priceClient.getPrice({
34
+ timestamp: date,
35
+ coinId: {
36
+ address: {
37
+ chain: chainId,
38
+ address: coinType,
39
+ },
40
+ },
41
+ }, {
42
+ retry: true,
43
+ retryMaxAttempts: 8,
44
+ });
45
+ price = response.price;
46
+ priceMap.set(key, price);
47
+ return price;
53
48
  }
54
49
  exports.getPriceByType = getPriceByType;
55
- function delay(ms) {
56
- return new Promise((resolve) => setTimeout(resolve, ms));
50
+ /**
51
+ *
52
+ * @param symbol token symbol like BTC, etc
53
+ * @param date
54
+ */
55
+ async function getPriceBySymbol(symbol, date) {
56
+ if (!priceClient) {
57
+ priceClient = getPriceClient();
58
+ }
59
+ const dateStr = [date.getUTCDate(), date.getUTCMonth() + 1, date.getUTCFullYear()].join('-');
60
+ const key = `${symbol}-${dateStr}`;
61
+ let price = priceMap.get(key);
62
+ if (price) {
63
+ return price;
64
+ }
65
+ const response = await priceClient.getPrice({
66
+ timestamp: date,
67
+ coinId: {
68
+ symbol,
69
+ },
70
+ }, {
71
+ retry: true,
72
+ retryMaxAttempts: 8,
73
+ });
74
+ price = response.price;
75
+ priceMap.set(key, price);
76
+ return price;
57
77
  }
58
- exports.delay = delay;
78
+ exports.getPriceBySymbol = getPriceBySymbol;
59
79
  //# sourceMappingURL=price.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"price.js","sourceRoot":"","sources":["../../src/utils/price.ts"],"names":[],"mappings":";;;AAAA,6DAA8F;AAC9F,yCAAuD;AAEvD,SAAgB,cAAc,CAAC,OAAgB;IAC7C,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,YAAY,CAAA;KACxC;IACD,MAAM,OAAO,GAAG,IAAA,yBAAa,EAAC,OAAO,CAAC,CAAA;IAEtC,OAAO,IAAA,wBAAY,EAAC,8BAAsB,EAAE,OAAO,CAAC,CAAA;AACtD,CAAC;AAPD,wCAOC;AAED,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAA;AAC1C,IAAI,WAA+B,CAAA;AAEnC;;;;;GAKG;AACI,KAAK,UAAU,cAAc,CAAC,OAAe,EAAE,QAAgB,EAAE,IAAU;IAChF,IAAI,CAAC,WAAW,EAAE;QAChB,WAAW,GAAG,cAAc,EAAE,CAAA;KAC/B;IAED,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC5F,MAAM,GAAG,GAAG,GAAG,QAAQ,IAAI,OAAO,EAAE,CAAA;IACpC,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC/B,IAAI,KAAK,EAAE;QACT,OAAO,KAAK,CAAA;KACb;IAED,oEAAoE;IACpE,OAAO,IAAI,EAAE;QACX,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC;gBAC1C,SAAS,EAAE,IAAI;gBACf,MAAM,EAAE;oBACN,OAAO,EAAE;wBACP,KAAK,EAAE,OAAO;wBACd,OAAO,EAAE,QAAQ;qBAClB;iBACF;aACF,CAAC,CAAA;YACF,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAA;YAC5B,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;YACxB,OAAO,KAAK,CAAA;SACb;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAA;YACxD,MAAM,KAAK,CAAC,IAAI,CAAC,CAAA;SAClB;KACF;AACH,CAAC;AAhCD,wCAgCC;AAED,SAAgB,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;AAC1D,CAAC;AAFD,sBAEC","sourcesContent":["import { PriceServiceClient, PriceServiceDefinition } from '../gen/service/price/protos/price'\nimport { createChannel, createClient } from 'nice-grpc'\n\nexport function getPriceClient(address?: string): PriceServiceClient {\n if (!address) {\n address = global.ENDPOINTS.priceFeedAPI\n }\n const channel = createChannel(address)\n\n return createClient(PriceServiceDefinition, channel)\n}\n\nconst priceMap = new Map<string, number>()\nlet priceClient: PriceServiceClient\n\n/**\n *\n * @param chainId chain id refers to CHAIN_MAP\n * @param coinType\n * @param date\n */\nexport async function getPriceByType(chainId: string, coinType: string, date: Date): Promise<number> {\n if (!priceClient) {\n priceClient = getPriceClient()\n }\n\n const dateStr = [date.getUTCDate(), date.getUTCMonth() + 1, date.getUTCFullYear()].join('-')\n const key = `${coinType}-${dateStr}`\n const price = priceMap.get(key)\n if (price) {\n return price\n }\n\n /*eslint no-constant-condition: [\"error\", { \"checkLoops\": false }]*/\n while (true) {\n try {\n const response = await priceClient.getPrice({\n timestamp: date,\n coinId: {\n address: {\n chain: chainId,\n address: coinType,\n },\n },\n })\n const price = response.price\n priceMap.set(key, price)\n return price\n } catch (e) {\n console.log('error getting price', e, dateStr, coinType)\n await delay(1000)\n }\n }\n}\n\nexport function delay(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n"]}
1
+ {"version":3,"file":"price.js","sourceRoot":"","sources":["../../src/utils/price.ts"],"names":[],"mappings":";;;AAAA,6DAA8F;AAC9F,yCAA8D;AAC9D,yFAAiF;AAEjF,SAAgB,cAAc,CAAC,OAAgB;IAC7C,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,YAAY,CAAA;KACxC;IACD,MAAM,OAAO,GAAG,IAAA,yBAAa,EAAC,OAAO,CAAC,CAAA;IAEtC,OAAO,IAAA,+BAAmB,GAAE,CAAC,GAAG,CAAC,mDAAe,CAAC,CAAC,MAAM,CAAC,8BAAsB,EAAE,OAAO,CAAC,CAAA;AAC3F,CAAC;AAPD,wCAOC;AAED,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAA;AAC1C,IAAI,WAA6C,CAAA;AAEjD;;;;;GAKG;AACI,KAAK,UAAU,cAAc,CAAC,OAAe,EAAE,QAAgB,EAAE,IAAU;IAChF,IAAI,CAAC,WAAW,EAAE;QAChB,WAAW,GAAG,cAAc,EAAE,CAAA;KAC/B;IAED,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC5F,MAAM,GAAG,GAAG,GAAG,QAAQ,IAAI,OAAO,EAAE,CAAA;IACpC,IAAI,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC7B,IAAI,KAAK,EAAE;QACT,OAAO,KAAK,CAAA;KACb;IAED,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,QAAQ,CACzC;QACE,SAAS,EAAE,IAAI;QACf,MAAM,EAAE;YACN,OAAO,EAAE;gBACP,KAAK,EAAE,OAAO;gBACd,OAAO,EAAE,QAAQ;aAClB;SACF;KACF,EACD;QACE,KAAK,EAAE,IAAI;QACX,gBAAgB,EAAE,CAAC;KACpB,CACF,CAAA;IACD,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAA;IACtB,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACxB,OAAO,KAAK,CAAA;AACd,CAAC;AA9BD,wCA8BC;AAED;;;;GAIG;AACI,KAAK,UAAU,gBAAgB,CAAC,MAAc,EAAE,IAAU;IAC/D,IAAI,CAAC,WAAW,EAAE;QAChB,WAAW,GAAG,cAAc,EAAE,CAAA;KAC/B;IAED,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC5F,MAAM,GAAG,GAAG,GAAG,MAAM,IAAI,OAAO,EAAE,CAAA;IAClC,IAAI,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC7B,IAAI,KAAK,EAAE;QACT,OAAO,KAAK,CAAA;KACb;IAED,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,QAAQ,CACzC;QACE,SAAS,EAAE,IAAI;QACf,MAAM,EAAE;YACN,MAAM;SACP;KACF,EACD;QACE,KAAK,EAAE,IAAI;QACX,gBAAgB,EAAE,CAAC;KACpB,CACF,CAAA;IACD,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAA;IACtB,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACxB,OAAO,KAAK,CAAA;AACd,CAAC;AA3BD,4CA2BC","sourcesContent":["import { PriceServiceClient, PriceServiceDefinition } from '../gen/service/price/protos/price'\nimport { createChannel, createClientFactory } from 'nice-grpc'\nimport { retryMiddleware, RetryOptions } from 'nice-grpc-client-middleware-retry'\n\nexport function getPriceClient(address?: string) {\n if (!address) {\n address = global.ENDPOINTS.priceFeedAPI\n }\n const channel = createChannel(address)\n\n return createClientFactory().use(retryMiddleware).create(PriceServiceDefinition, channel)\n}\n\nconst priceMap = new Map<string, number>()\nlet priceClient: PriceServiceClient<RetryOptions>\n\n/**\n *\n * @param chainId chain id refers to CHAIN_MAP\n * @param coinType\n * @param date\n */\nexport async function getPriceByType(chainId: string, coinType: string, date: Date): Promise<number> {\n if (!priceClient) {\n priceClient = getPriceClient()\n }\n\n const dateStr = [date.getUTCDate(), date.getUTCMonth() + 1, date.getUTCFullYear()].join('-')\n const key = `${coinType}-${dateStr}`\n let price = priceMap.get(key)\n if (price) {\n return price\n }\n\n const response = await priceClient.getPrice(\n {\n timestamp: date,\n coinId: {\n address: {\n chain: chainId,\n address: coinType,\n },\n },\n },\n {\n retry: true,\n retryMaxAttempts: 8,\n }\n )\n price = response.price\n priceMap.set(key, price)\n return price\n}\n\n/**\n *\n * @param symbol token symbol like BTC, etc\n * @param date\n */\nexport async function getPriceBySymbol(symbol: string, date: Date): Promise<number> {\n if (!priceClient) {\n priceClient = getPriceClient()\n }\n\n const dateStr = [date.getUTCDate(), date.getUTCMonth() + 1, date.getUTCFullYear()].join('-')\n const key = `${symbol}-${dateStr}`\n let price = priceMap.get(key)\n if (price) {\n return price\n }\n\n const response = await priceClient.getPrice(\n {\n timestamp: date,\n coinId: {\n symbol,\n },\n },\n {\n retry: true,\n retryMaxAttempts: 8,\n }\n )\n price = response.price\n priceMap.set(key, price)\n return price\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sentio/sdk",
3
3
  "license": "Apache-2.0",
4
- "version": "1.30.0",
4
+ "version": "1.30.1",
5
5
  "scripts": {
6
6
  "compile_target": "yarn tsc -b src/target-ethers-sentio/tsconfig.json",
7
7
  "compile": "tsc -p . && cp src/cli/webpack.config.js lib/cli && cp src/utils/*.csv lib/utils",
@@ -41,6 +41,8 @@
41
41
  "google-protobuf": "^3.15.8",
42
42
  "js-yaml": "^4.1.0",
43
43
  "nice-grpc": "^2.0.0",
44
+ "nice-grpc-client-middleware-retry": "^2.0.1",
45
+ "nice-grpc-error-details": "^0.1.4",
44
46
  "node-fetch": "2",
45
47
  "p-queue": "^6.6.2",
46
48
  "ts-loader": "^9.3.0",
@@ -26,15 +26,16 @@ module.exports = {
26
26
  mode: 'production',
27
27
  externals: [
28
28
  {
29
+ protobufjs: 'commonjs2 protobufjs',
29
30
  aptos: 'commonjs2 aptos-sdk',
30
31
  ethers: 'commonjs2 ethers',
31
32
  bs58: 'commonjs2 bs58',
32
33
  "bignumber.js": 'commonjs2 bignumber.js',
33
34
  'bn.js': 'commonjs2 bn.js',
34
- 'csv-parse': 'commonjs2 csv-parse'
35
+ 'csv-parse': 'commonjs2 csv-parse',
35
36
  },
36
37
  function ({ context, request }, callback) {
37
- if (/^@(ethersproject|solana|project-serum).*$/.test(request)) {
38
+ if (/^@(ethersproject|solana|project-serum|nice-grpc).*$/.test(request)) {
38
39
  return callback(null, 'commonjs ' + request)
39
40
  }
40
41
  if (request.startsWith("@sentio/sdk")) {
@@ -1,17 +1,18 @@
1
1
  import { PriceServiceClient, PriceServiceDefinition } from '../gen/service/price/protos/price'
2
- import { createChannel, createClient } from 'nice-grpc'
2
+ import { createChannel, createClientFactory } from 'nice-grpc'
3
+ import { retryMiddleware, RetryOptions } from 'nice-grpc-client-middleware-retry'
3
4
 
4
- export function getPriceClient(address?: string): PriceServiceClient {
5
+ export function getPriceClient(address?: string) {
5
6
  if (!address) {
6
7
  address = global.ENDPOINTS.priceFeedAPI
7
8
  }
8
9
  const channel = createChannel(address)
9
10
 
10
- return createClient(PriceServiceDefinition, channel)
11
+ return createClientFactory().use(retryMiddleware).create(PriceServiceDefinition, channel)
11
12
  }
12
13
 
13
14
  const priceMap = new Map<string, number>()
14
- let priceClient: PriceServiceClient
15
+ let priceClient: PriceServiceClient<RetryOptions>
15
16
 
16
17
  /**
17
18
  *
@@ -26,33 +27,61 @@ export async function getPriceByType(chainId: string, coinType: string, date: Da
26
27
 
27
28
  const dateStr = [date.getUTCDate(), date.getUTCMonth() + 1, date.getUTCFullYear()].join('-')
28
29
  const key = `${coinType}-${dateStr}`
29
- const price = priceMap.get(key)
30
+ let price = priceMap.get(key)
30
31
  if (price) {
31
32
  return price
32
33
  }
33
34
 
34
- /*eslint no-constant-condition: ["error", { "checkLoops": false }]*/
35
- while (true) {
36
- try {
37
- const response = await priceClient.getPrice({
38
- timestamp: date,
39
- coinId: {
40
- address: {
41
- chain: chainId,
42
- address: coinType,
43
- },
35
+ const response = await priceClient.getPrice(
36
+ {
37
+ timestamp: date,
38
+ coinId: {
39
+ address: {
40
+ chain: chainId,
41
+ address: coinType,
44
42
  },
45
- })
46
- const price = response.price
47
- priceMap.set(key, price)
48
- return price
49
- } catch (e) {
50
- console.log('error getting price', e, dateStr, coinType)
51
- await delay(1000)
43
+ },
44
+ },
45
+ {
46
+ retry: true,
47
+ retryMaxAttempts: 8,
52
48
  }
53
- }
49
+ )
50
+ price = response.price
51
+ priceMap.set(key, price)
52
+ return price
54
53
  }
55
54
 
56
- export function delay(ms: number) {
57
- return new Promise((resolve) => setTimeout(resolve, ms))
55
+ /**
56
+ *
57
+ * @param symbol token symbol like BTC, etc
58
+ * @param date
59
+ */
60
+ export async function getPriceBySymbol(symbol: string, date: Date): Promise<number> {
61
+ if (!priceClient) {
62
+ priceClient = getPriceClient()
63
+ }
64
+
65
+ const dateStr = [date.getUTCDate(), date.getUTCMonth() + 1, date.getUTCFullYear()].join('-')
66
+ const key = `${symbol}-${dateStr}`
67
+ let price = priceMap.get(key)
68
+ if (price) {
69
+ return price
70
+ }
71
+
72
+ const response = await priceClient.getPrice(
73
+ {
74
+ timestamp: date,
75
+ coinId: {
76
+ symbol,
77
+ },
78
+ },
79
+ {
80
+ retry: true,
81
+ retryMaxAttempts: 8,
82
+ }
83
+ )
84
+ price = response.price
85
+ priceMap.set(key, price)
86
+ return price
58
87
  }