@pythnetwork/price-pusher 9.1.0 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -0
- package/lib/aptos/balance-tracker.d.ts +46 -0
- package/lib/aptos/balance-tracker.d.ts.map +1 -0
- package/lib/aptos/balance-tracker.js +61 -0
- package/lib/aptos/command.d.ts +2 -0
- package/lib/aptos/command.d.ts.map +1 -1
- package/lib/aptos/command.js +46 -9
- package/lib/controller.d.ts +3 -0
- package/lib/controller.d.ts.map +1 -1
- package/lib/controller.js +37 -1
- package/lib/evm/balance-tracker.d.ts +42 -0
- package/lib/evm/balance-tracker.d.ts.map +1 -0
- package/lib/evm/balance-tracker.js +49 -0
- package/lib/evm/command.d.ts +2 -0
- package/lib/evm/command.d.ts.map +1 -1
- package/lib/evm/command.js +47 -10
- package/lib/evm/pyth-contract.d.ts.map +1 -1
- package/lib/evm/super-wallet.d.ts.map +1 -1
- package/lib/evm/super-wallet.js +17 -7
- package/lib/fuel/command.js +17 -7
- package/lib/index.js +3 -0
- package/lib/injective/command.d.ts +1 -0
- package/lib/injective/command.d.ts.map +1 -1
- package/lib/injective/command.js +26 -10
- package/lib/injective/injective.d.ts +2 -0
- package/lib/injective/injective.d.ts.map +1 -1
- package/lib/injective/injective.js +22 -7
- package/lib/interface.d.ts +51 -0
- package/lib/interface.d.ts.map +1 -1
- package/lib/interface.js +80 -1
- package/lib/metrics.d.ts +22 -0
- package/lib/metrics.d.ts.map +1 -0
- package/lib/metrics.js +113 -0
- package/lib/near/command.js +17 -7
- package/lib/options.d.ts +6 -0
- package/lib/options.d.ts.map +1 -1
- package/lib/options.js +17 -1
- package/lib/price-config.d.ts.map +1 -1
- package/lib/price-config.js +5 -1
- package/lib/solana/balance-tracker.d.ts +42 -0
- package/lib/solana/balance-tracker.d.ts.map +1 -0
- package/lib/solana/balance-tracker.js +51 -0
- package/lib/solana/command.d.ts +2 -0
- package/lib/solana/command.d.ts.map +1 -1
- package/lib/solana/command.js +48 -10
- package/lib/solana/solana.d.ts.map +1 -1
- package/lib/solana/solana.js +1 -1
- package/lib/sui/balance-tracker.d.ts +39 -0
- package/lib/sui/balance-tracker.d.ts.map +1 -0
- package/lib/sui/balance-tracker.js +54 -0
- package/lib/sui/command.d.ts +2 -0
- package/lib/sui/command.d.ts.map +1 -1
- package/lib/sui/command.js +50 -12
- package/lib/sui/sui.d.ts.map +1 -1
- package/lib/ton/command.js +17 -7
- package/lib/utils.d.ts +2 -2
- package/lib/utils.d.ts.map +1 -1
- package/package.json +16 -9
package/lib/evm/super-wallet.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.createClient = void 0;
|
|
27
37
|
const viem_1 = require("viem");
|
package/lib/fuel/command.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
package/lib/index.js
CHANGED
|
@@ -14,12 +14,15 @@ const command_5 = __importDefault(require("./near/command"));
|
|
|
14
14
|
const command_6 = __importDefault(require("./solana/command"));
|
|
15
15
|
const command_7 = __importDefault(require("./fuel/command"));
|
|
16
16
|
const command_8 = __importDefault(require("./ton/command"));
|
|
17
|
+
const options_1 = require("./options");
|
|
17
18
|
(0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
18
19
|
.parserConfiguration({
|
|
19
20
|
"parse-numbers": false,
|
|
20
21
|
})
|
|
21
22
|
.config("config")
|
|
22
23
|
.global("config")
|
|
24
|
+
.option("enable-metrics", options_1.enableMetrics["enable-metrics"])
|
|
25
|
+
.option("metrics-port", options_1.metricsPort["metrics-port"])
|
|
23
26
|
.command(command_2.default)
|
|
24
27
|
.command(command_7.default)
|
|
25
28
|
.command(command_1.default)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/injective/command.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;;;;;;;;;;;;;yBAevB,OAAO;iBAKP,OAAO;qBAIP,OAAO;0BAIP,OAAO;;oBAUiB,GAAG;;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/injective/command.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;;;;;;;;;;;;;yBAevB,OAAO;iBAKP,OAAO;qBAIP,OAAO;0BAIP,OAAO;wCAMP,OAAO;;oBAUiB,GAAG;;AAxCpC,wBA4HE"}
|
package/lib/injective/command.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -53,12 +63,17 @@ exports.default = {
|
|
|
53
63
|
required: true,
|
|
54
64
|
},
|
|
55
65
|
"gas-price": {
|
|
56
|
-
description: "Gas price to be used for each
|
|
66
|
+
description: "Gas price to be used for each transaction",
|
|
57
67
|
type: "number",
|
|
58
68
|
},
|
|
59
69
|
"gas-multiplier": {
|
|
60
|
-
description: "Gas multiplier to be used for each
|
|
70
|
+
description: "Gas multiplier to be used for each transaction",
|
|
71
|
+
type: "number",
|
|
72
|
+
},
|
|
73
|
+
"price-ids-process-chunk-size": {
|
|
74
|
+
description: "Set in case we wanna split price feeds updates into chunks to have smaller transactions. Set to -1 to disable chunking.",
|
|
61
75
|
type: "number",
|
|
76
|
+
required: false,
|
|
62
77
|
},
|
|
63
78
|
...options.priceConfigFile,
|
|
64
79
|
...options.priceServiceEndpoint,
|
|
@@ -71,7 +86,7 @@ exports.default = {
|
|
|
71
86
|
},
|
|
72
87
|
handler: async function (argv) {
|
|
73
88
|
// FIXME: type checks for this
|
|
74
|
-
const {
|
|
89
|
+
const { network, logLevel, gasPrice, grpcEndpoint, mnemonicFile, gasMultiplier, priceConfigFile, pollingFrequency, pushingFrequency, controllerLogLevel, pythContractAddress, priceServiceEndpoint, priceIdsProcessChunkSize, } = argv;
|
|
75
90
|
const logger = (0, pino_1.default)({ level: logLevel });
|
|
76
91
|
if (network !== "testnet" && network !== "mainnet") {
|
|
77
92
|
throw new Error("Please specify network. One of [testnet, mainnet]");
|
|
@@ -96,6 +111,7 @@ exports.default = {
|
|
|
96
111
|
chainId: (0, networks_1.getNetworkInfo)(network).chainId,
|
|
97
112
|
gasPrice,
|
|
98
113
|
gasMultiplier,
|
|
114
|
+
priceIdsProcessChunkSize,
|
|
99
115
|
});
|
|
100
116
|
const controller = new controller_1.Controller(priceConfigs, pythListener, injectiveListener, injectivePusher, logger.child({ module: "Controller" }, { level: controllerLogLevel }), { pushingFrequency });
|
|
101
117
|
controller.start();
|
|
@@ -15,6 +15,7 @@ type InjectiveConfig = {
|
|
|
15
15
|
chainId: string;
|
|
16
16
|
gasMultiplier: number;
|
|
17
17
|
gasPrice: number;
|
|
18
|
+
priceIdsProcessChunkSize: number;
|
|
18
19
|
};
|
|
19
20
|
export declare class InjectivePricePusher implements IPricePusher {
|
|
20
21
|
private hermesClient;
|
|
@@ -29,6 +30,7 @@ export declare class InjectivePricePusher implements IPricePusher {
|
|
|
29
30
|
private signAndBroadcastMsg;
|
|
30
31
|
getPriceFeedUpdateObject(priceIds: string[]): Promise<any>;
|
|
31
32
|
updatePriceFeed(priceIds: string[], pubTimesToPush: number[]): Promise<void>;
|
|
33
|
+
private updatePriceFeedChunk;
|
|
32
34
|
}
|
|
33
35
|
export {};
|
|
34
36
|
//# sourceMappingURL=injective.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injective.d.ts","sourceRoot":"","sources":["../../src/injective/injective.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EACL,YAAY,EACZ,SAAS,EACT,kBAAkB,EAClB,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"injective.d.ts","sourceRoot":"","sources":["../../src/injective/injective.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EACL,YAAY,EACZ,SAAS,EACT,kBAAkB,EAClB,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAa7C,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAyB9B,qBAAa,sBAAuB,SAAQ,kBAAkB;IAE1D,OAAO,CAAC,mBAAmB;IAC3B,OAAO,CAAC,YAAY;IAEpB,OAAO,CAAC,MAAM;gBAHN,mBAAmB,EAAE,MAAM,EAC3B,YAAY,EAAE,MAAM,EAC5B,UAAU,EAAE,SAAS,EAAE,EACf,MAAM,EAAE,MAAM,EACtB,MAAM,EAAE;QACN,gBAAgB,EAAE,iBAAiB,CAAC;KACrC;IAKG,mBAAmB,CACvB,OAAO,EAAE,SAAS,GACjB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;CA4BlC;AAED,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AACF,qBAAa,oBAAqB,YAAW,YAAY;IAMrD,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,mBAAmB;IAC3B,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,MAAM;IARhB,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,OAAO,CAAwB;gBAG7B,YAAY,EAAE,YAAY,EAC1B,mBAAmB,EAAE,MAAM,EAC3B,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACtB,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC;IAcxC,OAAO,CAAC,gBAAgB;YAIV,mBAAmB;IAmE3B,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAa1D,eAAe,CACnB,QAAQ,EAAE,MAAM,EAAE,EAClB,cAAc,EAAE,MAAM,EAAE,GACvB,OAAO,CAAC,IAAI,CAAC;YAqBF,oBAAoB;CA0EnC"}
|
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.InjectivePricePusher = exports.InjectivePriceListener = void 0;
|
|
4
4
|
const interface_1 = require("../interface");
|
|
5
5
|
const sdk_ts_1 = require("@injectivelabs/sdk-ts");
|
|
6
|
+
const utils_1 = require("@injectivelabs/utils");
|
|
6
7
|
const DEFAULT_GAS_PRICE = 160000000;
|
|
7
8
|
const DEFAULT_GAS_MULTIPLIER = 1.05;
|
|
9
|
+
const DEFAULT_PRICE_IDS_PROCESS_CHUNK_SIZE = -1;
|
|
8
10
|
const INJECTIVE_TESTNET_CHAIN_ID = "injective-888";
|
|
9
11
|
// this use price without leading 0x
|
|
10
12
|
class InjectivePriceListener extends interface_1.ChainPriceListener {
|
|
@@ -56,6 +58,8 @@ class InjectivePricePusher {
|
|
|
56
58
|
chainId: chainConfig?.chainId ?? INJECTIVE_TESTNET_CHAIN_ID,
|
|
57
59
|
gasMultiplier: chainConfig?.gasMultiplier ?? DEFAULT_GAS_MULTIPLIER,
|
|
58
60
|
gasPrice: chainConfig?.gasPrice ?? DEFAULT_GAS_PRICE,
|
|
61
|
+
priceIdsProcessChunkSize: chainConfig?.priceIdsProcessChunkSize ??
|
|
62
|
+
DEFAULT_PRICE_IDS_PROCESS_CHUNK_SIZE,
|
|
59
63
|
};
|
|
60
64
|
}
|
|
61
65
|
injectiveAddress() {
|
|
@@ -72,7 +76,7 @@ class InjectivePricePusher {
|
|
|
72
76
|
chainId: this.chainConfig.chainId,
|
|
73
77
|
pubKey: this.wallet.toPublicKey().toBase64(),
|
|
74
78
|
});
|
|
75
|
-
const txService = new sdk_ts_1.
|
|
79
|
+
const txService = new sdk_ts_1.TxGrpcApi(this.grpcEndpoint);
|
|
76
80
|
// simulation
|
|
77
81
|
try {
|
|
78
82
|
const { gasInfo: { gasUsed }, } = await txService.simulate(simulateTxRaw);
|
|
@@ -132,13 +136,24 @@ class InjectivePricePusher {
|
|
|
132
136
|
}
|
|
133
137
|
if (priceIds.length !== pubTimesToPush.length)
|
|
134
138
|
throw new Error("Invalid arguments");
|
|
139
|
+
const priceIdChunks = this.chainConfig.priceIdsProcessChunkSize === -1
|
|
140
|
+
? [priceIds]
|
|
141
|
+
: (0, utils_1.splitArrayToChunks)({
|
|
142
|
+
array: priceIds,
|
|
143
|
+
chunkSize: this.chainConfig.priceIdsProcessChunkSize,
|
|
144
|
+
});
|
|
145
|
+
for (const [chunkIndex, priceIdChunk] of priceIdChunks.entries()) {
|
|
146
|
+
await this.updatePriceFeedChunk(priceIdChunk, chunkIndex);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
async updatePriceFeedChunk(priceIds, chunkIndex) {
|
|
135
150
|
let priceFeedUpdateObject;
|
|
136
151
|
try {
|
|
137
152
|
// get the latest VAAs for updatePriceFeed and then push them
|
|
138
153
|
priceFeedUpdateObject = await this.getPriceFeedUpdateObject(priceIds);
|
|
139
154
|
}
|
|
140
155
|
catch (err) {
|
|
141
|
-
this.logger.error(err,
|
|
156
|
+
this.logger.error(err, `Error fetching the latest vaas to push for chunk ${chunkIndex}`);
|
|
142
157
|
return;
|
|
143
158
|
}
|
|
144
159
|
let updateFeeQueryResponse;
|
|
@@ -153,7 +168,7 @@ class InjectivePricePusher {
|
|
|
153
168
|
updateFeeQueryResponse = JSON.parse(json);
|
|
154
169
|
}
|
|
155
170
|
catch (err) {
|
|
156
|
-
this.logger.error(err,
|
|
171
|
+
this.logger.error(err, `Error fetching update fee for chunk ${chunkIndex}`);
|
|
157
172
|
// Throwing an error because it is likely an RPC issue
|
|
158
173
|
throw err;
|
|
159
174
|
}
|
|
@@ -165,19 +180,19 @@ class InjectivePricePusher {
|
|
|
165
180
|
funds: [updateFeeQueryResponse],
|
|
166
181
|
});
|
|
167
182
|
const rs = await this.signAndBroadcastMsg(executeMsg);
|
|
168
|
-
this.logger.info({ hash: rs.txHash },
|
|
183
|
+
this.logger.info({ hash: rs.txHash }, `Successfully broadcasted txHash for chunk ${chunkIndex}`);
|
|
169
184
|
}
|
|
170
185
|
catch (err) {
|
|
171
186
|
if (err.message.match(/account inj[a-zA-Z0-9]+ not found/) !== null) {
|
|
172
|
-
this.logger.error(err,
|
|
187
|
+
this.logger.error(err, `Account not found for chunk ${chunkIndex}`);
|
|
173
188
|
throw new Error("Please check the mnemonic");
|
|
174
189
|
}
|
|
175
190
|
if (err.message.match(/insufficient/) !== null &&
|
|
176
191
|
err.message.match(/funds/) !== null) {
|
|
177
|
-
this.logger.error(err,
|
|
192
|
+
this.logger.error(err, `Insufficient funds for chunk ${chunkIndex}`);
|
|
178
193
|
throw new Error("Insufficient funds");
|
|
179
194
|
}
|
|
180
|
-
this.logger.error(err,
|
|
195
|
+
this.logger.error(err, `Error executing messages for chunk ${chunkIndex}`);
|
|
181
196
|
}
|
|
182
197
|
}
|
|
183
198
|
}
|
package/lib/interface.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { HexString, UnixTimestamp } from "@pythnetwork/hermes-client";
|
|
2
2
|
import { DurationInSeconds } from "./utils";
|
|
3
|
+
import { Logger } from "pino";
|
|
4
|
+
import { PricePusherMetrics } from "./metrics";
|
|
3
5
|
export type PriceItem = {
|
|
4
6
|
id: HexString;
|
|
5
7
|
alias: string;
|
|
@@ -28,4 +30,53 @@ export declare abstract class ChainPriceListener implements IPriceListener {
|
|
|
28
30
|
export interface IPricePusher {
|
|
29
31
|
updatePriceFeed(priceIds: string[], pubTimesToPush: UnixTimestamp[]): Promise<void>;
|
|
30
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Common configuration properties for all balance trackers
|
|
35
|
+
*/
|
|
36
|
+
export interface BaseBalanceTrackerConfig {
|
|
37
|
+
/** Address of the wallet to track */
|
|
38
|
+
address: string;
|
|
39
|
+
/** Name/ID of the network/chain */
|
|
40
|
+
network: string;
|
|
41
|
+
/** How often to update the balance */
|
|
42
|
+
updateInterval: DurationInSeconds;
|
|
43
|
+
/** Metrics instance to report balance updates */
|
|
44
|
+
metrics: PricePusherMetrics;
|
|
45
|
+
/** Logger instance */
|
|
46
|
+
logger: Logger;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Interface for all balance trackers to implement
|
|
50
|
+
* Each chain will have its own implementation of this interface
|
|
51
|
+
*/
|
|
52
|
+
export interface IBalanceTracker {
|
|
53
|
+
/**
|
|
54
|
+
* Start tracking the wallet balance
|
|
55
|
+
*/
|
|
56
|
+
start(): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Stop tracking the wallet balance
|
|
59
|
+
*/
|
|
60
|
+
stop(): void;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Abstract base class that implements common functionality for all balance trackers
|
|
64
|
+
*/
|
|
65
|
+
export declare abstract class BaseBalanceTracker implements IBalanceTracker {
|
|
66
|
+
protected address: string;
|
|
67
|
+
protected network: string;
|
|
68
|
+
protected updateInterval: DurationInSeconds;
|
|
69
|
+
protected metrics: PricePusherMetrics;
|
|
70
|
+
protected logger: Logger;
|
|
71
|
+
protected isRunning: boolean;
|
|
72
|
+
constructor(config: BaseBalanceTrackerConfig);
|
|
73
|
+
start(): Promise<void>;
|
|
74
|
+
private startUpdateLoop;
|
|
75
|
+
/**
|
|
76
|
+
* Chain-specific balance update implementation
|
|
77
|
+
* Each chain will implement this method differently
|
|
78
|
+
*/
|
|
79
|
+
protected abstract updateBalance(): Promise<void>;
|
|
80
|
+
stop(): void;
|
|
81
|
+
}
|
|
31
82
|
//# sourceMappingURL=interface.d.ts.map
|
package/lib/interface.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,SAAS,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,aAAa,CAAC;CAC5B,CAAC;AAEF,MAAM,WAAW,cAAc;IAE7B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;CAC5D;AAED,8BAAsB,kBAAmB,YAAW,cAAc;IAK9D,OAAO,CAAC,gBAAgB;IACxB,SAAS,CAAC,UAAU,EAAE,SAAS,EAAE;IALnC,OAAO,CAAC,eAAe,CAA4B;IACnD,SAAS,CAAC,cAAc,EAAE,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;gBAGvC,gBAAgB,EAAE,iBAAiB,EACjC,UAAU,EAAE,SAAS,EAAE;IAQ7B,KAAK;YAMG,UAAU;IASxB,SAAS,CAAC,qBAAqB,CAC7B,OAAO,EAAE,SAAS,EAClB,aAAa,EAAE,SAAS;IAkB1B,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAI1D,QAAQ,CAAC,mBAAmB,CAC1B,OAAO,EAAE,SAAS,GACjB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;CAClC;AAED,MAAM,WAAW,YAAY;IAC3B,eAAe,CACb,QAAQ,EAAE,MAAM,EAAE,EAClB,cAAc,EAAE,aAAa,EAAE,GAC9B,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,cAAc,EAAE,iBAAiB,CAAC;IAClC,iDAAiD;IACjD,OAAO,EAAE,kBAAkB,CAAC;IAC5B,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;OAEG;IACH,IAAI,IAAI,IAAI,CAAC;CACd;AAED;;GAEG;AACH,8BAAsB,kBAAmB,YAAW,eAAe;IACjE,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,cAAc,EAAE,iBAAiB,CAAC;IAC5C,SAAS,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACtC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,SAAS,EAAE,OAAO,CAAS;gBAEzB,MAAM,EAAE,wBAAwB;IAQ/B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAcrB,eAAe;IAkB7B;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAE1C,IAAI,IAAI,IAAI;CAGpB"}
|
package/lib/interface.js
CHANGED
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ChainPriceListener = void 0;
|
|
36
|
+
exports.BaseBalanceTracker = exports.ChainPriceListener = void 0;
|
|
4
37
|
class ChainPriceListener {
|
|
5
38
|
pollingFrequency;
|
|
6
39
|
priceItems;
|
|
@@ -41,3 +74,49 @@ class ChainPriceListener {
|
|
|
41
74
|
}
|
|
42
75
|
}
|
|
43
76
|
exports.ChainPriceListener = ChainPriceListener;
|
|
77
|
+
/**
|
|
78
|
+
* Abstract base class that implements common functionality for all balance trackers
|
|
79
|
+
*/
|
|
80
|
+
class BaseBalanceTracker {
|
|
81
|
+
address;
|
|
82
|
+
network;
|
|
83
|
+
updateInterval;
|
|
84
|
+
metrics;
|
|
85
|
+
logger;
|
|
86
|
+
isRunning = false;
|
|
87
|
+
constructor(config) {
|
|
88
|
+
this.address = config.address;
|
|
89
|
+
this.network = config.network;
|
|
90
|
+
this.updateInterval = config.updateInterval;
|
|
91
|
+
this.metrics = config.metrics;
|
|
92
|
+
this.logger = config.logger;
|
|
93
|
+
}
|
|
94
|
+
async start() {
|
|
95
|
+
if (this.isRunning) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
this.isRunning = true;
|
|
99
|
+
// Initial balance update
|
|
100
|
+
await this.updateBalance();
|
|
101
|
+
// Start the update loop
|
|
102
|
+
this.startUpdateLoop();
|
|
103
|
+
}
|
|
104
|
+
async startUpdateLoop() {
|
|
105
|
+
// We're using dynamic import to avoid circular dependencies
|
|
106
|
+
const { sleep } = await Promise.resolve().then(() => __importStar(require("./utils")));
|
|
107
|
+
// Run in a loop to regularly update the balance
|
|
108
|
+
for (;;) {
|
|
109
|
+
// Wait first, since we already did the initial update in start()
|
|
110
|
+
await sleep(this.updateInterval * 1000);
|
|
111
|
+
// Only continue if we're still running
|
|
112
|
+
if (!this.isRunning) {
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
await this.updateBalance();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
stop() {
|
|
119
|
+
this.isRunning = false;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.BaseBalanceTracker = BaseBalanceTracker;
|
package/lib/metrics.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Counter, Gauge } from "prom-client";
|
|
2
|
+
import { PriceInfo } from "./interface";
|
|
3
|
+
import { Logger } from "pino";
|
|
4
|
+
import { UpdateCondition } from "./price-config";
|
|
5
|
+
export declare class PricePusherMetrics {
|
|
6
|
+
private registry;
|
|
7
|
+
private server;
|
|
8
|
+
private logger;
|
|
9
|
+
lastPublishedTime: Gauge<string>;
|
|
10
|
+
priceUpdateAttempts: Counter<string>;
|
|
11
|
+
priceFeedsTotal: Gauge<string>;
|
|
12
|
+
walletBalance: Gauge<string>;
|
|
13
|
+
constructor(logger: Logger);
|
|
14
|
+
start(port: number): void;
|
|
15
|
+
updateLastPublishedTime(priceId: string, alias: string, priceInfo: PriceInfo): void;
|
|
16
|
+
recordPriceUpdate(priceId: string, alias: string, trigger?: string): void;
|
|
17
|
+
recordUpdateCondition(priceId: string, alias: string, condition: UpdateCondition): void;
|
|
18
|
+
recordPriceUpdateError(priceId: string, alias: string, trigger?: string): void;
|
|
19
|
+
setPriceFeedsTotal(count: number): void;
|
|
20
|
+
updateWalletBalance(walletAddress: string, network: string, balance: bigint | number): void;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjD,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,MAAM,CAAS;IAGhB,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC,mBAAmB,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAE/B,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBAExB,MAAM,EAAE,MAAM;IA6CnB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAOzB,uBAAuB,CAC5B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,SAAS,GACnB,IAAI;IAQA,iBAAiB,CACtB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,MAAc,GACtB,IAAI;IAUA,qBAAqB,CAC1B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,eAAe,GACzB,IAAI;IAgBA,sBAAsB,CAC3B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,MAAc,GACtB,IAAI;IAUA,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKvC,mBAAmB,CACxB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAAG,MAAM,GACvB,IAAI;CAYR"}
|
package/lib/metrics.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PricePusherMetrics = void 0;
|
|
7
|
+
const prom_client_1 = require("prom-client");
|
|
8
|
+
const express_1 = __importDefault(require("express"));
|
|
9
|
+
const price_config_1 = require("./price-config");
|
|
10
|
+
// Define the metrics we want to track
|
|
11
|
+
class PricePusherMetrics {
|
|
12
|
+
registry;
|
|
13
|
+
server;
|
|
14
|
+
logger;
|
|
15
|
+
// Metrics for price feed updates
|
|
16
|
+
lastPublishedTime;
|
|
17
|
+
priceUpdateAttempts;
|
|
18
|
+
priceFeedsTotal;
|
|
19
|
+
// Wallet metrics
|
|
20
|
+
walletBalance;
|
|
21
|
+
constructor(logger) {
|
|
22
|
+
this.logger = logger;
|
|
23
|
+
this.registry = new prom_client_1.Registry();
|
|
24
|
+
this.server = (0, express_1.default)();
|
|
25
|
+
// Register the default metrics (memory, CPU, etc.)
|
|
26
|
+
this.registry.setDefaultLabels({ app: "price_pusher" });
|
|
27
|
+
// Create metrics
|
|
28
|
+
this.lastPublishedTime = new prom_client_1.Gauge({
|
|
29
|
+
name: "pyth_price_last_published_time",
|
|
30
|
+
help: "The last published time of a price feed in unix timestamp",
|
|
31
|
+
labelNames: ["price_id", "alias"],
|
|
32
|
+
registers: [this.registry],
|
|
33
|
+
});
|
|
34
|
+
this.priceUpdateAttempts = new prom_client_1.Counter({
|
|
35
|
+
name: "pyth_price_update_attempts_total",
|
|
36
|
+
help: "Total number of price update attempts with their trigger condition and status",
|
|
37
|
+
labelNames: ["price_id", "alias", "trigger", "status"],
|
|
38
|
+
registers: [this.registry],
|
|
39
|
+
});
|
|
40
|
+
this.priceFeedsTotal = new prom_client_1.Gauge({
|
|
41
|
+
name: "pyth_price_feeds_total",
|
|
42
|
+
help: "Total number of price feeds being monitored",
|
|
43
|
+
registers: [this.registry],
|
|
44
|
+
});
|
|
45
|
+
// Wallet balance metric
|
|
46
|
+
this.walletBalance = new prom_client_1.Gauge({
|
|
47
|
+
name: "pyth_wallet_balance",
|
|
48
|
+
help: "Current wallet balance of the price pusher in native token units",
|
|
49
|
+
labelNames: ["wallet_address", "network"],
|
|
50
|
+
registers: [this.registry],
|
|
51
|
+
});
|
|
52
|
+
// Setup the metrics endpoint
|
|
53
|
+
this.server.get("/metrics", async (req, res) => {
|
|
54
|
+
res.set("Content-Type", this.registry.contentType);
|
|
55
|
+
res.end(await this.registry.metrics());
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
// Start the metrics server
|
|
59
|
+
start(port) {
|
|
60
|
+
this.server.listen(port, () => {
|
|
61
|
+
this.logger.info(`Metrics server started on port ${port}`);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
// Update the last published time for a price feed
|
|
65
|
+
updateLastPublishedTime(priceId, alias, priceInfo) {
|
|
66
|
+
this.lastPublishedTime.set({ price_id: priceId, alias }, priceInfo.publishTime);
|
|
67
|
+
}
|
|
68
|
+
// Record a successful price update
|
|
69
|
+
recordPriceUpdate(priceId, alias, trigger = "yes") {
|
|
70
|
+
this.priceUpdateAttempts.inc({
|
|
71
|
+
price_id: priceId,
|
|
72
|
+
alias,
|
|
73
|
+
trigger: trigger.toLowerCase(),
|
|
74
|
+
status: "success",
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
// Record update condition status (YES/NO/EARLY)
|
|
78
|
+
recordUpdateCondition(priceId, alias, condition) {
|
|
79
|
+
const triggerLabel = price_config_1.UpdateCondition[condition].toLowerCase();
|
|
80
|
+
// Only record as 'skipped' when the condition is NO
|
|
81
|
+
if (condition === price_config_1.UpdateCondition.NO) {
|
|
82
|
+
this.priceUpdateAttempts.inc({
|
|
83
|
+
price_id: priceId,
|
|
84
|
+
alias,
|
|
85
|
+
trigger: triggerLabel,
|
|
86
|
+
status: "skipped",
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
// YES and EARLY don't increment the counter here - they'll be counted
|
|
90
|
+
// when recordPriceUpdate or recordPriceUpdateError is called
|
|
91
|
+
}
|
|
92
|
+
// Record a price update error
|
|
93
|
+
recordPriceUpdateError(priceId, alias, trigger = "yes") {
|
|
94
|
+
this.priceUpdateAttempts.inc({
|
|
95
|
+
price_id: priceId,
|
|
96
|
+
alias,
|
|
97
|
+
trigger: trigger.toLowerCase(),
|
|
98
|
+
status: "error",
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
// Set the number of price feeds
|
|
102
|
+
setPriceFeedsTotal(count) {
|
|
103
|
+
this.priceFeedsTotal.set(count);
|
|
104
|
+
}
|
|
105
|
+
// Update wallet balance
|
|
106
|
+
updateWalletBalance(walletAddress, network, balance) {
|
|
107
|
+
// Convert to number for compatibility with prometheus
|
|
108
|
+
const balanceNum = typeof balance === "bigint" ? Number(balance) / 1e18 : balance;
|
|
109
|
+
this.walletBalance.set({ wallet_address: walletAddress, network }, balanceNum);
|
|
110
|
+
this.logger.debug(`Updated wallet balance metric: ${walletAddress} = ${balanceNum}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exports.PricePusherMetrics = PricePusherMetrics;
|
package/lib/near/command.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
package/lib/options.d.ts
CHANGED
|
@@ -23,4 +23,10 @@ export declare const logLevel: {
|
|
|
23
23
|
export declare const controllerLogLevel: {
|
|
24
24
|
"controller-log-level": Options;
|
|
25
25
|
};
|
|
26
|
+
export declare const enableMetrics: {
|
|
27
|
+
"enable-metrics": Options;
|
|
28
|
+
};
|
|
29
|
+
export declare const metricsPort: {
|
|
30
|
+
"metrics-port": Options;
|
|
31
|
+
};
|
|
26
32
|
//# sourceMappingURL=options.d.ts.map
|
package/lib/options.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,eAAO,MAAM,oBAAoB;8BAM1B,OAAO;CACb,CAAC;AAEF,eAAO,MAAM,mBAAmB;6BAOzB,OAAO;CACb,CAAC;AAEF,eAAO,MAAM,eAAe;yBAKrB,OAAO;CACb,CAAC;AAEF,eAAO,MAAM,gBAAgB;yBAOtB,OAAO;CACb,CAAC;AAEF,eAAO,MAAM,gBAAgB;yBAStB,OAAO;CACb,CAAC;AAEF,eAAO,MAAM,YAAY;qBAKlB,OAAO;CACb,CAAC;AAEF,eAAO,MAAM,QAAQ;iBAOd,OAAO;CACb,CAAC;AAEF,eAAO,MAAM,kBAAkB;4BAOxB,OAAO;CACb,CAAC"}
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,eAAO,MAAM,oBAAoB;8BAM1B,OAAO;CACb,CAAC;AAEF,eAAO,MAAM,mBAAmB;6BAOzB,OAAO;CACb,CAAC;AAEF,eAAO,MAAM,eAAe;yBAKrB,OAAO;CACb,CAAC;AAEF,eAAO,MAAM,gBAAgB;yBAOtB,OAAO;CACb,CAAC;AAEF,eAAO,MAAM,gBAAgB;yBAStB,OAAO;CACb,CAAC;AAEF,eAAO,MAAM,YAAY;qBAKlB,OAAO;CACb,CAAC;AAEF,eAAO,MAAM,QAAQ;iBAOd,OAAO;CACb,CAAC;AAEF,eAAO,MAAM,kBAAkB;4BAOxB,OAAO;CACb,CAAC;AAEF,eAAO,MAAM,aAAa;sBAMnB,OAAO;CACb,CAAC;AAEF,eAAO,MAAM,WAAW;oBAMjB,OAAO;CACb,CAAC"}
|
package/lib/options.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.controllerLogLevel = exports.logLevel = exports.mnemonicFile = exports.pushingFrequency = exports.pollingFrequency = exports.priceConfigFile = exports.pythContractAddress = exports.priceServiceEndpoint = void 0;
|
|
3
|
+
exports.metricsPort = exports.enableMetrics = exports.controllerLogLevel = 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 hermes client. e.g: https://endpoint/example",
|
|
@@ -66,3 +66,19 @@ exports.controllerLogLevel = {
|
|
|
66
66
|
choices: ["trace", "debug", "info", "warn", "error"],
|
|
67
67
|
},
|
|
68
68
|
};
|
|
69
|
+
exports.enableMetrics = {
|
|
70
|
+
"enable-metrics": {
|
|
71
|
+
description: "Enable Prometheus metrics server",
|
|
72
|
+
type: "boolean",
|
|
73
|
+
required: false,
|
|
74
|
+
default: true,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
exports.metricsPort = {
|
|
78
|
+
"metrics-port": {
|
|
79
|
+
description: "Port for the Prometheus metrics server",
|
|
80
|
+
type: "number",
|
|
81
|
+
required: false,
|
|
82
|
+
default: 9090,
|
|
83
|
+
},
|
|
84
|
+
};
|