@pythnetwork/price-pusher 6.0.0 → 6.1.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 +33 -28
- package/lib/injective/command.d.ts +1 -0
- package/lib/injective/command.d.ts.map +1 -1
- package/lib/injective/command.js +6 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -73,6 +73,12 @@ Two sample YAML configuration files are available in the root of this repo.
|
|
|
73
73
|
You can get the list of available price feeds from
|
|
74
74
|
[here](https://pyth.network/developers/price-feed-ids/).
|
|
75
75
|
|
|
76
|
+
Price pusher communicates with [Hermes][] price service to get the most recent price updates. Hermes listens to the
|
|
77
|
+
Pythnet and Wormhole network to get latest price updates, and serves REST and websocket APIs for consumers to fetch the
|
|
78
|
+
updates. Pyth hosts public endpoints for Hermes; however, it is recommended to get a private endpoint from one of the
|
|
79
|
+
Hermes RPC providers for more reliability. Please refer to [this
|
|
80
|
+
document](https://docs.pyth.network/documentation/pythnet-price-feeds/hermes) for more information.
|
|
81
|
+
|
|
76
82
|
To run the price pusher, please run the following commands, replacing the command line arguments as necessary:
|
|
77
83
|
|
|
78
84
|
```sh
|
|
@@ -86,8 +92,8 @@ cd price_pusher
|
|
|
86
92
|
# For EVM
|
|
87
93
|
npm run start -- evm --endpoint wss://example-rpc.com \
|
|
88
94
|
--pyth-contract-address 0xff1a0f4744e8582DF...... \
|
|
89
|
-
--price-service-endpoint https://example-
|
|
90
|
-
--price-config-file "path/to/price-config.
|
|
95
|
+
--price-service-endpoint https://example-hermes-rpc.com \
|
|
96
|
+
--price-config-file "path/to/price-config.beta.sample.yaml" \
|
|
91
97
|
--mnemonic-file "path/to/mnemonic.txt" \
|
|
92
98
|
[--pushing-frequency 10] \
|
|
93
99
|
[--polling-frequency 5] \
|
|
@@ -95,17 +101,19 @@ npm run start -- evm --endpoint wss://example-rpc.com \
|
|
|
95
101
|
|
|
96
102
|
# For Injective
|
|
97
103
|
npm run start -- injective --grpc-endpoint https://grpc-endpoint.com \
|
|
98
|
-
--pyth-contract-address inj1z60tg0... --price-service-endpoint "https://example-
|
|
99
|
-
--price-config-file "path/to/price-config.
|
|
104
|
+
--pyth-contract-address inj1z60tg0... --price-service-endpoint "https://example-hermes-rpc.com" \
|
|
105
|
+
--price-config-file "path/to/price-config.beta.sample.yaml" \
|
|
100
106
|
--mnemonic-file "path/to/mnemonic.txt" \
|
|
101
107
|
--network testnet \
|
|
108
|
+
[--gas-price 500000000] \
|
|
102
109
|
[--pushing-frequency 10] \
|
|
103
110
|
[--polling-frequency 5]
|
|
104
111
|
|
|
105
112
|
# For Aptos
|
|
106
113
|
npm run start -- aptos --endpoint https://fullnode.testnet.aptoslabs.com/v1 \
|
|
107
|
-
--pyth-contract-address 0x7e783b349d3e89cf5931af376ebeadbfab855b3fa239b7ada8f5a92fbea6b387
|
|
108
|
-
--price-
|
|
114
|
+
--pyth-contract-address 0x7e783b349d3e89cf5931af376ebeadbfab855b3fa239b7ada8f5a92fbea6b387 \
|
|
115
|
+
--price-service-endpoint "https://example-hermes-rpc.com" \
|
|
116
|
+
--price-config-file "path/to/price-config.beta.sample.yaml" \
|
|
109
117
|
--mnemonic-file "path/to/mnemonic.txt" \
|
|
110
118
|
[--pushing-frequency 10] \
|
|
111
119
|
[--polling-frequency 5]
|
|
@@ -118,9 +126,9 @@ npm run start -- sui \
|
|
|
118
126
|
--wormhole-package-id 0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e \
|
|
119
127
|
--wormhole-state-id 0xebba4cc4d614f7a7cdbe883acc76d1cc767922bc96778e7b68be0d15fce27c02 \
|
|
120
128
|
--price-feed-to-price-info-object-table-id 0xf8929174008c662266a1adde78e1e8e33016eb7ad37d379481e860b911e40ed5 \
|
|
121
|
-
--price-service-endpoint https://hermes-
|
|
129
|
+
--price-service-endpoint https://example-hermes-rpc.com \
|
|
122
130
|
--mnemonic-file ./mnemonic \
|
|
123
|
-
--price-config-file ./price-config.
|
|
131
|
+
--price-config-file ./price-config.beta.sample.yaml \
|
|
124
132
|
[--pushing-frequency 10] \
|
|
125
133
|
[--polling-frequency 5] \
|
|
126
134
|
[--num-gas-objects 30]
|
|
@@ -130,6 +138,8 @@ npm run start -- sui \
|
|
|
130
138
|
docker run public.ecr.aws/pyth-network/xc-price-pusher:v<version> -- <above-arguments>
|
|
131
139
|
```
|
|
132
140
|
|
|
141
|
+
[hermes]: https://github.com/pyth-network/pyth-crosschain/tree/main/hermes
|
|
142
|
+
|
|
133
143
|
### Command Line Arguments
|
|
134
144
|
|
|
135
145
|
To know more about the arguments the price-pusher accepts. You can run:
|
|
@@ -146,14 +156,17 @@ npm run start -- {network} --help
|
|
|
146
156
|
For example, to push `BTC/USD` and `BNB/USD` prices on Fantom testnet, run the following command:
|
|
147
157
|
|
|
148
158
|
```sh
|
|
149
|
-
npm run dev -- evm
|
|
150
|
-
|
|
151
|
-
|
|
159
|
+
npm run dev -- evm \
|
|
160
|
+
--endpoint https://endpoints.omniatech.io/v1/fantom/testnet/public \
|
|
161
|
+
--pyth-contract-address 0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb \
|
|
162
|
+
--price-service-endpoint https://hermes.pyth.network \
|
|
163
|
+
--mnemonic-file "./mnemonic" \
|
|
164
|
+
--price-config-file "./price-config.stable.sample.yaml"
|
|
152
165
|
```
|
|
153
166
|
|
|
154
|
-
[`price-config.
|
|
155
|
-
and `BNB/USD` price feeds on Pyth
|
|
156
|
-
contains the same configuration for `BTC/USD` and `BNB/USD` on Pyth
|
|
167
|
+
[`price-config.stable.sample.yaml`](./price-config.stable.sample.yaml) contains configuration for `BTC/USD`
|
|
168
|
+
and `BNB/USD` price feeds on Pyth stable data sources. [`price-config.beta.sample.yaml`](./price-config.beta.sample.yaml)
|
|
169
|
+
contains the same configuration for `BTC/USD` and `BNB/USD` on Pyth beta data sources.
|
|
157
170
|
|
|
158
171
|
You can also provide a config file instead of providing command line options, run the following command:
|
|
159
172
|
|
|
@@ -163,30 +176,22 @@ npm run start -- injective --config "./config.injective.sample.json"
|
|
|
163
176
|
|
|
164
177
|
[`config.injective.sample.json`](./config.injective.sample.json) contains configuration to publish on Injective testnet.
|
|
165
178
|
|
|
166
|
-
## Running
|
|
179
|
+
## Running via docker-compose
|
|
167
180
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
Pyth hosts public endpoints for the price service; however, it is recommended to run it standalone to achieve more resiliency and
|
|
171
|
-
scalability.
|
|
181
|
+
This directory contains sample docker compose files ([stable](./docker-compose.stable.sample.yaml),
|
|
182
|
+
[beta](./docker-compose.beta.sample.yaml)) a price pusher.
|
|
172
183
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
price service and a Wormhole spy. A price service depends on a Wormhole spy. A spy listens to the Wormhole
|
|
176
|
-
network and reports all Pyth-related Wormhole messages to the price service.
|
|
177
|
-
|
|
178
|
-
To run the services via docker-compose, please modify the your target network (testnet, mainnet) sample docker-compose file to adjust the configurations.
|
|
184
|
+
To run the services via docker-compose, please set the RPC endpoint and contract address of your target network in the
|
|
185
|
+
sample docker-compose file.
|
|
179
186
|
|
|
180
187
|
Then, start the docker-compose like this:
|
|
181
188
|
|
|
182
189
|
```
|
|
183
|
-
docker-compose -f docker-compose.
|
|
190
|
+
docker-compose -f docker-compose.stable.sample.yaml up
|
|
184
191
|
```
|
|
185
192
|
|
|
186
193
|
It will take a few minutes until all the services are up and running.
|
|
187
194
|
|
|
188
|
-
[pyth price service]: https://github.com/pyth-network/pyth-crosschain/tree/main/price_service/server
|
|
189
|
-
|
|
190
195
|
## Reliability
|
|
191
196
|
|
|
192
197
|
You can run multiple instances of the price pusher to increase the reliability. It is better to use
|
|
@@ -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
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/injective/command.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;oBA+BL,GAAG;;AA5B9B,wBAkGE"}
|
package/lib/injective/command.js
CHANGED
|
@@ -50,6 +50,10 @@ exports.default = {
|
|
|
50
50
|
type: "string",
|
|
51
51
|
required: true,
|
|
52
52
|
},
|
|
53
|
+
"gas-price": {
|
|
54
|
+
description: "Gas price to be used for each transasction",
|
|
55
|
+
type: "number",
|
|
56
|
+
},
|
|
53
57
|
...options.priceConfigFile,
|
|
54
58
|
...options.priceServiceEndpoint,
|
|
55
59
|
...options.mnemonicFile,
|
|
@@ -59,7 +63,7 @@ exports.default = {
|
|
|
59
63
|
},
|
|
60
64
|
handler: function (argv) {
|
|
61
65
|
// FIXME: type checks for this
|
|
62
|
-
const { grpcEndpoint, priceConfigFile, priceServiceEndpoint, mnemonicFile, pythContractAddress, pushingFrequency, pollingFrequency, network, } = argv;
|
|
66
|
+
const { gasPrice, grpcEndpoint, priceConfigFile, priceServiceEndpoint, mnemonicFile, pythContractAddress, pushingFrequency, pollingFrequency, network, } = argv;
|
|
63
67
|
if (network !== "testnet" && network !== "mainnet") {
|
|
64
68
|
throw new Error("Please specify network. One of [testnet, mainnet]");
|
|
65
69
|
}
|
|
@@ -82,6 +86,7 @@ exports.default = {
|
|
|
82
86
|
});
|
|
83
87
|
const injectivePusher = new injective_1.InjectivePricePusher(priceServiceConnection, pythContractAddress, grpcEndpoint, mnemonic, {
|
|
84
88
|
chainId: (0, networks_1.getNetworkInfo)(network).chainId,
|
|
89
|
+
gasPrice,
|
|
85
90
|
});
|
|
86
91
|
const controller = new controller_1.Controller(priceConfigs, pythListener, injectiveListener, injectivePusher, { pushingFrequency });
|
|
87
92
|
controller.start();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pythnetwork/price-pusher",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "Pyth Price Pusher",
|
|
5
5
|
"homepage": "https://pyth.network",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"yaml": "^2.1.1",
|
|
65
65
|
"yargs": "^17.5.1"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "1be8a02b94d2a09e5284da72e57eb0eb3943d3ae"
|
|
68
68
|
}
|