@yuants/vendor-aster 0.7.8 → 0.7.10
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.
|
@@ -13,14 +13,14 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar
|
|
|
13
13
|
import { createSeriesProvider } from '@yuants/data-series';
|
|
14
14
|
import { Terminal } from '@yuants/protocol';
|
|
15
15
|
import { createSQLWriter } from '@yuants/sql';
|
|
16
|
-
import { decodePath,
|
|
16
|
+
import { decodePath, formatTime } from '@yuants/utils';
|
|
17
17
|
import { firstValueFrom, map, mergeAll, timer } from 'rxjs';
|
|
18
18
|
import { getFApiV1FundingRate } from '../../api/public-api';
|
|
19
19
|
import { productService } from './product';
|
|
20
20
|
const terminal = Terminal.fromNodeEnv();
|
|
21
21
|
createSQLWriter(terminal, {
|
|
22
22
|
data$: productService.products$.pipe(map((products) => products.filter((product) => product.no_interest_rate === false)), mergeAll(), map((product) => ({
|
|
23
|
-
series_id:
|
|
23
|
+
series_id: product.product_id,
|
|
24
24
|
table_name: 'interest_rate',
|
|
25
25
|
cron_pattern: '0 * * * *',
|
|
26
26
|
cron_timezone: 'UTC',
|
|
@@ -40,8 +40,7 @@ createSeriesProvider(terminal, {
|
|
|
40
40
|
return __asyncGenerator(this, arguments, function* () {
|
|
41
41
|
const start = started_at !== null && started_at !== void 0 ? started_at : 0;
|
|
42
42
|
const end = ended_at !== null && ended_at !== void 0 ? ended_at : Date.now();
|
|
43
|
-
const [
|
|
44
|
-
const [instType, instId] = decodePath(product_id);
|
|
43
|
+
const [, instType, instId] = decodePath(series_id);
|
|
45
44
|
if (instType !== 'PERP') {
|
|
46
45
|
return yield __await(void 0);
|
|
47
46
|
}
|
|
@@ -71,8 +70,8 @@ createSeriesProvider(terminal, {
|
|
|
71
70
|
const rate = Number(item.fundingRate);
|
|
72
71
|
return {
|
|
73
72
|
series_id,
|
|
74
|
-
product_id,
|
|
75
|
-
datasource_id,
|
|
73
|
+
product_id: series_id,
|
|
74
|
+
datasource_id: 'ASTER',
|
|
76
75
|
created_at: formatTime(item.fundingTime),
|
|
77
76
|
long_rate: `${-rate}`,
|
|
78
77
|
short_rate: `${rate}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interest_rate.js","sourceRoot":"","sources":["../../../src/services/markets/interest_rate.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,oBAAoB,EAAyB,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"interest_rate.js","sourceRoot":"","sources":["../../../src/services/markets/interest_rate.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,oBAAoB,EAAyB,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAc,UAAU,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,eAAe,CAAwB,QAAQ,EAAE;IAC/C,KAAK,EAAE,cAAc,CAAC,SAAS,CAAC,IAAI,CAClC,GAAG,CAAC,CAAC,QAAoB,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,gBAAgB,KAAK,KAAK,CAAC,CAA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;gBAE5B,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,EAAE;oBACrB,MAAM;iBACP;gBAED,cAAM,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA,CAAC;aACnC;QACH,CAAC;KAAA;CACF,CAAC,CAAC","sourcesContent":["import { IInterestRate } from '@yuants/data-interest-rate';\nimport { IProduct } from '@yuants/data-product';\nimport { createSeriesProvider, ISeriesCollectingTask } from '@yuants/data-series';\nimport { Terminal } from '@yuants/protocol';\nimport { createSQLWriter } from '@yuants/sql';\nimport { decodePath, encodePath, formatTime } from '@yuants/utils';\nimport { firstValueFrom, map, mergeAll, timer } from 'rxjs';\nimport { getFApiV1FundingRate } from '../../api/public-api';\nimport { productService } from './product';\n\nconst terminal = Terminal.fromNodeEnv();\n\ncreateSQLWriter<ISeriesCollectingTask>(terminal, {\n data$: productService.products$.pipe(\n map((products: IProduct[]) => products.filter((product) => product.no_interest_rate === false)),\n mergeAll(),\n map(\n (product: IProduct): ISeriesCollectingTask => ({\n series_id: product.product_id,\n table_name: 'interest_rate',\n cron_pattern: '0 * * * *',\n cron_timezone: 'UTC',\n disabled: false,\n replay_count: 0,\n }),\n ),\n ),\n tableName: 'series_collecting_task',\n writeInterval: 1000,\n conflictKeys: ['series_id', 'table_name'],\n});\n\ncreateSeriesProvider<IInterestRate>(terminal, {\n tableName: 'interest_rate',\n series_id_prefix_parts: ['ASTER'],\n reversed: true,\n serviceOptions: { concurrent: 1 },\n queryFn: async function* ({ series_id, started_at, ended_at }) {\n const start = started_at ?? 0;\n const end = ended_at ?? Date.now();\n const [, instType, instId] = decodePath(series_id);\n\n if (instType !== 'PERP') {\n return;\n }\n\n let currentStart = start;\n\n while (currentStart <= end) {\n const res = await getFApiV1FundingRate({\n symbol: instId,\n startTime: currentStart,\n endTime: end,\n limit: 1000,\n });\n\n if (!Array.isArray(res) || res.length === 0) {\n break;\n }\n\n const filtered = res.filter((item) => item.fundingTime >= currentStart && item.fundingTime <= end);\n\n if (filtered.length === 0) {\n const lastRecord = res[res.length - 1];\n const nextStart = lastRecord.fundingTime + 1;\n if (nextStart <= currentStart) {\n break;\n }\n currentStart = nextStart;\n await firstValueFrom(timer(1000));\n continue;\n }\n\n const data = filtered.map((item): IInterestRate => {\n const rate = Number(item.fundingRate);\n return {\n series_id,\n product_id: series_id,\n datasource_id: 'ASTER',\n created_at: formatTime(item.fundingTime),\n long_rate: `${-rate}`,\n short_rate: `${rate}`,\n settlement_price: '',\n };\n });\n\n yield data;\n\n const lastTime = filtered[filtered.length - 1].fundingTime;\n if (lastTime >= end) {\n break;\n }\n\n currentStart = lastTime + 1;\n\n if (res.length < 1000) {\n break;\n }\n\n await firstValueFrom(timer(1000));\n }\n },\n});\n"]}
|
|
@@ -22,7 +22,7 @@ const product_1 = require("./product");
|
|
|
22
22
|
const terminal = protocol_1.Terminal.fromNodeEnv();
|
|
23
23
|
(0, sql_1.createSQLWriter)(terminal, {
|
|
24
24
|
data$: product_1.productService.products$.pipe((0, rxjs_1.map)((products) => products.filter((product) => product.no_interest_rate === false)), (0, rxjs_1.mergeAll)(), (0, rxjs_1.map)((product) => ({
|
|
25
|
-
series_id:
|
|
25
|
+
series_id: product.product_id,
|
|
26
26
|
table_name: 'interest_rate',
|
|
27
27
|
cron_pattern: '0 * * * *',
|
|
28
28
|
cron_timezone: 'UTC',
|
|
@@ -42,8 +42,7 @@ const terminal = protocol_1.Terminal.fromNodeEnv();
|
|
|
42
42
|
return __asyncGenerator(this, arguments, function* () {
|
|
43
43
|
const start = started_at !== null && started_at !== void 0 ? started_at : 0;
|
|
44
44
|
const end = ended_at !== null && ended_at !== void 0 ? ended_at : Date.now();
|
|
45
|
-
const [
|
|
46
|
-
const [instType, instId] = (0, utils_1.decodePath)(product_id);
|
|
45
|
+
const [, instType, instId] = (0, utils_1.decodePath)(series_id);
|
|
47
46
|
if (instType !== 'PERP') {
|
|
48
47
|
return yield __await(void 0);
|
|
49
48
|
}
|
|
@@ -73,8 +72,8 @@ const terminal = protocol_1.Terminal.fromNodeEnv();
|
|
|
73
72
|
const rate = Number(item.fundingRate);
|
|
74
73
|
return {
|
|
75
74
|
series_id,
|
|
76
|
-
product_id,
|
|
77
|
-
datasource_id,
|
|
75
|
+
product_id: series_id,
|
|
76
|
+
datasource_id: 'ASTER',
|
|
78
77
|
created_at: (0, utils_1.formatTime)(item.fundingTime),
|
|
79
78
|
long_rate: `${-rate}`,
|
|
80
79
|
short_rate: `${rate}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interest_rate.js","sourceRoot":"","sources":["../../../src/services/markets/interest_rate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,qDAAkF;AAClF,+CAA4C;AAC5C,qCAA8C;AAC9C,yCAAmE;AACnE,+BAA4D;AAC5D,qDAA4D;AAC5D,uCAA2C;AAE3C,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,IAAA,qBAAe,EAAwB,QAAQ,EAAE;IAC/C,KAAK,EAAE,wBAAc,CAAC,SAAS,CAAC,IAAI,CAClC,IAAA,UAAG,EAAC,CAAC,QAAoB,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,gBAAgB,KAAK,KAAK,CAAC,CAAC,EAC/F,IAAA,eAAQ,GAAE,EACV,IAAA,UAAG,EACD,CAAC,OAAiB,EAAyB,EAAE,CAAC,CAAC;QAC7C,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"interest_rate.js","sourceRoot":"","sources":["../../../src/services/markets/interest_rate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,qDAAkF;AAClF,+CAA4C;AAC5C,qCAA8C;AAC9C,yCAAmE;AACnE,+BAA4D;AAC5D,qDAA4D;AAC5D,uCAA2C;AAE3C,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,IAAA,qBAAe,EAAwB,QAAQ,EA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AAC;gBACJ,CAAC,CAAC,CAAC;gBAEH,oBAAM,IAAI,CAAA,CAAC;gBAEX,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC;gBAC3D,IAAI,QAAQ,IAAI,GAAG,EAAE;oBACnB,MAAM;iBACP;gBAED,YAAY,GAAG,QAAQ,GAAG,CAAC,CAAC;gBAE5B,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,EAAE;oBACrB,MAAM;iBACP;gBAED,cAAM,IAAA,qBAAc,EAAC,IAAA,YAAK,EAAC,IAAI,CAAC,CAAC,CAAA,CAAC;aACnC;QACH,CAAC;KAAA;CACF,CAAC,CAAC","sourcesContent":["import { IInterestRate } from '@yuants/data-interest-rate';\nimport { IProduct } from '@yuants/data-product';\nimport { createSeriesProvider, ISeriesCollectingTask } from '@yuants/data-series';\nimport { Terminal } from '@yuants/protocol';\nimport { createSQLWriter } from '@yuants/sql';\nimport { decodePath, encodePath, formatTime } from '@yuants/utils';\nimport { firstValueFrom, map, mergeAll, timer } from 'rxjs';\nimport { getFApiV1FundingRate } from '../../api/public-api';\nimport { productService } from './product';\n\nconst terminal = Terminal.fromNodeEnv();\n\ncreateSQLWriter<ISeriesCollectingTask>(terminal, {\n data$: productService.products$.pipe(\n map((products: IProduct[]) => products.filter((product) => product.no_interest_rate === false)),\n mergeAll(),\n map(\n (product: IProduct): ISeriesCollectingTask => ({\n series_id: product.product_id,\n table_name: 'interest_rate',\n cron_pattern: '0 * * * *',\n cron_timezone: 'UTC',\n disabled: false,\n replay_count: 0,\n }),\n ),\n ),\n tableName: 'series_collecting_task',\n writeInterval: 1000,\n conflictKeys: ['series_id', 'table_name'],\n});\n\ncreateSeriesProvider<IInterestRate>(terminal, {\n tableName: 'interest_rate',\n series_id_prefix_parts: ['ASTER'],\n reversed: true,\n serviceOptions: { concurrent: 1 },\n queryFn: async function* ({ series_id, started_at, ended_at }) {\n const start = started_at ?? 0;\n const end = ended_at ?? Date.now();\n const [, instType, instId] = decodePath(series_id);\n\n if (instType !== 'PERP') {\n return;\n }\n\n let currentStart = start;\n\n while (currentStart <= end) {\n const res = await getFApiV1FundingRate({\n symbol: instId,\n startTime: currentStart,\n endTime: end,\n limit: 1000,\n });\n\n if (!Array.isArray(res) || res.length === 0) {\n break;\n }\n\n const filtered = res.filter((item) => item.fundingTime >= currentStart && item.fundingTime <= end);\n\n if (filtered.length === 0) {\n const lastRecord = res[res.length - 1];\n const nextStart = lastRecord.fundingTime + 1;\n if (nextStart <= currentStart) {\n break;\n }\n currentStart = nextStart;\n await firstValueFrom(timer(1000));\n continue;\n }\n\n const data = filtered.map((item): IInterestRate => {\n const rate = Number(item.fundingRate);\n return {\n series_id,\n product_id: series_id,\n datasource_id: 'ASTER',\n created_at: formatTime(item.fundingTime),\n long_rate: `${-rate}`,\n short_rate: `${rate}`,\n settlement_price: '',\n };\n });\n\n yield data;\n\n const lastTime = filtered[filtered.length - 1].fundingTime;\n if (lastTime >= end) {\n break;\n }\n\n currentStart = lastTime + 1;\n\n if (res.length < 1000) {\n break;\n }\n\n await firstValueFrom(timer(1000));\n }\n },\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuants/vendor-aster",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.10",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -8,19 +8,19 @@
|
|
|
8
8
|
"temp"
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@yuants/protocol": "0.53.
|
|
11
|
+
"@yuants/protocol": "0.53.2",
|
|
12
12
|
"@yuants/cache": "0.3.3",
|
|
13
|
-
"@yuants/data-account": "0.8.
|
|
13
|
+
"@yuants/data-account": "0.8.4",
|
|
14
14
|
"@yuants/utils": "0.14.0",
|
|
15
|
-
"@yuants/data-series": "0.3.
|
|
16
|
-
"@yuants/sql": "0.9.
|
|
17
|
-
"@yuants/data-product": "0.4.
|
|
18
|
-
"@yuants/data-ohlc": "0.4.
|
|
19
|
-
"@yuants/data-order": "0.6.
|
|
20
|
-
"@yuants/data-interest-rate": "0.1.
|
|
21
|
-
"@yuants/transfer": "0.2.
|
|
22
|
-
"@yuants/data-quote": "0.2.
|
|
23
|
-
"@yuants/exchange": "0.1.
|
|
15
|
+
"@yuants/data-series": "0.3.51",
|
|
16
|
+
"@yuants/sql": "0.9.30",
|
|
17
|
+
"@yuants/data-product": "0.4.21",
|
|
18
|
+
"@yuants/data-ohlc": "0.4.22",
|
|
19
|
+
"@yuants/data-order": "0.6.6",
|
|
20
|
+
"@yuants/data-interest-rate": "0.1.48",
|
|
21
|
+
"@yuants/transfer": "0.2.39",
|
|
22
|
+
"@yuants/data-quote": "0.2.43",
|
|
23
|
+
"@yuants/exchange": "0.1.2",
|
|
24
24
|
"rxjs": "~7.5.6"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
package/temp/package-deps.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"apps/vendor-aster/AGENTS.md": "dcd006d19a5c3b73081525d7c0afea68cd6d058b",
|
|
3
|
-
"apps/vendor-aster/CHANGELOG.json": "
|
|
4
|
-
"apps/vendor-aster/CHANGELOG.md": "
|
|
3
|
+
"apps/vendor-aster/CHANGELOG.json": "7f8f2987528230b9a39f6279bd9799564df1942e",
|
|
4
|
+
"apps/vendor-aster/CHANGELOG.md": "247bbb753dccd8fe86c700c9f1738447958d7e2c",
|
|
5
5
|
"apps/vendor-aster/SESSION_NOTES.md": "f54c13cf4182d8a5e720f6db5d3acc323655ea49",
|
|
6
6
|
"apps/vendor-aster/config/jest.config.json": "4bb17bde3ee911163a3edb36a6eb71491d80b1bd",
|
|
7
7
|
"apps/vendor-aster/config/rig.json": "f6c7b5537dc77a3170ba9f008bae3b6c3ee11956",
|
|
8
8
|
"apps/vendor-aster/config/typescript.json": "854907e8a821f2050f6533368db160c649c25348",
|
|
9
|
-
"apps/vendor-aster/package.json": "
|
|
9
|
+
"apps/vendor-aster/package.json": "b59c72d6a5ee4aec5e3be465176f9c5d41f4b220",
|
|
10
10
|
"apps/vendor-aster/src/api/private-api.ts": "2987cb0d1d0f6aac6ec8257696da1e755f15bc3b",
|
|
11
11
|
"apps/vendor-aster/src/api/public-api.ts": "bfc642fff0ae31319c23e198f365a4a3372d4b10",
|
|
12
12
|
"apps/vendor-aster/src/index.ts": "509ef4c18ec2deb8a6e11ed5682334433cb2bcb2",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"apps/vendor-aster/src/services/accounts/profile.ts": "01cbb2cd8a913bb6471208eb96fb0613fbcd8f10",
|
|
15
15
|
"apps/vendor-aster/src/services/accounts/spot.ts": "d612814726080714af3cbe3deeaa3f57e109aaf9",
|
|
16
16
|
"apps/vendor-aster/src/services/exchange.ts": "4cdd15bfff1d1e4b1aceda287af6b280d088ccee",
|
|
17
|
-
"apps/vendor-aster/src/services/markets/interest_rate.ts": "
|
|
17
|
+
"apps/vendor-aster/src/services/markets/interest_rate.ts": "b8a43085be3632fe0afe00502c509b5984ab9cd3",
|
|
18
18
|
"apps/vendor-aster/src/services/markets/product.ts": "a0e5c02e9f99682cd2f4cb0a9e7a01747e540b4e",
|
|
19
19
|
"apps/vendor-aster/src/services/markets/quote.ts": "a5a828de8c5b43963459461d057825d977304233",
|
|
20
20
|
"apps/vendor-aster/src/services/orders/cancelOrder.ts": "09a6d3b10a218ad226346dd68d0ff0207083a7f1",
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
"apps/vendor-aster/src/services/orders/submitOrder.ts": "9e99af753829d8f75a110cb29042ee3ebe6b724d",
|
|
23
23
|
"apps/vendor-aster/tsconfig.json": "81da8f78196974b5d15da0edb6b2d9f48641063c",
|
|
24
24
|
"apps/vendor-aster/.rush/temp/shrinkwrap-deps.json": "5ded440ffb547a8aa495353d5b13c1fd1b164b4a",
|
|
25
|
-
"libraries/protocol/temp/package-deps.json": "
|
|
25
|
+
"libraries/protocol/temp/package-deps.json": "0bd43721e96039b52d7b59c834dc6df45cf75e3f",
|
|
26
26
|
"libraries/cache/temp/package-deps.json": "a4afa15e6462983f9d3735d31dc1ed8a683fb4dc",
|
|
27
|
-
"libraries/data-account/temp/package-deps.json": "
|
|
27
|
+
"libraries/data-account/temp/package-deps.json": "ae6b0c69040d0d1989525e843717b6e303d95ef2",
|
|
28
28
|
"libraries/utils/temp/package-deps.json": "6d58e9b325e8d16de8a878c32010f626b12a01da",
|
|
29
|
-
"libraries/data-series/temp/package-deps.json": "
|
|
30
|
-
"libraries/sql/temp/package-deps.json": "
|
|
31
|
-
"libraries/data-product/temp/package-deps.json": "
|
|
32
|
-
"libraries/data-ohlc/temp/package-deps.json": "
|
|
33
|
-
"libraries/data-order/temp/package-deps.json": "
|
|
34
|
-
"libraries/data-interest-rate/temp/package-deps.json": "
|
|
35
|
-
"libraries/transfer/temp/package-deps.json": "
|
|
36
|
-
"libraries/data-quote/temp/package-deps.json": "
|
|
37
|
-
"libraries/exchange/temp/package-deps.json": "
|
|
29
|
+
"libraries/data-series/temp/package-deps.json": "c89ebffe302757903aa54eff78f76cb855486b8c",
|
|
30
|
+
"libraries/sql/temp/package-deps.json": "4a9a7ec55f04b20459e664e81e76fa74b6c77b39",
|
|
31
|
+
"libraries/data-product/temp/package-deps.json": "8caccae65af24afde5d0e602eb24f57c22c7efd2",
|
|
32
|
+
"libraries/data-ohlc/temp/package-deps.json": "c0059a14c647112486ad561d730a4427b9f6f832",
|
|
33
|
+
"libraries/data-order/temp/package-deps.json": "2adac9fc0423f9b1b7ddaa8946ab7af374cc22e1",
|
|
34
|
+
"libraries/data-interest-rate/temp/package-deps.json": "cef1e1cb0116ad593c24635684e0cbf03488d67c",
|
|
35
|
+
"libraries/transfer/temp/package-deps.json": "36c58299bd6c841c5ba7252d71881a881570d08c",
|
|
36
|
+
"libraries/data-quote/temp/package-deps.json": "34d079eab44d2bf65e07b112ac2099c6e92a015e",
|
|
37
|
+
"libraries/exchange/temp/package-deps.json": "f9a2557b53874e78a809b82326b850d98b524a9b",
|
|
38
38
|
"libraries/extension/temp/package-deps.json": "9569c553c2f9a7d50b70d8f101fc2d3825aaccb9",
|
|
39
39
|
"tools/toolkit/temp/package-deps.json": "23e053490eb8feade23e4d45de4e54883e322711"
|
|
40
40
|
}
|