zerodevapp / sdk

MIT License
34 stars 32 forks source link

Compilation error with viem + permissionless.js + zerodev sdk on NestJS app #184

Open yaniferhaoui opened 6 days ago

yaniferhaoui commented 6 days ago

I've created this small project to let you reproduce the compilation errors: https://github.com/yaniferhaoui/viem-permissionless-zerodev-bug/

Running nest start --watch fail because of some compilation errors

node_modules/viem/utils/signature/hashTypedData.ts:151:44 - error TS2345: Argument of type 'unknown[]' is not assignable to parameter of type '(readonly (readonly (readonly (readonly (readonly (readonly (readonly (readonly (readonly (readonly (readonly ...[])[])[])[])[])[])[])[])[])[])[] | readonly (readonly (readonly (readonly (readonly any[])[])[])[])[])[]'.
  Type 'unknown' is not assignable to type 'readonly (readonly (readonly (readonly (readonly (readonly (readonly (readonly (readonly (readonly (readonly ...[])[])[])[])[])[])[])[])[])[])[] | readonly (readonly (readonly (readonly (readonly any[])[])[])[])[]'.

151   return encodeAbiParameters(encodedTypes, encodedValues)
                                               ~~~~~~~~~~~~~

node_modules/viem/utils/transaction/parseTransaction.ts:295:5 - error TS2322: Type 'ToBlobSidecarsReturnType<"bytes" | "hex">' is not assignable to type 'false | readonly BlobSidecar<`0x${string}`>[]'.
  Type 'BlobSidecars<Uint8Array>' is not assignable to type 'false | readonly BlobSidecar<`0x${string}`>[]'.
    Type 'BlobSidecar<Uint8Array>[]' is not assignable to type 'readonly BlobSidecar<`0x${string}`>[]'.
      Type 'BlobSidecar<Uint8Array>' is not assignable to type 'BlobSidecar<`0x${string}`>'.
        Type 'Uint8Array' is not assignable to type '`0x${string}`'.

295     transaction.sidecars = toBlobSidecars({
        ~~~~~~~~~~~~~~~~~~~~

node_modules/viem/utils/transaction/serializeTransaction.ts:248:7 - error TS2322: Type 'ToBlobSidecarsReturnType<"bytes" | "hex">' is not assignable to type 'false | readonly BlobSidecar<`0x${string}`>[]'.
  Type 'BlobSidecars<Uint8Array>' is not assignable to type 'false | readonly BlobSidecar<`0x${string}`>[]'.
    Type 'BlobSidecar<Uint8Array>[]' is not assignable to type 'readonly BlobSidecar<`0x${string}`>[]'.
      Type 'BlobSidecar<Uint8Array>' is not assignable to type 'BlobSidecar<`0x${string}`>'.
        Type 'Uint8Array' is not assignable to type '`0x${string}`'.

248       sidecars = toBlobSidecars({ blobs, commitments, proofs })
          ~~~~~~~~

[5:38:52 PM] Found 322 errors. Watching for file changes.
jxom commented 4 days ago

Should be resolved via https://github.com/yaniferhaoui/viem-permissionless-zerodev-bug/pull/1