@pythnetwork/price-pusher 6.6.3 → 6.7.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/lib/evm/command.d.ts +2 -0
- package/lib/evm/command.d.ts.map +1 -1
- package/lib/evm/command.js +15 -2
- package/lib/evm/evm.d.ts +3 -1
- package/lib/evm/evm.d.ts.map +1 -1
- package/lib/evm/evm.js +12 -2
- package/package.json +2 -2
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":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/evm/command.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;oBAqEL,GAAG;;AAjE9B,wBA8IE"}
|
package/lib/evm/command.js
CHANGED
|
@@ -73,6 +73,19 @@ exports.default = {
|
|
|
73
73
|
required: false,
|
|
74
74
|
default: 5,
|
|
75
75
|
},
|
|
76
|
+
"gas-limit": {
|
|
77
|
+
description: "Gas limit for the transaction",
|
|
78
|
+
type: "number",
|
|
79
|
+
required: false,
|
|
80
|
+
},
|
|
81
|
+
"update-fee-multiplier": {
|
|
82
|
+
description: "Multiplier for the fee to update the price. It is useful in networks " +
|
|
83
|
+
"such as Hedera where setting on-chain getUpdateFee as the transaction value " +
|
|
84
|
+
"won't work. Default to 1",
|
|
85
|
+
type: "number",
|
|
86
|
+
required: false,
|
|
87
|
+
default: 1,
|
|
88
|
+
},
|
|
76
89
|
...options.priceConfigFile,
|
|
77
90
|
...options.priceServiceEndpoint,
|
|
78
91
|
...options.mnemonicFile,
|
|
@@ -82,7 +95,7 @@ exports.default = {
|
|
|
82
95
|
},
|
|
83
96
|
handler: function (argv) {
|
|
84
97
|
// FIXME: type checks for this
|
|
85
|
-
const { endpoint, priceConfigFile, priceServiceEndpoint, mnemonicFile, pythContractAddress, pushingFrequency, pollingFrequency, customGasStation, txSpeed, overrideGasPriceMultiplier, overrideGasPriceMultiplierCap, } = argv;
|
|
98
|
+
const { endpoint, priceConfigFile, priceServiceEndpoint, mnemonicFile, pythContractAddress, pushingFrequency, pollingFrequency, customGasStation, txSpeed, overrideGasPriceMultiplier, overrideGasPriceMultiplierCap, gasLimit, updateFeeMultiplier, } = argv;
|
|
86
99
|
const priceConfigs = (0, price_config_1.readPriceConfigFile)(priceConfigFile);
|
|
87
100
|
const priceServiceConnection = new price_service_client_1.PriceServiceConnection(priceServiceEndpoint, {
|
|
88
101
|
logger: {
|
|
@@ -105,7 +118,7 @@ exports.default = {
|
|
|
105
118
|
pollingFrequency,
|
|
106
119
|
});
|
|
107
120
|
const gasStation = (0, custom_gas_station_1.getCustomGasStation)(customGasStation, txSpeed);
|
|
108
|
-
const evmPusher = new evm_1.EvmPricePusher(priceServiceConnection, pythContractFactory, overrideGasPriceMultiplier, overrideGasPriceMultiplierCap, gasStation);
|
|
121
|
+
const evmPusher = new evm_1.EvmPricePusher(priceServiceConnection, pythContractFactory, overrideGasPriceMultiplier, overrideGasPriceMultiplierCap, updateFeeMultiplier, gasLimit, gasStation);
|
|
109
122
|
const controller = new controller_1.Controller(priceConfigs, pythListener, evmListener, evmPusher, { pushingFrequency });
|
|
110
123
|
controller.start();
|
|
111
124
|
},
|
package/lib/evm/evm.d.ts
CHANGED
|
@@ -19,12 +19,14 @@ export declare class EvmPricePusher implements IPricePusher {
|
|
|
19
19
|
private connection;
|
|
20
20
|
private overrideGasPriceMultiplier;
|
|
21
21
|
private overrideGasPriceMultiplierCap;
|
|
22
|
+
private updateFeeMultiplier;
|
|
23
|
+
private gasLimit?;
|
|
22
24
|
private customGasStation?;
|
|
23
25
|
private pythContract;
|
|
24
26
|
private web3;
|
|
25
27
|
private pusherAddress;
|
|
26
28
|
private lastPushAttempt;
|
|
27
|
-
constructor(connection: PriceServiceConnection, pythContractFactory: PythContractFactory, overrideGasPriceMultiplier: number, overrideGasPriceMultiplierCap: number, customGasStation?: CustomGasStation);
|
|
29
|
+
constructor(connection: PriceServiceConnection, pythContractFactory: PythContractFactory, overrideGasPriceMultiplier: number, overrideGasPriceMultiplierCap: number, updateFeeMultiplier: number, gasLimit?: number | undefined, customGasStation?: CustomGasStation);
|
|
28
30
|
updatePriceFeed(priceIds: string[], pubTimesToPush: UnixTimestamp[]): Promise<void>;
|
|
29
31
|
private getPriceFeedsUpdateData;
|
|
30
32
|
}
|
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,EAAE,QAAQ,EAAa,MAAM,mBAAmB,CAAC;AACxD,OAAO,EACL,YAAY,EACZ,SAAS,EACT,kBAAkB,EAClB,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAgB,iBAAiB,EAAmB,MAAM,UAAU,CAAC;AAE5E,OAAO,gBAAgB,MAAM,4BAA4B,CAAC;AAG1D,OAAO,EACL,sBAAsB,EACtB,SAAS,EACT,aAAa,EACd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAIxD,qBAAa,gBAAiB,SAAQ,kBAAkB;IACtD,OAAO,CAAC,mBAAmB,CAAsB;IACjD,OAAO,CAAC,YAAY,CAAW;gBAG7B,mBAAmB,EAAE,mBAAmB,EACxC,UAAU,EAAE,SAAS,EAAE,EACvB,MAAM,EAAE;QACN,gBAAgB,EAAE,iBAAiB,CAAC;KACrC;IAUG,KAAK;YAeG,iBAAiB;IAc/B,OAAO,CAAC,iBAAiB;IAsBnB,mBAAmB,CACvB,OAAO,EAAE,SAAS,GACjB,OAAO,CAAC,SAAS,G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aAAa,CAAqB;IAC1C,OAAO,CAAC,eAAe,CAA0B;gBAGvC,UAAU,EAAE,sBAAsB,EAC1C,mBAAmB,EAAE,mBAAmB,EAChC,0BAA0B,EAAE,MAAM,EAClC,6BAA6B,EAAE,MAAM,EACrC,mBAAmB,EAAE,MAAM,EAC3B,QAAQ,CAAC,oBAAQ,EACzB,gBAAgB,CAAC,EAAE,gBAAgB;IAa/B,eAAe,CACnB,QAAQ,EAAE,MAAM,EAAE,EAClB,cAAc,EAAE,aAAa,EAAE,GAC9B,OAAO,CAAC,IAAI,CAAC;YAuJF,uBAAuB;CAQtC;AAED,qBAAa,mBAAmB;IAE5B,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,mBAAmB;gBAFnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,mBAAmB,EAAE,MAAM;IAGrC;;;;;;OAMG;IACH,2BAA2B,IAAI,QAAQ;IAcvC;;;;;OAKG;IACH,kBAAkB,IAAI,QAAQ;IAS9B,oBAAoB,IAAI,OAAO;IAI/B,kBAAkB;IA0BlB,uBAAuB;CAQxB"}
|
package/lib/evm/evm.js
CHANGED
|
@@ -81,15 +81,19 @@ class EvmPricePusher {
|
|
|
81
81
|
connection;
|
|
82
82
|
overrideGasPriceMultiplier;
|
|
83
83
|
overrideGasPriceMultiplierCap;
|
|
84
|
+
updateFeeMultiplier;
|
|
85
|
+
gasLimit;
|
|
84
86
|
customGasStation;
|
|
85
87
|
pythContract;
|
|
86
88
|
web3;
|
|
87
89
|
pusherAddress;
|
|
88
90
|
lastPushAttempt;
|
|
89
|
-
constructor(connection, pythContractFactory, overrideGasPriceMultiplier, overrideGasPriceMultiplierCap, customGasStation) {
|
|
91
|
+
constructor(connection, pythContractFactory, overrideGasPriceMultiplier, overrideGasPriceMultiplierCap, updateFeeMultiplier, gasLimit, customGasStation) {
|
|
90
92
|
this.connection = connection;
|
|
91
93
|
this.overrideGasPriceMultiplier = overrideGasPriceMultiplier;
|
|
92
94
|
this.overrideGasPriceMultiplierCap = overrideGasPriceMultiplierCap;
|
|
95
|
+
this.updateFeeMultiplier = updateFeeMultiplier;
|
|
96
|
+
this.gasLimit = gasLimit;
|
|
93
97
|
this.customGasStation = customGasStation;
|
|
94
98
|
this.pythContract = pythContractFactory.createPythContractWithPayer();
|
|
95
99
|
this.web3 = new web3_1.default(pythContractFactory.createWeb3PayerProvider());
|
|
@@ -114,6 +118,7 @@ class EvmPricePusher {
|
|
|
114
118
|
updateFee = await this.pythContract.methods
|
|
115
119
|
.getUpdateFee(priceFeedUpdateData)
|
|
116
120
|
.call();
|
|
121
|
+
updateFee = Number(updateFee) * (this.updateFeeMultiplier || 1);
|
|
117
122
|
console.log(`Update fee: ${updateFee}`);
|
|
118
123
|
}
|
|
119
124
|
catch (e) {
|
|
@@ -143,7 +148,12 @@ class EvmPricePusher {
|
|
|
143
148
|
console.log(`Using gas price: ${gasPrice} and nonce: ${txNonce}`);
|
|
144
149
|
this.pythContract.methods
|
|
145
150
|
.updatePriceFeedsIfNecessary(priceFeedUpdateData, priceIdsWith0x, pubTimesToPush)
|
|
146
|
-
.send({
|
|
151
|
+
.send({
|
|
152
|
+
value: updateFee,
|
|
153
|
+
gasPrice,
|
|
154
|
+
nonce: txNonce,
|
|
155
|
+
gasLimit: this.gasLimit,
|
|
156
|
+
})
|
|
147
157
|
.on("transactionHash", (hash) => {
|
|
148
158
|
console.log(`Successful. Tx hash: ${hash}`);
|
|
149
159
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pythnetwork/price-pusher",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.0",
|
|
4
4
|
"description": "Pyth Price Pusher",
|
|
5
5
|
"homepage": "https://pyth.network",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"yaml": "^2.1.1",
|
|
68
68
|
"yargs": "^17.5.1"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "586a4398bd2b1f178ee70a38ff101bd1aec8971f"
|
|
71
71
|
}
|