@pythnetwork/price-pusher 10.0.0 → 10.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 +31 -3
- package/lib/controller.d.ts.map +1 -1
- package/lib/controller.js +1 -0
- package/lib/metrics.d.ts +3 -0
- package/lib/metrics.d.ts.map +1 -1
- package/lib/metrics.js +23 -0
- package/lib/solana/command.d.ts.map +1 -1
- package/lib/solana/command.js +8 -3
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -211,12 +211,12 @@ and the on-chain Pyth contract and deciding whether to push a new price. You can
|
|
|
211
211
|
|
|
212
212
|
### Example
|
|
213
213
|
|
|
214
|
-
For example, to push `BTC/USD` and `BNB/USD` prices on
|
|
214
|
+
For example, to push `BTC/USD` and `BNB/USD` prices on Sonic blaze testnet, run the following command:
|
|
215
215
|
|
|
216
216
|
```sh
|
|
217
217
|
pnpm run dev evm \
|
|
218
|
-
--endpoint https://
|
|
219
|
-
--pyth-contract-address
|
|
218
|
+
--endpoint https://rpc.blaze.soniclabs.com \
|
|
219
|
+
--pyth-contract-address 0x2880aB155794e7179c9eE2e38200202908C17B43 \
|
|
220
220
|
--price-service-endpoint https://hermes.pyth.network \
|
|
221
221
|
--mnemonic-file "./mnemonic" \
|
|
222
222
|
--price-config-file "./price-config.stable.sample.yaml" \
|
|
@@ -272,6 +272,8 @@ The following metrics are available:
|
|
|
272
272
|
- **pyth_price_last_published_time** (Gauge): The last published time of a price feed in unix timestamp, labeled by price_id and alias
|
|
273
273
|
- **pyth_price_update_attempts_total** (Counter): Total number of price update attempts with their trigger condition and status, labeled by price_id, alias, trigger, and status
|
|
274
274
|
- **pyth_price_feeds_total** (Gauge): Total number of price feeds being monitored
|
|
275
|
+
- **pyth_source_price** (Gauge): Latest price value from Pyth source, labeled by price_id and alias
|
|
276
|
+
- **pyth_target_price** (Gauge): Latest price value from target chain, labeled by price_id and alias
|
|
275
277
|
- **pyth_wallet_balance** (Gauge): Current wallet balance of the price pusher in native token units, labeled by wallet_address and network
|
|
276
278
|
|
|
277
279
|
### Configuration
|
|
@@ -343,6 +345,30 @@ pyth_wallet_balance
|
|
|
343
345
|
pyth_wallet_balance < 0.1
|
|
344
346
|
```
|
|
345
347
|
|
|
348
|
+
7. Monitor current source price values:
|
|
349
|
+
|
|
350
|
+
```
|
|
351
|
+
pyth_source_price
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
8. Monitor current target price values:
|
|
355
|
+
|
|
356
|
+
```
|
|
357
|
+
pyth_target_price
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
9. Compare source vs target price differences:
|
|
361
|
+
|
|
362
|
+
```
|
|
363
|
+
abs(pyth_source_price - pyth_target_price) / pyth_source_price * 100
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
10. Detect significant price deviations (>1%):
|
|
367
|
+
|
|
368
|
+
```
|
|
369
|
+
abs(pyth_source_price - pyth_target_price) / pyth_source_price * 100 > 1
|
|
370
|
+
```
|
|
371
|
+
|
|
346
372
|
### Dashboard
|
|
347
373
|
|
|
348
374
|
The docker-compose setup includes a pre-configured Grafana dashboard (`grafana-dashboard.sample.json`) that provides monitoring of your price pusher operations. The dashboard includes the following panels:
|
|
@@ -353,6 +379,8 @@ The docker-compose setup includes a pre-configured Grafana dashboard (`grafana-d
|
|
|
353
379
|
- **Price Feeds List**: A table listing all configured price feeds with their details.
|
|
354
380
|
- **Successful Updates (Current Range)**: Graph showing the number of successful price updates over the current range with timeline.
|
|
355
381
|
- **Update Conditions Distribution**: Pie chart showing the distribution of update conditions (YES/NO/EARLY) over the selected time range.
|
|
382
|
+
- **Source vs Target Price Values**: Graphs showing current price values from both Pyth source and target chains for comparison.
|
|
383
|
+
- **Price Deviation Monitoring**: Panels to track price differences between source and target chains.
|
|
356
384
|
- **Wallet Balance**: Current balance of your wallet in native token units.
|
|
357
385
|
- **Wallet Balance Over Time**: Graph tracking your wallet balance over time to monitor consumption.
|
|
358
386
|
- **Failed Updates (Current Range)**: Graph showing the number of failed price updates over the current range with timeline.
|
package/lib/controller.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../src/controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAS,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAiC,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,qBAAa,UAAU;IAKnB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,mBAAmB;IAC3B,OAAO,CAAC,mBAAmB;IAC3B,OAAO,CAAC,sBAAsB;IAC9B,OAAO,CAAC,MAAM;IARhB,OAAO,CAAC,gBAAgB,CAAoB;IAC5C,OAAO,CAAC,OAAO,CAAC,CAAqB;gBAG3B,YAAY,EAAE,WAAW,EAAE,EAC3B,mBAAmB,EAAE,cAAc,EACnC,mBAAmB,EAAE,cAAc,EACnC,sBAAsB,EAAE,YAAY,EACpC,MAAM,EAAE,MAAM,EACtB,MAAM,EAAE;QACN,gBAAgB,EAAE,iBAAiB,CAAC;QACpC,OAAO,CAAC,EAAE,kBAAkB,CAAC;KAC9B;IASG,KAAK;
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../src/controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAS,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAiC,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,qBAAa,UAAU;IAKnB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,mBAAmB;IAC3B,OAAO,CAAC,mBAAmB;IAC3B,OAAO,CAAC,sBAAsB;IAC9B,OAAO,CAAC,MAAM;IARhB,OAAO,CAAC,gBAAgB,CAAoB;IAC5C,OAAO,CAAC,OAAO,CAAC,CAAqB;gBAG3B,YAAY,EAAE,WAAW,EAAE,EAC3B,mBAAmB,EAAE,cAAc,EACnC,mBAAmB,EAAE,cAAc,EACnC,sBAAsB,EAAE,YAAY,EACpC,MAAM,EAAE,MAAM,EACtB,MAAM,EAAE;QACN,gBAAgB,EAAE,iBAAiB,CAAC;QACpC,OAAO,CAAC,EAAE,kBAAkB,CAAC;KAC9B;IASG,KAAK;CA4IZ"}
|
package/lib/controller.js
CHANGED
|
@@ -43,6 +43,7 @@ class Controller {
|
|
|
43
43
|
const sourceLatestPrice = this.sourcePriceListener.getLatestPriceInfo(priceId);
|
|
44
44
|
if (this.metrics && targetLatestPrice && sourceLatestPrice) {
|
|
45
45
|
this.metrics.updateTimestamps(priceId, alias, targetLatestPrice.publishTime, sourceLatestPrice.publishTime, priceConfig.timeDifference);
|
|
46
|
+
this.metrics.updatePriceValues(priceId, alias, sourceLatestPrice.price, targetLatestPrice.price);
|
|
46
47
|
}
|
|
47
48
|
const priceShouldUpdate = (0, price_config_1.shouldUpdate)(priceConfig, sourceLatestPrice, targetLatestPrice, this.logger);
|
|
48
49
|
// Record update condition in metrics
|
package/lib/metrics.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export declare class PricePusherMetrics {
|
|
|
10
10
|
priceFeedsTotal: Gauge<string>;
|
|
11
11
|
sourceTimestamp: Gauge<string>;
|
|
12
12
|
configuredTimeDifference: Gauge<string>;
|
|
13
|
+
sourcePriceValue: Gauge<string>;
|
|
14
|
+
targetPriceValue: Gauge<string>;
|
|
13
15
|
walletBalance: Gauge<string>;
|
|
14
16
|
constructor(logger: Logger);
|
|
15
17
|
start(port: number): void;
|
|
@@ -18,6 +20,7 @@ export declare class PricePusherMetrics {
|
|
|
18
20
|
recordPriceUpdateError(priceId: string, alias: string, trigger?: string): void;
|
|
19
21
|
setPriceFeedsTotal(count: number): void;
|
|
20
22
|
updateTimestamps(priceId: string, alias: string, targetLatestPricePublishTime: number, sourceLatestPricePublishTime: number, priceConfigTimeDifference: number): void;
|
|
23
|
+
updatePriceValues(priceId: string, alias: string, sourcePrice: string | undefined, targetPrice: string | undefined): void;
|
|
21
24
|
updateWalletBalance(walletAddress: string, network: string, balance: bigint | number): void;
|
|
22
25
|
}
|
|
23
26
|
//# sourceMappingURL=metrics.d.ts.map
|
package/lib/metrics.d.ts.map
CHANGED
|
@@ -1 +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,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;IAC/B,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/B,wBAAwB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;
|
|
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,MAAM,EAAE,MA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,EAAE,MAAM,GAAG,SAAS,EAC/B,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,IAAI;IAgBA,mBAAmB,CACxB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAAG,MAAM,GACvB,IAAI;CAYR"}
|
package/lib/metrics.js
CHANGED
|
@@ -18,6 +18,8 @@ class PricePusherMetrics {
|
|
|
18
18
|
priceFeedsTotal;
|
|
19
19
|
sourceTimestamp;
|
|
20
20
|
configuredTimeDifference;
|
|
21
|
+
sourcePriceValue;
|
|
22
|
+
targetPriceValue;
|
|
21
23
|
// Wallet metrics
|
|
22
24
|
walletBalance;
|
|
23
25
|
constructor(logger) {
|
|
@@ -56,6 +58,18 @@ class PricePusherMetrics {
|
|
|
56
58
|
labelNames: ["price_id", "alias"],
|
|
57
59
|
registers: [this.registry],
|
|
58
60
|
});
|
|
61
|
+
this.sourcePriceValue = new prom_client_1.Gauge({
|
|
62
|
+
name: "pyth_source_price",
|
|
63
|
+
help: "Latest price value from Pyth source",
|
|
64
|
+
labelNames: ["price_id", "alias"],
|
|
65
|
+
registers: [this.registry],
|
|
66
|
+
});
|
|
67
|
+
this.targetPriceValue = new prom_client_1.Gauge({
|
|
68
|
+
name: "pyth_target_price",
|
|
69
|
+
help: "Latest price value from target chain",
|
|
70
|
+
labelNames: ["price_id", "alias"],
|
|
71
|
+
registers: [this.registry],
|
|
72
|
+
});
|
|
59
73
|
// Wallet balance metric
|
|
60
74
|
this.walletBalance = new prom_client_1.Gauge({
|
|
61
75
|
name: "pyth_wallet_balance",
|
|
@@ -118,6 +132,15 @@ class PricePusherMetrics {
|
|
|
118
132
|
this.lastPublishedTime.set({ price_id: priceId, alias }, targetLatestPricePublishTime);
|
|
119
133
|
this.configuredTimeDifference.set({ price_id: priceId, alias }, priceConfigTimeDifference);
|
|
120
134
|
}
|
|
135
|
+
// Update price values
|
|
136
|
+
updatePriceValues(priceId, alias, sourcePrice, targetPrice) {
|
|
137
|
+
if (sourcePrice !== undefined) {
|
|
138
|
+
this.sourcePriceValue.set({ price_id: priceId, alias }, Number(sourcePrice));
|
|
139
|
+
}
|
|
140
|
+
if (targetPrice !== undefined) {
|
|
141
|
+
this.targetPriceValue.set({ price_id: priceId, alias }, Number(targetPrice));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
121
144
|
// Update wallet balance
|
|
122
145
|
updateWalletBalance(walletAddress, network, balance) {
|
|
123
146
|
// Convert to number for compatibility with prometheus
|
|
@@ -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;AAehC,OAAO,EACL,cAAc,EAEf,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;;;;;;;;;;;;;;kBAerB,OAAO;wBAKP,OAAO;oBAKP,OAAO;6CAKP,OAAO;0BAKP,OAAO;6BAMP,OAAO;6BAKP,OAAO;6BAKP,OAAO;iCAKP,OAAO;4BAKP,OAAO;mCAKP,OAAO;wCAKP,OAAO;uBAMP,OAAO;;oBAWiB,GAAG;;AAjFpC,wBAsPE;AAEF,eAAO,MAAM,cAAc,GAAI,GAAG,cAAc,EAAE,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/solana/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAehC,OAAO,EACL,cAAc,EAEf,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;;;;;;;;;;;;;;kBAerB,OAAO;wBAKP,OAAO;oBAKP,OAAO;6CAKP,OAAO;0BAKP,OAAO;6BAMP,OAAO;6BAKP,OAAO;6BAKP,OAAO;iCAKP,OAAO;4BAKP,OAAO;mCAKP,OAAO;wCAKP,OAAO;uBAMP,OAAO;;oBAWiB,GAAG;;AAjFpC,wBAsPE;AAEF,eAAO,MAAM,cAAc,GAAI,GAAG,cAAc,EAAE,QAAQ,MAAM,SAW/D,CAAC"}
|
package/lib/solana/command.js
CHANGED
|
@@ -211,8 +211,13 @@ exports.default = {
|
|
|
211
211
|
},
|
|
212
212
|
};
|
|
213
213
|
const onBundleResult = (c, logger) => {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
214
|
+
try {
|
|
215
|
+
c.onBundleResult(() => undefined, (err) => {
|
|
216
|
+
logger.error(err, "Error in bundle result");
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
logger.error(error, "Exception in bundle result");
|
|
221
|
+
}
|
|
217
222
|
};
|
|
218
223
|
exports.onBundleResult = onBundleResult;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pythnetwork/price-pusher",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.0",
|
|
4
4
|
"description": "Pyth Price Pusher",
|
|
5
5
|
"homepage": "https://pyth.network",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -72,11 +72,11 @@
|
|
|
72
72
|
"yargs": "^17.5.1",
|
|
73
73
|
"@pythnetwork/price-service-sdk": "^1.8.0",
|
|
74
74
|
"@pythnetwork/pyth-fuel-js": "1.0.7",
|
|
75
|
-
"@pythnetwork/pyth-
|
|
76
|
-
"@pythnetwork/pyth-solana-receiver": "0.11.0",
|
|
75
|
+
"@pythnetwork/pyth-solana-receiver": "0.12.0",
|
|
77
76
|
"@pythnetwork/pyth-sui-js": "2.2.0",
|
|
77
|
+
"@pythnetwork/solana-utils": "0.5.0",
|
|
78
78
|
"@pythnetwork/pyth-ton-js": "0.1.2",
|
|
79
|
-
"@pythnetwork/
|
|
79
|
+
"@pythnetwork/pyth-sdk-solidity": "4.2.0"
|
|
80
80
|
},
|
|
81
81
|
"scripts": {
|
|
82
82
|
"build": "tsc",
|