@@ -8,6 +8,7 @@ import { BigNumber } from "ethers";
8
8
import type { ContractExtension } from "../../schema/extension" ;
9
9
import { PrismaTransaction } from "../../schema/prisma" ;
10
10
import { getPrismaWithPostgresTx } from "../client" ;
11
+ import { getWalletDetails } from "../wallets/getWalletDetails" ;
11
12
12
13
interface QueueTxParams {
13
14
pgtx ?: PrismaTransaction ;
@@ -40,6 +41,16 @@ export const queueTx = async ({
40
41
41
42
const prisma = getPrismaWithPostgresTx ( pgtx ) ;
42
43
44
+ const fromAddress = ( await tx . getSignerAddress ( ) ) . toLowerCase ( ) ;
45
+ const walletDetails = await getWalletDetails ( {
46
+ pgtx,
47
+ address : fromAddress ,
48
+ } ) ;
49
+
50
+ if ( ! walletDetails ) {
51
+ throw new Error ( `No configured wallet found with address ${ fromAddress } ` ) ;
52
+ }
53
+
43
54
// TODO: We need a much safer way of detecting if the transaction should be a user operation
44
55
const isUserOp = ! ! ( tx . getSigner as ERC4337EthersSigner ) . erc4337provider ;
45
56
const txTableData = {
@@ -61,7 +72,7 @@ export const queueTx = async ({
61
72
signerAddress : await (
62
73
tx . getSigner as ERC4337EthersSigner
63
74
) . originalSigner . getAddress ( ) ,
64
- accountAddress : ( await tx . getSignerAddress ( ) ) . toLowerCase ( ) ,
75
+ accountAddress : fromAddress ,
65
76
// Fields needed to send user operation
66
77
target : tx . getTarget ( ) . toLowerCase ( ) ,
67
78
} ,
@@ -73,7 +84,7 @@ export const queueTx = async ({
73
84
data : {
74
85
...txTableData ,
75
86
// Fields needed to send transaction
76
- fromAddress : ( await tx . getSignerAddress ( ) ) . toLowerCase ( ) ,
87
+ fromAddress,
77
88
toAddress : tx . getTarget ( ) . toLowerCase ( ) ,
78
89
} ,
79
90
} ) ;
0 commit comments