Skip to content

Commit

Permalink
feat: add mock onchain paymaster
Browse files Browse the repository at this point in the history
  • Loading branch information
mouseless0x committed Mar 27, 2024
1 parent 660dee9 commit 824ba9b
Show file tree
Hide file tree
Showing 13 changed files with 136 additions and 640 deletions.
3 changes: 0 additions & 3 deletions templates/react/mprocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ procs:
alto-bundler:
cwd: packages/account-abstraction
shell: pnpm run dev:alto
paymaster:
cwd: packages/account-abstraction
shell: pnpm run dev:paymaster
4 changes: 1 addition & 3 deletions templates/react/packages/account-abstraction/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
"scripts": {
"build": "tsc && tsc-alias",
"dev:alto": "wait-port localhost:8545 && pnpm run start:deploy-contracts && pnpm run start:alto",
"dev:paymaster": "wait-port localhost:8545 && pnpm run start:paymaster",
"start:alto": "node ./node_modules/alto/src/lib/cli/alto.js run --config ./alto.config.json",
"start:deploy-contracts": "node dist/deploy-contracts/deployAA.js",
"start:paymaster": "node dist/paymaster/index.js"
"start:deploy-contracts": "node dist/index.js"
},
"dependencies": {
"@fastify/cors": "^9.0.1",
Expand Down
197 changes: 6 additions & 191 deletions templates/react/packages/account-abstraction/src/constants.ts

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { ENTRYPOINT_ADDRESS_V07 } from "permissionless";
import {
ANVIL_WALLET_CLIENT,
DETERMINISTIC_DEPLOYER,
ENTRY_POINT_CREATE_CALL,
ENTRY_POINT_SIMULATIONS_CREATE_CALL,
MOCK_PAYMASTER_ADDRESS,
MOCK_PAYMASTER_CREATE_CALL,
SIMPLE_ACCOUNT_FACTORY_CREATE_CALL,
} from "../constants";
} from "./constants";
import { getContract, parseAbi, parseEther } from "viem";

const walletClient = ANVIL_WALLET_CLIENT();

Expand All @@ -29,4 +33,23 @@ const walletClient = ANVIL_WALLET_CLIENT();
});

console.log("EntryPointSimulations deployed", entryPointSimulationsHash);

const mockPaymasterHash = await walletClient.sendTransaction({
to: DETERMINISTIC_DEPLOYER,
data: MOCK_PAYMASTER_CREATE_CALL(ENTRYPOINT_ADDRESS_V07),
});

console.log("MockPaymaster deployed", mockPaymasterHash);

const mockPaymasterContract = getContract({
address: MOCK_PAYMASTER_ADDRESS,
abi: parseAbi(["function deposit() payable"]),
client: walletClient,
});

const depositHash = await mockPaymasterContract.write.deposit({
value: parseEther("50"),
});

console.log("MockPaymaster deposited", depositHash);
})();

This file was deleted.

171 changes: 0 additions & 171 deletions templates/react/packages/account-abstraction/src/paymaster/index.ts

This file was deleted.

Loading

0 comments on commit 824ba9b

Please sign in to comment.