import { AccountMeta, AddressLookupTableAccount, Keypair, PublicKey, Transaction, TransactionInstruction, VersionedTransaction } from '@solana/web3.js'; import { Address, Domain, LazyAsync } from '@hyperlane-xyz/utils'; import { BaseSealevelAdapter } from '../../app/MultiProtocolApp.js'; import { IgpPaymentKeys, SealevelIgpProgramAdapter } from '../../gas/adapters/SealevelIgpAdapter.js'; import { SealevelIgpFeeConfig } from '../../gas/adapters/serialization.js'; import type { MultiProviderAdapter } from '../../providers/MultiProviderAdapter.js'; import { ChainName } from '../../types.js'; import { TokenMetadata } from '../types.js'; import { IHypTokenAdapter, ITokenAdapter, InterchainGasQuote, Quote, QuoteTransferRemoteParams, TransferParams, TransferRemoteParams } from './ITokenAdapter.js'; import { SealevelHyperlaneTokenData, SealevelTokenFeeConfig } from './serialization.js'; /** * The compute limit to set for the transfer remote instruction. * This is typically around ~160k, but can be higher depending on * the index in the merkle tree, which can result in more moderately * more expensive merkle tree insertion. * Because a higher compute limit doesn't increase the fee for a transaction, * we generously request 1M units. */ export declare const TRANSFER_REMOTE_COMPUTE_LIMIT = 1000000; export declare class SealevelNativeTokenAdapter extends BaseSealevelAdapter implements ITokenAdapter { getBalance(address: Address): Promise; getMetadata(): Promise; getMinimumTransferAmount(recipient: Address): Promise; isApproveRequired(): Promise; isRevokeApprovalRequired(_owner: Address, _spender: Address): Promise; populateApproveTx(): Promise; populateTransferTx({ weiAmountOrId, recipient, fromAccountOwner, }: TransferParams): Promise; getTotalSupply(): Promise; } export declare class SealevelTokenAdapter extends BaseSealevelAdapter implements ITokenAdapter { readonly chainName: ChainName; readonly multiProvider: MultiProviderAdapter; readonly addresses: { token: Address; }; readonly tokenMintPubKey: PublicKey; constructor(chainName: ChainName, multiProvider: MultiProviderAdapter, addresses: { token: Address; }); getBalance(owner: Address): Promise; getMetadata(_isNft?: boolean): Promise; getMinimumTransferAmount(_recipient: Address): Promise; isApproveRequired(): Promise; isRevokeApprovalRequired(_owner: Address, _spender: Address): Promise; populateApproveTx(_params: TransferParams): Promise; populateTransferTx({ weiAmountOrId, recipient, fromAccountOwner, fromTokenAccount, }: TransferParams): Promise; getTokenProgramId(): Promise; isSpl2022(): Promise; deriveAssociatedTokenAccount(owner: PublicKey): Promise; getTotalSupply(): Promise; } export interface SealevelAltAddresses { core: Address; warpSpecific: Address[]; } /** * Building blocks of a `transfer_remote` (or `transfer_remote_to`) tx — the * Sealevel adapter exposes this for composable callers (e.g. the offchain- * quoted-transfer provider) that need to prepend extra ixs between the * compute-budget head and the warp call. * * Fields are split deliberately: * * - `computeBudgetInstructions` — Solana compute-budget ixs. The composing * caller MUST place them at the head of the final tx (priority-fee and * CU-limit ixs are conventionally first; some RPC/wallet stacks rely on * that position when computing per-tx priority). * * - `transferInstructions` — the warp `transfer_remote` / `transfer_remote_to` * instructions themselves. Submit-quote ixs (warp fee, IGP) for the * offchain-quoted flow are prepended directly BEFORE these. * * Final tx order: `[...computeBudgetInstructions, ...submitQuoteIxs?, ...transferInstructions]`. */ export interface SealevelTransferBundle { computeBudgetInstructions: TransactionInstruction[]; transferInstructions: TransactionInstruction[]; addressLookupTableAccounts: AddressLookupTableAccount[]; feePayer: PublicKey; signers: Keypair[]; } interface HypTokenAddresses { token: Address; warpRouter: Address; mailbox: Address; altAddresses?: SealevelAltAddresses; } export declare abstract class SealevelHypTokenAdapter extends SealevelTokenAdapter implements IHypTokenAdapter { readonly chainName: ChainName; readonly multiProvider: MultiProviderAdapter; readonly warpProgramPubKey: PublicKey; readonly addresses: HypTokenAddresses; protected abstract readonly pluginDataSize: number; protected readonly tokenAccountData: LazyAsync; constructor(chainName: ChainName, multiProvider: MultiProviderAdapter, addresses: HypTokenAddresses); getTokenAccountData(): Promise; getFeeConfig(): Promise; readonly innerIgpFeeState: LazyAsync<{ innerIgpAccount: PublicKey; overheadIgpAccount?: PublicKey; gasOverheads?: Map; feeConfig: SealevelIgpFeeConfig | undefined; } | undefined>; private loadInnerIgpFeeState; /** * Address-or-denom value used for `tokenFeeQuote.addressOrDenom`. The * on-chain fee is deducted from the warp token; native adapters override * to return undefined (SOL sentinel). */ protected getFeeTokenAddressOrDenom(): string | undefined; protected readonly addressLookupTableAccounts: LazyAsync; private loadAddressLookupTableAccounts; protected readonly feeAccountBeneficiaryOwner: LazyAsync; private loadFeeAccountBeneficiaryOwner; /** * Per-token-type derivation of the terminal `fee_beneficiary` spliced into * the warp transfer_remote fee section. Matches * `HyperlaneSealevelTokenPlugin::fee_beneficiary_pubkey` on chain. */ protected abstract deriveFeeBeneficiary(beneficiaryOwner: PublicKey): Promise; /** * Build the fee-section account list. Spliced into the warp transfer_remote * after the dispatched-message PDA, when `token.fee_config` is Some. * [feeProgram, feeAccount, ...passThrough, feeBeneficiary(w)] * * `scopedSalt` (optional) is the pre-scoped 32-byte salt for an offchain * transient fee quote — when set, the on-chain cascade enumerator * (`GetQuoteAccountMetas`) returns the transient-quote PDA alongside the * standing path so a same-tx `SubmitFeeQuote` can deposit there. Standing- * only callers omit it. */ protected buildFeeSectionKeys({ feeConfig, payer, destination, targetRouter, scopedSalt, }: { feeConfig: SealevelTokenFeeConfig; payer: PublicKey; destination: Domain; targetRouter: Uint8Array; scopedSalt?: Uint8Array; }): Promise; /** * Build the quoted-mode IGP extension. Spliced into the IGP section between * the gas-payment PDA and the configured IGP account when the inner Igp * has `fee_config` set: * [igpQuoteAuthority, warpProgramId, ...cascade] * * The IGP quote authority is the warp's `invoke_signed` PDA at runtime; it * is NOT marked as a signer at the outer-instruction level. */ protected buildIgpQuotedSectionKeys({ igpProgramId, innerIgpAccount, payer, destination, scopedSalt, }: { igpProgramId: PublicKey; innerIgpAccount: PublicKey; payer: PublicKey; destination: Domain; /** * Pre-scoped 32-byte salt for an offchain transient IGP quote. When set, * `GetIgpQuoteAccountMetas` returns the transient PDA in its cascade. * Forward-looking — SVM IGP doesn't accept offchain submits today. */ scopedSalt?: Uint8Array; }): Promise; private loadTokenAccountData; getMetadata(): Promise; getDomains(): Promise; getRouterAddress(domain: Domain): Promise; getAllRouters(): Promise>; getBridgedSupply(): Promise; quoteTransferRemoteGas({ destination, sender, recipient, amount, }: QuoteTransferRemoteParams): Promise; protected quoteTransferGas({ destination, sender, recipient, amount, targetRouter, }: { destination: Domain; sender?: Address; recipient?: Address; amount?: bigint; targetRouter: Uint8Array; }): Promise; protected quoteWarpFee({ feeConfig, payer, destination, recipient, amount, targetRouter, }: { feeConfig: SealevelTokenFeeConfig; payer: PublicKey; destination: Domain; recipient: Address; amount: bigint; targetRouter: Uint8Array; }): Promise; private quoteIgpNewFlow; /** * Legacy (pre-offchain-quoting) on-chain IGP gas payment for `destination`. * The fallback the submit path takes when the route's IGP has no new-flow * `fee_config`; 0n when the route has no IGP. Shared with the offchain-quoted * display path so displayed and paid IGP fees agree on non-upgraded routes. */ quoteLegacyIgpGasPayment(destination: Domain, gasAmount: bigint, sender: PublicKey): Promise; /** * Sealevel-only — returns the building blocks of a `transfer_remote` tx * (compute-budget ixs separated from the warp ix, ALTs, fee payer, the * randomWallet signer) without compiling them into a `Transaction` / * `VersionedTransaction`. The composing layer (typically the offchain- * quoted-transfer provider) prepends `SubmitFeeQuote` / `SubmitIgpQuote` * ixs between the compute-budget head and the transfer ix. * * `scopedSalt` (optional) is the 32-byte `keccak256(payer || clientSalt)` * for a same-tx offchain transient quote — threaded through to the fee + * IGP cascade simulations so their PDA enumeration includes the transient * quote PDA. Matches the on-chain `scoped_salt` field. Standing-only * callers omit it. * * `populateTransferRemoteTx` wraps this with a blockhash fetch + tx * compilation; provider-level composition uses the bundle directly. */ getTransferRemoteIxBundle({ weiAmountOrId, destination, recipient, fromAccountOwner, extraSigners, scopedSalt, }: TransferRemoteParams & { /** Sealevel-only — see method docs. */ scopedSalt?: Uint8Array; }): Promise; populateTransferRemoteTx(params: TransferRemoteParams): Promise; getIgpKeys(): Promise; getTransferInstructionKeyList({ sender, mailbox, randomWallet, igp, feeSection, igpQuotedSection, }: KeyListParams): Promise>; deriveMailboxOutboxAccount(mailbox: PublicKey): PublicKey; deriveMessageDispatchAuthorityAccount(): PublicKey; deriveMsgStorageAccount(mailbox: PublicKey, randomWalletPubKey: PublicKey): PublicKey; deriveHypTokenAccount(): PublicKey; deriveAtaPayerAccount(): PublicKey; /** * Fetches the median prioritization fee for transfers of the collateralAddress token. * @returns The median prioritization fee in micro-lamports, defaults to `0` when chain is not solanamainnet */ getMedianPriorityFee(): Promise; protected getIgpAdapter(tokenData: SealevelHyperlaneTokenData): SealevelIgpProgramAdapter | undefined; } export declare class SealevelHypNativeAdapter extends SealevelHypTokenAdapter { readonly chainName: ChainName; readonly multiProvider: MultiProviderAdapter; protected readonly pluginDataSize = 1; readonly wrappedNative: SealevelNativeTokenAdapter; protected getFeeTokenAddressOrDenom(): string | undefined; protected deriveFeeBeneficiary(beneficiaryOwner: PublicKey): Promise; constructor(chainName: ChainName, multiProvider: MultiProviderAdapter, addresses: { token?: Address; warpRouter: Address; mailbox: Address; altAddresses?: SealevelAltAddresses; }); getBalance(owner: Address): Promise; getBridgedSupply(): Promise; getMetadata(): Promise; getMinimumTransferAmount(recipient: Address): Promise; getMedianPriorityFee(): Promise; getTransferInstructionKeyList(params: KeyListParams): Promise>; deriveNativeTokenCollateralAccount(): PublicKey; deriveAtaPayerAccount(): PublicKey; } export declare class SealevelHypCollateralAdapter extends SealevelHypTokenAdapter { protected readonly pluginDataSize = 98; protected deriveFeeBeneficiary(beneficiaryOwner: PublicKey): Promise; getBalance(owner: Address): Promise; getBridgedSupply(): Promise; getTransferInstructionKeyList(params: KeyListParams): Promise>; deriveEscrowAccount(): PublicKey; } export declare class SealevelHypSyntheticAdapter extends SealevelHypTokenAdapter { protected readonly pluginDataSize = 34; protected deriveFeeBeneficiary(beneficiaryOwner: PublicKey): Promise; getTransferInstructionKeyList(params: KeyListParams): Promise>; getBalance(owner: Address): Promise; getBridgedSupply(): Promise; getTotalSupply(): Promise; deriveMintAuthorityAccount(): PublicKey; deriveAssociatedTokenAccount(owner: PublicKey): Promise; } interface KeyListParams { sender: PublicKey; mailbox: PublicKey; randomWallet: PublicKey; igp?: IgpPaymentKeys; /** * Optional fee section spliced after the dispatched-message PDA when the * token has `fee_config` set. Layout: * [feeProgram, feeAccount, ...passThrough, feeBeneficiary(w)] */ feeSection?: AccountMeta[]; /** * Optional quoted-mode IGP extension spliced between the gas-payment PDA * and the configured IGP account when the inner Igp has `fee_config` set: * [dispatchAuthority, warpProgramId, ...cascade] */ igpQuotedSection?: AccountMeta[]; } export {}; //# sourceMappingURL=SealevelTokenAdapter.d.ts.map