From 59242dc2bf9631a6bf51bfe0951de4cf79768784 Mon Sep 17 00:00:00 2001 From: "zapaz.eth" Date: Sun, 27 Oct 2024 11:05:01 +0100 Subject: [PATCH] optimize svelte5 code --- foundry/addresses.json | 4 +- pnpm-lock.yaml | 155 +++++++++--------- svelte5/src/lib/deployments.json | 6 +- .../src/lib/onchain-ai/components/Chat.svelte | 9 +- .../src/lib/onchain-ai/components/Read.svelte | 52 ------ .../Events.svelte => runes/events.svelte.ts} | 62 +++---- .../src/lib/onchain-ai/runes/read.svelte.ts | 27 +-- svelte5/src/lib/onchain-ai/types.ts | 27 ++- svelte5/src/routes/events/+page.svelte | 29 ++-- svelte5/src/routes/tests/last/+page.svelte | 17 ++ svelte5/src/routes/tests/owner/+page.svelte | 11 ++ .../src/routes/tests/read-pair/+page.svelte | 46 ------ 12 files changed, 184 insertions(+), 261 deletions(-) delete mode 100644 svelte5/src/lib/onchain-ai/components/Read.svelte rename svelte5/src/lib/onchain-ai/{components/Events.svelte => runes/events.svelte.ts} (65%) create mode 100644 svelte5/src/routes/tests/last/+page.svelte create mode 100644 svelte5/src/routes/tests/owner/+page.svelte delete mode 100644 svelte5/src/routes/tests/read-pair/+page.svelte diff --git a/foundry/addresses.json b/foundry/addresses.json index c52300a..a74c471 100644 --- a/foundry/addresses.json +++ b/foundry/addresses.json @@ -2,7 +2,7 @@ "11155420": { "Counter": "0x8354Ef7b78012151c276f51F8d19147FF8C47288", "OnChainAI": "0xd1ca741de2d2975822ADf4646Cf0A8AE3Df51c78", - "OnChainAIv1": "0x9ee2948E17b4C25434c7D0D252E71201A2D87B05", + "OnChainAIv1": "0x432beBA9B2Fc71180FF9ba3fA93E1Ae88beDF402", "chainName": "optimism-sepolia" }, "31337": { @@ -19,7 +19,7 @@ "84532": { "Counter": "0x1bC96A82609F23419065FCEf120E16E2A6Bd3981", "OnChainAI": "0xCB60F4a4e578CDDBe89e4a27B2126f54BaeF3500", - "OnChainAIv1": "0x93EB497b305D2cC4Fa3AC62009258EaE951043dB", + "OnChainAIv1": "0xBf196B3732880a51Eaa6Cfc38d82De1A61582B06", "chainName": "base-sepolia" } } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4924f9c..67d52eb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1744,83 +1744,88 @@ packages: '@types/react': optional: true - '@rollup/rollup-android-arm-eabi@4.24.0': - resolution: {integrity: sha512-Q6HJd7Y6xdB48x8ZNVDOqsbh2uByBhgK8PiQgPhwkIw/HC/YX5Ghq2mQY5sRMZWHb3VsFkWooUVOZHKr7DmDIA==} + '@rollup/rollup-android-arm-eabi@4.24.1': + resolution: {integrity: sha512-j2llrtCTwNu68yp1wybgkTUW8CrR8AZvGZzIO/qwNAetVP3FHidylyz1s0dU2zXG9uqqpoUIhWKmMypGMcdM2Q==} cpu: [arm] os: [android] - '@rollup/rollup-android-arm64@4.24.0': - resolution: {integrity: sha512-ijLnS1qFId8xhKjT81uBHuuJp2lU4x2yxa4ctFPtG+MqEE6+C5f/+X/bStmxapgmwLwiL3ih122xv8kVARNAZA==} + '@rollup/rollup-android-arm64@4.24.1': + resolution: {integrity: sha512-y65R3hM9sJVAXV3qh/dJ5o2OCVzwy6d994qmi+rGw1i1onYY5AoV9dREDYoizaZvc9esEqOs07CyFgPzz4DBqg==} cpu: [arm64] os: [android] - '@rollup/rollup-darwin-arm64@4.24.0': - resolution: {integrity: sha512-bIv+X9xeSs1XCk6DVvkO+S/z8/2AMt/2lMqdQbMrmVpgFvXlmde9mLcbQpztXm1tajC3raFDqegsH18HQPMYtA==} + '@rollup/rollup-darwin-arm64@4.24.1': + resolution: {integrity: sha512-K9iOc75U9HpDffjop9qVPwNoBEPXS0Q6RrVSvh13gs38ynurJ2+HuS7NJbsx+fwiDA+eJYfBi7sablI8G2/3oA==} cpu: [arm64] os: [darwin] - '@rollup/rollup-darwin-x64@4.24.0': - resolution: {integrity: sha512-X6/nOwoFN7RT2svEQWUsW/5C/fYMBe4fnLK9DQk4SX4mgVBiTA9h64kjUYPvGQ0F/9xwJ5U5UfTbl6BEjaQdBQ==} + '@rollup/rollup-darwin-x64@4.24.1': + resolution: {integrity: sha512-Ufz0fX79W9937euBI4qEdh2xLb0Lzo4GiZ7xxDpueEZxWdPbow6gnTRokSzSgtqRFs1vFgcgm7Ci/KnOo15MIg==} cpu: [x64] os: [darwin] - '@rollup/rollup-linux-arm-gnueabihf@4.24.0': - resolution: {integrity: sha512-0KXvIJQMOImLCVCz9uvvdPgfyWo93aHHp8ui3FrtOP57svqrF/roSSR5pjqL2hcMp0ljeGlU4q9o/rQaAQ3AYA==} + '@rollup/rollup-freebsd-x64@4.24.1': + resolution: {integrity: sha512-IfG1khuwe10V2EBfFIrcd7P6X0stdhHQM71NyaG5TPgy6dXr2nzAa5TMNFA35tr41gihUPqp/w8StayYG7jXYw==} + cpu: [x64] + os: [freebsd] + + '@rollup/rollup-linux-arm-gnueabihf@4.24.1': + resolution: {integrity: sha512-W+drJRBL1+N1/zaq+8y/CtQ3VP5wxMXwCy7obFl9r5jJ5EFNEYAqchuPfYTleYOoA46bwXAprCL+OVK3BTrWWw==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm-musleabihf@4.24.0': - resolution: {integrity: sha512-it2BW6kKFVh8xk/BnHfakEeoLPv8STIISekpoF+nBgWM4d55CZKc7T4Dx1pEbTnYm/xEKMgy1MNtYuoA8RFIWw==} + '@rollup/rollup-linux-arm-musleabihf@4.24.1': + resolution: {integrity: sha512-mKngr0zxo4FMSDqiq4F4G/1IPqjpNO7MyjAM6+YxDIADO4ZSI4m05bZYD4po12Jid6+n9YJRWdIcvi4JztMVcw==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm64-gnu@4.24.0': - resolution: {integrity: sha512-i0xTLXjqap2eRfulFVlSnM5dEbTVque/3Pi4g2y7cxrs7+a9De42z4XxKLYJ7+OhE3IgxvfQM7vQc43bwTgPwA==} + '@rollup/rollup-linux-arm64-gnu@4.24.1': + resolution: {integrity: sha512-Rh12WITgvLydYFR9XAjmCRArU71nMfi5lDVLhpRV8dR2sCGtZESVkfD66mi3owp4q1scwysT35nNMPleRTQOow==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-arm64-musl@4.24.0': - resolution: {integrity: sha512-9E6MKUJhDuDh604Qco5yP/3qn3y7SLXYuiC0Rpr89aMScS2UAmK1wHP2b7KAa1nSjWJc/f/Lc0Wl1L47qjiyQw==} + '@rollup/rollup-linux-arm64-musl@4.24.1': + resolution: {integrity: sha512-zOLu7V1iBpJMIrrmZjpmAZ9txFlnGgqQMnjNmRrqmV1vQaou9SIT3qI3JE1kt+DQE8zCdB3n2/mAjIU90AfjEg==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-powerpc64le-gnu@4.24.0': - resolution: {integrity: sha512-2XFFPJ2XMEiF5Zi2EBf4h73oR1V/lycirxZxHZNc93SqDN/IWhYYSYj8I9381ikUFXZrz2v7r2tOVk2NBwxrWw==} + '@rollup/rollup-linux-powerpc64le-gnu@4.24.1': + resolution: {integrity: sha512-h9ipTGhMzTBAJL/bg1HsElhGPWLGeCKE8JkxgvrJ5O/S1MXH9RxMUTl++tzlpzxdOBCAGqygZIMBj3wIDf/kJw==} cpu: [ppc64] os: [linux] - '@rollup/rollup-linux-riscv64-gnu@4.24.0': - resolution: {integrity: sha512-M3Dg4hlwuntUCdzU7KjYqbbd+BLq3JMAOhCKdBE3TcMGMZbKkDdJ5ivNdehOssMCIokNHFOsv7DO4rlEOfyKpg==} + '@rollup/rollup-linux-riscv64-gnu@4.24.1': + resolution: {integrity: sha512-PNKCMA1xRBARR7/j6KXMSB1z0/eGenC/t2wdQl5et3jnrHA+igIaLVNUEPfnVjmZIZJign7u/dobvV2VkPxMiw==} cpu: [riscv64] os: [linux] - '@rollup/rollup-linux-s390x-gnu@4.24.0': - resolution: {integrity: sha512-mjBaoo4ocxJppTorZVKWFpy1bfFj9FeCMJqzlMQGjpNPY9JwQi7OuS1axzNIk0nMX6jSgy6ZURDZ2w0QW6D56g==} + '@rollup/rollup-linux-s390x-gnu@4.24.1': + resolution: {integrity: sha512-mkl3uWq/ix18gAfzBUIecSwioPyJkbR6QXVaNuOGM7Qbs7f1EfDLP4XtLSJx4GL6mO8GrKhB3cmhUc3zjUrQSg==} cpu: [s390x] os: [linux] - '@rollup/rollup-linux-x64-gnu@4.24.0': - resolution: {integrity: sha512-ZXFk7M72R0YYFN5q13niV0B7G8/5dcQ9JDp8keJSfr3GoZeXEoMHP/HlvqROA3OMbMdfr19IjCeNAnPUG93b6A==} + '@rollup/rollup-linux-x64-gnu@4.24.1': + resolution: {integrity: sha512-j0RPQWteEXAAxRQI+IcX3i7WQb7hFe7CW94H3l0edBVyJMIPOlr/hqc5CGG1FBDW9gNr0ZC2IzwSta1iSNJIoA==} cpu: [x64] os: [linux] - '@rollup/rollup-linux-x64-musl@4.24.0': - resolution: {integrity: sha512-w1i+L7kAXZNdYl+vFvzSZy8Y1arS7vMgIy8wusXJzRrPyof5LAb02KGr1PD2EkRcl73kHulIID0M501lN+vobQ==} + '@rollup/rollup-linux-x64-musl@4.24.1': + resolution: {integrity: sha512-UrwXowd3gyT+/ijoeSzMyHHGUaV3WhiJL77eTZE8/Pq+9K6auacIJ264biAUhHJ3FjAHsXNhzEmxGnj4tpDz2g==} cpu: [x64] os: [linux] - '@rollup/rollup-win32-arm64-msvc@4.24.0': - resolution: {integrity: sha512-VXBrnPWgBpVDCVY6XF3LEW0pOU51KbaHhccHw6AS6vBWIC60eqsH19DAeeObl+g8nKAz04QFdl/Cefta0xQtUQ==} + '@rollup/rollup-win32-arm64-msvc@4.24.1': + resolution: {integrity: sha512-wexHPBkBa2/tPhbGcxLqOM2AFZ7BQsZ0pk3dVxRL5Ec0SsXnkpcMucZ4j4woyoD5DbRdFP6Roptd9TRsGVTvUA==} cpu: [arm64] os: [win32] - '@rollup/rollup-win32-ia32-msvc@4.24.0': - resolution: {integrity: sha512-xrNcGDU0OxVcPTH/8n/ShH4UevZxKIO6HJFK0e15XItZP2UcaiLFd5kiX7hJnqCbSztUF8Qot+JWBC/QXRPYWQ==} + '@rollup/rollup-win32-ia32-msvc@4.24.1': + resolution: {integrity: sha512-IW2axCCdiC+kgj5/50Mt5v8qG0LYaDichBGKXM4Oo2NaWStAs0oQp1dqVzCV1XOXNvNNDRFw0EaT+JMs6BX+WQ==} cpu: [ia32] os: [win32] - '@rollup/rollup-win32-x64-msvc@4.24.0': - resolution: {integrity: sha512-fbMkAF7fufku0N2dE5TBXcNlg0pt0cJue4xBRE2Qc5Vqikxr4VCgKj/ht6SMdFcOacVA9rqF70APJ8RN/4vMJw==} + '@rollup/rollup-win32-x64-msvc@4.24.1': + resolution: {integrity: sha512-b9IK2buRXwm7owl4Hd8fselCQ7/gr2WaErv0e/IPgRQuJfFS+O0cFJA4t13+FKAZeQh97iEyBG06g613IJLirQ==} cpu: [x64] os: [win32] @@ -2961,8 +2966,8 @@ packages: resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} engines: {node: '>=10'} - caniuse-lite@1.0.30001671: - resolution: {integrity: sha512-jocyVaSSfXg2faluE6hrWkMgDOiULBMca4QLtDT39hw1YxaIPHWc1CcTCKkPmHgGH6tKji6ZNbMSmUAvENf2/A==} + caniuse-lite@1.0.30001672: + resolution: {integrity: sha512-XhW1vRo1ob6aeK2w3rTohwTPBLse/rvjq+s3RTSBwnlZqoFFjx9cHsShJjAIbLsLjyoacaTxpLZy9v3gg6zypw==} catering@2.1.1: resolution: {integrity: sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w==} @@ -5320,8 +5325,8 @@ packages: resolution: {integrity: sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ==} hasBin: true - rollup@4.24.0: - resolution: {integrity: sha512-DOmrlGSXNk1DM0ljiQA+i+o0rSLhtii1je5wgk60j49d1jHT5YYttBv1iWOnYSTG+fZZESUOSNiAl89SIet+Cg==} + rollup@4.24.1: + resolution: {integrity: sha512-2lhtdsnyxlfBAZVh9tfriEc1nV9HxjQGnqEpd7z7cWXuLbI4jHWDhAvw6JGs0AVcnYqv0gL7Mjuj/utxW2wPBw==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true @@ -8683,52 +8688,55 @@ snapshots: react: 18.3.1 react-native: 0.76.0(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(bufferutil@4.0.8)(react@18.3.1)(utf-8-validate@5.0.10) - '@rollup/rollup-android-arm-eabi@4.24.0': + '@rollup/rollup-android-arm-eabi@4.24.1': + optional: true + + '@rollup/rollup-android-arm64@4.24.1': optional: true - '@rollup/rollup-android-arm64@4.24.0': + '@rollup/rollup-darwin-arm64@4.24.1': optional: true - '@rollup/rollup-darwin-arm64@4.24.0': + '@rollup/rollup-darwin-x64@4.24.1': optional: true - '@rollup/rollup-darwin-x64@4.24.0': + '@rollup/rollup-freebsd-x64@4.24.1': optional: true - '@rollup/rollup-linux-arm-gnueabihf@4.24.0': + '@rollup/rollup-linux-arm-gnueabihf@4.24.1': optional: true - '@rollup/rollup-linux-arm-musleabihf@4.24.0': + '@rollup/rollup-linux-arm-musleabihf@4.24.1': optional: true - '@rollup/rollup-linux-arm64-gnu@4.24.0': + '@rollup/rollup-linux-arm64-gnu@4.24.1': optional: true - '@rollup/rollup-linux-arm64-musl@4.24.0': + '@rollup/rollup-linux-arm64-musl@4.24.1': optional: true - '@rollup/rollup-linux-powerpc64le-gnu@4.24.0': + '@rollup/rollup-linux-powerpc64le-gnu@4.24.1': optional: true - '@rollup/rollup-linux-riscv64-gnu@4.24.0': + '@rollup/rollup-linux-riscv64-gnu@4.24.1': optional: true - '@rollup/rollup-linux-s390x-gnu@4.24.0': + '@rollup/rollup-linux-s390x-gnu@4.24.1': optional: true - '@rollup/rollup-linux-x64-gnu@4.24.0': + '@rollup/rollup-linux-x64-gnu@4.24.1': optional: true - '@rollup/rollup-linux-x64-musl@4.24.0': + '@rollup/rollup-linux-x64-musl@4.24.1': optional: true - '@rollup/rollup-win32-arm64-msvc@4.24.0': + '@rollup/rollup-win32-arm64-msvc@4.24.1': optional: true - '@rollup/rollup-win32-ia32-msvc@4.24.0': + '@rollup/rollup-win32-ia32-msvc@4.24.1': optional: true - '@rollup/rollup-win32-x64-msvc@4.24.0': + '@rollup/rollup-win32-x64-msvc@4.24.1': optional: true '@safe-global/safe-apps-provider@0.18.3(bufferutil@4.0.8)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.22.4)': @@ -10435,7 +10443,7 @@ snapshots: autoprefixer@10.4.20(postcss@8.4.47): dependencies: browserslist: 4.24.2 - caniuse-lite: 1.0.30001671 + caniuse-lite: 1.0.30001672 fraction.js: 4.3.7 normalize-range: 0.1.2 picocolors: 1.1.1 @@ -10639,7 +10647,7 @@ snapshots: browserslist@4.24.2: dependencies: - caniuse-lite: 1.0.30001671 + caniuse-lite: 1.0.30001672 electron-to-chromium: 1.5.47 node-releases: 2.0.18 update-browserslist-db: 1.1.1(browserslist@4.24.2) @@ -10728,7 +10736,7 @@ snapshots: camelcase@6.3.0: {} - caniuse-lite@1.0.30001671: {} + caniuse-lite@1.0.30001672: {} catering@2.1.1: {} @@ -13274,26 +13282,27 @@ snapshots: dependencies: bn.js: 5.2.1 - rollup@4.24.0: + rollup@4.24.1: dependencies: '@types/estree': 1.0.6 optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.24.0 - '@rollup/rollup-android-arm64': 4.24.0 - '@rollup/rollup-darwin-arm64': 4.24.0 - '@rollup/rollup-darwin-x64': 4.24.0 - '@rollup/rollup-linux-arm-gnueabihf': 4.24.0 - '@rollup/rollup-linux-arm-musleabihf': 4.24.0 - '@rollup/rollup-linux-arm64-gnu': 4.24.0 - '@rollup/rollup-linux-arm64-musl': 4.24.0 - '@rollup/rollup-linux-powerpc64le-gnu': 4.24.0 - '@rollup/rollup-linux-riscv64-gnu': 4.24.0 - '@rollup/rollup-linux-s390x-gnu': 4.24.0 - '@rollup/rollup-linux-x64-gnu': 4.24.0 - '@rollup/rollup-linux-x64-musl': 4.24.0 - '@rollup/rollup-win32-arm64-msvc': 4.24.0 - '@rollup/rollup-win32-ia32-msvc': 4.24.0 - '@rollup/rollup-win32-x64-msvc': 4.24.0 + '@rollup/rollup-android-arm-eabi': 4.24.1 + '@rollup/rollup-android-arm64': 4.24.1 + '@rollup/rollup-darwin-arm64': 4.24.1 + '@rollup/rollup-darwin-x64': 4.24.1 + '@rollup/rollup-freebsd-x64': 4.24.1 + '@rollup/rollup-linux-arm-gnueabihf': 4.24.1 + '@rollup/rollup-linux-arm-musleabihf': 4.24.1 + '@rollup/rollup-linux-arm64-gnu': 4.24.1 + '@rollup/rollup-linux-arm64-musl': 4.24.1 + '@rollup/rollup-linux-powerpc64le-gnu': 4.24.1 + '@rollup/rollup-linux-riscv64-gnu': 4.24.1 + '@rollup/rollup-linux-s390x-gnu': 4.24.1 + '@rollup/rollup-linux-x64-gnu': 4.24.1 + '@rollup/rollup-linux-x64-musl': 4.24.1 + '@rollup/rollup-win32-arm64-msvc': 4.24.1 + '@rollup/rollup-win32-ia32-msvc': 4.24.1 + '@rollup/rollup-win32-x64-msvc': 4.24.1 fsevents: 2.3.3 run-parallel@1.2.0: @@ -14064,7 +14073,7 @@ snapshots: dependencies: esbuild: 0.21.5 postcss: 8.4.47 - rollup: 4.24.0 + rollup: 4.24.1 optionalDependencies: '@types/node': 22.8.1 fsevents: 2.3.3 diff --git a/svelte5/src/lib/deployments.json b/svelte5/src/lib/deployments.json index 80d5bf0..f01805a 100644 --- a/svelte5/src/lib/deployments.json +++ b/svelte5/src/lib/deployments.json @@ -1079,7 +1079,7 @@ ] }, "OnChainAIv1": { - "address": "0x93EB497b305D2cC4Fa3AC62009258EaE951043dB", + "address": "0xBf196B3732880a51Eaa6Cfc38d82De1A61582B06", "abi": [ { "type": "constructor", @@ -1618,7 +1618,7 @@ ] }, "OnChainAIv1": { - "address": "0x9ee2948E17b4C25434c7D0D252E71201A2D87B05", + "address": "0x432beBA9B2Fc71180FF9ba3fA93E1Ae88beDF402", "abi": [ { "type": "constructor", @@ -2117,4 +2117,4 @@ ] } } -} \ No newline at end of file +} diff --git a/svelte5/src/lib/onchain-ai/components/Chat.svelte b/svelte5/src/lib/onchain-ai/components/Chat.svelte index d950c8f..4a151d3 100644 --- a/svelte5/src/lib/onchain-ai/components/Chat.svelte +++ b/svelte5/src/lib/onchain-ai/components/Chat.svelte @@ -1,8 +1,7 @@ @@ -40,10 +39,6 @@ {/if} -
- -
-