import { Hex, PrivateKeyAccount, Client, BlockTag, Chain, PublicClient, Transport, Account, SendTransactionParameters, SendTransactionReturnType, Abi, ContractFunctionName, ContractFunctionArgs, WriteContractParameters, WriteContractReturnType } from 'viem';
import PQueue from 'p-queue';
import { g as getContract } from './getContract-93922960.js';
export { C as ContractWrite, G as GetContractOptions } from './getContract-93922960.js';

declare const resourceTypes: readonly ["table", "offchainTable", "namespace", "module", "system"];
type ResourceType = (typeof resourceTypes)[number];

type Resource = {
    readonly resourceId: Hex;
    readonly type: ResourceType;
    readonly namespace: string;
    readonly name: string;
};

declare function createBenchmark(namespace: string): (stepName: string) => void;

declare function createBurnerAccount(privateKey: Hex): PrivateKeyAccount;

type CreateNonceManagerOptions = {
    client: Client;
    address: Hex;
    blockTag?: BlockTag;
    broadcastChannelName?: string;
    queueConcurrency?: number;
};
type CreateNonceManagerResult = {
    hasNonce: () => boolean;
    getNonce: () => number;
    nextNonce: () => number;
    resetNonce: () => Promise<void>;
    shouldResetNonce: (error: unknown) => boolean;
    mempoolQueue: PQueue;
};
declare function createNonceManager({ client, address, // TODO: rename to account?
blockTag, broadcastChannelName, queueConcurrency, }: CreateNonceManagerOptions): CreateNonceManagerResult;

declare function getBurnerPrivateKey(cacheKey?: string): Hex;

declare function getNonceManager({ client, address, // TODO: rename to account?
blockTag, ...opts }: CreateNonceManagerOptions): Promise<CreateNonceManagerResult>;

declare function getNonceManagerId({ client, address, blockTag, }: {
    client: Client;
    address: Hex;
    blockTag: BlockTag;
}): Promise<string>;

declare function hexToResource(hex: Hex): Resource;

/**
 * Get the hex value at start/end positions. This will always return a valid hex string.
 *
 * If `start` is out of range, this returns `"0x"`.
 *
 * If `end` is specified and out of range, the result is right zero-padded to the desired length (`end - start`).
 */
declare function readHex(data: Hex, start: number, end?: number): Hex;

declare const rootNamespace = "";
type ResourceLabel<namespace extends string = string, name extends string = string> = namespace extends typeof rootNamespace ? name : `${namespace}__${name}`;
declare function resourceToLabel<namespace extends string, name extends string>({ namespace, name, }: {
    readonly namespace: namespace;
    readonly name: name;
}): ResourceLabel<namespace, name>;

/** @internal */
declare const resourceTypeIds: {
    readonly table: "tb";
    readonly offchainTable: "ot";
    readonly namespace: "ns";
    readonly module: "md";
    readonly system: "sy";
};
declare function resourceToHex(resource: Omit<Resource, "resourceId">): Hex;

type Result<Ok, Err = unknown> = {
    ok: Ok;
} | {
    error: Err;
};
declare function isOk<Ok, Err>(result: Result<Ok, Err>): result is {
    ok: Ok;
};
declare function isError<Ok, Err>(result: Result<Ok, Err>): result is {
    error: Err;
};
declare function unwrap<Ok, Err>(result: Result<Ok, Err>): Ok;

type SendTransactionExtraOptions<chain extends Chain | undefined> = {
    /**
     * `publicClient` can be provided to be used in place of the extended viem client for making public action calls
     * (`getChainId`, `getTransactionCount`, `call`). This helps in cases where the extended
     * viem client is a smart account client, like in [permissionless.js](https://github.com/pimlicolabs/permissionless.js),
     * where the transport is the bundler, not an RPC.
     */
    publicClient?: PublicClient<Transport, chain>;
    /**
     * Adjust the number of concurrent calls to the mempool. This defaults to `1` to ensure transactions are ordered
     * and nonces are handled properly. Any number greater than that is likely to see nonce errors and/or transactions
     * arriving out of order, but this may be an acceptable trade-off for some applications that can safely retry.
     * @default 1
     */
    queueConcurrency?: number;
};
/** @deprecated Use `walletClient.extend(transactionQueue())` instead. */
declare function sendTransaction<chain extends Chain | undefined, account extends Account | undefined, chainOverride extends Chain | undefined>(client: Client<Transport, chain, account>, request: SendTransactionParameters<chain, account, chainOverride>, opts?: SendTransactionExtraOptions<chain>): Promise<SendTransactionReturnType>;

declare function spliceHex(data: Hex, start: number, deleteCount?: number, newData?: Hex): Hex;

declare function transportObserver<TTransport extends Transport>(transport: TTransport): TTransport;

type WriteContractExtraOptions<chain extends Chain | undefined> = {
    /**
     * `publicClient` can be provided to be used in place of the extended viem client for making public action calls
     * (`getChainId`, `getTransactionCount`, `simulateContract`). This helps in cases where the extended
     * viem client is a smart account client, like in [permissionless.js](https://github.com/pimlicolabs/permissionless.js),
     * where the transport is the bundler, not an RPC.
     */
    publicClient?: PublicClient<Transport, chain>;
    /**
     * Adjust the number of concurrent calls to the mempool. This defaults to `1` to ensure transactions are ordered
     * and nonces are handled properly. Any number greater than that is likely to see nonce errors and/or transactions
     * arriving out of order, but this may be an acceptable trade-off for some applications that can safely retry.
     * @default 1
     */
    queueConcurrency?: number;
};
/** @deprecated Use `walletClient.extend(transactionQueue())` instead. */
declare function writeContract<chain extends Chain | undefined, account extends Account | undefined, abi extends Abi | readonly unknown[], functionName extends ContractFunctionName<abi, "nonpayable" | "payable">, args extends ContractFunctionArgs<abi, "nonpayable" | "payable", functionName>, chainOverride extends Chain | undefined>(client: Client<Transport, chain, account>, request: WriteContractParameters<abi, functionName, args, chain, account, chainOverride>, opts?: WriteContractExtraOptions<chain>): Promise<WriteContractReturnType>;

/** @deprecated use `getContract` instead */
declare const createContract: typeof getContract;

/** @deprecated use `resourceToHex` instead */
declare const resourceIdToHex: typeof resourceToHex;

/** @deprecated use `hexToResource` instead */
declare const hexToResourceId: typeof hexToResource;

export { CreateNonceManagerOptions, CreateNonceManagerResult, Resource, ResourceLabel, ResourceType, Result, SendTransactionExtraOptions, WriteContractExtraOptions, createBenchmark, createBurnerAccount, createContract, createNonceManager, getBurnerPrivateKey, getContract, getNonceManager, getNonceManagerId, hexToResource, hexToResourceId, isError, isOk, readHex, resourceIdToHex, resourceToHex, resourceToLabel, resourceTypeIds, resourceTypes, sendTransaction, spliceHex, transportObserver, unwrap, writeContract };
