Skip to content

Commit 447cd93

Browse files
committed
feat: attempt to use new dynamic contract addresses
When deploying the contracts, it should create the file, blocking the build
1 parent 019b677 commit 447cd93

File tree

6 files changed

+24
-25
lines changed

6 files changed

+24
-25
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ jobs:
4141
run: pnpm install -r --frozen-lockfile
4242
working-directory: packages/contracts
4343

44-
- name: Build SDK
45-
run: pnpm nx build sdk
46-
4744
- name: Build contracts
4845
run: pnpm build
4946
working-directory: packages/contracts
5047

5148
- name: Deploy contracts
52-
run: pnpm run deploy
49+
run: pnpm run deploy --file ../auth-server/stores/local-node.json
5350
working-directory: packages/contracts
5451

52+
- name: Build SDK
53+
run: pnpm nx build sdk
54+
5555
- name: Install zksync-foundry
5656
run: |
5757
wget -qc https://github.com/matter-labs/foundry-zksync/releases/download/nightly/foundry_nightly_linux_amd64.tar.gz -O - | tar -xz
@@ -115,17 +115,17 @@ jobs:
115115
run: pnpm install -r --frozen-lockfile
116116
working-directory: packages/contracts
117117

118-
- name: Build SDK
119-
run: pnpm nx build sdk
120-
121118
- name: Build contracts
122119
run: pnpm build
123120
working-directory: packages/contracts
124121

125122
- name: Deploy contracts
126-
run: pnpm run deploy
123+
run: pnpm run deploy --file ../auth-server/stores/local-node.json
127124
working-directory: packages/contracts
128125

126+
- name: Build SDK
127+
run: pnpm nx build sdk
128+
129129
- name: Deploy NFT contracts
130130
run: pnpm nx deploy:local nft-quest-contracts
131131

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ This monorepo is comprised of the following packages, products, and examples:
143143
# Compile and deploy contracts
144144
cd packages/contracts
145145
pnpm build
146-
pnpm run deploy
146+
pnpm run deploy --file ../auth-server/stores/local-node.json
147147
```
148148

149149
6. Start the demo application:

packages/auth-server/stores/client.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { zksyncInMemoryNode, zksyncSepoliaTestnet } from "viem/chains";
44
import { eip712WalletActions } from "viem/zksync";
55
import { createZksyncPasskeyClient, type PasskeyRequiredContracts } from "zksync-sso/client/passkey";
66

7+
import localChainData from "./local-node.json";
8+
79
export const supportedChains = [zksyncSepoliaTestnet, zksyncInMemoryNode];
810
export type SupportedChainId = (typeof supportedChains)[number]["id"];
911
export const blockExplorerUrlByChain: Record<SupportedChainId, string> = {
@@ -26,12 +28,7 @@ export const contractsByChain: Record<SupportedChainId, ChainContracts> = {
2628
accountFactory: "0x73CFa70318FD25F2166d47Af9d93Cf72eED48724",
2729
accountPaymaster: "0xA46D949858335308859076FA605E773eB679e534",
2830
},
29-
[zksyncInMemoryNode.id]: {
30-
session: "0xf6a233462E9bd4FE8092216FDcA56b7dfb27Fd32",
31-
passkey: "0xA62DBfA415026a54d21D6DffC42Ec730526F1E77",
32-
accountFactory: "0x9E2d664361eb7024E1FfdB8092Eec8198ddd8c33",
33-
accountPaymaster: "0x7bcfB1e5702cf0ad81fc128ECF8152C7c9a37c40",
34-
},
31+
[zksyncInMemoryNode.id]: localChainData,
3532
};
3633

3734
export const useClientStore = defineStore("client", () => {

packages/contracts

packages/sdk/src/client/passkey/actions/account.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ vi.mock("../../../utils/passkey.js", () => ({
1111
Buffer.from("0000000000000000000000000000000000000000000000000000000000000002", "hex"),
1212
]),
1313
base64UrlToUint8Array: vi.fn().mockReturnValue([
14-
Buffer.from("lWIw_JbKgvtxKTLAYtNkGDu55lvtvTaBEveBVeiTqaTf3wkajGocKNnfkT_rk6r7", "base64url"),
14+
Buffer.from("0000000000000000000000000000000000000000000000000000000000000003", "hex"),
1515
]),
1616
}));
1717

packages/sdk/src/utils/encoding.test.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ import { encodeModuleData, encodePasskeyModuleParameters } from "./encoding";
55
describe("encoding utils", () => {
66
describe("encodePasskeyModuleParameters", () => {
77
test("correctly encodes passkey parameters", () => {
8+
const passkey0 = "1234567890123456789012345678901234567890123456789012345678901234";
9+
const passkey1 = "abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd";
810
const passkey = {
9-
credentialId: "lWIw_JbKgvtxKTLAYtNkGDu55lvtvTaBEveBVeiTqaTf3wkajGocKNnfkT_rk6r7",
11+
credentialId: "unique-base64encoded-string",
1012
passkeyPublicKey: [
11-
Buffer.from("1234567890123456789012345678901234567890123456789012345678901234", "hex"),
12-
Buffer.from("abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd", "hex"),
13+
Buffer.from(passkey0, "hex"),
14+
Buffer.from(passkey1, "hex"),
1315
],
1416
expectedOrigin: "https://example.com",
1517
};
@@ -20,11 +22,11 @@ describe("encoding utils", () => {
2022
expect(encoded).toMatch(/^0x[0-9a-f]+$/i);
2123

2224
// Should contain both public key components and the origin
23-
expect(encoded).toContain("1234567890123456789012345678901234567890123456789012345678901234");
24-
expect(encoded).toContain("abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd");
25-
expect(encoded).toContain(Buffer.from("https://example.com").toString("hex"));
26-
expect(encoded).toContain(Buffer.from("lWIw_JbKgvtxKTLAYtNkGDu55lvtvTaBEveBVeiTqaTf3wkajGocKNnfkT_rk6r7", "base64url").toString("hex"));
27-
expect(encoded).toEqual("0x00000000000000000000000000000000000000000000000000000000000000801234567890123456789012345678901234567890123456789012345678901234abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000030956230fc96ca82fb712932c062d364183bb9e65bedbd368112f78155e893a9a4dfdf091a8c6a1c28d9df913feb93aafb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001368747470733a2f2f6578616d706c652e636f6d00000000000000000000000000");
25+
expect(encoded).toContain(passkey0);
26+
expect(encoded).toContain(passkey1);
27+
expect(encoded).toContain(Buffer.from(passkey.expectedOrigin).toString("hex"));
28+
expect(encoded).toContain(Buffer.from(passkey.credentialId, "base64url").toString("hex"));
29+
expect(encoded).toEqual("0x00000000000000000000000000000000000000000000000000000000000000801234567890123456789012345678901234567890123456789012345678901234abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000014ba78aab9ef9b6ac7bae1e9dca1d79dfacb6b8a78000000000000000000000000000000000000000000000000000000000000000000000000000000000000001368747470733a2f2f6578616d706c652e636f6d00000000000000000000000000");
2830
});
2931
});
3032

0 commit comments

Comments
 (0)