Skip to content

Commit

Permalink
fix monorepo lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mmv08 committed Jul 19, 2024
1 parent e73e753 commit 23a3118
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 288 deletions.
4 changes: 2 additions & 2 deletions examples/4337-gas-metering/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ NOTE: If you run a paymaster analysis twice or more without changing the salt fo
## Gas Usage Results

| | **With 4337?** | **Account Creation** | **Account Creation + Native Transfer** | **Native Transfer** | **Account Creation + ERC20 Transfer** | **ERC20 Transfer** | **Account Creation + ERC721 Minting** | **ERC721 Minting** |
| ---------------------------------------------------------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ---------------------------------------------------------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **[Without Paymaster](../../modules/4337/test/gas/Gas.spec.ts)** | Yes | 415213 | 447632 | 182081 | 426139 | 160575 | 467926 | 202374 |
| **Gelato (4337 Compatible - 1Balance)** | No | 302679 ([TX](https://sepolia.basescan.org/tx/0x1b2f743dff63dfc6e01e18623cb8d692d4a1cf206008358fac3eaf8fd5957c91)) ([Gas](https://dashboard.tenderly.co/tx/base-sepolia/0x1b2f743dff63dfc6e01e18623cb8d692d4a1cf206008358fac3eaf8fd5957c91/gas-usage)) | 313228 ([TX](https://sepolia.basescan.org/tx/0xddbd655b8a11cf043c535c2d6dbe14aa82925d444a0d4bb5378670993ad1862c)) ([Gas](https://dashboard.tenderly.co/tx/base-sepolia/0xddbd655b8a11cf043c535c2d6dbe14aa82925d444a0d4bb5378670993ad1862c/gas-usage)) | 83930 ([TX](https://sepolia.basescan.org/tx/0x162b8817fe9cbbccb905c4b51cc25cbf2625afa1e5341087a4e79b9bb6834fc6)) ([Gas](https://dashboard.tenderly.co/tx/base-sepolia/0x162b8817fe9cbbccb905c4b51cc25cbf2625afa1e5341087a4e79b9bb6834fc6/gas-usage)) | 315961 ([TX](https://sepolia.basescan.org/tx/0x1043acb58c89667d26360f23532d6eee4ab927b20ba37035fb3ffb8cc71c224b)) ([Gas](https://dashboard.tenderly.co/tx/base-sepolia/0x1043acb58c89667d26360f23532d6eee4ab927b20ba37035fb3ffb8cc71c224b/gas-usage)) | 86852 ([TX](https://sepolia.basescan.org/tx/0x6c6ccadea5e54aa47b36c603132b315f1cf15e75e96c0376a7c76ae48f69a006)) ([Gas](https://dashboard.tenderly.co/tx/base-sepolia/0x6c6ccadea5e54aa47b36c603132b315f1cf15e75e96c0376a7c76ae48f69a006/gas-usage)) | 345284 ([TX](https://sepolia.basescan.org/tx/0xd49b482ff37f07f12fc1688a2af33b4451d63409fe547f9cf2e660422866da3e)) ([Gas](https://dashboard.tenderly.co/tx/base-sepolia/0xd49b482ff37f07f12fc1688a2af33b4451d63409fe547f9cf2e660422866da3e/gas-usage)) | 116159 ([TX](https://sepolia.basescan.org/tx/0x5814be99c937b6e7386f3526fe9f11fc1bf7a21180daf66ee2e44cc1e4d0da3d)) ([Gas](https://dashboard.tenderly.co/tx/base-sepolia/0x5814be99c937b6e7386f3526fe9f11fc1bf7a21180daf66ee2e44cc1e4d0da3d/gas-usage)) |
| **Pimlico - EntryPoint v0.7 (Base Sepolia - ERC20 Paymaster)** | Yes | 487605 ([TX](https://sepolia.basescan.org/tx/0xc44f5d2f26a71663f15f0c257bc557707179161578508c2c9a1095b53a69daa7)) ([Gas](https://dashboard.tenderly.co/tx/base-sepolia/0xc44f5d2f26a71663f15f0c257bc557707179161578508c2c9a1095b53a69daa7/gas-usage)) | 494988 ([TX](https://sepolia.basescan.org/tx/0xcbd6cbce4bb5ca257968fc583b401b66a6d4658ed75e5eabecc895db1305e647)) ([Gas](https://dashboard.tenderly.co/tx/base-sepolia/0xcbd6cbce4bb5ca257968fc583b401b66a6d4658ed75e5eabecc895db1305e647/gas-usage)) | 182388 ([TX](https://sepolia.basescan.org/tx/0xae8555a827966d28414a1110ac73ced970115a2e3c5a7400490b8fbc9dc42624)) ([Gas](https://dashboard.tenderly.co/tx/base-sepolia/0xae8555a827966d28414a1110ac73ced970115a2e3c5a7400490b8fbc9dc42624/gas-usage)) | 514156 ([TX](https://sepolia.basescan.org/tx/0x8302c8a2f381067855091c97d091bcfc566e4112a33e65b34fbfadb5c5318c66)) ([Gas](https://dashboard.tenderly.co/tx/base-sepolia/0x8302c8a2f381067855091c97d091bcfc566e4112a33e65b34fbfadb5c5318c66/gas-usage)) | 185479 ([TX](https://sepolia.basescan.org/tx/0xa1b9fc3edefc8cf824b37151d55aa0e7319ab8f8c3e2affd1aba4d19efba3a91)) ([Gas](https://dashboard.tenderly.co/tx/base-sepolia/0xa1b9fc3edefc8cf824b37151d55aa0e7319ab8f8c3e2affd1aba4d19efba3a91/gas-usage)) | 527408 ([TX](https://sepolia.basescan.org/tx/0xfca26170369c63b0c4c6abcb4bcb569376e180310a4f2c4b37dbf3b6de2a9fd5)) ([Gas](https://dashboard.tenderly.co/tx/base-sepolia/0xfca26170369c63b0c4c6abcb4bcb569376e180310a4f2c4b37dbf3b6de2a9fd5/gas-usage)) | 214759 ([TX](https://sepolia.basescan.org/tx/0xe5a0e1aa8f714e354730344b1110f0225993d6885d68d7b9c8e309da800190a1)) ([Gas](https://dashboard.tenderly.co/tx/base-sepolia/0xe5a0e1aa8f714e354730344b1110f0225993d6885d68d7b9c8e309da800190a1/gas-usage)) |
Expand Down Expand Up @@ -60,7 +60,7 @@ NOTE: If you run a paymaster analysis twice or more without changing the salt fo
### Alchemy - EntryPoint v0.7 (ETH - Gas Policy)

| Type | Actual Gas | handleOps | createProxyWithNonce | ValidateUserOp (Safe) | \_executeUserOp | executeUserOp (Safe) | execTransactionFromModule |
|------------------------------------|------------|-----------|----------------------|-----------------------|-----------------|----------------------|---------------------------|
| ---------------------------------- | ---------- | --------- | -------------------- | --------------------- | --------------- | -------------------- | ------------------------- |
| Account Creation | 410072 | 373790 | 264042 | 11762 | NA | NA | NA |
| Account Creation + Native Transfer | 417573 | 381161 | 264042 | 11762 | 21913 | 13795 | 11782 |
| Native Transfer | 128393 | 102544 | NA | 15563 | 23933 | 15795 | 13782 |
Expand Down
5 changes: 3 additions & 2 deletions examples/4337-gas-metering/alchemy/alchemy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import {
getMaxPriorityFeePerGasFromAlchemy,
getMaxFeePerGas,
getGasValuesFromAlchemy,
submitUserOperationAlchemy, addHexPrefix,
submitUserOperationAlchemy,
addHexPrefix,
} from './utils'

import { transferETH } from '../utils/nativeTransfer'
Expand Down Expand Up @@ -251,7 +252,7 @@ if (usePaymaster) {
abi: parseAbi(['function depositTo(address _to) public payable']),
})

const transaction = await entryPoint.write.depositTo([sponsoredUserOperation.sender])
const transaction = await entryPoint.write.depositTo([sponsoredUserOperation.sender], { value: requiredPrefund })
console.log(`Prefund transaction hash: ${transaction}`)
await publicClient.waitForTransactionReceipt({
hash: transaction,
Expand Down
17 changes: 11 additions & 6 deletions examples/4337-gas-metering/alchemy/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Alchemy } from 'alchemy-sdk'
import { fromHex } from 'viem'
import { setTimeout } from "timers/promises";
import { setTimeout } from 'timers/promises'
import { UserOperation } from '../utils/userOps'

// Sponsored User Operation Data
Expand All @@ -11,7 +11,7 @@ export type suoData = {
paymaster: string
paymasterData: string
paymasterVerificationGasLimit: string
paymasterPostOpGasLimit: string
paymasterPostOpGasLimit: string
maxFeePerGas: string
maxPriorityFeePerGas: string
}
Expand Down Expand Up @@ -44,7 +44,7 @@ export const serializeValuesToBigInt = <T extends Record<string, string>, K exte
)
}

export const addHexPrefix = (hexStr: string): `0x${string}` => (hexStr.startsWith('0x') ? hexStr as `0x{string}` : `0x${hexStr}`)
export const addHexPrefix = (hexStr: string): `0x${string}` => (hexStr.startsWith('0x') ? (hexStr as `0x{string}`) : `0x${hexStr}`)

export const getGasValuesFromAlchemyPaymaster = async (
policyID: string | undefined,
Expand Down Expand Up @@ -92,7 +92,7 @@ export const getGasValuesFromAlchemyPaymaster = async (
})
console.log('\nReceived Paymaster Data from Alchemy.')

return serializeValuesToBigInt(suoData, ['paymaster', "paymasterData"])
return serializeValuesToBigInt(suoData, ['paymaster', 'paymasterData'])
}

export const getMaxPriorityFeePerGasFromAlchemy = async (chain: string, apiKey: string): Promise<bigint> => {
Expand Down Expand Up @@ -212,14 +212,19 @@ export const submitUserOperationAlchemy = async (
params: [
{
...sponsoredUserOperation,
paymasterPostOpGasLimit: addHexPrefix(sponsoredUserOperation.paymasterPostOpGasLimit?.toString(16) ?? '0x'),
paymasterVerificationGasLimit: addHexPrefix(sponsoredUserOperation.paymasterVerificationGasLimit?.toString(16) ?? '0x'),
callGasLimit: addHexPrefix(sponsoredUserOperation.callGasLimit.toString(16)),
verificationGasLimit: addHexPrefix(sponsoredUserOperation.verificationGasLimit.toString(16)),
preVerificationGas: addHexPrefix(sponsoredUserOperation.preVerificationGas.toString(16)),
maxFeePerGas: addHexPrefix(sponsoredUserOperation.maxFeePerGas.toString(16)),
maxPriorityFeePerGas: addHexPrefix(sponsoredUserOperation.maxPriorityFeePerGas.toString(16)),
nonce: addHexPrefix(sponsoredUserOperation.nonce.toString(16)),
// Paymaster fields do not pass alchemy validation if the transaction doesn't have a paymaster.
...(sponsoredUserOperation.paymaster
? {
paymasterPostOpGasLimit: addHexPrefix(sponsoredUserOperation.paymasterPostOpGasLimit?.toString(16) ?? '0x'),
paymasterVerificationGasLimit: addHexPrefix(sponsoredUserOperation.paymasterVerificationGasLimit?.toString(16) ?? '0x'),
}
: {}),
},
entryPointAddress,
],
Expand Down
2 changes: 1 addition & 1 deletion modules/4337/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@simplewebauthn/server": "^10.0.0",
"@types/chai": "^4.3.16",
"@types/mocha": "^10.0.7",
"@types/node": "^20.14.8",
"@types/node": "^20.14.10",
"@types/yargs": "^17.0.32",
"cbor": "^9.0.2",
"debug": "^4.3.5",
Expand Down
4 changes: 2 additions & 2 deletions modules/allowances/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@typechain/ethers-v6": "^0.5.1",
"@typechain/hardhat": "^9.1.0",
"@types/mocha": "^10.0.7",
"@types/node": "^20.14.8",
"@types/node": "^20.14.10",
"@typescript-eslint/eslint-plugin": "^7.12.0",
"@typescript-eslint/parser": "^7.12.0",
"dotenv": "^16.4.5",
Expand All @@ -46,4 +46,4 @@
"typechain": "^8.3.2",
"typescript": "^5.5.2"
}
}
}
2 changes: 1 addition & 1 deletion modules/passkey/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@safe-global/safe-4337-local-bundler": "workspace:^0.0.0",
"@safe-global/safe-contracts": "1.4.1-build.0",
"@simplewebauthn/server": "^10.0.0",
"@types/node": "^20.14.8",
"@types/node": "^20.14.10",
"dotenv": "^16.4.5",
"ethers": "^6.13.1",
"hardhat": "^2.22.5",
Expand Down
2 changes: 1 addition & 1 deletion modules/recovery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"devDependencies": {
"@nomicfoundation/hardhat-ethers": "^3.0.6",
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
"@types/node": "^20.14.8",
"@types/node": "^20.14.10",
"@types/yargs": "^17.0.32",
"dotenv": "^16.4.5",
"ethers": "^6.13.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/4337-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"typescript": "^5.5.2"
},
"devDependencies": {
"@types/node": "^20.14.8"
"@types/node": "^20.14.10"
}
}
}
Loading

0 comments on commit 23a3118

Please sign in to comment.