import { SuiGraphQLClient } from '@mysten/sui/graphql'; import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import { type BytesLike } from 'ethers'; import type { PickDeep, SetOptional } from 'type-fest'; import { type ChainContext, type ChainStatic, type GetBalanceOpts, type LogFilter, type TokenTransferFeeOpts, Chain } from '../chain.ts'; import type { EVMExtraArgsV2, ExtraArgs, SVMExtraArgsV1, SuiExtraArgsV1 } from '../extra-args.ts'; import type { LeafHasher } from '../hasher/common.ts'; import { type AnyMessage, type CCIPExecution, type CCIPMessage, type CCIPRequest, type ChainLog, type ChainTransaction, type CommitReport, type ExecutionReceipt, type Lane, type NetworkInfo, type WithLogger, ChainFamily } from '../types.ts'; import type { UnsignedSuiTx } from './types.ts'; export type { UnsignedSuiTx }; /** * Sui chain implementation supporting Sui networks. */ export declare class SuiChain extends Chain { static readonly family: "SUI"; static readonly decimals = 9; readonly network: NetworkInfo; readonly client: SuiJsonRpcClient; readonly graphqlClient: SuiGraphQLClient; /** * Creates a new SuiChain instance. * @param client - Sui client for interacting with the Sui network. * @param network - Network information for this chain. */ constructor(client: SuiJsonRpcClient, network: NetworkInfo, ctx?: ChainContext); /** * Creates a SuiChain instance from an RPC URL. * @param url - HTTP or WebSocket endpoint URL for the Sui network. * @returns A new SuiChain instance. * @throws {@link CCIPDataFormatUnsupportedError} if unable to fetch chain identifier * @throws {@link CCIPError} if chain identifier is not supported */ static fromUrl(url: string, ctx?: ChainContext): Promise; /** {@inheritDoc Chain.getBlockTimestamp} */ getBlockTimestamp(block: number | 'finalized'): Promise; /** {@inheritDoc Chain.getTransaction} */ getTransaction(hash: string | number): Promise; /** * {@inheritDoc Chain.getLogs} * @throws {@link CCIPLogsAddressRequiredError} if address is not provided * @throws {@link CCIPTopicsInvalidError} if topics format is invalid */ getLogs(opts: LogFilter & { versionAsHash?: boolean; }): AsyncGenerator<{ address: string; transactionHash: string; index: number; blockNumber: number; data: Record; topics: string[]; }, void, unknown>; /** {@inheritDoc Chain.getMessagesInBatch} */ getMessagesInBatch>(request: R, range: Pick, opts?: Pick): Promise; /** * {@inheritDoc Chain.typeAndVersion} * @throws {@link CCIPDataFormatUnsupportedError} if view call fails */ typeAndVersion(address: string): Promise<[type: string, version: string, typeAndVersion: string, suffix?: string | undefined]>; /** {@inheritDoc Chain.getRouterForOnRamp} */ getRouterForOnRamp(onRamp: string, _destChainSelector: bigint): Promise; /** * {@inheritDoc Chain.getRouterForOffRamp} * @throws {@link CCIPContractNotRouterError} always (Sui architecture doesn't have separate router) */ getRouterForOffRamp(offRamp: string, _sourceChainSelector: bigint): Promise; /** {@inheritDoc Chain.getNativeTokenForRouter} */ getNativeTokenForRouter(): Promise; /** {@inheritDoc Chain.getOffRampsForRouter} */ getOffRampsForRouter(router: string, _sourceChainSelector: bigint): Promise; /** {@inheritDoc Chain.getOnRampForRouter} */ getOnRampForRouter(router: string, _destChainSelector: bigint): Promise; /** * {@inheritDoc Chain.getOnRampsForOffRamp} * @throws {@link CCIPDataFormatUnsupportedError} if view call fails */ getOnRampsForOffRamp(offRamp: string, sourceChainSelector: bigint): Promise; /** * {@inheritDoc Chain.getTokenForTokenPool} * @throws {@link CCIPError} if token pool type is invalid or state not found * @throws {@link CCIPDataFormatUnsupportedError} if view call fails */ getTokenForTokenPool(tokenPool: string): Promise; /** * {@inheritDoc Chain.getTokenInfo} * @throws {@link CCIPError} if token address is invalid or metadata cannot be loaded */ getTokenInfo(token: string): Promise<{ symbol: string; decimals: number; }>; /** {@inheritDoc Chain.getBalance} */ getBalance(_opts: GetBalanceOpts): Promise; /** {@inheritDoc Chain.getTokenAdminRegistryFor} */ getTokenAdminRegistryFor(_address: string): Promise; /** * Decodes a CCIP message from a Sui log event. * @param log - Log event data. * @returns Decoded CCIPMessage or undefined if not valid. * @throws {@link CCIPSuiLogInvalidError} if log data format is invalid */ static decodeMessage(log: ChainLog): CCIPMessage | undefined; /** * Decodes extra arguments from Sui CCIP messages. * @param extraArgs - Encoded extra arguments bytes. * @returns Decoded extra arguments or undefined if unknown format. */ static decodeExtraArgs(extraArgs: BytesLike): (EVMExtraArgsV2 & { _tag: 'EVMExtraArgsV2'; }) | (SVMExtraArgsV1 & { _tag: 'SVMExtraArgsV1'; }) | undefined; /** * Encodes extra arguments for CCIP messages. * @param _extraArgs - Extra arguments to encode. * @returns Encoded extra arguments as a hex string. * @throws {@link CCIPNotImplementedError} always (not yet implemented) */ static encodeExtraArgs(_extraArgs: ExtraArgs): string; /** * Decodes commit reports from a log entry. * @param log - The log entry to decode. * @param lane - Optional lane information. * @returns Array of decoded commit reports or undefined. */ static decodeCommits({ data, topics }: SetOptional, 'topics'>, lane?: Lane): CommitReport[] | undefined; /** * Decodes an execution receipt from a log entry. * @param log - The log entry to decode. * @returns Decoded execution receipt or undefined. */ static decodeReceipt({ data, topics, }: SetOptional, 'topics'>): ExecutionReceipt | undefined; /** * Converts bytes to a Sui address. * @param bytes - Bytes to convert. * @returns Sui address. */ static getAddress(bytes: BytesLike | readonly number[]): string; /** * Validates a transaction hash format for Sui */ static isTxHash(v: unknown): v is string; /** * Gets the leaf hasher for Sui destination chains. * @param lane - Lane configuration. * @returns Leaf hasher function. */ static getDestLeafHasher(lane: Lane, _ctx?: WithLogger): LeafHasher; /** {@inheritDoc Chain.getFee} */ getFee(_opts: Parameters[0]): Promise; /** {@inheritDoc Chain.generateUnsignedSendMessage} */ generateUnsignedSendMessage(_opts: Parameters[0]): Promise; /** {@inheritDoc Chain.sendMessage} */ sendMessage(_opts: Parameters[0]): Promise; /** * {@inheritDoc Chain.generateUnsignedExecute} * @throws {@link CCIPExecutionReportChainMismatchError} if input is not a Sui v1.6 execution report */ generateUnsignedExecute(opts: Parameters[0]): Promise; /** * {@inheritDoc Chain.execute} * @throws {@link CCIPError} if transaction submission fails * @throws {@link CCIPExecTxRevertedError} if transaction reverts */ execute(opts: Parameters[0] & { receiverObjectIds?: string[]; }): Promise; /** * Parses raw Sui data into typed structures. * @param data - Raw data to parse. * @returns Parsed data or undefined. */ static parse(data: unknown): (SVMExtraArgsV1 & { _tag: "SVMExtraArgsV1"; }) | (import("../extra-args.ts").EVMExtraArgsV1 & { allowOutOfOrderExecution: boolean; } & { _tag: "EVMExtraArgsV2"; }) | undefined; /** {@inheritDoc Chain.getSupportedTokens} */ getSupportedTokens(_address: string): Promise; /** {@inheritDoc Chain.getRegistryTokenConfig} */ getRegistryTokenConfig(_address: string, _tokenName: string): Promise; /** {@inheritDoc Chain.getTokenPoolConfig} */ getTokenPoolConfig(_tokenPool: string, _feeOpts?: TokenTransferFeeOpts): Promise; /** {@inheritDoc Chain.getTokenPoolRemotes} */ getTokenPoolRemotes(_tokenPool: string): Promise; /** {@inheritDoc Chain.getFeeTokens} */ getFeeTokens(_router: string): Promise; /** * Returns a copy of a message, populating missing fields like `extraArgs` with defaults. * It's expected to return a message suitable at least for basic token transfers. * * @param message - AnyMessage (from source), containing at least `receiver` * @returns A message suitable for `sendMessage` to this destination chain family * @throws {@link CCIPArgumentInvalidError} if extraArgs contains unknown fields for SuiExtraArgsV1 */ static buildMessageForDest(message: Parameters[0]): AnyMessage & { extraArgs: SuiExtraArgsV1; }; } //# sourceMappingURL=index.d.ts.map