import { Client } from 'viem';
import { GetSupportedRoutesFn_Conditions, KnownRoute, DefinedRoute } from './utils/buildSupportedRoutes.js';
import { KnownChainId, KnownTokenId } from './utils/types/knownIds.js';
import { BridgeFromBitcoinInput, BridgeFromBitcoinOutput } from './xlinkSdkUtils/bridgeFromBitcoin.js';
export { BridgeFromBitcoinInput_signPsbtFn } from './xlinkSdkUtils/bridgeFromBitcoin.js';
import { BridgeFromEVMInput, BridgeFromEVMOutput } from './xlinkSdkUtils/bridgeFromEVM.js';
import { BridgeFromStacksInput, BridgeFromStacksOutput } from './xlinkSdkUtils/bridgeFromStacks.js';
import { BridgeInfoFromBitcoinInput, BridgeInfoFromBitcoinOutput } from './xlinkSdkUtils/bridgeInfoFromBitcoin.js';
import { BridgeInfoFromEVMInput, BridgeInfoFromEVMOutput } from './xlinkSdkUtils/bridgeInfoFromEVM.js';
import { BridgeInfoFromStacksInput, BridgeInfoFromStacksOutput } from './xlinkSdkUtils/bridgeInfoFromStacks.js';
import { EstimateBridgeTransactionFromBitcoinInput, EstimateBridgeTransactionFromBitcoinOutput } from './xlinkSdkUtils/estimateBridgeTransactionFromBitcoin.js';
import { GetTimeLockedAssetsInput, GetTimeLockedAssetsOutput, ClaimTimeLockedAssetsInput, ClaimTimeLockedAssetsOutput } from './xlinkSdkUtils/timelockFromEVM.js';
import { ChainId, PublicEVMContractType, EVMAddress, EVMNativeCurrencyAddress, StacksContractAddress } from './xlinkSdkUtils/types.js';
import './types.internal-BwEnb5-y.js';
import './evmUtils/evmContractAddresses.js';
import './utils/BigNumber.js';
import 'big.js';
import './utils/typeHelpers.js';
import '@scure/btc-signer';
import './bitcoinUtils/prepareTransaction.js';
import './bitcoinUtils/bitcoinHelpers.js';
import '@c4/btc-utils';
import './bitcoinUtils/createTransaction.js';
import 'clarity-codegen';
import './utils/types/TransferProphet.js';

interface XLinkSDKOptions {
    __experimental?: {
        backendAPI?: {
            runtimeEnv?: "prod" | "dev";
        };
    };
    evm?: {
        /**
         * @default true
         */
        cacheOnChainConfig?: boolean;
        /**
         * @default undefined
         */
        viemClients?: Record<KnownChainId.EVMChain, Client>;
    };
}
declare class XLinkSDK {
    static defaultConfig(options: XLinkSDKOptions): void;
    private sdkContext;
    constructor(options?: XLinkSDKOptions);
    /**
     * This function retrieves the list of supported routes for token transfers between blockchain
     * networks, filtered based on optional conditions. It aggregates the results from different
     * blockchain networks (Stacks, EVM, Bitcoin) to return a list of possible routes.
     * @param conditions - An optional object containing the conditions for filtering the supported routes:
     * - `fromChain?: ChainId` - The ID of the source blockchain (optional).
     * - `toChain?: ChainId` - The ID of the destination blockchain (optional).
     * - `fromToken?: TokenId` - The ID of the token being transferred from the source blockchain (optional).
     * - `toToken?: TokenId` - The ID of the token expected on the destination blockchain (optional).
     *
     * @returns A promise that resolves with an array of `KnownRoute` objects, each representing a
     * possible route for the token transfer.
     */
    getSupportedRoutes(conditions?: GetSupportedRoutesFn_Conditions): Promise<KnownRoute[]>;
    isSupportedRoute(route: DefinedRoute): Promise<boolean>;
    stacksAddressFromStacksToken: typeof stacksAddressFromStacksToken;
    stacksAddressToStacksToken: typeof stacksAddressToStacksToken;
    /**
     * This function provides detailed information about token transfers from the Stacks network to other supported
     * blockchain networks, including Bitcoin and EVM-compatible chains. It verifies the validity of the transfer
     * route and retrieves bridge information based on the destination chain and tokens.
     * @param input - An object containing the input parameters required for retrieving bridge information:
     * - `fromChain: ChainId` - The ID of the source blockchain (Stacks in this case).
     * - `toChain: ChainId` - The ID of the destination blockchain (Bitcoin, EVM-compatible chains, etc.).
     * - `fromToken: TokenId` - The token being transferred from the Stacks network.
     * - `toToken: TokenId` - The token expected on the destination chain.
     * - `amount: SDKNumber` - The amount of tokens involved in the transfer.
     *
     * @returns A promise that resolves with an object containing detailed information about the token transfer, including:
     * - `fromChain: KnownChainId.KnownChain` - The source blockchain.
     * - `fromToken: KnownTokenId.KnownToken` - The token being transferred from the Stacks network.
     * - `toChain: KnownChainId.KnownChain` - The destination blockchain.
     * - `toToken: KnownTokenId.KnownToken` - The token expected on the destination chain.
     * - `fromAmount: SDKNumber` - The amount of tokens being transferred.
     * - `toAmount: SDKNumber` - The amount of tokens expected on the destination chain after the transfer.
     * - `feeAmount: SDKNumber` - The fee amount deducted during the transfer.
     * @throws UnsupportedBridgeRouteError - If the provided route between the source and destination
     * chains or tokens is unsupported.
     */
    bridgeInfoFromStacks(input: BridgeInfoFromStacksInput): Promise<BridgeInfoFromStacksOutput>;
    /**
     * This function facilitates the transfer of tokens from the Stacks network to other supported blockchain
     * networks, including Bitcoin and EVM-compatible chains. It validates the route and calls the appropriate
     * bridging function based on the destination chain and tokens involved.
     * @param input -  An object containing the input parameters required for the bridging operation:
     * - `fromChain: ChainId` - The ID of the source blockchain.
     * - `toChain: ChainId` - The ID of the destination blockchain (Bitcoin, EVM, etc.).
     * - `fromToken: TokenId` - The token being transferred from the source chain.
     * - `toToken: TokenId` - The token expected on the destination chain.
     * - `fromAddress: string` - The sender's address on the source chain.
     * - `toAddress: string` - The recipient's address on the destination blockchain.
     * - `amount: SDKNumber` - The amount of tokens to transfer.
     * - `sendTransaction` - // Implementation for sending transaction from Stacks mainnet.
     *
     * @returns A promise that resolves with the transaction ID (`txid`) of the bridging operation.
     * @throws UnsupportedBridgeRouteError - If the provided route between the source and destination
     * chains or tokens is unsupported.
     */
    bridgeFromStacks(input: BridgeFromStacksInput): Promise<BridgeFromStacksOutput>;
    /**
     * This function retrieves the contract address of a specific type of contract
     * (e.g., a bridge endpoint) on a given EVM-compatible blockchain.
     * @param chain - The ID of the EVM-compatible blockchain where the contract is deployed.
     * @param contractType - The type of contract (e.g., `PublicEVMContractType.BridgeEndpoint`)
     * for which the address is to be retrieved.
     *
     * @returns A promise that resolves with the contract address of the specified type, or
     * `undefined` if the chain is not EVM-compatible or if the address cannot be retrieved.
     */
    getEVMContractAddress(chain: ChainId, contractType: PublicEVMContractType): Promise<undefined | EVMAddress>;
    /**
     * This function retrieves the contract address of a specific token on a given EVM-compatible blockchain.
     * @param chain - The ID of the EVM-compatible blockchain where the token contract is deployed.
     * @param token - The specific token ID for which the contract address is to be retrieved.
     *
     * @returns A promise that resolves with the contract address of the token, or `undefined` if the
     * chain is not EVM-compatible or if the contract address cannot be retrieved.
     */
    evmAddressFromEVMToken(chain: ChainId, token: KnownTokenId.EVMToken): Promise<undefined | EVMAddress | EVMNativeCurrencyAddress>;
    /**
     * This function maps a given contract address on an EVM-compatible blockchain to its corresponding known token ID.
     * @param chain - The ID of the EVM-compatible blockchain where the contract is deployed.
     * @param address - The contract address on the EVM-compatible blockchain.
     *
     * @returns A promise that resolves with the known token ID corresponding to the provided contract
     * address, or `undefined` if the token ID cannot be found or if the chain is not EVM-compatible.
     */
    evmAddressToEVMToken(chain: ChainId, address: EVMAddress | EVMNativeCurrencyAddress): Promise<undefined | KnownTokenId.EVMToken>;
    /**
     * This function provides detailed information about token transfers from an EVM-compatible blockchain to other supported
     * blockchain networks, including Stacks, Bitcoin, and other EVM-compatible chains. It verifies the validity of the transfer
     * route and retrieves bridge information based on the destination chain and tokens.
     * @param input - An object containing the input parameters required for retrieving bridge information:
     * - `fromChain: ChainId` - The ID of the source blockchain (Stacks in this case).
     * - `toChain: ChainId` - The ID of the destination blockchain (Bitcoin, EVM-compatible chains, etc.).
     * - `fromToken: TokenId` - The token being transferred from the Stacks network.
     * - `toToken: TokenId` - The token expected on the destination chain.
     * - `amount: SDKNumber` - The amount of tokens involved in the transfer.
     *
     * @returns A promise that resolves with an object containing detailed information about the token transfer, including:
     * - `fromChain: KnownChainId.KnownChain` - The source blockchain.
     * - `fromToken: KnownTokenId.KnownToken` - The token being transferred from the Stacks network.
     * - `toChain: KnownChainId.KnownChain` - The destination blockchain.
     * - `toToken: KnownTokenId.KnownToken` - The token expected on the destination chain.
     * - `fromAmount: SDKNumber` - The amount of tokens being transferred.
     * - `toAmount: SDKNumber` - The amount of tokens expected on the destination chain after the transfer.
     * - `feeAmount: SDKNumber` - The fee amount deducted during the transfer.
     * @throws UnsupportedBridgeRouteError - If the provided route between the source and destination
     * chains or tokens is unsupported.
     */
    bridgeInfoFromEVM(input: BridgeInfoFromEVMInput): Promise<BridgeInfoFromEVMOutput>;
    /**
     * This function facilitates the transfer of tokens from an EVM-compatible blockchain to other supported
     * blockchain networks, including Stacks, Bitcoin, and other EVM-compatible chains. It validates the
     * route and calls the appropriate bridging function based on the destination chain and tokens involved.
     * @param input - An object containing the input parameters required for the bridging operation:
     * - `fromChain: ChainId` - The ID of the source blockchain (an EVM-compatible chain in this case).
     * - `toChain: ChainId` - The ID of the destination blockchain (Stacks, Bitcoin, or another EVM-compatible chain).
     * - `fromToken: TokenId` - The token being transferred from the EVM-compatible blockchain.
     * - `toToken: TokenId` - The token expected on the destination chain.
     * - `fromAddress: string` - The sender's address on the source chain.
     * - `toAddress: string` - The recipient's address on the destination blockchain.
     * - `toAddressScriptPubKey?: Uint8Array` - The script public key for the `toAddress`, required when the destination is a Bitcoin chain.
     * - `amount: SDKNumber` - The amount of tokens to transfer.
     * - `sendTransaction` - // Implementation for sending transaction from EVM chain.
     *
     * @returns A promise that resolves with the transaction hash (`txHash`) of the bridging operation.
     * @throws UnsupportedBridgeRouteError - If the provided route between the source and destination
     * chains or tokens is unsupported.
     */
    bridgeFromEVM(input: BridgeFromEVMInput): Promise<BridgeFromEVMOutput>;
    /**
     * This function retrieves a list of time-locked assets for a given wallet address across multiple EVM-compatible
     * blockchain networks. It queries smart contracts to find and return information about the assets that are
     * currently locked in time-based agreements.
     * @param input - An object containing the input parameters required for retrieving time-locked assets:
     * - `walletAddress: EVMAddress` - The address of the wallet for which to retrieve the time-locked assets.
     * - `chains: KnownChainId.EVMChain[]` - An array of EVM-compatible blockchains to query for locked assets.
     *
     * @returns A promise that resolves with an object containing a list of time-locked assets:
     * - `assets: TimeLockedAsset[]` - An array of objects, each representing a time-locked asset, including:
     *   - `id: string` - The unique identifier of the time-locked agreement.
     *   - `chain: KnownChainId.EVMChain` - The blockchain where the asset is locked.
     *   - `token: KnownTokenId.EVMToken` - The token that is locked.
     *   - `amount: SDKNumber` - The amount of the token that is locked.
     *   - `releaseTime: Date` - The time when the asset is scheduled to be released.
     *
     * @throws UnsupportedChainError - If any of the provided EVM chains is unsupported or invalid.
     */
    getTimeLockedAssetsFromEVM(input: GetTimeLockedAssetsInput): Promise<GetTimeLockedAssetsOutput>;
    /**
     * This function facilitates the claiming of time-locked assets on EVM-compatible chains. It uses smart
     * contract functions to execute the release of locked assets based on predefined conditions.
     * @param input - An object containing the input parameters required for claiming time-locked assets:
     * - `chain: KnownChainId.EVMChain` - The ID of the EVM-compatible blockchain where the assets are locked.
     * - `lockedAssetIds: string[]` - An array of IDs representing the locked assets to be claimed.
     * - `sendTransaction` - // Implementation for sending transaction from EVM chain.
     *
     * @returns A promise that resolves with the transaction hash (`txHash`) of the claiming operation, or `undefined` if the operation fails.
     * @throws UnsupportedChainError - If the provided EVM chain is unsupported or invalid.
     */
    claimTimeLockedAssetsFromEVM(input: ClaimTimeLockedAssetsInput): Promise<undefined | ClaimTimeLockedAssetsOutput>;
    bitcoinReceiverAddress(fromChain: ChainId, toChain: ChainId): Promise<undefined | {
        address: string;
        scriptPubKey: Uint8Array;
    }>;
    /**
     * This function provides detailed information about token transfers from the Bitcoin network to other supported
     * blockchain networks, including Stacks and EVM-compatible chains. It verifies the validity of the transfer route
     * and retrieves bridge information based on the destination chain.
     * @param info - An object containing the input parameters required for retrieving bridge information:
     * - `fromChain: ChainId` - The ID of the source blockchain.
     * - `toChain: ChainId` - The ID of the destination blockchain (Stacks, EVM, etc.).
     * - `amount: SDKNumber` - The amount of tokens involved in the transfer.
     *
     * @returns A promise that resolves with an object containing detailed information about the token transfer, including:
     * - `fromChain: KnownChainId.KnownChain` - The source blockchain.
     * - `fromToken: KnownTokenId.KnownToken` - The token being transferred from the Bitcoin network.
     * - `toChain: KnownChainId.KnownChain` - The destination blockchain.
     * - `toToken: KnownTokenId.KnownToken` - The token expected on the destination chain.
     * - `fromAmount: SDKNumber` - The amount of tokens being transferred.
     * - `toAmount: SDKNumber` - The amount of tokens expected on the destination chain after the transfer.
     * - `feeAmount: SDKNumber` - The fee amount deducted during the transfer.
     * @throws UnsupportedBridgeRouteError - If the provided route between the source and destination
     * chains is unsupported.
     */
    bridgeInfoFromBitcoin(input: BridgeInfoFromBitcoinInput): Promise<BridgeInfoFromBitcoinOutput>;
    /**
     * This function estimates the transaction fee and vSize for move or swap tokens from the Bitcoin network
     * to other supported blockchain networks, including Stacks and EVM-compatible chains.
     * @param input - An object containing the input parameters required for estimating the transaction:
     * - `fromChain: ChainId` - The ID of the source blockchain (Bitcoin in this case).
     * - `toChain: ChainId` - The ID of the destination blockchain (Stacks, EVM-compatible chains, etc.).
     * - `fromToken: TokenId` - The token being transferred from the Bitcoin network.
     * - `toToken: TokenId` - The token expected on the destination chain.
     * - `fromAddress: string` - The source address on the Bitcoin network.
     * - `fromAddressScriptPubKey: Uint8Array` - The script public key of the source address.
     * - `toAddress: string` - The destination address on the target blockchain.
     * - `amount: SDKNumber` - The amount of tokens to be transferred.
     * - `networkFeeRate: bigint` - The fee rate for the Bitcoin network.
     * - `reselectSpendableUTXOs` - // Implementation for reselect UTXOs.
     *
     * @returns A promise that resolves with an object containing the estimated transaction details:
     * - `fee: SDKNumber` - The estimated transaction fee.
     * - `estimatedVSize: SDKNumber` - The estimated vSize of the transaction.
     * @throws UnsupportedBridgeRouteError - If the provided route between the source and destination
     * chains or tokens is unsupported.
     */
    estimateBridgeTransactionFromBitcoin(input: EstimateBridgeTransactionFromBitcoinInput): Promise<EstimateBridgeTransactionFromBitcoinOutput>;
    /**
     * This function facilitates the transfer of tokens from the Bitcoin network to other supported
     * blockchain networks. It checks the validity of the route and then calls the appropriate
     * bridging function based on the destination chain.
     * @param input - An object containing the input parameters required for the bridging operation:
     * - `fromChain: ChainId` - The ID of the source blockchain.
     * - `toChain: ChainId` - The ID of the destination blockchain (Stacks, EVM, etc.).
     * - `fromToken: TokenId` - The token being transferred from the Bitcoin network.
     * - `toToken: TokenId` - The token expected on the destination chain.
     * - `fromAddress: string` - The source address on the Bitcoin network.
     * - `fromAddressScriptPubKey: Uint8Array` - The script public key corresponding to the `fromAddress`.
     * - `toAddress: string` - The recipient's address on the destination blockchain.
     * - `amount: SDKNumber` - The amount of tokens to transfer.
     * - `networkFeeRate: bigint` - The network fee rate to be used for the transaction.
     * - `reselectSpendableUTXOs: ReselectSpendableUTXOsFn`.
     * - `signPsbt: BridgeFromBitcoinInput_signPsbtFn`.
     *
     * @returns A promise that resolves with the transaction ID (`tx`) of the bridging operation.
     * @throws UnsupportedBridgeRouteError - If the provided route between the source and destination
     * chains or tokens is unsupported.
     */
    bridgeFromBitcoin(input: BridgeFromBitcoinInput): Promise<BridgeFromBitcoinOutput>;
    brc20TickFromBRC20Token(chain: ChainId, token: KnownTokenId.BRC20Token): Promise<undefined | string>;
    brc20TickToBRC20Token(chain: ChainId, tick: string): Promise<undefined | KnownTokenId.BRC20Token>;
    runesIdFromRunesToken(chain: ChainId, token: KnownTokenId.RunesToken): Promise<undefined | `${number}:${number}`>;
    runesIdToRunesToken(chain: ChainId, id: `${number}:${number}`): Promise<undefined | KnownTokenId.RunesToken>;
}
/**
 * This function retrieves the contract address associated with a specific token on the Stacks blockchain.
 * @param chain - The ID of the Stacks blockchain.
 * @param token - The specific token ID for which the contract address is to be retrieved.
 *
 * @returns A promise that resolves with the contract address associated with the specified token,
 * or `undefined` if the chain is not a Stacks chain or if the contract address cannot be retrieved.
 */
declare function stacksAddressFromStacksToken(chain: ChainId, token: KnownTokenId.StacksToken): Promise<undefined | StacksContractAddress>;
/**
 * This function maps a given Stacks contract address to its corresponding known token ID.
 * @param chain - The ID of the Stacks blockchain.
 * @param address - The contract address on the Stacks blockchain.
 *
 * @returns A promise that resolves with the known token ID corresponding to the provided
 * contract address, or `undefined` if the chain is not a Stacks chain or if the token ID
 * cannot be found.
 */
declare function stacksAddressToStacksToken(chain: ChainId, address: StacksContractAddress): Promise<undefined | KnownTokenId.StacksToken>;

export { BridgeFromBitcoinInput, BridgeFromBitcoinOutput, BridgeFromEVMInput, BridgeFromEVMOutput, BridgeFromStacksInput, BridgeFromStacksOutput, BridgeInfoFromBitcoinInput, BridgeInfoFromBitcoinOutput, BridgeInfoFromEVMInput, BridgeInfoFromEVMOutput, BridgeInfoFromStacksInput, BridgeInfoFromStacksOutput, ClaimTimeLockedAssetsInput, ClaimTimeLockedAssetsOutput, EstimateBridgeTransactionFromBitcoinInput, EstimateBridgeTransactionFromBitcoinOutput, GetSupportedRoutesFn_Conditions, GetTimeLockedAssetsInput, GetTimeLockedAssetsOutput, KnownRoute, XLinkSDK, type XLinkSDKOptions };
