Skip to content

Commit

Permalink
test: add paymaster mock config (#859)
Browse files Browse the repository at this point in the history
  • Loading branch information
moldy530 committed Aug 28, 2024
1 parent 0fe811b commit 633e3ab
Show file tree
Hide file tree
Showing 7 changed files with 746 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .vitest/globalSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ export default async function () {
}

const shutdown = await Promise.all(
Object.values(instances).map((instance) => instance.start())
Object.values(instances).map(async (instance) => {
const shutdown = instance.start();

return shutdown;
})
);

return async () => {
Expand Down
9 changes: 5 additions & 4 deletions .vitest/setupTests.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import dotenv from "dotenv";
import fetch from "node-fetch";
import { setIntervalMining } from "viem/actions";
import { setAutomine } from "viem/actions";
import { afterAll, beforeAll } from "vitest";
import * as instances from "./src/instances.js";

const client = instances.anvilArbSepolia.getClient();
import { deployPaymasterContract } from "./src/paymaster.js";

dotenv.config();

// @ts-expect-error this does exist but ts is not liking it
global.fetch = fetch;

beforeAll(async () => {
await setIntervalMining(client, { interval: 0 });
const client = instances.anvilArbSepolia.getClient();
await setAutomine(client, true);
await deployPaymasterContract(client);
}, 60_000);

afterAll(async () => {});
70 changes: 70 additions & 0 deletions .vitest/src/Proxy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
export const ERC1967ProxyAbi = {
abi: [
{
type: "constructor",
inputs: [
{ name: "_logic", type: "address", internalType: "address" },
{ name: "_data", type: "bytes", internalType: "bytes" },
],
stateMutability: "payable",
},
{ type: "fallback", stateMutability: "payable" },
{ type: "receive", stateMutability: "payable" },
{
type: "event",
name: "AdminChanged",
inputs: [
{
name: "previousAdmin",
type: "address",
indexed: false,
internalType: "address",
},
{
name: "newAdmin",
type: "address",
indexed: false,
internalType: "address",
},
],
anonymous: false,
},
{
type: "event",
name: "BeaconUpgraded",
inputs: [
{
name: "beacon",
type: "address",
indexed: true,
internalType: "address",
},
],
anonymous: false,
},
{
type: "event",
name: "Upgraded",
inputs: [
{
name: "implementation",
type: "address",
indexed: true,
internalType: "address",
},
],
anonymous: false,
},
],
bytecode: {
object:
"0x60406080815261042c908138038061001681610218565b93843982019181818403126102135780516001600160a01b038116808203610213576020838101516001600160401b0394919391858211610213570186601f820112156102135780519061007161006c83610253565b610218565b918083528583019886828401011161021357888661008f930161026e565b813b156101b9577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b031916841790556000927fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8480a28051158015906101b2575b61010b575b855160e790816103458239f35b855194606086019081118682101761019e578697849283926101889952602788527f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c87890152660819985a5b195960ca1b8a8901525190845af4913d15610194573d9061017a61006c83610253565b91825281943d92013e610291565b508038808080806100fe565b5060609250610291565b634e487b7160e01b84526041600452602484fd5b50826100f9565b855162461bcd60e51b815260048101859052602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b600080fd5b6040519190601f01601f191682016001600160401b0381118382101761023d57604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b03811161023d57601f01601f191660200190565b60005b8381106102815750506000910152565b8181015183820152602001610271565b919290156102f357508151156102a5575090565b3b156102ae5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156103065750805190602001fd5b6044604051809262461bcd60e51b825260206004830152610336815180928160248601526020868601910161026e565b601f01601f19168101030190fdfe60806040523615605f5773ffffffffffffffffffffffffffffffffffffffff7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc54166000808092368280378136915af43d82803e15605b573d90f35b3d90fd5b73ffffffffffffffffffffffffffffffffffffffff7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc54166000808092368280378136915af43d82803e15605b573d90f3fea26469706673582212202e7baf1368345efcec935186bf9faf2338cba6a5337e8e5fdf2e25a91695dad464736f6c63430008110033",
linkReferences: {},
},
deployedBytecode: {
object:
"0x60806040523615605f5773ffffffffffffffffffffffffffffffffffffffff7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc54166000808092368280378136915af43d82803e15605b573d90f35b3d90fd5b73ffffffffffffffffffffffffffffffffffffffff7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc54166000808092368280378136915af43d82803e15605b573d90f3fea26469706673582212202e7baf1368345efcec935186bf9faf2338cba6a5337e8e5fdf2e25a91695dad464736f6c63430008110033",
linkReferences: {},
},
methodIdentifiers: {},
} as const;
Loading

0 comments on commit 633e3ab

Please sign in to comment.