import type { ClientWithCoreApi } from "@mysten/sui/client"; import type { SuiObjectRef } from "@mysten/sui/jsonRpc"; import type { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519"; import type { HermesClient } from "@pythnetwork/hermes-client"; import { SuiPythClient } from "@pythnetwork/pyth-sui-js"; import type { Logger } from "pino"; import type { IPricePusher, PriceInfo, PriceItem } from "../interface.js"; import { ChainPriceListener } from "../interface.js"; import type { DurationInSeconds } from "../utils.js"; type ObjectId = string; /** * Sui transport selector. `json-rpc` is the legacy default; `grpc` migrates to * the transport Sui Foundation is replacing JSON-RPC with (public JSON-RPC * endpoints are turned off in July 2026, removed entirely by mid-Oct 2026). */ export type SuiEndpointType = "json-rpc" | "grpc"; /** Sui network label passed to the `@mysten/sui` v2 clients. */ export type SuiNetwork = "mainnet" | "testnet" | "devnet" | "localnet"; /** gRPC request metadata (e.g. `{ "x-token": "" }`) sent on every call. */ export type SuiGrpcMetadata = Record; /** * Both the `@mysten/sui` v2 JSON-RPC client (`SuiJsonRpcClient`) and the * experimental gRPC client (`SuiGrpcClient`) expose the unified `.core` API. * The pusher reads and writes exclusively through `.core` so the same driver * works over either transport. * * `SuiGrpcClient` defaults to a grpc-web (HTTP/1.1) transport, which the Sui * providers' native-gRPC (HTTP/2) endpoints reject; it also drops the `meta` * option on that default path, so credentials never reach the wire. We * therefore build an explicit `@protobuf-ts/grpc-transport` (native gRPC over * `@grpc/grpc-js`) and pass the auth header through its `meta`. */ export declare function createSuiProvider(endpointType: SuiEndpointType, network: SuiNetwork, url: string, grpcMetadata?: SuiGrpcMetadata): ClientWithCoreApi; export declare class SuiPriceListener extends ChainPriceListener { private pythClient; private provider; private logger; constructor(pythStateId: ObjectId, wormholeStateId: ObjectId, endpoint: string, endpointType: SuiEndpointType, network: SuiNetwork, priceItems: PriceItem[], logger: Logger, config: { pollingFrequency: DurationInSeconds; }, grpcMetadata?: SuiGrpcMetadata); getOnChainPriceInfo(priceId: string): Promise; } /** * The `SuiPricePusher` is designed for high-throughput of price updates. * Achieving this property requires sacrificing some nice-to-have features of other * pusher implementations that can reduce cost when running multiple pushers. It also requires * jumping through some Sui-specific hoops in order to maximize parallelism. * * The two main design features are: * 1. This implementation does not use `update_price_feeds_if_necssary` and simulate the transaction * before submission. If multiple instances of this pusher are running in parallel, all of them will * land all of their pushed updates on-chain. * 2. The pusher will split the Coin balance in the provided account into a pool of different Coin objects. * Each transaction will be allocated a Coin object from this pool as needed. This process enables the * transactions to avoid referencing the same owned objects, which allows them to be processed in parallel. */ export declare class SuiPricePusher implements IPricePusher { private readonly signer; private readonly provider; private logger; private hermesClient; private gasBudget; private gasPool; private pythClient; constructor(signer: Ed25519Keypair, provider: ClientWithCoreApi, logger: Logger, hermesClient: HermesClient, gasBudget: number, gasPool: SuiObjectRef[], pythClient: SuiPythClient); /** * Create a price pusher with a pool of `numGasObjects` gas coins that will be used to send transactions. * The gas coins of the wallet for the provided keypair will be merged and then evenly split into `numGasObjects`. */ static createWithAutomaticGasPool(hermesClient: HermesClient, logger: Logger, pythStateId: string, wormholeStateId: string, endpoint: string, endpointType: SuiEndpointType, network: SuiNetwork, keypair: Ed25519Keypair, gasBudget: number, numGasObjects: number, ignoreGasObjects: string[], grpcMetadata?: SuiGrpcMetadata): Promise; updatePriceFeed(priceIds: string[], pubTimesToPush: number[]): Promise; /** Send every transaction in txs in parallel, returning when all transactions have completed. */ private sendTransactionBlocks; /** Send a single transaction block using a gas coin from the pool. */ private sendTransactionBlock; private static initializeGasPool; private static tryRefreshObjectReference; private static getAllGasCoins; private static splitGasCoinEqually; private static mergeGasCoinsIntoOne; } export {};