* Estimates and sends the currently selected transaction. * * This method validates the current transaction context, estimates, and submits the transaction using: * - modular mode: the Etherspot Modular SDK batch and send flow * - delegatedEoa mode: viem account abstraction with EIP-7702
({
paymasterDetails,
userOpOverrides,
authorization,
}: SendSingleTransactionParams = {})
| 1831 | * - `paymasterDetails` and `userOpOverrides` are not supported. |
| 1832 | */ |
| 1833 | async send({ |
| 1834 | paymasterDetails, |
| 1835 | userOpOverrides, |
| 1836 | authorization, |
| 1837 | }: SendSingleTransactionParams = {}): Promise< |
| 1838 | TransactionSendResult & ISentTransaction |
| 1839 | > { |
| 1840 | if (this.selectedBatchName) { |
| 1841 | log('send(): Batch selected, throwing error.', undefined, this.debugMode); |
| 1842 | this.throwError( |
| 1843 | 'send(): Cannot send a batch with send(). Use sendBatches() instead.' |
| 1844 | ); |
| 1845 | } |
| 1846 | if (!this.selectedTransactionName || !this.workingTransaction) { |
| 1847 | const result = { |
| 1848 | to: '', |
| 1849 | chainId: this.#etherspotProvider.getChainId(), |
| 1850 | errorMessage: 'No named transaction to send. Call name() first.', |
| 1851 | errorType: 'VALIDATION_ERROR' as const, |
| 1852 | isEstimatedSuccessfully: false, |
| 1853 | isSentSuccessfully: false, |
| 1854 | }; |
| 1855 | log( |
| 1856 | 'send(): No named transaction, returning error result.', |
| 1857 | result, |
| 1858 | this.debugMode |
| 1859 | ); |
| 1860 | return { ...result, ...this }; |
| 1861 | } |
| 1862 | |
| 1863 | // Only validate provider in modular mode |
| 1864 | const walletMode = this.#etherspotProvider.getWalletMode(); |
| 1865 | if (walletMode === 'modular') { |
| 1866 | // Reject authorization in modular mode |
| 1867 | if (authorization) { |
| 1868 | const result = { |
| 1869 | to: this.workingTransaction?.to || '', |
| 1870 | chainId: |
| 1871 | this.workingTransaction?.chainId ?? |
| 1872 | this.#etherspotProvider.getChainId(), |
| 1873 | errorMessage: |
| 1874 | 'authorization is only supported in delegatedEoa mode. Remove authorization or switch walletMode to delegatedEoa.', |
| 1875 | errorType: 'VALIDATION_ERROR' as const, |
| 1876 | isEstimatedSuccessfully: false, |
| 1877 | isSentSuccessfully: false, |
| 1878 | }; |
| 1879 | log( |
| 1880 | 'send(): authorization provided in modular mode', |
| 1881 | result, |
| 1882 | this.debugMode |
| 1883 | ); |
| 1884 | this.isSending = false; |
| 1885 | this.containsSendingError = true; |
| 1886 | return { ...result, ...this }; |
| 1887 | } |
| 1888 | log('send(): Getting provider...', undefined, this.debugMode); |
| 1889 | const provider = this.getProvider(); |
| 1890 | log('send(): Got provider:', provider, this.debugMode); |
nothing calls this directly
no test coverage detected