@hyperlane-xyz/sdk
Version:
The official SDK for the Hyperlane Network
91 lines • 4.33 kB
TypeScript
import { AccountMeta, PublicKey, Transaction, TransactionInstruction } from '@solana/web3.js';
import { Address, Domain } from '@hyperlane-xyz/utils';
import { BaseSealevelAdapter } from '../../app/MultiProtocolApp.js';
import type { MultiProviderAdapter } from '../../providers/MultiProviderAdapter.js';
import { ChainName } from '../../types.js';
import { SealevelGasOracle, SealevelGasOracleConfig, SealevelGasOverheadConfig, SealevelIgpData, SealevelOverheadIgpData, SealevelRemoteGasData } from './serialization.js';
export interface IgpPaymentKeys {
programId: PublicKey;
igpAccount: PublicKey;
overheadIgpAccount?: PublicKey;
}
export declare abstract class SealevelIgpProgramAdapter extends BaseSealevelAdapter {
readonly chainName: ChainName;
readonly multiProvider: MultiProviderAdapter;
readonly addresses: {
programId: Address;
};
protected readonly programId: PublicKey;
constructor(chainName: ChainName, multiProvider: MultiProviderAdapter, addresses: {
programId: Address;
});
abstract getPaymentKeys(): Promise<IgpPaymentKeys>;
quoteGasPayment(destination: Domain, gasAmount: bigint, payerKey: PublicKey): Promise<bigint>;
static deriveIgpProgramPda(igpProgramId: string | PublicKey): PublicKey;
static deriveGasPaymentPda(igpProgramId: string | PublicKey, randomWalletPubKey: PublicKey): PublicKey;
static deriveIgpAccountPda(programId: string | PublicKey, salt: Uint8Array): PublicKey;
static deriveIgpAccountPdaWithBump(programId: string | PublicKey, salt: Uint8Array): [PublicKey, number];
static deriveOverheadIgpAccountPda(programId: string | PublicKey, salt: Uint8Array): PublicKey;
static deriveOverheadIgpAccountPdaWithBump(programId: string | PublicKey, salt: Uint8Array): [PublicKey, number];
}
export declare class SealevelIgpAdapter extends SealevelIgpProgramAdapter {
readonly chainName: ChainName;
readonly multiProvider: MultiProviderAdapter;
readonly addresses: {
igp: Address;
programId: Address;
};
protected readonly igp: PublicKey;
constructor(chainName: ChainName, multiProvider: MultiProviderAdapter, addresses: {
igp: Address;
programId: Address;
});
getPaymentKeys(): Promise<IgpPaymentKeys>;
getAccountInfo(): Promise<SealevelIgpData>;
getClaimInstructionKeyList(beneficiary: PublicKey): Array<AccountMeta>;
/**
* Constructs a Transaction for .
* @param {PublicKey} beneficiary - The IGP's configured beneficiary.
* @returns {Promise<TransactionInstruction>} The claim instruction.
*/
populateClaimTx(beneficiary: PublicKey): Promise<Transaction>;
/**
* Create a SetGasOracleConfigs instruction
*/
createSetGasOracleConfigsInstruction(igpAccount: PublicKey, owner: PublicKey, configs: SealevelGasOracleConfig[]): TransactionInstruction;
/**
* Create a gas oracle config from remote gas data
*/
createGasOracleConfig(domain: number, remoteGasData: SealevelRemoteGasData | null): SealevelGasOracleConfig;
/**
* Check if gas oracle matches expected config
*/
gasOracleMatches(currentOracle: SealevelGasOracle | undefined, expected: SealevelRemoteGasData): {
matches: boolean;
actual: SealevelRemoteGasData | null;
};
}
export declare class SealevelOverheadIgpAdapter extends SealevelIgpProgramAdapter {
readonly chainName: ChainName;
readonly multiProvider: MultiProviderAdapter;
readonly addresses: {
overheadIgp: Address;
programId: Address;
};
protected readonly overheadIgp: PublicKey;
constructor(chainName: ChainName, multiProvider: MultiProviderAdapter, addresses: {
overheadIgp: Address;
programId: Address;
});
getAccountInfo(): Promise<SealevelOverheadIgpData>;
getPaymentKeys(): Promise<IgpPaymentKeys>;
/**
* Create a SetDestinationGasOverheads instruction
*/
createSetDestinationGasOverheadsInstruction(overheadIgpAccount: PublicKey, owner: PublicKey, configs: SealevelGasOverheadConfig[]): TransactionInstruction;
/**
* Create a gas overhead config
*/
createGasOverheadConfig(destination_domain: number, gas_overhead: bigint | null): SealevelGasOverheadConfig;
}
//# sourceMappingURL=SealevelIgpAdapter.d.ts.map