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

Change moduleResolution resolution to nodeNext #321

Merged
merged 5 commits into from
Nov 8, 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/funny-apricots-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@permissionless/wagmi": patch
---

Changed moduleResolution to Bundler for esm & types build
5 changes: 5 additions & 0 deletions .changeset/funny-cherries-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"permissionless": patch
---

Upgraded moduleResolution to nodenext for esm & types build
5 changes: 5 additions & 0 deletions .changeset/slimy-panthers-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@permissionless/wagmi": patch
---

Dropped support for cjs build
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"scripts": {
"build": "bun run build:permissionless && bun run build:wagmi",
"build:permissionless": "bun run clean:permissionless && bun run build:cjs && bun run build:esm && bun run build:types",
"build:wagmi": "bun run clean:wagmi && bun run build:wagmi:cjs && bun run build:wagmi:esm && bun run build:wagmi:types",
"build:wagmi": "bun run clean:wagmi && bun run build:wagmi:esm && bun run build:wagmi:types",
"build:cjs": "tsc --project ./tsconfig/tsconfig.permissionless.cjs.json && tsc-alias -p ./tsconfig/tsconfig.permissionless.cjs.json && printf '{\"type\":\"commonjs\"}' > ./packages/permissionless/_cjs/package.json",
"build:esm": "tsc --project ./tsconfig/tsconfig.permissionless.esm.json && tsc-alias -p ./tsconfig/tsconfig.permissionless.esm.json && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./packages/permissionless/_esm/package.json",
"build:types": "tsc --project ./tsconfig/tsconfig.permissionless.types.json && tsc-alias -p ./tsconfig/tsconfig.permissionless.types.json",
Expand All @@ -64,7 +64,6 @@
"test": "vitest dev -c ./packages/permissionless/vitest.config.ts",
"test:ci": "CI=true && vitest -c ./packages/permissionless/vitest.config.ts --coverage --pool=forks",
"wagmi-demo": "bun run --cwd packages/wagmi-demo dev",
"build:wagmi:cjs": "tsc --project ./tsconfig/tsconfig.wagmi.cjs.json && tsc-alias -p ./tsconfig/tsconfig.wagmi.cjs.json && printf '{\"type\":\"commonjs\"}' > ./packages/wagmi/_cjs/package.json",
"build:wagmi:esm": "tsc --project ./tsconfig/tsconfig.wagmi.esm.json && tsc-alias -p ./tsconfig/tsconfig.wagmi.esm.json && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./packages/wagmi/_esm/package.json",
"build:wagmi:types": "tsc --project ./tsconfig/tsconfig.wagmi.types.json && tsc-alias -p ./tsconfig/tsconfig.wagmi.types.json",
"test:setup": "docker compose -f \"packages/permissionless-test/mock-aa-infra/docker-compose.yml\" up"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import {
toSmartAccount
} from "viem/account-abstraction"
import { signMessage } from "viem/actions"
import { getAccountNonce } from "../../actions/public/getAccountNonce"
import { type EthereumProvider, toOwner } from "../../utils/toOwner"
import { BiconomyAbi, FactoryAbi } from "./abi/BiconomySmartAccountAbi"
import { getAccountNonce } from "../../actions/public/getAccountNonce.js"
import { type EthereumProvider, toOwner } from "../../utils/toOwner.js"
import { BiconomyAbi, FactoryAbi } from "./abi/BiconomySmartAccountAbi.js"

const BICONOMY_PROXY_CREATION_CODE =
"0x6080346100aa57601f61012038819003918201601f19168301916001600160401b038311848410176100af578084926020946040528339810103126100aa57516001600160a01b0381168082036100aa5715610065573055604051605a90816100c68239f35b60405162461bcd60e51b815260206004820152601e60248201527f496e76616c696420696d706c656d656e746174696f6e206164647265737300006044820152606490fd5b600080fd5b634e487b7160e01b600052604160045260246000fdfe608060405230546000808092368280378136915af43d82803e156020573d90f35b3d90fdfea2646970667358221220a03b18dce0be0b4c9afe58a9eb85c35205e2cf087da098bbf1d23945bf89496064736f6c63430008110033"
Expand Down
16 changes: 8 additions & 8 deletions packages/permissionless/accounts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,59 @@ import {
type ToSimpleSmartAccountParameters,
type ToSimpleSmartAccountReturnType,
toSimpleSmartAccount
} from "./simple/toSimpleSmartAccount"
} from "./simple/toSimpleSmartAccount.js"

import {
type LightAccountVersion,
type LightSmartAccountImplementation,
type ToLightSmartAccountParameters,
type ToLightSmartAccountReturnType,
toLightSmartAccount
} from "./light/toLightSmartAccount"
} from "./light/toLightSmartAccount.js"

import {
type ToTrustSmartAccountParameters,
type ToTrustSmartAccountReturnType,
type TrustSmartAccountImplementation,
toTrustSmartAccount
} from "./trust/toTrustSmartAccount"
} from "./trust/toTrustSmartAccount.js"

import {
type SafeSmartAccountImplementation,
type SafeVersion,
type ToSafeSmartAccountParameters,
type ToSafeSmartAccountReturnType,
toSafeSmartAccount
} from "./safe/toSafeSmartAccount"
} from "./safe/toSafeSmartAccount.js"

import {
type EcdsaKernelSmartAccountImplementation,
type KernelVersion,
type ToEcdsaKernelSmartAccountParameters,
type ToEcdsaKernelSmartAccountReturnType,
toEcdsaKernelSmartAccount
} from "./kernel/toEcdsaKernelSmartAccount"
} from "./kernel/toEcdsaKernelSmartAccount.js"

import {
type BiconomySmartAccountImplementation,
type ToBiconomySmartAccountParameters,
type ToBiconomySmartAccountReturnType,
toBiconomySmartAccount
} from "./biconomy/toBiconomySmartAccount"
} from "./biconomy/toBiconomySmartAccount.js"

import {
type NexusSmartAccountImplementation,
type ToNexusSmartAccountParameters,
type ToNexusSmartAccountReturnType,
toNexusSmartAccount
} from "./nexus/toNexusSmartAccount"
} from "./nexus/toNexusSmartAccount.js"

import {
type ThirdwebSmartAccountImplementation,
type ToThirdwebSmartAccountParameters,
type ToThirdwebSmartAccountReturnType,
toThirdwebSmartAccount
} from "./thirdweb/toThirdwebSmartAccount"
} from "./thirdweb/toThirdwebSmartAccount.js"

export {
type ToSimpleSmartAccountParameters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,25 @@ import {
} from "viem/account-abstraction"
import { signMessage as _signMessage, getChainId } from "viem/actions"
import { getAction } from "viem/utils"
import { getAccountNonce } from "../../actions/public/getAccountNonce"
import { getSenderAddress } from "../../actions/public/getSenderAddress"
import { type EthereumProvider, toOwner } from "../../utils/toOwner"
import { KernelInitAbi } from "./abi/KernelAccountAbi"
import { KernelV3InitAbi, KernelV3_1AccountAbi } from "./abi/KernelV3AccountAbi"
import { KernelV3MetaFactoryDeployWithFactoryAbi } from "./abi/KernelV3MetaFactoryAbi"
import { getAccountNonce } from "../../actions/public/getAccountNonce.js"
import { getSenderAddress } from "../../actions/public/getSenderAddress.js"
import { type EthereumProvider, toOwner } from "../../utils/toOwner.js"
import { KernelInitAbi } from "./abi/KernelAccountAbi.js"
import {
KernelV3InitAbi,
KernelV3_1AccountAbi
} from "./abi/KernelV3AccountAbi.js"
import { KernelV3MetaFactoryDeployWithFactoryAbi } from "./abi/KernelV3MetaFactoryAbi.js"
import {
DUMMY_ECDSA_SIGNATURE,
ROOT_MODE_KERNEL_V2,
VALIDATOR_TYPE
} from "./constants"
import { encodeCallData } from "./utils/encodeCallData"
import { getNonceKeyWithEncoding } from "./utils/getNonceKey"
import { isKernelV2 } from "./utils/isKernelV2"
import { signMessage } from "./utils/signMessage"
import { signTypedData } from "./utils/signTypedData"
} from "./constants.js"
import { encodeCallData } from "./utils/encodeCallData.js"
import { getNonceKeyWithEncoding } from "./utils/getNonceKey.js"
import { isKernelV2 } from "./utils/isKernelV2.js"
import { signMessage } from "./utils/signMessage.js"
import { signTypedData } from "./utils/signTypedData.js"

/**
* The account creation ABI for a kernel smart account (from the KernelFactory)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { type Address, type Hex, encodeFunctionData } from "viem"
import { encode7579Calls } from "../../../utils/encode7579Calls"
import { KernelExecuteAbi } from "../abi/KernelAccountAbi"
import type { KernelVersion } from "../toEcdsaKernelSmartAccount"
import { isKernelV2 } from "./isKernelV2"
import { encode7579Calls } from "../../../utils/encode7579Calls.js"
import { KernelExecuteAbi } from "../abi/KernelAccountAbi.js"
import type { KernelVersion } from "../toEcdsaKernelSmartAccount.js"
import { isKernelV2 } from "./isKernelV2.js"

export const encodeCallData = ({
kernelVersion,
Expand Down
6 changes: 3 additions & 3 deletions packages/permissionless/accounts/kernel/utils/getNonceKey.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type Address, concatHex, maxUint16, pad, toHex } from "viem"
import { VALIDATOR_MODE, VALIDATOR_TYPE } from "../constants"
import type { KernelVersion } from "../toEcdsaKernelSmartAccount"
import { isKernelV2 } from "./isKernelV2"
import { VALIDATOR_MODE, VALIDATOR_TYPE } from "../constants.js"
import type { KernelVersion } from "../toEcdsaKernelSmartAccount.js"
import { isKernelV2 } from "./isKernelV2.js"

export const getNonceKeyWithEncoding = (
kernelVersion: KernelVersion<"0.6" | "0.7">,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { KernelVersion } from "../toEcdsaKernelSmartAccount"
import type { KernelVersion } from "../toEcdsaKernelSmartAccount.js"

export const isKernelV2 = (version: KernelVersion<"0.6" | "0.7">): boolean => {
const regex = /0\.2\.\d+/
Expand Down
7 changes: 5 additions & 2 deletions packages/permissionless/accounts/kernel/utils/signMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import {
hashMessage
} from "viem"
import { signMessage as _signMessage } from "viem/actions"
import { isKernelV2 } from "./isKernelV2"
import { type WrapMessageHashParams, wrapMessageHash } from "./wrapMessageHash"
import { isKernelV2 } from "./isKernelV2.js"
import {
type WrapMessageHashParams,
wrapMessageHash
} from "./wrapMessageHash.js"

export async function signMessage({
message,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import {
hashTypedData,
validateTypedData
} from "viem"
import { isKernelV2 } from "./isKernelV2"
import { type WrapMessageHashParams, wrapMessageHash } from "./wrapMessageHash"
import { isKernelV2 } from "./isKernelV2.js"
import {
type WrapMessageHashParams,
wrapMessageHash
} from "./wrapMessageHash.js"

export async function signTypedData(
parameters: TypedDataDefinition &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
stringToHex
} from "viem"
import { type Address, domainSeparator } from "viem"
import type { KernelVersion } from "../toEcdsaKernelSmartAccount"
import type { KernelVersion } from "../toEcdsaKernelSmartAccount.js"

export type WrapMessageHashParams = {
kernelVersion: KernelVersion<"0.6" | "0.7">
Expand Down
6 changes: 3 additions & 3 deletions packages/permissionless/accounts/light/toLightSmartAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import {
} from "viem/account-abstraction"
import { getChainId, signMessage } from "viem/actions"
import { getAction } from "viem/utils"
import { getAccountNonce } from "../../actions/public/getAccountNonce"
import { getSenderAddress } from "../../actions/public/getSenderAddress"
import { type EthereumProvider, toOwner } from "../../utils/toOwner"
import { getAccountNonce } from "../../actions/public/getAccountNonce.js"
import { getSenderAddress } from "../../actions/public/getSenderAddress.js"
import { type EthereumProvider, toOwner } from "../../utils/toOwner.js"

const getAccountInitCode = async (
owner: Address,
Expand Down
6 changes: 3 additions & 3 deletions packages/permissionless/accounts/nexus/toNexusSmartAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ import {
} from "viem/account-abstraction"
import { getChainId, readContract } from "viem/actions"
import { getAction } from "viem/utils"
import { getAccountNonce } from "../../actions/public/getAccountNonce"
import { encode7579Calls } from "../../utils"
import { type EthereumProvider, toOwner } from "../../utils/toOwner"
import { getAccountNonce } from "../../actions/public/getAccountNonce.js"
import { encode7579Calls } from "../../utils/encode7579Calls.js"
import { type EthereumProvider, toOwner } from "../../utils/toOwner.js"

const wrapMessageHash = (
messageHash: Hex,
Expand Down
8 changes: 4 additions & 4 deletions packages/permissionless/accounts/safe/toSafeSmartAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ import {
} from "viem/account-abstraction"
import { getChainId, readContract, signTypedData } from "viem/actions"
import { getAction } from "viem/utils"
import { getAccountNonce } from "../../actions/public/getAccountNonce"
import { isSmartAccountDeployed, toOwner } from "../../utils"
import { encode7579Calls } from "../../utils/encode7579Calls"
import type { EthereumProvider } from "../../utils/toOwner"
import { getAccountNonce } from "../../actions/public/getAccountNonce.js"
import { encode7579Calls } from "../../utils/encode7579Calls.js"
import { isSmartAccountDeployed } from "../../utils/isSmartAccountDeployed.js"
import { type EthereumProvider, toOwner } from "../../utils/toOwner.js"

export type SafeVersion = "1.4.1"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import {
} from "viem/account-abstraction"
import { getChainId, signMessage } from "viem/actions"
import { getAction } from "viem/utils"
import { getAccountNonce } from "../../actions/public/getAccountNonce"
import { getSenderAddress } from "../../actions/public/getSenderAddress"
import { type EthereumProvider, toOwner } from "../../utils/toOwner"
import { getAccountNonce } from "../../actions/public/getAccountNonce.js"
import { getSenderAddress } from "../../actions/public/getSenderAddress.js"
import { type EthereumProvider, toOwner } from "../../utils/toOwner.js"

const getAccountInitCode = async (
owner: Address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
WalletClient
} from "viem"
import { getChainId } from "viem/actions"
import { getAccountNonce } from "../../actions/public/getAccountNonce"
import { getAccountNonce } from "../../actions/public/getAccountNonce.js"

import {
type SmartAccount,
Expand All @@ -24,12 +24,12 @@ import {
toSmartAccount
} from "viem/account-abstraction"
import { getAction, toHex } from "viem/utils"
import { type EthereumProvider, toOwner } from "../../utils/toOwner"
import { encodeCallData } from "./utils/encodeCallData"
import { getAccountAddress } from "./utils/getAccountAddress"
import { getFactoryData } from "./utils/getFactoryData"
import { signMessage } from "./utils/signMessage"
import { signTypedData } from "./utils/signTypedData"
import { type EthereumProvider, toOwner } from "../../utils/toOwner.js"
import { encodeCallData } from "./utils/encodeCallData.js"
import { getAccountAddress } from "./utils/getAccountAddress.js"
import { getFactoryData } from "./utils/getFactoryData.js"
import { signMessage } from "./utils/signMessage.js"
import { signTypedData } from "./utils/signTypedData.js"

/**
* Default addresses for Thirdweb Smart Account
Expand Down
10 changes: 5 additions & 5 deletions packages/permissionless/accounts/trust/toTrustSmartAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
hashTypedData
} from "viem"
import { getChainId, signMessage } from "viem/actions"
import { getAccountNonce } from "../../actions/public/getAccountNonce"
import { getAccountNonce } from "../../actions/public/getAccountNonce.js"

import {
type SmartAccount,
Expand All @@ -25,10 +25,10 @@ import {
toSmartAccount
} from "viem/account-abstraction"
import { getAction } from "viem/utils"
import { getSenderAddress } from "../../actions/public/getSenderAddress"
import { type EthereumProvider, toOwner } from "../../utils/toOwner"
import { encodeCallData } from "./utils/encodeCallData"
import { getFactoryData } from "./utils/getFactoryData"
import { getSenderAddress } from "../../actions/public/getSenderAddress.js"
import { type EthereumProvider, toOwner } from "../../utils/toOwner.js"
import { encodeCallData } from "./utils/encodeCallData.js"
import { getFactoryData } from "./utils/getFactoryData.js"

async function _signTypedData(
signer: LocalAccount,
Expand Down
23 changes: 13 additions & 10 deletions packages/permissionless/actions/erc7579.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,40 @@ import type {
GetSmartAccountParameter,
SmartAccount
} from "viem/account-abstraction"
import { accountId } from "./erc7579/accountId"
import { accountId } from "./erc7579/accountId.js"
import {
type InstallModuleParameters,
installModule
} from "./erc7579/installModule"
} from "./erc7579/installModule.js"
import {
type InstallModulesParameters,
installModules
} from "./erc7579/installModules"
} from "./erc7579/installModules.js"
import {
type IsModuleInstalledParameters,
isModuleInstalled
} from "./erc7579/isModuleInstalled"
} from "./erc7579/isModuleInstalled.js"
import {
type SupportsExecutionModeParameters,
supportsExecutionMode
} from "./erc7579/supportsExecutionMode"
import type { CallType, ExecutionMode } from "./erc7579/supportsExecutionMode"
} from "./erc7579/supportsExecutionMode.js"
import type {
CallType,
ExecutionMode
} from "./erc7579/supportsExecutionMode.js"
import {
type SupportsModuleParameters,
supportsModule
} from "./erc7579/supportsModule"
import type { ModuleType } from "./erc7579/supportsModule"
} from "./erc7579/supportsModule.js"
import type { ModuleType } from "./erc7579/supportsModule.js"
import {
type UninstallModuleParameters,
uninstallModule
} from "./erc7579/uninstallModule"
} from "./erc7579/uninstallModule.js"
import {
type UninstallModulesParameters,
uninstallModules
} from "./erc7579/uninstallModules"
} from "./erc7579/uninstallModules.js"

export type Erc7579Actions<TSmartAccount extends SmartAccount | undefined> = {
accountId: (
Expand Down
2 changes: 1 addition & 1 deletion packages/permissionless/actions/erc7579/accountId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
} from "viem/account-abstraction"
import { call, readContract } from "viem/actions"
import { getAction } from "viem/utils"
import { AccountNotFoundError } from "../../errors"
import { AccountNotFoundError } from "../../errors/index.js"

export async function accountId<TSmartAccount extends SmartAccount | undefined>(
client: Client<Transport, Chain | undefined, TSmartAccount>,
Expand Down
6 changes: 3 additions & 3 deletions packages/permissionless/actions/erc7579/installModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
sendUserOperation
} from "viem/account-abstraction"
import { getAction, parseAccount } from "viem/utils"
import { AccountNotFoundError } from "../../errors"
import { encodeInstallModule } from "../../utils"
import type { ModuleType } from "./supportsModule"
import { AccountNotFoundError } from "../../errors/index.js"
import { encodeInstallModule } from "../../utils/encodeInstallModule.js"
import type { ModuleType } from "./supportsModule.js"

export type InstallModuleParameters<
TSmartAccount extends SmartAccount | undefined,
Expand Down
Loading
Loading