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

Wrong types definition, Argument of type 'string' is not assignable to parameter of type '0x${ string} #358

Open
fewensa opened this issue Jan 26, 2025 · 3 comments

Comments

@fewensa
Copy link

fewensa commented Jan 26, 2025

After upgrade after 0.2.24 have lots of types error.

      ../../node_modules/permissionless/accounts/biconomy/toBiconomySmartAccount.ts(160,5
2): error TS2345: Argument of type 'string' is not assignable to parameter of type '`0x${
string}`'.
      ../../node_modules/permissionless/accounts/biconomy/toBiconomySmartAccount.ts(217,5
): error TS2322: Type '{ client: Client; entryPoint: { abi: Abi; address: string; version
: EntryPointVersion; }; extend?: object | undefined; getAddress: () => Promise<string>; .
.. 13 more ...; type: "smart"; }' is not assignable to type '{ client: Client; entryPoint
        The types of 'entryPoint.abi' are incompatible between these types.
          Type 'Abi' is not assignable to type 'readonly [{ readonly inputs: readonly [{
            Target requires 37 element(s) but source may have fewer.
      ../../node_modules/permissionless/accounts/biconomy/toBiconomySmartAccount.ts(270,9
        Type 'Promise<{ to: string; value: bigint; data: `0x${string}`; }[]>' is not assi
          Type '{ to: string; value: bigint; data: `0x${string}`; }[]' is not assignable
            Type '{ to: string; value: bigint; data: `0x${string}`; }' is not assignable
              Types of property 'to' are incompatible.
                Type 'string' is not assignable to type '`0x${string}`'.
      ../../node_modules/permissionless/accounts/etherspot/toEtherspotSmartAccount.ts(287
        Type 'Promise<readonly { to: string; value?: bigint | undefined; data?: `0x${stri
          Type 'readonly { to: string; value?: bigint | undefined; data?: `0x${string}` |
            Type '{ to: string; value?: bigint | undefined; data?: `0x${string}` | undefi
              Types of property 'to' are incompatible.
                Type 'string' is not assignable to type '`0x${string}`'.
      ../../node_modules/permissionless/accounts/etherspot/utils/getNonceKey.ts(12,13): e
      ../../node_modules/permissionless/accounts/kernel/toKernelSmartAccount.ts(35,62): e
      ../../node_modules/permissionless/accounts/kernel/toKernelSmartAccount.ts(209,49):
      ../../node_modules/permissionless/accounts/kernel/toKernelSmartAccount.ts(497,13):
      ../../node_modules/permissionless/accounts/kernel/toKernelSmartAccount.ts(548,15):
        Type 'Promise<readonly { to: string; value?: bigint | undefined; data?: `0x${stri
          Type 'readonly { to: string; value?: bigint | undefined; data?: `0x${string}` |
            Type '{ to: string; value?: bigint | undefined; data?: `0x${string}` | undefi
              Types of property 'to' are incompatible.
                Type 'string' is not assignable to type '`0x${string}`'.
      ../../node_modules/permissionless/accounts/kernel/utils/getNonceKey.ts(26,13): erro
      ../../node_modules/permissionless/accounts/kernel/utils/signMessage.ts(11,32): erro
      ../../node_modules/permissionless/accounts/light/toLightSmartAccount.ts(314,15): er
        Type 'Promise<{ to: string; value: bigint; data: `0x${string}`; }[]>' is not assi
          Type '{ to: string; value: bigint; data: `0x${string}`; }[]' is not assignable
            Type '{ to: string; value: bigint; data: `0x${string}`; }' is not assignable
              Types of property 'to' are incompatible.
                Type 'string' is not assignable to type '`0x${string}`'.
      ../../node_modules/permissionless/accounts/nexus/toNexusSmartAccount.ts(181,5): err
        The types of 'entryPoint.abi' are incompatible between these types.
          Type 'Abi' is not assignable to type 'readonly [{ readonly inputs: readonly [{
            Target requires 38 element(s) but source may have fewer.
      ../../node_modules/permissionless/accounts/nexus/toNexusSmartAccount.ts(217,17): er
      ../../node_modules/permissionless/accounts/nexus/toNexusSmartAccount.ts(225,29): er
        Type 'ByteArray' is not assignable to type 'string | number | bigint | boolean'.
      ../../node_modules/permissionless/accounts/nexus/toNexusSmartAccount.ts(239,15): er
        Type 'Promise<readonly { to: string; value?: bigint | undefined; data?: `0x${stri
          Type 'readonly { to: string; value?: bigint | undefined; data?: `0x${string}` |
            Type '{ to: string; value?: bigint | undefined; data?: `0x${string}` | undefi
              Types of property 'to' are incompatible.
                Type 'string' is not assignable to type '`0x${string}`'.
      ../../node_modules/permissionless/accounts/safe/signUserOperation.ts(92,17): error
      ../../node_modules/permissionless/accounts/safe/signUserOperation.ts(99,9): error T
        Type 'ByteArray' is not assignable to type '`0x${string}`'.
      ../../node_modules/permissionless/accounts/safe/toSafeSmartAccount.ts(509,13): erro
      ../../node_modules/permissionless/accounts/safe/toSafeSmartAccount.ts(572,17): erro
        Type '{ module: string; initData: string; }' is not assignable to type '{ module:
          Types of property 'initData' are incompatible.
            Type 'string' is not assignable to type '`0x${string}`'.
      ../../node_modules/permissionless/accounts/safe/toSafeSmartAccount.ts(576,17): erro
        Type '{ module: string; initData: string; }' is not assignable to type '{ module:
          Types of property 'initData' are incompatible.
            Type 'string' is not assignable to type '`0x${string}`'.
      ../../node_modules/permissionless/accounts/safe/toSafeSmartAccount.ts(580,17): erro
        Type '{ module: string; initData: string; }' is not assignable to type '{ module:
          Types of property 'initData' are incompatible.
            Type 'string' is not assignable to type '`0x${string}`'.
      ../../node_modules/permissionless/accounts/safe/toSafeSmartAccount.ts(714,21): erro
        Type '{ module: string; initData: string; }' is not assignable to type '{ module:
          Types of property 'initData' are incompatible.
            Type 'string' is not assignable to type '`0x${string}`'.
      ../../node_modules/permissionless/accounts/safe/toSafeSmartAccount.ts(762,15): erro
      ../../node_modules/permissionless/accounts/safe/toSafeSmartAccount.ts(1081,25): err
      ../../node_modules/permissionless/accounts/safe/toSafeSmartAccount.ts(1214,9): erro
        Type '{ to: string; data: string; value: bigint; }' is not assignable to type '{
          Types of property 'to' are incompatible.
            Type 'string' is not assignable to type '`0x${string}`'.
      ../../node_modules/permissionless/accounts/safe/toSafeSmartAccount.ts(1345,33): err
        Type '{ module: string; initData: string; }' is not assignable to type '{ module:
          Types of property 'initData' are incompatible.
            Type 'string' is not assignable to type '`0x${string}`'.
      ../../node_modules/permissionless/accounts/safe/toSafeSmartAccount.ts(1414,15): err
        Type 'Promise<readonly { to: string; value?: bigint | undefined; data?: `0x${stri
          Type 'readonly { to: string; value?: bigint | undefined; data?: `0x${string}` |
            Type '{ to: string; value?: bigint | undefined; data?: `0x${string}` | undefi
              Types of property 'to' are incompatible.
                Type 'string' is not assignable to type '`0x${string}`'.
      ../../node_modules/permissionless/accounts/simple/toSimpleSmartAccount.ts(295,9): e
        Type 'Promise<{ to: string; data: `0x${string}`; value?: bigint | undefined; }[]>
          Type '{ to: string; data: `0x${string}`; value?: bigint | undefined; }[]' is no
            Type '{ to: string; data: `0x${string}`; value?: bigint | undefined; }' is no
              Types of property 'to' are incompatible.
                Type 'string' is not assignable to type '`0x${string}`'.
      ../../node_modules/permissionless/accounts/thirdweb/toThirdwebSmartAccount.ts(162,1
        Type 'Promise<{ to: string; data: `0x${string}`; value?: bigint | undefined; }[]>
          Type '{ to: string; data: `0x${string}`; value?: bigint | undefined; }[]' is not assignable to type 'readonly Call[]'.
            Type '{ to: string; data: `0x${string}`; value?: bigint | undefined; }' is not assignable to type 'Call'.
              Types of property 'to' are incompatible.
                Type 'string' is not assignable to type '`0x${string}`'.
      ../../node_modules/permissionless/accounts/trust/toTrustSmartAccount.ts(144,17): error TS2322: Type 'string' is not assignable to type '`0x${string}`'.
      ../../node_modules/permissionless/accounts/trust/toTrustSmartAccount.ts(172,15): error TS2322: Type '(callData: `0x${string}`) => Promise<{ to: string; data: `0x${string}`; value?: bigint | undefined; }[]>' is not assignable to type '(data: `0x${string}`) => Promise<readonly Call[]>'.
        Type 'Promise<{ to: string; data: `0x${string}`; value?: bigint | undefined; }[]>' is not assignable to type 'Promise<readonly Call[]>'.
          Type '{ to: string; data: `0x${string}`; value?: bigint | undefined; }[]' is not assignable to type 'readonly Call[]'.
            Type '{ to: string; data: `0x${string}`; value?: bigint | undefined; }' is not assignable to type 'Call'.
              Types of property 'to' are incompatible.
                Type 'string' is not assignable to type '`0x${string}`'.
      ../../node_modules/permissionless/utils/encode7579Calls.ts(108,17): error TS2322: Type 'string' is not assignable to type '`0x${string}`'.
      ../../node_modules/permissionless/utils/getPackedUserOperation.ts(10,15): error TS2322: Type 'string' is not assignable to type '`0x${string}` | ByteArray'.
      ../../node_modules/permissionless/utils/getPackedUserOperation.ts(68,15): error TS2322: Type 'string' is not assignable to type '`0x${string}` | ByteArray'.
      ../../node_modules/permissionless/utils/getPackedUserOperation.ts(114,9): error TS2322: Type '`0x${string}` | ByteArray' is not assignable to type '`0x${string}`'.
        Type 'ByteArray' is not assignable to type '`0x${string}`'.
      ../../node_modules/permissionless/utils/getPackedUserOperation.ts(119,9): error TS2322: Type '`0x${string}` | ByteArray' is not assignable to type '`0x${string}`'.
        Type 'ByteArray' is not assignable to type '`0x${string}`'.
@plusminushalf
Copy link
Member

What is your viem version? And from which version did you upgrade from?

@fewensa
Copy link
Author

fewensa commented Jan 27, 2025

viem

viem@^2, viem@^2.21.57, viem@^2.21.8:
  version "2.22.3"
  resolved "https://registry.yarnpkg.com/viem/-/viem-2.22.3.tgz#8212f8ee8e2cecc362f63fcfb7518a87989d38f9"
  integrity sha512-lO8K4lL5vWfJ9dmeJo9BfwlJJ0vNDrgLXgwFJNzjLJ6eDfOGXr48yzNhqt96ybYS7SlM7ecT7yhJIVfhZLkOkw==
  dependencies:
    "@noble/curves" "1.7.0"
    "@noble/hashes" "1.6.1"
    "@scure/bip32" "1.6.0"
    "@scure/bip39" "1.5.0"
    abitype "1.0.7"
    isows "1.0.6"
    ox "0.6.0"
    webauthn-p256 "0.0.10"
    ws "8.18.0"

from 0.2.24 to 0.2.28

@plusminushalf
Copy link
Member

For [email protected] you will need viem@^2.21.54. Can you try upgrading viem and share the new error?

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

2 participants