From 1261eb88013166332198308aaaa1f00a3b306e7c Mon Sep 17 00:00:00 2001 From: Garvit Khatri Date: Mon, 4 Nov 2024 11:29:36 +0000 Subject: [PATCH 1/3] Change node resolution to nodeNext --- .../biconomy/toBiconomySmartAccount.ts | 6 ++--- packages/permissionless/accounts/index.ts | 16 +++++------ .../kernel/toEcdsaKernelSmartAccount.ts | 27 ++++++++++--------- .../accounts/kernel/utils/encodeCallData.ts | 8 +++--- .../accounts/kernel/utils/getNonceKey.ts | 6 ++--- .../accounts/kernel/utils/isKernelV2.ts | 2 +- .../accounts/kernel/utils/signMessage.ts | 7 +++-- .../accounts/kernel/utils/signTypedData.ts | 7 +++-- .../accounts/kernel/utils/wrapMessageHash.ts | 2 +- .../accounts/light/toLightSmartAccount.ts | 6 ++--- .../accounts/nexus/toNexusSmartAccount.ts | 6 ++--- .../accounts/safe/toSafeSmartAccount.ts | 7 ++--- .../accounts/simple/toSimpleSmartAccount.ts | 6 ++--- .../thirdweb/toThirdwebSmartAccount.ts | 14 +++++----- .../accounts/trust/toTrustSmartAccount.ts | 10 +++---- packages/permissionless/actions/erc7579.ts | 23 +++++++++------- .../actions/erc7579/accountId.ts | 2 +- .../actions/erc7579/installModule.ts | 6 ++--- .../actions/erc7579/installModules.ts | 4 +-- .../actions/erc7579/isModuleInstalled.ts | 4 +-- .../actions/erc7579/supportsExecutionMode.ts | 2 +- .../actions/erc7579/supportsModule.ts | 2 +- .../actions/erc7579/uninstallModule.ts | 6 ++--- .../actions/erc7579/uninstallModules.ts | 4 +-- packages/permissionless/actions/index.ts | 8 +++--- packages/permissionless/actions/pimlico.ts | 16 +++++------ .../actions/pimlico/getTokenQuotes.ts | 2 +- .../pimlico/getUserOperationGasPrice.ts | 2 +- .../actions/pimlico/getUserOperationStatus.ts | 2 +- .../pimlico/sendCompressedUserOperation.ts | 2 +- .../actions/pimlico/sponsorUserOperation.ts | 4 +-- .../pimlico/validateSponsorshipPolicies.ts | 4 +-- .../permissionless/actions/smartAccount.ts | 8 +++--- .../actions/smartAccount/sendTransaction.ts | 2 +- .../actions/smartAccount/signMessage.ts | 2 +- .../actions/smartAccount/signTypedData.ts | 2 +- .../actions/smartAccount/writeContract.ts | 2 +- .../clients/createSmartAccountClient.ts | 2 +- .../clients/decorators/pimlico.ts | 8 +++--- .../clients/decorators/smartAccount.ts | 8 +++--- packages/permissionless/clients/index.ts | 4 +-- packages/permissionless/clients/pimlico.ts | 4 +-- .../experimental/pimlico/index.ts | 2 +- .../prepareUserOperationForErc20Paymaster.ts | 5 ++-- packages/permissionless/index.ts | 6 ++--- .../permissionless/utils/encode7579Calls.ts | 2 +- .../utils/encodeInstallModule.ts | 4 +-- .../utils/encodeUninstallModule.ts | 4 +-- packages/permissionless/utils/index.ts | 27 ++++++++++--------- .../wagmi/hooks/useAvailableCapabilities.ts | 2 +- packages/wagmi/hooks/useSendTransaction.ts | 2 +- .../hooks/useWaitForTransactionReceipt.ts | 6 ++--- packages/wagmi/index.ts | 6 ++--- 53 files changed, 174 insertions(+), 157 deletions(-) diff --git a/packages/permissionless/accounts/biconomy/toBiconomySmartAccount.ts b/packages/permissionless/accounts/biconomy/toBiconomySmartAccount.ts index a3596072..bb6d7ef0 100644 --- a/packages/permissionless/accounts/biconomy/toBiconomySmartAccount.ts +++ b/packages/permissionless/accounts/biconomy/toBiconomySmartAccount.ts @@ -30,9 +30,9 @@ import { toSmartAccount } from "viem/account-abstraction" import { signMessage } from "viem/actions" -import { getAccountNonce } from "../../actions/public/getAccountNonce" -import { toOwner } from "../../utils/toOwner" -import { BiconomyAbi, FactoryAbi } from "./abi/BiconomySmartAccountAbi" +import { getAccountNonce } from "../../actions/public/getAccountNonce.js" +import { toOwner } from "../../utils/toOwner.js" +import { BiconomyAbi, FactoryAbi } from "./abi/BiconomySmartAccountAbi.js" const BICONOMY_PROXY_CREATION_CODE = "0x6080346100aa57601f61012038819003918201601f19168301916001600160401b038311848410176100af578084926020946040528339810103126100aa57516001600160a01b0381168082036100aa5715610065573055604051605a90816100c68239f35b60405162461bcd60e51b815260206004820152601e60248201527f496e76616c696420696d706c656d656e746174696f6e206164647265737300006044820152606490fd5b600080fd5b634e487b7160e01b600052604160045260246000fdfe608060405230546000808092368280378136915af43d82803e156020573d90f35b3d90fdfea2646970667358221220a03b18dce0be0b4c9afe58a9eb85c35205e2cf087da098bbf1d23945bf89496064736f6c63430008110033" diff --git a/packages/permissionless/accounts/index.ts b/packages/permissionless/accounts/index.ts index da659ffa..6675db2b 100644 --- a/packages/permissionless/accounts/index.ts +++ b/packages/permissionless/accounts/index.ts @@ -3,7 +3,7 @@ import { type ToSimpleSmartAccountParameters, type ToSimpleSmartAccountReturnType, toSimpleSmartAccount -} from "./simple/toSimpleSmartAccount" +} from "./simple/toSimpleSmartAccount.js" import { type LightAccountVersion, @@ -11,14 +11,14 @@ import { 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, @@ -26,7 +26,7 @@ import { type ToSafeSmartAccountParameters, type ToSafeSmartAccountReturnType, toSafeSmartAccount -} from "./safe/toSafeSmartAccount" +} from "./safe/toSafeSmartAccount.js" import { type EcdsaKernelSmartAccountImplementation, @@ -34,28 +34,28 @@ import { 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, diff --git a/packages/permissionless/accounts/kernel/toEcdsaKernelSmartAccount.ts b/packages/permissionless/accounts/kernel/toEcdsaKernelSmartAccount.ts index 62077413..1e996462 100644 --- a/packages/permissionless/accounts/kernel/toEcdsaKernelSmartAccount.ts +++ b/packages/permissionless/accounts/kernel/toEcdsaKernelSmartAccount.ts @@ -30,22 +30,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 { 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 { 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) diff --git a/packages/permissionless/accounts/kernel/utils/encodeCallData.ts b/packages/permissionless/accounts/kernel/utils/encodeCallData.ts index 344ed979..94e6c3d0 100644 --- a/packages/permissionless/accounts/kernel/utils/encodeCallData.ts +++ b/packages/permissionless/accounts/kernel/utils/encodeCallData.ts @@ -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, diff --git a/packages/permissionless/accounts/kernel/utils/getNonceKey.ts b/packages/permissionless/accounts/kernel/utils/getNonceKey.ts index 17bb482d..e0f70890 100644 --- a/packages/permissionless/accounts/kernel/utils/getNonceKey.ts +++ b/packages/permissionless/accounts/kernel/utils/getNonceKey.ts @@ -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">, diff --git a/packages/permissionless/accounts/kernel/utils/isKernelV2.ts b/packages/permissionless/accounts/kernel/utils/isKernelV2.ts index 16fc02f9..fe04533a 100644 --- a/packages/permissionless/accounts/kernel/utils/isKernelV2.ts +++ b/packages/permissionless/accounts/kernel/utils/isKernelV2.ts @@ -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+/ diff --git a/packages/permissionless/accounts/kernel/utils/signMessage.ts b/packages/permissionless/accounts/kernel/utils/signMessage.ts index 510a1d99..12026169 100644 --- a/packages/permissionless/accounts/kernel/utils/signMessage.ts +++ b/packages/permissionless/accounts/kernel/utils/signMessage.ts @@ -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, diff --git a/packages/permissionless/accounts/kernel/utils/signTypedData.ts b/packages/permissionless/accounts/kernel/utils/signTypedData.ts index ff7bd81f..8b1dc66a 100644 --- a/packages/permissionless/accounts/kernel/utils/signTypedData.ts +++ b/packages/permissionless/accounts/kernel/utils/signTypedData.ts @@ -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 & diff --git a/packages/permissionless/accounts/kernel/utils/wrapMessageHash.ts b/packages/permissionless/accounts/kernel/utils/wrapMessageHash.ts index a2e72a5b..1764b2f0 100644 --- a/packages/permissionless/accounts/kernel/utils/wrapMessageHash.ts +++ b/packages/permissionless/accounts/kernel/utils/wrapMessageHash.ts @@ -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"> diff --git a/packages/permissionless/accounts/light/toLightSmartAccount.ts b/packages/permissionless/accounts/light/toLightSmartAccount.ts index 629e1ec8..d8f57086 100644 --- a/packages/permissionless/accounts/light/toLightSmartAccount.ts +++ b/packages/permissionless/accounts/light/toLightSmartAccount.ts @@ -27,9 +27,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 { toOwner } from "../../utils/toOwner" +import { getAccountNonce } from "../../actions/public/getAccountNonce.js" +import { getSenderAddress } from "../../actions/public/getSenderAddress.js" +import { toOwner } from "../../utils/toOwner.js" const getAccountInitCode = async ( owner: Address, diff --git a/packages/permissionless/accounts/nexus/toNexusSmartAccount.ts b/packages/permissionless/accounts/nexus/toNexusSmartAccount.ts index c5ae3b0a..9c83133f 100644 --- a/packages/permissionless/accounts/nexus/toNexusSmartAccount.ts +++ b/packages/permissionless/accounts/nexus/toNexusSmartAccount.ts @@ -38,9 +38,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 { toOwner } from "../../utils/toOwner" +import { getAccountNonce } from "../../actions/public/getAccountNonce.js" +import { encode7579Calls } from "../../utils/encode7579Calls.js" +import { toOwner } from "../../utils/toOwner.js" const wrapMessageHash = ( messageHash: Hex, diff --git a/packages/permissionless/accounts/safe/toSafeSmartAccount.ts b/packages/permissionless/accounts/safe/toSafeSmartAccount.ts index 03690096..5c2ad380 100644 --- a/packages/permissionless/accounts/safe/toSafeSmartAccount.ts +++ b/packages/permissionless/accounts/safe/toSafeSmartAccount.ts @@ -39,9 +39,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 { getAccountNonce } from "../../actions/public/getAccountNonce.js" +import { encode7579Calls } from "../../utils/encode7579Calls.js" +import { isSmartAccountDeployed } from "../../utils/isSmartAccountDeployed.js" +import { toOwner } from "../../utils/toOwner.js" export type SafeVersion = "1.4.1" diff --git a/packages/permissionless/accounts/simple/toSimpleSmartAccount.ts b/packages/permissionless/accounts/simple/toSimpleSmartAccount.ts index 8c72a388..94482627 100644 --- a/packages/permissionless/accounts/simple/toSimpleSmartAccount.ts +++ b/packages/permissionless/accounts/simple/toSimpleSmartAccount.ts @@ -24,9 +24,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 { toOwner } from "../../utils/toOwner" +import { getAccountNonce } from "../../actions/public/getAccountNonce.js" +import { getSenderAddress } from "../../actions/public/getSenderAddress.js" +import { toOwner } from "../../utils/toOwner.js" const getAccountInitCode = async ( owner: Address, diff --git a/packages/permissionless/accounts/thirdweb/toThirdwebSmartAccount.ts b/packages/permissionless/accounts/thirdweb/toThirdwebSmartAccount.ts index 8b27544c..82234fb6 100644 --- a/packages/permissionless/accounts/thirdweb/toThirdwebSmartAccount.ts +++ b/packages/permissionless/accounts/thirdweb/toThirdwebSmartAccount.ts @@ -12,7 +12,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, @@ -25,12 +25,12 @@ import { toSmartAccount } from "viem/account-abstraction" import { getAction, toHex } from "viem/utils" -import { 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 { 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 diff --git a/packages/permissionless/accounts/trust/toTrustSmartAccount.ts b/packages/permissionless/accounts/trust/toTrustSmartAccount.ts index 65c3f7e8..fa0be572 100644 --- a/packages/permissionless/accounts/trust/toTrustSmartAccount.ts +++ b/packages/permissionless/accounts/trust/toTrustSmartAccount.ts @@ -14,7 +14,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, @@ -26,10 +26,10 @@ import { toSmartAccount } from "viem/account-abstraction" import { getAction } from "viem/utils" -import { getSenderAddress } from "../../actions/public/getSenderAddress" -import { toOwner } from "../../utils/toOwner" -import { encodeCallData } from "./utils/encodeCallData" -import { getFactoryData } from "./utils/getFactoryData" +import { getSenderAddress } from "../../actions/public/getSenderAddress.js" +import { toOwner } from "../../utils/toOwner.js" +import { encodeCallData } from "./utils/encodeCallData.js" +import { getFactoryData } from "./utils/getFactoryData.js" async function _signTypedData( signer: LocalAccount, diff --git a/packages/permissionless/actions/erc7579.ts b/packages/permissionless/actions/erc7579.ts index bc5ddde4..6fe38307 100644 --- a/packages/permissionless/actions/erc7579.ts +++ b/packages/permissionless/actions/erc7579.ts @@ -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 = { accountId: ( diff --git a/packages/permissionless/actions/erc7579/accountId.ts b/packages/permissionless/actions/erc7579/accountId.ts index 6b434ebf..f8daf162 100644 --- a/packages/permissionless/actions/erc7579/accountId.ts +++ b/packages/permissionless/actions/erc7579/accountId.ts @@ -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( client: Client, diff --git a/packages/permissionless/actions/erc7579/installModule.ts b/packages/permissionless/actions/erc7579/installModule.ts index a4c09a80..0e035123 100644 --- a/packages/permissionless/actions/erc7579/installModule.ts +++ b/packages/permissionless/actions/erc7579/installModule.ts @@ -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, diff --git a/packages/permissionless/actions/erc7579/installModules.ts b/packages/permissionless/actions/erc7579/installModules.ts index 2a8bdf74..ff583d71 100644 --- a/packages/permissionless/actions/erc7579/installModules.ts +++ b/packages/permissionless/actions/erc7579/installModules.ts @@ -6,11 +6,11 @@ import { sendUserOperation } from "viem/account-abstraction" import { getAction, parseAccount } from "viem/utils" -import { AccountNotFoundError } from "../../errors" +import { AccountNotFoundError } from "../../errors/index.js" import { type EncodeInstallModuleParameters, encodeInstallModule -} from "../../utils/encodeInstallModule" +} from "../../utils/encodeInstallModule.js" export type InstallModulesParameters< TSmartAccount extends SmartAccount | undefined, diff --git a/packages/permissionless/actions/erc7579/isModuleInstalled.ts b/packages/permissionless/actions/erc7579/isModuleInstalled.ts index 421a4bc9..4e51666c 100644 --- a/packages/permissionless/actions/erc7579/isModuleInstalled.ts +++ b/packages/permissionless/actions/erc7579/isModuleInstalled.ts @@ -16,8 +16,8 @@ import type { } from "viem/account-abstraction" import { call, readContract } from "viem/actions" import { getAction, parseAccount } from "viem/utils" -import { AccountNotFoundError } from "../../errors" -import { type ModuleType, parseModuleTypeId } from "./supportsModule" +import { AccountNotFoundError } from "../../errors/index.js" +import { type ModuleType, parseModuleTypeId } from "./supportsModule.js" export type IsModuleInstalledParameters< TSmartAccount extends SmartAccount | undefined diff --git a/packages/permissionless/actions/erc7579/supportsExecutionMode.ts b/packages/permissionless/actions/erc7579/supportsExecutionMode.ts index e08720e1..06c43d72 100644 --- a/packages/permissionless/actions/erc7579/supportsExecutionMode.ts +++ b/packages/permissionless/actions/erc7579/supportsExecutionMode.ts @@ -17,7 +17,7 @@ import type { import { call, readContract } from "viem/actions" import { getAction } from "viem/utils" import { parseAccount } from "viem/utils" -import { AccountNotFoundError } from "../../errors" +import { AccountNotFoundError } from "../../errors/index.js" export type CallType = "call" | "delegatecall" | "batchcall" diff --git a/packages/permissionless/actions/erc7579/supportsModule.ts b/packages/permissionless/actions/erc7579/supportsModule.ts index b2a8951f..731f3a9b 100644 --- a/packages/permissionless/actions/erc7579/supportsModule.ts +++ b/packages/permissionless/actions/erc7579/supportsModule.ts @@ -13,7 +13,7 @@ import type { import { call, readContract } from "viem/actions" import { getAction } from "viem/utils" import { parseAccount } from "viem/utils" -import { AccountNotFoundError } from "../../errors" +import { AccountNotFoundError } from "../../errors/index.js" export type ModuleType = "validator" | "executor" | "fallback" | "hook" diff --git a/packages/permissionless/actions/erc7579/uninstallModule.ts b/packages/permissionless/actions/erc7579/uninstallModule.ts index 5817c97e..e9b2e69c 100644 --- a/packages/permissionless/actions/erc7579/uninstallModule.ts +++ b/packages/permissionless/actions/erc7579/uninstallModule.ts @@ -16,9 +16,9 @@ import { } from "viem/account-abstraction" import { getAction } from "viem/utils" import { parseAccount } from "viem/utils" -import { AccountNotFoundError } from "../../errors" -import { encodeUninstallModule } from "../../utils/encodeUninstallModule" -import type { ModuleType } from "./supportsModule" +import { AccountNotFoundError } from "../../errors/index.js" +import { encodeUninstallModule } from "../../utils/encodeUninstallModule.js" +import type { ModuleType } from "./supportsModule.js" export type UninstallModuleParameters< TSmartAccount extends SmartAccount | undefined, diff --git a/packages/permissionless/actions/erc7579/uninstallModules.ts b/packages/permissionless/actions/erc7579/uninstallModules.ts index 885bf6bb..c68d40f7 100644 --- a/packages/permissionless/actions/erc7579/uninstallModules.ts +++ b/packages/permissionless/actions/erc7579/uninstallModules.ts @@ -7,11 +7,11 @@ import { } from "viem/account-abstraction" import { getAction } from "viem/utils" import { parseAccount } from "viem/utils" -import { AccountNotFoundError } from "../../errors" +import { AccountNotFoundError } from "../../errors/index.js" import { type EncodeUninstallModuleParameters, encodeUninstallModule -} from "../../utils/encodeUninstallModule" +} from "../../utils/encodeUninstallModule.js" export type UninstallModulesParameters< TSmartAccount extends SmartAccount | undefined, diff --git a/packages/permissionless/actions/index.ts b/packages/permissionless/actions/index.ts index 0d2236be..f8070760 100644 --- a/packages/permissionless/actions/index.ts +++ b/packages/permissionless/actions/index.ts @@ -1,11 +1,11 @@ -import type { GetSenderAddressParams } from "./public/getSenderAddress" +import type { GetSenderAddressParams } from "./public/getSenderAddress.js" import { InvalidEntryPointError, getSenderAddress -} from "./public/getSenderAddress" +} from "./public/getSenderAddress.js" -import type { GetAccountNonceParams } from "./public/getAccountNonce" -import { getAccountNonce } from "./public/getAccountNonce" +import type { GetAccountNonceParams } from "./public/getAccountNonce.js" +import { getAccountNonce } from "./public/getAccountNonce.js" export type { GetSenderAddressParams, GetAccountNonceParams } diff --git a/packages/permissionless/actions/pimlico.ts b/packages/permissionless/actions/pimlico.ts index 908aba0d..0909000a 100644 --- a/packages/permissionless/actions/pimlico.ts +++ b/packages/permissionless/actions/pimlico.ts @@ -2,34 +2,34 @@ import { type GetTokenQuotesParameters, type GetTokenQuotesReturnType, getTokenQuotes -} from "./pimlico/getTokenQuotes" +} from "./pimlico/getTokenQuotes.js" import { type GetUserOperationGasPriceReturnType, getUserOperationGasPrice -} from "./pimlico/getUserOperationGasPrice" +} from "./pimlico/getUserOperationGasPrice.js" import { type GetUserOperationStatusParameters, type GetUserOperationStatusReturnType, getUserOperationStatus -} from "./pimlico/getUserOperationStatus" +} from "./pimlico/getUserOperationStatus.js" import { type SendCompressedUserOperationParameters, sendCompressedUserOperation -} from "./pimlico/sendCompressedUserOperation" +} from "./pimlico/sendCompressedUserOperation.js" import { type PimlicoSponsorUserOperationParameters, type SponsorUserOperationReturnType, sponsorUserOperation -} from "./pimlico/sponsorUserOperation" +} from "./pimlico/sponsorUserOperation.js" -import type { PimlicoActions } from "../clients/decorators/pimlico" -import { pimlicoActions } from "../clients/decorators/pimlico" +import type { PimlicoActions } from "../clients/decorators/pimlico.js" +import { pimlicoActions } from "../clients/decorators/pimlico.js" import { type ValidateSponsorshipPolicies, type ValidateSponsorshipPoliciesParameters, validateSponsorshipPolicies -} from "./pimlico/validateSponsorshipPolicies" +} from "./pimlico/validateSponsorshipPolicies.js" export type { GetUserOperationGasPriceReturnType, diff --git a/packages/permissionless/actions/pimlico/getTokenQuotes.ts b/packages/permissionless/actions/pimlico/getTokenQuotes.ts index 7c054621..d3364150 100644 --- a/packages/permissionless/actions/pimlico/getTokenQuotes.ts +++ b/packages/permissionless/actions/pimlico/getTokenQuotes.ts @@ -9,7 +9,7 @@ import { hexToBigInt, numberToHex } from "viem" -import type { PimlicoRpcSchema } from "../../types/pimlico" +import type { PimlicoRpcSchema } from "../../types/pimlico.js" export type GetTokenQuotesParameters< TChain extends Chain | undefined, diff --git a/packages/permissionless/actions/pimlico/getUserOperationGasPrice.ts b/packages/permissionless/actions/pimlico/getUserOperationGasPrice.ts index 1b2e7592..74524180 100644 --- a/packages/permissionless/actions/pimlico/getUserOperationGasPrice.ts +++ b/packages/permissionless/actions/pimlico/getUserOperationGasPrice.ts @@ -1,5 +1,5 @@ import type { Account, Chain, Client, Transport } from "viem" -import type { PimlicoRpcSchema } from "../../types/pimlico" +import type { PimlicoRpcSchema } from "../../types/pimlico.js" export type GetUserOperationGasPriceReturnType = { slow: { diff --git a/packages/permissionless/actions/pimlico/getUserOperationStatus.ts b/packages/permissionless/actions/pimlico/getUserOperationStatus.ts index 93b1fcc2..0ecd31c6 100644 --- a/packages/permissionless/actions/pimlico/getUserOperationStatus.ts +++ b/packages/permissionless/actions/pimlico/getUserOperationStatus.ts @@ -2,7 +2,7 @@ import type { Account, Chain, Client, Hash, Transport } from "viem" import type { PimlicoRpcSchema, PimlicoUserOperationStatus -} from "../../types/pimlico" +} from "../../types/pimlico.js" export type GetUserOperationStatusParameters = { hash: Hash diff --git a/packages/permissionless/actions/pimlico/sendCompressedUserOperation.ts b/packages/permissionless/actions/pimlico/sendCompressedUserOperation.ts index 232d7728..b471b1fa 100644 --- a/packages/permissionless/actions/pimlico/sendCompressedUserOperation.ts +++ b/packages/permissionless/actions/pimlico/sendCompressedUserOperation.ts @@ -7,7 +7,7 @@ import type { Hex, Transport } from "viem" -import type { PimlicoRpcSchema } from "../../types/pimlico" +import type { PimlicoRpcSchema } from "../../types/pimlico.js" export type SendCompressedUserOperationParameters = { compressedUserOperation: Hex diff --git a/packages/permissionless/actions/pimlico/sponsorUserOperation.ts b/packages/permissionless/actions/pimlico/sponsorUserOperation.ts index fdfac621..920c1971 100644 --- a/packages/permissionless/actions/pimlico/sponsorUserOperation.ts +++ b/packages/permissionless/actions/pimlico/sponsorUserOperation.ts @@ -9,8 +9,8 @@ import type { Transport } from "viem" import type { UserOperation } from "viem/account-abstraction" -import type { PimlicoRpcSchema } from "../../types/pimlico" -import { deepHexlify } from "../../utils/deepHexlify" +import type { PimlicoRpcSchema } from "../../types/pimlico.js" +import { deepHexlify } from "../../utils/deepHexlify.js" export type PimlicoSponsorUserOperationParameters< entryPointVersion extends "0.6" | "0.7" diff --git a/packages/permissionless/actions/pimlico/validateSponsorshipPolicies.ts b/packages/permissionless/actions/pimlico/validateSponsorshipPolicies.ts index e5c2bef3..4fd53efd 100644 --- a/packages/permissionless/actions/pimlico/validateSponsorshipPolicies.ts +++ b/packages/permissionless/actions/pimlico/validateSponsorshipPolicies.ts @@ -1,7 +1,7 @@ import type { Account, Address, Chain, Client, Transport } from "viem" import type { UserOperation } from "viem/account-abstraction" -import type { PimlicoRpcSchema } from "../../types/pimlico" -import { deepHexlify } from "../../utils/deepHexlify" +import type { PimlicoRpcSchema } from "../../types/pimlico.js" +import { deepHexlify } from "../../utils/deepHexlify.js" export type ValidateSponsorshipPoliciesParameters = { userOperation: UserOperation diff --git a/packages/permissionless/actions/smartAccount.ts b/packages/permissionless/actions/smartAccount.ts index f09e4245..06366c9b 100644 --- a/packages/permissionless/actions/smartAccount.ts +++ b/packages/permissionless/actions/smartAccount.ts @@ -1,9 +1,9 @@ -import { sendTransaction } from "./smartAccount/sendTransaction" +import { sendTransaction } from "./smartAccount/sendTransaction.js" -import { signMessage } from "./smartAccount/signMessage" +import { signMessage } from "./smartAccount/signMessage.js" -import { signTypedData } from "./smartAccount/signTypedData" +import { signTypedData } from "./smartAccount/signTypedData.js" -import { writeContract } from "./smartAccount/writeContract" +import { writeContract } from "./smartAccount/writeContract.js" export { sendTransaction, signMessage, signTypedData, writeContract } diff --git a/packages/permissionless/actions/smartAccount/sendTransaction.ts b/packages/permissionless/actions/smartAccount/sendTransaction.ts index 1aad613d..95793f81 100644 --- a/packages/permissionless/actions/smartAccount/sendTransaction.ts +++ b/packages/permissionless/actions/smartAccount/sendTransaction.ts @@ -12,7 +12,7 @@ import { waitForUserOperationReceipt } from "viem/account-abstraction" import { getAction, parseAccount } from "viem/utils" -import { AccountNotFoundError } from "../../errors" +import { AccountNotFoundError } from "../../errors/index.js" /** * Creates, signs, and sends a new transaction to the network. diff --git a/packages/permissionless/actions/smartAccount/signMessage.ts b/packages/permissionless/actions/smartAccount/signMessage.ts index 2d816446..c125a5bb 100644 --- a/packages/permissionless/actions/smartAccount/signMessage.ts +++ b/packages/permissionless/actions/smartAccount/signMessage.ts @@ -7,7 +7,7 @@ import type { } from "viem" import type { SmartAccount } from "viem/account-abstraction" import { parseAccount } from "viem/utils" -import { AccountNotFoundError } from "../../errors" +import { AccountNotFoundError } from "../../errors/index.js" /** * Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. diff --git a/packages/permissionless/actions/smartAccount/signTypedData.ts b/packages/permissionless/actions/smartAccount/signTypedData.ts index 398f7654..d2da2a5e 100644 --- a/packages/permissionless/actions/smartAccount/signTypedData.ts +++ b/packages/permissionless/actions/smartAccount/signTypedData.ts @@ -12,7 +12,7 @@ import { } from "viem" import type { SmartAccount } from "viem/account-abstraction" import { parseAccount } from "viem/utils" -import { AccountNotFoundError } from "../../errors" +import { AccountNotFoundError } from "../../errors/index.js" /** * Signs typed data and calculates an Ethereum-specific signature in [https://eips.ethereum.org/EIPS/eip-712](https://eips.ethereum.org/EIPS/eip-712): `sign(keccak256("\x19\x01" ‖ domainSeparator ‖ hashStruct(message)))` diff --git a/packages/permissionless/actions/smartAccount/writeContract.ts b/packages/permissionless/actions/smartAccount/writeContract.ts index ca6149bb..ae63777a 100644 --- a/packages/permissionless/actions/smartAccount/writeContract.ts +++ b/packages/permissionless/actions/smartAccount/writeContract.ts @@ -13,7 +13,7 @@ import { } from "viem" import type { SmartAccount } from "viem/account-abstraction" import { getAction } from "viem/utils" -import { sendTransaction } from "./sendTransaction" +import { sendTransaction } from "./sendTransaction.js" export async function writeContract< TChain extends Chain | undefined, diff --git a/packages/permissionless/clients/createSmartAccountClient.ts b/packages/permissionless/clients/createSmartAccountClient.ts index b501a771..6d560e6d 100644 --- a/packages/permissionless/clients/createSmartAccountClient.ts +++ b/packages/permissionless/clients/createSmartAccountClient.ts @@ -22,7 +22,7 @@ import { import { type SmartAccountActions, smartAccountActions -} from "./decorators/smartAccount" +} from "./decorators/smartAccount.js" /** * TODO: diff --git a/packages/permissionless/clients/decorators/pimlico.ts b/packages/permissionless/clients/decorators/pimlico.ts index 499a0827..109d7861 100644 --- a/packages/permissionless/clients/decorators/pimlico.ts +++ b/packages/permissionless/clients/decorators/pimlico.ts @@ -8,21 +8,21 @@ import { getTokenQuotes, sendCompressedUserOperation, validateSponsorshipPolicies -} from "../../actions/pimlico" +} from "../../actions/pimlico.js" import { type GetUserOperationGasPriceReturnType, getUserOperationGasPrice -} from "../../actions/pimlico/getUserOperationGasPrice" +} from "../../actions/pimlico/getUserOperationGasPrice.js" import { type GetUserOperationStatusParameters, type GetUserOperationStatusReturnType, getUserOperationStatus -} from "../../actions/pimlico/getUserOperationStatus" +} from "../../actions/pimlico/getUserOperationStatus.js" import { type PimlicoSponsorUserOperationParameters, type SponsorUserOperationReturnType, sponsorUserOperation -} from "../../actions/pimlico/sponsorUserOperation" +} from "../../actions/pimlico/sponsorUserOperation.js" export type PimlicoActions< TChain extends Chain | undefined, diff --git a/packages/permissionless/clients/decorators/smartAccount.ts b/packages/permissionless/clients/decorators/smartAccount.ts index 96708a37..6d9c1159 100644 --- a/packages/permissionless/clients/decorators/smartAccount.ts +++ b/packages/permissionless/clients/decorators/smartAccount.ts @@ -11,10 +11,10 @@ import type { WriteContractParameters } from "viem" import type { SmartAccount } from "viem/account-abstraction" -import { sendTransaction } from "../../actions/smartAccount/sendTransaction" -import { signMessage } from "../../actions/smartAccount/signMessage" -import { signTypedData } from "../../actions/smartAccount/signTypedData" -import { writeContract } from "../../actions/smartAccount/writeContract" +import { sendTransaction } from "../../actions/smartAccount/sendTransaction.js" +import { signMessage } from "../../actions/smartAccount/signMessage.js" +import { signTypedData } from "../../actions/smartAccount/signTypedData.js" +import { writeContract } from "../../actions/smartAccount/writeContract.js" export type SmartAccountActions< TChain extends Chain | undefined = Chain | undefined, diff --git a/packages/permissionless/clients/index.ts b/packages/permissionless/clients/index.ts index 9684a3c4..2387c0dd 100644 --- a/packages/permissionless/clients/index.ts +++ b/packages/permissionless/clients/index.ts @@ -1,2 +1,2 @@ -export * from "./createSmartAccountClient" -export * from "./decorators/smartAccount" +export * from "./createSmartAccountClient.js" +export * from "./decorators/smartAccount.js" diff --git a/packages/permissionless/clients/pimlico.ts b/packages/permissionless/clients/pimlico.ts index 4cd141b9..5f41552b 100644 --- a/packages/permissionless/clients/pimlico.ts +++ b/packages/permissionless/clients/pimlico.ts @@ -17,8 +17,8 @@ import { entryPoint07Address, paymasterActions } from "viem/account-abstraction" -import type { PimlicoRpcSchema } from "../types/pimlico" -import { type PimlicoActions, pimlicoActions } from "./decorators/pimlico" +import type { PimlicoRpcSchema } from "../types/pimlico.js" +import { type PimlicoActions, pimlicoActions } from "./decorators/pimlico.js" export type PimlicoClient< entryPointVersion extends "0.6" | "0.7" = "0.7" | "0.6", diff --git a/packages/permissionless/experimental/pimlico/index.ts b/packages/permissionless/experimental/pimlico/index.ts index 80c0e415..7e46bbf5 100644 --- a/packages/permissionless/experimental/pimlico/index.ts +++ b/packages/permissionless/experimental/pimlico/index.ts @@ -1,2 +1,2 @@ -import { prepareUserOperationForErc20Paymaster } from "./utils/prepareUserOperationForErc20Paymaster" +import { prepareUserOperationForErc20Paymaster } from "./utils/prepareUserOperationForErc20Paymaster.js" export { prepareUserOperationForErc20Paymaster } diff --git a/packages/permissionless/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.ts b/packages/permissionless/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.ts index 51597912..5b7b83bd 100644 --- a/packages/permissionless/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.ts +++ b/packages/permissionless/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.ts @@ -24,8 +24,9 @@ import { import { getChainId as getChainId_ } from "viem/actions" import { readContract } from "viem/actions" import { getAction, parseAccount } from "viem/utils" -import { getTokenQuotes } from "../../../actions/pimlico" -import { erc20AllowanceOverride, erc20BalanceOverride } from "../../../utils" +import { getTokenQuotes } from "../../../actions/pimlico.js" +import { erc20AllowanceOverride } from "../../../utils/erc20AllowanceOverride.js" +import { erc20BalanceOverride } from "../../../utils/erc20BalanceOverride.js" export const prepareUserOperationForErc20Paymaster = ( diff --git a/packages/permissionless/index.ts b/packages/permissionless/index.ts index ed21b5a7..2d108e91 100644 --- a/packages/permissionless/index.ts +++ b/packages/permissionless/index.ts @@ -1,3 +1,3 @@ -export * from "./utils/" -export * from "./errors/" -export * from "./clients/" +export * from "./utils/index.js" +export * from "./errors/index.js" +export * from "./clients/index.js" diff --git a/packages/permissionless/utils/encode7579Calls.ts b/packages/permissionless/utils/encode7579Calls.ts index cf9dbd8b..61bfe876 100644 --- a/packages/permissionless/utils/encode7579Calls.ts +++ b/packages/permissionless/utils/encode7579Calls.ts @@ -10,7 +10,7 @@ import { type CallType, type ExecutionMode, encodeExecutionMode -} from "../actions/erc7579/supportsExecutionMode" +} from "../actions/erc7579/supportsExecutionMode.js" export type EncodeCallDataParams = { mode: ExecutionMode diff --git a/packages/permissionless/utils/encodeInstallModule.ts b/packages/permissionless/utils/encodeInstallModule.ts index a8b141ca..2d55ae38 100644 --- a/packages/permissionless/utils/encodeInstallModule.ts +++ b/packages/permissionless/utils/encodeInstallModule.ts @@ -12,8 +12,8 @@ import type { import { type ModuleType, parseModuleTypeId -} from "../actions/erc7579/supportsModule" -import { AccountNotFoundError } from "../errors" +} from "../actions/erc7579/supportsModule.js" +import { AccountNotFoundError } from "../errors/index.js" export type EncodeInstallModuleParameter = { type: ModuleType diff --git a/packages/permissionless/utils/encodeUninstallModule.ts b/packages/permissionless/utils/encodeUninstallModule.ts index 1f556b3a..786ad6e6 100644 --- a/packages/permissionless/utils/encodeUninstallModule.ts +++ b/packages/permissionless/utils/encodeUninstallModule.ts @@ -12,8 +12,8 @@ import type { import { type ModuleType, parseModuleTypeId -} from "../actions/erc7579/supportsModule" -import { AccountNotFoundError } from "../errors" +} from "../actions/erc7579/supportsModule.js" +import { AccountNotFoundError } from "../errors/index.js" export type EncodeUninstallModuleParameter = { type: ModuleType diff --git a/packages/permissionless/utils/index.ts b/packages/permissionless/utils/index.ts index c388de49..3da817b5 100644 --- a/packages/permissionless/utils/index.ts +++ b/packages/permissionless/utils/index.ts @@ -1,30 +1,33 @@ -import { deepHexlify, transactionReceiptStatus } from "./deepHexlify" -import { getAddressFromInitCodeOrPaymasterAndData } from "./getAddressFromInitCodeOrPaymasterAndData" +import { deepHexlify, transactionReceiptStatus } from "./deepHexlify.js" +import { getAddressFromInitCodeOrPaymasterAndData } from "./getAddressFromInitCodeOrPaymasterAndData.js" import { type GetRequiredPrefundReturnType, getRequiredPrefund -} from "./getRequiredPrefund" -import { isSmartAccountDeployed } from "./isSmartAccountDeployed" -import { toOwner } from "./toOwner" +} from "./getRequiredPrefund.js" +import { isSmartAccountDeployed } from "./isSmartAccountDeployed.js" +import { toOwner } from "./toOwner.js" -import { decodeNonce } from "./decodeNonce" -import { encodeNonce } from "./encodeNonce" +import { decodeNonce } from "./decodeNonce.js" +import { encodeNonce } from "./encodeNonce.js" import { type EncodeInstallModuleParameters, encodeInstallModule -} from "./encodeInstallModule" -import { getPackedUserOperation } from "./getPackedUserOperation" +} from "./encodeInstallModule.js" +import { getPackedUserOperation } from "./getPackedUserOperation.js" -import { type EncodeCallDataParams, encode7579Calls } from "./encode7579Calls" +import { + type EncodeCallDataParams, + encode7579Calls +} from "./encode7579Calls.js" import { type Erc20AllowanceOverrideParameters, erc20AllowanceOverride -} from "./erc20AllowanceOverride" +} from "./erc20AllowanceOverride.js" import { type Erc20BalanceOverrideParameters, erc20BalanceOverride -} from "./erc20BalanceOverride" +} from "./erc20BalanceOverride.js" export { transactionReceiptStatus, diff --git a/packages/wagmi/hooks/useAvailableCapabilities.ts b/packages/wagmi/hooks/useAvailableCapabilities.ts index 17f45da5..f4ad38b6 100644 --- a/packages/wagmi/hooks/useAvailableCapabilities.ts +++ b/packages/wagmi/hooks/useAvailableCapabilities.ts @@ -4,7 +4,7 @@ import { useContext, useMemo } from "react" import type { WalletCapabilities, WalletSendCallsParameters } from "viem" import { useAccount } from "wagmi" import { useCapabilities } from "wagmi/experimental" -import { PermissionlessContext } from "../context" +import { PermissionlessContext } from "../context.js" export const useAvailableCapabilities = () => { const { capabilities: capabilitiesConfigured } = useContext( diff --git a/packages/wagmi/hooks/useSendTransaction.ts b/packages/wagmi/hooks/useSendTransaction.ts index f0c2238f..c777c761 100644 --- a/packages/wagmi/hooks/useSendTransaction.ts +++ b/packages/wagmi/hooks/useSendTransaction.ts @@ -18,7 +18,7 @@ import type { UseMutationParameters, UseMutationReturnType } from "wagmi/query" -import { useAvailableCapabilities } from "./useAvailableCapabilities" +import { useAvailableCapabilities } from "./useAvailableCapabilities.js" const sendTransactionMutationOptions = ( config: config, diff --git a/packages/wagmi/hooks/useWaitForTransactionReceipt.ts b/packages/wagmi/hooks/useWaitForTransactionReceipt.ts index b82c4e8e..5b5d9b56 100644 --- a/packages/wagmi/hooks/useWaitForTransactionReceipt.ts +++ b/packages/wagmi/hooks/useWaitForTransactionReceipt.ts @@ -45,9 +45,9 @@ import { type WaitForTransactionReceiptQueryFnData, useQuery } from "wagmi/query" -import { observe } from "../utils/observe" -import { useAvailableCapabilities } from "./useAvailableCapabilities" -import type { ConfigParameter } from "./useSendTransaction" +import { observe } from "../utils/observe.js" +import { useAvailableCapabilities } from "./useAvailableCapabilities.js" +import type { ConfigParameter } from "./useSendTransaction.js" export type WaitForTransactionReceiptQueryKey< config extends Config, diff --git a/packages/wagmi/index.ts b/packages/wagmi/index.ts index 4b8dd695..b3798924 100644 --- a/packages/wagmi/index.ts +++ b/packages/wagmi/index.ts @@ -1,15 +1,15 @@ export { PermissionlessProvider, type PermissionlessProviderProps -} from "./context" +} from "./context.js" export { useSendTransaction, type UseSendTransactionParameters, type UseSendTransactionReturnType -} from "./hooks/useSendTransaction" +} from "./hooks/useSendTransaction.js" export { useWaitForTransactionReceipt, type UseWaitForTransactionReceiptParameters, type UseWaitForTransactionReceiptReturnType -} from "./hooks/useWaitForTransactionReceipt" +} from "./hooks/useWaitForTransactionReceipt.js" From b8d170c50284edb2b1b3703e401ac090db6dc338 Mon Sep 17 00:00:00 2001 From: Garvit Khatri Date: Mon, 4 Nov 2024 12:07:24 +0000 Subject: [PATCH 2/3] Makle tsconfig changes --- package.json | 3 +-- .../clients/createSmartAccountClient.ts | 4 ++-- .../clients/decorators/smartAccount.ts | 18 ++++++++---------- packages/wagmi-demo/src/wagmi.ts | 4 +++- packages/wagmi-demo/tsconfig.node.json | 6 ++++-- .../hooks/useWaitForTransactionReceipt.ts | 2 +- tsconfig/tsconfig.base.json | 2 -- tsconfig/tsconfig.permissionless.cjs.json | 3 ++- tsconfig/tsconfig.permissionless.esm.json | 5 +++-- tsconfig/tsconfig.permissionless.json | 1 - tsconfig/tsconfig.permissionless.types.json | 5 +++-- tsconfig/tsconfig.wagmi.cjs.json | 10 ---------- tsconfig/tsconfig.wagmi.esm.json | 4 ++-- tsconfig/tsconfig.wagmi.json | 2 +- 14 files changed, 30 insertions(+), 39 deletions(-) delete mode 100644 tsconfig/tsconfig.wagmi.cjs.json diff --git a/package.json b/package.json index 67590478..ddb3c3a0 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" diff --git a/packages/permissionless/clients/createSmartAccountClient.ts b/packages/permissionless/clients/createSmartAccountClient.ts index 6d560e6d..32a09b64 100644 --- a/packages/permissionless/clients/createSmartAccountClient.ts +++ b/packages/permissionless/clients/createSmartAccountClient.ts @@ -172,10 +172,10 @@ export function createSmartAccountClient( return customPrepareUserOp(client, args) } })) - .extend(smartAccountActions()) as SmartAccountClient + .extend(smartAccountActions) as SmartAccountClient } return client .extend(bundlerActions) - .extend(smartAccountActions()) as SmartAccountClient + .extend(smartAccountActions) as SmartAccountClient } diff --git a/packages/permissionless/clients/decorators/smartAccount.ts b/packages/permissionless/clients/decorators/smartAccount.ts index 6d9c1159..3b55c211 100644 --- a/packages/permissionless/clients/decorators/smartAccount.ts +++ b/packages/permissionless/clients/decorators/smartAccount.ts @@ -311,18 +311,16 @@ export type SmartAccountActions< > } -export function smartAccountActions() { - return < - TChain extends Chain | undefined = Chain | undefined, - TSmartAccount extends SmartAccount | undefined = - | SmartAccount - | undefined - >( - client: Client - ): SmartAccountActions => ({ +export function smartAccountActions< + TChain extends Chain | undefined = Chain | undefined, + TSmartAccount extends SmartAccount | undefined = SmartAccount | undefined +>( + client: Client +): SmartAccountActions { + return { sendTransaction: (args) => sendTransaction(client, args as any), signMessage: (args) => signMessage(client, args), signTypedData: (args) => signTypedData(client, args), writeContract: (args) => writeContract(client, args) - }) + } } diff --git a/packages/wagmi-demo/src/wagmi.ts b/packages/wagmi-demo/src/wagmi.ts index 9b70ecdc..0c3fe601 100644 --- a/packages/wagmi-demo/src/wagmi.ts +++ b/packages/wagmi-demo/src/wagmi.ts @@ -2,7 +2,9 @@ import { sepolia } from "viem/chains" import { http, createConfig } from "wagmi" import { coinbaseWallet } from "wagmi/connectors" -const pimlicoApiKey = process.env.PIMLICO_API_KEY +// TODO: Replace with your Pimlico API key +// @ts-ignore +const pimlicoApiKey = PIMLICO_API_KEY export const config = createConfig({ chains: [sepolia], diff --git a/packages/wagmi-demo/tsconfig.node.json b/packages/wagmi-demo/tsconfig.node.json index 42872c59..73dbb0b0 100644 --- a/packages/wagmi-demo/tsconfig.node.json +++ b/packages/wagmi-demo/tsconfig.node.json @@ -6,5 +6,7 @@ "moduleResolution": "bundler", "allowSyntheticDefaultImports": true }, - "include": ["vite.config.ts"] -} + "include": [ + "vite.config.ts" + ] +} \ No newline at end of file diff --git a/packages/wagmi/hooks/useWaitForTransactionReceipt.ts b/packages/wagmi/hooks/useWaitForTransactionReceipt.ts index 5b5d9b56..abe16f0e 100644 --- a/packages/wagmi/hooks/useWaitForTransactionReceipt.ts +++ b/packages/wagmi/hooks/useWaitForTransactionReceipt.ts @@ -312,7 +312,7 @@ export async function waitForCallsStatus< }) } -export function waitForTransactionReceiptQueryOptions< +function waitForTransactionReceiptQueryOptions< config extends Config, chainId extends config["chains"][number]["id"] = config["chains"][number]["id"] diff --git a/tsconfig/tsconfig.base.json b/tsconfig/tsconfig.base.json index fc47f3bc..db889a6b 100644 --- a/tsconfig/tsconfig.base.json +++ b/tsconfig/tsconfig.base.json @@ -26,8 +26,6 @@ "verbatimModuleSyntax": true, "importHelpers": true, // This is only used for build validation. Since we do not have `tslib` installed, this will fail if we accidentally make use of anything that'd require injection of helpers. // Language and environment - "moduleResolution": "NodeNext", - "module": "NodeNext", "target": "ES2021", // Setting this to `ES2021` enables native support for `Node v16+`: https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping. "lib": [ "ES2022", // By using ES2022 we get access to the `.cause` property on `Error` instances. diff --git a/tsconfig/tsconfig.permissionless.cjs.json b/tsconfig/tsconfig.permissionless.cjs.json index e857c712..4731efc4 100644 --- a/tsconfig/tsconfig.permissionless.cjs.json +++ b/tsconfig/tsconfig.permissionless.cjs.json @@ -3,8 +3,9 @@ "extends": "./tsconfig.permissionless.json", "compilerOptions": { "module": "commonjs", + "moduleResolution": "Node", "outDir": "../packages/permissionless/_cjs", "removeComments": true, "verbatimModuleSyntax": false } -} +} \ No newline at end of file diff --git a/tsconfig/tsconfig.permissionless.esm.json b/tsconfig/tsconfig.permissionless.esm.json index dbd9eea6..58b63b93 100644 --- a/tsconfig/tsconfig.permissionless.esm.json +++ b/tsconfig/tsconfig.permissionless.esm.json @@ -2,7 +2,8 @@ // This file is used to compile the for cjs and esm (see package.json build scripts). It should exclude all test files. "extends": "./tsconfig.permissionless.json", "compilerOptions": { - "module": "es2015", + "module": "NodeNext", + "moduleResolution": "NodeNext", "outDir": "../packages/permissionless/_esm", } -} +} \ No newline at end of file diff --git a/tsconfig/tsconfig.permissionless.json b/tsconfig/tsconfig.permissionless.json index cec9d51d..86a98d81 100644 --- a/tsconfig/tsconfig.permissionless.json +++ b/tsconfig/tsconfig.permissionless.json @@ -12,7 +12,6 @@ "../packages/permissionless/**/*.bench.ts" ], "compilerOptions": { - "moduleResolution": "node", "sourceMap": true, "rootDir": "../packages/permissionless" } diff --git a/tsconfig/tsconfig.permissionless.types.json b/tsconfig/tsconfig.permissionless.types.json index b75d3afa..36006b85 100644 --- a/tsconfig/tsconfig.permissionless.types.json +++ b/tsconfig/tsconfig.permissionless.types.json @@ -2,11 +2,12 @@ // This file is used to compile the for cjs and esm (see package.json build scripts). It should exclude all test files. "extends": "./tsconfig.permissionless.json", "compilerOptions": { - "module": "esnext", + "moduleResolution": "NodeNext", + "module": "NodeNext", "outDir": "../packages/permissionless/_esm", "declarationDir": "../packages/permissionless/_types", "emitDeclarationOnly": true, "declaration": true, "declarationMap": true, } -} +} \ No newline at end of file diff --git a/tsconfig/tsconfig.wagmi.cjs.json b/tsconfig/tsconfig.wagmi.cjs.json deleted file mode 100644 index 44cfbfcb..00000000 --- a/tsconfig/tsconfig.wagmi.cjs.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - // This file is used to compile the for cjs and esm (see package.json build scripts). It should exclude all test files. - "extends": "./tsconfig.wagmi.json", - "compilerOptions": { - "module": "commonjs", - "outDir": "../packages/wagmi/_cjs", - "removeComments": true, - "verbatimModuleSyntax": false - } -} \ No newline at end of file diff --git a/tsconfig/tsconfig.wagmi.esm.json b/tsconfig/tsconfig.wagmi.esm.json index dc5cef38..d267ebd0 100644 --- a/tsconfig/tsconfig.wagmi.esm.json +++ b/tsconfig/tsconfig.wagmi.esm.json @@ -2,7 +2,7 @@ // This file is used to compile the for cjs and esm (see package.json build scripts). It should exclude all test files. "extends": "./tsconfig.wagmi.json", "compilerOptions": { - "module": "es2015", + "module": "ESNext", "outDir": "../packages/wagmi/_esm", } -} +} \ No newline at end of file diff --git a/tsconfig/tsconfig.wagmi.json b/tsconfig/tsconfig.wagmi.json index 20c976ab..7ea48738 100644 --- a/tsconfig/tsconfig.wagmi.json +++ b/tsconfig/tsconfig.wagmi.json @@ -11,7 +11,7 @@ "../packages/wagmi/**/*.bench.ts" ], "compilerOptions": { - "moduleResolution": "node", + "moduleResolution": "Bundler", "sourceMap": true, "rootDir": "../packages/wagmi" }, From a0730b515bf9e8b21dcfecfad546f41619f5eabe Mon Sep 17 00:00:00 2001 From: Garvit Khatri Date: Mon, 4 Nov 2024 12:13:58 +0000 Subject: [PATCH 3/3] Add changeset --- .changeset/funny-apricots-retire.md | 5 +++++ .changeset/funny-cherries-fold.md | 5 +++++ .changeset/slimy-panthers-complain.md | 5 +++++ 3 files changed, 15 insertions(+) create mode 100644 .changeset/funny-apricots-retire.md create mode 100644 .changeset/funny-cherries-fold.md create mode 100644 .changeset/slimy-panthers-complain.md diff --git a/.changeset/funny-apricots-retire.md b/.changeset/funny-apricots-retire.md new file mode 100644 index 00000000..d2e4df83 --- /dev/null +++ b/.changeset/funny-apricots-retire.md @@ -0,0 +1,5 @@ +--- +"@permissionless/wagmi": patch +--- + +Changed moduleResolution to Bundler for esm & types build diff --git a/.changeset/funny-cherries-fold.md b/.changeset/funny-cherries-fold.md new file mode 100644 index 00000000..0023a3f9 --- /dev/null +++ b/.changeset/funny-cherries-fold.md @@ -0,0 +1,5 @@ +--- +"permissionless": patch +--- + +Upgraded moduleResolution to nodenext for esm & types build diff --git a/.changeset/slimy-panthers-complain.md b/.changeset/slimy-panthers-complain.md new file mode 100644 index 00000000..06c9d4d4 --- /dev/null +++ b/.changeset/slimy-panthers-complain.md @@ -0,0 +1,5 @@ +--- +"@permissionless/wagmi": patch +--- + +Dropped support for cjs build