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

feat: sdk connector interface improvements, and more #202

Merged
merged 7 commits into from
Nov 27, 2024

Conversation

JackHamer09
Copy link
Member

@JackHamer09 JackHamer09 commented Nov 26, 2024

Description

SDK quality of life and typesafety improvements, as well as bug fixes for constraint abi indexes.

  • New zksyncSsoConnector interface:
import { zksyncSsoConnector, callPolicy } from "zksync-sso/connector";

zksyncSsoConnector({
  session: {
    expiry: "1 day", // human readable time

    contractCalls: [
      callPolicy({ // new helper function, provides type safety
        address: "0x...",
        abi: erc20Abi, // now have to provide abi
        functionName: "transfer", // typesafe function name
        constraints: [
          {
            index: 0,
            value: "0x6cC8cf7f6b488C58AA909B77E6e65c631c204784", // typesafe value, converted to abi bytes32 on SDK side
          },
          {
            index: 1,
            limit: {
              limit: 1n,
              period: "1 hour", // human readable time
            },
          },
        ],
      }),
    ],
  },
});
  • Added few additional wagmi methods, e.g. getConnectedSsoClient. It provides a way to get properly typed ZKsync SSO client, so that developers can access things like session key and other available parameters and methods.

Copy link

github-actions bot commented Nov 26, 2024

Visit the preview URL for this PR (updated for commit 8f6ec49):

https://zksync-auth-server-staging--pr202-improved-sdk-interfa-r02vtgz9.web.app

(expires Wed, 04 Dec 2024 09:50:29 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 509a9c9ea42583076f531c53cf2979c544d5d0b7

@JackHamer09 JackHamer09 changed the title Improved sdk interface feat: sdk connector interface improvements, and more Nov 26, 2024
@JackHamer09 JackHamer09 merged commit 42733c9 into old-main Nov 27, 2024
7 checks passed
@JackHamer09 JackHamer09 deleted the improved-sdk-interface branch November 27, 2024 09:53
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

Successfully merging this pull request may close these issues.

2 participants