@pythnetwork/price-pusher 9.0.1 → 9.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 +4 -1
- package/lib/evm/command.d.ts +1 -0
- package/lib/evm/command.d.ts.map +1 -1
- package/lib/evm/command.js +7 -2
- package/lib/evm/evm.d.ts +2 -1
- package/lib/evm/evm.d.ts.map +1 -1
- package/lib/evm/evm.js +6 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -101,7 +101,10 @@ pnpm run start evm --endpoint wss://example-rpc.com \
|
|
|
101
101
|
--mnemonic-file "path/to/mnemonic.txt" \
|
|
102
102
|
[--pushing-frequency 10] \
|
|
103
103
|
[--polling-frequency 5] \
|
|
104
|
-
[--override-gas-price-multiplier 1.1]
|
|
104
|
+
[--override-gas-price-multiplier 1.1] \
|
|
105
|
+
[--override-gas-price-multiplier-cap 5] \
|
|
106
|
+
[--gas-limit 1000000] \
|
|
107
|
+
[--gas-price 160000000]
|
|
105
108
|
|
|
106
109
|
# For Injective
|
|
107
110
|
pnpm run start injective --grpc-endpoint https://grpc-endpoint.com \
|
package/lib/evm/command.d.ts
CHANGED
package/lib/evm/command.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/evm/command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;;;;;;;;;;;;;kBAyBvB,OAAO;8BAMP,OAAO;oBAMP,OAAO;yCAUP,OAAO;6CAQP,OAAO;qBAKP,OAAO;iCASP,OAAO;;oBAUiB,GAAG;;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/evm/command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;;;;;;;;;;;;;kBAyBvB,OAAO;8BAMP,OAAO;oBAMP,OAAO;yCAUP,OAAO;6CAQP,OAAO;qBAKP,OAAO;qBAKP,OAAO;iCASP,OAAO;;oBAUiB,GAAG;;AAxEpC,wBAgLE"}
|
package/lib/evm/command.js
CHANGED
|
@@ -82,6 +82,11 @@ exports.default = {
|
|
|
82
82
|
type: "number",
|
|
83
83
|
required: false,
|
|
84
84
|
},
|
|
85
|
+
"gas-price": {
|
|
86
|
+
description: "Override the gas price that would be received from the RPC",
|
|
87
|
+
type: "number",
|
|
88
|
+
required: false,
|
|
89
|
+
},
|
|
85
90
|
"update-fee-multiplier": {
|
|
86
91
|
description: "Multiplier for the fee to update the price. It is useful in networks " +
|
|
87
92
|
"such as Hedera where setting on-chain getUpdateFee as the transaction value " +
|
|
@@ -101,7 +106,7 @@ exports.default = {
|
|
|
101
106
|
},
|
|
102
107
|
handler: async function (argv) {
|
|
103
108
|
// FIXME: type checks for this
|
|
104
|
-
const { endpoint, priceConfigFile, priceServiceEndpoint, mnemonicFile, pythContractAddress, pushingFrequency, pollingFrequency, customGasStation, txSpeed, overrideGasPriceMultiplier, overrideGasPriceMultiplierCap, gasLimit, updateFeeMultiplier, logLevel, controllerLogLevel, } = argv;
|
|
109
|
+
const { endpoint, priceConfigFile, priceServiceEndpoint, mnemonicFile, pythContractAddress, pushingFrequency, pollingFrequency, customGasStation, txSpeed, overrideGasPriceMultiplier, overrideGasPriceMultiplierCap, gasLimit, gasPrice, updateFeeMultiplier, logLevel, controllerLogLevel, } = argv;
|
|
105
110
|
console.log("***** priceServiceEndpoint *****", priceServiceEndpoint);
|
|
106
111
|
const logger = (0, pino_1.default)({
|
|
107
112
|
level: logLevel,
|
|
@@ -130,7 +135,7 @@ exports.default = {
|
|
|
130
135
|
pollingFrequency,
|
|
131
136
|
});
|
|
132
137
|
const gasStation = (0, custom_gas_station_1.getCustomGasStation)(logger.child({ module: "CustomGasStation" }), customGasStation, txSpeed);
|
|
133
|
-
const evmPusher = new evm_1.EvmPricePusher(hermesClient, client, pythContract, logger.child({ module: "EvmPricePusher" }), overrideGasPriceMultiplier, overrideGasPriceMultiplierCap, updateFeeMultiplier, gasLimit, gasStation);
|
|
138
|
+
const evmPusher = new evm_1.EvmPricePusher(hermesClient, client, pythContract, logger.child({ module: "EvmPricePusher" }), overrideGasPriceMultiplier, overrideGasPriceMultiplierCap, updateFeeMultiplier, gasLimit, gasStation, gasPrice);
|
|
134
139
|
const controller = new controller_1.Controller(priceConfigs, pythListener, evmListener, evmPusher, logger.child({ module: "Controller" }, { level: controllerLogLevel }), { pushingFrequency });
|
|
135
140
|
controller.start();
|
|
136
141
|
},
|
package/lib/evm/evm.d.ts
CHANGED
|
@@ -27,9 +27,10 @@ export declare class EvmPricePusher implements IPricePusher {
|
|
|
27
27
|
private updateFeeMultiplier;
|
|
28
28
|
private gasLimit?;
|
|
29
29
|
private customGasStation?;
|
|
30
|
+
private gasPrice?;
|
|
30
31
|
private pusherAddress;
|
|
31
32
|
private lastPushAttempt;
|
|
32
|
-
constructor(hermesClient: HermesClient, client: SuperWalletClient, pythContract: PythContract, logger: Logger, overrideGasPriceMultiplier: number, overrideGasPriceMultiplierCap: number, updateFeeMultiplier: number, gasLimit?: number | undefined, customGasStation?: CustomGasStation | undefined);
|
|
33
|
+
constructor(hermesClient: HermesClient, client: SuperWalletClient, pythContract: PythContract, logger: Logger, overrideGasPriceMultiplier: number, overrideGasPriceMultiplierCap: number, updateFeeMultiplier: number, gasLimit?: number | undefined, customGasStation?: CustomGasStation | undefined, gasPrice?: number | undefined);
|
|
33
34
|
updatePriceFeed(priceIds: string[], pubTimesToPush: UnixTimestamp[]): Promise<void>;
|
|
34
35
|
private waitForTransactionReceipt;
|
|
35
36
|
private getPriceFeedsUpdateData;
|
package/lib/evm/evm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evm.d.ts","sourceRoot":"","sources":["../../src/evm/evm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,SAAS,EACT,kBAAkB,EAClB,SAAS,EACV,MAAM,cA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AmB,EAAE,MAAM,EAC3B,QAAQ,CAAC,EAAE,MAAM,YAAA,EACjB,gBAAgB,CAAC,EAAE,gBAAgB,YAAA,EACnC,QAAQ,CAAC,EAAE,MAAM,YAAA;IASrB,eAAe,CACnB,QAAQ,EAAE,MAAM,EAAE,EAClB,cAAc,EAAE,aAAa,EAAE,GAC9B,OAAO,CAAC,IAAI,CAAC;YAkPF,yBAAyB;YAuBzB,uBAAuB;CAStC"}
|
package/lib/evm/evm.js
CHANGED
|
@@ -75,9 +75,10 @@ class EvmPricePusher {
|
|
|
75
75
|
updateFeeMultiplier;
|
|
76
76
|
gasLimit;
|
|
77
77
|
customGasStation;
|
|
78
|
+
gasPrice;
|
|
78
79
|
pusherAddress;
|
|
79
80
|
lastPushAttempt;
|
|
80
|
-
constructor(hermesClient, client, pythContract, logger, overrideGasPriceMultiplier, overrideGasPriceMultiplierCap, updateFeeMultiplier, gasLimit, customGasStation) {
|
|
81
|
+
constructor(hermesClient, client, pythContract, logger, overrideGasPriceMultiplier, overrideGasPriceMultiplierCap, updateFeeMultiplier, gasLimit, customGasStation, gasPrice) {
|
|
81
82
|
this.hermesClient = hermesClient;
|
|
82
83
|
this.client = client;
|
|
83
84
|
this.pythContract = pythContract;
|
|
@@ -87,6 +88,7 @@ class EvmPricePusher {
|
|
|
87
88
|
this.updateFeeMultiplier = updateFeeMultiplier;
|
|
88
89
|
this.gasLimit = gasLimit;
|
|
89
90
|
this.customGasStation = customGasStation;
|
|
91
|
+
this.gasPrice = gasPrice;
|
|
90
92
|
}
|
|
91
93
|
// The pubTimes are passed here to use the values that triggered the push.
|
|
92
94
|
// This is an optimization to avoid getting a newer value (as an update comes)
|
|
@@ -118,8 +120,9 @@ class EvmPricePusher {
|
|
|
118
120
|
// addition of baseFee and priorityFee required to land the transaction. We
|
|
119
121
|
// are using this to remain compatible with the networks that doesn't
|
|
120
122
|
// support this transaction type.
|
|
121
|
-
let gasPrice =
|
|
122
|
-
Number(await this.
|
|
123
|
+
let gasPrice = this.gasPrice ??
|
|
124
|
+
Number(await (this.customGasStation?.getCustomGasPrice() ??
|
|
125
|
+
this.client.getGasPrice()));
|
|
123
126
|
// Try to re-use the same nonce and increase the gas if the last tx is not landed yet.
|
|
124
127
|
if (this.pusherAddress === undefined) {
|
|
125
128
|
this.pusherAddress = this.client.account.address;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pythnetwork/price-pusher",
|
|
3
|
-
"version": "9.0
|
|
3
|
+
"version": "9.1.0",
|
|
4
4
|
"description": "Pyth Price Pusher",
|
|
5
5
|
"homepage": "https://pyth.network",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "tsc",
|
|
24
24
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
25
|
-
"test:lint": "eslint src/",
|
|
25
|
+
"test:lint": "eslint src/ --max-warnings 0",
|
|
26
26
|
"start": "node lib/index.js",
|
|
27
27
|
"dev": "ts-node src/index.ts",
|
|
28
28
|
"prepublishOnly": "pnpm run build && pnpm run test:lint",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"yaml": "^2.1.1",
|
|
83
83
|
"yargs": "^17.5.1"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "f61d4dd5465375d8b4addf1bcd3bc1c634fcb5a1"
|
|
86
86
|
}
|