Skip to content

Commit

Permalink
feat: add new features of v1 to v2 (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xSulpiride authored Jun 6, 2024
1 parent 5e22d97 commit 714548c
Show file tree
Hide file tree
Showing 94 changed files with 4,099 additions and 1,752 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM --platform=${BUILDPLATFORM:-amd64} node:18-alpine as build_src
WORKDIR /usr/app
RUN apk update && apk add --no-cache g++ make python3 && rm -rf /var/cache/apk/*
RUN apk update && apk add --no-cache g++ make python3 git py3-setuptools && rm -rf /var/cache/apk/*

COPY . .

Expand All @@ -10,7 +10,7 @@ RUN yarn install --non-interactive --frozen-lockfile && \

FROM node:18-alpine as build_deps
WORKDIR /usr/app
RUN apk update && apk add --no-cache g++ make python3 && rm -rf /var/cache/apk/*
RUN apk update && apk add --no-cache g++ make python3 git py3-setuptools && rm -rf /var/cache/apk/*

COPY --from=build_src /usr/app .

Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
## Important links

**[Install Skandha](https://etherspot.fyi/skandha/installation)**
| [Chains supported](https://etherspot.fyi/skandha/chains)
| [Chains supported](https://etherspot.fyi/prime-sdk/chains-supported)
| [UserOp Fee history](https://etherspot.fyi/skandha/feehistory)

## ⚙️ How to run (from Source code)
Expand Down Expand Up @@ -72,8 +72,9 @@ Or follow the steps below:
"entryPoints": [
"0x0000000071727De22E5E9d8BAf0edAc6f37da032"
],
"relayer": "0x{RELAYER-PRIVATE-KEY}",
"beneficiary": "0x{BENEFICIARY-ADDRESS}",
"relayers": [
"0x{RELAYER-PRIVATE-KEY}"
],
"rpcEndpoint": "https://polygon-mumbai.blockpi.network/v1/rpc/public"
}
```
Expand Down Expand Up @@ -115,7 +116,7 @@ Or follow the steps below:
"account": []
},
"bundleGasLimitMarkup": 25000, # optional, adds some amount of additional gas to a bundle tx
"relayingMode": "classic"; # optional, allows to switch to Flashbots Builder api if set to "flashbots", see packages/executor/src/interfaces.ts for more
"relayingMode": "classic"; # optional, "flashbots" for Flashbots Builder API, "merkle" for Merkle.io
"bundleInterval": 10000, # bundle creation interval
"bundleSize": 4, # optional, max size of a bundle, 4 userops by default
"pvgMarkup": 0 # optional, adds some gas on top of estimated PVG
Expand Down
184 changes: 184 additions & 0 deletions docs/skandha_subscribe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
## skandha_subscribe

Creates a new subscription for desired events. Sends data as soon as it occurs.

### Event Types

- pendingUserOps - user ops validated and put in the mempool
- submittedUserOps - user ops that are submitted on chain, reverted or deleted from mempool
- onChainUserOps - user ops successfully submitted on chain

### Examples:

### Pending UserOps

```json
{
"method": "skandha_subscribe",
"params": [
"pendingUserOps"
],
"id": 1,
"jsonrpc": "2.0"
}
```

#### Response

```json
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x106eb9867751ff1bf61bad4a80b8b486"
}
```


#### Event

```json
{
"jsonrpc": "2.0",
"method": "skandha_subscription",
"params": {
"subscription": "0x106eb9867751ff1bf61bad4a80b8b486",
"result": {
"userOp": {
"sender": "0xb582979C2136189475326c648732F76677B16B98",
"nonce": "0x5",
"initCode": "0x",
"callData": "0x47e1da2a000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000009fd4f6088f2025427ab1e89257a44747081ed590000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000009184e72a000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000",
"callGasLimit": "0xb957",
"verificationGasLimit": "0x9b32",
"maxFeePerGas": "0x171ab3b64",
"maxPriorityFeePerGas": "0x59682f00",
"paymasterAndData": "0x",
"preVerificationGas": "0xae70",
"signature": "0x260dfe374ec4d662fae1ac99384abc50b0490d9a087877580f585e739be368e424576440db1d2fa8950b32207d023126a48749f86c35192d872b04eed22c4f2d1b"
},
"userOpHash": "0xf8a549671473d0ee532ca235b4629b239823b426b9a898d20c58ca5212a64c9e",
"entryPoint": "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
"prefund": "0x2e7a15ccb8c44",
"submittedTime": "0x18f2990121c",
"status": "pending"
}
}
}
```

---

### Submitted, Reverted, Cancelled User Ops

```json
{
"method": "skandha_subscribe",
"params": [
"submittedUserOps"
],
"id": 1,
"jsonrpc": "2.0"
}
```

#### Event

```json
{
"jsonrpc": "2.0",
"method": "skandha_subscription",
"params": {
"subscription": "0x80e0632d2300aa2e1bcdb1e84329963f",
"result": {
"userOp": {
"sender": "0xb582979C2136189475326c648732F76677B16B98",
"nonce": "0x5",
"initCode": "0x",
"callData": "0x47e1da2a000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000009fd4f6088f2025427ab1e89257a44747081ed590000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000009184e72a000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000",
"callGasLimit": "0xb957",
"verificationGasLimit": "0x9b32",
"maxFeePerGas": "0x171ab3b64",
"maxPriorityFeePerGas": "0x59682f00",
"paymasterAndData": "0x",
"preVerificationGas": "0xae70",
"signature": "0x260dfe374ec4d662fae1ac99384abc50b0490d9a087877580f585e739be368e424576440db1d2fa8950b32207d023126a48749f86c35192d872b04eed22c4f2d1b"
},
"userOpHash": "0xf8a549671473d0ee532ca235b4629b239823b426b9a898d20c58ca5212a64c9e",
"entryPoint": "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
"transaction": "0x3612daa69ec6d4804065e107e9055c9ec25c9c801d199886524e884e98179656",
"status": "Submitted"
}
}
}
```

### Onchain UserOps

#### Request

```json
{
"method": "skandha_subscribe",
"params": [
"onChainUserOps"
],
"id": 1,
"jsonrpc": "2.0"
}
```

#### Event

```json
{
"jsonrpc": "2.0",
"method": "skandha_subscription",
"params": {
"subscription": "0x2e8cf00cbe014abca180c1b6eae51173",
"result": {
"userOp": {
"sender": "0xb582979C2136189475326c648732F76677B16B98",
"nonce": "0x6",
"initCode": "0x",
"callData": "0x47e1da2a000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000009fd4f6088f2025427ab1e89257a44747081ed590000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000009184e72a000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000",
"callGasLimit": "0xb957",
"verificationGasLimit": "0x9b32",
"maxFeePerGas": "0x1420c636e",
"maxPriorityFeePerGas": "0x59682f00",
"paymasterAndData": "0x",
"preVerificationGas": "0xae70",
"signature": "0xbe055319adb23a465cf7439b7d4c2ab6e86383a100459c9c34942bd9a7fd016273a159b9239fca414633b6163353faa648dc3a41857075cde2cdd1813eb92fbc1c"
},
"userOpHash": "0xefafb37d346ccfaf183f0474015aacefe178707e78d56d95e19de8950c033393",
"entryPoint": "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
"transaction": "0x8adba5c0463bd2cce16585871190972f49f00ead733b7005f43bf62c93296233",
"status": "onChain"
}
}
}
```

### Unsubscribe

#### Request

```json
{
"method": "skandha_unsubscribe",
"params": [
"0xcf47424b5f492abfaa97ca5d4aed1f1d"
],
"id": 1,
"jsonrpc": "2.0"
}
```

#### Response

```json
{
"jsonrpc": "2.0",
"id": 1,
"result": "ok"
}
```
107 changes: 107 additions & 0 deletions docs/skandha_userOperationStatus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
## skandha_userOperationStatus

Returns the status of a userop by its hash

### Example

#### Request

```json
{
"id": 3,
"method": "skandha_userOperationStatus",
"params": [
"0x63e222d108878e7f7440036bce49aeb83007708f067ec8d01153961e97fe1c53"
],
"jsonrpc": "2.0"
}
```


#### Response

```json
{
"jsonrpc": "2.0",
"method": "skandha_subscription",
"params": {
"subscription": "0x6f2342e1637fc8ad51426fcee800e0f9",
"result": {
"userOp": {
"sender": "0x310788f30062415E1c6f154dB377bf3F39200178",
"nonce": "0x2",
"callData": "0xb61d27f6000000000000000000000000260e35d7dcddaa7b558d0ff322f5ddd1109f5dab00000000000000000000000000000000000000000000000000000000000186a000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000",
"callGasLimit": "0xff339",
"verificationGasLimit": "0x9bc9",
"preVerificationGas": "0xa384",
"maxFeePerGas": "0x28030e335c",
"maxPriorityFeePerGas": "0x1dcd6500",
"signature": "0x364e6ff383f1276f08badae090bafc1b06de94695fb2dbbf8d81c930ea5f35dd688d85ab7695190c882c8981069804b6236daff55e256bef64e2ceaabf4a56441c"
},
"userOpHash": "0x3e52209fe0323d5d70039327ccf558fad91893b42235045d1707a63b7eebcfad",
"entryPoint": "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
"prefund": "0x2b0197bc892da28",
"submittedTime": "0x18fe7d72dfc",
"status": "pending"
}
}
}
```

#### Response (after some time)

```json
{
"jsonrpc": "2.0",
"method": "skandha_subscription",
"params": {
"subscription": "0x2d8a9d5599e0704aad0a024cf1f284ed",
"result": {
"userOp": {
"sender": "0x310788f30062415E1c6f154dB377bf3F39200178",
"nonce": "0x2",
"callData": "0xb61d27f6000000000000000000000000260e35d7dcddaa7b558d0ff322f5ddd1109f5dab00000000000000000000000000000000000000000000000000000000000186a000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000",
"callGasLimit": "0xff339",
"verificationGasLimit": "0x9bc9",
"preVerificationGas": "0xa384",
"maxFeePerGas": "0x28030e335c",
"maxPriorityFeePerGas": "0x1dcd6500",
"signature": "0x364e6ff383f1276f08badae090bafc1b06de94695fb2dbbf8d81c930ea5f35dd688d85ab7695190c882c8981069804b6236daff55e256bef64e2ceaabf4a56441c"
},
"userOpHash": "0x3e52209fe0323d5d70039327ccf558fad91893b42235045d1707a63b7eebcfad",
"entryPoint": "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
"transaction": "0xf27d85b4e29a33a66eb91d692938cb94a2c35bd1db736e659afa660ad6d40997",
"status": "Submitted"
}
}
}
```

#### Response (after appearing on chain)

```json
{
"jsonrpc": "2.0",
"method": "skandha_subscription",
"params": {
"subscription": "0xcf69f6e84a1568824afedf7a61c49fe1",
"result": {
"userOp": {
"sender": "0x310788f30062415E1c6f154dB377bf3F39200178",
"nonce": "0x2",
"callData": "0xb61d27f6000000000000000000000000260e35d7dcddaa7b558d0ff322f5ddd1109f5dab00000000000000000000000000000000000000000000000000000000000186a000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000",
"callGasLimit": "0xff339",
"verificationGasLimit": "0x9bc9",
"preVerificationGas": "0xa384",
"maxFeePerGas": "0x28030e335c",
"maxPriorityFeePerGas": "0x1dcd6500",
"signature": "0x364e6ff383f1276f08badae090bafc1b06de94695fb2dbbf8d81c930ea5f35dd688d85ab7695190c882c8981069804b6236daff55e256bef64e2ceaabf4a56441c"
},
"userOpHash": "0x3e52209fe0323d5d70039327ccf558fad91893b42235045d1707a63b7eebcfad",
"entryPoint": "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
"transaction": "0xf27d85b4e29a33a66eb91d692938cb94a2c35bd1db736e659afa660ad6d40997",
"status": "onChain"
}
}
}
```
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"packages/*"
],
"npmClient": "yarn",
"version": "2.0.1",
"version": "2.0.2",
"stream": "true",
"command": {
"version": {
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "root",
"private": true,
"version": "2.0.1",
"version": "2.0.2",
"engines": {
"node": ">=18.0.0"
},
Expand Down Expand Up @@ -33,8 +33,8 @@
"@types/abstract-leveldown": "7.2.1",
"@types/compression": "1.7.2",
"@types/node": "18.11.9",
"@typescript-eslint/eslint-plugin": "5.43.0",
"@typescript-eslint/parser": "5.43.0",
"@typescript-eslint/parser": "6.21.0",
"@typescript-eslint/eslint-plugin": "6.21.0",
"eslint": "8.27.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-plugin-import": "2.26.0",
Expand All @@ -43,7 +43,7 @@
"lerna": "7.3.0",
"ts-node": "10.9.1",
"tsconfig-paths": "4.1.2",
"typescript": "4.8.4",
"typescript": "5.4.5",
"chai": "4.3.8",
"chai-as-promised": "7.1.1",
"sinon": "16.0.0",
Expand Down
Loading

0 comments on commit 714548c

Please sign in to comment.