Skip to content

Commit a3c4618

Browse files
authored
Publish connector (#172)
* fix: re-add the removed publish steps Want to actually test the publish * fix: update step names Installs correctly, but auth-server is missing deps * fix: add snarkjs to public folder Was failing oidc * fix: update linting and addresses * fix: more linting errors in the copy script * fix: code review comments * fix: more linting errors
1 parent 7f139d7 commit a3c4618

File tree

12 files changed

+242
-48
lines changed

12 files changed

+242
-48
lines changed

.github/workflows/deploy-package.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,20 @@ jobs:
5151
- name: Build the package
5252
run: pnpm nx build sdk
5353

54-
# - name: Build the connector-export package
55-
# run: pnpm nx build connector-export
54+
- name: Build the wagmi-connector package
55+
run: pnpm nx build connector-export
5656

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

63-
# - name: Prepare connector-export package.json
64-
# working-directory: packages/connector-export
65-
# run: node prepare-package.mjs
66-
# env:
67-
# INPUT_VERSION: ${{ github.event.inputs.version }}
63+
- name: Prepare wagmi connector package.json
64+
working-directory: packages/connector-export
65+
run: node prepare-package.mjs
66+
env:
67+
INPUT_VERSION: ${{ github.event.inputs.version }}
6868

6969
- name: Create .npmrc for NPM
7070
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPMJS_NPM_MATTERLABS_AUTOMATION_TOKEN }}" > ~/.npmrc
@@ -84,7 +84,7 @@ jobs:
8484
working-directory: packages/sdk
8585
run: npm publish --access public --tag ${{ steps.npm_tag.outputs.tag }}
8686

87-
- name: Publish connector-export to NPM
87+
- name: Publish wagmi connector to NPM
8888
working-directory: packages/connector-export
8989
run: npm publish --access public --tag ${{ steps.npm_tag.outputs.tag }}
9090

@@ -101,9 +101,9 @@ jobs:
101101
npm pkg set name="@matter-labs/zksync-sso"
102102
npm publish --registry=https://npm.pkg.github.com --tag ${{ steps.npm_tag.outputs.tag }}
103103
104-
- name: Publish connector-export to GitHub Packages
104+
- name: Publish wagmi connector to GitHub Packages
105105
working-directory: packages/connector-export
106106
run: |
107107
# Update package name for GitHub Packages to be scoped to the organization
108-
npm pkg set name="@matter-labs/zksync-sso-connector-export"
108+
npm pkg set name="@matter-labs/zksync-sso-wagmi-connector"
109109
npm publish --registry=https://npm.pkg.github.com --tag ${{ steps.npm_tag.outputs.tag }}

.vscode/mcp.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
{
2-
"servers": {
3-
"nx-mcp": {
4-
"type": "sse",
5-
"url": "http://localhost:9100/sse"
6-
}
7-
}
2+
"servers": {}
83
}

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ COPY --from=build /prod/oidc-server /prod/oidc-server
1616
WORKDIR /prod/oidc-server
1717
COPY --from=build /usr/src/app/packages/oidc-server/dist ./dist
1818
ENV SALT_SERVICE_PORT=3003
19-
EXPOSE 3003
19+
# Expose main service port and Prometheus metrics port
20+
EXPOSE 3003 9090
2021
CMD [ "node", "dist/salt-service.js" ]
2122

2223
FROM oidc-server AS key-registry

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
},
5656
"packageManager": "pnpm@9.11.0",
5757
"dependencies": {
58-
"prettier-plugin-solidity": "^1.4.1"
58+
"prettier-plugin-solidity": "^1.4.1",
59+
"snarkjs": "^0.7.5"
5960
}
6061
}

packages/auth-server/nuxt.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ export default defineNuxtConfig({
8080
appKitProjectId: process.env.NUXT_PUBLIC_APPKIT_PROJECT_ID || "9bc5059f6eed355858cc56a3388e9b50",
8181
oidc: {
8282
googlePublicClient: "866068535821-e9em0h73pee93q4evoajtnnkldsjhqdk.apps.googleusercontent.com",
83-
saltServiceUrl: process.env.NUXT_PUBLIC_SALT_SERVICE_URL,
84-
zkeyUrl: process.env.NUXT_PUBLIC_ZKEY_URL,
85-
witnessUrl: process.env.NUXT_PUBLIC_WITNESS_WASM_URL,
83+
saltServiceUrl: process.env.NUXT_PUBLIC_SALT_SERVICE_URL || "https://salt.zksync-sso.com",
84+
zkeyUrl: process.env.NUXT_PUBLIC_ZKEY_URL || "https://zkey.zksync-sso.com",
85+
witnessUrl: process.env.NUXT_PUBLIC_WITNESS_WASM_URL || "https://witness.zksync-sso.com",
8686
},
8787
},
8888
},

packages/auth-server/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"private": true,
44
"type": "module",
55
"scripts": {
6-
"postinstall": "nuxt prepare"
6+
"postinstall": "nuxt prepare && pnpm run copy:snarkjs",
7+
"copy:snarkjs": "node ./scripts/copy-snarkjs.mjs"
78
},
89
"dependencies": {
910
"@heroicons/vue": "^2.1.5",
@@ -36,6 +37,7 @@
3637
"vue": "latest",
3738
"wagmi": "^2.12.17",
3839
"web3-avatar-vue": "^1.0.4",
40+
"snarkjs": "^0.7.5",
3941
"zksync-sso": "workspace:*",
4042
"zksync-sso-circuits": "workspace:*",
4143
"zod": "^3.24.1"

packages/auth-server/project.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"executor": "nx:run-commands",
77
"options": {
88
"cwd": "packages/auth-server",
9-
"command": "PORT=3002 nuxt dev"
9+
"command": "pnpm run copy:snarkjs && PORT=3002 nuxt dev"
1010
},
1111
"dependsOn": ["^build", "zksync-sso-contracts:deploy", "nft-quest-contracts:deploy:local"]
1212
},
@@ -24,7 +24,7 @@
2424
"cwd": "packages/auth-server",
2525
"commands": [
2626
{
27-
"command": "pnpm nuxt generate"
27+
"command": "pnpm run copy:snarkjs && pnpm nuxt generate"
2828
}
2929
]
3030
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/usr/bin/env node
2+
import { copyFileSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
3+
import { createRequire } from "node:module";
4+
import { dirname, join, resolve } from "node:path";
5+
import { fileURLToPath } from "node:url";
6+
7+
function main() {
8+
// Resolve the path to snarkjs browser bundle
9+
// Resolve snarkjs package base
10+
let baseDir;
11+
try {
12+
// Prefer import.meta.resolve for pure ESM; fallback to createRequire for older Node versions
13+
let pkgJsonPath;
14+
if (typeof import.meta.resolve === "function") {
15+
const resolvedUrl = import.meta.resolve("snarkjs/package.json");
16+
pkgJsonPath = fileURLToPath(resolvedUrl);
17+
} else {
18+
const require = createRequire(import.meta.url);
19+
pkgJsonPath = require.resolve("snarkjs/package.json");
20+
}
21+
baseDir = dirname(pkgJsonPath);
22+
} catch (e) {
23+
console.warn("[copy-snarkjs] snarkjs not installed yet; skipping copy", e);
24+
return; // don't fail install, maybe another step will install it
25+
}
26+
const candidateRelPaths = ["dist/web/snarkjs.min.js", "dist/snarkjs.min.js", "build/snarkjs.min.js"];
27+
let src;
28+
for (const rel of candidateRelPaths) {
29+
const cand = join(baseDir, rel);
30+
if (existsSync(cand)) {
31+
src = cand;
32+
break;
33+
}
34+
}
35+
if (!src) {
36+
// Last resort: scan first level dirs for snarkjs.min.js
37+
try {
38+
const entries = readdirSync(baseDir, { withFileTypes: true });
39+
for (const ent of entries) {
40+
if (ent.isDirectory()) {
41+
const cand = join(baseDir, ent.name, "snarkjs.min.js");
42+
if (existsSync(cand)) {
43+
src = cand;
44+
break;
45+
}
46+
}
47+
}
48+
} catch (e) {
49+
console.warn("[copy-snarkjs] Error scanning for snarkjs.min.js", e);
50+
}
51+
}
52+
if (!src) {
53+
console.warn(
54+
"[copy-snarkjs] Could not locate snarkjs.min.js inside package; looked in: " + candidateRelPaths.join(", "),
55+
);
56+
return;
57+
}
58+
const __filename = fileURLToPath(import.meta.url);
59+
const __dirname = dirname(__filename);
60+
const destDir = resolve(__dirname, "../public");
61+
const dest = resolve(destDir, "snarkjs.min.js");
62+
63+
try {
64+
statSync(destDir);
65+
} catch {
66+
mkdirSync(destDir, { recursive: true });
67+
}
68+
if (existsSync(dest)) {
69+
try {
70+
const srcStat = statSync(src);
71+
const destStat = statSync(dest);
72+
if (destStat.mtimeMs >= srcStat.mtimeMs) {
73+
console.log("[copy-snarkjs] Existing snarkjs.min.js is up to date");
74+
return;
75+
}
76+
} catch (e) {
77+
console.warn("[copy-snarkjs] Error checking existing snarkjs.min.js", e);
78+
}
79+
}
80+
copyFileSync(src, dest);
81+
console.log(`[copy-snarkjs] Copied ${src} -> ${dest}`);
82+
}
83+
84+
main();
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"beacon": "0xDfD52B58c321Ba2fa0C4D0f281B884Fcba56c803",
3-
"session": "0x1660a46e1405d53A0abc98C330666c1455815418",
4-
"passkey": "0xDdB1e5ECd29aAC588E0fb0a7eAB1b589fE7D7dcD",
5-
"accountFactory": "0x816982130eDE57B11D3B60984a8874B0d22CC5F5",
6-
"accountPaymaster": "0x4842668C02757e4Eac60dAceB6374CE7F752e3c8",
7-
"recovery": "0xFB55FFb34f002e393232dC28EC27E3F8e8a423d1",
8-
"recoveryOidc": "0x2f99523C6165b92b790A4379dC4e49295b51f57A",
9-
"oidcKeyRegistry": "0x16A346FD3B6cEBF0C1DBf2E10cB66aCD95921115"
2+
"beacon": "0x40f5C447f510d834e2b1fF3f54830CE0B4a157da",
3+
"session": "0x031f5d8f86afE1d6011Dc3F3E8d27E274fbCEB13",
4+
"passkey": "0x0A39934c490546FF547A102f378876e625C9610f",
5+
"accountFactory": "0x799B1252B0a05e17daDb23E19553611997e1aAFE",
6+
"accountPaymaster": "0xebC6385457c82f764b18d3e36a5EA18617340aC4",
7+
"recovery": "0x6EdDCe98684947C563408198144E3C05823910Eb",
8+
"recoveryOidc": "0x25441b19ba5A049684Ecc8d40B72400E7B80DA7C",
9+
"oidcKeyRegistry": "0xDcF51c2486282F04447d8aaeCA0F23d36BFe9833"
1010
}

packages/oidc-server/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"express-rate-limit": "^7.5.0",
2828
"install": "^0.13.0",
2929
"jose": "^5.9.6",
30+
"prom-client": "^15.1.0",
3031
"viem": "^2.22.19",
3132
"zksync-sso": "workspace:*",
3233
"zksync-sso-circuits": "workspace:*",

0 commit comments

Comments
 (0)