Skip to content

Commit

Permalink
fix: typo and added console log
Browse files Browse the repository at this point in the history
  • Loading branch information
KannuSingh committed May 16, 2024
1 parent 142b65a commit 6948b38
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -440,12 +440,12 @@ export class KernelSmartAccountLib implements EIP155Wallet {
})
const gasPrice = (await pimlicoBundlerClient.getUserOperationGasPrice()).fast
const calls = getSendCallData(sendCallsParam)
const callData = await this.client.account.encodeCallData(calls)
const capabilities = sendCallsParam.capabilities
if (capabilities && capabilities['payamasterService']) {
const paymasterService = capabilities.get(
'payamasterService'
) as SendCallsPaymasterServiceCapabilityParam
if (capabilities && capabilities['paymasterService']) {
console.log("executing sendCalls with paymasterService")
const paymasterService = capabilities[
'paymasterService'
] as SendCallsPaymasterServiceCapabilityParam

const paymasterUrl = paymasterService.url

Expand Down Expand Up @@ -480,7 +480,7 @@ export class KernelSmartAccountLib implements EIP155Wallet {
chain: this.chain,
context: paymasterService.context
})

console.log({paymasterStubData})
const userOpWithStubData: UserOperation<'v0.7'> = {
...userOpPreStubData,
...paymasterStubData,
Expand All @@ -493,7 +493,7 @@ export class KernelSmartAccountLib implements EIP155Wallet {
const gasEstimation = await pimlicoBundlerClient.estimateUserOperationGas({
userOperation: userOpWithStubData
})

console.log({gasEstimation})
const userOpWithGasEstimates: UserOperation<'v0.7'> = {
...userOpWithStubData,
...gasEstimation
Expand All @@ -508,7 +508,7 @@ export class KernelSmartAccountLib implements EIP155Wallet {
chain: this.chain,
context: paymasterService.context
})

console.log({paymasterData})
const userOpWithPaymasterData: UserOperation<'v0.7'> = {
...userOpWithGasEstimates,
...paymasterData
Expand All @@ -524,8 +524,10 @@ export class KernelSmartAccountLib implements EIP155Wallet {
const userOpHash = await pimlicoBundlerClient.sendUserOperation({
userOperation: userOp
})
console.log({userOpHash})
return userOpHash
}
console.log("executing sendCalls")
return this.sendBatchTransaction(calls)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { SendCallsParams, SendCallsPaymasterServiceCapabilityParam } from '@/dat

export class SafeSmartAccountLib extends SmartAccountLib {
async getClientConfig(): Promise<SmartAccountClientConfig<EntryPoint>> {
this.type = 'Safe'
const safeAccount = await signerToSafe7579SmartAccount(this.publicClient, {
entryPoint: ENTRYPOINT_ADDRESS_V07,
signer: this.signer
Expand Down Expand Up @@ -184,13 +185,11 @@ export class SafeSmartAccountLib extends SmartAccountLib {
}
const gasPrice = (await this.bundlerClient.getUserOperationGasPrice()).fast
const calls = getSendCallData(sendCallsParam)
console.log({ calls })
const accountDeployed = await isSmartAccountDeployed(
this.publicClient,
this.client.account.address
)
let callData = await this.client.account.encodeCallData(calls)

if (!accountDeployed) {
const initialValidators = getSafe7579InitialValidators()
const initData = getSafe7579InitData(this.signer.address, initialValidators, calls)
Expand All @@ -203,11 +202,12 @@ export class SafeSmartAccountLib extends SmartAccountLib {
}

const capabilities = sendCallsParam.capabilities
console.log({ capabilities })
if (capabilities && capabilities['payamasterService']) {
const paymasterService = capabilities.get(
'payamasterService'
) as SendCallsPaymasterServiceCapabilityParam

if (capabilities && capabilities['paymasterService']) {
console.log("executing sendCalls with paymasterService")
const paymasterService = capabilities[
'paymasterService'
] as SendCallsPaymasterServiceCapabilityParam

const paymasterUrl = paymasterService.url

Expand Down Expand Up @@ -242,7 +242,7 @@ export class SafeSmartAccountLib extends SmartAccountLib {
chain: this.chain,
context: paymasterService.context
})

console.log({paymasterStubData})
const userOpWithStubData: UserOperation<'v0.7'> = {
...userOpPreStubData,
...paymasterStubData,
Expand All @@ -255,7 +255,7 @@ export class SafeSmartAccountLib extends SmartAccountLib {
const gasEstimation = await this.bundlerClient.estimateUserOperationGas({
userOperation: userOpWithStubData
})

console.log({gasEstimation})
const userOpWithGasEstimates: UserOperation<'v0.7'> = {
...userOpWithStubData,
...gasEstimation
Expand All @@ -270,7 +270,7 @@ export class SafeSmartAccountLib extends SmartAccountLib {
chain: this.chain,
context: paymasterService.context
})

console.log({paymasterData})
const userOpWithPaymasterData: UserOperation<'v0.7'> = {
...userOpWithGasEstimates,
...paymasterData
Expand All @@ -286,8 +286,10 @@ export class SafeSmartAccountLib extends SmartAccountLib {
const userOpHash = await this.bundlerClient.sendUserOperation({
userOperation: userOp
})
console.log({userOpHash})
return userOpHash
}
console.log("executing sendCalls")
return this.sendBatchTransaction(calls)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,13 @@ export abstract class SmartAccountLib implements EIP155Wallet {
}
const gasPrice = (await this.bundlerClient.getUserOperationGasPrice()).fast
const calls = getSendCallData(sendCallsParam)
const callData = await this.client.account.encodeCallData(calls)

const capabilities = sendCallsParam.capabilities
if (capabilities && capabilities.get('payamasterService')) {
const paymasterService = capabilities.get(
'payamasterService'
) as SendCallsPaymasterServiceCapabilityParam
if (capabilities && capabilities['paymasterService']) {
console.log("executing sendCalls with paymasterService")
const paymasterService = capabilities[
'paymasterService'
] as SendCallsPaymasterServiceCapabilityParam

const paymasterUrl = paymasterService.url

Expand Down Expand Up @@ -269,7 +270,7 @@ export abstract class SmartAccountLib implements EIP155Wallet {
chain: this.chain,
context: paymasterService.context
})

console.log({paymasterStubData})
const userOpWithStubData: UserOperation<'v0.7'> = {
...userOpPreStubData,
...paymasterStubData,
Expand All @@ -282,7 +283,7 @@ export abstract class SmartAccountLib implements EIP155Wallet {
const gasEstimation = await this.bundlerClient.estimateUserOperationGas({
userOperation: userOpWithStubData
})

console.log({gasEstimation})
const userOpWithGasEstimates: UserOperation<'v0.7'> = {
...userOpWithStubData,
...gasEstimation
Expand All @@ -297,7 +298,7 @@ export abstract class SmartAccountLib implements EIP155Wallet {
chain: this.chain,
context: paymasterService.context
})

console.log({paymasterData})
const userOpWithPaymasterData: UserOperation<'v0.7'> = {
...userOpWithGasEstimates,
...paymasterData
Expand All @@ -313,8 +314,10 @@ export abstract class SmartAccountLib implements EIP155Wallet {
const userOpHash = await this.bundlerClient.sendUserOperation({
userOperation: userOp
})
console.log({userOpHash})
return userOpHash
}
console.log("executing sendCalls")
return this.sendBatchTransaction(calls)
}
}

0 comments on commit 6948b38

Please sign in to comment.