From ce1f48de7cb5a8934233df6b3af408f8cdc83290 Mon Sep 17 00:00:00 2001 From: Sherif Abdelmoatty Date: Tue, 6 Feb 2024 18:46:07 +0300 Subject: [PATCH] format --- src/abstractionkit.ts | 5 +--- src/account/Safe/SafeAccountV0_2_0.ts | 33 ++++++++++++++------------- src/account/Safe/types.ts | 20 ++++++++-------- src/paymaster/CandidePaymaster.ts | 8 +++++-- src/paymaster/types.ts | 3 +-- 5 files changed, 35 insertions(+), 34 deletions(-) diff --git a/src/abstractionkit.ts b/src/abstractionkit.ts index cbe0de2..7a1ba61 100644 --- a/src/abstractionkit.ts +++ b/src/abstractionkit.ts @@ -47,7 +47,4 @@ export { MetaTransaction, } from "./types"; -export { - ZeroAddress, - UserOperationDummyValues, -} from "./constants"; \ No newline at end of file +export { ZeroAddress, UserOperationDummyValues } from "./constants"; diff --git a/src/account/Safe/SafeAccountV0_2_0.ts b/src/account/Safe/SafeAccountV0_2_0.ts index 14f3d5f..db82675 100644 --- a/src/account/Safe/SafeAccountV0_2_0.ts +++ b/src/account/Safe/SafeAccountV0_2_0.ts @@ -130,10 +130,11 @@ export class SafeAccountV0_2_0 extends SmartAccount { public static createAccountAddress( owners: string[], overrides: InitCodeOverrides = {}, - ): string{ + ): string { const [address, ] = SafeAccountV0_2_0.createAccountAddressAndInitCode( - owners, overrides - ) + owners, + overrides, + ); return address; } @@ -439,7 +440,7 @@ export class SafeAccountV0_2_0 extends SmartAccount { } /** - * a non static wrapper function for prependTokenPaymasterApproveToCallDataStatic + * a non static wrapper function for prependTokenPaymasterApproveToCallDataStatic * which adds a token approve call to the call data for a token paymaster * @returns callData */ @@ -455,8 +456,8 @@ export class SafeAccountV0_2_0 extends SmartAccount { tokenAddress, paymasterAddress, approveAmount, - multisendContractAddress - ) + multisendContractAddress, + ); } /** @@ -471,7 +472,7 @@ export class SafeAccountV0_2_0 extends SmartAccount { multisendContractAddress: string = SafeAccountV0_2_0.DEFAULT_MULTISEND_CONTRACT_ADDRESS, ): string { const [to, value, accountCallData, operation] = - SafeAccountV0_2_0.decodeAccountCallData(callData); + SafeAccountV0_2_0.decodeAccountCallData(callData); let accountCallDataString = ""; if (typeof accountCallData !== "string") { accountCallDataString = new TextDecoder().decode(accountCallData); @@ -597,13 +598,13 @@ export class SafeAccountV0_2_0 extends SmartAccount { let nonce = 0n as bigint; if (overrids.nonce == null) { - if(providerRpc != null){ + if (providerRpc != null) { nonce = await fetchAccountNonce( providerRpc, this.entrypointAddress, this.accountAddress, ); - }else{ + } else { throw new AbstractionKitError( "BAD_DATA", "providerRpc cant't be null if nonce is not overriden", @@ -645,9 +646,9 @@ export class SafeAccountV0_2_0 extends SmartAccount { overrids.maxFeePerGas == null || overrids.maxPriorityFeePerGas == null ) { - if(providerRpc != null){ + if (providerRpc != null) { [maxFeePerGas, maxPriorityFeePerGas] = await fetchGasPrice(providerRpc); - }else{ + } else { throw new AbstractionKitError( "BAD_DATA", "providerRpc cant't be null if maxFeePerGas and maxPriorityFeePerGas are not overriden", @@ -704,7 +705,7 @@ export class SafeAccountV0_2_0 extends SmartAccount { overrids.verificationGasLimit == null || overrids.callGasLimit == null ) { - if(bundlerRpc != null){ + if (bundlerRpc != null) { [preVerificationGas, verificationGasLimit, callGasLimit] = await this.estimateUserOperationGas( userOperation, @@ -712,7 +713,7 @@ export class SafeAccountV0_2_0 extends SmartAccount { overrids.state_override_set, overrids.numberOfSigners, ); - }else{ + } else { throw new AbstractionKitError( "BAD_DATA", "bundlerRpc cant't be null if preVerificationGas,verificationGasLimit and callGasLimit are not overriden", @@ -800,7 +801,7 @@ export class SafeAccountV0_2_0 extends SmartAccount { throw RangeError("validUntil can't be negative"); } - const SafeUserOperation:SafeUserOperationTypedDataValues = { + const SafeUserOperation: SafeUserOperationTypedDataValues = { safe: useroperation.sender, nonce: useroperation.nonce, initCode: useroperation.initCode, @@ -816,10 +817,10 @@ export class SafeAccountV0_2_0 extends SmartAccount { entryPoint: this.entrypointAddress, }; - const domain:SafeUserOperationTypedDataDomain = { + const domain: SafeUserOperationTypedDataDomain = { chainId, verifyingContract: this.safe4337ModuleAddress, - } + }; const signersAddresses = []; const signatures = []; diff --git a/src/account/Safe/types.ts b/src/account/Safe/types.ts index 21a2958..b574f79 100644 --- a/src/account/Safe/types.ts +++ b/src/account/Safe/types.ts @@ -79,22 +79,22 @@ export enum SafeModuleExecutorFunctionSelector { } export interface SafeUserOperationTypedDataDomain { - chainId: bigint, + chainId: bigint; verifyingContract: string; } export interface SafeUserOperationTypedDataValues { safe: string; - nonce: bigint, + nonce: bigint; initCode: string; callData: string; - callGasLimit: bigint, - verificationGasLimit: bigint, - preVerificationGas: bigint, - maxFeePerGas: bigint, - maxPriorityFeePerGas: bigint, + callGasLimit: bigint; + verificationGasLimit: bigint; + preVerificationGas: bigint; + maxFeePerGas: bigint; + maxPriorityFeePerGas: bigint; paymasterAndData: string; - validAfter: bigint, - validUntil: bigint, + validAfter: bigint; + validUntil: bigint; entryPoint: string; -} \ No newline at end of file +} diff --git a/src/paymaster/CandidePaymaster.ts b/src/paymaster/CandidePaymaster.ts index fd627df..71fb8ca 100644 --- a/src/paymaster/CandidePaymaster.ts +++ b/src/paymaster/CandidePaymaster.ts @@ -8,7 +8,10 @@ import { ERC20Token, StateOverrideSet, } from "../types"; -import { CandidePaymasterContext, PrependTokenPaymasterApproveAccount } from "./types"; +import { + CandidePaymasterContext, + PrependTokenPaymasterApproveAccount, +} from "./types"; import { Bundler } from "src/Bundler"; import { AbstractionKitError, ensureError } from "src/errors"; @@ -137,7 +140,8 @@ export class CandidePaymaster extends Paymaster { } const supportedTokens = this.supportedTokens as ERC20Token[]; const gasToken = supportedTokens.find( - (token) => token.address.toLowerCase() === erc20TokenAddress.toLowerCase(), + (token) => + token.address.toLowerCase() === erc20TokenAddress.toLowerCase(), ); if (!gasToken) { diff --git a/src/paymaster/types.ts b/src/paymaster/types.ts index 0f3fb13..69e6223 100644 --- a/src/paymaster/types.ts +++ b/src/paymaster/types.ts @@ -2,7 +2,6 @@ export interface CandidePaymasterContext { token?: string; } - export interface PrependTokenPaymasterApproveAccount { prependTokenPaymasterApproveToCallData( callData: string, @@ -10,4 +9,4 @@ export interface PrependTokenPaymasterApproveAccount { paymasterAddress: string, approveAmount: bigint, ): string; -} \ No newline at end of file +}