/**
 * @prettier
 */
import * as request from 'superagent';
import { AuditDecryptedKeyParams, BaseBroadcastTransactionOptions, BaseBroadcastTransactionResult, BaseCoin, ParseTransactionOptions as BaseParseTransactionOptions, TransactionPrebuild as BaseTransactionPrebuild, BitGoBase, ITokenEnablement, KeyPair, Memo, MPCAlgorithm, MPCConsolidationRecoveryOptions, MPCRecoveryOptions, MPCSweepRecoveryOptions, MPCSweepTxs, MPCTx, MPCTxs, MultisigType, ParsedTransaction, PopulatedIntent, PrebuildTransactionWithIntentOptions, PresignTransactionOptions, SignedTransaction, SignTransactionOptions, TokenEnablement, TokenEnablementConfig, TransactionExplanation, TransactionParams, TransactionRecipient, VerifyTransactionOptions, TssVerifyAddressOptions } from '@bitgo/sdk-core';
import { BaseNetwork, CoinFamily, BaseCoin as StaticsBaseCoin } from '@bitgo/statics';
import { TransactionExplanation as SolLibTransactionExplanation } from './lib/iface';
export declare const DEFAULT_SCAN_FACTOR = 20;
export interface TransactionFee {
    fee: string;
}
export type SolTransactionExplanation = TransactionExplanation;
export interface ExplainTransactionOptions {
    txBase64: string;
    feeInfo: TransactionFee;
    tokenAccountRentExemptAmount?: string;
    coinName?: string;
}
export interface TxInfo {
    recipients: TransactionRecipient[];
    from: string;
    txid: string;
}
export interface SolSignTransactionOptions extends SignTransactionOptions {
    txPrebuild: TransactionPrebuild;
    prv: string | string[];
    pubKeys?: string[];
}
export interface TransactionPrebuild extends BaseTransactionPrebuild {
    txBase64: string;
    txInfo: TxInfo;
    source: string;
}
export interface SolVerifyTransactionOptions extends VerifyTransactionOptions {
    memo?: Memo;
    feePayer: string;
    blockhash: string;
    durableNonce?: {
        walletNonceAddress: string;
        authWalletAddress: number;
    };
}
interface TransactionOutput {
    address: string;
    amount: number | string;
    tokenName?: string;
}
type TransactionInput = TransactionOutput;
export interface SolParsedTransaction extends ParsedTransaction {
    inputs: TransactionInput[];
    outputs: TransactionOutput[];
}
export interface SolParseTransactionOptions extends BaseParseTransactionOptions {
    txBase64: string;
    feeInfo: TransactionFee;
    tokenAccountRentExemptAmount?: string;
}
interface SolDurableNonceFromNode {
    authority: string;
    blockhash: string;
}
interface TokenAmount {
    amount: string;
    decimals: number;
    uiAmount: number;
    uiAmountString: string;
}
interface TokenAccountInfo {
    isNative: boolean;
    mint: string;
    owner: string;
    state: string;
    tokenAmount: TokenAmount;
}
interface TokenAccount {
    info: TokenAccountInfo;
    pubKey: string;
    tokenName?: string;
}
export interface SolRecoveryOptions extends MPCRecoveryOptions {
    durableNonce?: {
        publicKey: string;
        secretKey: string;
    };
    tokenContractAddress?: string;
    closeAtaAddress?: string;
    recoveryDestinationAtaAddress?: string;
    nestedAtaAddress?: string;
    ownerAtaAddress?: string;
    tokenMintAddress?: string;
    programId?: string;
    apiKey?: string;
}
export interface SolConsolidationRecoveryOptions extends MPCConsolidationRecoveryOptions {
    durableNonces: {
        publicKeys: string[];
        secretKey: string;
    };
    tokenContractAddress?: string;
    apiKey?: string;
    programId?: string;
}
/**
 * Get amount string corrected for architecture-specific endianness issues.
 *
 * On s390x (big-endian) architecture, the Solana transaction parser (via @solana/web3.js)
 * incorrectly reads little-endian u64 amounts as big-endian, resulting in corrupted values.
 *
 * This function corrects all amounts on s390x by swapping byte order to undo
 * the incorrect byte order that happened during transaction parsing.
 *
 * @param amount - The amount to check and potentially fix
 * @returns The corrected amount as a string
 */
export declare function getAmountBasedOnEndianness(amount: string | number): string;
export declare class Sol extends BaseCoin {
    protected readonly _staticsCoin: Readonly<StaticsBaseCoin>;
    constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>);
    static createInstance(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>): BaseCoin;
    allowsAccountConsolidations(): boolean;
    supportsTss(): boolean;
    /** @inheritDoc */
    supportsMessageSigning(): boolean;
    /** inherited doc */
    getDefaultMultisigType(): MultisigType;
    getMPCAlgorithm(): MPCAlgorithm;
    getChain(): string;
    getFamily(): CoinFamily;
    getFullName(): string;
    getNetwork(): BaseNetwork;
    getBaseFactor(): string | number;
    verifyTxType(expectedTypeFromUserParams: string, actualTypeFromDecoded: string | undefined): void;
    throwIfMissingTokenEnablementsOrReturn(explanation: TransactionExplanation): ITokenEnablement[];
    throwIfMissingEnableTokenConfigOrReturn(txParams: TransactionParams): TokenEnablement[];
    verifyTokenName(tokenEnablementsPrebuild: ITokenEnablement[], enableTokensConfig: TokenEnablement[]): void;
    verifyTokenAddress(tokenEnablementsPrebuild: ITokenEnablement[], enableTokensConfig: TokenEnablement[]): Promise<void>;
    private hasSolVersionedTransactionData;
    /**
     * Verify a versioned Solana transaction with basic structural validation
     * @param params - verification parameters
     * @returns true if verification passes
     */
    private verifyVersionedTransaction;
    verifyTransaction(params: SolVerifyTransactionOptions): Promise<boolean>;
    isWalletAddress(params: TssVerifyAddressOptions): Promise<boolean>;
    /**
     * Converts a Solana public key to an address
     * @param publicKey Hex-encoded public key (64 hex characters = 32 bytes)
     * @returns Base58-encoded Solana address
     */
    getAddressFromPublicKey(publicKey: string): string;
    /**
     * Generate Solana key pair
     *
     * @param {Buffer} seed - Seed from which the new SolKeyPair should be generated, otherwise a random seed is used
     * @returns {Object} object with generated pub and prv
     */
    generateKeyPair(seed?: Buffer | undefined): KeyPair;
    /**
     * Return boolean indicating whether input is valid public key for the coin
     *
     * @param {string} pub the prv to be checked
     * @returns is it valid?
     */
    isValidPub(pub: string): boolean;
    /**
     * Return boolean indicating whether input is valid private key for the coin
     *
     * @param {string} prv the prv to be checked
     * @returns is it valid?
     */
    isValidPrv(prv: string): boolean;
    isValidAddress(address: string): boolean;
    signMessage(key: KeyPair, message: string | Buffer): Promise<Buffer>;
    /**
     * Signs Solana transaction
     * @param params
     * @param callback
     */
    signTransaction(params: SolSignTransactionOptions): Promise<SignedTransaction>;
    parseTransaction(params: SolParseTransactionOptions): Promise<SolParsedTransaction>;
    /**
     * Explain a Solana transaction from txBase64
     * Uses WASM-based parsing for testnet, with fallback to legacy builder approach.
     * @param params
     */
    explainTransaction(params: ExplainTransactionOptions): Promise<SolTransactionExplanation>;
    /**
     * Explain a Solana transaction using WASM parsing (bypasses @solana/web3.js rebuild).
     * Delegates to standalone explainSolTransaction().
     */
    explainTransactionWithWasm(params: ExplainTransactionOptions): SolLibTransactionExplanation;
    /** @inheritDoc */
    getSignablePayload(serializedTx: string): Promise<Buffer>;
    /** @inheritDoc */
    presignTransaction(params: PresignTransactionOptions): Promise<PresignTransactionOptions>;
    protected getPublicNodeUrl(apiKey?: string): string;
    /**
     * Make a request to one of the public SOL nodes available
     * @param params.payload
     */
    protected getDataFromNode(params: {
        payload?: Record<string, unknown>;
    }, apiKey?: string): Promise<request.Response>;
    protected getBlockhash(apiKey?: string): Promise<string>;
    protected getFeeForMessage(message: string, apiKey?: string): Promise<number>;
    protected getRentExemptAmount(apiKey?: string): Promise<number>;
    protected getAccountBalance(pubKey: string, apiKey?: string): Promise<number>;
    protected getAccountInfo(pubKey: string, apiKey?: string): Promise<SolDurableNonceFromNode>;
    protected getTokenAccountsByOwner(pubKey?: string, programId?: string, apiKey?: string): Promise<[] | TokenAccount[]>;
    protected getTokenAccountInfo(pubKey: string, apiKey?: string): Promise<TokenAccount>;
    /** inherited doc */
    createBroadcastableSweepTransaction(params: MPCSweepRecoveryOptions): Promise<MPCTxs>;
    /**
     * Builds a funds recovery transaction without BitGo
     * @param {SolRecoveryOptions} params parameters needed to construct and
     * (maybe) sign the transaction
     *
     * @returns {MPCTx | MPCSweepTxs} the serialized transaction hex string and index
     * of the address being swept
     */
    recover(params: SolRecoveryOptions): Promise<MPCTx | MPCSweepTxs>;
    /**
     * Builds a funds recovery transaction without BitGo
     * @param {SolRecoveryOptions} params parameters needed to construct and
     * (maybe) sign the transaction
     *
     * @returns {BaseBroadcastTransactionResult[]} the serialized transaction hex string and index
     * of the address being swept
     */
    recoverCloseATA(params: SolRecoveryOptions): Promise<BaseBroadcastTransactionResult[]>;
    /**
     * Recovers tokens from a nested ATA — an ATA whose owner is another ATA rather than a wallet address.
     *
     * This situation occurs when an external sender mistakenly calls createAssociatedTokenAccount with
     * an ATA address as the owner instead of the root wallet address. The result is a "nested ATA"
     * (ATA-2) owned by the wallet's normal ATA (ATA-1). Because ATA-1 is a PDA with no private key,
     * the standard recoverCloseATA flow cannot sign for ATA-2.
     *
     * This method uses the Associated Token Account program's RecoverNested instruction, which allows
     * the root wallet owner to sign and atomically move tokens from ATA-2 → ATA-1 and close ATA-2,
     * returning the rent-exempt SOL to the wallet address.
     *
     * @param {SolRecoveryOptions} params - recovery params, requires nestedAtaAddress, ownerAtaAddress,
     *   and tokenMintAddress in addition to the standard keychain fields
     */
    recoverNestedAta(params: SolRecoveryOptions): Promise<BaseBroadcastTransactionResult>;
    signAndGenerateBroadcastableTransaction(params: SolRecoveryOptions, txBuilder: any, bs58EncodedPublicKey: string): Promise<MPCTx>;
    /**
     * Builds native SOL recoveries of receive addresses in batch without BitGo.
     * Funds will be recovered to base address first. You need to initiate another sweep txn after that.
     *
     * @param {SolConsolidationRecoveryOptions} params - options for consolidation recovery.
     * @param {string} [params.startingScanIndex] - receive address index to start scanning from. default to 1 (inclusive).
     * @param {string} [params.endingScanIndex] - receive address index to end scanning at. default to startingScanIndex + 20 (exclusive).
     */
    recoverConsolidations(params: SolConsolidationRecoveryOptions): Promise<MPCTxs | MPCSweepTxs>;
    getTokenEnablementConfig(): TokenEnablementConfig;
    private getBuilder;
    broadcastTransaction({ serializedSignedTransaction, }: BaseBroadcastTransactionOptions): Promise<BaseBroadcastTransactionResult>;
    /** @inheritDoc */
    auditDecryptedKey({ prv, publicKey, multiSigType }: AuditDecryptedKeyParams): void;
    /** @inheritDoc */
    setCoinSpecificFieldsInIntent(intent: PopulatedIntent, params: PrebuildTransactionWithIntentOptions): void;
}
export {};
//# sourceMappingURL=sol.d.ts.map