import type { Abi } from "abitype"; import * as universalethers from "ethers"; import type * as ethers6 from "ethers6"; import type { Chain } from "../chains/types.js"; import type { ThirdwebClient } from "../client/client.js"; import { type ThirdwebContract } from "../contract/contract.js"; import type { Account } from "../wallets/interfaces/wallet.js"; type Ethers6 = typeof ethers6; /** * The ethers6 adapter provides a way to convert between Thirdweb contracts, accounts, and providers. * @example * * ### Converting a Thirdweb account to an ethers.js signer * ```ts * import { ethers6Adapter } from "thirdweb/adapters/ethers6"; * const signer = await ethers6Adapter.signer.toEthers({ client, chain, account }); * ``` * * ### Converting an ethers.js signer into a Thirdweb account * ```ts * import { ethers6Adapter } from "thirdweb/adapters/ethers6"; * const account = await ethers6Adapter.signer.fromEthers({ signer }); * ``` * * ### Converting a Thirdweb contract to an ethers.js Contract * ```ts * import { ethers6Adapter } from "thirdweb/adapters/ethers6"; * const ethersContract = await ethers6Adapter.contract.toEthers({ thirdwebContract }); * ``` * * ### Converting a Thirdweb client and chain ID into an ethers.js provider * ```ts * import { ethers6Adapter } from "thirdweb/adapters/ethers6"; * const provider = ethers6Adapter.provider.toEthers({ client, chain }); * ``` */ export declare const ethers6Adapter: { /** * Converts a ThirdwebContract to an ethers.js Contract or the other way around. * @example * * ### toEthers * ```ts * import { ethers6Adapter } from "thirdweb/adapters/ethers6"; * const ethersContract = await ethers6Adapter.contract.toEthers({ thirdwebContract, account }); * ``` * * ### fromEthers * ```ts * import { ethers6Adapter } from "thirdweb/adapters"; * const contract = ethers6Adapter.contract.fromEthers({ client, chain, ethersContract }); * ``` */ contract: { /** * Creates a ThirdwebContract from an ethers.js Contract. * @param options - The options for creating a ThirdwebContract from an ethers.js Contract. * @param options.ethersContract - The ethers.js Contract to convert. * @param options.chain - The chain. * @returns The ThirdwebContract. * @example * ```ts * import { ethers6Adapter } from "thirdweb/adapters/ethers6"; * const contract = ethers6Adapter.contract.fromEthers({ ethersContract, chain }); * ``` */ fromEthers: (options: FromEthersContractOptions) => Promise>>; /** * Converts a ThirdwebContract to an ethers.js Contract. * @param options - The options for converting a ThirdwebContract to an ethers.js Contract. * @param options.thirdwebContract - The ThirdwebContract to convert. * @param options.account - The account to use for signing the transaction. * @returns The ethers.js Contract. * @example * ```ts * import { ethers6Adapter } from "thirdweb/adapters/ethers6"; * const ethersContract = await ethers6Adapter.contract.toEthers({ thirdwebContract }); * ``` */ toEthers: (options: { thirdwebContract: ThirdwebContract; account?: Account; }) => Promise; }; /** * Converts a Thirdweb client and chain ID into an ethers.js provider. * @param options - The options for converting the Thirdweb client and chain ID into an ethers.js provider. * @param options.client - The Thirdweb client. * @param options.chain - The chain. * @returns The ethers.js provider. * @example * ```ts * import { ethers6Adapter } from "thirdweb/adapters/ethers6"; * const provider = ethers6Adapter.provider.toEthers({ client, chain }); * ``` */ provider: { /** * Converts a Thirdweb client and chain ID into an ethers.js provider. * @param options - The options for converting the Thirdweb client and chain ID into an ethers.js provider. * @param options.client - The Thirdweb client. * @param options.chain - The chain. * @returns The ethers.js provider. * @example * ```ts * import { ethers6Adapter } from "thirdweb/adapters/ethers6"; * const provider = ethers6Adapter.provider.toEthers({ client, chain }); * ``` */ toEthers: (options: { client: ThirdwebClient; chain: Chain; }) => universalethers.ethers.JsonRpcProvider; }; /** * Converts an ethers6 Signer into a Wallet object or the other way around. * @example * * ### fromEthersSigner * ```ts * import { ethers6Adapter } from "thirdweb/adapters/ethers6"; * const signer = ethers6Adapter.signer.fromEthersSigner({ signer }); * ``` * * ### toEthersSigner * ```ts * import { ethers6Adapter } from "thirdweb/adapters/ethers6"; * const signer = await ethers6Adapter.signer.toEthers({ client, chain, account }); * ``` */ signer: { /** * Converts an ethers6 Signer into an thirdweb account. * @param options - The options for converting the ethers6 Signer into a thirdweb account. * @param options.signer - The ethers6 Signer object. * @returns - A Promise that resolves to a thirdweb account. * @example * ```ts * import { ethers6Adapter } from "thirdweb/adapters/ethers6"; * const account = await ethers6Adapter.signer.fromEthers({ signer }); * ``` */ fromEthers: (options: { signer: ethers6.Signer; }) => Promise; /** * Converts a Thirdweb wallet to an ethers.js signer. * @param options - The options for converting the Thirdweb wallet to an ethers.js signer. * @param options.client - The thirdweb client. * @param options.account - The account. * @param options.chain - The chain. * @returns A promise that resolves to an ethers.js signer. * @example * ```ts * import { ethers6Adapter } from "thirdweb/adapters/ethers6"; * const signer = await ethers6Adapter.signer.toEthers({ client, chain, account }); * ``` */ toEthers: (options: { client: ThirdwebClient; account: Account; chain: Chain; }) => universalethers.ethers.Signer; }; }; /** * Converts a Thirdweb client and chain ID into an ethers.js provider. * @param ethers - The ethers.js library instance. * @param client - The Thirdweb client. * @param chain - The chain. * @returns The ethers.js provider. * @internal */ export declare function toEthersProvider(ethers: Ethers6, client: ThirdwebClient, chain: Chain): universalethers.ethers.JsonRpcProvider; /** * Converts a ThirdwebContract to an ethers.js Contract. * @param ethers - The ethers.js instance. * @param twContract - The ThirdwebContract to convert. * @returns A Promise that resolves to an ethers.js Contract. * @internal */ export declare function toEthersContract(ethers: Ethers6, twContract: ThirdwebContract, account?: Account): Promise; type FromEthersContractOptions = { client: ThirdwebClient; ethersContract: ethers6.Contract; chain: Chain; }; /** * Creates a ThirdwebContract instance from an ethers.js contract. * @param options - The options for creating the ThirdwebContract instance. * @returns A promise that resolves to a ThirdwebContract instance. * @internal */ export declare function fromEthersContract({ client, ethersContract, chain, }: FromEthersContractOptions): Promise>; /** * Converts an ethers5 Signer into an Account object. * @param signer - The ethers5 Signer object. * @returns - A Promise that resolves to an Account object. * @internal */ export declare function fromEthersSigner(signer: ethers6.Signer): Promise; /** * Converts a Thirdweb account to an ethers.js signer. * @param ethers - The ethers.js library. * @param client - The Thirdweb client. * @param chain - The blockchain chain. * @param account - The Thirdweb account. * @returns An ethers.js signer. * @internal */ export declare function toEthersSigner(ethers: Ethers6, client: ThirdwebClient, account: Account, chain: Chain): ethers6.Signer; export {}; //# sourceMappingURL=ethers6.d.ts.map