@pythnetwork/price-pusher 9.0.0 → 9.0.1
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/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,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;AAC9B,OAAO,EAAE,yBAAyB,EAAoB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,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.0.
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"description": "Pyth Price Pusher",
|
|
5
5
|
"homepage": "https://pyth.network",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -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": "4bd2adacc4d30b0899492026c7071d5d5007bb3b"
|
|
86
86
|
}
|