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

Mock paymaster #53

Merged
merged 3 commits into from
Jul 30, 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
5 changes: 5 additions & 0 deletions .changeset/fifty-bees-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/mock-verifying-paymaster": minor
---

mock-verifying-paymaster
57 changes: 57 additions & 0 deletions .github/workflows/paymaster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: paymaster
on:
workflow_call:
inputs:
release:
type: boolean
required: false
secrets:
NPM_TOKEN:
required: true
TURBO_TOKEN:
required: true
pull_request:
paths:
- .github/workflows/paymaster.yaml
- packages/mock-verifying-paymaster/**
- packages/eslint-config/**
- packages/tsconfig/**
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
- name: Setup Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
cache: "pnpm"

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm build --filter @cartesi/mock-verifying-paymaster

- name: Publish
if: ${{ inputs.release }}
working-directory: ./packages/mock-verifying-paymaster
run: pnpm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
9 changes: 9 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,12 @@ jobs:
secrets: inherit
with:
release: true

build_paymaster:
name: Build paymaster
needs: [release, packages_to_build]
if: ${{ needs.release.outputs.published == 'true' && contains(fromJSON(needs.packages_to_build.outputs.packages), '@cartesi/mock-verifying-paymaster') }}
uses: ./.github/workflows/paymaster.yaml
secrets: inherit
with:
release: true
1 change: 1 addition & 0 deletions packages/mock-verifying-paymaster/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/dist
48 changes: 48 additions & 0 deletions packages/mock-verifying-paymaster/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
services:
anvil:
image: cartesi/sdk:0.9.0
command: ["devnet", "--block-time", "${BLOCK_TIME:-5}"]
healthcheck:
test: ["CMD", "eth_isready"]
interval: 10s
timeout: 1s
retries: 5
environment:
ANVIL_IP_ADDR: 0.0.0.0
ports:
- 8545:8545

alto:
image: cartesi/sdk:0.9.0
command:
[
"alto",
"--entrypoints",
"0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789,0x0000000071727De22E5E9d8BAf0edAc6f37da032",
"--log-level",
"info",
"--entrypoint-simulation-contract",
"0x74Cb5e4eE81b86e70f9045036a1C5477de69eE87",
"--rpc-url",
"http://anvil:8545",
"--min-executor-balance",
"0",
"--utility-private-key",
"0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97",
"--executor-private-keys",
"0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6,0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356,0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e,0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba,0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a",
"--max-block-range",
"10000",
"--safe-mode",
"false",
"--port",
"4337",
"--public-client-log-level",
"error",
"--wallet-client-log-level",
"error",
"--polling-interval",
"100",
"--enable-debug-endpoints",
]
ports: ["4337:4337"]
31 changes: 31 additions & 0 deletions packages/mock-verifying-paymaster/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "@cartesi/mock-verifying-paymaster",
"version": "0.0.0",
"bin": {
"mock-paymaster": "./dist/index.js"
},
"files": [
"dist"
],
"scripts": {
"build": "tsup",
"start": "ts-node src/index.ts"
},
"dependencies": {
"@fastify/cors": "^9.0.1",
"fastify": "^4.26.2",
"permissionless": "^0.1.43",
"tslib": "^2.6.2",
"viem": "2.18.4",
"zod": "^3.22.4",
"zod-validation-error": "^3.0.3"
},
"devDependencies": {
"@types/node": "^22.0.0",
"tsconfig": "workspace:*",
"ts-node": "^10.9.2",
"tsup": "^8.2.3",
"typescript": "5.5.4",
"wait-port": "^1.0.4"
}
}
Loading
Loading