@pythnetwork/pyth-solana-receiver 0.10.0 → 0.10.2
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/PythSolanaReceiver.d.ts +0 -1
- package/lib/PythSolanaReceiver.d.ts.map +1 -1
- package/lib/PythSolanaReceiver.js +2 -2
- package/lib/address.d.ts.map +1 -1
- package/lib/address.js +2 -2
- package/lib/vaa.d.ts +0 -1
- package/lib/vaa.d.ts.map +1 -1
- package/lib/vaa.js +25 -23
- package/package.json +18 -17
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { AnchorProvider, IdlAccounts, Program } from "@coral-xyz/anchor";
|
|
3
2
|
import { AddressLookupTableAccount, Connection, Signer, Transaction, VersionedTransaction } from "@solana/web3.js";
|
|
4
3
|
import { PythSolanaReceiver as PythSolanaReceiverProgram } from "./idl/pyth_solana_receiver";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PythSolanaReceiver.d.ts","sourceRoot":"","sources":["../src/PythSolanaReceiver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PythSolanaReceiver.d.ts","sourceRoot":"","sources":["../src/PythSolanaReceiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACL,yBAAyB,EACzB,UAAU,EACV,MAAM,EACN,WAAW,EACX,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kBAAkB,IAAI,yBAAyB,EAEhD,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,wBAAwB,EAEzB,MAAM,mCAAmC,CAAC;AAU3C,OAAO,EAAE,SAAS,EAAW,MAAM,iBAAiB,CAAC;AAYrD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAS3C,OAAO,EACL,kBAAkB,EAClB,+BAA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IAAI,CAAC;IAMrC;;;;;OAKG;IACH,0BAA0B,CACxB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GAAG,MAAM,GAC3B,SAAS;IAQZ;;;OAGG;IACG,2BAA2B;CAOlC;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,mBAAmB,CAAC,EAAE,SAAS,GAC9B,SAAS,CAmBX"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PythSolanaReceiver = exports.PythTransactionBuilder = exports.DEFAULT_TREASURY_ID = void 0;
|
|
4
|
+
exports.getPriceFeedAccountForProgram = getPriceFeedAccountForProgram;
|
|
4
5
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
5
6
|
const pyth_solana_receiver_1 = require("./idl/pyth_solana_receiver");
|
|
6
7
|
const wormhole_core_bridge_solana_1 = require("./idl/wormhole_core_bridge_solana");
|
|
@@ -630,4 +631,3 @@ function getPriceFeedAccountForProgram(shardId, priceFeedId, pushOracleProgramId
|
|
|
630
631
|
shardBuffer.writeUint16LE(shardId, 0);
|
|
631
632
|
return web3_js_1.PublicKey.findProgramAddressSync([shardBuffer, priceFeedId], pushOracleProgramId ?? address_1.DEFAULT_PUSH_ORACLE_PROGRAM_ID)[0];
|
|
632
633
|
}
|
|
633
|
-
exports.getPriceFeedAccountForProgram = getPriceFeedAccountForProgram;
|
package/lib/address.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../src/address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,2BAA2B,WAEvC,CAAC;AACF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,WAEvC,CAAC;AAEF,eAAO,MAAM,8BAA8B,WAE1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../src/address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,2BAA2B,WAEvC,CAAC;AACF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,WAEvC,CAAC;AAEF,eAAO,MAAM,8BAA8B,WAE1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,kBAAkB,MAAM,EACxB,mBAAmB,SAAS,cAQ7B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,mBAAmB,WAElC;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,GACzB,YAAY,MAAM,EAClB,mBAAmB,SAAS,cAM7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,mBAAmB,SAAS,cAKxD,CAAC"}
|
package/lib/address.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getConfigPda = exports.getTreasuryPda = exports.
|
|
3
|
+
exports.getConfigPda = exports.getTreasuryPda = exports.getGuardianSetPda = exports.DEFAULT_PUSH_ORACLE_PROGRAM_ID = exports.DEFAULT_WORMHOLE_PROGRAM_ID = exports.DEFAULT_RECEIVER_PROGRAM_ID = void 0;
|
|
4
|
+
exports.getRandomTreasuryId = getRandomTreasuryId;
|
|
4
5
|
const web3_js_1 = require("@solana/web3.js");
|
|
5
6
|
/**
|
|
6
7
|
* The default Pyth Solana Receiver program ID.
|
|
@@ -29,7 +30,6 @@ exports.getGuardianSetPda = getGuardianSetPda;
|
|
|
29
30
|
function getRandomTreasuryId() {
|
|
30
31
|
return Math.floor(Math.random() * 256);
|
|
31
32
|
}
|
|
32
|
-
exports.getRandomTreasuryId = getRandomTreasuryId;
|
|
33
33
|
/**
|
|
34
34
|
* Returns the address of a treasury account from the Pyth Solana Receiver program.
|
|
35
35
|
*/
|
package/lib/vaa.d.ts
CHANGED
package/lib/vaa.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vaa.d.ts","sourceRoot":"","sources":["../src/vaa.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vaa.d.ts","sourceRoot":"","sources":["../src/vaa.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAS5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,UAE9C;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,IAAI,CAAC;AAEnD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,SAAS,KAAK,CAAC;AAE5B;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,EACX,CAAC,SAAoC,GACpC,MAAM,CAeR;AAkHD;;;;;;;;;;;;GAYG;AACH,wBAAsB,+BAA+B,CACnD,QAAQ,EAAE,OAAO,CAAC,wBAAwB,CAAC,EAC3C,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IACT,iBAAiB,EAAE,SAAS,CAAC;IAC7B,gBAAgB,EAAE,+BAA+B,EAAE,CAAC;IACpD,iBAAiB,EAAE,+BAA+B,EAAE,CAAC;CACtD,CAAC,CAeD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,uCAAuC,CAC3D,QAAQ,EAAE,OAAO,CAAC,wBAAwB,CAAC,EAC3C,eAAe,EAAE,qBAAqB,EACtC,aAAa,EAAE,qBAAqB,GACnC,OAAO,CAAC;IACT,sBAAsB,EAAE,SAAS,CAAC;IAClC,oBAAoB,EAAE,SAAS,CAAC;IAChC,gBAAgB,EAAE,+BAA+B,EAAE,CAAC;IACpD,iBAAiB,EAAE,+BAA+B,EAAE,CAAC;CACtD,CAAC,CAmCD;AAED;;GAEG;AACH,wBAAsB,+BAA+B,CACnD,QAAQ,EAAE,OAAO,CAAC,wBAAwB,CAAC,EAC3C,UAAU,EAAE,SAAS,GACpB,OAAO,CAAC,+BAA+B,CAAC,CAU1C;AAED;;;;GAIG;AACH,wBAAsB,gCAAgC,CACpD,QAAQ,EAAE,OAAO,CAAC,wBAAwB,CAAC,EAC3C,GAAG,EAAE,MAAM,EACX,iBAAiB,EAAE,OAAO,GACzB,OAAO,CAAC,+BAA+B,CAAC,CAS1C;AAED;;;GAGG;AACH,wBAAsB,sCAAsC,CAC1D,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,SAAS,EACzB,iBAAiB,EAAE,SAAS,GAC3B,OAAO,CAAC,SAAS,EAAE,CAAC,CAoBtB"}
|
package/lib/vaa.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.VAA_SPLIT_INDEX = exports.VAA_START = exports.VAA_SIGNATURE_SIZE = exports.DEFAULT_REDUCED_GUARDIAN_SET_SIZE = void 0;
|
|
4
|
+
exports.getGuardianSetIndex = getGuardianSetIndex;
|
|
5
|
+
exports.trimSignatures = trimSignatures;
|
|
6
|
+
exports.buildPostEncodedVaaInstructions = buildPostEncodedVaaInstructions;
|
|
7
|
+
exports.buildPostEncodedVaasForTwapInstructions = buildPostEncodedVaasForTwapInstructions;
|
|
8
|
+
exports.buildCloseEncodedVaaInstruction = buildCloseEncodedVaaInstruction;
|
|
9
|
+
exports.buildEncodedVaaCreateInstruction = buildEncodedVaaCreateInstruction;
|
|
10
|
+
exports.findEncodedVaaAccountsByWriteAuthority = findEncodedVaaAccountsByWriteAuthority;
|
|
4
11
|
const web3_js_1 = require("@solana/web3.js");
|
|
5
12
|
const compute_budget_1 = require("./compute_budget");
|
|
6
13
|
const sha256_1 = require("@noble/hashes/sha256");
|
|
@@ -12,7 +19,6 @@ const address_1 = require("./address");
|
|
|
12
19
|
function getGuardianSetIndex(vaa) {
|
|
13
20
|
return vaa.readUInt32BE(1);
|
|
14
21
|
}
|
|
15
|
-
exports.getGuardianSetIndex = getGuardianSetIndex;
|
|
16
22
|
/**
|
|
17
23
|
* The default number of signatures to keep in a VAA when using `trimSignatures`.
|
|
18
24
|
* This number was chosen as the maximum number of signatures so that the VAA's contents can be posted in a single Solana transaction.
|
|
@@ -58,7 +64,6 @@ function trimSignatures(vaa, n = exports.DEFAULT_REDUCED_GUARDIAN_SET_SIZE) {
|
|
|
58
64
|
trimmedVaa[5] = n;
|
|
59
65
|
return trimmedVaa;
|
|
60
66
|
}
|
|
61
|
-
exports.trimSignatures = trimSignatures;
|
|
62
67
|
// Core function to generate VAA instruction groups
|
|
63
68
|
async function generateVaaInstructionGroups(wormhole, vaa) {
|
|
64
69
|
const encodedVaaKeypair = new web3_js_1.Keypair();
|
|
@@ -93,8 +98,10 @@ async function generateVaaInstructionGroups(wormhole, vaa) {
|
|
|
93
98
|
},
|
|
94
99
|
];
|
|
95
100
|
// Second write and verify instructions
|
|
96
|
-
const writeSecondPartAndVerifyInstructions = [
|
|
97
|
-
|
|
101
|
+
const writeSecondPartAndVerifyInstructions = [];
|
|
102
|
+
// The second write instruction is only needed if there are more bytes past the split index in the VAA
|
|
103
|
+
if (vaa.length > exports.VAA_SPLIT_INDEX) {
|
|
104
|
+
writeSecondPartAndVerifyInstructions.push({
|
|
98
105
|
instruction: await wormhole.methods
|
|
99
106
|
.writeEncodedVaa({
|
|
100
107
|
index: exports.VAA_SPLIT_INDEX,
|
|
@@ -106,19 +113,19 @@ async function generateVaaInstructionGroups(wormhole, vaa) {
|
|
|
106
113
|
.instruction(),
|
|
107
114
|
signers: [],
|
|
108
115
|
computeUnits: compute_budget_1.WRITE_ENCODED_VAA_COMPUTE_BUDGET,
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
writeSecondPartAndVerifyInstructions.push({
|
|
119
|
+
instruction: await wormhole.methods
|
|
120
|
+
.verifyEncodedVaaV1()
|
|
121
|
+
.accounts({
|
|
122
|
+
guardianSet: (0, address_1.getGuardianSetPda)(getGuardianSetIndex(vaa), wormhole.programId),
|
|
123
|
+
draftVaa: encodedVaaKeypair.publicKey,
|
|
124
|
+
})
|
|
125
|
+
.instruction(),
|
|
126
|
+
signers: [],
|
|
127
|
+
computeUnits: compute_budget_1.VERIFY_ENCODED_VAA_COMPUTE_BUDGET,
|
|
128
|
+
});
|
|
122
129
|
// Close instructions
|
|
123
130
|
const closeInstructions = [
|
|
124
131
|
{
|
|
@@ -166,7 +173,6 @@ async function buildPostEncodedVaaInstructions(wormhole, vaa) {
|
|
|
166
173
|
closeInstructions: groups.closeInstructions,
|
|
167
174
|
};
|
|
168
175
|
}
|
|
169
|
-
exports.buildPostEncodedVaaInstructions = buildPostEncodedVaaInstructions;
|
|
170
176
|
/**
|
|
171
177
|
* Build instructions to post two VAAs for TWAP (Time-Weighted Average Price) calculations,
|
|
172
178
|
* optimized for 3 transactions. This is specifically designed for posting start and end
|
|
@@ -213,7 +219,6 @@ async function buildPostEncodedVaasForTwapInstructions(wormhole, startUpdateData
|
|
|
213
219
|
],
|
|
214
220
|
};
|
|
215
221
|
}
|
|
216
|
-
exports.buildPostEncodedVaasForTwapInstructions = buildPostEncodedVaasForTwapInstructions;
|
|
217
222
|
/**
|
|
218
223
|
* Build an instruction to close an encoded VAA account, recovering the rent.
|
|
219
224
|
*/
|
|
@@ -228,7 +233,6 @@ async function buildCloseEncodedVaaInstruction(wormhole, encodedVaa) {
|
|
|
228
233
|
computeUnits: compute_budget_1.CLOSE_ENCODED_VAA_COMPUTE_BUDGET,
|
|
229
234
|
};
|
|
230
235
|
}
|
|
231
|
-
exports.buildCloseEncodedVaaInstruction = buildCloseEncodedVaaInstruction;
|
|
232
236
|
/**
|
|
233
237
|
* Build an instruction to create an encoded VAA account.
|
|
234
238
|
*
|
|
@@ -241,7 +245,6 @@ async function buildEncodedVaaCreateInstruction(wormhole, vaa, encodedVaaKeypair
|
|
|
241
245
|
signers: [encodedVaaKeypair],
|
|
242
246
|
};
|
|
243
247
|
}
|
|
244
|
-
exports.buildEncodedVaaCreateInstruction = buildEncodedVaaCreateInstruction;
|
|
245
248
|
/**
|
|
246
249
|
* Find all the encoded VAA accounts that have a given write authority
|
|
247
250
|
* @returns a list of the public keys of the encoded VAA accounts
|
|
@@ -265,4 +268,3 @@ async function findEncodedVaaAccountsByWriteAuthority(connection, writeAuthority
|
|
|
265
268
|
});
|
|
266
269
|
return result.map((account) => new web3_js_1.PublicKey(account.pubkey));
|
|
267
270
|
}
|
|
268
|
-
exports.findEncodedVaaAccountsByWriteAuthority = findEncodedVaaAccountsByWriteAuthority;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pythnetwork/pyth-solana-receiver",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "Pyth solana receiver SDK",
|
|
5
5
|
"homepage": "https://pyth.network",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -16,38 +16,39 @@
|
|
|
16
16
|
"publishConfig": {
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "tsc",
|
|
21
|
-
"format": "prettier --write \"src/**/*.ts\"",
|
|
22
|
-
"test:lint": "eslint src/",
|
|
23
|
-
"prepublishOnly": "pnpm run build && pnpm test:lint",
|
|
24
|
-
"preversion": "pnpm run test:lint",
|
|
25
|
-
"version": "pnpm run format && git add -A src"
|
|
26
|
-
},
|
|
27
19
|
"keywords": [
|
|
28
20
|
"pyth",
|
|
29
21
|
"oracle"
|
|
30
22
|
],
|
|
31
23
|
"license": "Apache-2.0",
|
|
32
24
|
"devDependencies": {
|
|
33
|
-
"@pythnetwork/hermes-client": "2.0.0",
|
|
34
25
|
"@types/jest": "^29.4.0",
|
|
26
|
+
"@types/node": "^22.14.0",
|
|
35
27
|
"@typescript-eslint/eslint-plugin": "^5.20.0",
|
|
36
28
|
"@typescript-eslint/parser": "^5.20.0",
|
|
37
29
|
"eslint": "^8.13.0",
|
|
38
30
|
"jest": "^29.4.0",
|
|
39
|
-
"prettier": "^
|
|
31
|
+
"prettier": "^3.5.3",
|
|
40
32
|
"quicktype": "^23.0.76",
|
|
41
33
|
"ts-jest": "^29.0.5",
|
|
42
34
|
"ts-node": "^10.9.2",
|
|
43
|
-
"typescript": "^
|
|
35
|
+
"typescript": "^5.8.2",
|
|
36
|
+
"@pythnetwork/hermes-client": "2.0.0"
|
|
44
37
|
},
|
|
45
38
|
"dependencies": {
|
|
46
39
|
"@coral-xyz/anchor": "^0.29.0",
|
|
47
40
|
"@noble/hashes": "^1.4.0",
|
|
48
|
-
"@
|
|
49
|
-
"@pythnetwork/solana-utils": "0.4.
|
|
50
|
-
"@
|
|
41
|
+
"@solana/web3.js": "^1.90.0",
|
|
42
|
+
"@pythnetwork/solana-utils": "0.4.5",
|
|
43
|
+
"@pythnetwork/price-service-sdk": "1.8.0"
|
|
51
44
|
},
|
|
52
|
-
"
|
|
53
|
-
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "tsc",
|
|
47
|
+
"test:lint": "eslint src/ --max-warnings 0",
|
|
48
|
+
"test:format": "prettier --check \"src/**/*.ts\"",
|
|
49
|
+
"fix:lint": "eslint src/ --fix --max-warnings 0",
|
|
50
|
+
"fix:format": "prettier --write \"src/**/*.ts\"",
|
|
51
|
+
"preversion": "pnpm run test:lint",
|
|
52
|
+
"version": "pnpm run format && git add -A src"
|
|
53
|
+
}
|
|
54
|
+
}
|