UNPKG

@hyperlane-xyz/sdk

Version:

The official SDK for the Hyperlane Network

128 lines 6.68 kB
import { AccountMeta, PublicKey, Transaction } 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 type { MultiProviderAdapter } from '../../providers/MultiProviderAdapter.js'; import { ChainName } from '../../types.js'; import { TokenMetadata } from '../types.js'; import { IHypTokenAdapter, ITokenAdapter, InterchainGasQuote, QuoteTransferRemoteParams, TransferParams, TransferRemoteParams } from './ITokenAdapter.js'; import { SealevelHyperlaneTokenData } 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<Transaction> { getBalance(address: Address): Promise<bigint>; getMetadata(): Promise<TokenMetadata>; getMinimumTransferAmount(recipient: Address): Promise<bigint>; isApproveRequired(): Promise<boolean>; isRevokeApprovalRequired(_owner: Address, _spender: Address): Promise<boolean>; populateApproveTx(): Promise<Transaction>; populateTransferTx({ weiAmountOrId, recipient, fromAccountOwner, }: TransferParams): Promise<Transaction>; getTotalSupply(): Promise<bigint | undefined>; } export declare class SealevelTokenAdapter extends BaseSealevelAdapter implements ITokenAdapter<Transaction> { 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<bigint>; getMetadata(_isNft?: boolean): Promise<TokenMetadata>; getMinimumTransferAmount(_recipient: Address): Promise<bigint>; isApproveRequired(): Promise<boolean>; isRevokeApprovalRequired(_owner: Address, _spender: Address): Promise<boolean>; populateApproveTx(_params: TransferParams): Promise<Transaction>; populateTransferTx({ weiAmountOrId, recipient, fromAccountOwner, fromTokenAccount, }: TransferParams): Promise<Transaction>; getTokenProgramId(): Promise<PublicKey>; isSpl2022(): Promise<boolean>; deriveAssociatedTokenAccount(owner: PublicKey): Promise<PublicKey>; getTotalSupply(): Promise<bigint | undefined>; } interface HypTokenAddresses { token: Address; warpRouter: Address; mailbox: Address; } export declare abstract class SealevelHypTokenAdapter extends SealevelTokenAdapter implements IHypTokenAdapter<Transaction> { readonly chainName: ChainName; readonly multiProvider: MultiProviderAdapter; readonly warpProgramPubKey: PublicKey; readonly addresses: HypTokenAddresses; protected readonly tokenAccountData: LazyAsync<SealevelHyperlaneTokenData>; constructor(chainName: ChainName, multiProvider: MultiProviderAdapter, addresses: HypTokenAddresses); getTokenAccountData(): Promise<SealevelHyperlaneTokenData>; private loadTokenAccountData; getMetadata(): Promise<TokenMetadata>; getDomains(): Promise<Domain[]>; getRouterAddress(domain: Domain): Promise<Buffer>; getAllRouters(): Promise<Array<{ domain: Domain; address: Buffer; }>>; getBridgedSupply(): Promise<bigint | undefined>; quoteTransferRemoteGas({ destination, sender, }: QuoteTransferRemoteParams): Promise<InterchainGasQuote>; populateTransferRemoteTx({ weiAmountOrId, destination, recipient, fromAccountOwner, extraSigners, }: TransferRemoteParams): Promise<Transaction>; getIgpKeys(): Promise<IgpPaymentKeys | undefined>; getTransferInstructionKeyList({ sender, mailbox, randomWallet, igp, }: KeyListParams): Promise<Array<AccountMeta>>; 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<number | undefined>; protected getIgpAdapter(tokenData: SealevelHyperlaneTokenData): SealevelIgpProgramAdapter | undefined; } export declare class SealevelHypNativeAdapter extends SealevelHypTokenAdapter { readonly chainName: ChainName; readonly multiProvider: MultiProviderAdapter; readonly wrappedNative: SealevelNativeTokenAdapter; constructor(chainName: ChainName, multiProvider: MultiProviderAdapter, addresses: { token?: Address; warpRouter: Address; mailbox: Address; }); getBalance(owner: Address): Promise<bigint>; getBridgedSupply(): Promise<bigint>; getMetadata(): Promise<TokenMetadata>; getMinimumTransferAmount(recipient: Address): Promise<bigint>; getMedianPriorityFee(): Promise<number | undefined>; getTransferInstructionKeyList(params: KeyListParams): Promise<Array<AccountMeta>>; deriveNativeTokenCollateralAccount(): PublicKey; deriveAtaPayerAccount(): PublicKey; } export declare class SealevelHypCollateralAdapter extends SealevelHypTokenAdapter { getBalance(owner: Address): Promise<bigint>; getBridgedSupply(): Promise<bigint>; getTransferInstructionKeyList(params: KeyListParams): Promise<Array<AccountMeta>>; deriveEscrowAccount(): PublicKey; } export declare class SealevelHypSyntheticAdapter extends SealevelHypTokenAdapter { getTransferInstructionKeyList(params: KeyListParams): Promise<Array<AccountMeta>>; getBalance(owner: Address): Promise<bigint>; getBridgedSupply(): Promise<bigint>; getTotalSupply(): Promise<bigint>; deriveMintAuthorityAccount(): PublicKey; deriveAssociatedTokenAccount(owner: PublicKey): Promise<PublicKey>; } interface KeyListParams { sender: PublicKey; mailbox: PublicKey; randomWallet: PublicKey; igp?: IgpPaymentKeys; } export {}; //# sourceMappingURL=SealevelTokenAdapter.d.ts.map