@pythnetwork/price-pusher 6.6.0 → 6.6.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.
package/README.md CHANGED
@@ -10,7 +10,7 @@ By default, Pyth does not automatically update the on-chain price every time the
10
10
  instead, anyone can permissionlessly update the on-chain price prior to using it.
11
11
  For more information please refer to [this document](https://docs.pyth.network/documentation/how-pyth-works).
12
12
 
13
- Protocols integrating with can update the on-chain Pyth prices in two different ways.
13
+ Protocols integrating with Pyth can update the on-chain Pyth prices in two different ways.
14
14
  The first approach is on-demand updates: package a Pyth price update together with each transaction that depends on it.
15
15
  On-demand updates minimize latency and are more gas efficient, as prices are only updated on-chain when they are needed.
16
16
 
@@ -87,7 +87,7 @@ npm install
87
87
  npx lerna run build --scope @pythnetwork/price-pusher --include-dependencies
88
88
 
89
89
  # Navigate to the price_pusher folder
90
- cd price_pusher
90
+ cd apps/price_pusher
91
91
 
92
92
  # For EVM
93
93
  npm run start -- evm --endpoint wss://example-rpc.com \
@@ -145,6 +145,33 @@ npm run start -- near \
145
145
  [--pushing-frequency 10] \
146
146
  [--polling-frequency 5]
147
147
 
148
+ # For Solana, using Jito (recommended)
149
+ npm run start -- solana \
150
+ --endpoint https://api.mainnet-beta.solana.com \
151
+ --keypair-file ./id.json \
152
+ --shard-id 1 \
153
+ --jito-endpoint mainnet.block-engine.jito.wtf \
154
+ --jito-keypair-file ./jito.json \
155
+ --jito-tip-lamports 100000 \
156
+ --jito-bundle-size 5 \
157
+ --price-config-file ./price-config.yaml \
158
+ --price-service-endpoint https://hermes.pyth.network/ \
159
+ --pyth-contract-address pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT \
160
+ --pushing-frequency 30 \
161
+ [--polling-frequency 5]
162
+
163
+ # For Solana, using Solana RPC
164
+ npm run start -- solana \
165
+ --endpoint https://api.devnet.solana.com \
166
+ --keypair-file ./id.json \
167
+ --shard-id 1 \
168
+ --price-config-file ./price-config.yaml \
169
+ --price-service-endpoint https://hermes.pyth.network/ \
170
+ --pyth-contract-address pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT \
171
+ --pushing-frequency 30 \
172
+ [--polling-frequency 5]
173
+
174
+
148
175
 
149
176
  # Or, run the price pusher docker image instead of building from the source
150
177
  docker run public.ecr.aws/pyth-network/xc-price-pusher:v<version> -- <above-arguments>
package/lib/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ #!/usr/bin/env node
1
2
  export {};
2
3
  //# sourceMappingURL=index.d.ts.map
package/lib/index.js CHANGED
@@ -1,9 +1,9 @@
1
+ #!/usr/bin/env node
1
2
  "use strict";
2
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
5
  };
5
6
  Object.defineProperty(exports, "__esModule", { value: true });
6
- // #!/usr/bin/env node
7
7
  const yargs_1 = __importDefault(require("yargs"));
8
8
  const helpers_1 = require("yargs/helpers");
9
9
  const command_1 = __importDefault(require("./injective/command"));
@@ -106,7 +106,7 @@ exports.default = {
106
106
  const pythListener = new pyth_price_listener_1.PythPriceListener(priceServiceConnection, priceItems);
107
107
  const wallet = new nodewallet_1.default(web3_js_1.Keypair.fromSecretKey(Uint8Array.from(JSON.parse(fs_1.default.readFileSync(keypairFile, "ascii")))));
108
108
  const pythSolanaReceiver = new pyth_solana_receiver_1.PythSolanaReceiver({
109
- connection: new web3_js_1.Connection(endpoint),
109
+ connection: new web3_js_1.Connection(endpoint, "processed"),
110
110
  wallet,
111
111
  pushOracleProgramId: new web3_js_2.PublicKey(pythContractAddress),
112
112
  });
@@ -16,8 +16,7 @@ export declare class SolanaPricePusher implements IPricePusher {
16
16
  private priceServiceConnection;
17
17
  private shardId;
18
18
  private computeUnitPriceMicroLamports;
19
- private alreadySending;
20
- constructor(pythSolanaReceiver: PythSolanaReceiver, priceServiceConnection: PriceServiceConnection, shardId: number, computeUnitPriceMicroLamports: number, alreadySending?: boolean);
19
+ constructor(pythSolanaReceiver: PythSolanaReceiver, priceServiceConnection: PriceServiceConnection, shardId: number, computeUnitPriceMicroLamports: number);
21
20
  updatePriceFeed(priceIds: string[], pubTimesToPush: number[]): Promise<void>;
22
21
  }
23
22
  export declare class SolanaPricePusherJito implements IPricePusher {
@@ -1 +1 @@
1
- {"version":3,"file":"solana.d.ts","sourceRoot":"","sources":["../../src/solana/solana.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAK3E,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAExE,qBAAa,mBAAoB,SAAQ,kBAAkB;IAEvD,OAAO,CAAC,kBAAkB;IAC1B,OAAO,CAAC,OAAO;gBADP,kBAAkB,EAAE,kBAAkB,EACtC,OAAO,EAAE,MAAM,EACvB,UAAU,EAAE,SAAS,EAAE,EACvB,MAAM,EAAE;QACN,gBAAgB,EAAE,iBAAiB,CAAC;KACrC;IAKG,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;CA2B3E;AAED,qBAAa,iBAAkB,YAAW,YAAY;IAElD,OAAO,CAAC,kBAAkB;IAC1B,OAAO,CAAC,sBAAsB;IAC9B,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,6BAA6B;IACrC,OAAO,CAAC,cAAc;gBAJd,kBAAkB,EAAE,kBAAkB,EACtC,sBAAsB,EAAE,sBAAsB,EAC9C,OAAO,EAAE,MAAM,EACf,6BAA6B,EAAE,MAAM,EACrC,cAAc,GAAE,OAAe;IAGnC,eAAe,CACnB,QAAQ,EAAE,MAAM,EAAE,EAClB,cAAc,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D,OAAO,CAAC,kBAAkB;IAC1B,OAAO,CAAC,sBAAsB;IAC9B,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,6BAA6B;gBAH7B,kBAAkB,EAAE,kBAAkB,EACtC,sBAAsB,EAAE,sBAAsB,EAC9C,OAAO,EAAE,MAAM,EACf,6BAA6B,EAAE,MAAM;IAGzC,eAAe,CACnB,QAAQ,EAAE,MAAM,EAAE,EAClB,cAAc,EAAE,MAAM,EAAE,GACvB,OAAO,CAAC,IAAI,CAAC;CAwCjB;AAED,qBAAa,qBAAsB,YAAW,YAAY;IAEtD,OAAO,CAAC,kBAAkB;IAC1B,OAAO,CAAC,sBAAsB;IAC9B,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,cAAc;gBALd,kBAAkB,EAAE,kBAAkB,EACtC,sBAAsB,EAAE,sBAAsB,EAC9C,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,MAAM;IAG1B,eAAe,CACnB,QAAQ,EAAE,MAAM,EAAE,EAClB,cAAc,EAAE,MAAM,EAAE,GACvB,OAAO,CAAC,IAAI,CAAC;CAyDjB"}
@@ -39,20 +39,13 @@ class SolanaPricePusher {
39
39
  priceServiceConnection;
40
40
  shardId;
41
41
  computeUnitPriceMicroLamports;
42
- alreadySending;
43
- constructor(pythSolanaReceiver, priceServiceConnection, shardId, computeUnitPriceMicroLamports, alreadySending = false) {
42
+ constructor(pythSolanaReceiver, priceServiceConnection, shardId, computeUnitPriceMicroLamports) {
44
43
  this.pythSolanaReceiver = pythSolanaReceiver;
45
44
  this.priceServiceConnection = priceServiceConnection;
46
45
  this.shardId = shardId;
47
46
  this.computeUnitPriceMicroLamports = computeUnitPriceMicroLamports;
48
- this.alreadySending = alreadySending;
49
47
  }
50
48
  async updatePriceFeed(priceIds, pubTimesToPush) {
51
- if (this.alreadySending) {
52
- console.log(new Date(), "updatePriceFeed already in progress");
53
- return;
54
- }
55
- this.alreadySending = true;
56
49
  if (priceIds.length === 0) {
57
50
  return;
58
51
  }
@@ -75,11 +68,9 @@ class SolanaPricePusher {
75
68
  try {
76
69
  await (0, solana_utils_1.sendTransactions)(transactions, this.pythSolanaReceiver.connection, this.pythSolanaReceiver.wallet);
77
70
  console.log(new Date(), "updatePriceFeed successful");
78
- this.alreadySending = false;
79
71
  }
80
72
  catch (e) {
81
73
  console.error(new Date(), "updatePriceFeed failed", e);
82
- this.alreadySending = false;
83
74
  return;
84
75
  }
85
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pythnetwork/price-pusher",
3
- "version": "6.6.0",
3
+ "version": "6.6.3",
4
4
  "description": "Pyth Price Pusher",
5
5
  "homepage": "https://pyth.network",
6
6
  "main": "lib/index.js",
@@ -14,7 +14,7 @@
14
14
  "repository": {
15
15
  "type": "git",
16
16
  "url": "https://github.com/pyth-network/pyth-crosschain",
17
- "directory": "price_pusher"
17
+ "directory": "apps/price_pusher"
18
18
  },
19
19
  "publishConfig": {
20
20
  "access": "public"
@@ -67,5 +67,5 @@
67
67
  "yaml": "^2.1.1",
68
68
  "yargs": "^17.5.1"
69
69
  },
70
- "gitHead": "56cbace282dcdce0099a188a637493ce6bf2312c"
70
+ "gitHead": "cf90bff2364e02ef29d97550e30422dc8e9ce524"
71
71
  }