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

Compile error This expression is not callable. Type 'never' has no call signatures. #162

Open
asghaiermp opened this issue Apr 9, 2024 · 8 comments
Assignees

Comments

@asghaiermp
Copy link

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"]
}
@kristofgazso
Copy link
Contributor

on it!

@pavlovdog
Copy link
Contributor

pavlovdog commented Apr 10, 2024

Hey! Can you share the code? Also, try to use the tsconfig.json from the tutorial. Using es2022 may help.

@asghaiermp
Copy link
Author

asghaiermp commented Apr 12, 2024

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;
}

@pavlovdog
Copy link
Contributor

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.

@asghaiermp
Copy link
Author

@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
      }

@asghaiermp
Copy link
Author

@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;
}

@pavlovdog
Copy link
Contributor

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?

@yaniferhaoui
Copy link

Hi, I have this kind of compile error me too, did you figured out the solution @asghaiermp ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants