Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/zerodevapp/sdk into feat/fa…
Browse files Browse the repository at this point in the history
…llback-provider
  • Loading branch information
adnpark committed Apr 25, 2024
2 parents 60ec087 + d267467 commit 06a920e
Show file tree
Hide file tree
Showing 48 changed files with 304 additions and 312 deletions.
2 changes: 1 addition & 1 deletion .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ runs:

- name: Install dependencies
shell: bash
run: bun install --ignore-scripts
run: bun install --ignore-scripts --frozen-lockfile
3 changes: 2 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
},
"style": {
"noUnusedTemplateLiteral": "warn",
"noUselessElse": "off"
"noUselessElse": "off",
"useNodejsImportProtocol": "off"
}
}
},
Expand Down
Binary file modified bun.lockb
Binary file not shown.
74 changes: 35 additions & 39 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,37 @@
{
"workspaces": [
"packages/*",
"templates/*",
"plugins/*"
],
"private": true,
"author": "ZeroDev",
"type": "module",
"sideEffects": false,
"devDependencies": {
"@ambire/signature-validator": "^1.3.1",
"@biomejs/biome": "^1.0.0",
"@changesets/changelog-git": "^0.1.14",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2",
"@size-limit/esbuild-why": "^9.0.0",
"@size-limit/preset-small-lib": "^9.0.0",
"ethers": "5",
"rimraf": "^5.0.1",
"simple-git-hooks": "^2.9.0",
"size-limit": "^9.0.0",
"tslib": "^2.6.2",
"typescript": "^5.2.2"
},
"description": "",
"keywords": [],
"license": "MIT",
"scripts": {
"build": "bash build-all.sh",
"format": "biome format . --write",
"lint": "biome check .",
"lint:fix": "bun run lint --apply",
"changeset": "changeset",
"changeset:release": "bun run build && changeset publish",
"changeset:version": "changeset version && bun install --lockfile-only"
},
"simple-git-hooks": {
"pre-commit": "bun run format && bun run lint:fix"
}
"workspaces": ["packages/*", "templates/*", "plugins/*"],
"private": true,
"author": "ZeroDev",
"type": "module",
"sideEffects": false,
"devDependencies": {
"@ambire/signature-validator": "^1.3.1",
"@biomejs/biome": "^1.0.0",
"@changesets/changelog-git": "^0.1.14",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2",
"@size-limit/esbuild-why": "^9.0.0",
"@size-limit/preset-small-lib": "^9.0.0",
"ethers": "5",
"rimraf": "^5.0.1",
"simple-git-hooks": "^2.9.0",
"size-limit": "^9.0.0",
"tslib": "^2.6.2",
"typescript": "~5.3.0"
},
"description": "",
"keywords": [],
"license": "MIT",
"scripts": {
"build": "bash build-all.sh",
"format": "biome format . --write",
"lint": "biome check .",
"lint:fix": "bun run lint --apply",
"changeset": "changeset",
"changeset:release": "bun run build && changeset publish",
"changeset:version": "changeset version && bun install --lockfile-only"
},
"simple-git-hooks": {
"pre-commit": "bun run format && bun run lint:fix"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toSmartAccount } from "permissionless/accounts"
import type { toSmartAccount } from "permissionless/accounts"
import { encodeDeployData } from "viem"
import { safeCreateCallAddress } from "../../../../../constants.js"
import { encodeSafeCreateCall } from "../../common/encodeSafeCreateCall.js"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toSmartAccount } from "permissionless/accounts"
import type { toSmartAccount } from "permissionless/accounts"
import { encodeDeployData } from "viem"
import { EXEC_TYPE, safeCreateCallAddress } from "../../../../../constants.js"
import { encodeSafeCreateCall } from "../../common/encodeSafeCreateCall.js"
Expand Down
4 changes: 2 additions & 2 deletions packages/core/accounts/kernel/v1/createKernelV1Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ import {
} from "viem"
import { toAccount } from "viem/accounts"
import { getChainId, signMessage, signTypedData } from "viem/actions"
import { type KernelEncodeCallDataArgs } from "../../../types/kernel.js"
import type { KernelEncodeCallDataArgs } from "../../../types/kernel.js"
import { wrapSignatureWith6492 } from "../../utils/6492.js"
import { parseFactoryAddressAndCallDataFromAccountInitCode } from "../../utils/index.js"
import {
MULTISEND_ADDRESS,
encodeMultiSend,
multiSendAbi
} from "../../utils/multisend.js"
import { type KernelSmartAccount } from "../createKernelAccount.js"
import type { KernelSmartAccount } from "../createKernelAccount.js"

export type KernelV1SmartAccount<
entryPoint extends EntryPoint,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/accounts/kernel/v2/createKernelV2Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import {
isKernelPluginManager,
toKernelPluginManager
} from "../../utils/toKernelPluginManager.js"
import { type KernelSmartAccount } from "../createKernelAccount.js"
import type { KernelSmartAccount } from "../createKernelAccount.js"
import { KernelAccountV2Abi } from "./abi/KernelAccountV2Abi.js"
import { KernelFactoryV2Abi } from "./abi/KernelFactoryV2Abi.js"

Expand Down
5 changes: 1 addition & 4 deletions packages/core/accounts/utils/multisend.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { type Address, type Hex, encodePacked, toBytes } from "viem"
import {
type CallType,
type KernelEncodeCallDataArgs
} from "../../types/index.js"
import type { CallType, KernelEncodeCallDataArgs } from "../../types/index.js"

export const MULTISEND_ADDRESS = "0x8ae01fcf7c655655ff2c6ef907b8b4718ab4e17c"

Expand Down
4 changes: 2 additions & 2 deletions packages/core/clients/decorators/kernel.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { type SmartAccountActions, smartAccountActions } from "permissionless"
import { type Middleware } from "permissionless/actions/smartAccount"
import type { Middleware } from "permissionless/actions/smartAccount"
import type { EntryPoint, Prettify } from "permissionless/types"
import type { Chain, Client, Transport } from "viem"
import { type KernelSmartAccount } from "../../accounts/index.js"
import type { KernelSmartAccount } from "../../accounts/index.js"
import {
type GetUserOperationGasPriceReturnType,
getUserOperationGasPrice
Expand Down
2 changes: 1 addition & 1 deletion packages/core/clients/kernelAccountClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
type Transport,
createClient
} from "viem"
import { type KernelSmartAccount } from "../accounts/index.js"
import type { KernelSmartAccount } from "../accounts/index.js"
import { getUserOperationGasPrice } from "../actions/account-client/getUserOperationGasPrice.js"
import {
type KernelAccountClientActions,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { EntryPointVersion } from "permissionless/types/entrypoint"
import { type Address, type Hex } from "viem"
import type { Address, Hex } from "viem"

export const DUMMY_ECDSA_SIG =
"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"
Expand Down
8 changes: 1 addition & 7 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@
"type": "module",
"sideEffects": false,
"description": "A utility library for working with ERC-4337",
"keywords": [
"ethereum",
"erc-4337",
"eip-4337",
"paymaster",
"bundler"
],
"keywords": ["ethereum", "erc-4337", "eip-4337", "paymaster", "bundler"],
"license": "MIT",
"files": [
"_esm",
Expand Down
12 changes: 6 additions & 6 deletions packages/core/providers/KernelEIP1193Provider.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { EventEmitter } from "events"
import { type KernelAccountClient } from "@zerodev/sdk"
import type { KernelAccountClient } from "@zerodev/sdk"
import type { EntryPoint } from "permissionless/types"
import {
type EIP1193Parameters,
type EIP1193RequestFn,
type Hash,
type SendTransactionParameters
import type {
EIP1193Parameters,
EIP1193RequestFn,
Hash,
SendTransactionParameters
} from "viem"

export class KernelEIP1193Provider<
Expand Down
4 changes: 2 additions & 2 deletions packages/core/types/kernel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import type {
UserOperation,
UserOperationWithBigIntAsHex
} from "permissionless/types/userOperation"
import { type Address, type Hex, type LocalAccount } from "viem"
import type { Address, Hex, LocalAccount } from "viem"
import type { PartialBy } from "viem/types/utils"
import { VALIDATOR_TYPE } from "../constants.js"
import type { VALIDATOR_TYPE } from "../constants.js"
export type ZeroDevPaymasterRpcSchema<entryPoint extends EntryPoint> = [
{
Method: "zd_sponsorUserOperation"
Expand Down
4 changes: 2 additions & 2 deletions packages/core/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
} from "viem"
import type { ZeroDevPaymasterClient } from "./clients/paymasterClient.js"
import {
CALL_TYPE,
EXEC_TYPE,
type CALL_TYPE,
type EXEC_TYPE,
KernelImplToVersionMap,
LATEST_KERNEL_VERSION
} from "./constants.js"
Expand Down
108 changes: 54 additions & 54 deletions packages/presets/package.json
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
{
"name": "@zerodev/presets",
"version": "5.2.2",
"author": "ZeroDev",
"main": "./_cjs/index.js",
"module": "./_esm/index.js",
"types": "./_types/index.d.ts",
"typings": "./_types/index.d.ts",
"type": "module",
"devDependencies": {
"bun-types": "latest"
},
"exports": {
".": {
"types": "./_types/zerodev/index.d.ts",
"import": "./_esm/zerodev/index.js",
"default": "./_cjs/zerodev/index.js"
"name": "@zerodev/presets",
"version": "5.2.2",
"author": "ZeroDev",
"main": "./_cjs/index.js",
"module": "./_esm/index.js",
"types": "./_types/index.d.ts",
"typings": "./_types/index.d.ts",
"type": "module",
"devDependencies": {
"bun-types": "latest"
},
"./zerodev": {
"types": "./_types/zerodev/index.d.ts",
"import": "./_esm/zerodev/index.js",
"default": "./_cjs/zerodev/index.js"
"exports": {
".": {
"types": "./_types/zerodev/index.d.ts",
"import": "./_esm/zerodev/index.js",
"default": "./_cjs/zerodev/index.js"
},
"./zerodev": {
"types": "./_types/zerodev/index.d.ts",
"import": "./_esm/zerodev/index.js",
"default": "./_cjs/zerodev/index.js"
}
},
"license": "MIT",
"files": [
"_esm",
"_cjs",
"_types",
"./**/*.ts",
"!_esm/**/*.tsbuildinfo",
"!_cjs/**/*.tsbuildinfo",
"!_types/**/*.tsbuildinfo",
"!.env",
"!./**/*.test.ts",
"!.changeset"
],
"scripts": {
"build": "bun run clean && bun run build:cjs && bun run build:esm && bun run build:types",
"build:cjs": "tsc --project ./tsconfig.build.json --module commonjs --outDir ./_cjs --removeComments --verbatimModuleSyntax false && printf '{\"type\":\"commonjs\"}' > ./_cjs/package.json",
"build:esm": "tsc --project ./tsconfig.build.json --module es2015 --outDir ./_esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./_esm/package.json",
"build:types": "tsc --project ./tsconfig.build.json --module esnext --declarationDir ./_types --emitDeclarationOnly --declaration --declarationMap",
"clean": "rimraf _esm _cjs _types",
"changeset": "changeset",
"changeset:release": "bun run build && changeset publish",
"changeset:version": "changeset version && bun install --lockfile-only",
"format": "biome format . --write",
"lint": "biome check .",
"lint:fix": "bun run lint --apply"
},
"peerDependencies": {
"typescript": "~5.3.0",
"@zerodev/sdk": "^5.2.1",
"@zerodev/ecdsa-validator": "^5.2.1",
"permissionless": "^0.1.18",
"viem": "^2.9.17"
}
},
"license": "MIT",
"files": [
"_esm",
"_cjs",
"_types",
"./**/*.ts",
"!_esm/**/*.tsbuildinfo",
"!_cjs/**/*.tsbuildinfo",
"!_types/**/*.tsbuildinfo",
"!.env",
"!./**/*.test.ts",
"!.changeset"
],
"scripts": {
"build": "bun run clean && bun run build:cjs && bun run build:esm && bun run build:types",
"build:cjs": "tsc --project ./tsconfig.build.json --module commonjs --outDir ./_cjs --removeComments --verbatimModuleSyntax false && printf '{\"type\":\"commonjs\"}' > ./_cjs/package.json",
"build:esm": "tsc --project ./tsconfig.build.json --module es2015 --outDir ./_esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./_esm/package.json",
"build:types": "tsc --project ./tsconfig.build.json --module esnext --declarationDir ./_types --emitDeclarationOnly --declaration --declarationMap",
"clean": "rimraf _esm _cjs _types",
"changeset": "changeset",
"changeset:release": "bun run build && changeset publish",
"changeset:version": "changeset version && bun install --lockfile-only",
"format": "biome format . --write",
"lint": "biome check .",
"lint:fix": "bun run lint --apply"
},
"peerDependencies": {
"typescript": "^5.0.0",
"@zerodev/sdk": "^5.2.1",
"@zerodev/ecdsa-validator": "^5.2.1",
"permissionless": "^0.1.18",
"viem": "^2.9.17"
}
}
4 changes: 2 additions & 2 deletions packages/test/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EntryPointVersion } from "permissionless/types/entrypoint"
import { Chain } from "viem"
import type { EntryPointVersion } from "permissionless/types/entrypoint"
import type { Chain } from "viem"
import { polygonMumbai, sepolia } from "viem/chains"

export const config: {
Expand Down
20 changes: 10 additions & 10 deletions packages/test/ecdsaKernelAccount.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
constants,
EIP1271Abi,
KERNEL_ADDRESSES,
KernelAccountClient,
KernelSmartAccount,
type KernelAccountClient,
type KernelSmartAccount,
createKernelAccount,
getCustomNonceKeyFromString,
getERC20PaymasterApproveCall,
Expand All @@ -19,17 +19,17 @@ import {
import { gasTokenAddresses } from "@zerodev/sdk"
import dotenv from "dotenv"
import { ethers } from "ethers"
import { BundlerClient, ENTRYPOINT_ADDRESS_V06 } from "permissionless"
import { type BundlerClient, ENTRYPOINT_ADDRESS_V06 } from "permissionless"
import { SignTransactionNotSupportedBySmartAccount } from "permissionless/accounts"
import { EntryPoint } from "permissionless/types/entrypoint.js"
import type { EntryPoint } from "permissionless/types/entrypoint.js"
import {
Address,
Chain,
GetContractReturnType,
Hex,
PrivateKeyAccount,
type Address,
type Chain,
type GetContractReturnType,
type Hex,
type PrivateKeyAccount,
type PublicClient,
Transport,
type Transport,
decodeEventLog,
encodeFunctionData,
erc20Abi,
Expand Down
Loading

0 comments on commit 06a920e

Please sign in to comment.