Skip to content

ODIS page: update the WalletKeySigner example for @celo/identity 6.0 #2365

Open

Description

@palango

The WalletKeySigner example in tooling/libraries-sdks/contractkit/odis.mdx (prose on line 41, code on lines 43-48) uses the @celo/identity 5.x API. It does not work with 6.0.

The example passes a ContractKit instance:

const authSigner: AuthSigner = {
  authenticationMethod: OdisUtils.Query.AuthenticationMethod.WALLET_KEY,
  contractKit,
};

In 6.0, WalletKeySigner has no contractKit field. It takes a sign191 function that signs the message with EIP-191 and returns the signature. From lib/odis/query.d.ts in 6.0.0-beta.0:

export interface WalletKeySigner {
    authenticationMethod: AuthenticationMethod.WALLET_KEY;
    sign191: ({ message, account }: { message: SignableMessage; account: Address }) => Promise<Hex>;
}

The types come from viem, and @celo/contractkit is now an optional peer dependency. The social-connect changeset .changeset/nasty-forks-tell.md describes the change, and the social-connect README uses the new form:

const authSigner: AuthSigner = {
  authenticationMethod: OdisUtils.Query.AuthenticationMethod.WALLET_KEY,
  sign191: ({ message, account }) => viemClient.signMessage({ message, account }),
};

Copied into a 6.0 project, the current example fails to type-check. Plain JavaScript gets further and then fails when the library calls signer.sign191. The sentence on line 41 ("passing in a contractkit instance with the account unlocked") is wrong for 6.0 too. The EncryptionKeySigner example on lines 34-39 works in both versions.

This can't change yet. npm latest is still 5.1.2, and 6.0 is published only as 6.0.0-beta.0 under the beta tag, so switching the example now would break it for everyone on the stable release. #2346 left it alone for that reason, although the page already says the Celo Sepolia contexts need 6.0.0-beta.0 or later.

When @celo/identity 6.0.0 ships as latest:

  • Replace the contractKit example with the sign191 form and rewrite line 41 to match.
  • Check the rest of the page against the 6.0 types. The changeset says many fields that were string are now 0x-string typed.
  • Change "6.0.0-beta.0 and later" to the stable version.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions