Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
sherifahmed990 committed Feb 6, 2024
1 parent ee268c8 commit ce1f48d
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 34 deletions.
5 changes: 1 addition & 4 deletions src/abstractionkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,4 @@ export {
MetaTransaction,
} from "./types";

export {
ZeroAddress,
UserOperationDummyValues,
} from "./constants";
export { ZeroAddress, UserOperationDummyValues } from "./constants";
33 changes: 17 additions & 16 deletions src/account/Safe/SafeAccountV0_2_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
*/
Expand All @@ -455,8 +456,8 @@ export class SafeAccountV0_2_0 extends SmartAccount {
tokenAddress,
paymasterAddress,
approveAmount,
multisendContractAddress
)
multisendContractAddress,
);
}

/**
Expand All @@ -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);
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -704,15 +705,15 @@ 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,
bundlerRpc,
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",
Expand Down Expand Up @@ -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,
Expand All @@ -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 = [];
Expand Down
20 changes: 10 additions & 10 deletions src/account/Safe/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
8 changes: 6 additions & 2 deletions src/paymaster/CandidePaymaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions src/paymaster/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ export interface CandidePaymasterContext {
token?: string;
}


export interface PrependTokenPaymasterApproveAccount {
prependTokenPaymasterApproveToCallData(
callData: string,
tokenAddress: string,
paymasterAddress: string,
approveAmount: bigint,
): string;
}
}

0 comments on commit ce1f48d

Please sign in to comment.