Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stable release 3.0.0 #250

Merged
merged 5 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/account/src/BiconomySmartAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,14 @@ export class BiconomySmartAccount extends SmartAccount implements IBiconomySmart

// Requesting to update gas limits again (especially callGasLimit needs to be re-calculated)
try {
delete finalUserOp.callGasLimit
delete finalUserOp.verificationGasLimit
delete finalUserOp.preVerificationGas

// Maybe send paymasterAndData since we know it's for Token paymaster
/*finalUserOp.paymasterAndData =
'0x00000f7748595E46527413574A9327942E744e91010000000000000000000000000000000000000000000000000000000064c8d0b00000000000000000000000000000000000000000000000000000000064c8c9a80000000000000000000000009ff2a6b0cdc4ab06bbe231327edfe493f130a9940000000000000000000000000000065b8abb967271817555f23945eedf08015c0000000000000000000000000000000000000000000000637beae03368dff0200000000000000000000000000000000000000000000000000000000000124f80b4b2e253ade49657abd3dd298a172e7d13f46dd60245c18f69b1df2302a2bef45c75e6a1c34013805e074f841e33d42d1eb058c106ab21b4c62f9b3232c72c341b'*/

finalUserOp = await this.estimateUserOpGas(finalUserOp)
const cgl = ethers.BigNumber.from(finalUserOp.callGasLimit)
if (finalUserOp.callGasLimit && cgl.lt(ethers.BigNumber.from('21000'))) {
Expand Down
22 changes: 14 additions & 8 deletions packages/account/src/SmartAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,21 @@ export abstract class SmartAccount implements ISmartAccount {
(await this.provider.getGasPrice())
if (userOp.initCode)
userOp.verificationGasLimit =
userOp.verificationGasLimit ?? (await this.getVerificationGasLimit(userOp.initCode))
userOp.verificationGasLimit !== null || userOp.verificationGasLimit !== undefined
? userOp.verificationGasLimit
: await this.getVerificationGasLimit(userOp.initCode)
userOp.callGasLimit =
userOp.callGasLimit ??
(await this.provider.estimateGas({
from: this.smartAccountConfig.entryPointAddress,
to: userOp.sender,
data: userOp.callData
}))
userOp.preVerificationGas = userOp.preVerificationGas ?? this.getPreVerificationGas(userOp)
userOp.callGasLimit !== null || userOp.callGasLimit !== undefined
? userOp.callGasLimit
: await this.provider.estimateGas({
from: this.smartAccountConfig.entryPointAddress,
to: userOp.sender,
data: userOp.callData
})
userOp.preVerificationGas =
userOp.preVerificationGas !== null || userOp.preVerificationGas !== undefined
? userOp.preVerificationGas
: this.getPreVerificationGas(userOp)
return userOp
}

Expand Down
4 changes: 3 additions & 1 deletion packages/common/src/httpRequests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,20 @@ export async function sendRequest<T>({ url, method, body, headers = {} }: HttpRe
}
// else
}
const errorObject = { code: response.status, message: response.statusText }
const errorObject = { code: response.status, message: response.statusText, data: undefined }

if (jsonResponse?.error) {
if (typeof jsonResponse.error === 'string') {
const error = jsonResponse.error
errorObject.code = response.status
errorObject.message = error
delete errorObject.data
throw errorObject
} else if (typeof jsonResponse.error === 'object') {
const error = jsonResponse.error
errorObject.code = error?.code
errorObject.message = error?.message
errorObject.data = error?.handleOpsCallData
throw errorObject
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/paymaster/src/BiconomyPaymaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ export class BiconomyPaymaster implements IHybridPaymaster<SponsorUserOperationD
): Promise<Partial<UserOperation>> {
// Review
userOp = await resolveProperties(userOp)
if (userOp.nonce) {
if (userOp.nonce !== null || userOp.nonce !== undefined) {
userOp.nonce = BigNumber.from(userOp.nonce).toHexString()
}
if (userOp.callGasLimit) {
if (userOp.callGasLimit !== null || userOp.callGasLimit !== undefined) {
userOp.callGasLimit = BigNumber.from(userOp.callGasLimit).toString()
}
if (userOp.verificationGasLimit) {
if (userOp.verificationGasLimit !== null || userOp.verificationGasLimit !== undefined) {
userOp.verificationGasLimit = BigNumber.from(userOp.verificationGasLimit).toString()
}
if (userOp.preVerificationGas) {
if (userOp.preVerificationGas !== null || userOp.preVerificationGas !== undefined) {
userOp.preVerificationGas = BigNumber.from(userOp.preVerificationGas).toString()
}
userOp.maxFeePerGas = BigNumber.from(userOp.maxFeePerGas).toHexString()
Expand Down