diff --git a/.gitignore b/.gitignore index 90c427d..f0dacfa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ test-results node_modules dist +.turbo # Output .output diff --git a/.prettierignore b/.prettierignore index ab78a95..15eae14 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,3 +2,4 @@ package-lock.json pnpm-lock.yaml yarn.lock +.turbo \ No newline at end of file diff --git a/README.md b/README.md index a9ab571..61880b1 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ yarn add @kredeum/wagmi-svelte5 ## Quick Start ```typescript -import { createConfig } from '@kredeum/wagmi-svelte5'; +import { createConfig } from "@kredeum/wagmi-svelte5"; // Configure your Web3 settings const config = createConfig({ @@ -38,7 +38,7 @@ const config = createConfig({ ```svelte @@ -75,4 +75,4 @@ MIT License - see the [LICENSE](LICENSE) file for details. ## Author -zapaz.eth (http://labs.kredeum.com/) \ No newline at end of file +zapaz.eth (http://labs.kredeum.com/) diff --git a/package.json b/package.json index f42bcae..f61edde 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "@kredeum/wagmi-svelte5", "version": "0.1.5", + "type": "module", "description": "Svelte5 Web3 library based on Wagmi", "keywords": [ "svelte", @@ -25,20 +26,28 @@ "sideEffects": [ "**/*.css" ], - "type": "module", + "packageManager": "pnpm@9.12.3", + "engines": { + "node": "^22", + "pnpm": "^9" + }, "scripts": { "all": "pnpm run setup && pnpm run format && pnpm run check && pnpm run build && pnpm run test && pnpm run dev", "clean": "rm -rf node_modules .pnpm-lock.yaml .svelte-kit dist", "setup": "pnpm run clean && pnpm install", "format": "prettier --write --list-different .", - "check": "prettier --check . && eslint . && svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check": "prettier --check . && eslint . && pnpm run sync && svelte-check --tsconfig ./tsconfig.json", "build": "vite build", - "test": "npm run test:unit && npm run test:e2e", + "test": "pnpm run test:unit && pnpm run test:e2e", "dev": "vite dev", "preview": "vite preview", "test:unit": "vitest run", "test:e2e": "playwright test", - "package": "NODE_ENV=prod svelte-kit sync && svelte-package && publint" + "package": "pnpm run sync && svelte-package && publint", + "sync": "NODE_ENV=prod svelte-kit sync", + "prepublishOnly": "pnpm package", + "check:watch": "pnpm run sync && svelte-check --tsconfig ./tsconfig.json --watch", + "lint": "prettier --check . && eslint ." }, "dependencies": { "svelte": "^5.16.0" @@ -50,7 +59,7 @@ "@playwright/test": "^1.49.1", "@sveltejs/adapter-auto": "^3.3.1", "@sveltejs/adapter-static": "^3.0.8", - "@sveltejs/kit": "^2.15.0", + "@sveltejs/kit": "^2.15.1", "@sveltejs/package": "^2.3.7", "@sveltejs/vite-plugin-svelte": "^4.0.4", "@types/node": "^22.10.2", @@ -58,7 +67,7 @@ "@wagmi/core": "^2.16.3", "@walletconnect/ethereum-provider": "^2.17.3", "autoprefixer": "^10.4.20", - "daisyui": "^4.12.22", + "daisyui": "^4.12.23", "eslint": "^9.17.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-svelte": "^2.46.1", @@ -73,10 +82,11 @@ "svelte-hero-icons": "^5.2.0", "svelte-hot-french-toast": "^1.0.0", "tailwindcss": "^3.4.17", + "turbo": "^2.3.3", "typescript": "^5.7.2", "typescript-eslint": "^8.18.2", "viem": "^2.21.57", "vite": "^5.4.11", "vitest": "^2.1.8" } -} \ No newline at end of file +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 52d87ac..0f0c6a3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,19 +20,19 @@ importers: version: 1.2.4(eslint@9.17.0(jiti@2.4.2)) '@metamask/sdk': specifier: ^0.31.4 - version: 0.31.4(bufferutil@4.0.8)(utf-8-validate@5.0.10) + version: 0.31.4(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@playwright/test': specifier: ^1.49.1 version: 1.49.1 '@sveltejs/adapter-auto': specifier: ^3.3.1 - version: 3.3.1(@sveltejs/kit@2.15.0(@sveltejs/vite-plugin-svelte@4.0.4(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2))) + version: 3.3.1(@sveltejs/kit@2.15.1(@sveltejs/vite-plugin-svelte@4.0.4(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2))) '@sveltejs/adapter-static': specifier: ^3.0.8 - version: 3.0.8(@sveltejs/kit@2.15.0(@sveltejs/vite-plugin-svelte@4.0.4(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2))) + version: 3.0.8(@sveltejs/kit@2.15.1(@sveltejs/vite-plugin-svelte@4.0.4(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2))) '@sveltejs/kit': - specifier: ^2.15.0 - version: 2.15.0(@sveltejs/vite-plugin-svelte@4.0.4(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)) + specifier: ^2.15.1 + version: 2.15.1(@sveltejs/vite-plugin-svelte@4.0.4(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)) '@sveltejs/package': specifier: ^2.3.7 version: 2.3.7(svelte@5.16.0)(typescript@5.7.2) @@ -44,19 +44,19 @@ importers: version: 22.10.2 '@wagmi/connectors': specifier: ^5.7.3 - version: 5.7.3(@wagmi/core@2.16.3(react@18.3.1)(typescript@5.7.2)(use-sync-external-store@1.2.0(react@18.3.1))(viem@2.21.57(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)))(bufferutil@4.0.8)(react@18.3.1)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.21.57(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) + version: 5.7.3(@wagmi/core@2.16.3(react@18.3.1)(typescript@5.7.2)(use-sync-external-store@1.2.0(react@18.3.1))(viem@2.21.57(bufferutil@4.0.9)(typescript@5.7.2)(utf-8-validate@5.0.10)))(bufferutil@4.0.9)(react@18.3.1)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.21.57(bufferutil@4.0.9)(typescript@5.7.2)(utf-8-validate@5.0.10)) '@wagmi/core': specifier: ^2.16.3 - version: 2.16.3(react@18.3.1)(typescript@5.7.2)(use-sync-external-store@1.2.0(react@18.3.1))(viem@2.21.57(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) + version: 2.16.3(react@18.3.1)(typescript@5.7.2)(use-sync-external-store@1.2.0(react@18.3.1))(viem@2.21.57(bufferutil@4.0.9)(typescript@5.7.2)(utf-8-validate@5.0.10)) '@walletconnect/ethereum-provider': specifier: ^2.17.3 - version: 2.17.3(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10) + version: 2.17.3(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10) autoprefixer: specifier: ^10.4.20 version: 10.4.20(postcss@8.4.49) daisyui: - specifier: ^4.12.22 - version: 4.12.22(postcss@8.4.49) + specifier: ^4.12.23 + version: 4.12.23(postcss@8.4.49) eslint: specifier: ^9.17.0 version: 9.17.0(jiti@2.4.2) @@ -99,6 +99,9 @@ importers: tailwindcss: specifier: ^3.4.17 version: 3.4.17 + turbo: + specifier: ^2.3.3 + version: 2.3.3 typescript: specifier: ^5.7.2 version: 5.7.2 @@ -107,7 +110,7 @@ importers: version: 8.18.2(eslint@9.17.0(jiti@2.4.2))(typescript@5.7.2) viem: specifier: ^2.21.57 - version: 2.21.57(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + version: 2.21.57(bufferutil@4.0.9)(typescript@5.7.2)(utf-8-validate@5.0.10) vite: specifier: ^5.4.11 version: 5.4.11(@types/node@22.10.2) @@ -780,8 +783,8 @@ packages: peerDependencies: '@sveltejs/kit': ^2.0.0 - '@sveltejs/kit@2.15.0': - resolution: {integrity: sha512-FI1bhfhFNGI2sKg+BhiRyM4eaOvX+KZqRYSQqL5PK3ZZREX2xufZ6MzZAw79N846OnIxYNqcz/3VOUq+FPDd3w==} + '@sveltejs/kit@2.15.1': + resolution: {integrity: sha512-8t7D3hQHbUDMiaQ2RVnjJJ/+Ur4Fn/tkeySJCsHtX346Q9cp3LAnav8xXdfuqYNJwpUGX0x3BqF1uvbmXQw93A==} engines: {node: '>=18.13'} hasBin: true peerDependencies: @@ -1161,8 +1164,8 @@ packages: buffer@6.0.3: resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} - bufferutil@4.0.8: - resolution: {integrity: sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==} + bufferutil@4.0.9: + resolution: {integrity: sha512-WDtdLmJvAuNNPzByAYpRo2rF1Mmradw6gvWsQKf63476DDXmomT9zUiGypLcG4ibIM67vhAj8jJRdbmEws2Aqw==} engines: {node: '>=6.14.2'} cac@6.7.14: @@ -1241,8 +1244,8 @@ packages: concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} - consola@3.3.2: - resolution: {integrity: sha512-X3dcWPU+QeEaPrdtX3zBRQ0P0kIeEnmJV49uNtpy4N/TPnzA3grJvHftKjHuFIQNLrqBPzzykmc3fNrkQDl5yA==} + consola@3.3.3: + resolution: {integrity: sha512-Qil5KwghMzlqd51UXM0b6fyaGHtOC22scxrwrz4A2882LyUMwQjnvaedN1HAeXzphspQ6CpHkzMAWxBTUruDLg==} engines: {node: ^14.18.0 || >=16.10.0} cookie-es@1.2.2: @@ -1285,8 +1288,8 @@ packages: resolution: {integrity: sha512-pHJg+jbuFsCjz9iclQBqyL3B2HLCBF71BwVNujUYEvCeQMvV97R59MNK3R2+jgJ3a1fcZgI9B3vYgz8lzr/BFQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - daisyui@4.12.22: - resolution: {integrity: sha512-HDLWbmTnXxhE1MrMgSWjVgdRt+bVYHvfNbW3GTsyIokRSqTHonUTrxV3RhpPDjGIWaHt+ELtDCTYCtUFgL2/Nw==} + daisyui@4.12.23: + resolution: {integrity: sha512-EM38duvxutJ5PD65lO/AFMpcw+9qEy6XAZrTpzp7WyaPeO/l+F/Qiq0ECHHmFNcFXh5aVoALY4MGrrxtCiaQCQ==} engines: {node: '>=16.9.0'} date-fns@2.30.0: @@ -1408,8 +1411,8 @@ packages: resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} engines: {node: '>= 0.4'} - es-module-lexer@1.5.4: - resolution: {integrity: sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==} + es-module-lexer@1.6.0: + resolution: {integrity: sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ==} es-object-atoms@1.0.0: resolution: {integrity: sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==} @@ -2649,6 +2652,40 @@ packages: tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + turbo-darwin-64@2.3.3: + resolution: {integrity: sha512-bxX82xe6du/3rPmm4aCC5RdEilIN99VUld4HkFQuw+mvFg6darNBuQxyWSHZTtc25XgYjQrjsV05888w1grpaA==} + cpu: [x64] + os: [darwin] + + turbo-darwin-arm64@2.3.3: + resolution: {integrity: sha512-DYbQwa3NsAuWkCUYVzfOUBbSUBVQzH5HWUFy2Kgi3fGjIWVZOFk86ss+xsWu//rlEAfYwEmopigsPYSmW4X15A==} + cpu: [arm64] + os: [darwin] + + turbo-linux-64@2.3.3: + resolution: {integrity: sha512-eHj9OIB0dFaP6BxB88jSuaCLsOQSYWBgmhy2ErCu6D2GG6xW3b6e2UWHl/1Ho9FsTg4uVgo4DB9wGsKa5erjUA==} + cpu: [x64] + os: [linux] + + turbo-linux-arm64@2.3.3: + resolution: {integrity: sha512-NmDE/NjZoDj1UWBhMtOPmqFLEBKhzGS61KObfrDEbXvU3lekwHeoPvAMfcovzswzch+kN2DrtbNIlz+/rp8OCg==} + cpu: [arm64] + os: [linux] + + turbo-windows-64@2.3.3: + resolution: {integrity: sha512-O2+BS4QqjK3dOERscXqv7N2GXNcqHr9hXumkMxDj/oGx9oCatIwnnwx34UmzodloSnJpgSqjl8iRWiY65SmYoQ==} + cpu: [x64] + os: [win32] + + turbo-windows-arm64@2.3.3: + resolution: {integrity: sha512-dW4ZK1r6XLPNYLIKjC4o87HxYidtRRcBeo/hZ9Wng2XM/MqqYkAyzJXJGgRMsc0MMEN9z4+ZIfnSNBrA0b08ag==} + cpu: [arm64] + os: [win32] + + turbo@2.3.3: + resolution: {integrity: sha512-DUHWQAcC8BTiUZDRzAYGvpSpGLiaOQPfYXlCieQbwUvmml/LRGIe3raKdrOPOoiX0DYlzxs2nH6BoWJoZrj8hA==} + hasBin: true + type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} @@ -2680,8 +2717,8 @@ packages: unenv@1.10.0: resolution: {integrity: sha512-wY5bskBQFL9n3Eca5XnhH6KbUo/tfvkwm9OpcdCvLaeA7piBNbavbOKJySEwQ1V0RH6HvNlSAFRTpvTqgKRQXQ==} - unstorage@1.14.3: - resolution: {integrity: sha512-nj1rtc2XWCck2fDB39sboAajqooj9LmxZ9/eBM1XR+iUQAFctKvLl0FcPP5f4vzRgU1dmJ03SZhqZMLc9RDXIA==} + unstorage@1.14.4: + resolution: {integrity: sha512-1SYeamwuYeQJtJ/USE1x4l17LkmQBzg7deBJ+U9qOBoHo15d1cDxG4jM31zKRgF7pG0kirZy4wVMX6WL6Zoscg==} peerDependencies: '@azure/app-configuration': ^1.8.0 '@azure/cosmos': ^4.2.0 @@ -3412,16 +3449,16 @@ snapshots: '@metamask/safe-event-emitter@3.1.2': {} - '@metamask/sdk-communication-layer@0.31.0(cross-fetch@4.1.0)(eciesjs@0.4.13)(eventemitter2@6.4.9)(readable-stream@3.6.2)(socket.io-client@4.8.1(bufferutil@4.0.8)(utf-8-validate@5.0.10))': + '@metamask/sdk-communication-layer@0.31.0(cross-fetch@4.1.0)(eciesjs@0.4.13)(eventemitter2@6.4.9)(readable-stream@3.6.2)(socket.io-client@4.8.1(bufferutil@4.0.9)(utf-8-validate@5.0.10))': dependencies: - bufferutil: 4.0.8 + bufferutil: 4.0.9 cross-fetch: 4.1.0 date-fns: 2.30.0 debug: 4.4.0 eciesjs: 0.4.13 eventemitter2: 6.4.9 readable-stream: 3.6.2 - socket.io-client: 4.8.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + socket.io-client: 4.8.1(bufferutil@4.0.9)(utf-8-validate@5.0.10) utf-8-validate: 5.0.10 uuid: 8.3.2 transitivePeerDependencies: @@ -3431,12 +3468,12 @@ snapshots: dependencies: '@paulmillr/qr': 0.2.1 - '@metamask/sdk@0.31.4(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@metamask/sdk@0.31.4(bufferutil@4.0.9)(utf-8-validate@5.0.10)': dependencies: '@babel/runtime': 7.26.0 '@metamask/onboarding': 1.0.1 '@metamask/providers': 16.1.0 - '@metamask/sdk-communication-layer': 0.31.0(cross-fetch@4.1.0)(eciesjs@0.4.13)(eventemitter2@6.4.9)(readable-stream@3.6.2)(socket.io-client@4.8.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)) + '@metamask/sdk-communication-layer': 0.31.0(cross-fetch@4.1.0)(eciesjs@0.4.13)(eventemitter2@6.4.9)(readable-stream@3.6.2)(socket.io-client@4.8.1(bufferutil@4.0.9)(utf-8-validate@5.0.10)) '@metamask/sdk-install-modal-web': 0.31.2 '@paulmillr/qr': 0.2.1 bowser: 2.11.0 @@ -3448,7 +3485,7 @@ snapshots: obj-multiplex: 1.0.0 pump: 3.0.2 readable-stream: 3.6.2 - socket.io-client: 4.8.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + socket.io-client: 4.8.1(bufferutil@4.0.9)(utf-8-validate@5.0.10) tslib: 2.8.1 util: 0.12.5 uuid: 8.3.2 @@ -3639,9 +3676,9 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.29.1': optional: true - '@safe-global/safe-apps-provider@0.18.5(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)': + '@safe-global/safe-apps-provider@0.18.5(bufferutil@4.0.9)(typescript@5.7.2)(utf-8-validate@5.0.10)': dependencies: - '@safe-global/safe-apps-sdk': 9.1.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + '@safe-global/safe-apps-sdk': 9.1.0(bufferutil@4.0.9)(typescript@5.7.2)(utf-8-validate@5.0.10) events: 3.3.0 transitivePeerDependencies: - bufferutil @@ -3649,10 +3686,10 @@ snapshots: - utf-8-validate - zod - '@safe-global/safe-apps-sdk@9.1.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)': + '@safe-global/safe-apps-sdk@9.1.0(bufferutil@4.0.9)(typescript@5.7.2)(utf-8-validate@5.0.10)': dependencies: '@safe-global/safe-gateway-typescript-sdk': 3.22.4 - viem: 2.21.57(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + viem: 2.21.57(bufferutil@4.0.9)(typescript@5.7.2)(utf-8-validate@5.0.10) transitivePeerDependencies: - bufferutil - typescript @@ -3771,16 +3808,16 @@ snapshots: '@steeze-ui/heroicons@2.4.2': {} - '@sveltejs/adapter-auto@3.3.1(@sveltejs/kit@2.15.0(@sveltejs/vite-plugin-svelte@4.0.4(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))': + '@sveltejs/adapter-auto@3.3.1(@sveltejs/kit@2.15.1(@sveltejs/vite-plugin-svelte@4.0.4(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))': dependencies: - '@sveltejs/kit': 2.15.0(@sveltejs/vite-plugin-svelte@4.0.4(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)) + '@sveltejs/kit': 2.15.1(@sveltejs/vite-plugin-svelte@4.0.4(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)) import-meta-resolve: 4.1.0 - '@sveltejs/adapter-static@3.0.8(@sveltejs/kit@2.15.0(@sveltejs/vite-plugin-svelte@4.0.4(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))': + '@sveltejs/adapter-static@3.0.8(@sveltejs/kit@2.15.1(@sveltejs/vite-plugin-svelte@4.0.4(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))': dependencies: - '@sveltejs/kit': 2.15.0(@sveltejs/vite-plugin-svelte@4.0.4(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)) + '@sveltejs/kit': 2.15.1(@sveltejs/vite-plugin-svelte@4.0.4(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)) - '@sveltejs/kit@2.15.0(@sveltejs/vite-plugin-svelte@4.0.4(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2))': + '@sveltejs/kit@2.15.1(@sveltejs/vite-plugin-svelte@4.0.4(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)))(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2))': dependencies: '@sveltejs/vite-plugin-svelte': 4.0.4(svelte@5.16.0)(vite@5.4.11(@types/node@22.10.2)) '@types/cookie': 0.6.0 @@ -3966,16 +4003,16 @@ snapshots: loupe: 3.1.2 tinyrainbow: 1.2.0 - '@wagmi/connectors@5.7.3(@wagmi/core@2.16.3(react@18.3.1)(typescript@5.7.2)(use-sync-external-store@1.2.0(react@18.3.1))(viem@2.21.57(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)))(bufferutil@4.0.8)(react@18.3.1)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.21.57(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10))': + '@wagmi/connectors@5.7.3(@wagmi/core@2.16.3(react@18.3.1)(typescript@5.7.2)(use-sync-external-store@1.2.0(react@18.3.1))(viem@2.21.57(bufferutil@4.0.9)(typescript@5.7.2)(utf-8-validate@5.0.10)))(bufferutil@4.0.9)(react@18.3.1)(typescript@5.7.2)(utf-8-validate@5.0.10)(viem@2.21.57(bufferutil@4.0.9)(typescript@5.7.2)(utf-8-validate@5.0.10))': dependencies: '@coinbase/wallet-sdk': 4.2.3 - '@metamask/sdk': 0.31.4(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@safe-global/safe-apps-provider': 0.18.5(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) - '@safe-global/safe-apps-sdk': 9.1.0(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) - '@wagmi/core': 2.16.3(react@18.3.1)(typescript@5.7.2)(use-sync-external-store@1.2.0(react@18.3.1))(viem@2.21.57(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10)) - '@walletconnect/ethereum-provider': 2.17.0(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10) + '@metamask/sdk': 0.31.4(bufferutil@4.0.9)(utf-8-validate@5.0.10) + '@safe-global/safe-apps-provider': 0.18.5(bufferutil@4.0.9)(typescript@5.7.2)(utf-8-validate@5.0.10) + '@safe-global/safe-apps-sdk': 9.1.0(bufferutil@4.0.9)(typescript@5.7.2)(utf-8-validate@5.0.10) + '@wagmi/core': 2.16.3(react@18.3.1)(typescript@5.7.2)(use-sync-external-store@1.2.0(react@18.3.1))(viem@2.21.57(bufferutil@4.0.9)(typescript@5.7.2)(utf-8-validate@5.0.10)) + '@walletconnect/ethereum-provider': 2.17.0(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10) cbw-sdk: '@coinbase/wallet-sdk@3.9.3' - viem: 2.21.57(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + viem: 2.21.57(bufferutil@4.0.9)(typescript@5.7.2)(utf-8-validate@5.0.10) optionalDependencies: typescript: 5.7.2 transitivePeerDependencies: @@ -4005,11 +4042,11 @@ snapshots: - utf-8-validate - zod - '@wagmi/core@2.16.3(react@18.3.1)(typescript@5.7.2)(use-sync-external-store@1.2.0(react@18.3.1))(viem@2.21.57(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10))': + '@wagmi/core@2.16.3(react@18.3.1)(typescript@5.7.2)(use-sync-external-store@1.2.0(react@18.3.1))(viem@2.21.57(bufferutil@4.0.9)(typescript@5.7.2)(utf-8-validate@5.0.10))': dependencies: eventemitter3: 5.0.1 mipd: 0.0.7(typescript@5.7.2) - viem: 2.21.57(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10) + viem: 2.21.57(bufferutil@4.0.9)(typescript@5.7.2)(utf-8-validate@5.0.10) zustand: 5.0.0(react@18.3.1)(use-sync-external-store@1.2.0(react@18.3.1)) optionalDependencies: typescript: 5.7.2 @@ -4019,13 +4056,13 @@ snapshots: - react - use-sync-external-store - '@walletconnect/core@2.17.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@walletconnect/core@2.17.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)': dependencies: '@walletconnect/heartbeat': 1.2.2 '@walletconnect/jsonrpc-provider': 1.0.14 '@walletconnect/jsonrpc-types': 1.0.4 '@walletconnect/jsonrpc-utils': 1.0.8 - '@walletconnect/jsonrpc-ws-connection': 1.0.14(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@walletconnect/jsonrpc-ws-connection': 1.0.14(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@walletconnect/keyvaluestorage': 1.1.1 '@walletconnect/logger': 2.1.2 '@walletconnect/relay-api': 1.0.11 @@ -4059,13 +4096,13 @@ snapshots: - uploadthing - utf-8-validate - '@walletconnect/core@2.17.3(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@walletconnect/core@2.17.3(bufferutil@4.0.9)(utf-8-validate@5.0.10)': dependencies: '@walletconnect/heartbeat': 1.2.2 '@walletconnect/jsonrpc-provider': 1.0.14 '@walletconnect/jsonrpc-types': 1.0.4 '@walletconnect/jsonrpc-utils': 1.0.8 - '@walletconnect/jsonrpc-ws-connection': 1.0.16(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@walletconnect/jsonrpc-ws-connection': 1.0.16(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@walletconnect/keyvaluestorage': 1.1.1 '@walletconnect/logger': 2.1.2 '@walletconnect/relay-api': 1.0.11 @@ -4104,16 +4141,16 @@ snapshots: dependencies: tslib: 1.14.1 - '@walletconnect/ethereum-provider@2.17.0(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10)': + '@walletconnect/ethereum-provider@2.17.0(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10)': dependencies: '@walletconnect/jsonrpc-http-connection': 1.0.8 '@walletconnect/jsonrpc-provider': 1.0.14 '@walletconnect/jsonrpc-types': 1.0.4 '@walletconnect/jsonrpc-utils': 1.0.8 '@walletconnect/modal': 2.7.0(react@18.3.1) - '@walletconnect/sign-client': 2.17.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@walletconnect/sign-client': 2.17.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@walletconnect/types': 2.17.0 - '@walletconnect/universal-provider': 2.17.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@walletconnect/universal-provider': 2.17.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@walletconnect/utils': 2.17.0 events: 3.3.0 transitivePeerDependencies: @@ -4141,7 +4178,7 @@ snapshots: - uploadthing - utf-8-validate - '@walletconnect/ethereum-provider@2.17.3(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10)': + '@walletconnect/ethereum-provider@2.17.3(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10)': dependencies: '@walletconnect/jsonrpc-http-connection': 1.0.8 '@walletconnect/jsonrpc-provider': 1.0.14 @@ -4149,9 +4186,9 @@ snapshots: '@walletconnect/jsonrpc-utils': 1.0.8 '@walletconnect/keyvaluestorage': 1.1.1 '@walletconnect/modal': 2.7.0(react@18.3.1) - '@walletconnect/sign-client': 2.17.3(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@walletconnect/sign-client': 2.17.3(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@walletconnect/types': 2.17.3 - '@walletconnect/universal-provider': 2.17.3(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@walletconnect/universal-provider': 2.17.3(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@walletconnect/utils': 2.17.3 events: 3.3.0 transitivePeerDependencies: @@ -4216,22 +4253,22 @@ snapshots: '@walletconnect/jsonrpc-types': 1.0.4 tslib: 1.14.1 - '@walletconnect/jsonrpc-ws-connection@1.0.14(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@walletconnect/jsonrpc-ws-connection@1.0.14(bufferutil@4.0.9)(utf-8-validate@5.0.10)': dependencies: '@walletconnect/jsonrpc-utils': 1.0.8 '@walletconnect/safe-json': 1.0.2 events: 3.3.0 - ws: 7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10) + ws: 7.5.10(bufferutil@4.0.9)(utf-8-validate@5.0.10) transitivePeerDependencies: - bufferutil - utf-8-validate - '@walletconnect/jsonrpc-ws-connection@1.0.16(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@walletconnect/jsonrpc-ws-connection@1.0.16(bufferutil@4.0.9)(utf-8-validate@5.0.10)': dependencies: '@walletconnect/jsonrpc-utils': 1.0.8 '@walletconnect/safe-json': 1.0.2 events: 3.3.0 - ws: 7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10) + ws: 7.5.10(bufferutil@4.0.9)(utf-8-validate@5.0.10) transitivePeerDependencies: - bufferutil - utf-8-validate @@ -4240,7 +4277,7 @@ snapshots: dependencies: '@walletconnect/safe-json': 1.0.2 idb-keyval: 6.2.1 - unstorage: 1.14.3(idb-keyval@6.2.1) + unstorage: 1.14.4(idb-keyval@6.2.1) transitivePeerDependencies: - '@azure/app-configuration' - '@azure/cosmos' @@ -4307,9 +4344,9 @@ snapshots: dependencies: tslib: 1.14.1 - '@walletconnect/sign-client@2.17.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@walletconnect/sign-client@2.17.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)': dependencies: - '@walletconnect/core': 2.17.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@walletconnect/core': 2.17.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@walletconnect/events': 1.0.1 '@walletconnect/heartbeat': 1.2.2 '@walletconnect/jsonrpc-utils': 1.0.8 @@ -4340,9 +4377,9 @@ snapshots: - uploadthing - utf-8-validate - '@walletconnect/sign-client@2.17.3(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@walletconnect/sign-client@2.17.3(bufferutil@4.0.9)(utf-8-validate@5.0.10)': dependencies: - '@walletconnect/core': 2.17.3(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@walletconnect/core': 2.17.3(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@walletconnect/events': 1.0.1 '@walletconnect/heartbeat': 1.2.2 '@walletconnect/jsonrpc-utils': 1.0.8 @@ -4433,14 +4470,14 @@ snapshots: - ioredis - uploadthing - '@walletconnect/universal-provider@2.17.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@walletconnect/universal-provider@2.17.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)': dependencies: '@walletconnect/jsonrpc-http-connection': 1.0.8 '@walletconnect/jsonrpc-provider': 1.0.14 '@walletconnect/jsonrpc-types': 1.0.4 '@walletconnect/jsonrpc-utils': 1.0.8 '@walletconnect/logger': 2.1.2 - '@walletconnect/sign-client': 2.17.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@walletconnect/sign-client': 2.17.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@walletconnect/types': 2.17.0 '@walletconnect/utils': 2.17.0 events: 3.3.0 @@ -4467,7 +4504,7 @@ snapshots: - uploadthing - utf-8-validate - '@walletconnect/universal-provider@2.17.3(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@walletconnect/universal-provider@2.17.3(bufferutil@4.0.9)(utf-8-validate@5.0.10)': dependencies: '@walletconnect/events': 1.0.1 '@walletconnect/jsonrpc-http-connection': 1.0.8 @@ -4476,7 +4513,7 @@ snapshots: '@walletconnect/jsonrpc-utils': 1.0.8 '@walletconnect/keyvaluestorage': 1.1.1 '@walletconnect/logger': 2.1.2 - '@walletconnect/sign-client': 2.17.3(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@walletconnect/sign-client': 2.17.3(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@walletconnect/types': 2.17.3 '@walletconnect/utils': 2.17.3 events: 3.3.0 @@ -4700,7 +4737,7 @@ snapshots: base64-js: 1.5.1 ieee754: 1.2.1 - bufferutil@4.0.8: + bufferutil@4.0.9: dependencies: node-gyp-build: 4.8.4 @@ -4782,7 +4819,7 @@ snapshots: concat-map@0.0.1: {} - consola@3.3.2: {} + consola@3.3.3: {} cookie-es@1.2.2: {} @@ -4823,7 +4860,7 @@ snapshots: culori@3.3.0: {} - daisyui@4.12.22(postcss@8.4.49): + daisyui@4.12.23(postcss@8.4.49): dependencies: css-selector-tokenizer: 0.8.0 culori: 3.3.0 @@ -4930,12 +4967,12 @@ snapshots: dependencies: once: 1.4.0 - engine.io-client@6.6.2(bufferutil@4.0.8)(utf-8-validate@5.0.10): + engine.io-client@6.6.2(bufferutil@4.0.9)(utf-8-validate@5.0.10): dependencies: '@socket.io/component-emitter': 3.1.2 debug: 4.3.7 engine.io-parser: 5.2.3 - ws: 8.17.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + ws: 8.17.1(bufferutil@4.0.9)(utf-8-validate@5.0.10) xmlhttprequest-ssl: 2.1.2 transitivePeerDependencies: - bufferutil @@ -4948,7 +4985,7 @@ snapshots: es-errors@1.3.0: {} - es-module-lexer@1.5.4: {} + es-module-lexer@1.6.0: {} es-object-atoms@1.0.0: dependencies: @@ -5392,9 +5429,9 @@ snapshots: isexe@2.0.0: {} - isows@1.0.6(ws@8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)): + isows@1.0.6(ws@8.18.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)): dependencies: - ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + ws: 8.18.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) jackspeak@3.4.3: dependencies: @@ -5968,11 +6005,11 @@ snapshots: mrmime: 2.0.0 totalist: 3.0.1 - socket.io-client@4.8.1(bufferutil@4.0.8)(utf-8-validate@5.0.10): + socket.io-client@4.8.1(bufferutil@4.0.9)(utf-8-validate@5.0.10): dependencies: '@socket.io/component-emitter': 3.1.2 debug: 4.3.7 - engine.io-client: 6.6.2(bufferutil@4.0.8)(utf-8-validate@5.0.10) + engine.io-client: 6.6.2(bufferutil@4.0.9)(utf-8-validate@5.0.10) socket.io-parser: 4.2.4 transitivePeerDependencies: - bufferutil @@ -6179,6 +6216,33 @@ snapshots: tslib@2.8.1: {} + turbo-darwin-64@2.3.3: + optional: true + + turbo-darwin-arm64@2.3.3: + optional: true + + turbo-linux-64@2.3.3: + optional: true + + turbo-linux-arm64@2.3.3: + optional: true + + turbo-windows-64@2.3.3: + optional: true + + turbo-windows-arm64@2.3.3: + optional: true + + turbo@2.3.3: + optionalDependencies: + turbo-darwin-64: 2.3.3 + turbo-darwin-arm64: 2.3.3 + turbo-linux-64: 2.3.3 + turbo-linux-arm64: 2.3.3 + turbo-windows-64: 2.3.3 + turbo-windows-arm64: 2.3.3 + type-check@0.4.0: dependencies: prelude-ls: 1.2.1 @@ -6207,13 +6271,13 @@ snapshots: unenv@1.10.0: dependencies: - consola: 3.3.2 + consola: 3.3.3 defu: 6.1.4 mime: 3.0.0 node-fetch-native: 1.6.4 pathe: 1.1.2 - unstorage@1.14.3(idb-keyval@6.2.1): + unstorage@1.14.4(idb-keyval@6.2.1): dependencies: anymatch: 3.1.3 chokidar: 3.6.0 @@ -6265,17 +6329,17 @@ snapshots: optionalDependencies: react: 18.3.1 - viem@2.21.57(bufferutil@4.0.8)(typescript@5.7.2)(utf-8-validate@5.0.10): + viem@2.21.57(bufferutil@4.0.9)(typescript@5.7.2)(utf-8-validate@5.0.10): dependencies: '@noble/curves': 1.7.0 '@noble/hashes': 1.6.1 '@scure/bip32': 1.6.0 '@scure/bip39': 1.5.0 abitype: 1.0.7(typescript@5.7.2) - isows: 1.0.6(ws@8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)) + isows: 1.0.6(ws@8.18.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)) ox: 0.1.2(typescript@5.7.2) webauthn-p256: 0.0.10 - ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + ws: 8.18.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) optionalDependencies: typescript: 5.7.2 transitivePeerDependencies: @@ -6287,7 +6351,7 @@ snapshots: dependencies: cac: 6.7.14 debug: 4.4.0 - es-module-lexer: 1.5.4 + es-module-lexer: 1.6.0 pathe: 1.1.2 vite: 5.4.11(@types/node@22.10.2) transitivePeerDependencies: @@ -6410,19 +6474,19 @@ snapshots: wrappy@1.0.2: {} - ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10): + ws@7.5.10(bufferutil@4.0.9)(utf-8-validate@5.0.10): optionalDependencies: - bufferutil: 4.0.8 + bufferutil: 4.0.9 utf-8-validate: 5.0.10 - ws@8.17.1(bufferutil@4.0.8)(utf-8-validate@5.0.10): + ws@8.17.1(bufferutil@4.0.9)(utf-8-validate@5.0.10): optionalDependencies: - bufferutil: 4.0.8 + bufferutil: 4.0.9 utf-8-validate: 5.0.10 - ws@8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10): + ws@8.18.0(bufferutil@4.0.9)(utf-8-validate@5.0.10): optionalDependencies: - bufferutil: 4.0.8 + bufferutil: 4.0.9 utf-8-validate: 5.0.10 xmlhttprequest-ssl@2.1.2: {} diff --git a/src/lib/index.ts b/src/lib/index.ts index 856f2b6..678502d 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -1 +1,7 @@ // place files you want to import through the `$lib` alias in this folder. + +// Export components and functionality +export * from "./wagmi"; + +// Export styles +import "./styles/index.pcss"; diff --git a/src/lib/wagmi/classes/Account.svelte.ts b/src/lib/wagmi/classes/Account.svelte.ts index 953fb3c..1494ca9 100644 --- a/src/lib/wagmi/classes/Account.svelte.ts +++ b/src/lib/wagmi/classes/Account.svelte.ts @@ -23,7 +23,6 @@ class Account extends Address { watch = () => watchAccount(wagmiConfig, { onChange: (newAccount: AccountType) => { - console.info("watchAccount Change:", newAccount); this.#account = newAccount; super.address = newAccount.address; } diff --git a/src/lib/wagmi/classes/Events.svelte.ts b/src/lib/wagmi/classes/Events.svelte.ts index ce011cf..1d2722a 100644 --- a/src/lib/wagmi/classes/Events.svelte.ts +++ b/src/lib/wagmi/classes/Events.svelte.ts @@ -1,6 +1,14 @@ -import { type Address as AddressType, type ContractEventName } from "viem"; +import { type Address as AddressType, type Log } from "viem"; import { watchContractEvent, getBlockNumber } from "@wagmi/core"; -import { type LogWithArgs, type EventsFilter, type EventsSortOrder, SmartContract, wagmi, wagmiConfig, getContractEvents } from ".."; +import { + type LogWithArgs, + type EventsFilter, + type EventsSortOrder, + SmartContract, + wagmi, + wagmiConfig, + getContractEvents +} from ".."; class Events extends SmartContract { limit: number = $state(0); diff --git a/src/lib/wagmi/classes/SmartContract.svelte.ts b/src/lib/wagmi/classes/SmartContract.svelte.ts index 01ae664..17affb2 100644 --- a/src/lib/wagmi/classes/SmartContract.svelte.ts +++ b/src/lib/wagmi/classes/SmartContract.svelte.ts @@ -11,7 +11,15 @@ import { writeContract } from "@wagmi/core"; -import { wagmi, wagmiConfig, isAddress, shorten0xString, readDeployment, notification, LinkTx } from ".."; +import { + wagmi, + wagmiConfig, + isAddress, + shorten0xString, + readDeployment, + notification, + LinkTx +} from ".."; let counter = 0; diff --git a/src/lib/wagmi/classes/Wagmi.svelte.ts b/src/lib/wagmi/classes/Wagmi.svelte.ts index 7a011be..b9d738c 100644 --- a/src/lib/wagmi/classes/Wagmi.svelte.ts +++ b/src/lib/wagmi/classes/Wagmi.svelte.ts @@ -10,7 +10,15 @@ import { } from "@wagmi/core"; import { coinbaseWallet, injected, metaMask, walletConnect } from "@wagmi/connectors"; -import { Network, createBurnerConnector, alchemyTransport, ALCHEMY_API_KEY, POLLING_INTERVAL, CHAINS, WALLET_CONNECT_PROJECT_ID } from ".."; +import { + Network, + createBurnerConnector, + alchemyTransport, + ALCHEMY_API_KEY, + POLLING_INTERVAL, + CHAINS, + WALLET_CONNECT_PROJECT_ID +} from ".."; const getChains = () => { const selectedChains: Chain[] = []; diff --git a/src/lib/wagmi/components/BaseNotification.svelte b/src/lib/wagmi/components/BaseNotification.svelte index 79ad1a3..1602236 100644 --- a/src/lib/wagmi/components/BaseNotification.svelte +++ b/src/lib/wagmi/components/BaseNotification.svelte @@ -8,7 +8,7 @@ XMark } from "svelte-hero-icons"; import toast_, { type Renderable, type Toast } from "svelte-hot-french-toast"; - + import { clickOutside } from ".."; const { @@ -26,6 +26,7 @@
toast_.dismiss(id)} + role="status" class="notification-{status} relative flex max-w-sm transform-gpu flex-row items-start justify-between space-x-2 rounded-xl bg-base-200 p-4 shadow-center shadow-accent transition-all duration-500 ease-in-out {position!.substring( 0, 3 diff --git a/src/lib/wagmi/components/LinkAddress.svelte b/src/lib/wagmi/components/LinkAddress.svelte index 539c6a6..e91d6bf 100644 --- a/src/lib/wagmi/components/LinkAddress.svelte +++ b/src/lib/wagmi/components/LinkAddress.svelte @@ -1,5 +1,5 @@ + +

diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 61846ae..d9dd675 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -5,6 +5,7 @@ {/snippet}
    + {@render pageTest("notification")} {@render pageTest("counter")} {@render pageTest("deployments")}
diff --git a/src/routes/counter/+page.svelte b/src/routes/counter/+page.svelte index b8e98e7..e18ac17 100644 --- a/src/routes/counter/+page.svelte +++ b/src/routes/counter/+page.svelte @@ -1,4 +1,5 @@
-
+
{contract.isFetching ? "fetching..." : contract.sending @@ -22,7 +23,11 @@ -
+
{contract.number}² = {contract.square(contract.number)}
+ +
diff --git a/src/routes/notification/+page.svelte b/src/routes/notification/+page.svelte new file mode 100644 index 0000000..8a7307a --- /dev/null +++ b/src/routes/notification/+page.svelte @@ -0,0 +1,9 @@ + + +
+ +
diff --git a/tests/e2e/demo.t.ts b/tests/e2e/demo.t.ts index 5b1b7c8..7524261 100644 --- a/tests/e2e/demo.t.ts +++ b/tests/e2e/demo.t.ts @@ -40,9 +40,9 @@ test("connect button should be visible and clickable", async ({ page }) => { await expect(disconnectButton).toBeVisible(); }); -test('disconnect wallet functionality', async ({ page }) => { +test("disconnect wallet functionality", async ({ page }) => { // Navigate to the home page - await page.goto('/'); + await page.goto("/"); // Find and click the connect button const connectButton = page.locator("#connect-wallet"); diff --git a/tests/e2e/notification.t.ts b/tests/e2e/notification.t.ts new file mode 100644 index 0000000..bb599bb --- /dev/null +++ b/tests/e2e/notification.t.ts @@ -0,0 +1,53 @@ +import { expect, test } from "@playwright/test"; + +test.describe("Notification Page", () => { + test.beforeEach(async ({ page }) => { + // Navigate to the notification page before each test + await page.goto("/notification"); + }); + + test("should display notification when clicking the button", async ({ page }) => { + // Find and click the notification button + const notifButton = page.getByRole("button", { name: "Notif" }); + await expect(notifButton).toBeVisible(); + await notifButton.click(); + + // Wait for and verify the notification appears + const notification = page.getByText("Notification!"); + await expect(notification).toBeVisible(); + + // Verify the notification has the correct styles (info type) + const notificationContainer = page.locator('[role="status"].notification-info'); + await expect(notificationContainer).toBeVisible(); + await expect(notificationContainer).toHaveClass(/top-0/); + + // Wait for notification to disappear (default timeout is 3000ms) + await expect(notification).toBeHidden({ timeout: 5000 }); + }); + + test("notification should have correct position", async ({ page }) => { + // Click the notification button + await page.getByRole("button", { name: "Notif" }).click(); + + // Get the notification container + const notificationContainer = page.locator('[role="status"].notification-info'); + + // Verify it appears at the top-center (default position) + await expect(notificationContainer).toHaveClass(/top-0/); + }); + + test("should handle multiple notifications", async ({ page }) => { + // Click the button multiple times + const button = page.getByRole("button", { name: "Notif" }); + await button.click(); + await button.click(); + await button.click(); + + // Verify multiple notifications are visible + const notifications = page.locator('[role="status"].notification-info'); + await expect(notifications).toHaveCount(3); + + // Wait for all notifications to disappear + await expect(notifications).toHaveCount(0, { timeout: 5000 }); + }); +}); diff --git a/tests/unit/mocks/env/static/public.ts b/tests/unit/mocks/env/static/public.ts index 59db6f3..e43924e 100644 --- a/tests/unit/mocks/env/static/public.ts +++ b/tests/unit/mocks/env/static/public.ts @@ -1,6 +1,6 @@ -export const PUBLIC_CHAINS = 'anvil,baseSepolia' -export const PUBLIC_POLLING_INTERVAL = '5000' -export const PUBLIC_ALCHEMY_API_KEY = 'test-key' -export const PUBLIC_WALLET_CONNECT_PROJECT_ID = 'test-project-id' -export const PUBLIC_BURNER_WALLET_ONLY_LOCAL = 'true' -export const PUBLIC_BURNER_WALLET_KEY = 'test-key' +export const PUBLIC_CHAINS = "anvil,baseSepolia"; +export const PUBLIC_POLLING_INTERVAL = "5000"; +export const PUBLIC_ALCHEMY_API_KEY = "test-key"; +export const PUBLIC_WALLET_CONNECT_PROJECT_ID = "test-project-id"; +export const PUBLIC_BURNER_WALLET_ONLY_LOCAL = "true"; +export const PUBLIC_BURNER_WALLET_KEY = "test-key"; diff --git a/tests/unit/setup.ts b/tests/unit/setup.ts index a903888..44170bd 100644 --- a/tests/unit/setup.ts +++ b/tests/unit/setup.ts @@ -1,34 +1,34 @@ -import { vi } from 'vitest' -import { Window } from 'happy-dom' +import { vi } from "vitest"; +import { Window } from "happy-dom"; // Setup global environment -Object.defineProperty(globalThis, 'window', { value: new Window() }) +Object.defineProperty(globalThis, "window", { value: new Window() }); // Mock deployments JSON if not already defined -if (!('__DEPLOYMENTS_JSON__' in globalThis)) { - Object.defineProperty(globalThis, '__DEPLOYMENTS_JSON__', { +if (!("__DEPLOYMENTS_JSON__" in globalThis)) { + Object.defineProperty(globalThis, "__DEPLOYMENTS_JSON__", { value: { - '31337': { - name: 'Anvil', - chainId: '31337', + "31337": { + name: "Anvil", + chainId: "31337", contracts: {} }, - '84532': { - name: 'Base Sepolia', - chainId: '84532', + "84532": { + name: "Base Sepolia", + chainId: "84532", contracts: {} } }, configurable: true - }) + }); } // Mock SvelteKit's $env/static/public module -vi.mock('$env/static/public', () => ({ - PUBLIC_CHAINS: 'anvil,baseSepolia', - PUBLIC_POLLING_INTERVAL: '5000', - PUBLIC_ALCHEMY_API_KEY: 'test-key', - PUBLIC_WALLET_CONNECT_PROJECT_ID: 'test-project-id', - PUBLIC_BURNER_WALLET_ONLY_LOCAL: 'true', - PUBLIC_BURNER_WALLET_KEY: 'test-key' -})) +vi.mock("$env/static/public", () => ({ + PUBLIC_CHAINS: "anvil,baseSepolia", + PUBLIC_POLLING_INTERVAL: "5000", + PUBLIC_ALCHEMY_API_KEY: "test-key", + PUBLIC_WALLET_CONNECT_PROJECT_ID: "test-project-id", + PUBLIC_BURNER_WALLET_ONLY_LOCAL: "true", + PUBLIC_BURNER_WALLET_KEY: "test-key" +})); diff --git a/tests/unit/utils.t.ts b/tests/unit/utils.t.ts index d388e9a..bd90f2e 100644 --- a/tests/unit/utils.t.ts +++ b/tests/unit/utils.t.ts @@ -1,79 +1,86 @@ -import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; -import { isEns, isAddress, shorten0xString, replacer, saveBurnerSK, loadBurnerSK } from '../../src/lib/wagmi/ts/utils'; -import { type Address } from 'viem'; +import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"; +import { + isEns, + isAddress, + shorten0xString, + replacer, + saveBurnerSK, + loadBurnerSK +} from "../../src/lib/wagmi/ts/utils"; +import { type Address } from "viem"; declare const global: typeof globalThis; -describe('Address and ENS utilities', () => { - describe('isEns', () => { - it('should return false for null or undefined', () => { +describe("Address and ENS utilities", () => { + describe("isEns", () => { + it("should return false for null or undefined", () => { expect(isEns(null)).toBe(false); expect(isEns(undefined)).toBe(false); }); - it('should return true for valid .eth addresses', () => { - expect(isEns('vitalik.eth')).toBe(true); - expect(isEns('test-name.eth')).toBe(true); + it("should return true for valid .eth addresses", () => { + expect(isEns("vitalik.eth")).toBe(true); + expect(isEns("test-name.eth")).toBe(true); }); - it('should return false for non-.eth addresses', () => { - expect(isEns('vitalik')).toBe(false); - expect(isEns('test.com')).toBe(false); + it("should return false for non-.eth addresses", () => { + expect(isEns("vitalik")).toBe(false); + expect(isEns("test.com")).toBe(false); }); }); - describe('isAddress', () => { - it('should return false for null or undefined', () => { + describe("isAddress", () => { + it("should return false for null or undefined", () => { expect(isAddress(null)).toBe(false); expect(isAddress(undefined)).toBe(false); }); - it('should return true for valid Ethereum addresses', () => { - const validAddress = '0x742d35Cc6634C0532925a3b844Bc454e4438f44e' as Address; + it("should return true for valid Ethereum addresses", () => { + const validAddress = "0x742d35Cc6634C0532925a3b844Bc454e4438f44e" as Address; expect(isAddress(validAddress)).toBe(true); }); - it('should return false for invalid Ethereum addresses', () => { - expect(isAddress('0xinvalid')).toBe(false); - expect(isAddress('not an address')).toBe(false); + it("should return false for invalid Ethereum addresses", () => { + expect(isAddress("0xinvalid")).toBe(false); + expect(isAddress("not an address")).toBe(false); }); }); - describe('shorten0xString', () => { - it('should shorten address to format: 0x1234...5678', () => { - const address = '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'; - expect(shorten0xString(address as `0x${string}`)).toBe('0x742d35C...8f44e'); + describe("shorten0xString", () => { + it("should shorten address to format: 0x1234...5678", () => { + const address = "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"; + expect(shorten0xString(address as `0x${string}`)).toBe("0x742d35C...8f44e"); }); }); }); -describe('JSON utilities', () => { - describe('replacer', () => { - it('should convert BigInt to string', () => { - const bigIntValue = BigInt('123456789'); - expect(replacer('test', bigIntValue)).toBe('123456789'); +describe("JSON utilities", () => { + describe("replacer", () => { + it("should convert BigInt to string", () => { + const bigIntValue = BigInt("123456789"); + expect(replacer("test", bigIntValue)).toBe("123456789"); }); - it('should return non-BigInt values as is', () => { - expect(replacer('test', 123)).toBe(123); - expect(replacer('test', 'string')).toBe('string'); - expect(replacer('test', { key: 'value' })).toEqual({ key: 'value' }); + it("should return non-BigInt values as is", () => { + expect(replacer("test", 123)).toBe(123); + expect(replacer("test", "string")).toBe("string"); + expect(replacer("test", { key: "value" })).toEqual({ key: "value" }); }); }); }); -describe('Burner wallet utilities', () => { +describe("Burner wallet utilities", () => { let localStorageMock: { [key: string]: string }; beforeEach(() => { localStorageMock = {}; - vi.stubGlobal('window', { + vi.stubGlobal("window", { localStorage: { getItem: (key: string) => localStorageMock[key] || null, setItem: (key: string, value: string) => { localStorageMock[key] = value; - }, - }, + } + } }); }); @@ -81,34 +88,34 @@ describe('Burner wallet utilities', () => { vi.unstubAllGlobals(); }); - describe('saveBurnerSK', () => { - it('should save private key to localStorage', () => { - const testKey = '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'; + describe("saveBurnerSK", () => { + it("should save private key to localStorage", () => { + const testKey = "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"; saveBurnerSK(testKey as `0x${string}`); - expect(localStorageMock['wagmiSvelte5.burnerWallet.sk']).toBe(testKey); + expect(localStorageMock["wagmiSvelte5.burnerWallet.sk"]).toBe(testKey); }); - it('should handle undefined window object', () => { + it("should handle undefined window object", () => { (global as { window: unknown }).window = undefined; - const testKey = '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'; + const testKey = "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"; expect(() => saveBurnerSK(testKey as `0x${string}`)).not.toThrow(); }); }); - describe('loadBurnerSK', () => { - it('should load existing private key from localStorage', () => { - const testKey = '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'; - localStorageMock['wagmiSvelte5.burnerWallet.sk'] = testKey; + describe("loadBurnerSK", () => { + it("should load existing private key from localStorage", () => { + const testKey = "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"; + localStorageMock["wagmiSvelte5.burnerWallet.sk"] = testKey; expect(loadBurnerSK()).toBe(testKey); }); - it('should generate new private key if none exists', () => { + it("should generate new private key if none exists", () => { const result = loadBurnerSK(); expect(result).toMatch(/^0x[a-fA-F0-9]{64}$/); }); - it('should handle invalid localStorage key', () => { - localStorageMock['wagmiSvelte5.burnerWallet.sk'] = 'invalid-key'; + it("should handle invalid localStorage key", () => { + localStorageMock["wagmiSvelte5.burnerWallet.sk"] = "invalid-key"; const result = loadBurnerSK(); expect(result).toMatch(/^0x[a-fA-F0-9]{64}$/); }); diff --git a/turbo.json b/turbo.json new file mode 100644 index 0000000..fdca7f2 --- /dev/null +++ b/turbo.json @@ -0,0 +1,43 @@ +{ + "$schema": "https://turbo.build/schema.json", + "envMode": "strict", + "ui": "stream", + "tasks": { + "format": { + "inputs": ["src/**", "test/**"], + "outputLogs": "new-only" + }, + "check": { + "dependsOn": ["format"], + "outputLogs": "new-only" + }, + "build": { + "dependsOn": ["check"], + "outputLogs": "new-only" + }, + "test": { + "dependsOn": ["build"], + "cache": false, + "outputLogs": "new-only" + }, + "dev": { + "cache": false, + "persistent": true, + "inputs": ["src/**"], + "outputLogs": "new-only" + }, + "start": { + "dependsOn": ["check"], + "cache": false, + "persistent": true, + "inputs": ["src/**"], + "outputLogs": "new-only" + }, + "preview": { + "dependsOn": ["build"], + "cache": false, + "persistent": true, + "outputLogs": "new-only" + } + } +} diff --git a/vite.config.ts b/vite.config.ts index b76d114..02606cc 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,5 +6,8 @@ import deploymentsJson from "./deployments.json"; export default defineConfig({ plugins: [sveltekit()], server: { open: true }, - define: { __DEPLOYMENTS_JSON__: deploymentsJson } + define: { + __DEPLOYMENTS_JSON__: deploymentsJson, + "process.env.NODE_ENV": '"development"' + } }); diff --git a/vitest.config.ts b/vitest.config.ts index 945bd46..ba96a58 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,19 +1,19 @@ -import { defineConfig } from 'vitest/config' -import { svelte } from '@sveltejs/vite-plugin-svelte' -import { resolve } from 'path' +import { defineConfig } from "vitest/config"; +import { svelte } from "@sveltejs/vite-plugin-svelte"; +import { resolve } from "path"; export default defineConfig({ plugins: [svelte({ hot: !process.env.VITEST })], test: { - include: ['tests/unit/**/*.{test,spec,t}.{js,ts}'], - environment: 'happy-dom', + include: ["tests/unit/**/*.{test,spec,t}.{js,ts}"], + environment: "happy-dom", globals: true, - setupFiles: ['tests/unit/setup.ts'], + setupFiles: ["tests/unit/setup.ts"], testTimeout: 10000, hookTimeout: 10000, teardownTimeout: 10000, isolate: false, - pool: 'threads', + pool: "threads", environmentOptions: { happyDOM: { settings: { @@ -24,9 +24,9 @@ export default defineConfig({ }, resolve: { alias: { - '$env': resolve(__dirname, './tests/unit/mocks/env'), - '$lib': resolve(__dirname, './src/lib'), - '@wagmi-svelte5': resolve(__dirname, './src/lib/wagmi/index.ts') + $env: resolve(__dirname, "./tests/unit/mocks/env"), + $lib: resolve(__dirname, "./src/lib"), + "@wagmi-svelte5": resolve(__dirname, "./src/lib/wagmi/index.ts") } } -}) +});