Skip to content

Commit

Permalink
update to include all tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
kristofgazso committed Jul 12, 2023
1 parent 19d4107 commit 61377ef
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PIMLICO_API_KEY=
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
.env
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# Pimlico Tutorial 1
# Pimlico Tutorials

This repository contains the full code for [tutorial 1](https://docs.pimlico.io/tutorial/tutorial-1) in the Pimlico documentation.
This repository contains the full code for [Pimlico tutorials](https://docs.pimlico.io/tutorial) in the Pimlico documentation.

To set up the repository, clone it, replace the `pimlicoApiKey` variable in `index.ts` with your Pimlico API key (use the [quick start guide](https://docs.pimlico.io/how-to/quick-start) to generate one), install the dependencies, and run `npm start`!
To set up the repository, clone it, copy the .env.example file to .env and fill in your Pimlico API key (use the [quick start guide](https://docs.pimlico.io/how-to/quick-start) to generate one), install the dependencies, and run `npm tutorial-1` (or whichever tutorial you're looking to run)!

```bash
npm install
npm start
cp .env.example .env
# fill in your Pimlico API key in .env
npm tutorial-1
```

If everything works correctly, you should deploy a User Operation as per the flow of Tutorial 1.
If everything works correctly, you should deploy a User Operation as per the flow of the tutorial.

Good luck!
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "pimlico-tutorial-1",
"name": "pimlico-tutorials",
"version": "1.0.0",
"description": "A repository containing the full code for tutorial 1 of the Pimlico documentation (https://docs.pimlico.io/tutorial/tutorial-1)",
"description": "A repository containing the full code for the Pimlico tutorials (https://docs.pimlico.io/tutorial)",
"main": "index.ts",
"type": "module",
"scripts": {
"start": "ts-node-esm index.ts"
"tutorial-1": "ts-node-esm tutorial-1.ts"
},
"author": "",
"license": "MIT",
Expand All @@ -16,4 +16,4 @@
"ts-node": "^10.9.1",
"typescript": "^5.1.6"
}
}
}
4 changes: 1 addition & 3 deletions index.ts → tutorial-1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import { BigNumber, Wallet, constants, utils } from "ethers"
import { ERC20, ERC20__factory } from "@pimlico/erc20-paymaster/contracts"
import { getERC20Paymaster } from "@pimlico/erc20-paymaster"

const apiKey = "YOUR_PIMLICO_API_KEY" // REPLACE THIS
// You can get an API key by signing up at https://dashboard.pimlico.io

// GENERATE THE INITCODE
const SIMPLE_ACCOUNT_FACTORY_ADDRESS = "0x9406Cc6185a346906296840746125a0E44976454"
const lineaProvider = new StaticJsonRpcProvider("https://rpc.goerli.linea.build/")
Expand Down Expand Up @@ -86,6 +83,7 @@ const userOperation = {

// REQUEST PIMLICO VERIFYING PAYMASTER SPONSORSHIP
const chain = "linea-testnet" // find the list of chain names on the Pimlico verifying paymaster reference page
const apiKey = process.env.PIMLICO_API_KEY // REPLACE THIS

const pimlicoEndpoint = `https://api.pimlico.io/v1/${chain}/rpc?apikey=${apiKey}`

Expand Down

0 comments on commit 61377ef

Please sign in to comment.