import { ethers, Signer, Bytes, BigNumberish } from "ethers"; import { AccessListish, Deferrable } from "ethers/lib/utils"; import BlsProvider from "./BlsProvider"; import BlsWalletWrapper from "./BlsWalletWrapper"; import { Signature } from "./signer"; export declare const _constructorGuard: {}; /** * Based on draft wallet_batchTransactions rpc proposal https://hackmd.io/HFHohGDbRSGgUFI2rk22bA?view * * @property gas - (THIS PROPERTY IS NOT USED BY BLS WALLET) Transaction gas limit * @property maxPriorityFeePerGas - (THIS PROPERTY IS NOT USED BY BLS WALLET) Miner tip aka priority fee * @property maxFeePerGas - (THIS PROPERTY IS NOT USED BY BLS WALLET) The maximum total fee per gas the sender is willing to pay (includes the network/base fee and miner/priority fee) in wei * @property nonce - Integer of a nonce. This allows overwriting your own pending transactions that use the same nonce * @property chainId - Chain ID that this transaction is valid on * @property accessList - (THIS PROPERTY IS NOT USED BY BLS WALLET) EIP-2930 access list */ export type BatchOptions = { gas?: BigNumberish; maxPriorityFeePerGas: BigNumberish; maxFeePerGas: BigNumberish; nonce: BigNumberish; chainId: number; accessList?: AccessListish; }; /** * @property transactions - An array of Ethers transaction objects * @property batchOptions - Optional batch options taken into account by smart contract wallets. See {@link BatchOptions} */ export type TransactionBatch = { transactions: Array; batchOptions?: BatchOptions; }; /** * @property transactions - An array of Ethers transaction response objects * @property awaitBatchReceipt - A function that returns a promise that resolves to a transaction receipt */ export interface TransactionBatchResponse { transactions: Array; awaitBatchReceipt: (confirmations?: number) => Promise; } export default class BlsSigner extends Signer { readonly addressOrIndex?: string | number | undefined; readonly provider: BlsProvider; readonly verificationGatewayAddress: string; readonly aggregatorUtilitiesAddress: string; wallet: BlsWalletWrapper; _index: number; _address: string; readonly initPromise: Promise; /** * @param constructorGuard Prevents BlsSigner constructor being called directly * @param provider BlsProvider accociated with this signer * @param privateKey Private key for the account this signer represents * @param addressOrIndex (Not used) Address or index of this account, managed by the connected Ethereum node */ constructor(constructorGuard: Record, provider: BlsProvider, privateKey: string | Promise, addressOrIndex?: string | number | undefined); /** Instantiates a BLS Wallet and then connects the signer to it */ private initializeWallet; /** * @returns a random BLS private key */ static getRandomBlsPrivateKey(): Promise; /** * Sends transactions to be executed. Converts the TransactionRequest * to a bundle and adds it to the aggregator * * @remarks The transaction hash returned in the transaction response does * NOT correspond to a transaction hash that can be viewed on a block * explorer. It instead represents the bundle hash, which can be used to * get a transaction receipt that has a hash that can be used on a block explorer * * @param transaction Transaction request object * @returns A transaction response object that can be awaited to get the transaction receipt */ sendTransaction(transaction: Deferrable): Promise; /** * @param transactionBatch A transaction batch object * @returns A transaction batch response object that can be awaited to get the transaction receipt */ sendTransactionBatch(transactionBatch: TransactionBatch): Promise; /** * @returns The address associated with the BlsSigner */ getAddress(): Promise; /** * This method passes calls through to the underlying node and allows users to unlock EOA accounts through this provider. * The personal namespace is used to manage keys for ECDSA signing. BLS keys are not supported natively by execution clients. */ unlock(password: string): Promise; /** * @remarks Signs a transaction that can be executed by the BlsProvider * * @param transaction Transaction request object * @returns A signed bundle as a string */ signTransaction(transaction: Deferrable): Promise; /** * Signs a transaction batch that can be executed by the BlsProvider * * @param transactionBatch A transaction batch object * @returns A signed bundle containing all transactions from the transaction batch as a string */ signTransactionBatch(transactionBatch: TransactionBatch): Promise; /** * Signs a message. Because of the function signature enforced by ethers, we cannot return the signature * in it's default type. Instead, we return a concatenated string of the signature. * * Use BlsSigner.signedMessageToSignature to convert the concatenated signature string into a BLS Signature type. * * @param message the message to be signed * @returns a concatenated string of the signature */ signMessage(message: Bytes | string): Promise; /** helper method to convert blsSigner.signMessage concatenated signature string into BLS Signature type */ static signedMessageToSignature(signedMessage: string): Signature; connect(provider: ethers.providers.Provider): BlsSigner; _signTypedData(domain: any, types: Record>, value: Record): Promise; /** * @returns A new Signer object which does not perform additional checks when sending a transaction */ connectUnchecked(): BlsSigner; /** * @param transaction Transaction request object * @returns Transaction hash for the transaction, corresponds to a bundle hash */ sendUncheckedTransaction(transaction: Deferrable): Promise; _legacySignMessage(message: Bytes | string): Promise; _validateTransaction(transaction: Deferrable): Promise; _validateTransactionBatch(transactionBatch: TransactionBatch): Promise; _validateBatchOptions(batchOptions: BatchOptions): Promise; } export declare class UncheckedBlsSigner extends BlsSigner { /** * As with other transaction methods, the transaction hash returned represents the bundle hash, NOT a transaction hash you can use on a block explorer * * @param transaction Transaction request object * @returns The transaction response object with only the transaction hash property populated with a valid value */ sendTransaction(transaction: Deferrable): Promise; } //# sourceMappingURL=BlsSigner.d.ts.map