@pythnetwork/price-pusher 9.2.0 → 9.3.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"balance-tracker.d.ts","sourceRoot":"","sources":["../../src/aptos/balance-tracker.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,EAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,wBAAwB;IACzE,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,kBAAkB;IACzD,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAS;gBAEb,MAAM,EAAE,yBAAyB;IAY7C;;;OAGG;cACa,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;CAkC/C;AAED;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,iBAAiB,CAAC;IAClC,OAAO,EAAE,kBAAkB,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,+BAA+B,GACtC,eAAe,CAUjB"}
1
+ {"version":3,"file":"balance-tracker.d.ts","sourceRoot":"","sources":["../../src/aptos/balance-tracker.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,EAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,wBAAwB;IACzE,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,kBAAkB;IACzD,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAS;gBAEb,MAAM,EAAE,yBAAyB;IAa7C;;;OAGG;cACa,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;CA8B/C;AAED;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,iBAAiB,CAAC;IAClC,OAAO,EAAE,kBAAkB,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,+BAA+B,GACtC,eAAe,CAUjB"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AptosBalanceTracker = void 0;
4
4
  exports.createAptosBalanceTracker = createAptosBalanceTracker;
5
- const aptos_1 = require("aptos");
5
+ const ts_sdk_1 = require("@aptos-labs/ts-sdk");
6
6
  const interface_1 = require("../interface");
7
7
  /**
8
8
  * Aptos-specific implementation of the balance tracker
@@ -16,7 +16,7 @@ class AptosBalanceTracker extends interface_1.BaseBalanceTracker {
16
16
  ...config,
17
17
  logger: config.logger.child({ module: "AptosBalanceTracker" }),
18
18
  });
19
- this.client = new aptos_1.AptosClient(config.endpoint);
19
+ this.client = new ts_sdk_1.Aptos(new ts_sdk_1.AptosConfig({ network: ts_sdk_1.Network.CUSTOM, fullnode: config.endpoint }));
20
20
  this.aptosAddress = config.address;
21
21
  // APT has 8 decimal places by default
22
22
  this.decimals = config.decimals ?? 8;
@@ -28,11 +28,11 @@ class AptosBalanceTracker extends interface_1.BaseBalanceTracker {
28
28
  async updateBalance() {
29
29
  try {
30
30
  // Get account resource to check the balance
31
- const accountResource = await this.client.getAccountResource(this.aptosAddress, "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>");
32
- // Extract the balance value from the account resource
33
- const rawBalance = accountResource.data.coin.value;
34
- // Convert the balance to a bigint
35
- const balance = BigInt(rawBalance);
31
+ const accountAPTAmount = await this.client.getAccountAPTAmount({
32
+ accountAddress: this.aptosAddress,
33
+ });
34
+ // Convert the amount to a bigint
35
+ const balance = BigInt(accountAPTAmount);
36
36
  // Calculate the normalized balance for display
37
37
  const normalizedBalance = Number(balance) / Math.pow(10, this.decimals);
38
38
  // Update metrics with the new balance
@@ -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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;QACpC,OAAO,CAAC,EAAE,kBAAkB,CAAC;KAC9B;IASG,KAAK;CAsIZ"}
package/lib/controller.js CHANGED
@@ -41,9 +41,8 @@ class Controller {
41
41
  const alias = priceConfig.alias;
42
42
  const targetLatestPrice = this.targetPriceListener.getLatestPriceInfo(priceId);
43
43
  const sourceLatestPrice = this.sourcePriceListener.getLatestPriceInfo(priceId);
44
- // Update metrics for the last published time if available
45
- if (this.metrics && targetLatestPrice) {
46
- this.metrics.updateLastPublishedTime(priceId, alias, targetLatestPrice);
44
+ if (this.metrics && targetLatestPrice && sourceLatestPrice) {
45
+ this.metrics.updateTimestamps(priceId, alias, targetLatestPrice.publishTime, sourceLatestPrice.publishTime, priceConfig.timeDifference);
47
46
  }
48
47
  const priceShouldUpdate = (0, price_config_1.shouldUpdate)(priceConfig, sourceLatestPrice, targetLatestPrice, this.logger);
49
48
  // Record update condition in metrics
package/lib/index.js CHANGED
File without changes
@@ -1,7 +1,13 @@
1
1
  import { HexString, HermesClient } from "@pythnetwork/hermes-client";
2
- import { IPricePusher, PriceInfo, ChainPriceListener, PriceItem } from "../interface";
2
+ import { PriceItem, PriceInfo, IPricePusher, ChainPriceListener } from "../interface";
3
3
  import { DurationInSeconds } from "../utils";
4
4
  import { Logger } from "pino";
5
+ type InjectiveConfig = {
6
+ chainId: string;
7
+ gasMultiplier: number;
8
+ gasPrice: number;
9
+ priceIdsProcessChunkSize: number;
10
+ };
5
11
  export declare class InjectivePriceListener extends ChainPriceListener {
6
12
  private pythContractAddress;
7
13
  private grpcEndpoint;
@@ -11,26 +17,34 @@ export declare class InjectivePriceListener extends ChainPriceListener {
11
17
  });
12
18
  getOnChainPriceInfo(priceId: HexString): Promise<PriceInfo | undefined>;
13
19
  }
14
- type InjectiveConfig = {
15
- chainId: string;
16
- gasMultiplier: number;
17
- gasPrice: number;
18
- priceIdsProcessChunkSize: number;
19
- };
20
20
  export declare class InjectivePricePusher implements IPricePusher {
21
21
  private hermesClient;
22
22
  private pythContractAddress;
23
23
  private grpcEndpoint;
24
24
  private logger;
25
- private wallet;
25
+ private mnemonic;
26
26
  private chainConfig;
27
- private account;
27
+ private accounts; /** { address: Account } */
28
28
  constructor(hermesClient: HermesClient, pythContractAddress: string, grpcEndpoint: string, logger: Logger, mnemonic: string, chainConfig?: Partial<InjectiveConfig>);
29
- private injectiveAddress;
29
+ private getWallet;
30
30
  private signAndBroadcastMsg;
31
- getPriceFeedUpdateObject(priceIds: string[]): Promise<any>;
32
31
  updatePriceFeed(priceIds: string[], pubTimesToPush: number[]): Promise<void>;
33
32
  private updatePriceFeedChunk;
33
+ /**
34
+ * Get the fee for the transaction (using simulation).
35
+ *
36
+ * We also apply a multiplier to the gas used to apply a small
37
+ * buffer to the gas that'll be used.
38
+ */
39
+ private getStdFee;
40
+ /**
41
+ * Get the latest VAAs for updatePriceFeed and then push them
42
+ */
43
+ private getPriceFeedUpdateObject;
44
+ /**
45
+ * Get the update fee for the given VAAs (i.e the fee that is paid to the pyth contract)
46
+ */
47
+ private getUpdateFee;
34
48
  }
35
49
  export {};
36
50
  //# 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;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,EA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C;;OAEG;YACW,YAAY;CAwB3B"}
@@ -45,15 +45,15 @@ class InjectivePricePusher {
45
45
  pythContractAddress;
46
46
  grpcEndpoint;
47
47
  logger;
48
- wallet;
48
+ mnemonic;
49
49
  chainConfig;
50
- account = null;
50
+ accounts = {}; /** { address: Account } */
51
51
  constructor(hermesClient, pythContractAddress, grpcEndpoint, logger, mnemonic, chainConfig) {
52
52
  this.hermesClient = hermesClient;
53
53
  this.pythContractAddress = pythContractAddress;
54
54
  this.grpcEndpoint = grpcEndpoint;
55
55
  this.logger = logger;
56
- this.wallet = sdk_ts_1.PrivateKey.fromMnemonic(mnemonic);
56
+ this.mnemonic = mnemonic;
57
57
  this.chainConfig = {
58
58
  chainId: chainConfig?.chainId ?? INJECTIVE_TESTNET_CHAIN_ID,
59
59
  gasMultiplier: chainConfig?.gasMultiplier ?? DEFAULT_GAS_MULTIPLIER,
@@ -62,74 +62,46 @@ class InjectivePricePusher {
62
62
  DEFAULT_PRICE_IDS_PROCESS_CHUNK_SIZE,
63
63
  };
64
64
  }
65
- injectiveAddress() {
66
- return this.wallet.toBech32();
65
+ getWallet(index) {
66
+ if (this.chainConfig.priceIdsProcessChunkSize === -1 ||
67
+ this.chainConfig.priceIdsProcessChunkSize === undefined) {
68
+ return sdk_ts_1.PrivateKey.fromMnemonic(this.mnemonic);
69
+ }
70
+ return sdk_ts_1.PrivateKey.fromMnemonic(this.mnemonic, `m/44'/60'/0'/0/${index}`);
67
71
  }
68
- async signAndBroadcastMsg(msg) {
72
+ async signAndBroadcastMsg(msg, index) {
69
73
  const chainGrpcAuthApi = new sdk_ts_1.ChainGrpcAuthApi(this.grpcEndpoint);
74
+ const wallet = this.getWallet(index);
75
+ const injectiveAddress = wallet.toAddress().toBech32();
70
76
  // Fetch the latest account details only if it's not stored.
71
- this.account ??= await chainGrpcAuthApi.fetchAccount(this.injectiveAddress());
72
- const { txRaw: simulateTxRaw } = (0, sdk_ts_1.createTransactionFromMsg)({
73
- sequence: this.account.baseAccount.sequence,
74
- accountNumber: this.account.baseAccount.accountNumber,
75
- message: msg,
76
- chainId: this.chainConfig.chainId,
77
- pubKey: this.wallet.toPublicKey().toBase64(),
78
- });
79
- const txService = new sdk_ts_1.TxGrpcApi(this.grpcEndpoint);
80
- // simulation
77
+ this.accounts[injectiveAddress] ??=
78
+ await chainGrpcAuthApi.fetchAccount(injectiveAddress);
79
+ const account = this.accounts[injectiveAddress];
81
80
  try {
82
- const { gasInfo: { gasUsed }, } = await txService.simulate(simulateTxRaw);
83
- // simulation returns us the approximate gas used
84
- // gas passed with the transaction should be more than that
85
- // in order for it to be successfully executed
86
- // this multiplier takes care of that
87
- const gas = (gasUsed * this.chainConfig.gasMultiplier).toFixed();
88
- const fee = {
89
- amount: [
90
- {
91
- denom: "inj",
92
- amount: (Number(gas) * this.chainConfig.gasPrice).toFixed(),
93
- },
94
- ],
95
- gas,
96
- };
97
81
  const { signBytes, txRaw } = (0, sdk_ts_1.createTransactionFromMsg)({
98
- sequence: this.account.baseAccount.sequence,
99
- accountNumber: this.account.baseAccount.accountNumber,
82
+ sequence: account.baseAccount.sequence,
83
+ accountNumber: account.baseAccount.accountNumber,
100
84
  message: msg,
101
85
  chainId: this.chainConfig.chainId,
102
- fee,
103
- pubKey: this.wallet.toPublicKey().toBase64(),
86
+ fee: await this.getStdFee(msg, index),
87
+ pubKey: wallet.toPublicKey().toBase64(),
104
88
  });
105
- const sig = await this.wallet.sign(Buffer.from(signBytes));
106
- this.account.baseAccount.sequence++;
89
+ const sig = await wallet.sign(Buffer.from(signBytes));
107
90
  /** Append Signatures */
108
91
  txRaw.signatures = [sig];
109
92
  // this takes approx 5 seconds
110
- const txResponse = await txService.broadcast(txRaw);
93
+ const txResponse = await new sdk_ts_1.TxGrpcApi(this.grpcEndpoint).broadcast(txRaw);
94
+ account.baseAccount.sequence++;
111
95
  return txResponse;
112
96
  }
113
97
  catch (e) {
114
- // The sequence number was invalid and hence we will have to fetch it again.
98
+ // The sequence number was invalid and hence we will have to fetch it again
115
99
  if (JSON.stringify(e).match(/account sequence mismatch/) !== null) {
116
- // We need to fetch the account details again.
117
- this.account = null;
100
+ this.accounts[injectiveAddress] = undefined;
118
101
  }
119
102
  throw e;
120
103
  }
121
104
  }
122
- async getPriceFeedUpdateObject(priceIds) {
123
- const response = await this.hermesClient.getLatestPriceUpdates(priceIds, {
124
- encoding: "base64",
125
- });
126
- const vaas = response.binary.data;
127
- return {
128
- update_price_feeds: {
129
- data: vaas,
130
- },
131
- };
132
- }
133
105
  async updatePriceFeed(priceIds, pubTimesToPush) {
134
106
  if (priceIds.length === 0) {
135
107
  return;
@@ -140,46 +112,22 @@ class InjectivePricePusher {
140
112
  ? [priceIds]
141
113
  : (0, utils_1.splitArrayToChunks)({
142
114
  array: priceIds,
143
- chunkSize: this.chainConfig.priceIdsProcessChunkSize,
115
+ chunkSize: Number(this.chainConfig.priceIdsProcessChunkSize),
144
116
  });
145
- for (const [chunkIndex, priceIdChunk] of priceIdChunks.entries()) {
146
- await this.updatePriceFeedChunk(priceIdChunk, chunkIndex);
147
- }
117
+ await Promise.all(priceIdChunks.map((priceIdChunk, chunkIndex) => this.updatePriceFeedChunk(priceIdChunk, chunkIndex)));
148
118
  }
149
119
  async updatePriceFeedChunk(priceIds, chunkIndex) {
150
- let priceFeedUpdateObject;
151
120
  try {
152
- // get the latest VAAs for updatePriceFeed and then push them
153
- priceFeedUpdateObject = await this.getPriceFeedUpdateObject(priceIds);
154
- }
155
- catch (err) {
156
- this.logger.error(err, `Error fetching the latest vaas to push for chunk ${chunkIndex}`);
157
- return;
158
- }
159
- let updateFeeQueryResponse;
160
- try {
161
- const api = new sdk_ts_1.ChainGrpcWasmApi(this.grpcEndpoint);
162
- const { data } = await api.fetchSmartContractState(this.pythContractAddress, Buffer.from(JSON.stringify({
163
- get_update_fee: {
164
- vaas: priceFeedUpdateObject.update_price_feeds.data,
165
- },
166
- })).toString("base64"));
167
- const json = Buffer.from(data).toString();
168
- updateFeeQueryResponse = JSON.parse(json);
169
- }
170
- catch (err) {
171
- this.logger.error(err, `Error fetching update fee for chunk ${chunkIndex}`);
172
- // Throwing an error because it is likely an RPC issue
173
- throw err;
174
- }
175
- try {
176
- const executeMsg = sdk_ts_1.MsgExecuteContract.fromJSON({
177
- sender: this.injectiveAddress(),
121
+ const priceFeedUpdateObject = await this.getPriceFeedUpdateObject(priceIds);
122
+ const updateFeeQueryResponse = await this.getUpdateFee(priceFeedUpdateObject.update_price_feeds.data);
123
+ const wallet = this.getWallet(chunkIndex);
124
+ const msg = sdk_ts_1.MsgExecuteContract.fromJSON({
125
+ sender: wallet.toAddress().toBech32(),
178
126
  contractAddress: this.pythContractAddress,
179
127
  msg: priceFeedUpdateObject,
180
128
  funds: [updateFeeQueryResponse],
181
129
  });
182
- const rs = await this.signAndBroadcastMsg(executeMsg);
130
+ const rs = await this.signAndBroadcastMsg(msg, chunkIndex);
183
131
  this.logger.info({ hash: rs.txHash }, `Successfully broadcasted txHash for chunk ${chunkIndex}`);
184
132
  }
185
133
  catch (err) {
@@ -195,5 +143,84 @@ class InjectivePricePusher {
195
143
  this.logger.error(err, `Error executing messages for chunk ${chunkIndex}`);
196
144
  }
197
145
  }
146
+ /**
147
+ * Get the fee for the transaction (using simulation).
148
+ *
149
+ * We also apply a multiplier to the gas used to apply a small
150
+ * buffer to the gas that'll be used.
151
+ */
152
+ async getStdFee(msg, index) {
153
+ const wallet = this.getWallet(index);
154
+ const injectiveAddress = wallet.toAddress().toBech32();
155
+ const account = this.accounts[injectiveAddress];
156
+ if (!account) {
157
+ throw new Error("Account not found");
158
+ }
159
+ const { txRaw: simulateTxRaw } = (0, sdk_ts_1.createTransactionFromMsg)({
160
+ sequence: account.baseAccount.sequence,
161
+ accountNumber: account.baseAccount.accountNumber,
162
+ message: msg,
163
+ chainId: this.chainConfig.chainId,
164
+ pubKey: wallet.toPublicKey().toBase64(),
165
+ });
166
+ try {
167
+ const result = await new sdk_ts_1.TxGrpcApi(this.grpcEndpoint).simulate(simulateTxRaw);
168
+ const gas = (result.gasInfo.gasUsed * this.chainConfig.gasMultiplier).toFixed();
169
+ const fee = {
170
+ amount: [
171
+ {
172
+ denom: "inj",
173
+ amount: (Number(gas) * this.chainConfig.gasPrice).toFixed(),
174
+ },
175
+ ],
176
+ gas,
177
+ };
178
+ return fee;
179
+ }
180
+ catch (err) {
181
+ this.logger.error(err, `Error getting std fee`);
182
+ throw err;
183
+ }
184
+ }
185
+ /**
186
+ * Get the latest VAAs for updatePriceFeed and then push them
187
+ */
188
+ async getPriceFeedUpdateObject(priceIds) {
189
+ try {
190
+ const response = await this.hermesClient.getLatestPriceUpdates(priceIds, {
191
+ encoding: "base64",
192
+ });
193
+ const vaas = response.binary.data;
194
+ return {
195
+ update_price_feeds: {
196
+ data: vaas,
197
+ },
198
+ };
199
+ }
200
+ catch (err) {
201
+ this.logger.error(err, `Error fetching the latest vaas to push`);
202
+ throw err;
203
+ }
204
+ }
205
+ /**
206
+ * Get the update fee for the given VAAs (i.e the fee that is paid to the pyth contract)
207
+ */
208
+ async getUpdateFee(vaas) {
209
+ try {
210
+ const api = new sdk_ts_1.ChainGrpcWasmApi(this.grpcEndpoint);
211
+ const { data } = await api.fetchSmartContractState(this.pythContractAddress, Buffer.from(JSON.stringify({
212
+ get_update_fee: {
213
+ vaas,
214
+ },
215
+ })).toString("base64"));
216
+ const json = Buffer.from(data).toString();
217
+ return JSON.parse(json);
218
+ }
219
+ catch (err) {
220
+ this.logger.error(err, `Error fetching update fee.`);
221
+ // Throwing an error because it is likely an RPC issue
222
+ throw err;
223
+ }
224
+ }
198
225
  }
199
226
  exports.InjectivePricePusher = InjectivePricePusher;
package/lib/metrics.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Counter, Gauge } from "prom-client";
2
- import { PriceInfo } from "./interface";
3
2
  import { Logger } from "pino";
4
3
  import { UpdateCondition } from "./price-config";
5
4
  export declare class PricePusherMetrics {
@@ -9,14 +8,16 @@ export declare class PricePusherMetrics {
9
8
  lastPublishedTime: Gauge<string>;
10
9
  priceUpdateAttempts: Counter<string>;
11
10
  priceFeedsTotal: Gauge<string>;
11
+ sourceTimestamp: Gauge<string>;
12
+ configuredTimeDifference: Gauge<string>;
12
13
  walletBalance: Gauge<string>;
13
14
  constructor(logger: Logger);
14
15
  start(port: number): void;
15
- updateLastPublishedTime(priceId: string, alias: string, priceInfo: PriceInfo): void;
16
16
  recordPriceUpdate(priceId: string, alias: string, trigger?: string): void;
17
17
  recordUpdateCondition(priceId: string, alias: string, condition: UpdateCondition): void;
18
18
  recordPriceUpdateError(priceId: string, alias: string, trigger?: string): void;
19
19
  setPriceFeedsTotal(count: number): void;
20
+ updateTimestamps(priceId: string, alias: string, targetLatestPricePublishTime: number, sourceLatestPricePublishTime: number, priceConfigTimeDifference: number): void;
20
21
  updateWalletBalance(walletAddress: string, network: string, balance: bigint | number): void;
21
22
  }
22
23
  //# sourceMappingURL=metrics.d.ts.map
@@ -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,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,IAA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AC;gBAExB,MAAM,EAAE,MAAM;IA2DnB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAOzB,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,gBAAgB,CACrB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,4BAA4B,EAAE,MAAM,EACpC,4BAA4B,EAAE,MAAM,EACpC,yBAAyB,EAAE,MAAM,GAChC,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
@@ -16,6 +16,8 @@ class PricePusherMetrics {
16
16
  lastPublishedTime;
17
17
  priceUpdateAttempts;
18
18
  priceFeedsTotal;
19
+ sourceTimestamp;
20
+ configuredTimeDifference;
19
21
  // Wallet metrics
20
22
  walletBalance;
21
23
  constructor(logger) {
@@ -42,6 +44,18 @@ class PricePusherMetrics {
42
44
  help: "Total number of price feeds being monitored",
43
45
  registers: [this.registry],
44
46
  });
47
+ this.sourceTimestamp = new prom_client_1.Gauge({
48
+ name: "pyth_source_timestamp",
49
+ help: "Latest source chain price publish timestamp",
50
+ labelNames: ["price_id", "alias"],
51
+ registers: [this.registry],
52
+ });
53
+ this.configuredTimeDifference = new prom_client_1.Gauge({
54
+ name: "pyth_configured_time_difference",
55
+ help: "Configured time difference threshold between source and target chains",
56
+ labelNames: ["price_id", "alias"],
57
+ registers: [this.registry],
58
+ });
45
59
  // Wallet balance metric
46
60
  this.walletBalance = new prom_client_1.Gauge({
47
61
  name: "pyth_wallet_balance",
@@ -61,10 +75,6 @@ class PricePusherMetrics {
61
75
  this.logger.info(`Metrics server started on port ${port}`);
62
76
  });
63
77
  }
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
78
  // Record a successful price update
69
79
  recordPriceUpdate(priceId, alias, trigger = "yes") {
70
80
  this.priceUpdateAttempts.inc({
@@ -102,6 +112,12 @@ class PricePusherMetrics {
102
112
  setPriceFeedsTotal(count) {
103
113
  this.priceFeedsTotal.set(count);
104
114
  }
115
+ // Update source, target and configured time difference timestamps
116
+ updateTimestamps(priceId, alias, targetLatestPricePublishTime, sourceLatestPricePublishTime, priceConfigTimeDifference) {
117
+ this.sourceTimestamp.set({ price_id: priceId, alias }, sourceLatestPricePublishTime);
118
+ this.lastPublishedTime.set({ price_id: priceId, alias }, targetLatestPricePublishTime);
119
+ this.configuredTimeDifference.set({ price_id: priceId, alias }, priceConfigTimeDifference);
120
+ }
105
121
  // Update wallet balance
106
122
  updateWalletBalance(walletAddress, network, balance) {
107
123
  // Convert to number for compatibility with prometheus
@@ -1 +1 @@
1
- {"version":3,"file":"balance-tracker.d.ts","sourceRoot":"","sources":["../../src/sui/balance-tracker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,EAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,wBAAwB;IACv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C;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,iBAAiB,CAAC;IAClC,OAAO,EAAE,kBAAkB,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,6BAA6B,GACpC,eAAe,CASjB"}
@@ -20,16 +20,11 @@ class SuiBalanceTracker extends interface_1.BaseBalanceTracker {
20
20
  */
21
21
  async updateBalance() {
22
22
  try {
23
- // Get all coins owned by the address
24
- const { data: coins } = await this.client.getCoins({
23
+ const balance = await this.client.getBalance({
25
24
  owner: this.address,
26
25
  });
27
- // Sum up all coin balances
28
- const totalBalance = coins.reduce((acc, coin) => {
29
- return acc + BigInt(coin.balance);
30
- }, BigInt(0));
31
26
  // Convert to a normalized number for reporting (SUI has 9 decimals)
32
- const normalizedBalance = Number(totalBalance) / 1e9;
27
+ const normalizedBalance = Number(balance.totalBalance) / 1e9;
33
28
  this.metrics.updateWalletBalance(this.address, this.network, normalizedBalance);
34
29
  this.logger.debug(`Updated Sui wallet balance: ${this.address} = ${normalizedBalance} SUI`);
35
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pythnetwork/price-pusher",
3
- "version": "9.2.0",
3
+ "version": "9.3.3",
4
4
  "description": "Pyth Price Pusher",
5
5
  "homepage": "https://pyth.network",
6
6
  "main": "lib/index.js",
@@ -19,18 +19,6 @@
19
19
  "publishConfig": {
20
20
  "access": "public"
21
21
  },
22
- "scripts": {
23
- "build": "tsc",
24
- "fix:format": "prettier --write \"src/**/*.ts\"",
25
- "fix:lint": "eslint src/ --fix --max-warnings 0",
26
- "test:format": "prettier --check \"src/**/*.ts\"",
27
- "test:lint": "eslint src/ --max-warnings 0",
28
- "start": "node lib/index.js",
29
- "dev": "ts-node src/index.ts",
30
- "prepublishOnly": "pnpm run build && pnpm run test:lint",
31
- "preversion": "pnpm run test:lint",
32
- "version": "pnpm run test:format && pnpm run test:lint && git add -A src"
33
- },
34
22
  "keywords": [
35
23
  "pyth",
36
24
  "oracle",
@@ -53,25 +41,19 @@
53
41
  "eslint": "^8.13.0",
54
42
  "jest": "^29.7.0",
55
43
  "pino-pretty": "^11.2.1",
56
- "prettier": "catalog:",
44
+ "prettier": "^3.5.3",
57
45
  "ts-jest": "^29.1.1",
58
- "ts-node": "catalog:",
59
- "typescript": "catalog:"
46
+ "ts-node": "^10.9.2",
47
+ "typescript": "^5.8.2"
60
48
  },
61
49
  "dependencies": {
50
+ "@aptos-labs/ts-sdk": "^1.39.0",
62
51
  "@coral-xyz/anchor": "^0.30.0",
63
52
  "@injectivelabs/networks": "1.14.47",
64
- "@injectivelabs/sdk-ts": "1.14.49",
65
- "@injectivelabs/utils": "^1.14.47",
53
+ "@injectivelabs/sdk-ts": "1.14.50",
54
+ "@injectivelabs/utils": "^1.14.48",
66
55
  "@mysten/sui": "^1.3.0",
67
56
  "@pythnetwork/hermes-client": "^1.3.1",
68
- "@pythnetwork/price-service-sdk": "^1.8.0",
69
- "@pythnetwork/pyth-fuel-js": "1.0.7",
70
- "@pythnetwork/pyth-sdk-solidity": "4.0.0",
71
- "@pythnetwork/pyth-solana-receiver": "0.10.0",
72
- "@pythnetwork/pyth-sui-js": "2.1.0",
73
- "@pythnetwork/pyth-ton-js": "0.1.2",
74
- "@pythnetwork/solana-utils": "0.4.4",
75
57
  "@solana/web3.js": "^1.93.0",
76
58
  "@ton/core": "^0.59.0",
77
59
  "@ton/crypto": "^3.3.0",
@@ -87,7 +69,24 @@
87
69
  "prom-client": "^15.1.0",
88
70
  "viem": "^2.19.4",
89
71
  "yaml": "^2.1.1",
90
- "yargs": "^17.5.1"
72
+ "yargs": "^17.5.1",
73
+ "@pythnetwork/pyth-fuel-js": "1.0.7",
74
+ "@pythnetwork/price-service-sdk": "^1.8.0",
75
+ "@pythnetwork/pyth-solana-receiver": "0.10.1",
76
+ "@pythnetwork/pyth-sdk-solidity": "4.1.0",
77
+ "@pythnetwork/pyth-ton-js": "0.1.2",
78
+ "@pythnetwork/pyth-sui-js": "2.1.0",
79
+ "@pythnetwork/solana-utils": "0.4.4"
91
80
  },
92
- "gitHead": "da6c1185d9fce5e6ca2df4f7e6e1f5edc9b366eb"
93
- }
81
+ "scripts": {
82
+ "build": "tsc",
83
+ "fix:format": "prettier --write \"src/**/*.ts\"",
84
+ "fix:lint": "eslint src/ --fix --max-warnings 0",
85
+ "test:format": "prettier --check \"src/**/*.ts\"",
86
+ "test:lint": "eslint src/ --max-warnings 0",
87
+ "start": "node lib/index.js",
88
+ "dev": "ts-node src/index.ts",
89
+ "preversion": "pnpm run test:lint",
90
+ "version": "pnpm run test:format && pnpm run test:lint && git add -A src"
91
+ }
92
+ }