Skip to content

Commit af5f065

Browse files
committed
feat(pyth-sui-js): Migrate from price-service-client to hermes-client
1 parent 2887d6d commit af5f065

File tree

5 files changed

+23
-15
lines changed

5 files changed

+23
-15
lines changed

pnpm-lock.yaml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

target_chains/sui/sdk/js/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/pyth-sui-js",
3-
"version": "2.2.0",
3+
"version": "2.3.0",
44
"description": "Pyth Network Sui Utilities",
55
"homepage": "https://pyth.network",
66
"author": {
@@ -55,7 +55,7 @@
5555
},
5656
"dependencies": {
5757
"@mysten/sui": "^1.3.0",
58-
"@pythnetwork/price-service-client": "workspace:*",
58+
"@pythnetwork/hermes-client": "workspace:*",
5959
"buffer": "^6.0.3"
6060
}
6161
}
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import {
2-
PriceServiceConnection,
3-
HexString,
4-
} from "@pythnetwork/price-service-client";
2+
HermesClient,
3+
HexString,
4+
PriceUpdate,
5+
} from "@pythnetwork/hermes-client";
56
import { Buffer } from "buffer";
67

7-
export class SuiPriceServiceConnection extends PriceServiceConnection {
8+
export class SuiPriceServiceConnection extends HermesClient {
89
/**
910
* Gets price update data (either batch price attestation VAAs or accumulator messages, depending on the chosen endpoint), which then
1011
* can be submitted to the Pyth contract to update the prices. This will throw an axios error if there is a network problem or
@@ -15,7 +16,7 @@ export class SuiPriceServiceConnection extends PriceServiceConnection {
1516
*/
1617
async getPriceFeedsUpdateData(priceIds: HexString[]): Promise<Buffer[]> {
1718
// Fetch the latest price feed update VAAs from the price service
18-
const latestVaas = await this.getLatestVaas(priceIds);
19-
return latestVaas.map((vaa) => Buffer.from(vaa, "base64"));
19+
const latestVaas: PriceUpdate = await this.getLatestPriceUpdates(priceIds, { encoding: "base64", parsed: false });
20+
return latestVaas.binary.data.map((vaa) => Buffer.from(vaa, "base64"));
2021
}
2122
}

target_chains/sui/sdk/js/src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { SuiClient } from "@mysten/sui/client";
22
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
33
import { Transaction } from "@mysten/sui/transactions";
44
import { bcs } from "@mysten/sui/bcs";
5-
import { HexString } from "@pythnetwork/price-service-client";
5+
import { HexString } from "@pythnetwork/hermes-client";
66
import { Buffer } from "buffer";
77

88
const MAX_ARGUMENT_SIZE = 16 * 1024;

target_chains/sui/sdk/js/src/index.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@ export { SuiPriceServiceConnection } from "./SuiPriceServiceConnection";
22
export { SuiPythClient } from "./client";
33

44
export {
5+
AssetType,
6+
BinaryPriceUpdate,
57
DurationInMs,
8+
DurationInSeconds,
9+
EncodingType,
10+
HermesClientConfig,
611
HexString,
7-
Price,
8-
PriceFeed,
9-
PriceServiceConnectionConfig,
12+
PriceFeedMetadata,
13+
PriceIdInput,
14+
PriceUpdate,
15+
PublisherCaps,
16+
TwapsResponse,
1017
UnixTimestamp,
11-
} from "@pythnetwork/price-service-client";
18+
} from "@pythnetwork/hermes-client";

0 commit comments

Comments
 (0)