[price service] Return VAA without prepending publish time (#577)

* [price service] Return VAA without prepending publish time

* bump version

---------

Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
This commit is contained in:
Jayant Krishnamurthy 2023-02-10 10:15:49 -08:00 committed by GitHub
parent 7f991bbdbc
commit 3e9472b8ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 18 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "@pythnetwork/price-service-server", "name": "@pythnetwork/price-service-server",
"version": "2.3.5", "version": "3.0.0",
"description": "Pyth price pervice server", "description": "Webservice for retrieving prices from the Pyth oracle.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"format": "prettier --write \"src/**/*.ts\"", "format": "prettier --write \"src/**/*.ts\"",

View File

@ -246,13 +246,9 @@ describe("Get VAA endpoint and Get VAA CCIP", () => {
.query({ .query({
data: "0x" + id + pubTime16AsHex64Bit, data: "0x" + id + pubTime16AsHex64Bit,
}); });
const pubTime20AsHex64Bit = "0000000000000014";
expect(ccipResp.status).toBe(StatusCodes.OK); expect(ccipResp.status).toBe(StatusCodes.OK);
expect(ccipResp.body).toEqual({ expect(ccipResp.body).toEqual({
data: data: "0x" + Buffer.from("abcd20", "base64").toString("hex"),
"0x" +
pubTime20AsHex64Bit +
Buffer.from("abcd20", "base64").toString("hex"),
}); });
}); });
@ -372,10 +368,7 @@ describe("Get VAA endpoint and Get VAA CCIP", () => {
}); });
expect(ccipResp.status).toBe(StatusCodes.OK); expect(ccipResp.status).toBe(StatusCodes.OK);
expect(ccipResp.body).toEqual({ expect(ccipResp.body).toEqual({
data: data: "0x" + Buffer.from(`pythnet${id}5`, "base64").toString("hex"),
"0x" +
pubTime5AsHex64Bit +
Buffer.from(`pythnet${id}5`, "base64").toString("hex"),
}); });
dbApp.close(); dbApp.close();

View File

@ -239,13 +239,7 @@ export class RestAPI {
.status(StatusCodes.BAD_GATEWAY) .status(StatusCodes.BAD_GATEWAY)
.json({ "message:": "VAA not found." }); .json({ "message:": "VAA not found." });
} else { } else {
const pubTimeBuffer = Buffer.alloc(8); const resData = "0x" + Buffer.from(vaa.vaa, "base64").toString("hex");
pubTimeBuffer.writeBigInt64BE(BigInt(vaa.publishTime));
const resData =
"0x" +
pubTimeBuffer.toString("hex") +
Buffer.from(vaa.vaa, "base64").toString("hex");
res.json({ res.json({
data: resData, data: resData,