permissionless.js
permissionless.js copied to clipboard
Compile error This expression is not callable. Type 'never' has no call signatures.
I am getting this error when running npm run build for my nodejs app
node_modules/permissionless/utils/getAction.ts:10:9 - error TS2349: This expression is not callable. Type 'never' has no call signatures.
10 ( ~ 11 client as Client & { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ... 13 } ~~~~~~~~~~~~~ 14 )[actionName]?.(...params) ?? action(client, ...params) ~~~~~~~~~~~~~~~~~~~~~
Found 1 error in node_modules/permissionless/utils/getAction.ts:10
Here is my ts.config file
{
"compilerOptions": {
"module": "CommonJS",
"target": "ES2021",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"outDir": "./build",
"sourceMap": true,
"skipLibCheck": true,
"resolveJsonModule":true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"]
}
on it!
Hey! Can you share the code? Also, try to use the tsconfig.json from the tutorial. Using es2022 may help.
I have tried that but still getting similar errors
here is the code we are using for AA through ZeroDev SDK
import { polygonMumbai, polygon } from "viem/chains"
import { createPublicClient, http, Hex, keccak256, toHex } from "viem"
import { getKernelAddressFromECDSA } from "@zerodev/ecdsa-validator"
import { BlockchainTypes, ContractEnvironment } from "@mentaport/serverless-common"
import { getCertificatesBlockchainEnv } from "./blockchainEnv"
/**
* Function to create a wallet from an email using account abstraction
*
* @param {email} email of user
*
* @returns {string} Returns smart contract wallet address
*/
export async function generateWalletFromEmail(email:string, environment: ContractEnvironment, chain: BlockchainTypes):Promise<string> {
const config = getCertificatesBlockchainEnv(environment,chain);
// hash the customer email and convert to BigInt so always same index
const index = BigInt(keccak256(toHex(email)));
const publicClient = createPublicClient({
chain: environment === ContractEnvironment.Mainnet ? polygon : polygonMumbai,
transport: http(config.RPC_URL),
});
const smartAccountAddress = await getKernelAddressFromECDSA({
publicClient,
eoaAddress: config.eoaAddress as Hex,
index
});
return smartAccountAddress;
}
Can't reproduce without these dependencies
import { BlockchainTypes, ContractEnvironment } from "@mentaport/serverless-common"
import { getCertificatesBlockchainEnv } from "./blockchainEnv"
Also, it seems that you forgot to pass entryPointAddress to a getKernelAddressFromECDSA.
@pavlovdog I am not sure what you meant by pass entryPointAddress to getKernelAddressFromECDSA
according to ZeroDev documentation the params to be passed to getKernelAddressFromECDSA are
type GetKernelAddressFromECDSAParams =
| {
publicClient: PublicClient
eoaAddress: Address
index: bigint
}
| {
eoaAddress: Address
index: bigint
initCodeHash: Hex
}
@pavlovdog to reproduce here is a modified version of the code
import { polygon, polygonAmoy } from "viem/chains"
import { createPublicClient, http, Hex, keccak256, toHex } from "viem"
import { getKernelAddressFromECDSA } from "@zerodev/ecdsa-validator"
/**
* Function to create a wallet from an email using account abstraction
*
* @param {email} email of user
*
* @returns {string} Returns smart contract wallet address
*/
export async function generateWalletFromEmail(email:string):Promise<string> {
// hash the customer email and convert to BigInt so always same index
const index = BigInt(keccak256(toHex(email)));
const publicClient = createPublicClient({
chain: polygonAmoy,
transport: http(`https://polygon-amoy.g.alchemy.com/v2/${API_KEY}`),
});
const smartAccountAddress = await getKernelAddressFromECDSA({
publicClient,
eoaAddress: 'ANY EOA ADDRESS',
index
});
return smartAccountAddress;
}
I still can't reproduce this, it works on my setup. Can you share the minimal repo, including all the involved versions (node/package manager/etc) and a run command?
Hi, I have this kind of compile error me too, did you figured out the solution @asghaiermp ?
This is not relevant post [email protected]