diff --git a/README.md b/README.md index e9a1d5c2..6cbded1f 100644 --- a/README.md +++ b/README.md @@ -45,12 +45,22 @@ const ssoConnector = zksyncSsoConnector({ // Allow up to 0.1 ETH to be spend in gas fees feeLimit: parseEther("0.1"), - // Allow ETH transfers to a specific address: transfers: [ + // Allow ETH transfers of up to 0.1 ETH to specific address { to: "0x188bd99cd7D4d78d4E605Aeea12C17B32CC3135A", valueLimit: parseEther("0.1"), }, + + // Allow ETH transfers to specific address with a limit of 0.1 ETH per hour + // until the session expires + { + to: "0x188bd99cd7D4d78d4E605Aeea12C17B32CC3135A", + valueLimit: { + limit: parseEther("0.1"), + period: BigInt(60 * 60), // 1 hour in seconds + }, + }, ], // Allow calling specific smart contracts (e.g. ERC20 transfer): @@ -61,21 +71,21 @@ const ssoConnector = zksyncSsoConnector({ // Optional call constraints (unconstrained otherwise): constraints: [ + // Only allow transfers to this address { index: 0, condition: "Equal", - refValue: "0x6cC8cf7f6b488C58AA909B77E6e65c631c204784", + refValue: pad("0x6cC8cf7f6b488C58AA909B77E6e65c631c204784", { size: 32 }), }, - // Limit the transfer amount to 0.1 tokens + // Transfer up to 0.2 tokens { index: 1, - condition: "LessEqual", - refValue: toHex(parseUnits("0.1", TOKEN.decimals), { size: 32 }), + limit: parseUnits("0.2", TOKEN.decimals), // Unlimited if omitted }, ], - } + }, ], }, }); diff --git a/cspell-config/cspell-packages.txt b/cspell-config/cspell-packages.txt index fffbaff2..202acb85 100644 --- a/cspell-config/cspell-packages.txt +++ b/cspell-config/cspell-packages.txt @@ -4,3 +4,4 @@ viem wagmi cbor levischuck +ofetch diff --git a/examples/bank-demo/nuxt.config.ts b/examples/bank-demo/nuxt.config.ts index acc99afa..e7fe5267 100644 --- a/examples/bank-demo/nuxt.config.ts +++ b/examples/bank-demo/nuxt.config.ts @@ -49,5 +49,15 @@ export default defineNuxtConfig({ explorerUrl: "http://34.121.229.57:3010/", } } - } + }, + vite: { + css: { + preprocessorOptions: { + scss: { + // Fix deprecation warnings with modern API + api: "modern", + }, + }, + }, + }, }); diff --git a/examples/demo-app/nuxt.config.ts b/examples/demo-app/nuxt.config.ts index b836c1ab..1bf5d31f 100644 --- a/examples/demo-app/nuxt.config.ts +++ b/examples/demo-app/nuxt.config.ts @@ -7,7 +7,7 @@ export default defineNuxtConfig({ modules: ["@nuxt/eslint", "@pinia/nuxt", "@nuxtjs/tailwindcss", "@nuxtjs/google-fonts"], app: { head: { - title: "ZKsync SSO Demo App", + title: "ZKsync SSO Demo", link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }], }, }, @@ -34,4 +34,14 @@ export default defineNuxtConfig({ }, }, }, + vite: { + css: { + preprocessorOptions: { + scss: { + // Fix deprecation warnings with modern API + api: "modern", + }, + }, + }, + }, }); diff --git a/examples/demo-app/pages/index.vue b/examples/demo-app/pages/index.vue index 7a16c725..5e98fca0 100644 --- a/examples/demo-app/pages/index.vue +++ b/examples/demo-app/pages/index.vue @@ -16,14 +16,14 @@

Connected Address: {{ address }}

-

Balance: {{ balance.formatted }} {{ balance.symbol }}

+

Balance: {{ balance ? `${balance.formatted} ${balance.symbol}` : '...' }}