@pythnetwork/price-pusher 6.8.0 → 7.0.0-alpha
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.
- package/README.md +26 -14
- package/lib/aptos/aptos.d.ts +5 -2
- package/lib/aptos/aptos.d.ts.map +1 -1
- package/lib/aptos/aptos.js +19 -19
- package/lib/aptos/command.d.ts +3 -0
- package/lib/aptos/command.d.ts.map +1 -1
- package/lib/aptos/command.js +12 -14
- package/lib/controller.d.ts +3 -1
- package/lib/controller.d.ts.map +1 -1
- package/lib/controller.js +11 -4
- package/lib/evm/command.d.ts +3 -0
- package/lib/evm/command.d.ts.map +1 -1
- package/lib/evm/command.js +14 -16
- package/lib/evm/custom-gas-station.d.ts +4 -2
- package/lib/evm/custom-gas-station.d.ts.map +1 -1
- package/lib/evm/custom-gas-station.js +7 -6
- package/lib/evm/evm.d.ts +7 -3
- package/lib/evm/evm.d.ts.map +1 -1
- package/lib/evm/evm.js +25 -24
- package/lib/injective/command.d.ts +3 -0
- package/lib/injective/command.d.ts.map +1 -1
- package/lib/injective/command.js +11 -13
- package/lib/injective/injective.d.ts +5 -2
- package/lib/injective/injective.d.ts.map +1 -1
- package/lib/injective/injective.js +22 -22
- package/lib/interface.d.ts +1 -2
- package/lib/interface.d.ts.map +1 -1
- package/lib/interface.js +1 -4
- package/lib/near/command.d.ts +3 -0
- package/lib/near/command.d.ts.map +1 -1
- package/lib/near/command.js +14 -13
- package/lib/near/near.d.ts +5 -2
- package/lib/near/near.d.ts.map +1 -1
- package/lib/near/near.js +19 -17
- package/lib/options.d.ts +9 -0
- package/lib/options.d.ts.map +1 -1
- package/lib/options.js +28 -1
- package/lib/price-config.d.ts +2 -1
- package/lib/price-config.d.ts.map +1 -1
- package/lib/price-config.js +4 -6
- package/lib/pyth-price-listener.d.ts +3 -1
- package/lib/pyth-price-listener.d.ts.map +1 -1
- package/lib/pyth-price-listener.js +4 -2
- package/lib/solana/command.d.ts +5 -1
- package/lib/solana/command.d.ts.map +1 -1
- package/lib/solana/command.js +16 -18
- package/lib/solana/solana.d.ts +9 -5
- package/lib/solana/solana.d.ts.map +1 -1
- package/lib/solana/solana.js +27 -18
- package/lib/sui/command.d.ts +3 -0
- package/lib/sui/command.d.ts.map +1 -1
- package/lib/sui/command.js +12 -14
- package/lib/sui/sui.d.ts +6 -3
- package/lib/sui/sui.d.ts.map +1 -1
- package/lib/sui/sui.js +31 -36
- package/package.json +21 -11
package/lib/options.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mnemonicFile = exports.pushingFrequency = exports.pollingFrequency = exports.priceConfigFile = exports.pythContractAddress = exports.priceServiceEndpoint = void 0;
|
|
3
|
+
exports.controllerLogLevel = exports.priceServiceConnectionLogLevel = exports.logLevel = exports.mnemonicFile = exports.pushingFrequency = exports.pollingFrequency = exports.priceConfigFile = exports.pythContractAddress = exports.priceServiceEndpoint = void 0;
|
|
4
4
|
exports.priceServiceEndpoint = {
|
|
5
5
|
"price-service-endpoint": {
|
|
6
6
|
description: "Endpoint URL for the price service. e.g: https://endpoint/example",
|
|
@@ -48,3 +48,30 @@ exports.mnemonicFile = {
|
|
|
48
48
|
required: true,
|
|
49
49
|
},
|
|
50
50
|
};
|
|
51
|
+
exports.logLevel = {
|
|
52
|
+
"log-level": {
|
|
53
|
+
description: "Log level",
|
|
54
|
+
type: "string",
|
|
55
|
+
required: false,
|
|
56
|
+
default: "info",
|
|
57
|
+
choices: ["trace", "debug", "info", "warn", "error"],
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
exports.priceServiceConnectionLogLevel = {
|
|
61
|
+
"price-service-connection-log-level": {
|
|
62
|
+
description: "Log level for the price service connection.",
|
|
63
|
+
type: "string",
|
|
64
|
+
required: false,
|
|
65
|
+
default: "warn",
|
|
66
|
+
choices: ["trace", "debug", "info", "warn", "error"],
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
exports.controllerLogLevel = {
|
|
70
|
+
"controller-log-level": {
|
|
71
|
+
description: "Log level for the controller.",
|
|
72
|
+
type: "string",
|
|
73
|
+
required: false,
|
|
74
|
+
default: "info",
|
|
75
|
+
choices: ["trace", "debug", "info", "warn", "error"],
|
|
76
|
+
},
|
|
77
|
+
};
|
package/lib/price-config.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HexString } from "@pythnetwork/price-service-client";
|
|
2
|
+
import { Logger } from "pino";
|
|
2
3
|
import { DurationInSeconds, PctNumber } from "./utils";
|
|
3
4
|
import { PriceInfo } from "./interface";
|
|
4
5
|
export type PriceConfig = {
|
|
@@ -24,5 +25,5 @@ export declare enum UpdateCondition {
|
|
|
24
25
|
* @param priceConfig Config of the price feed to check
|
|
25
26
|
* @returns True if the on-chain price needs to be updated.
|
|
26
27
|
*/
|
|
27
|
-
export declare function shouldUpdate(priceConfig: PriceConfig, sourceLatestPrice: PriceInfo | undefined, targetLatestPrice: PriceInfo | undefined): UpdateCondition;
|
|
28
|
+
export declare function shouldUpdate(priceConfig: PriceConfig, sourceLatestPrice: PriceInfo | undefined, targetLatestPrice: PriceInfo | undefined, logger: Logger): UpdateCondition;
|
|
28
29
|
//# sourceMappingURL=price-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price-config.d.ts","sourceRoot":"","sources":["../src/price-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAI9D,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAmB,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAuBxC,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,SAAS,CAAC;IACd,cAAc,EAAE,iBAAiB,CAAC;IAClC,cAAc,EAAE,SAAS,CAAC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AAG,WAAW,EAAE,CAuB/D;AAED,oBAAY,eAAe;IAEzB,GAAG,IAAA;IAEH,KAAK,IAAA;IAEL,EAAE,IAAA;CACH;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,SAAS,GAAG,SAAS,EACxC,iBAAiB,EAAE,SAAS,GAAG,SAAS,EACxC,MAAM,EAAE,MAAM,GACb,eAAe,CAkEjB"}
|
package/lib/price-config.js
CHANGED
|
@@ -63,7 +63,7 @@ var UpdateCondition;
|
|
|
63
63
|
* @param priceConfig Config of the price feed to check
|
|
64
64
|
* @returns True if the on-chain price needs to be updated.
|
|
65
65
|
*/
|
|
66
|
-
function shouldUpdate(priceConfig, sourceLatestPrice, targetLatestPrice) {
|
|
66
|
+
function shouldUpdate(priceConfig, sourceLatestPrice, targetLatestPrice, logger) {
|
|
67
67
|
const priceId = priceConfig.id;
|
|
68
68
|
// There is no price to update the target with.
|
|
69
69
|
if (sourceLatestPrice === undefined) {
|
|
@@ -71,7 +71,7 @@ function shouldUpdate(priceConfig, sourceLatestPrice, targetLatestPrice) {
|
|
|
71
71
|
}
|
|
72
72
|
// It means that price never existed there. So we should push the latest price feed.
|
|
73
73
|
if (targetLatestPrice === undefined) {
|
|
74
|
-
|
|
74
|
+
logger.info(`${priceConfig.alias} (${priceId}) is not available on the target network. Pushing the price.`);
|
|
75
75
|
return UpdateCondition.YES;
|
|
76
76
|
}
|
|
77
77
|
// The current price is not newer than the price onchain
|
|
@@ -83,10 +83,8 @@ function shouldUpdate(priceConfig, sourceLatestPrice, targetLatestPrice) {
|
|
|
83
83
|
Number(targetLatestPrice.price)) *
|
|
84
84
|
100;
|
|
85
85
|
const confidenceRatioPct = Math.abs((Number(sourceLatestPrice.conf) / Number(sourceLatestPrice.price)) * 100);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
console.log("Target latest price: ", targetLatestPrice);
|
|
89
|
-
console.log(`Time difference: ${timeDifference} (< ${priceConfig.timeDifference}? / early: < ${priceConfig.earlyUpdateTimeDifference}) OR ` +
|
|
86
|
+
logger.info({ sourcePrice: sourceLatestPrice, targetPrice: targetLatestPrice }, `Analyzing price ${priceConfig.alias} (${priceId}). ` +
|
|
87
|
+
`Time difference: ${timeDifference} (< ${priceConfig.timeDifference}? / early: < ${priceConfig.earlyUpdateTimeDifference}) OR ` +
|
|
90
88
|
`Price deviation: ${priceDeviationPct.toFixed(5)}% (< ${priceConfig.priceDeviation}%? / early: < ${priceConfig.earlyUpdatePriceDeviation}%?) OR ` +
|
|
91
89
|
`Confidence ratio: ${confidenceRatioPct.toFixed(5)}% (< ${priceConfig.confidenceRatio}%? / early: < ${priceConfig.earlyUpdatePriceDeviation}%?)`);
|
|
92
90
|
if (timeDifference >= priceConfig.timeDifference ||
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { PriceServiceConnection } from "@pythnetwork/price-service-client";
|
|
2
2
|
import { PriceInfo, IPriceListener, PriceItem } from "./interface";
|
|
3
|
+
import { Logger } from "pino";
|
|
3
4
|
export declare class PythPriceListener implements IPriceListener {
|
|
4
5
|
private connection;
|
|
5
6
|
private priceIds;
|
|
6
7
|
private priceIdToAlias;
|
|
7
8
|
private latestPriceInfo;
|
|
8
|
-
|
|
9
|
+
private logger;
|
|
10
|
+
constructor(connection: PriceServiceConnection, priceItems: PriceItem[], logger: Logger);
|
|
9
11
|
start(): Promise<void>;
|
|
10
12
|
private onNewPriceFeed;
|
|
11
13
|
getLatestPriceInfo(priceId: string): PriceInfo | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pyth-price-listener.d.ts","sourceRoot":"","sources":["../src/pyth-price-listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,sBAAsB,EACvB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"pyth-price-listener.d.ts","sourceRoot":"","sources":["../src/pyth-price-listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,sBAAsB,EACvB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,qBAAa,iBAAkB,YAAW,cAAc;IACtD,OAAO,CAAC,UAAU,CAAyB;IAC3C,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,cAAc,CAAyB;IAC/C,OAAO,CAAC,eAAe,CAA4B;IACnD,OAAO,CAAC,MAAM,CAAS;gBAGrB,UAAU,EAAE,sBAAsB,EAClC,UAAU,EAAE,SAAS,EAAE,EACvB,MAAM,EAAE,MAAM;IAaV,KAAK;IAmBX,OAAO,CAAC,cAAc;IAsBtB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;CAG3D"}
|
|
@@ -6,11 +6,13 @@ class PythPriceListener {
|
|
|
6
6
|
priceIds;
|
|
7
7
|
priceIdToAlias;
|
|
8
8
|
latestPriceInfo;
|
|
9
|
-
|
|
9
|
+
logger;
|
|
10
|
+
constructor(connection, priceItems, logger) {
|
|
10
11
|
this.connection = connection;
|
|
11
12
|
this.priceIds = priceItems.map((priceItem) => priceItem.id);
|
|
12
13
|
this.priceIdToAlias = new Map(priceItems.map((priceItem) => [priceItem.id, priceItem.alias]));
|
|
13
14
|
this.latestPriceInfo = new Map();
|
|
15
|
+
this.logger = logger;
|
|
14
16
|
}
|
|
15
17
|
// This method should be awaited on and once it finishes it has the latest value
|
|
16
18
|
// for the given price feeds (if they exist).
|
|
@@ -29,7 +31,7 @@ class PythPriceListener {
|
|
|
29
31
|
});
|
|
30
32
|
}
|
|
31
33
|
onNewPriceFeed(priceFeed) {
|
|
32
|
-
|
|
34
|
+
this.logger.debug(`Received new price feed update from Pyth price service: ${this.priceIdToAlias.get(priceFeed.id)} ${priceFeed.id}`);
|
|
33
35
|
// Consider price to be currently available if it is not older than 60s
|
|
34
36
|
const currentPrice = priceFeed.getPriceNoOlderThan(60);
|
|
35
37
|
if (currentPrice === undefined) {
|
package/lib/solana/command.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { Options } from "yargs";
|
|
2
2
|
import { SearcherClient } from "jito-ts/dist/sdk/block-engine/searcher";
|
|
3
|
+
import { Logger } from "pino";
|
|
3
4
|
declare const _default: {
|
|
4
5
|
command: string;
|
|
5
6
|
describe: string;
|
|
6
7
|
builder: {
|
|
8
|
+
"controller-log-level": Options;
|
|
9
|
+
"price-service-connection-log-level": Options;
|
|
10
|
+
"log-level": Options;
|
|
7
11
|
"pushing-frequency": Options;
|
|
8
12
|
"polling-frequency": Options;
|
|
9
13
|
"pyth-contract-address": Options;
|
|
@@ -21,5 +25,5 @@ declare const _default: {
|
|
|
21
25
|
handler: (argv: any) => void;
|
|
22
26
|
};
|
|
23
27
|
export default _default;
|
|
24
|
-
export declare const onBundleResult: (c: SearcherClient) => void;
|
|
28
|
+
export declare const onBundleResult: (c: SearcherClient, logger: Logger) => void;
|
|
25
29
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/solana/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAgBhC,OAAO,EACL,cAAc,EAEf,MAAM,wCAAwC,CAAC
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/solana/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAgBhC,OAAO,EACL,cAAc,EAEf,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;oBAwDH,GAAG;;AAtD9B,wBA2JE;AAEF,eAAO,MAAM,cAAc,MAAO,cAAc,UAAU,MAAM,SAO/D,CAAC"}
|
package/lib/solana/command.js
CHANGED
|
@@ -39,6 +39,7 @@ const web3_js_1 = require("@solana/web3.js");
|
|
|
39
39
|
const fs_1 = __importDefault(require("fs"));
|
|
40
40
|
const web3_js_2 = require("@solana/web3.js");
|
|
41
41
|
const searcher_1 = require("jito-ts/dist/sdk/block-engine/searcher");
|
|
42
|
+
const pino_1 = __importDefault(require("pino"));
|
|
42
43
|
exports.default = {
|
|
43
44
|
command: "solana",
|
|
44
45
|
describe: "run price pusher for solana",
|
|
@@ -88,22 +89,19 @@ exports.default = {
|
|
|
88
89
|
...options.pythContractAddress,
|
|
89
90
|
...options.pollingFrequency,
|
|
90
91
|
...options.pushingFrequency,
|
|
92
|
+
...options.logLevel,
|
|
93
|
+
...options.priceServiceConnectionLogLevel,
|
|
94
|
+
...options.controllerLogLevel,
|
|
91
95
|
},
|
|
92
96
|
handler: function (argv) {
|
|
93
|
-
const { endpoint, keypairFile, shardId, computeUnitPriceMicroLamports, priceConfigFile, priceServiceEndpoint, pythContractAddress, pushingFrequency, pollingFrequency, jitoEndpoint, jitoKeypairFile, jitoTipLamports, jitoBundleSize, } = argv;
|
|
97
|
+
const { endpoint, keypairFile, shardId, computeUnitPriceMicroLamports, priceConfigFile, priceServiceEndpoint, pythContractAddress, pushingFrequency, pollingFrequency, jitoEndpoint, jitoKeypairFile, jitoTipLamports, jitoBundleSize, logLevel, priceServiceConnectionLogLevel, controllerLogLevel, } = argv;
|
|
98
|
+
const logger = (0, pino_1.default)({ level: logLevel });
|
|
94
99
|
const priceConfigs = (0, price_config_1.readPriceConfigFile)(priceConfigFile);
|
|
95
100
|
const priceServiceConnection = new price_service_client_1.PriceServiceConnection(priceServiceEndpoint, {
|
|
96
|
-
logger: {
|
|
97
|
-
// Log only warnings and errors from the price service client
|
|
98
|
-
info: () => undefined,
|
|
99
|
-
warn: console.warn,
|
|
100
|
-
error: console.error,
|
|
101
|
-
debug: () => undefined,
|
|
102
|
-
trace: () => undefined,
|
|
103
|
-
},
|
|
101
|
+
logger: logger.child({ module: "PriceServiceConnection" }, { level: priceServiceConnectionLogLevel }),
|
|
104
102
|
});
|
|
105
103
|
const priceItems = priceConfigs.map(({ id, alias }) => ({ id, alias }));
|
|
106
|
-
const pythListener = new pyth_price_listener_1.PythPriceListener(priceServiceConnection, priceItems);
|
|
104
|
+
const pythListener = new pyth_price_listener_1.PythPriceListener(priceServiceConnection, priceItems, logger.child({ module: "PythPriceListener" }));
|
|
107
105
|
const wallet = new nodewallet_1.default(web3_js_1.Keypair.fromSecretKey(Uint8Array.from(JSON.parse(fs_1.default.readFileSync(keypairFile, "ascii")))));
|
|
108
106
|
const pythSolanaReceiver = new pyth_solana_receiver_1.PythSolanaReceiver({
|
|
109
107
|
connection: new web3_js_1.Connection(endpoint, "processed"),
|
|
@@ -114,20 +112,20 @@ exports.default = {
|
|
|
114
112
|
if (jitoTipLamports) {
|
|
115
113
|
const jitoKeypair = web3_js_1.Keypair.fromSecretKey(Uint8Array.from(JSON.parse(fs_1.default.readFileSync(jitoKeypairFile, "ascii"))));
|
|
116
114
|
const jitoClient = (0, searcher_1.searcherClient)(jitoEndpoint, jitoKeypair);
|
|
117
|
-
solanaPricePusher = new solana_1.SolanaPricePusherJito(pythSolanaReceiver, priceServiceConnection, shardId, jitoTipLamports, jitoClient, jitoBundleSize);
|
|
118
|
-
(0, exports.onBundleResult)(jitoClient);
|
|
115
|
+
solanaPricePusher = new solana_1.SolanaPricePusherJito(pythSolanaReceiver, priceServiceConnection, logger.child({ module: "SolanaPricePusherJito" }), shardId, jitoTipLamports, jitoClient, jitoBundleSize);
|
|
116
|
+
(0, exports.onBundleResult)(jitoClient, logger.child({ module: "JitoClient" }));
|
|
119
117
|
}
|
|
120
118
|
else {
|
|
121
|
-
solanaPricePusher = new solana_1.SolanaPricePusher(pythSolanaReceiver, priceServiceConnection, shardId, computeUnitPriceMicroLamports);
|
|
119
|
+
solanaPricePusher = new solana_1.SolanaPricePusher(pythSolanaReceiver, priceServiceConnection, logger.child({ module: "SolanaPricePusher" }), shardId, computeUnitPriceMicroLamports);
|
|
122
120
|
}
|
|
123
|
-
const solanaPriceListener = new solana_1.SolanaPriceListener(pythSolanaReceiver, shardId, priceItems, { pollingFrequency });
|
|
124
|
-
const controller = new controller_1.Controller(priceConfigs, pythListener, solanaPriceListener, solanaPricePusher, { pushingFrequency });
|
|
121
|
+
const solanaPriceListener = new solana_1.SolanaPriceListener(pythSolanaReceiver, shardId, priceItems, logger.child({ module: "SolanaPriceListener" }), { pollingFrequency });
|
|
122
|
+
const controller = new controller_1.Controller(priceConfigs, pythListener, solanaPriceListener, solanaPricePusher, logger.child({ module: "Controller" }, { level: controllerLogLevel }), { pushingFrequency });
|
|
125
123
|
controller.start();
|
|
126
124
|
},
|
|
127
125
|
};
|
|
128
|
-
const onBundleResult = (c) => {
|
|
129
|
-
c.onBundleResult(() => undefined, (
|
|
130
|
-
|
|
126
|
+
const onBundleResult = (c, logger) => {
|
|
127
|
+
c.onBundleResult(() => undefined, (err) => {
|
|
128
|
+
logger.error(err, "Error in bundle result");
|
|
131
129
|
});
|
|
132
130
|
};
|
|
133
131
|
exports.onBundleResult = onBundleResult;
|
package/lib/solana/solana.d.ts
CHANGED
|
@@ -3,10 +3,12 @@ import { ChainPriceListener, IPricePusher, PriceInfo, PriceItem } from "../inter
|
|
|
3
3
|
import { DurationInSeconds } from "../utils";
|
|
4
4
|
import { PriceServiceConnection } from "@pythnetwork/price-service-client";
|
|
5
5
|
import { SearcherClient } from "jito-ts/dist/sdk/block-engine/searcher";
|
|
6
|
+
import { Logger } from "pino";
|
|
6
7
|
export declare class SolanaPriceListener extends ChainPriceListener {
|
|
7
8
|
private pythSolanaReceiver;
|
|
8
9
|
private shardId;
|
|
9
|
-
|
|
10
|
+
private logger;
|
|
11
|
+
constructor(pythSolanaReceiver: PythSolanaReceiver, shardId: number, priceItems: PriceItem[], logger: Logger, config: {
|
|
10
12
|
pollingFrequency: DurationInSeconds;
|
|
11
13
|
});
|
|
12
14
|
getOnChainPriceInfo(priceId: string): Promise<PriceInfo | undefined>;
|
|
@@ -14,19 +16,21 @@ export declare class SolanaPriceListener extends ChainPriceListener {
|
|
|
14
16
|
export declare class SolanaPricePusher implements IPricePusher {
|
|
15
17
|
private pythSolanaReceiver;
|
|
16
18
|
private priceServiceConnection;
|
|
19
|
+
private logger;
|
|
17
20
|
private shardId;
|
|
18
21
|
private computeUnitPriceMicroLamports;
|
|
19
|
-
constructor(pythSolanaReceiver: PythSolanaReceiver, priceServiceConnection: PriceServiceConnection, shardId: number, computeUnitPriceMicroLamports: number);
|
|
20
|
-
updatePriceFeed(priceIds: string[],
|
|
22
|
+
constructor(pythSolanaReceiver: PythSolanaReceiver, priceServiceConnection: PriceServiceConnection, logger: Logger, shardId: number, computeUnitPriceMicroLamports: number);
|
|
23
|
+
updatePriceFeed(priceIds: string[], _pubTimesToPush: number[]): Promise<void>;
|
|
21
24
|
}
|
|
22
25
|
export declare class SolanaPricePusherJito implements IPricePusher {
|
|
23
26
|
private pythSolanaReceiver;
|
|
24
27
|
private priceServiceConnection;
|
|
28
|
+
private logger;
|
|
25
29
|
private shardId;
|
|
26
30
|
private jitoTipLamports;
|
|
27
31
|
private searcherClient;
|
|
28
32
|
private jitoBundleSize;
|
|
29
|
-
constructor(pythSolanaReceiver: PythSolanaReceiver, priceServiceConnection: PriceServiceConnection, shardId: number, jitoTipLamports: number, searcherClient: SearcherClient, jitoBundleSize: number);
|
|
30
|
-
updatePriceFeed(priceIds: string[],
|
|
33
|
+
constructor(pythSolanaReceiver: PythSolanaReceiver, priceServiceConnection: PriceServiceConnection, logger: Logger, shardId: number, jitoTipLamports: number, searcherClient: SearcherClient, jitoBundleSize: number);
|
|
34
|
+
updatePriceFeed(priceIds: string[], _pubTimesToPush: number[]): Promise<void>;
|
|
31
35
|
}
|
|
32
36
|
//# sourceMappingURL=solana.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solana.d.ts","sourceRoot":"","sources":["../../src/solana/solana.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAK3E,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"solana.d.ts","sourceRoot":"","sources":["../../src/solana/solana.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAK3E,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAExE,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,qBAAa,mBAAoB,SAAQ,kBAAkB;IAEvD,OAAO,CAAC,kBAAkB;IAC1B,OAAO,CAAC,OAAO;IAEf,OAAO,CAAC,MAAM;gBAHN,kBAAkB,EAAE,kBAAkB,EACtC,OAAO,EAAE,MAAM,EACvB,UAAU,EAAE,SAAS,EAAE,EACf,MAAM,EAAE,MAAM,EACtB,MAAM,EAAE;QACN,gBAAgB,EAAE,iBAAiB,CAAC;KACrC;IAKG,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;CA0B3E;AAED,qBAAa,iBAAkB,YAAW,YAAY;IAElD,OAAO,CAAC,kBAAkB;IAC1B,OAAO,CAAC,sBAAsB;IAC9B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,6BAA6B;gBAJ7B,kBAAkB,EAAE,kBAAkB,EACtC,sBAAsB,EAAE,sBAAsB,EAC9C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,6BAA6B,EAAE,MAAM;IAGzC,eAAe,CACnB,QAAQ,EAAE,MAAM,EAAE,EAElB,eAAe,EAAE,MAAM,EAAE,GACxB,OAAO,CAAC,IAAI,CAAC;CAwCjB;AAID,qBAAa,qBAAsB,YAAW,YAAY;IAEtD,OAAO,CAAC,kBAAkB;IAC1B,OAAO,CAAC,sBAAsB;IAC9B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,cAAc;gBANd,kBAAkB,EAAE,kBAAkB,EACtC,sBAAsB,EAAE,sBAAsB,EAC9C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,MAAM;IAG1B,eAAe,CACnB,QAAQ,EAAE,MAAM,EAAE,EAElB,eAAe,EAAE,MAAM,EAAE,GACxB,OAAO,CAAC,IAAI,CAAC;CAuCjB"}
|
package/lib/solana/solana.js
CHANGED
|
@@ -7,15 +7,17 @@ const price_service_sdk_1 = require("@pythnetwork/price-service-sdk");
|
|
|
7
7
|
class SolanaPriceListener extends interface_1.ChainPriceListener {
|
|
8
8
|
pythSolanaReceiver;
|
|
9
9
|
shardId;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
logger;
|
|
11
|
+
constructor(pythSolanaReceiver, shardId, priceItems, logger, config) {
|
|
12
|
+
super(config.pollingFrequency, priceItems);
|
|
12
13
|
this.pythSolanaReceiver = pythSolanaReceiver;
|
|
13
14
|
this.shardId = shardId;
|
|
15
|
+
this.logger = logger;
|
|
14
16
|
}
|
|
15
17
|
async getOnChainPriceInfo(priceId) {
|
|
16
18
|
try {
|
|
17
19
|
const priceFeedAccount = await this.pythSolanaReceiver.fetchPriceFeedAccount(this.shardId, Buffer.from(priceId, "hex"));
|
|
18
|
-
|
|
20
|
+
this.logger.debug(`Polled a Solana on chain price for feed ${this.priceIdToAlias.get(priceId)} (${priceId}).`);
|
|
19
21
|
if (priceFeedAccount) {
|
|
20
22
|
return {
|
|
21
23
|
conf: priceFeedAccount.priceMessage.conf.toString(),
|
|
@@ -27,9 +29,8 @@ class SolanaPriceListener extends interface_1.ChainPriceListener {
|
|
|
27
29
|
return undefined;
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
|
-
catch (
|
|
31
|
-
|
|
32
|
-
console.error(e);
|
|
32
|
+
catch (err) {
|
|
33
|
+
this.logger.error({ err, priceId }, `Polling on-chain price failed.`);
|
|
33
34
|
return undefined;
|
|
34
35
|
}
|
|
35
36
|
}
|
|
@@ -38,15 +39,19 @@ exports.SolanaPriceListener = SolanaPriceListener;
|
|
|
38
39
|
class SolanaPricePusher {
|
|
39
40
|
pythSolanaReceiver;
|
|
40
41
|
priceServiceConnection;
|
|
42
|
+
logger;
|
|
41
43
|
shardId;
|
|
42
44
|
computeUnitPriceMicroLamports;
|
|
43
|
-
constructor(pythSolanaReceiver, priceServiceConnection, shardId, computeUnitPriceMicroLamports) {
|
|
45
|
+
constructor(pythSolanaReceiver, priceServiceConnection, logger, shardId, computeUnitPriceMicroLamports) {
|
|
44
46
|
this.pythSolanaReceiver = pythSolanaReceiver;
|
|
45
47
|
this.priceServiceConnection = priceServiceConnection;
|
|
48
|
+
this.logger = logger;
|
|
46
49
|
this.shardId = shardId;
|
|
47
50
|
this.computeUnitPriceMicroLamports = computeUnitPriceMicroLamports;
|
|
48
51
|
}
|
|
49
|
-
async updatePriceFeed(priceIds,
|
|
52
|
+
async updatePriceFeed(priceIds,
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
54
|
+
_pubTimesToPush) {
|
|
50
55
|
if (priceIds.length === 0) {
|
|
51
56
|
return;
|
|
52
57
|
}
|
|
@@ -54,8 +59,8 @@ class SolanaPricePusher {
|
|
|
54
59
|
try {
|
|
55
60
|
priceFeedUpdateData = await this.priceServiceConnection.getLatestVaas(priceIds);
|
|
56
61
|
}
|
|
57
|
-
catch (
|
|
58
|
-
|
|
62
|
+
catch (err) {
|
|
63
|
+
this.logger.error(err, "getPriceFeedsUpdateData failed:");
|
|
59
64
|
return;
|
|
60
65
|
}
|
|
61
66
|
const transactionBuilder = this.pythSolanaReceiver.newTransactionBuilder({
|
|
@@ -67,11 +72,11 @@ class SolanaPricePusher {
|
|
|
67
72
|
tightComputeBudget: true,
|
|
68
73
|
});
|
|
69
74
|
try {
|
|
70
|
-
await (0, solana_utils_1.sendTransactions)(transactions, this.pythSolanaReceiver.connection, this.pythSolanaReceiver.wallet);
|
|
71
|
-
|
|
75
|
+
const signatures = await (0, solana_utils_1.sendTransactions)(transactions, this.pythSolanaReceiver.connection, this.pythSolanaReceiver.wallet);
|
|
76
|
+
this.logger.info({ signatures }, "updatePriceFeed successful");
|
|
72
77
|
}
|
|
73
|
-
catch (
|
|
74
|
-
|
|
78
|
+
catch (err) {
|
|
79
|
+
this.logger.error(err, "updatePriceFeed failed");
|
|
75
80
|
return;
|
|
76
81
|
}
|
|
77
82
|
}
|
|
@@ -81,25 +86,29 @@ const UPDATES_PER_JITO_BUNDLE = 7;
|
|
|
81
86
|
class SolanaPricePusherJito {
|
|
82
87
|
pythSolanaReceiver;
|
|
83
88
|
priceServiceConnection;
|
|
89
|
+
logger;
|
|
84
90
|
shardId;
|
|
85
91
|
jitoTipLamports;
|
|
86
92
|
searcherClient;
|
|
87
93
|
jitoBundleSize;
|
|
88
|
-
constructor(pythSolanaReceiver, priceServiceConnection, shardId, jitoTipLamports, searcherClient, jitoBundleSize) {
|
|
94
|
+
constructor(pythSolanaReceiver, priceServiceConnection, logger, shardId, jitoTipLamports, searcherClient, jitoBundleSize) {
|
|
89
95
|
this.pythSolanaReceiver = pythSolanaReceiver;
|
|
90
96
|
this.priceServiceConnection = priceServiceConnection;
|
|
97
|
+
this.logger = logger;
|
|
91
98
|
this.shardId = shardId;
|
|
92
99
|
this.jitoTipLamports = jitoTipLamports;
|
|
93
100
|
this.searcherClient = searcherClient;
|
|
94
101
|
this.jitoBundleSize = jitoBundleSize;
|
|
95
102
|
}
|
|
96
|
-
async updatePriceFeed(priceIds,
|
|
103
|
+
async updatePriceFeed(priceIds,
|
|
104
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
105
|
+
_pubTimesToPush) {
|
|
97
106
|
let priceFeedUpdateData;
|
|
98
107
|
try {
|
|
99
108
|
priceFeedUpdateData = await this.priceServiceConnection.getLatestVaas(priceIds);
|
|
100
109
|
}
|
|
101
|
-
catch (
|
|
102
|
-
|
|
110
|
+
catch (err) {
|
|
111
|
+
this.logger.error(err, "getPriceFeedsUpdateData failed");
|
|
103
112
|
return;
|
|
104
113
|
}
|
|
105
114
|
for (let i = 0; i < priceIds.length; i += UPDATES_PER_JITO_BUNDLE) {
|
package/lib/sui/command.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ declare const _default: {
|
|
|
3
3
|
command: string;
|
|
4
4
|
describe: string;
|
|
5
5
|
builder: {
|
|
6
|
+
"controller-log-level": Options;
|
|
7
|
+
"price-service-connection-log-level": Options;
|
|
8
|
+
"log-level": Options;
|
|
6
9
|
"pushing-frequency": Options;
|
|
7
10
|
"polling-frequency": Options;
|
|
8
11
|
"mnemonic-file": Options;
|
package/lib/sui/command.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/sui/command.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/sui/command.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;oBAqEC,GAAG;;AAhEpC,wBAoJE"}
|
package/lib/sui/command.js
CHANGED
|
@@ -34,6 +34,7 @@ const pyth_price_listener_1 = require("../pyth-price-listener");
|
|
|
34
34
|
const controller_1 = require("../controller");
|
|
35
35
|
const sui_1 = require("./sui");
|
|
36
36
|
const ed25519_1 = require("@mysten/sui.js/keypairs/ed25519");
|
|
37
|
+
const pino_1 = __importDefault(require("pino"));
|
|
37
38
|
exports.default = {
|
|
38
39
|
command: "sui",
|
|
39
40
|
describe: "Run price pusher for sui. Most of the arguments below are" +
|
|
@@ -89,33 +90,30 @@ exports.default = {
|
|
|
89
90
|
...options.mnemonicFile,
|
|
90
91
|
...options.pollingFrequency,
|
|
91
92
|
...options.pushingFrequency,
|
|
93
|
+
...options.logLevel,
|
|
94
|
+
...options.priceServiceConnectionLogLevel,
|
|
95
|
+
...options.controllerLogLevel,
|
|
92
96
|
},
|
|
93
97
|
handler: async function (argv) {
|
|
94
|
-
const { endpoint, priceConfigFile, priceServiceEndpoint, mnemonicFile, pushingFrequency, pollingFrequency, pythStateId, wormholeStateId, numGasObjects, ignoreGasObjects, gasBudget, accountIndex, } = argv;
|
|
98
|
+
const { endpoint, priceConfigFile, priceServiceEndpoint, mnemonicFile, pushingFrequency, pollingFrequency, pythStateId, wormholeStateId, numGasObjects, ignoreGasObjects, gasBudget, accountIndex, logLevel, priceServiceConnectionLogLevel, controllerLogLevel, } = argv;
|
|
99
|
+
const logger = (0, pino_1.default)({ level: logLevel });
|
|
95
100
|
const priceConfigs = (0, price_config_1.readPriceConfigFile)(priceConfigFile);
|
|
96
101
|
const priceServiceConnection = new price_service_client_1.PriceServiceConnection(priceServiceEndpoint, {
|
|
97
|
-
logger: {
|
|
98
|
-
// Log only warnings and errors from the price service client
|
|
99
|
-
info: () => undefined,
|
|
100
|
-
warn: console.warn,
|
|
101
|
-
error: console.error,
|
|
102
|
-
debug: () => undefined,
|
|
103
|
-
trace: () => undefined,
|
|
104
|
-
},
|
|
102
|
+
logger: logger.child({ module: "PriceServiceConnection" }, { level: priceServiceConnectionLogLevel }),
|
|
105
103
|
priceFeedRequestConfig: {
|
|
106
104
|
binary: true,
|
|
107
105
|
},
|
|
108
106
|
});
|
|
109
107
|
const mnemonic = fs_1.default.readFileSync(mnemonicFile, "utf-8").trim();
|
|
110
108
|
const keypair = ed25519_1.Ed25519Keypair.deriveKeypair(mnemonic, `m/44'/784'/${accountIndex}'/0'/0'`);
|
|
111
|
-
|
|
109
|
+
logger.info(`Pushing updates from wallet address: ${keypair
|
|
112
110
|
.getPublicKey()
|
|
113
111
|
.toSuiAddress()}`);
|
|
114
112
|
const priceItems = priceConfigs.map(({ id, alias }) => ({ id, alias }));
|
|
115
|
-
const pythListener = new pyth_price_listener_1.PythPriceListener(priceServiceConnection, priceItems);
|
|
116
|
-
const suiListener = new sui_1.SuiPriceListener(pythStateId, wormholeStateId, endpoint, priceItems, { pollingFrequency });
|
|
117
|
-
const suiPusher = await sui_1.SuiPricePusher.createWithAutomaticGasPool(priceServiceConnection, pythStateId, wormholeStateId, endpoint, keypair, gasBudget, numGasObjects, ignoreGasObjects);
|
|
118
|
-
const controller = new controller_1.Controller(priceConfigs, pythListener, suiListener, suiPusher, { pushingFrequency });
|
|
113
|
+
const pythListener = new pyth_price_listener_1.PythPriceListener(priceServiceConnection, priceItems, logger.child({ module: "PythPriceListener" }));
|
|
114
|
+
const suiListener = new sui_1.SuiPriceListener(pythStateId, wormholeStateId, endpoint, priceItems, logger.child({ module: "SuiPriceListener" }), { pollingFrequency });
|
|
115
|
+
const suiPusher = await sui_1.SuiPricePusher.createWithAutomaticGasPool(priceServiceConnection, logger.child({ module: "SuiPricePusher" }), pythStateId, wormholeStateId, endpoint, keypair, gasBudget, numGasObjects, ignoreGasObjects);
|
|
116
|
+
const controller = new controller_1.Controller(priceConfigs, pythListener, suiListener, suiPusher, logger.child({ module: "Controller" }, { level: controllerLogLevel }), { pushingFrequency });
|
|
119
117
|
controller.start();
|
|
120
118
|
},
|
|
121
119
|
};
|
package/lib/sui/sui.d.ts
CHANGED
|
@@ -4,11 +4,13 @@ import { PriceServiceConnection } from "@pythnetwork/price-service-client";
|
|
|
4
4
|
import { SuiPythClient } from "@pythnetwork/pyth-sui-js";
|
|
5
5
|
import { Ed25519Keypair } from "@mysten/sui.js/keypairs/ed25519";
|
|
6
6
|
import { SuiClient, SuiObjectRef } from "@mysten/sui.js/client";
|
|
7
|
+
import { Logger } from "pino";
|
|
7
8
|
type ObjectId = string;
|
|
8
9
|
export declare class SuiPriceListener extends ChainPriceListener {
|
|
9
10
|
private pythClient;
|
|
10
11
|
private provider;
|
|
11
|
-
|
|
12
|
+
private logger;
|
|
13
|
+
constructor(pythStateId: ObjectId, wormholeStateId: ObjectId, endpoint: string, priceItems: PriceItem[], logger: Logger, config: {
|
|
12
14
|
pollingFrequency: DurationInSeconds;
|
|
13
15
|
});
|
|
14
16
|
getOnChainPriceInfo(priceId: string): Promise<PriceInfo | undefined>;
|
|
@@ -30,6 +32,7 @@ export declare class SuiPriceListener extends ChainPriceListener {
|
|
|
30
32
|
export declare class SuiPricePusher implements IPricePusher {
|
|
31
33
|
private readonly signer;
|
|
32
34
|
private readonly provider;
|
|
35
|
+
private logger;
|
|
33
36
|
private priceServiceConnection;
|
|
34
37
|
private pythPackageId;
|
|
35
38
|
private pythStateId;
|
|
@@ -38,7 +41,7 @@ export declare class SuiPricePusher implements IPricePusher {
|
|
|
38
41
|
private gasBudget;
|
|
39
42
|
private gasPool;
|
|
40
43
|
private pythClient;
|
|
41
|
-
constructor(signer: Ed25519Keypair, provider: SuiClient, priceServiceConnection: PriceServiceConnection, pythPackageId: string, pythStateId: string, wormholePackageId: string, wormholeStateId: string, endpoint: string, keypair: Ed25519Keypair, gasBudget: number, gasPool: SuiObjectRef[], pythClient: SuiPythClient);
|
|
44
|
+
constructor(signer: Ed25519Keypair, provider: SuiClient, logger: Logger, priceServiceConnection: PriceServiceConnection, pythPackageId: string, pythStateId: string, wormholePackageId: string, wormholeStateId: string, endpoint: string, keypair: Ed25519Keypair, gasBudget: number, gasPool: SuiObjectRef[], pythClient: SuiPythClient);
|
|
42
45
|
/**
|
|
43
46
|
* getPackageId returns the latest package id that the object belongs to. Use this to
|
|
44
47
|
* fetch the latest package id for a given object id and handle package upgrades automatically.
|
|
@@ -51,7 +54,7 @@ export declare class SuiPricePusher implements IPricePusher {
|
|
|
51
54
|
* Create a price pusher with a pool of `numGasObjects` gas coins that will be used to send transactions.
|
|
52
55
|
* The gas coins of the wallet for the provided keypair will be merged and then evenly split into `numGasObjects`.
|
|
53
56
|
*/
|
|
54
|
-
static createWithAutomaticGasPool(priceServiceConnection: PriceServiceConnection, pythStateId: string, wormholeStateId: string, endpoint: string, keypair: Ed25519Keypair, gasBudget: number, numGasObjects: number, ignoreGasObjects: string[]): Promise<SuiPricePusher>;
|
|
57
|
+
static createWithAutomaticGasPool(priceServiceConnection: PriceServiceConnection, logger: Logger, pythStateId: string, wormholeStateId: string, endpoint: string, keypair: Ed25519Keypair, gasBudget: number, numGasObjects: number, ignoreGasObjects: string[]): Promise<SuiPricePusher>;
|
|
55
58
|
updatePriceFeed(priceIds: string[], pubTimesToPush: number[]): Promise<void>;
|
|
56
59
|
/** Send every transaction in txs in parallel, returning when all transactions have completed. */
|
|
57
60
|
private sendTransactionBlocks;
|
package/lib/sui/sui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sui.d.ts","sourceRoot":"","sources":["../../src/sui/sui.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE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