@pythnetwork/price-pusher 9.0.0 → 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/lib/solana/command.d.ts +2 -0
- package/lib/solana/command.d.ts.map +1 -1
- package/lib/solana/command.js +22 -4
- package/lib/solana/solana.d.ts +5 -2
- package/lib/solana/solana.d.ts.map +1 -1
- package/lib/solana/solana.js +8 -4
- package/package.json +4 -4
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,cAAc,CAAC;AACtB,OAAO,EAGL,iBAAiB,EAElB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EACL,YAAY,EACZ,SAAS,EACT,aAAa,EACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAaxD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,qBAAa,gBAAiB,SAAQ,kBAAkB;IAEpD,OAAO,CAAC,YAAY;IAEpB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,MAAM;gBAHN,YAAY,EAAE,YAAY,EAClC,UAAU,EAAE,SAAS,EAAE,EACf,WAAW,EAAE,OAAO,EACpB,MAAM,EAAE,MAAM,EACtB,MAAM,EAAE;QACN,gBAAgB,EAAE,iBAAiB,CAAC;KACrC;IAUG,KAAK;YAeG,aAAa;IAO3B,OAAO,CAAC,iBAAiB;IAuBnB,mBAAmB,CACvB,OAAO,EAAE,SAAS,GACjB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;CAuBlC;AAED,qBAAa,cAAe,YAAW,YAAY;IAK/C,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,0BAA0B;IAClC,OAAO,CAAC,6BAA6B;IACrC,OAAO,CAAC,mBAAmB;IAC3B,OAAO,CAAC,QAAQ,CAAC;IACjB,OAAO,CAAC,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"evm.d.ts","sourceRoot":"","sources":["../../src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Y,EAAE,YAAY,EAC1B,MAAM,EAAE,iBAAiB,EACzB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,0BAA0B,EAAE,MAAM,EAClC,6BAA6B,EAAE,MAAM,EACrC,mBAAmB,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/lib/solana/command.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/solana/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAehC,OAAO,EACL,cAAc,EAEf,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;;;;;;;;;;;;kBAWrB,OAAO;wBAKP,OAAO;oBAKP,OAAO;6CAKP,OAAO;yBAKP,OAAO;6BAMP,OAAO;6BAKP,OAAO;6BAKP,OAAO;iCAKP,OAAO;4BAKP,OAAO;mCAKP,OAAO;;oBASiB,GAAG;;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/solana/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAehC,OAAO,EACL,cAAc,EAEf,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;;;;;;;;;;;;kBAWrB,OAAO;wBAKP,OAAO;oBAKP,OAAO;6CAKP,OAAO;yBAKP,OAAO;6BAMP,OAAO;6BAKP,OAAO;6BAKP,OAAO;iCAKP,OAAO;4BAKP,OAAO;mCAKP,OAAO;wCAKP,OAAO;uBAMP,OAAO;;oBASiB,GAAG;;AA/EpC,wBA4ME;AAEF,eAAO,MAAM,cAAc,MAAO,cAAc,UAAU,MAAM,SAO/D,CAAC"}
|
package/lib/solana/command.js
CHANGED
|
@@ -100,6 +100,16 @@ exports.default = {
|
|
|
100
100
|
type: "number",
|
|
101
101
|
default: 6,
|
|
102
102
|
},
|
|
103
|
+
"address-lookup-table-account": {
|
|
104
|
+
description: "The pubkey of the ALT to use when updating price feeds",
|
|
105
|
+
type: "string",
|
|
106
|
+
optional: true,
|
|
107
|
+
},
|
|
108
|
+
"treasury-id": {
|
|
109
|
+
description: "The treasuryId to use. Useful when the corresponding treasury account is indexed in the ALT passed to --address-lookup-table-account. This is a tx size optimization and is optional; if not set, a random treasury account will be used.",
|
|
110
|
+
type: "number",
|
|
111
|
+
optional: true,
|
|
112
|
+
},
|
|
103
113
|
...options.priceConfigFile,
|
|
104
114
|
...options.priceServiceEndpoint,
|
|
105
115
|
...options.pythContractAddress,
|
|
@@ -109,7 +119,7 @@ exports.default = {
|
|
|
109
119
|
...options.controllerLogLevel,
|
|
110
120
|
},
|
|
111
121
|
handler: async function (argv) {
|
|
112
|
-
const { endpoint, keypairFile, shardId, computeUnitPriceMicroLamports, priceConfigFile, priceServiceEndpoint, pythContractAddress, pushingFrequency, pollingFrequency, jitoEndpoint, jitoKeypairFile, jitoTipLamports, dynamicJitoTips, maxJitoTipLamports, jitoBundleSize, updatesPerJitoBundle, logLevel, controllerLogLevel, } = argv;
|
|
122
|
+
const { endpoint, keypairFile, shardId, computeUnitPriceMicroLamports, priceConfigFile, priceServiceEndpoint, pythContractAddress, pushingFrequency, pollingFrequency, jitoEndpoint, jitoKeypairFile, jitoTipLamports, dynamicJitoTips, maxJitoTipLamports, jitoBundleSize, updatesPerJitoBundle, addressLookupTableAccount, treasuryId, logLevel, controllerLogLevel, } = argv;
|
|
113
123
|
const logger = (0, pino_1.default)({ level: logLevel });
|
|
114
124
|
const priceConfigs = (0, price_config_1.readPriceConfigFile)(priceConfigFile);
|
|
115
125
|
const hermesClient = new hermes_client_1.HermesClient(priceServiceEndpoint);
|
|
@@ -124,20 +134,28 @@ exports.default = {
|
|
|
124
134
|
priceItems = existingPriceItems;
|
|
125
135
|
const pythListener = new pyth_price_listener_1.PythPriceListener(hermesClient, priceItems, logger.child({ module: "PythPriceListener" }));
|
|
126
136
|
const wallet = new nodewallet_1.default(web3_js_1.Keypair.fromSecretKey(Uint8Array.from(JSON.parse(fs_1.default.readFileSync(keypairFile, "ascii")))));
|
|
137
|
+
const connection = new web3_js_1.Connection(endpoint, "processed");
|
|
127
138
|
const pythSolanaReceiver = new pyth_solana_receiver_1.PythSolanaReceiver({
|
|
128
|
-
connection
|
|
139
|
+
connection,
|
|
129
140
|
wallet,
|
|
130
141
|
pushOracleProgramId: new web3_js_2.PublicKey(pythContractAddress),
|
|
142
|
+
treasuryId: treasuryId,
|
|
131
143
|
});
|
|
144
|
+
// Fetch the account lookup table if provided
|
|
145
|
+
const lookupTableAccount = addressLookupTableAccount
|
|
146
|
+
? await connection
|
|
147
|
+
.getAddressLookupTable(new web3_js_2.PublicKey(addressLookupTableAccount))
|
|
148
|
+
.then((result) => result.value ?? undefined)
|
|
149
|
+
: undefined;
|
|
132
150
|
let solanaPricePusher;
|
|
133
151
|
if (jitoTipLamports) {
|
|
134
152
|
const jitoKeypair = web3_js_1.Keypair.fromSecretKey(Uint8Array.from(JSON.parse(fs_1.default.readFileSync(jitoKeypairFile, "ascii"))));
|
|
135
153
|
const jitoClient = (0, searcher_1.searcherClient)(jitoEndpoint, jitoKeypair);
|
|
136
|
-
solanaPricePusher = new solana_1.SolanaPricePusherJito(pythSolanaReceiver, hermesClient, logger.child({ module: "SolanaPricePusherJito" }), shardId, jitoTipLamports, dynamicJitoTips, maxJitoTipLamports, jitoClient, jitoBundleSize, updatesPerJitoBundle);
|
|
154
|
+
solanaPricePusher = new solana_1.SolanaPricePusherJito(pythSolanaReceiver, hermesClient, logger.child({ module: "SolanaPricePusherJito" }), shardId, jitoTipLamports, dynamicJitoTips, maxJitoTipLamports, jitoClient, jitoBundleSize, updatesPerJitoBundle, lookupTableAccount);
|
|
137
155
|
(0, exports.onBundleResult)(jitoClient, logger.child({ module: "JitoClient" }));
|
|
138
156
|
}
|
|
139
157
|
else {
|
|
140
|
-
solanaPricePusher = new solana_1.SolanaPricePusher(pythSolanaReceiver, hermesClient, logger.child({ module: "SolanaPricePusher" }), shardId, computeUnitPriceMicroLamports);
|
|
158
|
+
solanaPricePusher = new solana_1.SolanaPricePusher(pythSolanaReceiver, hermesClient, logger.child({ module: "SolanaPricePusher" }), shardId, computeUnitPriceMicroLamports, lookupTableAccount);
|
|
141
159
|
}
|
|
142
160
|
const solanaPriceListener = new solana_1.SolanaPriceListener(pythSolanaReceiver, shardId, priceItems, logger.child({ module: "SolanaPriceListener" }), { pollingFrequency });
|
|
143
161
|
const controller = new controller_1.Controller(priceConfigs, pythListener, solanaPriceListener, solanaPricePusher, logger.child({ module: "Controller" }, { level: controllerLogLevel }), { pushingFrequency });
|
package/lib/solana/solana.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { DurationInSeconds } from "../utils";
|
|
|
4
4
|
import { HermesClient } from "@pythnetwork/hermes-client";
|
|
5
5
|
import { SearcherClient } from "jito-ts/dist/sdk/block-engine/searcher";
|
|
6
6
|
import { Logger } from "pino";
|
|
7
|
+
import { AddressLookupTableAccount } from "@solana/web3.js";
|
|
7
8
|
export declare class SolanaPriceListener extends ChainPriceListener {
|
|
8
9
|
private pythSolanaReceiver;
|
|
9
10
|
private shardId;
|
|
@@ -21,7 +22,8 @@ export declare class SolanaPricePusher implements IPricePusher {
|
|
|
21
22
|
private logger;
|
|
22
23
|
private shardId;
|
|
23
24
|
private computeUnitPriceMicroLamports;
|
|
24
|
-
|
|
25
|
+
private addressLookupTableAccount?;
|
|
26
|
+
constructor(pythSolanaReceiver: PythSolanaReceiver, hermesClient: HermesClient, logger: Logger, shardId: number, computeUnitPriceMicroLamports: number, addressLookupTableAccount?: AddressLookupTableAccount | undefined);
|
|
25
27
|
updatePriceFeed(priceIds: string[]): Promise<void>;
|
|
26
28
|
}
|
|
27
29
|
export declare class SolanaPricePusherJito implements IPricePusher {
|
|
@@ -35,7 +37,8 @@ export declare class SolanaPricePusherJito implements IPricePusher {
|
|
|
35
37
|
private searcherClient;
|
|
36
38
|
private jitoBundleSize;
|
|
37
39
|
private updatesPerJitoBundle;
|
|
38
|
-
|
|
40
|
+
private addressLookupTableAccount?;
|
|
41
|
+
constructor(pythSolanaReceiver: PythSolanaReceiver, hermesClient: HermesClient, logger: Logger, shardId: number, defaultJitoTipLamports: number, dynamicJitoTips: boolean, maxJitoTipLamports: number, searcherClient: SearcherClient, jitoBundleSize: number, updatesPerJitoBundle: number, addressLookupTableAccount?: AddressLookupTableAccount | undefined);
|
|
39
42
|
getRecentJitoTipLamports(): Promise<number | undefined>;
|
|
40
43
|
private sleep;
|
|
41
44
|
updatePriceFeed(priceIds: string[]): Promise<void>;
|
|
@@ -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,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAK1D,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAExE,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;
|
|
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,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;IACf,OAAO,CAAC,sBAAsB;IAC9B,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,kBAAkB;IAC1B,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,oBAAoB;IAC5B,OAAO,CAAC,yBAAyB,CAAC;gBAV1B,kBAAkB,EAAE,kBAAkB,EACtC,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,sBAAsB,EAAE,MAAM,EAC9B,eAAe,EAAE,OAAO,EACxB,kBAAkB,EAAE,MAAM,EAC1B,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,MAAM,EACtB,oBAAoB,EAAE,MAAM,EAC5B,yBAAyB,CAAC,EAAE,yBAAyB,YAAA;IAGzD,wBAAwB,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;YAsB/C,KAAK;IAIb,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAyEzD"}
|
package/lib/solana/solana.js
CHANGED
|
@@ -66,12 +66,14 @@ class SolanaPricePusher {
|
|
|
66
66
|
logger;
|
|
67
67
|
shardId;
|
|
68
68
|
computeUnitPriceMicroLamports;
|
|
69
|
-
|
|
69
|
+
addressLookupTableAccount;
|
|
70
|
+
constructor(pythSolanaReceiver, hermesClient, logger, shardId, computeUnitPriceMicroLamports, addressLookupTableAccount) {
|
|
70
71
|
this.pythSolanaReceiver = pythSolanaReceiver;
|
|
71
72
|
this.hermesClient = hermesClient;
|
|
72
73
|
this.logger = logger;
|
|
73
74
|
this.shardId = shardId;
|
|
74
75
|
this.computeUnitPriceMicroLamports = computeUnitPriceMicroLamports;
|
|
76
|
+
this.addressLookupTableAccount = addressLookupTableAccount;
|
|
75
77
|
}
|
|
76
78
|
async updatePriceFeed(priceIds) {
|
|
77
79
|
if (priceIds.length === 0) {
|
|
@@ -96,7 +98,7 @@ class SolanaPricePusher {
|
|
|
96
98
|
}
|
|
97
99
|
const transactionBuilder = this.pythSolanaReceiver.newTransactionBuilder({
|
|
98
100
|
closeUpdateAccounts: true,
|
|
99
|
-
});
|
|
101
|
+
}, this.addressLookupTableAccount);
|
|
100
102
|
await transactionBuilder.addUpdatePriceFeed(priceFeedUpdateData, this.shardId);
|
|
101
103
|
const transactions = await transactionBuilder.buildVersionedTransactions({
|
|
102
104
|
computeUnitPriceMicroLamports: this.computeUnitPriceMicroLamports,
|
|
@@ -124,7 +126,8 @@ class SolanaPricePusherJito {
|
|
|
124
126
|
searcherClient;
|
|
125
127
|
jitoBundleSize;
|
|
126
128
|
updatesPerJitoBundle;
|
|
127
|
-
|
|
129
|
+
addressLookupTableAccount;
|
|
130
|
+
constructor(pythSolanaReceiver, hermesClient, logger, shardId, defaultJitoTipLamports, dynamicJitoTips, maxJitoTipLamports, searcherClient, jitoBundleSize, updatesPerJitoBundle, addressLookupTableAccount) {
|
|
128
131
|
this.pythSolanaReceiver = pythSolanaReceiver;
|
|
129
132
|
this.hermesClient = hermesClient;
|
|
130
133
|
this.logger = logger;
|
|
@@ -135,6 +138,7 @@ class SolanaPricePusherJito {
|
|
|
135
138
|
this.searcherClient = searcherClient;
|
|
136
139
|
this.jitoBundleSize = jitoBundleSize;
|
|
137
140
|
this.updatesPerJitoBundle = updatesPerJitoBundle;
|
|
141
|
+
this.addressLookupTableAccount = addressLookupTableAccount;
|
|
138
142
|
}
|
|
139
143
|
async getRecentJitoTipLamports() {
|
|
140
144
|
try {
|
|
@@ -175,7 +179,7 @@ class SolanaPricePusherJito {
|
|
|
175
179
|
for (let i = 0; i < priceIds.length; i += this.updatesPerJitoBundle) {
|
|
176
180
|
const transactionBuilder = this.pythSolanaReceiver.newTransactionBuilder({
|
|
177
181
|
closeUpdateAccounts: true,
|
|
178
|
-
});
|
|
182
|
+
}, this.addressLookupTableAccount);
|
|
179
183
|
await transactionBuilder.addUpdatePriceFeed(priceFeedUpdateData.map((x) => {
|
|
180
184
|
return (0, price_service_sdk_1.sliceAccumulatorUpdateData)(Buffer.from(x, "base64"), i, i + this.updatesPerJitoBundle).toString("base64");
|
|
181
185
|
}), this.shardId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pythnetwork/price-pusher",
|
|
3
|
-
"version": "9.
|
|
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",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@pythnetwork/price-service-sdk": "^1.8.0",
|
|
65
65
|
"@pythnetwork/pyth-fuel-js": "1.0.7",
|
|
66
66
|
"@pythnetwork/pyth-sdk-solidity": "4.0.0",
|
|
67
|
-
"@pythnetwork/pyth-solana-receiver": "0.
|
|
67
|
+
"@pythnetwork/pyth-solana-receiver": "0.10.0",
|
|
68
68
|
"@pythnetwork/pyth-sui-js": "2.1.0",
|
|
69
69
|
"@pythnetwork/pyth-ton-js": "0.1.2",
|
|
70
70
|
"@pythnetwork/solana-utils": "0.4.4",
|
|
@@ -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
|
}
|