11import type { DeployTransaction , Transaction } from "@thirdweb-dev/sdk" ;
2- import { ERC4337EthersSigner } from "@thirdweb-dev/wallets/dist/declarations/src/evm/connectors/smart-wallet/lib/erc4337-signer" ;
3- import { Address , ZERO_ADDRESS } from "thirdweb" ;
2+ import type { ERC4337EthersSigner } from "@thirdweb-dev/wallets/dist/declarations/src/evm/connectors/smart-wallet/lib/erc4337-signer" ;
3+ import { ZERO_ADDRESS , type Address } from "thirdweb" ;
44import type { ContractExtension } from "../../schema/extension" ;
5+ import { parseTransactionOverrides } from "../../server/utils/transactionOverrides" ;
56import { maybeBigInt , normalizeAddress } from "../../utils/primitiveTypes" ;
67import { insertTransaction } from "../../utils/transaction/insertTransaction" ;
8+ import type { InsertedTransaction } from "../../utils/transaction/types" ;
79
810interface QueueTxParams {
911 // we should move away from Transaction type (v4 SDK)
@@ -49,10 +51,8 @@ export const queueTx = async ({
4951 functionName,
5052 functionArgs,
5153 extension,
52- gas : maybeBigInt ( txOverrides ?. gas ) ,
53- maxFeePerGas : maybeBigInt ( txOverrides ?. maxFeePerGas ) ,
54- maxPriorityFeePerGas : maybeBigInt ( txOverrides ?. maxPriorityFeePerGas ) ,
55- } ;
54+ ...parseTransactionOverrides ( txOverrides ) ,
55+ } satisfies Partial < InsertedTransaction > ;
5656
5757 // TODO: We need a much safer way of detecting if the transaction should be a user operation
5858 const isUserOp = ! ! ( tx . getSigner as ERC4337EthersSigner ) . erc4337provider ;
@@ -76,27 +76,25 @@ export const queueTx = async ({
7676 idempotencyKey,
7777 shouldSimulate : simulateTx ,
7878 } ) ;
79- } else {
80- const isPublishedContractDeploy =
81- tx . getTarget ( ) === ZERO_ADDRESS &&
82- functionName === "deploy" &&
83- extension === "deploy-published" ;
79+ }
8480
85- const queueId = await insertTransaction ( {
86- insertedTransaction : {
87- ...baseTransaction ,
88- isUserOp : false ,
89- deployedContractAddress,
90- deployedContractType,
91- from : normalizeAddress ( await tx . getSignerAddress ( ) ) ,
92- to : normalizeAddress (
93- isPublishedContractDeploy ? undefined : tx . getTarget ( ) ,
94- ) ,
95- } ,
96- idempotencyKey,
97- shouldSimulate : simulateTx ,
98- } ) ;
81+ const isPublishedContractDeploy =
82+ tx . getTarget ( ) === ZERO_ADDRESS &&
83+ functionName === "deploy" &&
84+ extension === "deploy-published" ;
9985
100- return queueId ;
101- }
86+ return await insertTransaction ( {
87+ insertedTransaction : {
88+ ...baseTransaction ,
89+ isUserOp : false ,
90+ deployedContractAddress,
91+ deployedContractType,
92+ from : normalizeAddress ( await tx . getSignerAddress ( ) ) ,
93+ to : normalizeAddress (
94+ isPublishedContractDeploy ? undefined : tx . getTarget ( ) ,
95+ ) ,
96+ } ,
97+ idempotencyKey,
98+ shouldSimulate : simulateTx ,
99+ } ) ;
102100} ;
0 commit comments