Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion target_chains/sui/sdk/js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const priceUpdateData = await connection.getPriceFeedsUpdateData(priceIds); // s
// It is either injected from browser or instantiated in backend via some private key
const wallet: SignerWithProvider = getWallet();
// Get the state ids of the Pyth and Wormhole contracts from
// https://docs.pyth.network/documentation/pythnet-price-feeds/sui
// https://docs.pyth.network/price-feeds/contract-addresses/sui
const wormholeStateId = " 0xFILL_ME";
const pythStateId = "0xFILL_ME";

Expand Down
4 changes: 2 additions & 2 deletions target_chains/sui/sdk/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pythnetwork/pyth-sui-js",
"version": "2.2.0",
"version": "2.3.0",
"description": "Pyth Network Sui Utilities",
"homepage": "https://pyth.network",
"author": {
Expand Down Expand Up @@ -55,7 +55,7 @@
},
"dependencies": {
"@mysten/sui": "^1.3.0",
"@pythnetwork/price-service-client": "workspace:*",
"@pythnetwork/hermes-client": "workspace:*",
"buffer": "^6.0.3"
}
}
13 changes: 7 additions & 6 deletions target_chains/sui/sdk/js/src/SuiPriceServiceConnection.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import {
PriceServiceConnection,
HexString,
} from "@pythnetwork/price-service-client";
HermesClient,
HexString,
PriceUpdate,
} from "@pythnetwork/hermes-client";
import { Buffer } from "buffer";

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's call this update data instead of Vaas (they are not vaas anymore)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks.

return latestVaas.binary.data.map((vaa) => Buffer.from(vaa, "base64"));
}
}
2 changes: 1 addition & 1 deletion target_chains/sui/sdk/js/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SuiClient } from "@mysten/sui/client";
import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
import { Transaction } from "@mysten/sui/transactions";
import { bcs } from "@mysten/sui/bcs";
import { HexString } from "@pythnetwork/price-service-client";
import { HexString } from "@pythnetwork/hermes-client";
import { Buffer } from "buffer";

const MAX_ARGUMENT_SIZE = 16 * 1024;
Expand Down
15 changes: 11 additions & 4 deletions target_chains/sui/sdk/js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@ export { SuiPriceServiceConnection } from "./SuiPriceServiceConnection";
export { SuiPythClient } from "./client";

export {
AssetType,
BinaryPriceUpdate,
DurationInMs,
DurationInSeconds,
EncodingType,
HermesClientConfig,
HexString,
Price,
PriceFeed,
PriceServiceConnectionConfig,
PriceFeedMetadata,
PriceIdInput,
PriceUpdate,
PublisherCaps,
TwapsResponse,
UnixTimestamp,
} from "@pythnetwork/price-service-client";
} from "@pythnetwork/hermes-client";
Loading