This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
More cleanup for account-integrations/safe #87
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,6 @@ | |
"eslint-plugin-import": "^2.28.1", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"ethers": "^6.4.0", | ||
"ethers-v5": "npm:[email protected]", | ||
"hardhat": "^2.17.1", | ||
"hardhat-gas-reporter": "^1.0.8", | ||
"hardhat-preprocessor": "^0.1.5", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ethers } from "ethers"; | ||
|
||
export default async function receiptOf( | ||
txResponseOrPromise: | ||
| ethers.TransactionResponse | ||
| Promise<ethers.TransactionResponse>, | ||
) { | ||
const txResponse = await txResponseOrPromise; | ||
return await txResponse.wait(); | ||
} |
36 changes: 36 additions & 0 deletions
36
account-integrations/safe/test/hardhat/utils/sendUserOpAndWait.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { UserOperationStruct } from "@account-abstraction/contracts"; | ||
import { ethers } from "ethers"; | ||
import sleep from "./sleep"; | ||
|
||
export default async function sendUserOpAndWait( | ||
userOp: UserOperationStruct, | ||
entryPoint: string, | ||
bundlerProvider: ethers.JsonRpcProvider, | ||
pollingDelay = 100, | ||
maxAttempts = 200, | ||
) { | ||
const userOpHash = (await bundlerProvider.send("eth_sendUserOperation", [ | ||
userOp, | ||
entryPoint, | ||
])) as string; | ||
|
||
let receipt: { success: boolean } | null = null; | ||
|
||
let attempts = 0; | ||
|
||
while (attempts < maxAttempts && receipt === null) { | ||
await sleep(pollingDelay); | ||
|
||
receipt = (await bundlerProvider.send("eth_getUserOperationReceipt", [ | ||
userOpHash, | ||
])) as { success: boolean } | null; | ||
|
||
attempts++; | ||
} | ||
|
||
if (receipt === null) { | ||
throw new Error(`Could not get receipt after ${maxAttempts} attempts`); | ||
} | ||
|
||
return receipt; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2627,7 +2627,22 @@ ethereumjs-util@^7.1.0, ethereumjs-util@^7.1.4: | |
ethereum-cryptography "^0.1.3" | ||
rlp "^2.2.4" | ||
|
||
"ethers-v5@npm:[email protected]", ethers@^5.5.3, ethers@^5.7.0, ethers@^5.7.1: | ||
ethers@^4.0.40: | ||
version "4.0.49" | ||
resolved "https://registry.yarnpkg.com/ethers/-/ethers-4.0.49.tgz#0eb0e9161a0c8b4761be547396bbe2fb121a8894" | ||
integrity sha512-kPltTvWiyu+OktYy1IStSO16i2e7cS9D9OxZ81q2UUaiNPVrm/RTcbxamCXF9VUSKzJIdJV68EAIhTEVBalRWg== | ||
dependencies: | ||
aes-js "3.0.0" | ||
bn.js "^4.11.9" | ||
elliptic "6.5.4" | ||
hash.js "1.1.3" | ||
js-sha3 "0.5.7" | ||
scrypt-js "2.0.4" | ||
setimmediate "1.0.4" | ||
uuid "2.0.1" | ||
xmlhttprequest "1.8.0" | ||
|
||
ethers@^5.5.3, ethers@^5.7.0, ethers@^5.7.1: | ||
version "5.7.2" | ||
resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" | ||
integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== | ||
|
@@ -2663,21 +2678,6 @@ ethereumjs-util@^7.1.0, ethereumjs-util@^7.1.4: | |
"@ethersproject/web" "5.7.1" | ||
"@ethersproject/wordlists" "5.7.0" | ||
|
||
ethers@^4.0.40: | ||
version "4.0.49" | ||
resolved "https://registry.yarnpkg.com/ethers/-/ethers-4.0.49.tgz#0eb0e9161a0c8b4761be547396bbe2fb121a8894" | ||
integrity sha512-kPltTvWiyu+OktYy1IStSO16i2e7cS9D9OxZ81q2UUaiNPVrm/RTcbxamCXF9VUSKzJIdJV68EAIhTEVBalRWg== | ||
dependencies: | ||
aes-js "3.0.0" | ||
bn.js "^4.11.9" | ||
elliptic "6.5.4" | ||
hash.js "1.1.3" | ||
js-sha3 "0.5.7" | ||
scrypt-js "2.0.4" | ||
setimmediate "1.0.4" | ||
uuid "2.0.1" | ||
xmlhttprequest "1.8.0" | ||
|
||
ethers@^6.4.0: | ||
version "6.6.7" | ||
resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.6.7.tgz#9cf773bcbc0ca56d783d4774e9b73b4d1aff9962" | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I originally copied over these tests and converted them to use ethers v6, I ran into an issue where the bundlerProvider would not work if it wasn't connected to an ethers v5 provider. Hence I added this alias. Did you run into this issue at all? It looks like you just started using ethers v6 for the bundlerProvider with no issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh interesting. Yeah I didn't run into any trouble, wonder what happened.