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

Get User Operation Receipt #12

Merged
merged 2 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 4 additions & 3 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
ETH_RPC=https://rpc2.sepolia.org
NEAR_MULTICHAIN_CONTRACT=v2.multichain-mpc.testnet
RECOVERY_ADDRESS=

NEAR_ACCOUNT_ID=
NEAR_ACCOUNT_PRIVATE_KEY=

# Note that these items produce your deterministic Safe Address
NEAR_ACCOUNT_ID=
RECOVERY_ADDRESS=
SAFE_SALT_NONCE=0

# Head to https://www.pimlico.io/ for an API key
ERC4337_BUNDLER_URL=
12 changes: 9 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,15 @@ async function main() {
await contracts.entryPoint.getAddress(),
);
console.log("UserOp Hash", userOpHash);
// TODO(bh2smith) this is returning null because we are requesting it too soon!
// Maybe better to `eth_getUserOperationByHash` (although this also returns null).
const userOpReceipt = await getUserOpReceipt(userOpHash);

// TODO(bh2smith): use safe4337Pack
// https://docs.safe.global/sdk/relay-kit/guides/4337-safe-sdk#check-the-transaction-status
let userOpReceipt = null;
while (!userOpReceipt) {
// Wait 2 seconds before checking the status again
await new Promise((resolve) => setTimeout(resolve, 2000));
userOpReceipt = await getUserOpReceipt(userOpHash);
}
console.log("userOp Receipt", userOpReceipt);
}

Expand Down