import { Aptos, AptosConfig, Network } from '@aptos-labs/ts-sdk'; import { type BytesLike } from 'ethers'; import type { PickDeep } from 'type-fest'; import { type ChainContext, type GetBalanceOpts, type LogFilter, type TokenInfo, type TokenPoolRemote, type TokenPrice, type TokenTransferFeeOpts, Chain } from '../chain.ts'; import { type EVMExtraArgsV2, type ExtraArgs, type SVMExtraArgsV1 } from '../extra-args.ts'; import { type UnsignedAptosTx } from './types.ts'; import type { LeafHasher } from '../hasher/common.ts'; import { type CCIPExecution, type CCIPMessage, type CCIPRequest, type ChainLog, type ChainTransaction, type CommitReport, type ExecutionReceipt, type Lane, type NetworkInfo, type WithLogger, ChainFamily } from '../types.ts'; export type { UnsignedAptosTx }; /** * Aptos chain implementation supporting Aptos networks. */ export declare class AptosChain extends Chain { /** Chain family identifier for Aptos networks. */ static readonly family: "APTOS"; /** Native token decimals (8 for APT). */ static readonly decimals = 8; /** The Aptos SDK provider for blockchain interactions. */ provider: Aptos; /** Retrieves token information for a given token address. */ getTokenInfo: (token: string) => Promise; /** @internal */ _getAccountModulesNames: (address: string) => Promise; /** * Creates a new AptosChain instance. * @param provider - Aptos SDK provider instance. * @param network - Network information for this chain. */ constructor(provider: Aptos, network: NetworkInfo, ctx?: ChainContext); /** * Creates an AptosChain instance from an existing Aptos provider. * @param provider - Aptos SDK provider instance. * @param ctx - context containing logger. * @returns A new AptosChain instance. */ static fromProvider(provider: Aptos, ctx?: WithLogger): Promise; /** * Creates an AptosChain instance from an Aptos configuration. * @param config - Aptos configuration object. * @param ctx - context containing logger. * @returns A new AptosChain instance. */ static fromAptosConfig(config: AptosConfig, ctx?: WithLogger): Promise; /** * Creates an AptosChain instance from a URL or network identifier. * @param url - RPC URL, Aptos Network enum value or [fullNodeUrl, Network] tuple. * @param ctx - context containing logger * @returns A new AptosChain instance. * @throws {@link CCIPAptosNetworkUnknownError} if network cannot be determined from URL */ static fromUrl(url: string | Network | readonly [string, Network], ctx?: ChainContext): Promise; /** {@inheritDoc Chain.getBlockTimestamp} */ getBlockTimestamp(version: number | 'finalized'): Promise; /** * {@inheritDoc Chain.getTransaction} * @throws {@link CCIPAptosTransactionInvalidError} if hash/version format is invalid * @throws {@link CCIPAptosTransactionTypeInvalidError} if transaction is not a user transaction */ getTransaction(hashOrVersion: string | number): Promise; /** {@inheritDoc Chain.getLogs} */ getLogs(opts: LogFilter & { versionAsHash?: boolean; }): AsyncIterableIterator; /** {@inheritDoc Chain.getMessagesInBatch} */ getMessagesInBatch>(request: R, range: Pick, opts?: { page?: number; }): Promise; /** {@inheritDoc Chain.typeAndVersion} */ 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} */ getRouterForOffRamp(offRamp: string, _sourceChainSelector: bigint): Promise; /** {@inheritDoc Chain.getNativeTokenForRouter} */ getNativeTokenForRouter(_router: string): Promise; /** {@inheritDoc Chain.getOffRampsForRouter} */ getOffRampsForRouter(router: string, _sourceChainSelector: bigint): Promise; /** {@inheritDoc Chain.getOnRampForRouter} */ getOnRampForRouter(router: string, _destChainSelector: bigint): Promise; /** {@inheritDoc Chain.getOnRampsForOffRamp} */ getOnRampsForOffRamp(offRamp: string, sourceChainSelector: bigint): Promise; /** {@inheritDoc Chain.getTokenForTokenPool} */ getTokenForTokenPool(tokenPool: string): Promise; /** {@inheritDoc Chain.getBalance} */ getBalance(opts: GetBalanceOpts): Promise; /** * {@inheritDoc Chain.getTokenAdminRegistryFor} * @throws {@link CCIPAptosRegistryTypeInvalidError} if registry type is invalid */ getTokenAdminRegistryFor(address: string): Promise; /** * Decodes a CCIP message from an Aptos log event. * @param log - Log with data field. * @returns Decoded CCIPMessage or undefined if not valid. * @throws {@link CCIPAptosLogInvalidError} if log data format is invalid */ static decodeMessage(log: { data: BytesLike | Record; }): CCIPMessage | undefined; /** * Decodes extra arguments from Aptos 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 Aptos CCIP messages. * @param extraArgs - Extra arguments to encode. * @returns Encoded extra arguments as hex string. * @throws {@link CCIPAptosExtraArgsEncodingError} if extra args format is not supported */ static encodeExtraArgs(extraArgs: ExtraArgs): string; /** * Decodes commit reports from an Aptos log event. * @param log - Log with data field. * @param lane - Lane info for filtering. * @returns Array of CommitReport or undefined if not valid. * @throws {@link CCIPAptosLogInvalidError} if log data format is invalid */ static decodeCommits({ data }: Pick, lane?: Lane): CommitReport[] | undefined; /** * Decodes an execution receipt from an Aptos log event. * @param log - Log with data field. * @returns ExecutionReceipt or undefined if not valid. * @throws {@link CCIPAptosLogInvalidError} if log data format is invalid */ static decodeReceipt({ data }: Pick): ExecutionReceipt | undefined; /** * Converts bytes to an Aptos address. * @param bytes - Bytes to convert. * @returns Aptos address (0x-prefixed hex, 32 bytes padded). * @throws {@link CCIPDataFormatUnsupportedError} if bytes length exceeds 32 */ static getAddress(bytes: BytesLike | readonly number[]): string; /** * Validates a transaction hash format for Aptos */ static isTxHash(v: unknown): v is `0x${string}`; /** * Gets the leaf hasher for Aptos destination chains. * @param lane - Lane configuration. * @returns Leaf hasher function. */ static getDestLeafHasher(lane: Lane, _ctx?: WithLogger): LeafHasher; /** {@inheritDoc Chain.getFee} */ getFee({ router, destChainSelector, message, }: Parameters[0]): Promise; /** {@inheritDoc Chain.generateUnsignedSendMessage} */ generateUnsignedSendMessage(opts: Parameters[0]): Promise; /** * {@inheritDoc Chain.sendMessage} * @throws {@link CCIPAptosWalletInvalidError} if wallet is not a valid Aptos account */ sendMessage(opts: Parameters[0]): Promise; /** * {@inheritDoc Chain.generateUnsignedExecute} * @throws {@link CCIPAptosExtraArgsV2RequiredError} if message missing EVMExtraArgsV2 fields */ generateUnsignedExecute({ payer, ...opts }: Parameters[0]): Promise; /** * {@inheritDoc Chain.execute} * @throws {@link CCIPAptosWalletInvalidError} if wallet is not a valid Aptos account */ execute(opts: Parameters[0]): Promise; /** * Parses raw Aptos 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, opts?: { page?: number; }): Promise; /** * {@inheritDoc Chain.getRegistryTokenConfig} * @throws {@link CCIPAptosTokenNotRegisteredError} if token is not registered */ getRegistryTokenConfig(registry: string, token: string): Promise<{ administrator: string; pendingAdministrator?: string; tokenPool?: string; }>; /** {@inheritDoc Chain.getTokenPoolConfig} */ getTokenPoolConfig(tokenPool: string, _feeOpts?: TokenTransferFeeOpts): Promise<{ token: string; router: string; typeAndVersion?: string; }>; /** {@inheritDoc Chain.getTokenPoolRemotes} */ getTokenPoolRemotes(tokenPool: string, remoteChainSelector?: bigint): Promise>; /** {@inheritDoc Chain.getTokenPrice} */ getTokenPrice(opts: { router: string; token: string; timestamp?: number; }): Promise; /** {@inheritDoc Chain.getFeeTokens} */ getFeeTokens(router: string): Promise>; } //# sourceMappingURL=index.d.ts.map