update price service sdk (#849)

* update price service sdk

* bump version

* fix test

* include slot

* bump price-service-client version

* bump all that uses price-service-client

* bump all that uses price-service-client
This commit is contained in:
Daniel Chew 2023-05-29 20:18:29 +09:00 committed by GitHub
parent ce8e064c98
commit f99f23c416
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 52 additions and 33 deletions

18
package-lock.json generated
View File

@ -55583,7 +55583,7 @@
},
"price_pusher": {
"name": "@pythnetwork/price-pusher",
"version": "5.1.0",
"version": "5.3.0",
"license": "Apache-2.0",
"dependencies": {
"@injectivelabs/sdk-ts": "1.10.72",
@ -57014,7 +57014,7 @@
},
"price_service/client/js": {
"name": "@pythnetwork/price-service-client",
"version": "1.4.1",
"version": "1.5.0",
"license": "Apache-2.0",
"dependencies": {
"@pythnetwork/price-service-sdk": "*",
@ -57104,7 +57104,7 @@
},
"price_service/sdk/js": {
"name": "@pythnetwork/price-service-sdk",
"version": "1.2.0",
"version": "1.3.0",
"license": "Apache-2.0",
"devDependencies": {
"@types/jest": "^29.4.0",
@ -57237,7 +57237,7 @@
},
"target_chains/aptos/sdk/js": {
"name": "@pythnetwork/pyth-aptos-js",
"version": "1.0.2",
"version": "1.1.0",
"license": "Apache-2.0",
"dependencies": {
"@pythnetwork/price-service-client": "*",
@ -57328,7 +57328,7 @@
},
"target_chains/cosmwasm/sdk/js": {
"name": "@pythnetwork/pyth-terra-js",
"version": "1.1.2",
"version": "1.2.0",
"license": "Apache-2.0",
"dependencies": {
"@pythnetwork/price-service-client": "*",
@ -57400,7 +57400,7 @@
},
"target_chains/cosmwasm/tools": {
"name": "@pythnetwork/cosmwasm-deploy-tools",
"version": "1.0.0",
"version": "1.1.0",
"license": "ISC",
"dependencies": {
"@cosmjs/cosmwasm-stargate": "^0.29.5",
@ -57409,6 +57409,7 @@
"@injectivelabs/networks": "1.0.68",
"@injectivelabs/sdk-ts": "1.0.354",
"@ltd/j-toml": "^1.38.0",
"@pythnetwork/price-service-client": "*",
"@pythnetwork/xc-governance-sdk": "*",
"@terra-money/terra.js": "^3.1.3",
"adm-zip": "^0.5.10",
@ -58370,7 +58371,7 @@
},
"target_chains/ethereum/sdk/js": {
"name": "@pythnetwork/pyth-evm-js",
"version": "1.16.1",
"version": "1.17.0",
"license": "Apache-2.0",
"dependencies": {
"@pythnetwork/price-service-client": "*",
@ -66809,6 +66810,7 @@
"@injectivelabs/networks": "1.0.68",
"@injectivelabs/sdk-ts": "1.0.354",
"@ltd/j-toml": "^1.38.0",
"@pythnetwork/price-service-client": "*",
"@pythnetwork/xc-governance-sdk": "*",
"@terra-money/terra.js": "^3.1.3",
"@types/adm-zip": "^0.5.0",
@ -67336,7 +67338,7 @@
"version": "file:price_pusher",
"requires": {
"@injectivelabs/sdk-ts": "1.10.72",
"@mysten/sui.js": "*",
"@mysten/sui.js": "^0.34.0",
"@pythnetwork/price-service-client": "*",
"@pythnetwork/pyth-sdk-solidity": "*",
"@truffle/hdwallet-provider": "^2.1.3",

View File

@ -1,6 +1,6 @@
{
"name": "@pythnetwork/price-pusher",
"version": "5.2.1",
"version": "5.3.0",
"description": "Pyth Price Pusher",
"homepage": "https://pyth.network",
"main": "lib/index.js",

View File

@ -1,6 +1,6 @@
{
"name": "@pythnetwork/price-service-client",
"version": "1.4.1",
"version": "1.5.0",
"description": "Pyth price service client",
"author": {
"name": "Pyth Data Association"

View File

@ -1,6 +1,6 @@
{
"name": "@pythnetwork/price-service-sdk",
"version": "1.2.0",
"version": "1.3.0",
"description": "Pyth price service SDK",
"homepage": "https://pyth.network",
"main": "lib/index.js",

View File

@ -83,7 +83,7 @@ export class PriceFeedMetadata {
/**
* Attestation time of the price
*/
attestationTime: number;
attestationTime?: number;
/**
* Chain of the emitter
*/
@ -91,22 +91,28 @@ export class PriceFeedMetadata {
/**
* The time that the price service received the price
*/
priceServiceReceiveTime: number;
priceServiceReceiveTime?: number;
/**
* Sequence number of the price
*/
sequenceNumber: number;
sequenceNumber?: number;
/**
* Pythnet slot number of the price
*/
slot?: number;
constructor(metadata: {
attestationTime: number;
attestationTime?: number;
emitterChain: number;
receiveTime: number;
sequenceNumber: number;
receiveTime?: number;
sequenceNumber?: number;
slot?: number;
}) {
this.attestationTime = metadata.attestationTime;
this.emitterChain = metadata.emitterChain;
this.priceServiceReceiveTime = metadata.receiveTime;
this.sequenceNumber = metadata.sequenceNumber;
this.slot = metadata.slot;
}
static fromJson(json: any): PriceFeedMetadata | undefined {
@ -119,6 +125,7 @@ export class PriceFeedMetadata {
emitterChain: jsonFeed.emitter_chain,
receiveTime: jsonFeed.price_service_receive_time,
sequenceNumber: jsonFeed.sequence_number,
slot: jsonFeed.slot,
});
}
@ -128,6 +135,7 @@ export class PriceFeedMetadata {
emitter_chain: this.emitterChain,
price_service_receive_time: this.priceServiceReceiveTime,
sequence_number: this.sequenceNumber,
slot: this.slot,
};
// this is done to avoid sending undefined values to the server
return Convert.priceFeedMetadataToJson(jsonFeed);

View File

@ -68,7 +68,7 @@ export interface PriceFeedMetadata {
/**
* Attestation time of the price
*/
attestation_time: number;
attestation_time?: number;
/**
* Chain of the emitter
*/
@ -76,11 +76,15 @@ export interface PriceFeedMetadata {
/**
* The time that the price service received the price
*/
price_service_receive_time: number;
price_service_receive_time?: number;
/**
* Sequence number of the price
*/
sequence_number: number;
sequence_number?: number;
/**
* Pythnet slot number of the price
*/
slot?: number;
}
// Converts JSON types to/from your types
@ -284,14 +288,19 @@ const typeMap: any = {
),
PriceFeedMetadata: o(
[
{ json: "attestation_time", js: "attestation_time", typ: 0 },
{
json: "attestation_time",
js: "attestation_time",
typ: u(undefined, 0),
},
{ json: "emitter_chain", js: "emitter_chain", typ: 0 },
{
json: "price_service_receive_time",
js: "price_service_receive_time",
typ: 0,
typ: u(undefined, 0),
},
{ json: "sequence_number", js: "sequence_number", typ: 0 },
{ json: "sequence_number", js: "sequence_number", typ: u(undefined, 0) },
{ json: "slot", js: "slot", typ: u(undefined, 0) },
],
"any"
),

View File

@ -58,12 +58,7 @@
"PriceFeedMetadata": {
"description": "Represents metadata of a price feed.",
"type": "object",
"required": [
"attestation_time",
"emitter_chain",
"price_service_receive_time",
"sequence_number"
],
"required": ["emitter_chain"],
"properties": {
"attestation_time": {
"description": "Attestation time of the price",
@ -84,6 +79,11 @@
"description": "Sequence number of the price",
"type": "integer",
"format": "int64"
},
"slot": {
"description": "Pythnet slot number of the price",
"type": "integer",
"format": "int64"
}
}
}

View File

@ -1,6 +1,6 @@
{
"name": "@pythnetwork/pyth-aptos-js",
"version": "1.0.2",
"version": "1.1.0",
"description": "Pyth Network Aptos Utilities",
"homepage": "https://pyth.network",
"author": {

View File

@ -1,6 +1,6 @@
{
"name": "@pythnetwork/pyth-terra-js",
"version": "1.1.2",
"version": "1.2.0",
"description": "Pyth Network Terra Utils in JS",
"homepage": "https://pyth.network",
"author": {

View File

@ -1,6 +1,6 @@
{
"name": "@pythnetwork/cosmwasm-deploy-tools",
"version": "1.0.0",
"version": "1.1.0",
"description": "",
"main": "deploy-pyth-bridge.ts",
"scripts": {

View File

@ -1,6 +1,6 @@
{
"name": "@pythnetwork/pyth-evm-js",
"version": "1.16.1",
"version": "1.17.0",
"description": "Pyth Network EVM Utils in JS",
"homepage": "https://pyth.network",
"author": {