@pythnetwork/price-pusher 10.3.1 → 10.4.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.
Files changed (52) hide show
  1. package/README.md +3 -1
  2. package/dist/aptos/aptos.cjs +7 -7
  3. package/dist/aptos/aptos.d.ts +1 -1
  4. package/dist/aptos/balance-tracker.cjs +7 -7
  5. package/dist/aptos/balance-tracker.d.ts +1 -1
  6. package/dist/aptos/command.cjs +20 -17
  7. package/dist/aptos/command.d.ts +3 -2
  8. package/dist/controller.cjs +2 -2
  9. package/dist/controller.d.ts +1 -1
  10. package/dist/evm/balance-tracker.cjs +4 -4
  11. package/dist/evm/balance-tracker.d.ts +2 -2
  12. package/dist/evm/command.cjs +46 -43
  13. package/dist/evm/command.d.ts +7 -6
  14. package/dist/evm/evm.cjs +7 -7
  15. package/dist/evm/evm.d.ts +3 -4
  16. package/dist/evm/pyth-contract.cjs +2 -2
  17. package/dist/evm/super-wallet.cjs +4 -4
  18. package/dist/evm/super-wallet.d.ts +1 -1
  19. package/dist/fuel/command.cjs +17 -14
  20. package/dist/fuel/command.d.ts +3 -2
  21. package/dist/fuel/fuel.d.ts +2 -2
  22. package/dist/injective/command.cjs +26 -23
  23. package/dist/injective/command.d.ts +5 -4
  24. package/dist/injective/injective.cjs +11 -11
  25. package/dist/injective/injective.d.ts +2 -3
  26. package/dist/interface.d.ts +1 -1
  27. package/dist/metrics.cjs +29 -29
  28. package/dist/near/command.cjs +22 -19
  29. package/dist/near/command.d.ts +5 -4
  30. package/dist/near/near.cjs +17 -16
  31. package/dist/near/near.d.ts +1 -1
  32. package/dist/options.cjs +36 -26
  33. package/dist/options.d.ts +3 -0
  34. package/dist/price-config.cjs +13 -13
  35. package/dist/pyth-price-listener.cjs +2 -2
  36. package/dist/pyth-price-listener.d.ts +2 -3
  37. package/dist/solana/balance-tracker.cjs +5 -5
  38. package/dist/solana/balance-tracker.d.ts +2 -2
  39. package/dist/solana/command.cjs +75 -60
  40. package/dist/solana/command.d.ts +13 -10
  41. package/dist/solana/solana.d.ts +4 -4
  42. package/dist/sui/balance-tracker.cjs +4 -4
  43. package/dist/sui/balance-tracker.d.ts +2 -2
  44. package/dist/sui/command.cjs +42 -39
  45. package/dist/sui/command.d.ts +7 -6
  46. package/dist/sui/sui.cjs +14 -14
  47. package/dist/sui/sui.d.ts +2 -2
  48. package/dist/ton/command.cjs +17 -14
  49. package/dist/ton/command.d.ts +3 -2
  50. package/dist/ton/ton.d.ts +2 -3
  51. package/dist/utils.d.ts +1 -2
  52. package/package.json +119 -130
@@ -1,18 +1,19 @@
1
1
  import type { Options } from "yargs";
2
2
  declare const _default: {
3
- command: string;
4
- describe: string;
5
3
  builder: {
6
4
  "controller-log-level": Options;
7
5
  "log-level": Options;
8
6
  "polling-frequency": Options;
9
7
  "pushing-frequency": Options;
8
+ "hermes-access-token": Options;
10
9
  "price-service-endpoint": Options;
11
10
  "price-config-file": Options;
12
11
  endpoint: Options;
13
12
  "private-key-file": Options;
14
13
  "pyth-contract-address": Options;
15
14
  };
15
+ command: string;
16
+ describe: string;
16
17
  handler: (argv: any) => Promise<void>;
17
18
  };
18
19
  export default _default;
@@ -1,5 +1,5 @@
1
- import { HermesClient } from "@pythnetwork/hermes-client";
2
- import { Provider, Wallet } from "fuels";
1
+ import type { HermesClient } from "@pythnetwork/hermes-client";
2
+ import type { Provider, Wallet } from "fuels";
3
3
  import type { Logger } from "pino";
4
4
  import type { IPricePusher, PriceInfo, PriceItem } from "../interface.js";
5
5
  import { ChainPriceListener } from "../interface.js";
@@ -12,12 +12,12 @@ const _nodefs = /*#__PURE__*/ _interop_require_default(require("node:fs"));
12
12
  const _networks = require("@injectivelabs/networks");
13
13
  const _hermesclient = require("@pythnetwork/hermes-client");
14
14
  const _pino = require("pino");
15
+ const _controller = require("../controller.cjs");
15
16
  const _options = /*#__PURE__*/ _interop_require_wildcard(require("../options.cjs"));
16
17
  const _priceconfig = require("../price-config.cjs");
17
- const _injective = require("./injective.cjs");
18
- const _controller = require("../controller.cjs");
19
18
  const _pythpricelistener = require("../pyth-price-listener.cjs");
20
19
  const _utils = require("../utils.cjs");
20
+ const _injective = require("./injective.cjs");
21
21
  function _interop_require_default(obj) {
22
22
  return obj && obj.__esModule ? obj : {
23
23
  default: obj
@@ -65,34 +65,33 @@ function _interop_require_wildcard(obj, nodeInterop) {
65
65
  return newObj;
66
66
  }
67
67
  const _default = {
68
- command: "injective",
69
- describe: "run price pusher for injective",
70
68
  builder: {
71
- "grpc-endpoint": {
72
- description: "gRPC endpoint URL for injective. The pusher will periodically" + "poll for updates. The polling interval is configurable via the " + "`polling-frequency` command-line argument.",
73
- type: "string",
74
- required: true
75
- },
76
- network: {
77
- description: "testnet or mainnet",
78
- type: "string",
79
- required: true
69
+ "gas-multiplier": {
70
+ description: "Gas multiplier to be used for each transaction",
71
+ type: "number"
80
72
  },
81
73
  "gas-price": {
82
74
  description: "Gas price to be used for each transaction",
83
75
  type: "number"
84
76
  },
85
- "gas-multiplier": {
86
- description: "Gas multiplier to be used for each transaction",
87
- type: "number"
77
+ "grpc-endpoint": {
78
+ description: "gRPC endpoint URL for injective. The pusher will periodically" + "poll for updates. The polling interval is configurable via the " + "`polling-frequency` command-line argument.",
79
+ required: true,
80
+ type: "string"
81
+ },
82
+ network: {
83
+ description: "testnet or mainnet",
84
+ required: true,
85
+ type: "string"
88
86
  },
89
87
  "price-ids-process-chunk-size": {
90
88
  description: "Set in case we wanna split price feeds updates into chunks to have smaller transactions. Set to -1 to disable chunking.",
91
- type: "number",
92
- required: false
89
+ required: false,
90
+ type: "number"
93
91
  },
94
92
  ..._options.priceConfigFile,
95
93
  ..._options.priceServiceEndpoint,
94
+ ..._options.hermesAccessToken,
96
95
  ..._options.mnemonicFile,
97
96
  ..._options.pythContractAddress,
98
97
  ..._options.pollingFrequency,
@@ -100,9 +99,11 @@ const _default = {
100
99
  ..._options.logLevel,
101
100
  ..._options.controllerLogLevel
102
101
  },
102
+ command: "injective",
103
+ describe: "run price pusher for injective",
103
104
  handler: async function(argv) {
104
105
  // FIXME: type checks for this
105
- const { network, logLevel, gasPrice, grpcEndpoint, mnemonicFile, gasMultiplier, priceConfigFile, pollingFrequency, pushingFrequency, controllerLogLevel, pythContractAddress, priceServiceEndpoint, priceIdsProcessChunkSize } = argv;
106
+ const { network, logLevel, gasPrice, grpcEndpoint, mnemonicFile, gasMultiplier, priceConfigFile, pollingFrequency, pushingFrequency, controllerLogLevel, pythContractAddress, priceServiceEndpoint, hermesAccessToken, priceIdsProcessChunkSize } = argv;
106
107
  const logger = (0, _pino.pino)({
107
108
  level: logLevel
108
109
  });
@@ -110,11 +111,13 @@ const _default = {
110
111
  throw new Error("Please specify network. One of [testnet, mainnet]");
111
112
  }
112
113
  const priceConfigs = (0, _priceconfig.readPriceConfigFile)(priceConfigFile);
113
- const hermesClient = new _hermesclient.HermesClient(priceServiceEndpoint);
114
+ const hermesClient = new _hermesclient.HermesClient(priceServiceEndpoint, {
115
+ accessToken: hermesAccessToken
116
+ });
114
117
  const mnemonic = _nodefs.default.readFileSync(mnemonicFile, "utf8").trim();
115
118
  let priceItems = priceConfigs.map(({ id, alias })=>({
116
- id,
117
- alias
119
+ alias,
120
+ id
118
121
  }));
119
122
  // Better to filter out invalid price items before creating the pyth listener
120
123
  const { existingPriceItems, invalidPriceItems } = await (0, _utils.filterInvalidPriceItems)(hermesClient, priceItems);
@@ -134,8 +137,8 @@ const _default = {
134
137
  module: "InjectivePricePusher"
135
138
  }), mnemonic, {
136
139
  chainId: (0, _networks.getNetworkInfo)(network).chainId,
137
- gasPrice,
138
140
  gasMultiplier,
141
+ gasPrice,
139
142
  priceIdsProcessChunkSize
140
143
  });
141
144
  const controller = new _controller.Controller(priceConfigs, pythListener, injectiveListener, injectivePusher, logger.child({
@@ -1,7 +1,5 @@
1
1
  import type { Options } from "yargs";
2
2
  declare const _default: {
3
- command: string;
4
- describe: string;
5
3
  builder: {
6
4
  "controller-log-level": Options;
7
5
  "log-level": Options;
@@ -9,14 +7,17 @@ declare const _default: {
9
7
  "polling-frequency": Options;
10
8
  "pyth-contract-address": Options;
11
9
  "mnemonic-file": Options;
10
+ "hermes-access-token": Options;
12
11
  "price-service-endpoint": Options;
13
12
  "price-config-file": Options;
13
+ "gas-multiplier": Options;
14
+ "gas-price": Options;
14
15
  "grpc-endpoint": Options;
15
16
  network: Options;
16
- "gas-price": Options;
17
- "gas-multiplier": Options;
18
17
  "price-ids-process-chunk-size": Options;
19
18
  };
19
+ command: string;
20
+ describe: string;
20
21
  handler: (argv: any) => Promise<void>;
21
22
  };
22
23
  export default _default;
@@ -85,12 +85,12 @@ class InjectivePricePusher {
85
85
  const account = this.accounts[injectiveAddress];
86
86
  try {
87
87
  const { signBytes, txRaw } = (0, _sdkts.createTransactionFromMsg)({
88
- sequence: account.baseAccount.sequence,
89
88
  accountNumber: account.baseAccount.accountNumber,
90
- message: msg,
91
89
  chainId: this.chainConfig.chainId,
92
90
  fee: await this.getStdFee(msg, index),
93
- pubKey: wallet.toPublicKey().toBase64()
91
+ message: msg,
92
+ pubKey: wallet.toPublicKey().toBase64(),
93
+ sequence: account.baseAccount.sequence
94
94
  });
95
95
  // eslint-disable-next-line @typescript-eslint/await-thenable
96
96
  const sig = await wallet.sign(Buffer.from(signBytes));
@@ -128,12 +128,12 @@ class InjectivePricePusher {
128
128
  const updateFeeQueryResponse = await this.getUpdateFee(priceFeedUpdateObject.update_price_feeds.data);
129
129
  const wallet = this.getWallet(chunkIndex);
130
130
  const msg = _sdkts.MsgExecuteContract.fromJSON({
131
- sender: wallet.toAddress().toBech32(),
132
131
  contractAddress: this.pythContractAddress,
133
- msg: priceFeedUpdateObject,
134
132
  funds: [
135
133
  updateFeeQueryResponse
136
- ]
134
+ ],
135
+ msg: priceFeedUpdateObject,
136
+ sender: wallet.toAddress().toBech32()
137
137
  });
138
138
  const rs = await this.signAndBroadcastMsg(msg, chunkIndex);
139
139
  this.logger.info({
@@ -164,11 +164,11 @@ class InjectivePricePusher {
164
164
  throw new Error("Account not found");
165
165
  }
166
166
  const { txRaw: simulateTxRaw } = (0, _sdkts.createTransactionFromMsg)({
167
- sequence: account.baseAccount.sequence,
168
167
  accountNumber: account.baseAccount.accountNumber,
169
- message: msg,
170
168
  chainId: this.chainConfig.chainId,
171
- pubKey: wallet.toPublicKey().toBase64()
169
+ message: msg,
170
+ pubKey: wallet.toPublicKey().toBase64(),
171
+ sequence: account.baseAccount.sequence
172
172
  });
173
173
  try {
174
174
  const result = await new _sdkts.TxGrpcApi(this.grpcEndpoint).simulate(simulateTxRaw);
@@ -176,8 +176,8 @@ class InjectivePricePusher {
176
176
  const fee = {
177
177
  amount: [
178
178
  {
179
- denom: "inj",
180
- amount: (Number(gas) * this.chainConfig.gasPrice).toFixed(0)
179
+ amount: (Number(gas) * this.chainConfig.gasPrice).toFixed(0),
180
+ denom: "inj"
181
181
  }
182
182
  ],
183
183
  gas
@@ -1,7 +1,6 @@
1
- import type { HexString } from "@pythnetwork/hermes-client";
2
- import { HermesClient } from "@pythnetwork/hermes-client";
1
+ import type { HermesClient, HexString } from "@pythnetwork/hermes-client";
3
2
  import type { Logger } from "pino";
4
- import type { PriceItem, PriceInfo, IPricePusher } from "../interface.js";
3
+ import type { IPricePusher, PriceInfo, PriceItem } from "../interface.js";
5
4
  import { ChainPriceListener } from "../interface.js";
6
5
  import type { DurationInSeconds } from "../utils.js";
7
6
  type InjectiveConfig = {
@@ -1,6 +1,6 @@
1
1
  import type { HexString, UnixTimestamp } from "@pythnetwork/hermes-client";
2
2
  import type { Logger } from "pino";
3
- import { PricePusherMetrics } from "./metrics.js";
3
+ import type { PricePusherMetrics } from "./metrics.js";
4
4
  import type { DurationInSeconds } from "./utils.js";
5
5
  export type PriceItem = {
6
6
  id: HexString;
package/dist/metrics.cjs CHANGED
@@ -40,18 +40,17 @@ class PricePusherMetrics {
40
40
  });
41
41
  // Create metrics
42
42
  this.lastPublishedTime = new _promclient.Gauge({
43
- name: "pyth_price_last_published_time",
44
43
  help: "The last published time of a price feed in unix timestamp",
45
44
  labelNames: [
46
45
  "price_id",
47
46
  "alias"
48
47
  ],
48
+ name: "pyth_price_last_published_time",
49
49
  registers: [
50
50
  this.registry
51
51
  ]
52
52
  });
53
53
  this.priceUpdateAttempts = new _promclient.Counter({
54
- name: "pyth_price_update_attempts_total",
55
54
  help: "Total number of price update attempts with their trigger condition and status",
56
55
  labelNames: [
57
56
  "price_id",
@@ -59,69 +58,70 @@ class PricePusherMetrics {
59
58
  "trigger",
60
59
  "status"
61
60
  ],
61
+ name: "pyth_price_update_attempts_total",
62
62
  registers: [
63
63
  this.registry
64
64
  ]
65
65
  });
66
66
  this.priceFeedsTotal = new _promclient.Gauge({
67
- name: "pyth_price_feeds_total",
68
67
  help: "Total number of price feeds being monitored",
68
+ name: "pyth_price_feeds_total",
69
69
  registers: [
70
70
  this.registry
71
71
  ]
72
72
  });
73
73
  this.sourceTimestamp = new _promclient.Gauge({
74
- name: "pyth_source_timestamp",
75
74
  help: "Latest source chain price publish timestamp",
76
75
  labelNames: [
77
76
  "price_id",
78
77
  "alias"
79
78
  ],
79
+ name: "pyth_source_timestamp",
80
80
  registers: [
81
81
  this.registry
82
82
  ]
83
83
  });
84
84
  this.configuredTimeDifference = new _promclient.Gauge({
85
- name: "pyth_configured_time_difference",
86
85
  help: "Configured time difference threshold between source and target chains",
87
86
  labelNames: [
88
87
  "price_id",
89
88
  "alias"
90
89
  ],
90
+ name: "pyth_configured_time_difference",
91
91
  registers: [
92
92
  this.registry
93
93
  ]
94
94
  });
95
95
  this.sourcePriceValue = new _promclient.Gauge({
96
- name: "pyth_source_price",
97
96
  help: "Latest price value from Pyth source",
98
97
  labelNames: [
99
98
  "price_id",
100
99
  "alias"
101
100
  ],
101
+ name: "pyth_source_price",
102
102
  registers: [
103
103
  this.registry
104
104
  ]
105
105
  });
106
106
  this.targetPriceValue = new _promclient.Gauge({
107
- name: "pyth_target_price",
108
107
  help: "Latest price value from target chain",
109
108
  labelNames: [
110
109
  "price_id",
111
110
  "alias"
112
111
  ],
112
+ name: "pyth_target_price",
113
113
  registers: [
114
114
  this.registry
115
115
  ]
116
116
  });
117
117
  // Wallet balance metric
118
118
  this.walletBalance = new _promclient.Gauge({
119
- name: "pyth_wallet_balance",
120
119
  help: "Current wallet balance of the price pusher in native token units",
121
120
  labelNames: [
122
121
  "wallet_address",
123
122
  "network"
124
123
  ],
124
+ name: "pyth_wallet_balance",
125
125
  registers: [
126
126
  this.registry
127
127
  ]
@@ -141,10 +141,10 @@ class PricePusherMetrics {
141
141
  // Record a successful price update
142
142
  recordPriceUpdate(priceId, alias, trigger = "yes") {
143
143
  this.priceUpdateAttempts.inc({
144
- price_id: priceId,
145
144
  alias,
146
- trigger: trigger.toLowerCase(),
147
- status: "success"
145
+ price_id: priceId,
146
+ status: "success",
147
+ trigger: trigger.toLowerCase()
148
148
  });
149
149
  }
150
150
  // Record update condition status (YES/NO/EARLY)
@@ -153,10 +153,10 @@ class PricePusherMetrics {
153
153
  // Only record as 'skipped' when the condition is NO
154
154
  if (condition === _priceconfig.UpdateCondition.NO) {
155
155
  this.priceUpdateAttempts.inc({
156
- price_id: priceId,
157
156
  alias,
158
- trigger: triggerLabel,
159
- status: "skipped"
157
+ price_id: priceId,
158
+ status: "skipped",
159
+ trigger: triggerLabel
160
160
  });
161
161
  }
162
162
  // YES and EARLY don't increment the counter here - they'll be counted
@@ -165,10 +165,10 @@ class PricePusherMetrics {
165
165
  // Record a price update error
166
166
  recordPriceUpdateError(priceId, alias, trigger = "yes") {
167
167
  this.priceUpdateAttempts.inc({
168
- price_id: priceId,
169
168
  alias,
170
- trigger: trigger.toLowerCase(),
171
- status: "error"
169
+ price_id: priceId,
170
+ status: "error",
171
+ trigger: trigger.toLowerCase()
172
172
  });
173
173
  }
174
174
  // Set the number of price feeds
@@ -178,30 +178,30 @@ class PricePusherMetrics {
178
178
  // Update source, target and configured time difference timestamps
179
179
  updateTimestamps(priceId, alias, targetLatestPricePublishTime, sourceLatestPricePublishTime, priceConfigTimeDifference) {
180
180
  this.sourceTimestamp.set({
181
- price_id: priceId,
182
- alias
181
+ alias,
182
+ price_id: priceId
183
183
  }, sourceLatestPricePublishTime);
184
184
  this.lastPublishedTime.set({
185
- price_id: priceId,
186
- alias
185
+ alias,
186
+ price_id: priceId
187
187
  }, targetLatestPricePublishTime);
188
188
  this.configuredTimeDifference.set({
189
- price_id: priceId,
190
- alias
189
+ alias,
190
+ price_id: priceId
191
191
  }, priceConfigTimeDifference);
192
192
  }
193
193
  // Update price values
194
194
  updatePriceValues(priceId, alias, sourcePrice, targetPrice) {
195
195
  if (sourcePrice !== undefined) {
196
196
  this.sourcePriceValue.set({
197
- price_id: priceId,
198
- alias
197
+ alias,
198
+ price_id: priceId
199
199
  }, Number(sourcePrice));
200
200
  }
201
201
  if (targetPrice !== undefined) {
202
202
  this.targetPriceValue.set({
203
- price_id: priceId,
204
- alias
203
+ alias,
204
+ price_id: priceId
205
205
  }, Number(targetPrice));
206
206
  }
207
207
  }
@@ -210,8 +210,8 @@ class PricePusherMetrics {
210
210
  // Convert to number for compatibility with prometheus
211
211
  const balanceNum = typeof balance === "bigint" ? Number(balance) / 1e18 : balance;
212
212
  this.walletBalance.set({
213
- wallet_address: walletAddress,
214
- network
213
+ network,
214
+ wallet_address: walletAddress
215
215
  }, balanceNum);
216
216
  this.logger.debug(`Updated wallet balance metric: ${walletAddress} = ${balanceNum}`);
217
217
  }
@@ -14,8 +14,8 @@ const _controller = require("../controller.cjs");
14
14
  const _options = /*#__PURE__*/ _interop_require_wildcard(require("../options.cjs"));
15
15
  const _priceconfig = require("../price-config.cjs");
16
16
  const _pythpricelistener = require("../pyth-price-listener.cjs");
17
- const _near = require("./near.cjs");
18
17
  const _utils = require("../utils.cjs");
18
+ const _near = require("./near.cjs");
19
19
  function _getRequireWildcardCache(nodeInterop) {
20
20
  if (typeof WeakMap !== "function") return null;
21
21
  var cacheBabelInterop = new WeakMap();
@@ -58,48 +58,51 @@ function _interop_require_wildcard(obj, nodeInterop) {
58
58
  return newObj;
59
59
  }
60
60
  const _default = {
61
- command: "near",
62
- describe: "run price pusher for near",
63
61
  builder: {
64
- "node-url": {
65
- description: "NEAR RPC API url. used to make JSON RPC calls to interact with NEAR.",
66
- type: "string",
67
- required: true
62
+ "account-id": {
63
+ description: "payer account identifier.",
64
+ required: true,
65
+ type: "string"
68
66
  },
69
67
  network: {
70
68
  description: "testnet or mainnet.",
71
- type: "string",
72
- required: true
69
+ required: true,
70
+ type: "string"
73
71
  },
74
- "account-id": {
75
- description: "payer account identifier.",
76
- type: "string",
77
- required: true
72
+ "node-url": {
73
+ description: "NEAR RPC API url. used to make JSON RPC calls to interact with NEAR.",
74
+ required: true,
75
+ type: "string"
78
76
  },
79
77
  "private-key-path": {
80
78
  description: "path to payer private key file.",
81
- type: "string",
82
- required: false
79
+ required: false,
80
+ type: "string"
83
81
  },
84
82
  ..._options.priceConfigFile,
85
83
  ..._options.priceServiceEndpoint,
84
+ ..._options.hermesAccessToken,
86
85
  ..._options.pythContractAddress,
87
86
  ..._options.pollingFrequency,
88
87
  ..._options.pushingFrequency,
89
88
  ..._options.logLevel,
90
89
  ..._options.controllerLogLevel
91
90
  },
91
+ command: "near",
92
+ describe: "run price pusher for near",
92
93
  handler: async function(argv) {
93
94
  // FIXME: type checks for this
94
- const { nodeUrl, network, accountId, privateKeyPath, priceConfigFile, priceServiceEndpoint, pythContractAddress, pushingFrequency, pollingFrequency, logLevel, controllerLogLevel } = argv;
95
+ const { nodeUrl, network, accountId, privateKeyPath, priceConfigFile, priceServiceEndpoint, hermesAccessToken, pythContractAddress, pushingFrequency, pollingFrequency, logLevel, controllerLogLevel } = argv;
95
96
  const logger = (0, _pino.pino)({
96
97
  level: logLevel
97
98
  });
98
99
  const priceConfigs = (0, _priceconfig.readPriceConfigFile)(priceConfigFile);
99
- const hermesClient = new _hermesclient.HermesClient(priceServiceEndpoint);
100
+ const hermesClient = new _hermesclient.HermesClient(priceServiceEndpoint, {
101
+ accessToken: hermesAccessToken
102
+ });
100
103
  let priceItems = priceConfigs.map(({ id, alias })=>({
101
- id,
102
- alias
104
+ alias,
105
+ id
103
106
  }));
104
107
  // Better to filter out invalid price items before creating the pyth listener
105
108
  const { existingPriceItems, invalidPriceItems } = await (0, _utils.filterInvalidPriceItems)(hermesClient, priceItems);
@@ -1,20 +1,21 @@
1
1
  import type { Options } from "yargs";
2
2
  declare const _default: {
3
- command: string;
4
- describe: string;
5
3
  builder: {
6
4
  "controller-log-level": Options;
7
5
  "log-level": Options;
8
6
  "pushing-frequency": Options;
9
7
  "polling-frequency": Options;
10
8
  "pyth-contract-address": Options;
9
+ "hermes-access-token": Options;
11
10
  "price-service-endpoint": Options;
12
11
  "price-config-file": Options;
13
- "node-url": Options;
14
- network: Options;
15
12
  "account-id": Options;
13
+ network: Options;
14
+ "node-url": Options;
16
15
  "private-key-path": Options;
17
16
  };
17
+ command: string;
18
+ describe: string;
18
19
  handler: (argv: any) => Promise<void>;
19
20
  };
20
21
  export default _default;
@@ -85,7 +85,8 @@ class NearPricePusher {
85
85
  const outcome = await this.account.updatePriceFeeds(data, updateFee);
86
86
  const failureMessages = [];
87
87
  const is_success = Object.values(outcome.receipts_outcome).reduce((is_success, receipt)=>{
88
- if (Object.prototype.hasOwnProperty.call(receipt.outcome.status, "Failure")) {
88
+ if (// biome-ignore lint/suspicious/noPrototypeBuiltins: receipt.outcome.status is ExecutionStatus | ExecutionStatusBasic (string union), which Object.hasOwn rejects at the type level
89
+ Object.prototype.hasOwnProperty.call(receipt.outcome.status, "Failure")) {
89
90
  failureMessages.push(receipt.outcome.status);
90
91
  return false;
91
92
  }
@@ -123,31 +124,31 @@ class NearAccount {
123
124
  }
124
125
  async getPriceUnsafe(priceId) {
125
126
  return await this.account.viewFunction({
126
- contractId: this.pythAccountId,
127
- methodName: "get_price_unsafe",
128
127
  args: {
129
128
  price_identifier: priceId
130
- }
129
+ },
130
+ contractId: this.pythAccountId,
131
+ methodName: "get_price_unsafe"
131
132
  });
132
133
  }
133
134
  async getUpdateFeeEstimate(data) {
134
135
  return await this.account.viewFunction({
135
- contractId: this.pythAccountId,
136
- methodName: "get_update_fee_estimate",
137
136
  args: {
138
137
  data
139
- }
138
+ },
139
+ contractId: this.pythAccountId,
140
+ methodName: "get_update_fee_estimate"
140
141
  });
141
142
  }
142
143
  async updatePriceFeeds(data, updateFee) {
143
144
  return await this.account.functionCall({
144
- contractId: this.pythAccountId,
145
- methodName: "update_price_feeds",
146
145
  args: {
147
146
  data
148
147
  },
148
+ attachedDeposit: updateFee,
149
+ contractId: this.pythAccountId,
149
150
  gas: "300000000000000",
150
- attachedDeposit: updateFee
151
+ methodName: "update_price_feeds"
151
152
  });
152
153
  }
153
154
  getConnection(network, accountId, nodeUrl, privateKeyPath) {
@@ -163,18 +164,18 @@ class NearAccount {
163
164
  const keyStore = new _key_stores.InMemoryKeyStore();
164
165
  void keyStore.setKey(network, accountInfo.account_id, keyPair);
165
166
  return _nearapijs.Connection.fromConfig({
167
+ jsvmAccountId: `jsvm.${network}`,
166
168
  networkId: network,
167
169
  provider: {
168
- type: "JsonRpcProvider",
169
170
  args: {
170
171
  url: nodeUrl
171
- }
172
+ },
173
+ type: "JsonRpcProvider"
172
174
  },
173
175
  signer: {
174
- type: "InMemorySigner",
175
- keyStore
176
- },
177
- jsvmAccountId: `jsvm.${network}`
176
+ keyStore,
177
+ type: "InMemorySigner"
178
+ }
178
179
  });
179
180
  } else {
180
181
  throw new Error("Invalid key file!");
@@ -1,4 +1,4 @@
1
- import { HermesClient } from "@pythnetwork/hermes-client";
1
+ import type { HermesClient } from "@pythnetwork/hermes-client";
2
2
  import type { FinalExecutionOutcome } from "near-api-js/lib/providers/provider";
3
3
  import type { Logger } from "pino";
4
4
  import type { IPricePusher, PriceInfo, PriceItem } from "../interface.js";