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

verifyEIP6492Signature params type incompatible with OP stack chains #181

Open
freeatnet opened this issue Aug 26, 2024 · 0 comments
Open

Comments

@freeatnet
Copy link

freeatnet commented Aug 26, 2024

Steps to reproduce:

  1. Set up a TypeScript project with the latest @zerodev/sdk (just the package, no client-side required).
  2. Write code to verify a signature with verifyEIP6492Signature (example below).

Expected: code should compile.
Observed: TypeScript error when client is an OP stack chain client.

Package versions:

  • @zerodev/sdk: 5.3.10
  • viem: 2.17.0 (due to permissionless requiring viem < 2.18.0)

Triage:
It appears that viem expects a generic to be used to type the PublicClient instance correctly.

Repro code

import { verifyEIP6492Signature } from "@zerodev/sdk";
import { createPublicClient, http } from "viem";
import { arbitrum, base, mainnet, optimism } from "viem/chains";

const mainnetPublicClient = createPublicClient({
  chain: mainnet,
  transport: http(),
});

const arbPublicClient = createPublicClient({
  chain: arbitrum,
  transport: http(),
});

const optPublicClient = createPublicClient({
  chain: optimism,
  transport: http(),
});

const basePublicClient = createPublicClient({
  chain: base,
  transport: http(),
});

const SIGNATURE_PARAMS = {
  signer: "0x3535353535353535353535353535353535353535",
  hash: "0x35353535353535353535353535353535353535353535353535353535353535353535353535353535",
  signature:
    "0x35353535353535353535353535353535353535353535353535353535353535353535353535353535",
} as const;

void verifyEIP6492Signature({
  ...SIGNATURE_PARAMS,
  client: mainnetPublicClient, // OK
});

void verifyEIP6492Signature({
  ...SIGNATURE_PARAMS,
  client: arbPublicClient, // OK
});

void verifyEIP6492Signature({
  ...SIGNATURE_PARAMS,
  client: optPublicClient, // ERR: not assignable to type
});

void verifyEIP6492Signature({
  ...SIGNATURE_PARAMS,
  client: basePublicClient, // ERR: not assignable to type
});

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
@freeatnet and others