11import { Address , LocalAccountSigner , SmartAccountSigner } from "@aa-sdk/core" ;
2- import { alchemy , defineAlchemyChain } from "@account-kit/infra" ;
2+ import { alchemy } from "@account-kit/infra" ;
33import {
4- createModularAccountV2 ,
54 createModularAccountV2Client ,
65 ModularAccountV2Client ,
76} from "@account-kit/smart-contracts" ;
@@ -11,7 +10,7 @@ import {
1110 Hex ,
1211 http ,
1312 SignTypedDataParameters ,
14- zeroAddress ,
13+ TransactionRequest ,
1514} from "viem" ;
1615import { AcpContractConfig , baseAcpConfigV2 } from "../configs/acpConfigs" ;
1716import AcpError from "../acpError" ;
@@ -33,10 +32,6 @@ import { base, baseSepolia } from "viem/chains";
3332import MEMO_MANAGER_ABI from "../abis/memoManagerAbi" ;
3433
3534class AcpContractClientV2 extends BaseAcpContractClient {
36- private PRIORITY_FEE_MULTIPLIER = 2 ;
37- private MAX_FEE_PER_GAS = 20000000 ;
38- private MAX_PRIORITY_FEE_PER_GAS = 21000000 ;
39- private GAS_FEE_MULTIPLIER = 0.5 ;
4035 private RETRY_CONFIG = {
4136 intervalMs : 200 ,
4237 multiplier : 1.1 ,
@@ -198,7 +193,7 @@ class AcpContractClientV2 extends BaseAcpContractClient {
198193 return BigInt ( "0x" + hex ) ;
199194 }
200195
201- get sessionKeyClient ( ) {
196+ private get sessionKeyClient ( ) {
202197 if ( ! this . _sessionKeyClient ) {
203198 throw new AcpError ( "Session key client not initialized" ) ;
204199 }
@@ -214,28 +209,6 @@ class AcpContractClientV2 extends BaseAcpContractClient {
214209 return this . _acpX402 ;
215210 }
216211
217- private async calculateGasFees ( chainId ?: number ) {
218- if ( chainId ) {
219- const { maxFeePerGas } = await this . publicClients [
220- chainId
221- ] . estimateFeesPerGas ( ) ;
222-
223- const increasedMaxFeePerGas =
224- BigInt ( maxFeePerGas ) +
225- ( BigInt ( maxFeePerGas ) * BigInt ( this . GAS_FEE_MULTIPLIER * 100 ) ) /
226- BigInt ( 100 ) ;
227-
228- return increasedMaxFeePerGas ;
229- }
230-
231- const finalMaxFeePerGas =
232- BigInt ( this . MAX_FEE_PER_GAS ) +
233- BigInt ( this . MAX_PRIORITY_FEE_PER_GAS ) *
234- BigInt ( Math . max ( 0 , this . PRIORITY_FEE_MULTIPLIER - 1 ) ) ;
235-
236- return finalMaxFeePerGas ;
237- }
238-
239212 async handleOperation (
240213 operations : OperationPayload [ ] ,
241214 chainId ?: number
@@ -409,6 +382,12 @@ class AcpContractClientV2 extends BaseAcpContractClient {
409382 async signTypedData ( typedData : SignTypedDataParameters ) : Promise < Hex > {
410383 return await this . sessionKeyClient . signTypedData ( { typedData } ) ;
411384 }
385+
386+ async sendTransaction ( request : TransactionRequest ) : Promise < Hex > {
387+ return await this . sessionKeyClient . sendTransaction ( request , {
388+ paymasterAndData : "0x" ,
389+ } ) ;
390+ }
412391}
413392
414393export default AcpContractClientV2 ;
0 commit comments