@pythnetwork/pyth-solana-receiver 0.12.0 → 0.14.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 +0 -44
- package/dist/cjs/PythSolanaReceiver.cjs +442 -0
- package/{lib → dist/cjs}/PythSolanaReceiver.d.ts +10 -86
- package/dist/cjs/address.cjs +63 -0
- package/{lib → dist/cjs}/address.d.ts +0 -1
- package/dist/cjs/compute_budget.cjs +42 -0
- package/{lib → dist/cjs}/compute_budget.d.ts +0 -5
- package/dist/cjs/idl/pyth_push_oracle.cjs +132 -0
- package/{lib → dist/cjs}/idl/pyth_push_oracle.d.ts +0 -1
- package/dist/cjs/idl/pyth_solana_receiver.cjs +858 -0
- package/{lib → dist/cjs}/idl/pyth_solana_receiver.d.ts +0 -1
- package/dist/cjs/idl/wormhole_core_bridge_solana.cjs +1751 -0
- package/{lib → dist/cjs}/idl/wormhole_core_bridge_solana.d.ts +0 -1
- package/dist/cjs/index.cjs +44 -0
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/vaa.cjs +192 -0
- package/{lib → dist/cjs}/vaa.d.ts +4 -30
- package/dist/esm/PythSolanaReceiver.d.ts +318 -0
- package/dist/esm/PythSolanaReceiver.mjs +462 -0
- package/dist/esm/address.d.ts +29 -0
- package/dist/esm/address.mjs +45 -0
- package/dist/esm/compute_budget.d.ts +28 -0
- package/dist/esm/compute_budget.mjs +21 -0
- package/dist/esm/idl/pyth_push_oracle.d.ts +117 -0
- package/{lib/idl/pyth_push_oracle.js → dist/esm/idl/pyth_push_oracle.mjs} +41 -38
- package/dist/esm/idl/pyth_solana_receiver.d.ts +840 -0
- package/{lib/idl/pyth_solana_receiver.js → dist/esm/idl/pyth_solana_receiver.mjs} +237 -231
- package/dist/esm/idl/wormhole_core_bridge_solana.d.ts +1606 -0
- package/{lib/idl/wormhole_core_bridge_solana.js → dist/esm/idl/wormhole_core_bridge_solana.mjs} +598 -465
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.mjs +5 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/vaa.d.ts +75 -0
- package/dist/esm/vaa.mjs +197 -0
- package/package.json +101 -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,5 @@
|
|
|
1
|
+
export { PythSolanaReceiver, PythTransactionBuilder, getPriceFeedAccountForProgram, } from "./PythSolanaReceiver";
|
|
2
|
+
export { TransactionBuilder, type InstructionWithEphemeralSigners, } from "@pythnetwork/solana-utils";
|
|
3
|
+
export { getConfigPda, DEFAULT_RECEIVER_PROGRAM_ID, DEFAULT_WORMHOLE_PROGRAM_ID, } from "./address";
|
|
4
|
+
export { IDL as pythSolanaReceiverIdl, type PythSolanaReceiver as PythSolanaReceiverProgram, } from "./idl/pyth_solana_receiver";
|
|
5
|
+
export { IDL as wormholeCoreBridgeIdl, type WormholeCoreBridgeSolana as WormholeCoreBridgeProgram, } from "./idl/wormhole_core_bridge_solana";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { PythSolanaReceiver, PythTransactionBuilder, getPriceFeedAccountForProgram } from "./PythSolanaReceiver.mjs";
|
|
2
|
+
export { TransactionBuilder } from "@pythnetwork/solana-utils";
|
|
3
|
+
export { getConfigPda, DEFAULT_RECEIVER_PROGRAM_ID, DEFAULT_WORMHOLE_PROGRAM_ID } from "./address.mjs";
|
|
4
|
+
export { IDL as pythSolanaReceiverIdl } from "./idl/pyth_solana_receiver.mjs";
|
|
5
|
+
export { IDL as wormholeCoreBridgeIdl } from "./idl/wormhole_core_bridge_solana.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "module" }
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Program } from "@coral-xyz/anchor";
|
|
2
|
+
import type { InstructionWithEphemeralSigners } from "@pythnetwork/solana-utils";
|
|
3
|
+
import { Connection, Keypair, PublicKey } from "@solana/web3.js";
|
|
4
|
+
import type { WormholeCoreBridgeSolana } from "./idl/wormhole_core_bridge_solana";
|
|
5
|
+
/**
|
|
6
|
+
* Get the index of the guardian set that signed a VAA
|
|
7
|
+
*/
|
|
8
|
+
export declare function getGuardianSetIndex(vaa: Buffer): number;
|
|
9
|
+
/**
|
|
10
|
+
* The default number of signatures to keep in a VAA when using `trimSignatures`.
|
|
11
|
+
* This number was chosen as the maximum number of signatures so that the VAA's contents can be posted in a single Solana transaction.
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEFAULT_REDUCED_GUARDIAN_SET_SIZE = 5;
|
|
14
|
+
/**
|
|
15
|
+
* The size of a guardian signature in a VAA.
|
|
16
|
+
*
|
|
17
|
+
* It is 66 bytes long, the first byte is the guardian index and the next 65 bytes are the signature (including a recovery id).
|
|
18
|
+
*/
|
|
19
|
+
export declare const VAA_SIGNATURE_SIZE = 66;
|
|
20
|
+
/**
|
|
21
|
+
* The start of the VAA bytes in an encoded VAA account. Before this offset, the account contains a header.
|
|
22
|
+
*/
|
|
23
|
+
export declare const VAA_START = 46;
|
|
24
|
+
/**
|
|
25
|
+
* Writing the VAA to an encoded VAA account is done in 2 instructions.
|
|
26
|
+
*
|
|
27
|
+
* The first one writes the first `VAA_SPLIT_INDEX` bytes and the second one writes the rest.
|
|
28
|
+
*
|
|
29
|
+
* This number was chosen as the biggest number such that one can still call `createInstruction`,
|
|
30
|
+
* `initEncodedVaa` and `writeEncodedVaa` in a single Solana transaction, while using an address lookup table.
|
|
31
|
+
* This way, the packing of the instructions to post an encoded vaa is more efficient.
|
|
32
|
+
*/
|
|
33
|
+
export declare const VAA_SPLIT_INDEX = 721;
|
|
34
|
+
/**
|
|
35
|
+
* Trim the number of signatures of a VAA.
|
|
36
|
+
*
|
|
37
|
+
* @returns the same VAA as the input, but with `n` signatures instead of the original number of signatures.
|
|
38
|
+
*
|
|
39
|
+
* A Wormhole VAA typically has a number of signatures equal to two thirds of the number of guardians. However,
|
|
40
|
+
* this function is useful to make VAAs smaller to post their contents in a single Solana transaction.
|
|
41
|
+
*/
|
|
42
|
+
export declare function trimSignatures(vaa: Buffer, n?: number): Buffer;
|
|
43
|
+
/**
|
|
44
|
+
* Build instructions to post a single VAA to the Wormhole program.
|
|
45
|
+
* The instructions can be packed efficiently into 2 transactions:
|
|
46
|
+
* - TX1: Create, init the encoded VAA account and write the first part of the VAA
|
|
47
|
+
* - TX2: Write the second part of the VAA and verify it
|
|
48
|
+
*
|
|
49
|
+
* @param wormhole - The Wormhole program instance
|
|
50
|
+
* @param vaa - The VAA buffer to post
|
|
51
|
+
* @returns Result containing:
|
|
52
|
+
* - encodedVaaAddress: Public key of the encoded VAA account
|
|
53
|
+
* - postInstructions: Instructions to post and verify the VAA
|
|
54
|
+
* - closeInstructions: Instructions to close the encoded VAA account and recover rent
|
|
55
|
+
*/
|
|
56
|
+
export declare function buildPostEncodedVaaInstructions(wormhole: Program<WormholeCoreBridgeSolana>, vaa: Buffer): Promise<{
|
|
57
|
+
encodedVaaAddress: PublicKey;
|
|
58
|
+
postInstructions: InstructionWithEphemeralSigners[];
|
|
59
|
+
closeInstructions: InstructionWithEphemeralSigners[];
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* Build an instruction to close an encoded VAA account, recovering the rent.
|
|
63
|
+
*/
|
|
64
|
+
export declare function buildCloseEncodedVaaInstruction(wormhole: Program<WormholeCoreBridgeSolana>, encodedVaa: PublicKey): Promise<InstructionWithEphemeralSigners>;
|
|
65
|
+
/**
|
|
66
|
+
* Build an instruction to create an encoded VAA account.
|
|
67
|
+
*
|
|
68
|
+
* This is the first step to post a VAA to the Wormhole program.
|
|
69
|
+
*/
|
|
70
|
+
export declare function buildEncodedVaaCreateInstruction(wormhole: Program<WormholeCoreBridgeSolana>, vaa: Buffer, encodedVaaKeypair: Keypair): Promise<InstructionWithEphemeralSigners>;
|
|
71
|
+
/**
|
|
72
|
+
* Find all the encoded VAA accounts that have a given write authority
|
|
73
|
+
* @returns a list of the public keys of the encoded VAA accounts
|
|
74
|
+
*/
|
|
75
|
+
export declare function findEncodedVaaAccountsByWriteAuthority(connection: Connection, writeAuthority: PublicKey, wormholeProgramId: PublicKey): Promise<PublicKey[]>;
|
package/dist/esm/vaa.mjs
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// eslint-disable-next-line unicorn/prefer-node-protocol
|
|
2
|
+
import { Buffer as IsomorphicBuffer } from "buffer";
|
|
3
|
+
import { bs58 } from "@coral-xyz/anchor/dist/cjs/utils/bytes";
|
|
4
|
+
import { sha256 } from "@noble/hashes/sha256";
|
|
5
|
+
import { Keypair, PublicKey } from "@solana/web3.js";
|
|
6
|
+
import { getGuardianSetPda } from "./address.mjs";
|
|
7
|
+
import { CLOSE_ENCODED_VAA_COMPUTE_BUDGET, INIT_ENCODED_VAA_COMPUTE_BUDGET, VERIFY_ENCODED_VAA_COMPUTE_BUDGET, WRITE_ENCODED_VAA_COMPUTE_BUDGET } from "./compute_budget.mjs";
|
|
8
|
+
/**
|
|
9
|
+
* Get the index of the guardian set that signed a VAA
|
|
10
|
+
*/ export function getGuardianSetIndex(vaa) {
|
|
11
|
+
return vaa.readUInt32BE(1);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The default number of signatures to keep in a VAA when using `trimSignatures`.
|
|
15
|
+
* This number was chosen as the maximum number of signatures so that the VAA's contents can be posted in a single Solana transaction.
|
|
16
|
+
*/ export const DEFAULT_REDUCED_GUARDIAN_SET_SIZE = 5;
|
|
17
|
+
/**
|
|
18
|
+
* The size of a guardian signature in a VAA.
|
|
19
|
+
*
|
|
20
|
+
* It is 66 bytes long, the first byte is the guardian index and the next 65 bytes are the signature (including a recovery id).
|
|
21
|
+
*/ export const VAA_SIGNATURE_SIZE = 66;
|
|
22
|
+
/**
|
|
23
|
+
* The start of the VAA bytes in an encoded VAA account. Before this offset, the account contains a header.
|
|
24
|
+
*/ export const VAA_START = 46;
|
|
25
|
+
/**
|
|
26
|
+
* Writing the VAA to an encoded VAA account is done in 2 instructions.
|
|
27
|
+
*
|
|
28
|
+
* The first one writes the first `VAA_SPLIT_INDEX` bytes and the second one writes the rest.
|
|
29
|
+
*
|
|
30
|
+
* This number was chosen as the biggest number such that one can still call `createInstruction`,
|
|
31
|
+
* `initEncodedVaa` and `writeEncodedVaa` in a single Solana transaction, while using an address lookup table.
|
|
32
|
+
* This way, the packing of the instructions to post an encoded vaa is more efficient.
|
|
33
|
+
*/ export const VAA_SPLIT_INDEX = 721;
|
|
34
|
+
/**
|
|
35
|
+
* Trim the number of signatures of a VAA.
|
|
36
|
+
*
|
|
37
|
+
* @returns the same VAA as the input, but with `n` signatures instead of the original number of signatures.
|
|
38
|
+
*
|
|
39
|
+
* A Wormhole VAA typically has a number of signatures equal to two thirds of the number of guardians. However,
|
|
40
|
+
* this function is useful to make VAAs smaller to post their contents in a single Solana transaction.
|
|
41
|
+
*/ export function trimSignatures(vaa, n = DEFAULT_REDUCED_GUARDIAN_SET_SIZE) {
|
|
42
|
+
const currentNumSignatures = vaa[5];
|
|
43
|
+
if (currentNumSignatures === undefined) {
|
|
44
|
+
throw new Error("vaa[5] is undefined");
|
|
45
|
+
}
|
|
46
|
+
if (n > currentNumSignatures) {
|
|
47
|
+
throw new Error("Resulting VAA can't have more signatures than the original VAA");
|
|
48
|
+
}
|
|
49
|
+
const trimmedVaa = IsomorphicBuffer.concat([
|
|
50
|
+
vaa.subarray(0, 6 + n * VAA_SIGNATURE_SIZE),
|
|
51
|
+
vaa.subarray(6 + currentNumSignatures * VAA_SIGNATURE_SIZE)
|
|
52
|
+
]);
|
|
53
|
+
trimmedVaa[5] = n;
|
|
54
|
+
return trimmedVaa;
|
|
55
|
+
}
|
|
56
|
+
// Core function to generate VAA instruction groups
|
|
57
|
+
async function generateVaaInstructionGroups(wormhole, vaa) {
|
|
58
|
+
const encodedVaaKeypair = new Keypair();
|
|
59
|
+
// Create and init instructions
|
|
60
|
+
const initInstructions = [
|
|
61
|
+
await buildEncodedVaaCreateInstruction(wormhole, vaa, encodedVaaKeypair),
|
|
62
|
+
{
|
|
63
|
+
instruction: await wormhole.methods.initEncodedVaa().accounts({
|
|
64
|
+
encodedVaa: encodedVaaKeypair.publicKey
|
|
65
|
+
}).instruction(),
|
|
66
|
+
signers: [],
|
|
67
|
+
computeUnits: INIT_ENCODED_VAA_COMPUTE_BUDGET
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
// First write instruction
|
|
71
|
+
const writeFirstPartInstructions = [
|
|
72
|
+
{
|
|
73
|
+
instruction: await wormhole.methods.writeEncodedVaa({
|
|
74
|
+
index: 0,
|
|
75
|
+
data: vaa.subarray(0, VAA_SPLIT_INDEX)
|
|
76
|
+
}).accounts({
|
|
77
|
+
draftVaa: encodedVaaKeypair.publicKey
|
|
78
|
+
}).instruction(),
|
|
79
|
+
signers: [],
|
|
80
|
+
computeUnits: WRITE_ENCODED_VAA_COMPUTE_BUDGET
|
|
81
|
+
}
|
|
82
|
+
];
|
|
83
|
+
// Second write and verify instructions
|
|
84
|
+
const writeSecondPartAndVerifyInstructions = [];
|
|
85
|
+
// The second write instruction is only needed if there are more bytes past the split index in the VAA
|
|
86
|
+
if (vaa.length > VAA_SPLIT_INDEX) {
|
|
87
|
+
writeSecondPartAndVerifyInstructions.push({
|
|
88
|
+
instruction: await wormhole.methods.writeEncodedVaa({
|
|
89
|
+
index: VAA_SPLIT_INDEX,
|
|
90
|
+
data: vaa.subarray(VAA_SPLIT_INDEX)
|
|
91
|
+
}).accounts({
|
|
92
|
+
draftVaa: encodedVaaKeypair.publicKey
|
|
93
|
+
}).instruction(),
|
|
94
|
+
signers: [],
|
|
95
|
+
computeUnits: WRITE_ENCODED_VAA_COMPUTE_BUDGET
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
writeSecondPartAndVerifyInstructions.push({
|
|
99
|
+
instruction: await wormhole.methods.verifyEncodedVaaV1().accounts({
|
|
100
|
+
guardianSet: getGuardianSetPda(getGuardianSetIndex(vaa), wormhole.programId),
|
|
101
|
+
draftVaa: encodedVaaKeypair.publicKey
|
|
102
|
+
}).instruction(),
|
|
103
|
+
signers: [],
|
|
104
|
+
computeUnits: VERIFY_ENCODED_VAA_COMPUTE_BUDGET
|
|
105
|
+
});
|
|
106
|
+
// Close instructions
|
|
107
|
+
const closeInstructions = [
|
|
108
|
+
{
|
|
109
|
+
instruction: await wormhole.methods.closeEncodedVaa().accounts({
|
|
110
|
+
encodedVaa: encodedVaaKeypair.publicKey
|
|
111
|
+
}).instruction(),
|
|
112
|
+
signers: [],
|
|
113
|
+
computeUnits: CLOSE_ENCODED_VAA_COMPUTE_BUDGET
|
|
114
|
+
}
|
|
115
|
+
];
|
|
116
|
+
return {
|
|
117
|
+
initInstructions,
|
|
118
|
+
writeFirstPartInstructions,
|
|
119
|
+
writeSecondPartAndVerifyInstructions,
|
|
120
|
+
closeInstructions,
|
|
121
|
+
encodedVaaAddress: encodedVaaKeypair.publicKey
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Build instructions to post a single VAA to the Wormhole program.
|
|
126
|
+
* The instructions can be packed efficiently into 2 transactions:
|
|
127
|
+
* - TX1: Create, init the encoded VAA account and write the first part of the VAA
|
|
128
|
+
* - TX2: Write the second part of the VAA and verify it
|
|
129
|
+
*
|
|
130
|
+
* @param wormhole - The Wormhole program instance
|
|
131
|
+
* @param vaa - The VAA buffer to post
|
|
132
|
+
* @returns Result containing:
|
|
133
|
+
* - encodedVaaAddress: Public key of the encoded VAA account
|
|
134
|
+
* - postInstructions: Instructions to post and verify the VAA
|
|
135
|
+
* - closeInstructions: Instructions to close the encoded VAA account and recover rent
|
|
136
|
+
*/ export async function buildPostEncodedVaaInstructions(wormhole, vaa) {
|
|
137
|
+
const groups = await generateVaaInstructionGroups(wormhole, vaa);
|
|
138
|
+
// Pack instructions for optimal 2-transaction pattern:
|
|
139
|
+
// TX1: init + first write
|
|
140
|
+
// TX2: second write + verify
|
|
141
|
+
return {
|
|
142
|
+
encodedVaaAddress: groups.encodedVaaAddress,
|
|
143
|
+
postInstructions: [
|
|
144
|
+
...groups.initInstructions,
|
|
145
|
+
...groups.writeFirstPartInstructions,
|
|
146
|
+
...groups.writeSecondPartAndVerifyInstructions
|
|
147
|
+
],
|
|
148
|
+
closeInstructions: groups.closeInstructions
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Build an instruction to close an encoded VAA account, recovering the rent.
|
|
153
|
+
*/ export async function buildCloseEncodedVaaInstruction(wormhole, encodedVaa) {
|
|
154
|
+
const instruction = await wormhole.methods.closeEncodedVaa().accounts({
|
|
155
|
+
encodedVaa
|
|
156
|
+
}).instruction();
|
|
157
|
+
return {
|
|
158
|
+
instruction,
|
|
159
|
+
signers: [],
|
|
160
|
+
computeUnits: CLOSE_ENCODED_VAA_COMPUTE_BUDGET
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Build an instruction to create an encoded VAA account.
|
|
165
|
+
*
|
|
166
|
+
* This is the first step to post a VAA to the Wormhole program.
|
|
167
|
+
*/ export async function buildEncodedVaaCreateInstruction(wormhole, vaa, encodedVaaKeypair) {
|
|
168
|
+
const encodedVaaSize = vaa.length + VAA_START;
|
|
169
|
+
return {
|
|
170
|
+
instruction: await wormhole.account.encodedVaa.createInstruction(encodedVaaKeypair, encodedVaaSize),
|
|
171
|
+
signers: [
|
|
172
|
+
encodedVaaKeypair
|
|
173
|
+
]
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Find all the encoded VAA accounts that have a given write authority
|
|
178
|
+
* @returns a list of the public keys of the encoded VAA accounts
|
|
179
|
+
*/ export async function findEncodedVaaAccountsByWriteAuthority(connection, writeAuthority, wormholeProgramId) {
|
|
180
|
+
const result = await connection.getProgramAccounts(wormholeProgramId, {
|
|
181
|
+
filters: [
|
|
182
|
+
{
|
|
183
|
+
memcmp: {
|
|
184
|
+
offset: 0,
|
|
185
|
+
bytes: bs58.encode(IsomorphicBuffer.from(sha256("account:EncodedVaa").slice(0, 8)))
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
memcmp: {
|
|
190
|
+
offset: 8 + 1,
|
|
191
|
+
bytes: bs58.encode(writeAuthority.toBuffer())
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
});
|
|
196
|
+
return result.map((account)=>new PublicKey(account.pubkey));
|
|
197
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pythnetwork/pyth-solana-receiver",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Pyth solana receiver SDK",
|
|
5
5
|
"homepage": "https://pyth.network",
|
|
6
|
-
"main": "
|
|
7
|
-
"types": "
|
|
6
|
+
"main": "./dist/cjs/index.cjs",
|
|
7
|
+
"types": "./dist/cjs/index.d.ts",
|
|
8
8
|
"files": [
|
|
9
|
-
"
|
|
9
|
+
"dist/**/*"
|
|
10
10
|
],
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
@@ -22,33 +22,121 @@
|
|
|
22
22
|
],
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"devDependencies": {
|
|
25
|
+
"@cprussin/eslint-config": "^4.0.2",
|
|
25
26
|
"@types/jest": "^29.4.0",
|
|
26
27
|
"@types/node": "^22.14.0",
|
|
27
|
-
"
|
|
28
|
-
"@typescript-eslint/parser": "^5.20.0",
|
|
29
|
-
"eslint": "^8.13.0",
|
|
28
|
+
"eslint": "^9.23.0",
|
|
30
29
|
"jest": "^29.4.0",
|
|
31
30
|
"prettier": "^3.5.3",
|
|
32
31
|
"quicktype": "^23.0.76",
|
|
33
32
|
"ts-jest": "^29.0.5",
|
|
34
33
|
"ts-node": "^10.9.2",
|
|
35
|
-
"
|
|
36
|
-
"@pythnetwork/hermes-client": "2.0.0"
|
|
34
|
+
"@pythnetwork/hermes-client": "3.1.0"
|
|
37
35
|
},
|
|
38
36
|
"dependencies": {
|
|
39
37
|
"@coral-xyz/anchor": "^0.29.0",
|
|
40
38
|
"@noble/hashes": "^1.4.0",
|
|
41
39
|
"@solana/web3.js": "^1.90.0",
|
|
42
|
-
"
|
|
43
|
-
"@pythnetwork/solana-utils": "0.
|
|
40
|
+
"buffer": "^6.0.3",
|
|
41
|
+
"@pythnetwork/solana-utils": "0.6.0",
|
|
42
|
+
"@pythnetwork/price-service-sdk": "1.9.0"
|
|
44
43
|
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": "^24.0.0"
|
|
46
|
+
},
|
|
47
|
+
"type": "module",
|
|
48
|
+
"exports": {
|
|
49
|
+
"./PythSolanaReceiver": {
|
|
50
|
+
"require": {
|
|
51
|
+
"types": "./dist/cjs/PythSolanaReceiver.d.ts",
|
|
52
|
+
"default": "./dist/cjs/PythSolanaReceiver.cjs"
|
|
53
|
+
},
|
|
54
|
+
"import": {
|
|
55
|
+
"types": "./dist/esm/PythSolanaReceiver.d.ts",
|
|
56
|
+
"default": "./dist/esm/PythSolanaReceiver.mjs"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"./address": {
|
|
60
|
+
"require": {
|
|
61
|
+
"types": "./dist/cjs/address.d.ts",
|
|
62
|
+
"default": "./dist/cjs/address.cjs"
|
|
63
|
+
},
|
|
64
|
+
"import": {
|
|
65
|
+
"types": "./dist/esm/address.d.ts",
|
|
66
|
+
"default": "./dist/esm/address.mjs"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"./compute_budget": {
|
|
70
|
+
"require": {
|
|
71
|
+
"types": "./dist/cjs/compute_budget.d.ts",
|
|
72
|
+
"default": "./dist/cjs/compute_budget.cjs"
|
|
73
|
+
},
|
|
74
|
+
"import": {
|
|
75
|
+
"types": "./dist/esm/compute_budget.d.ts",
|
|
76
|
+
"default": "./dist/esm/compute_budget.mjs"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"./idl/pyth_push_oracle": {
|
|
80
|
+
"require": {
|
|
81
|
+
"types": "./dist/cjs/idl/pyth_push_oracle.d.ts",
|
|
82
|
+
"default": "./dist/cjs/idl/pyth_push_oracle.cjs"
|
|
83
|
+
},
|
|
84
|
+
"import": {
|
|
85
|
+
"types": "./dist/esm/idl/pyth_push_oracle.d.ts",
|
|
86
|
+
"default": "./dist/esm/idl/pyth_push_oracle.mjs"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"./idl/pyth_solana_receiver": {
|
|
90
|
+
"require": {
|
|
91
|
+
"types": "./dist/cjs/idl/pyth_solana_receiver.d.ts",
|
|
92
|
+
"default": "./dist/cjs/idl/pyth_solana_receiver.cjs"
|
|
93
|
+
},
|
|
94
|
+
"import": {
|
|
95
|
+
"types": "./dist/esm/idl/pyth_solana_receiver.d.ts",
|
|
96
|
+
"default": "./dist/esm/idl/pyth_solana_receiver.mjs"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"./idl/wormhole_core_bridge_solana": {
|
|
100
|
+
"require": {
|
|
101
|
+
"types": "./dist/cjs/idl/wormhole_core_bridge_solana.d.ts",
|
|
102
|
+
"default": "./dist/cjs/idl/wormhole_core_bridge_solana.cjs"
|
|
103
|
+
},
|
|
104
|
+
"import": {
|
|
105
|
+
"types": "./dist/esm/idl/wormhole_core_bridge_solana.d.ts",
|
|
106
|
+
"default": "./dist/esm/idl/wormhole_core_bridge_solana.mjs"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
".": {
|
|
110
|
+
"require": {
|
|
111
|
+
"types": "./dist/cjs/index.d.ts",
|
|
112
|
+
"default": "./dist/cjs/index.cjs"
|
|
113
|
+
},
|
|
114
|
+
"import": {
|
|
115
|
+
"types": "./dist/esm/index.d.ts",
|
|
116
|
+
"default": "./dist/esm/index.mjs"
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"./vaa": {
|
|
120
|
+
"require": {
|
|
121
|
+
"types": "./dist/cjs/vaa.d.ts",
|
|
122
|
+
"default": "./dist/cjs/vaa.cjs"
|
|
123
|
+
},
|
|
124
|
+
"import": {
|
|
125
|
+
"types": "./dist/esm/vaa.d.ts",
|
|
126
|
+
"default": "./dist/esm/vaa.mjs"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"./package.json": "./package.json"
|
|
130
|
+
},
|
|
131
|
+
"module": "./dist/esm/index.mjs",
|
|
45
132
|
"scripts": {
|
|
46
|
-
"build": "
|
|
133
|
+
"build": "ts-duality",
|
|
47
134
|
"test:lint": "eslint src/ --max-warnings 0",
|
|
48
135
|
"test:format": "prettier --check \"src/**/*.ts\"",
|
|
49
136
|
"fix:lint": "eslint src/ --fix --max-warnings 0",
|
|
50
137
|
"fix:format": "prettier --write \"src/**/*.ts\"",
|
|
51
138
|
"preversion": "pnpm run test:lint",
|
|
52
|
-
"version": "pnpm run format && git add -A src"
|
|
139
|
+
"version": "pnpm run format && git add -A src",
|
|
140
|
+
"clean": "rm -rf ./dist"
|
|
53
141
|
}
|
|
54
142
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PythSolanaReceiver.d.ts","sourceRoot":"","sources":["../src/PythSolanaReceiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,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