@pythnetwork/pyth-solana-receiver 0.12.0 → 0.13.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/dist/PythSolanaReceiver.cjs +581 -0
- package/{lib → dist}/PythSolanaReceiver.d.ts +10 -10
- package/dist/address.cjs +61 -0
- package/{lib → dist}/address.d.ts +0 -1
- package/dist/compute_budget.cjs +46 -0
- package/{lib → dist}/compute_budget.d.ts +0 -1
- package/{lib/idl/pyth_push_oracle.js → dist/idl/pyth_push_oracle.cjs} +50 -37
- package/{lib → dist}/idl/pyth_push_oracle.d.ts +0 -1
- package/{lib/idl/pyth_solana_receiver.js → dist/idl/pyth_solana_receiver.cjs} +246 -230
- package/{lib → dist}/idl/pyth_solana_receiver.d.ts +0 -1
- package/{lib/idl/wormhole_core_bridge_solana.js → dist/idl/wormhole_core_bridge_solana.cjs} +607 -464
- package/{lib → dist}/idl/wormhole_core_bridge_solana.d.ts +0 -1
- package/dist/index.cjs +44 -0
- package/dist/index.d.ts +5 -0
- package/dist/package.json +1 -0
- package/dist/vaa.cjs +221 -0
- package/{lib → dist}/vaa.d.ts +6 -7
- package/package.json +52 -13
- package/lib/PythSolanaReceiver.d.ts.map +0 -1
- package/lib/PythSolanaReceiver.js +0 -633
- package/lib/address.d.ts.map +0 -1
- package/lib/address.js +0 -46
- package/lib/compute_budget.d.ts.map +0 -1
- package/lib/compute_budget.js +0 -35
- package/lib/idl/pyth_push_oracle.d.ts.map +0 -1
- package/lib/idl/pyth_solana_receiver.d.ts.map +0 -1
- package/lib/idl/pyth_solana_receiver.json +0 -839
- package/lib/idl/wormhole_core_bridge_solana.d.ts.map +0 -1
- package/lib/index.d.ts +0 -6
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -17
- package/lib/vaa.d.ts.map +0 -1
- package/lib/vaa.js +0 -270
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable tsdoc/syntax */ "use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get DEFAULT_TREASURY_ID () {
|
|
13
|
+
return DEFAULT_TREASURY_ID;
|
|
14
|
+
},
|
|
15
|
+
get PythSolanaReceiver () {
|
|
16
|
+
return PythSolanaReceiver;
|
|
17
|
+
},
|
|
18
|
+
get PythTransactionBuilder () {
|
|
19
|
+
return PythTransactionBuilder;
|
|
20
|
+
},
|
|
21
|
+
get getPriceFeedAccountForProgram () {
|
|
22
|
+
return getPriceFeedAccountForProgram;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const _anchor = require("@coral-xyz/anchor");
|
|
26
|
+
const _priceservicesdk = require("@pythnetwork/price-service-sdk");
|
|
27
|
+
const _solanautils = require("@pythnetwork/solana-utils");
|
|
28
|
+
const _web3 = require("@solana/web3.js");
|
|
29
|
+
const _address = require("./address.cjs");
|
|
30
|
+
const _compute_budget = require("./compute_budget.cjs");
|
|
31
|
+
const _pyth_push_oracle = require("./idl/pyth_push_oracle.cjs");
|
|
32
|
+
const _pyth_solana_receiver = require("./idl/pyth_solana_receiver.cjs");
|
|
33
|
+
const _wormhole_core_bridge_solana = require("./idl/wormhole_core_bridge_solana.cjs");
|
|
34
|
+
const _vaa = require("./vaa.cjs");
|
|
35
|
+
const DEFAULT_TREASURY_ID = 0;
|
|
36
|
+
class PythTransactionBuilder extends _solanautils.TransactionBuilder {
|
|
37
|
+
pythSolanaReceiver;
|
|
38
|
+
closeInstructions;
|
|
39
|
+
priceFeedIdToPriceUpdateAccount;
|
|
40
|
+
priceFeedIdToTwapUpdateAccount;
|
|
41
|
+
closeUpdateAccounts;
|
|
42
|
+
constructor(pythSolanaReceiver, config, addressLookupTable){
|
|
43
|
+
super(pythSolanaReceiver.wallet.publicKey, pythSolanaReceiver.connection, addressLookupTable);
|
|
44
|
+
this.pythSolanaReceiver = pythSolanaReceiver;
|
|
45
|
+
this.closeInstructions = [];
|
|
46
|
+
this.priceFeedIdToPriceUpdateAccount = {};
|
|
47
|
+
this.priceFeedIdToTwapUpdateAccount = {};
|
|
48
|
+
this.closeUpdateAccounts = config.closeUpdateAccounts ?? true;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Add instructions to post price updates to the builder.
|
|
52
|
+
* Use this function to post fully verified price updates from the present or from the past for your program to consume.
|
|
53
|
+
*
|
|
54
|
+
* @param priceUpdateDataArray the output of the `@pythnetwork/price-service-client`'s `PriceServiceConnection.getLatestVaas`. This is an array of verifiable price updates.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* // Get the price feed ids from https://pyth.network/developers/price-feed-ids#pyth-evm-stable
|
|
59
|
+
* const priceUpdateData = await priceServiceConnection.getLatestVaas([
|
|
60
|
+
* SOL_PRICE_FEED_ID,
|
|
61
|
+
* ETH_PRICE_FEED_ID,
|
|
62
|
+
* ]);
|
|
63
|
+
*
|
|
64
|
+
* const transactionBuilder = pythSolanaReceiver.newTransactionBuilder({});
|
|
65
|
+
* await transactionBuilder.addPostPriceUpdates(priceUpdateData);
|
|
66
|
+
* console.log("The SOL/USD price update will get posted to:", transactionBuilder.getPriceUpdateAccount(SOL_PRICE_FEED_ID).toBase58())
|
|
67
|
+
* await transactionBuilder.addPriceConsumerInstructions(...)
|
|
68
|
+
* ```
|
|
69
|
+
*/ async addPostPriceUpdates(priceUpdateDataArray) {
|
|
70
|
+
const { postInstructions, priceFeedIdToPriceUpdateAccount, closeInstructions } = await this.pythSolanaReceiver.buildPostPriceUpdateInstructions(priceUpdateDataArray);
|
|
71
|
+
this.closeInstructions.push(...closeInstructions);
|
|
72
|
+
Object.assign(this.priceFeedIdToPriceUpdateAccount, priceFeedIdToPriceUpdateAccount);
|
|
73
|
+
this.addInstructions(postInstructions);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Add instructions to post partially verified price updates to the builder.
|
|
77
|
+
* Use this function to post partially verified price updates from the present or from the past for your program to consume.
|
|
78
|
+
*
|
|
79
|
+
* @param priceUpdateDataArray the output of the `@pythnetwork/price-service-client`'s `PriceServiceConnection.getLatestVaas`. This is an array of verifiable price updates.
|
|
80
|
+
*
|
|
81
|
+
* Partially verified price updates are price updates where not all the guardian signatures have been verified. By default this methods checks `DEFAULT_REDUCED_GUARDIAN_SET_SIZE` signatures when posting the VAA.
|
|
82
|
+
* If you are a on-chain program developer, make sure you understand the risks of consuming partially verified price updates here: {@link https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/solana/pyth_solana_receiver_sdk/src/price_update.rs}.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* // Get the price feed ids from https://pyth.network/developers/price-feed-ids#pyth-evm-stable
|
|
87
|
+
* const priceUpdateData = await priceServiceConnection.getLatestVaas([
|
|
88
|
+
* SOL_PRICE_FEED_ID,
|
|
89
|
+
* ETH_PRICE_FEED_ID,
|
|
90
|
+
* ]);
|
|
91
|
+
*
|
|
92
|
+
* const transactionBuilder = pythSolanaReceiver.newTransactionBuilder({});
|
|
93
|
+
* await transactionBuilder.addPostPartiallyVerifiedPriceUpdates(priceUpdateData);
|
|
94
|
+
* console.log("The SOL/USD price update will get posted to:", transactionBuilder.getPriceUpdateAccount(SOL_PRICE_FEED_ID).toBase58())
|
|
95
|
+
* await transactionBuilder.addPriceConsumerInstructions(...)
|
|
96
|
+
* ...
|
|
97
|
+
* ```
|
|
98
|
+
*/ async addPostPartiallyVerifiedPriceUpdates(priceUpdateDataArray) {
|
|
99
|
+
const { postInstructions, priceFeedIdToPriceUpdateAccount, closeInstructions } = await this.pythSolanaReceiver.buildPostPriceUpdateAtomicInstructions(priceUpdateDataArray);
|
|
100
|
+
this.closeInstructions.push(...closeInstructions);
|
|
101
|
+
Object.assign(this.priceFeedIdToPriceUpdateAccount, priceFeedIdToPriceUpdateAccount);
|
|
102
|
+
this.addInstructions(postInstructions);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Add instructions to post TWAP updates to the builder.
|
|
106
|
+
* Use this function to post fully verified TWAP updates from the present or from the past for your program to consume.
|
|
107
|
+
*
|
|
108
|
+
* @param twapUpdateDataArray the output of the `@pythnetwork/hermes-client`'s `getLatestTwaps`. This is an array of verifiable price updates.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* // Get the price feed ids from https://pyth.network/developers/price-feed-ids#pyth-evm-stable
|
|
113
|
+
* const twapUpdateData = await hermesClient.getLatestTwaps([
|
|
114
|
+
* SOL_PRICE_FEED_ID,
|
|
115
|
+
* ETH_PRICE_FEED_ID,
|
|
116
|
+
* ]);
|
|
117
|
+
*
|
|
118
|
+
* const transactionBuilder = pythSolanaReceiver.newTransactionBuilder({});
|
|
119
|
+
* await transactionBuilder.addPostTwapUpdates(priceUpdateData);
|
|
120
|
+
* console.log("The SOL/USD price update will get posted to:", transactionBuilder.getTwapUpdateAccount(SOL_PRICE_FEED_ID).toBase58())
|
|
121
|
+
* await transactionBuilder.addTwapConsumerInstructions(...)
|
|
122
|
+
* ```
|
|
123
|
+
*/ async addPostTwapUpdates(twapUpdateDataArray) {
|
|
124
|
+
const { postInstructions, priceFeedIdToTwapUpdateAccount, closeInstructions } = await this.pythSolanaReceiver.buildPostTwapUpdateInstructions(twapUpdateDataArray);
|
|
125
|
+
this.closeInstructions.push(...closeInstructions);
|
|
126
|
+
Object.assign(this.priceFeedIdToTwapUpdateAccount, priceFeedIdToTwapUpdateAccount);
|
|
127
|
+
this.addInstructions(postInstructions);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Add instructions to update price feed accounts to the builder.
|
|
131
|
+
* Price feed accounts are fixed accounts per price feed id that can only be updated with a more recent price.
|
|
132
|
+
*
|
|
133
|
+
* @param priceUpdateDataArray the output of the `@pythnetwork/price-service-client`'s `PriceServiceConnection.getLatestVaas`. This is an array of verifiable price updates.
|
|
134
|
+
* @param shardId the shard ID of the set of price feed accounts. This shard ID allows for multiple price feed accounts for the same price feed id to exist.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* // Get the price feed ids from https://pyth.network/developers/price-feed-ids#pyth-evm-stable
|
|
139
|
+
* const priceUpdateData = await priceServiceConnection.getLatestVaas([
|
|
140
|
+
* SOL_PRICE_FEED_ID,
|
|
141
|
+
* ETH_PRICE_FEED_ID,
|
|
142
|
+
* ]);
|
|
143
|
+
*
|
|
144
|
+
* const transactionBuilder = pythSolanaReceiver.newTransactionBuilder({});
|
|
145
|
+
* await transactionBuilder.addUpdatePriceFeed(priceUpdateData);
|
|
146
|
+
* await transactionBuilder.addPriceConsumerInstructions(...)
|
|
147
|
+
* ...
|
|
148
|
+
* ```
|
|
149
|
+
*/ async addUpdatePriceFeed(priceUpdateDataArray, shardId) {
|
|
150
|
+
const { postInstructions, priceFeedIdToPriceUpdateAccount, closeInstructions } = await this.pythSolanaReceiver.buildUpdatePriceFeedInstructions(priceUpdateDataArray, shardId);
|
|
151
|
+
this.closeInstructions.push(...closeInstructions);
|
|
152
|
+
Object.assign(this.priceFeedIdToPriceUpdateAccount, priceFeedIdToPriceUpdateAccount);
|
|
153
|
+
this.addInstructions(postInstructions);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Add instructions that consume price updates to the builder.
|
|
157
|
+
*
|
|
158
|
+
* @param getInstructions a function that given a mapping of price feed IDs to price update accounts, generates a series of instructions. Price updates get posted to ephemeral accounts and this function allows the user to indicate which accounts in their instruction need to be "replaced" with each price update account.
|
|
159
|
+
* If multiple price updates for the same price feed ID are posted with the same builder, the account corresponding to the last update to get posted will be used.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* ...
|
|
164
|
+
* await transactionBuilder.addPostPriceUpdates(priceUpdateData);
|
|
165
|
+
* await transactionBuilder.addPriceConsumerInstructions(
|
|
166
|
+
* async (
|
|
167
|
+
* getPriceUpdateAccount: ( priceFeedId: string) => PublicKey
|
|
168
|
+
* ): Promise<InstructionWithEphemeralSigners[]> => {
|
|
169
|
+
* return [
|
|
170
|
+
* {
|
|
171
|
+
* instruction: await myFirstPythApp.methods
|
|
172
|
+
* .consume()
|
|
173
|
+
* .accounts({
|
|
174
|
+
* solPriceUpdate: getPriceUpdateAccount(SOL_PRICE_FEED_ID),
|
|
175
|
+
* ethPriceUpdate: getPriceUpdateAccount(ETH_PRICE_FEED_ID),
|
|
176
|
+
* })
|
|
177
|
+
* .instruction(),
|
|
178
|
+
* signers: [],
|
|
179
|
+
* },
|
|
180
|
+
* ];
|
|
181
|
+
* }
|
|
182
|
+
* );
|
|
183
|
+
* ```
|
|
184
|
+
*/ async addPriceConsumerInstructions(getInstructions) {
|
|
185
|
+
this.addInstructions(await getInstructions(this.getPriceUpdateAccount.bind(this)));
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Add instructions that consume TWAP updates to the builder.
|
|
189
|
+
*
|
|
190
|
+
* @param getInstructions a function that given a mapping of price feed IDs to TWAP update accounts, generates a series of instructions. TWAP updates get posted to ephemeral accounts and this function allows the user to indicate which accounts in their instruction need to be "replaced" with each price update account.
|
|
191
|
+
* If multiple TWAP updates for the same price feed ID are posted with the same builder, the account corresponding to the last update to get posted will be used.
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```typescript
|
|
195
|
+
* ...
|
|
196
|
+
* await transactionBuilder.addPostTwapUpdates(twapUpdateData);
|
|
197
|
+
* await transactionBuilder.addTwapConsumerInstructions(
|
|
198
|
+
* async (
|
|
199
|
+
* getTwapUpdateAccount: ( priceFeedId: string) => PublicKey
|
|
200
|
+
* ): Promise<InstructionWithEphemeralSigners[]> => {
|
|
201
|
+
* return [
|
|
202
|
+
* {
|
|
203
|
+
* instruction: await myFirstPythApp.methods
|
|
204
|
+
* .consume()
|
|
205
|
+
* .accounts({
|
|
206
|
+
* solTwapUpdate: getTwapUpdateAccount(SOL_PRICE_FEED_ID),
|
|
207
|
+
* ethTwapUpdate: getTwapUpdateAccount(ETH_PRICE_FEED_ID),
|
|
208
|
+
* })
|
|
209
|
+
* .instruction(),
|
|
210
|
+
* signers: [],
|
|
211
|
+
* },
|
|
212
|
+
* ];
|
|
213
|
+
* }
|
|
214
|
+
* );
|
|
215
|
+
* ```
|
|
216
|
+
*/ async addTwapConsumerInstructions(getInstructions) {
|
|
217
|
+
this.addInstructions(await getInstructions(this.getTwapUpdateAccount.bind(this)));
|
|
218
|
+
}
|
|
219
|
+
/** Add instructions to close encoded VAA accounts from previous actions.
|
|
220
|
+
* If you have previously used the PythTransactionBuilder with closeUpdateAccounts set to false or if you posted encoded VAAs but the transaction to close them did not land on-chain, your wallet might own many encoded VAA accounts.
|
|
221
|
+
* The rent cost for these accounts is 0.008 SOL per encoded VAA account. You can recover this rent calling this function when building a set of transactions.
|
|
222
|
+
*/ async addClosePreviousEncodedVaasInstructions(maxInstructions = 40) {
|
|
223
|
+
this.addInstructions(await this.pythSolanaReceiver.buildClosePreviousEncodedVaasInstructions(maxInstructions));
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Returns all the added instructions batched into versioned transactions, plus for each transaction the ephemeral signers that need to sign it
|
|
227
|
+
*/ async buildVersionedTransactions(args) {
|
|
228
|
+
if (this.closeUpdateAccounts) {
|
|
229
|
+
this.addInstructions(this.closeInstructions);
|
|
230
|
+
}
|
|
231
|
+
return super.buildVersionedTransactions(args);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Returns all the added instructions batched into transactions, plus for each transaction the ephemeral signers that need to sign it
|
|
235
|
+
*/ buildLegacyTransactions(args) {
|
|
236
|
+
if (this.closeUpdateAccounts) {
|
|
237
|
+
this.addInstructions(this.closeInstructions);
|
|
238
|
+
}
|
|
239
|
+
return super.buildLegacyTransactions(args);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* This method is used to retrieve the address of the price update account where the price update for a given price feed ID will be posted.
|
|
243
|
+
* If multiple price updates for the same price feed ID will be posted with the same builder, the address of the account corresponding to the last update to get posted will be returned.
|
|
244
|
+
* */ getPriceUpdateAccount(priceFeedId) {
|
|
245
|
+
const priceUpdateAccount = this.priceFeedIdToPriceUpdateAccount[priceFeedId];
|
|
246
|
+
if (!priceUpdateAccount) {
|
|
247
|
+
throw new Error(`No price update account found for the price feed ID ${priceFeedId}. Make sure to call addPostPriceUpdates or addPostPartiallyVerifiedPriceUpdates before calling this function.`);
|
|
248
|
+
}
|
|
249
|
+
return priceUpdateAccount;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* This method is used to retrieve the address of the TWAP update account where the TWAP update for a given price feed ID will be posted.
|
|
253
|
+
* If multiple updates for the same price feed ID will be posted with the same builder, the address of the account corresponding to the last update to get posted will be returned.
|
|
254
|
+
* */ getTwapUpdateAccount(priceFeedId) {
|
|
255
|
+
const twapUpdateAccount = this.priceFeedIdToTwapUpdateAccount[priceFeedId];
|
|
256
|
+
if (!twapUpdateAccount) {
|
|
257
|
+
throw new Error(`No TWAP update account found for the price feed ID ${priceFeedId}. Make sure to call addPostTwapUpdates before calling this function.`);
|
|
258
|
+
}
|
|
259
|
+
return twapUpdateAccount;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
class PythSolanaReceiver {
|
|
263
|
+
connection;
|
|
264
|
+
wallet;
|
|
265
|
+
provider;
|
|
266
|
+
receiver;
|
|
267
|
+
wormhole;
|
|
268
|
+
pushOracle;
|
|
269
|
+
treasuryId;
|
|
270
|
+
constructor({ connection, wallet, wormholeProgramId = _address.DEFAULT_WORMHOLE_PROGRAM_ID, receiverProgramId = _address.DEFAULT_RECEIVER_PROGRAM_ID, pushOracleProgramId = _address.DEFAULT_PUSH_ORACLE_PROGRAM_ID, treasuryId }){
|
|
271
|
+
if (treasuryId !== undefined && (treasuryId < 0 || treasuryId > 255)) {
|
|
272
|
+
throw new Error("treasuryId must be between 0 and 255");
|
|
273
|
+
}
|
|
274
|
+
this.connection = connection;
|
|
275
|
+
this.wallet = wallet;
|
|
276
|
+
this.provider = new _anchor.AnchorProvider(this.connection, this.wallet, {
|
|
277
|
+
commitment: connection.commitment
|
|
278
|
+
});
|
|
279
|
+
this.receiver = new _anchor.Program(_pyth_solana_receiver.IDL, receiverProgramId, this.provider);
|
|
280
|
+
this.wormhole = new _anchor.Program(_wormhole_core_bridge_solana.IDL, wormholeProgramId, this.provider);
|
|
281
|
+
this.pushOracle = new _anchor.Program(_pyth_push_oracle.IDL, pushOracleProgramId, this.provider);
|
|
282
|
+
this.treasuryId = treasuryId;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Get a new transaction builder to build transactions that interact with the Pyth Solana Receiver program and consume price updates
|
|
286
|
+
*/ newTransactionBuilder(config, addressLookupAccount) {
|
|
287
|
+
return new PythTransactionBuilder(this, config, addressLookupAccount);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Build a series of helper instructions that post price updates to the Pyth Solana Receiver program and another series to close the price update accounts.
|
|
291
|
+
*
|
|
292
|
+
* This function uses partially verified price updates. Partially verified price updates are price updates where not all the guardian signatures have been verified. By default this methods checks `DEFAULT_REDUCED_GUARDIAN_SET_SIZE` signatures when posting the VAA.
|
|
293
|
+
* If you are a on-chain program developer, make sure you understand the risks of consuming partially verified price updates here: {@link https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/solana/pyth_solana_receiver_sdk/src/price_update.rs}.
|
|
294
|
+
*
|
|
295
|
+
* @param priceUpdateDataArray the output of the `@pythnetwork/price-service-client`'s `PriceServiceConnection.getLatestVaas`. This is an array of verifiable price updates.
|
|
296
|
+
* @returns `postInstructions`: the instructions to post the price updates, these should be called before consuming the price updates
|
|
297
|
+
* @returns `priceFeedIdToPriceUpdateAccount`: this is a map of price feed IDs to Solana address. Given a price feed ID, you can use this map to find the account where `postInstructions` will post the price update.
|
|
298
|
+
* @returns `closeInstructions`: the instructions to close the price update accounts, these should be called after consuming the price updates
|
|
299
|
+
*/ async buildPostPriceUpdateAtomicInstructions(priceUpdateDataArray) {
|
|
300
|
+
const postInstructions = [];
|
|
301
|
+
const priceFeedIdToPriceUpdateAccount = {};
|
|
302
|
+
const closeInstructions = [];
|
|
303
|
+
const treasuryId = this.treasuryId ?? (0, _address.getRandomTreasuryId)();
|
|
304
|
+
for (const priceUpdateData of priceUpdateDataArray){
|
|
305
|
+
const accumulatorUpdateData = (0, _priceservicesdk.parseAccumulatorUpdateData)(Buffer.from(priceUpdateData, "base64"));
|
|
306
|
+
const guardianSetIndex = (0, _vaa.getGuardianSetIndex)(accumulatorUpdateData.vaa);
|
|
307
|
+
const trimmedVaa = (0, _vaa.trimSignatures)(accumulatorUpdateData.vaa);
|
|
308
|
+
for (const update of accumulatorUpdateData.updates){
|
|
309
|
+
const priceUpdateKeypair = new _web3.Keypair();
|
|
310
|
+
postInstructions.push({
|
|
311
|
+
instruction: await this.receiver.methods.postUpdateAtomic({
|
|
312
|
+
vaa: trimmedVaa,
|
|
313
|
+
merklePriceUpdate: update,
|
|
314
|
+
treasuryId
|
|
315
|
+
}).accounts({
|
|
316
|
+
priceUpdateAccount: priceUpdateKeypair.publicKey,
|
|
317
|
+
treasury: (0, _address.getTreasuryPda)(treasuryId, this.receiver.programId),
|
|
318
|
+
config: (0, _address.getConfigPda)(this.receiver.programId),
|
|
319
|
+
guardianSet: (0, _address.getGuardianSetPda)(guardianSetIndex, this.wormhole.programId)
|
|
320
|
+
}).instruction(),
|
|
321
|
+
signers: [
|
|
322
|
+
priceUpdateKeypair
|
|
323
|
+
],
|
|
324
|
+
computeUnits: _compute_budget.POST_UPDATE_ATOMIC_COMPUTE_BUDGET
|
|
325
|
+
});
|
|
326
|
+
priceFeedIdToPriceUpdateAccount["0x" + (0, _priceservicesdk.parsePriceFeedMessage)(update.message).feedId.toString("hex")] = priceUpdateKeypair.publicKey;
|
|
327
|
+
closeInstructions.push(await this.buildClosePriceUpdateInstruction(priceUpdateKeypair.publicKey));
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return {
|
|
331
|
+
postInstructions,
|
|
332
|
+
priceFeedIdToPriceUpdateAccount,
|
|
333
|
+
closeInstructions
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Build a series of helper instructions that post price updates to the Pyth Solana Receiver program and another series to close the encoded vaa accounts and the price update accounts.
|
|
338
|
+
*
|
|
339
|
+
* @param priceUpdateDataArray the output of the `@pythnetwork/price-service-client`'s `PriceServiceConnection.getLatestVaas`. This is an array of verifiable price updates.
|
|
340
|
+
* @returns `postInstructions`: the instructions to post the price updates, these should be called before consuming the price updates
|
|
341
|
+
* @returns `priceFeedIdToPriceUpdateAccount`: this is a map of price feed IDs to Solana address. Given a price feed ID, you can use this map to find the account where `postInstructions` will post the price update.
|
|
342
|
+
* @returns `closeInstructions`: the instructions to close the price update accounts, these should be called after consuming the price updates
|
|
343
|
+
*/ async buildPostPriceUpdateInstructions(priceUpdateDataArray) {
|
|
344
|
+
const postInstructions = [];
|
|
345
|
+
const priceFeedIdToPriceUpdateAccount = {};
|
|
346
|
+
const closeInstructions = [];
|
|
347
|
+
const treasuryId = this.treasuryId ?? (0, _address.getRandomTreasuryId)();
|
|
348
|
+
for (const priceUpdateData of priceUpdateDataArray){
|
|
349
|
+
const accumulatorUpdateData = (0, _priceservicesdk.parseAccumulatorUpdateData)(Buffer.from(priceUpdateData, "base64"));
|
|
350
|
+
const { postInstructions: postEncodedVaaInstructions, encodedVaaAddress: encodedVaa, closeInstructions: postEncodedVaacloseInstructions } = await this.buildPostEncodedVaaInstructions(accumulatorUpdateData.vaa);
|
|
351
|
+
postInstructions.push(...postEncodedVaaInstructions);
|
|
352
|
+
closeInstructions.push(...postEncodedVaacloseInstructions);
|
|
353
|
+
for (const update of accumulatorUpdateData.updates){
|
|
354
|
+
const priceUpdateKeypair = new _web3.Keypair();
|
|
355
|
+
postInstructions.push({
|
|
356
|
+
instruction: await this.receiver.methods.postUpdate({
|
|
357
|
+
merklePriceUpdate: update,
|
|
358
|
+
treasuryId
|
|
359
|
+
}).accounts({
|
|
360
|
+
encodedVaa,
|
|
361
|
+
priceUpdateAccount: priceUpdateKeypair.publicKey,
|
|
362
|
+
treasury: (0, _address.getTreasuryPda)(treasuryId, this.receiver.programId),
|
|
363
|
+
config: (0, _address.getConfigPda)(this.receiver.programId)
|
|
364
|
+
}).instruction(),
|
|
365
|
+
signers: [
|
|
366
|
+
priceUpdateKeypair
|
|
367
|
+
],
|
|
368
|
+
computeUnits: _compute_budget.POST_UPDATE_COMPUTE_BUDGET
|
|
369
|
+
});
|
|
370
|
+
priceFeedIdToPriceUpdateAccount["0x" + (0, _priceservicesdk.parsePriceFeedMessage)(update.message).feedId.toString("hex")] = priceUpdateKeypair.publicKey;
|
|
371
|
+
closeInstructions.push(await this.buildClosePriceUpdateInstruction(priceUpdateKeypair.publicKey));
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
return {
|
|
375
|
+
postInstructions,
|
|
376
|
+
priceFeedIdToPriceUpdateAccount,
|
|
377
|
+
closeInstructions
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Build a series of helper instructions that post TWAP updates to the Pyth Solana Receiver program and another series to close the encoded vaa accounts and the TWAP update accounts.
|
|
382
|
+
*
|
|
383
|
+
* @param twapUpdateDataArray the output of the `@pythnetwork/price-service-client`'s `PriceServiceConnection.getLatestTwaps`. This is an array of verifiable price updates.
|
|
384
|
+
* @returns `postInstructions`: the instructions to post the TWAP updates, these should be called before consuming the price updates
|
|
385
|
+
* @returns `priceFeedIdToTwapUpdateAccount`: this is a map of price feed IDs to Solana address. Given a price feed ID, you can use this map to find the account where `postInstructions` will post the TWAP update.
|
|
386
|
+
* @returns `closeInstructions`: the instructions to close the TWAP update accounts, these should be called after consuming the TWAP updates
|
|
387
|
+
*/ async buildPostTwapUpdateInstructions(twapUpdateDataArray) {
|
|
388
|
+
const postInstructions = [];
|
|
389
|
+
const priceFeedIdToTwapUpdateAccount = {};
|
|
390
|
+
const closeInstructions = [];
|
|
391
|
+
const treasuryId = this.treasuryId ?? (0, _address.getRandomTreasuryId)();
|
|
392
|
+
if (twapUpdateDataArray.length !== 2) {
|
|
393
|
+
throw new Error("twapUpdateDataArray must contain exactly two updates (start and end)");
|
|
394
|
+
}
|
|
395
|
+
const [startUpdateData, endUpdateData] = twapUpdateDataArray.map((data)=>(0, _priceservicesdk.parseAccumulatorUpdateData)(Buffer.from(data, "base64")));
|
|
396
|
+
if (!startUpdateData) {
|
|
397
|
+
throw new Error("startUpdateData is undefined. this is a bug 🐛");
|
|
398
|
+
}
|
|
399
|
+
if (!endUpdateData) {
|
|
400
|
+
throw new Error("startUpdateData is undefined. this is a bug 🐛");
|
|
401
|
+
}
|
|
402
|
+
// Validate that the start and end updates contain the same number of price feeds
|
|
403
|
+
if (startUpdateData.updates.length !== endUpdateData.updates.length) {
|
|
404
|
+
throw new Error("Start and end updates must contain the same number of price feeds");
|
|
405
|
+
}
|
|
406
|
+
// Post encoded VAAs
|
|
407
|
+
const { postInstructions: buildVaasInstructions, closeInstructions: closeVaasInstructions, startEncodedVaaAddress, endEncodedVaaAddress } = await (0, _vaa.buildPostEncodedVaasForTwapInstructions)(this.wormhole, startUpdateData, endUpdateData);
|
|
408
|
+
postInstructions.push(...buildVaasInstructions);
|
|
409
|
+
closeInstructions.push(...closeVaasInstructions);
|
|
410
|
+
// Post a TWAP update to the receiver contract for each price feed
|
|
411
|
+
for(let i = 0; i < startUpdateData.updates.length; i++){
|
|
412
|
+
const startUpdate = startUpdateData.updates[i];
|
|
413
|
+
const endUpdate = endUpdateData.updates[i];
|
|
414
|
+
const twapUpdateKeypair = new _web3.Keypair();
|
|
415
|
+
postInstructions.push({
|
|
416
|
+
instruction: await this.receiver.methods.postTwapUpdate({
|
|
417
|
+
startMerklePriceUpdate: startUpdate,
|
|
418
|
+
endMerklePriceUpdate: endUpdate,
|
|
419
|
+
treasuryId
|
|
420
|
+
}).accounts({
|
|
421
|
+
startEncodedVaa: startEncodedVaaAddress,
|
|
422
|
+
endEncodedVaa: endEncodedVaaAddress,
|
|
423
|
+
twapUpdateAccount: twapUpdateKeypair.publicKey,
|
|
424
|
+
treasury: (0, _address.getTreasuryPda)(treasuryId, this.receiver.programId),
|
|
425
|
+
config: (0, _address.getConfigPda)(this.receiver.programId)
|
|
426
|
+
}).instruction(),
|
|
427
|
+
signers: [
|
|
428
|
+
twapUpdateKeypair
|
|
429
|
+
],
|
|
430
|
+
computeUnits: _compute_budget.POST_TWAP_UPDATE_COMPUTE_BUDGET
|
|
431
|
+
});
|
|
432
|
+
priceFeedIdToTwapUpdateAccount["0x" + (0, _priceservicesdk.parseTwapMessage)(startUpdate.message).feedId.toString("hex")] = twapUpdateKeypair.publicKey;
|
|
433
|
+
closeInstructions.push(await this.buildCloseTwapUpdateInstruction(twapUpdateKeypair.publicKey));
|
|
434
|
+
}
|
|
435
|
+
return {
|
|
436
|
+
postInstructions,
|
|
437
|
+
priceFeedIdToTwapUpdateAccount,
|
|
438
|
+
closeInstructions
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Build a series of helper instructions that update one or many price feed accounts and another series to close the encoded vaa accounts used to update the price feed accounts.
|
|
443
|
+
*
|
|
444
|
+
* @param priceUpdateDataArray the output of the `@pythnetwork/price-service-client`'s `PriceServiceConnection.getLatestVaas`. This is an array of verifiable price updates.
|
|
445
|
+
* @param shardId the shard ID of the set of price feed accounts. This shard ID allows for multiple price feed accounts for the same price feed id to exist.
|
|
446
|
+
* @returns `postInstructions`: the instructions to update the price feed accounts. If the price feed accounts don't contain a recent update, these should be called before consuming the price updates.
|
|
447
|
+
* @returns `priceFeedIdToPriceUpdateAccount`: this is a map of price feed IDs to Solana address. Given a price feed ID, you can use this map to find the account where `postInstructions` will post the price update. Note that since price feed accounts are PDAs, the address of the account can also be found with `getPriceFeedAccountAddress`.
|
|
448
|
+
* @returns `closeInstructions`: the instructions to close the encoded VAA accounts that were used to update the price feed accounts.
|
|
449
|
+
*/ async buildUpdatePriceFeedInstructions(priceUpdateDataArray, shardId) {
|
|
450
|
+
const postInstructions = [];
|
|
451
|
+
const priceFeedIdToPriceUpdateAccount = {};
|
|
452
|
+
const closeInstructions = [];
|
|
453
|
+
const treasuryId = this.treasuryId ?? (0, _address.getRandomTreasuryId)();
|
|
454
|
+
for (const priceUpdateData of priceUpdateDataArray){
|
|
455
|
+
const accumulatorUpdateData = (0, _priceservicesdk.parseAccumulatorUpdateData)(Buffer.from(priceUpdateData, "base64"));
|
|
456
|
+
const { postInstructions: postEncodedVaaInstructions, encodedVaaAddress: encodedVaa, closeInstructions: postEncodedVaacloseInstructions } = await this.buildPostEncodedVaaInstructions(accumulatorUpdateData.vaa);
|
|
457
|
+
postInstructions.push(...postEncodedVaaInstructions);
|
|
458
|
+
closeInstructions.push(...postEncodedVaacloseInstructions);
|
|
459
|
+
for (const update of accumulatorUpdateData.updates){
|
|
460
|
+
const feedId = (0, _priceservicesdk.parsePriceFeedMessage)(update.message).feedId;
|
|
461
|
+
postInstructions.push({
|
|
462
|
+
instruction: await this.pushOracle.methods.updatePriceFeed({
|
|
463
|
+
merklePriceUpdate: update,
|
|
464
|
+
treasuryId
|
|
465
|
+
}, shardId, [
|
|
466
|
+
...feedId
|
|
467
|
+
]).accounts({
|
|
468
|
+
pythSolanaReceiver: this.receiver.programId,
|
|
469
|
+
encodedVaa,
|
|
470
|
+
priceFeedAccount: this.getPriceFeedAccountAddress(shardId, feedId),
|
|
471
|
+
treasury: (0, _address.getTreasuryPda)(treasuryId, this.receiver.programId),
|
|
472
|
+
config: (0, _address.getConfigPda)(this.receiver.programId)
|
|
473
|
+
}).instruction(),
|
|
474
|
+
signers: [],
|
|
475
|
+
computeUnits: _compute_budget.UPDATE_PRICE_FEED_COMPUTE_BUDGET
|
|
476
|
+
});
|
|
477
|
+
priceFeedIdToPriceUpdateAccount["0x" + (0, _priceservicesdk.parsePriceFeedMessage)(update.message).feedId.toString("hex")] = this.getPriceFeedAccountAddress(shardId, feedId);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return {
|
|
481
|
+
postInstructions,
|
|
482
|
+
priceFeedIdToPriceUpdateAccount,
|
|
483
|
+
closeInstructions
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Build a series of helper instructions that post a VAA in an encoded VAA account. This function is bespoke for posting Pyth VAAs and might not work for other usecases.
|
|
488
|
+
*
|
|
489
|
+
* @param vaa a Wormhole VAA
|
|
490
|
+
* @returns `encodedVaaAddress`: the address of the encoded VAA account where the VAA will be posted
|
|
491
|
+
* @returns `postInstructions`: the instructions to post the VAA
|
|
492
|
+
* @returns `closeInstructions`: the instructions to close the encoded VAA account
|
|
493
|
+
*/ async buildPostEncodedVaaInstructions(vaa) {
|
|
494
|
+
return (0, _vaa.buildPostEncodedVaaInstructions)(this.wormhole, vaa);
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Build an instruction to close an encoded VAA account, recovering the rent.
|
|
498
|
+
*/ async buildCloseEncodedVaaInstruction(encodedVaa) {
|
|
499
|
+
return (0, _vaa.buildCloseEncodedVaaInstruction)(this.wormhole, encodedVaa);
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Build aset of instructions to close all the existing encoded VAA accounts owned by this PythSolanaReceiver's wallet
|
|
503
|
+
*/ async buildClosePreviousEncodedVaasInstructions(maxInstructions) {
|
|
504
|
+
const encodedVaas = await this.findOwnedEncodedVaaAccounts();
|
|
505
|
+
const instructions = [];
|
|
506
|
+
for (const encodedVaa of encodedVaas){
|
|
507
|
+
instructions.push(await this.buildCloseEncodedVaaInstruction(encodedVaa));
|
|
508
|
+
}
|
|
509
|
+
return instructions.slice(0, maxInstructions);
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Build an instruction to close a price update account, recovering the rent.
|
|
513
|
+
*/ async buildClosePriceUpdateInstruction(priceUpdateAccount) {
|
|
514
|
+
const instruction = await this.receiver.methods.reclaimRent().accounts({
|
|
515
|
+
priceUpdateAccount
|
|
516
|
+
}).instruction();
|
|
517
|
+
return {
|
|
518
|
+
instruction,
|
|
519
|
+
signers: []
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Build an instruction to close a TWAP update account, recovering the rent.
|
|
524
|
+
*/ async buildCloseTwapUpdateInstruction(twapUpdateAccount) {
|
|
525
|
+
const instruction = await this.receiver.methods.reclaimTwapRent().accounts({
|
|
526
|
+
twapUpdateAccount
|
|
527
|
+
}).instruction();
|
|
528
|
+
return {
|
|
529
|
+
instruction,
|
|
530
|
+
signers: []
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Returns a set of versioned transactions that contain the provided instructions in the same order and with efficient batching
|
|
535
|
+
*/ async batchIntoVersionedTransactions(instructions, priorityFeeConfig, addressLookupTable) {
|
|
536
|
+
return _solanautils.TransactionBuilder.batchIntoVersionedTransactions(this.wallet.publicKey, this.connection, instructions, priorityFeeConfig, addressLookupTable);
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Fetch the contents of a price update account
|
|
540
|
+
* @param priceUpdateAccount The address of the price update account
|
|
541
|
+
* @returns The contents of the deserialized price update account or `null` if the account doesn't exist
|
|
542
|
+
*/ async fetchPriceUpdateAccount(priceUpdateAccount) {
|
|
543
|
+
return this.receiver.account.priceUpdateV2.fetchNullable(priceUpdateAccount);
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Fetch the contents of a price feed account
|
|
547
|
+
* @param shardId The shard ID of the set of price feed accounts. This shard ID allows for multiple price feed accounts for the same price feed id to exist.
|
|
548
|
+
* @param priceFeedId The price feed ID, as either a 32-byte buffer or hexadecimal string with or without a leading "0x" prefix.
|
|
549
|
+
* @returns The contents of the deserialized price feed account or `null` if the account doesn't exist
|
|
550
|
+
*/ async fetchPriceFeedAccount(shardId, priceFeedId) {
|
|
551
|
+
return this.receiver.account.priceUpdateV2.fetchNullable(this.getPriceFeedAccountAddress(shardId, priceFeedId));
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Derive the address of a price feed account
|
|
555
|
+
* @param shardId The shard ID of the set of price feed accounts. This shard ID allows for multiple price feed accounts for the same price feed id to exist.
|
|
556
|
+
* @param priceFeedId The price feed ID, as either a 32-byte buffer or hexadecimal string with or without a leading "0x" prefix.
|
|
557
|
+
* @returns The address of the price feed account
|
|
558
|
+
*/ getPriceFeedAccountAddress(shardId, priceFeedId) {
|
|
559
|
+
return getPriceFeedAccountForProgram(shardId, priceFeedId, this.pushOracle.programId);
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Find all the encoded VAA accounts owned by this PythSolanaReceiver's wallet
|
|
563
|
+
* @returns a list of the public keys of the encoded VAA accounts
|
|
564
|
+
*/ async findOwnedEncodedVaaAccounts() {
|
|
565
|
+
return await (0, _vaa.findEncodedVaaAccountsByWriteAuthority)(this.receiver.provider.connection, this.wallet.publicKey, this.wormhole.programId);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
function getPriceFeedAccountForProgram(shardId, priceFeedId, pushOracleProgramId) {
|
|
569
|
+
if (typeof priceFeedId == "string") {
|
|
570
|
+
priceFeedId = priceFeedId.startsWith("0x") ? Buffer.from(priceFeedId.slice(2), "hex") : Buffer.from(priceFeedId, "hex");
|
|
571
|
+
}
|
|
572
|
+
if (priceFeedId.length != 32) {
|
|
573
|
+
throw new Error("Feed ID should be 32 bytes long");
|
|
574
|
+
}
|
|
575
|
+
const shardBuffer = Buffer.alloc(2);
|
|
576
|
+
shardBuffer.writeUint16LE(shardId, 0);
|
|
577
|
+
return _web3.PublicKey.findProgramAddressSync([
|
|
578
|
+
shardBuffer,
|
|
579
|
+
priceFeedId
|
|
580
|
+
], pushOracleProgramId ?? _address.DEFAULT_PUSH_ORACLE_PROGRAM_ID)[0];
|
|
581
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import type { IdlAccounts } from "@coral-xyz/anchor";
|
|
2
|
+
import { AnchorProvider, Program, Wallet } from "@coral-xyz/anchor";
|
|
3
|
+
import type { InstructionWithEphemeralSigners, PriorityFeeConfig } from "@pythnetwork/solana-utils";
|
|
4
|
+
import { TransactionBuilder } from "@pythnetwork/solana-utils";
|
|
5
|
+
import type { Signer } from "@solana/web3.js";
|
|
6
|
+
import { AddressLookupTableAccount, Connection, Transaction, VersionedTransaction, PublicKey } from "@solana/web3.js";
|
|
7
|
+
import type { PythPushOracle } from "./idl/pyth_push_oracle";
|
|
8
|
+
import type { PythSolanaReceiver as PythSolanaReceiverProgram } from "./idl/pyth_solana_receiver";
|
|
9
|
+
import type { WormholeCoreBridgeSolana } from "./idl/wormhole_core_bridge_solana";
|
|
9
10
|
export type PriceUpdateAccount = IdlAccounts<PythSolanaReceiverProgram>["priceUpdateV2"];
|
|
10
11
|
export type TwapUpdateAccount = IdlAccounts<PythSolanaReceiverProgram>["twapUpdate"];
|
|
11
12
|
/**
|
|
@@ -252,7 +253,7 @@ export declare class PythSolanaReceiver {
|
|
|
252
253
|
readonly receiver: Program<PythSolanaReceiverProgram>;
|
|
253
254
|
readonly wormhole: Program<WormholeCoreBridgeSolana>;
|
|
254
255
|
readonly pushOracle: Program<PythPushOracle>;
|
|
255
|
-
readonly treasuryId?: number;
|
|
256
|
+
readonly treasuryId?: number | undefined;
|
|
256
257
|
constructor({ connection, wallet, wormholeProgramId, receiverProgramId, pushOracleProgramId, treasuryId, }: {
|
|
257
258
|
connection: Connection;
|
|
258
259
|
wallet: Wallet;
|
|
@@ -391,4 +392,3 @@ export declare class PythSolanaReceiver {
|
|
|
391
392
|
* @returns The address of the price feed account
|
|
392
393
|
*/
|
|
393
394
|
export declare function getPriceFeedAccountForProgram(shardId: number, priceFeedId: Buffer | string, pushOracleProgramId?: PublicKey): PublicKey;
|
|
394
|
-
//# sourceMappingURL=PythSolanaReceiver.d.ts.map
|