diff --git a/package-lock.json b/package-lock.json index 7ee10e73d2..3c1ba83984 100644 --- a/package-lock.json +++ b/package-lock.json @@ -59678,7 +59678,7 @@ }, "target_chains/sui/sdk/js": { "name": "@pythnetwork/pyth-sui-js", - "version": "1.2.0", + "version": "1.2.1", "license": "Apache-2.0", "dependencies": { "@mysten/sui.js": "^0.37.1", diff --git a/target_chains/sui/cli/src/cli.ts b/target_chains/sui/cli/src/cli.ts index 386ab93758..24ed8c95a7 100644 --- a/target_chains/sui/cli/src/cli.ts +++ b/target_chains/sui/cli/src/cli.ts @@ -40,7 +40,7 @@ const OPTIONS = { }, endpoint: { type: "string", - desc: "Price service endpoint to use, defaults to https://xc-mainnet.pyth.network for mainnet and https://xc-testnet.pyth.network for testnet", + desc: "Price service endpoint to use, defaults to https://hermes.pyth.network for mainnet and https://hermes-beta.pyth.network for testnet", }, "feed-id": { type: "array", diff --git a/target_chains/sui/sdk/js/package.json b/target_chains/sui/sdk/js/package.json index 40be40f8a5..027c2f6e85 100644 --- a/target_chains/sui/sdk/js/package.json +++ b/target_chains/sui/sdk/js/package.json @@ -1,6 +1,6 @@ { "name": "@pythnetwork/pyth-sui-js", - "version": "1.2.0", + "version": "1.2.1", "description": "Pyth Network Sui Utilities", "homepage": "https://pyth.network", "author": { diff --git a/target_chains/sui/sdk/js/src/client.ts b/target_chains/sui/sdk/js/src/client.ts index 232bd94636..a665ce3e30 100644 --- a/target_chains/sui/sdk/js/src/client.ts +++ b/target_chains/sui/sdk/js/src/client.ts @@ -6,6 +6,7 @@ import { TransactionBlock, } from "@mysten/sui.js"; import { HexString } from "@pythnetwork/price-service-client"; +import { Buffer } from "buffer"; const MAX_ARGUMENT_SIZE = 16 * 1024; @@ -155,6 +156,12 @@ export class SuiPythClient { } const priceInfoObjects: ObjectId[] = []; + const baseUpdateFee = await this.getBaseUpdateFee(); + const coins = tx.splitCoins( + tx.gas, + feedIds.map(() => tx.pure(baseUpdateFee)) + ); + let coinId = 0; for (const feedId of feedIds) { const priceInfoObjectId = await this.getPriceFeedObjectId(feedId); if (!priceInfoObjectId) { @@ -163,19 +170,17 @@ export class SuiPythClient { ); } priceInfoObjects.push(priceInfoObjectId); - const coin = tx.splitCoins(tx.gas, [ - tx.pure(await this.getBaseUpdateFee()), - ]); [priceUpdatesHotPotato] = tx.moveCall({ target: `${packageId}::pyth::update_single_price_feed`, arguments: [ tx.object(this.pythStateId), priceUpdatesHotPotato, tx.object(priceInfoObjectId), - coin, + coins[coinId], tx.object(SUI_CLOCK_OBJECT_ID), ], }); + coinId++; } tx.moveCall({ target: `${packageId}::hot_potato_vector::destroy`, diff --git a/target_chains/sui/sdk/js/src/examples/SuiRelay.ts b/target_chains/sui/sdk/js/src/examples/SuiRelay.ts index 0d15b698ff..d126f07dcf 100644 --- a/target_chains/sui/sdk/js/src/examples/SuiRelay.ts +++ b/target_chains/sui/sdk/js/src/examples/SuiRelay.ts @@ -7,7 +7,7 @@ import { RawSigner, TransactionBlock, } from "@mysten/sui.js"; - +import { Buffer } from "buffer"; import { SuiPythClient } from "../client"; import { SuiPriceServiceConnection } from "../index";