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

fix: update zksync account to sso, sdk package deployment workflow, remove verdaccio #186

Merged
merged 13 commits into from
Nov 19, 2024
Merged
46 changes: 46 additions & 0 deletions .github/workflows/deploy-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy NPM Package

on:
workflow_dispatch:
inputs:
version:
description: "Version to publish (e.g., 1.0.0)"
default: "1.0.0"
required: true

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.11.0

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: lts/Iron
cache: 'pnpm'

- name: Install dependencies
run: pnpm install -r --frozen-lockfile

- name: Build the package
run: pnpm nx build sdk

- name: Prepare package.json
working-directory: packages/sdk
run: node prepare-package.mjs
env:
INPUT_VERSION: ${{ github.event.inputs.version }}

- name: Create .npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPMJS_NPM_MATTERLABS_AUTOMATION_TOKEN }}" > ~/.npmrc

- name: Publish to NPM
working-directory: packages/sdk
run: npm publish --access public
28 changes: 0 additions & 28 deletions .verdaccio/config.yml

This file was deleted.

35 changes: 5 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ Add ZKsync SSO connector to your app (using `wagmi`):
```ts
import { zksyncSepoliaTestnet } from "viem/chains";
import { createConfig, connect } from "@wagmi/core";
import { zksyncAccountConnector } from "zksync-sso/connector";
import { zksyncSsoConnector } from "zksync-sso/connector";

const ssoConnector = zksyncAccountConnector({
const ssoConnector = zksyncSsoConnector({
// Optional session configuration, if omitted user will have to sign every transaction via Auth Server
session: {
// Allow up to 0.1 ETH to be spend in gas fees
Expand Down Expand Up @@ -117,34 +117,9 @@ This monorepo is comprised of the following packages, products, and examples:
pnpm install
```

You have two options for using the SDK in the monorepo workspaces, via PNPM
workspace protocol or using Verdaccio. The project is currently configured to
use the SDK package via PNPM. If you want to use the SDK outside of the monorepo
in another local project, setup the Verdaccio option to easily use the SDK
package.

### Using the SDK package via PNPM

PNPM provides a way to "link" workspaces together via `package.json`
dependencies using the
[Workspace protocol](https://pnpm.io/workspaces#workspace-protocol-workspace).

### Using the SDK package locally via Verdaccio

2. Start up the Verdaccio proxy registry.

```bash
pnpm run registry
```

3. Publish the SDK package to your proxy registry.

```bash
pnpm nx publish:local sdk
```

4. Edit the respective `package.json` dependency for the SDK to use the version
that is published to Verdaccio.
2. If creating new packages: use pnpm and
[workspace protocol](https://pnpm.io/workspaces#workspace-protocol-workspace)
to link SDK in the new folder.

## Running commands

Expand Down
1 change: 0 additions & 1 deletion cspell-config/cspell-misc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ nuxt
Nuxt
nuxtjs
testid
verdaccio
vueuse

// examples/bank-demo
Expand Down
4 changes: 2 additions & 2 deletions docs/sdk/client-auth-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ your application. It's built on top of [client SDK](../client/README.md) and
```ts
import { zksync } from "viem/chains";
import { createConfig, connect } from "@wagmi/core";
import { zksyncAccountConnector } from "zksync-sso/connector";
import { zksyncSsoConnector } from "zksync-sso/connector";

const ssoConnector = zksyncAccountConnector({
const ssoConnector = zksyncSsoConnector({
// Optional session configuration
session: {
feeLimit: parseEther("0.1"),
Expand Down
51 changes: 0 additions & 51 deletions docs/verdaccio.md

This file was deleted.

4 changes: 2 additions & 2 deletions examples/demo-app/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@

<script lang="ts" setup>
import { disconnect, getBalance, watchAccount, sendTransaction, createConfig, connect, reconnect, type GetBalanceReturnType } from "@wagmi/core";
import { zksyncAccountConnector } from "zksync-sso/connector";
import { zksyncSsoConnector } from "zksync-sso/connector";
import { zksyncInMemoryNode } from "@wagmi/core/chains";
import { createWalletClient, http, parseEther, type Address } from "viem";
import { privateKeyToAccount } from "viem/accounts";
const testTransferTarget = "0x55bE1B079b53962746B2e86d12f158a41DF294A6";
const zksyncConnector = zksyncAccountConnector({
const zksyncConnector = zksyncSsoConnector({
authServerUrl: "http://localhost:3002/confirm",
session: {
feeLimit: parseEther("0.1"),
Expand Down
4 changes: 2 additions & 2 deletions examples/nft-quest/stores/connector.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { connect, createConfig, type CreateConnectorFn, disconnect, getAccount, http, reconnect, watchAccount } from "@wagmi/core";
import { zksyncInMemoryNode, zksyncLocalNode, zksyncSepoliaTestnet } from "@wagmi/core/chains";
import { type Address, type Hash, parseEther } from "viem";
import { zksyncAccountConnector } from "zksync-sso/connector";
import { zksyncSsoConnector } from "zksync-sso/connector";

export const useConnectorStore = defineStore("connector", () => {
const runtimeConfig = useRuntimeConfig();
Expand All @@ -14,7 +14,7 @@ export const useConnectorStore = defineStore("connector", () => {
type SupportedChainId = (typeof supportedChains)[number]["id"];
if (!chain) throw new Error(`Chain with id ${runtimeConfig.public.chain.id} was not found in supported chains list`);

const connector = zksyncAccountConnector({
const connector = zksyncSsoConnector({
metadata: {
name: "ZK NFT Quest",
icon: `${runtimeConfig.public.baseUrl}/favicon.svg`,
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
],
"scripts": {
"prepare": "husky",
"registry": "pnpm nx local-registry",
"graph": "pnpm nx graph",
"dev:demo": "pnpm nx run-many -t serve -p auth-server demo-app",
"fmt": "pnpm prettier --write .",
Expand Down Expand Up @@ -49,7 +48,6 @@
"prettier": "3.3.3",
"typescript": "5.6.2",
"typescript-eslint": "8.7.0",
"verdaccio": "6.0.0",
"viem": "^2.21.14",
"zksync-sso": "workspace:*"
},
Expand Down
92 changes: 0 additions & 92 deletions packages/contracts/test/sdk/PasskeyClient.ts

This file was deleted.

17 changes: 17 additions & 0 deletions packages/sdk/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Ignore everything by default
*

# Include specific files and folders
!dist/
!src/
!README.md

# Ignore unnecessary files
.gitignore
.lintstagedrc.js
eslint.config.js
prepare-package.mjs
project.json
tsconfig.json
tsconfig.base.json
*.tsbuildinfo
4 changes: 2 additions & 2 deletions packages/sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# zksync-sso-sdk
# zksync-sso

ZKsync Account SDK
ZKsync SSO SDK
3 changes: 2 additions & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"private": true,
"type": "module",
"name": "zksync-sso",
"description": "ZKsync Smart Sign On SDK",
Expand All @@ -10,7 +11,7 @@
"author": "Matter Labs",
"repository": {
"type": "git",
"url": "https://github.com/matter-labs/zksync-account-sdk.git"
"url": "git+https://github.com/matter-labs/zksync-sso.git"
},
"scripts": {
"build": "npm run clean && npm run build:esm && npm run build:cjs && npm run build:types",
Expand Down
Loading
Loading