From bf94dbe1d29910e0b50457a87f2213f93a225daa Mon Sep 17 00:00:00 2001 From: CJskii Date: Thu, 2 May 2024 17:05:30 +0100 Subject: [PATCH 1/9] fix: tezos imports --- example/src/components/siwTezos.tsx | 2 +- example/src/pages/api/auth/[...nextauth].ts | 2 +- pnpm-lock.yaml | 832 +++++++++++++++++++- 3 files changed, 814 insertions(+), 22 deletions(-) diff --git a/example/src/components/siwTezos.tsx b/example/src/components/siwTezos.tsx index 3bf9c84..3cf0914 100644 --- a/example/src/components/siwTezos.tsx +++ b/example/src/components/siwTezos.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect } from "react"; -import { SiwTezosMessage } from "@learnweb3dao/siwTezos"; +import { SiwTezosMessage } from "@learnweb3dao/siwtezos"; import { TezosToolkit } from "@taquito/taquito"; import { BeaconWallet } from "@taquito/beacon-wallet"; import { getCsrfToken, signIn } from "next-auth/react"; diff --git a/example/src/pages/api/auth/[...nextauth].ts b/example/src/pages/api/auth/[...nextauth].ts index da7b23b..cf7c75d 100644 --- a/example/src/pages/api/auth/[...nextauth].ts +++ b/example/src/pages/api/auth/[...nextauth].ts @@ -1,4 +1,4 @@ -import { SiwTezosMessage } from "@learnweb3dao/siwTezos"; +import { SiwTezosMessage } from "@learnweb3dao/siwtezos"; import { SiweMessage } from "@learnweb3dao/siwe"; import { SiwsMessage } from "@learnweb3dao/siws"; import { SiwStacksMessage } from "@learnweb3dao/siwstacks"; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 517aa8d..08a40dd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -37,7 +37,7 @@ importers: version: 4.0.12 '@learnweb3dao/siwe': specifier: workspace:^ - version: link:../packages/eip155 + version: link:../packages/fuel '@learnweb3dao/siws': specifier: workspace:^ version: link:../packages/solana @@ -151,6 +151,31 @@ importers: specifier: ^10.9.1 version: 10.9.1(@types/node@18.16.3)(typescript@5.3.3) + packages/fuel: + dependencies: + '@learnweb3dao/siwx-common': + specifier: ^0.3.0 + version: link:../common + ethers: + specifier: '5' + version: 5.7.2 + fuels: + specifier: ^0.83.0 + version: 0.83.0 + devDependencies: + '@types/jest': + specifier: ^29.5.1 + version: 29.5.1 + jest: + specifier: ^29.5.0 + version: 29.5.0(@types/node@18.16.3)(ts-node@10.9.1) + ts-jest: + specifier: ^29.1.0 + version: 29.1.0(@babel/core@7.21.8)(esbuild@0.19.12)(jest@29.5.0)(typescript@5.3.3) + ts-node: + specifier: ^10.9.1 + version: 10.9.1(@types/node@18.16.3)(typescript@5.3.3) + packages/solana: dependencies: '@learnweb3dao/siwx-common': @@ -209,6 +234,19 @@ importers: starknet: specifier: ^5.19.5 version: 5.19.5 + devDependencies: + '@types/jest': + specifier: ^29.5.1 + version: 29.5.1 + jest: + specifier: ^29.5.0 + version: 29.5.0(@types/node@18.16.3)(ts-node@10.9.1) + ts-jest: + specifier: ^29.1.0 + version: 29.1.0(@babel/core@7.21.8)(esbuild@0.19.12)(jest@29.5.0)(typescript@5.3.3) + ts-node: + specifier: ^10.9.1 + version: 10.9.1(@types/node@18.16.3)(typescript@5.3.3) packages/tezos: dependencies: @@ -245,6 +283,10 @@ packages: engines: {node: '>=0.10.0'} dev: false + /@adraffy/ens-normalize@1.10.1: + resolution: {integrity: sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==} + dev: false + /@airgap/beacon-core@4.0.12: resolution: {integrity: sha512-Hg2xMug9mR0EdNuCfwrpHiQJlNzyJpFxqZdWsMEkQQ/AA9kdUGVAVV0BSb5GiJ7R1t3WE1pTr9+WrYm5O/xzJg==} dependencies: @@ -932,6 +974,14 @@ packages: get-tsconfig: 4.5.0 dev: true + /@esbuild/aix-ppc64@0.19.12: + resolution: {integrity: sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [aix] + requiresBuild: true + optional: true + /@esbuild/android-arm64@0.17.18: resolution: {integrity: sha512-/iq0aK0eeHgSC3z55ucMAHO05OIqmQehiGay8eP5l/5l+iEr4EIbh4/MI8xD9qRFjqzgkc0JkX0LculNC9mXBw==} engines: {node: '>=12'} @@ -941,6 +991,14 @@ packages: dev: true optional: true + /@esbuild/android-arm64@0.19.12: + resolution: {integrity: sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + optional: true + /@esbuild/android-arm@0.17.18: resolution: {integrity: sha512-EmwL+vUBZJ7mhFCs5lA4ZimpUH3WMAoqvOIYhVQwdIgSpHC8ImHdsRyhHAVxpDYUSm0lWvd63z0XH1IlImS2Qw==} engines: {node: '>=12'} @@ -950,6 +1008,14 @@ packages: dev: true optional: true + /@esbuild/android-arm@0.19.12: + resolution: {integrity: sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + optional: true + /@esbuild/android-x64@0.17.18: resolution: {integrity: sha512-x+0efYNBF3NPW2Xc5bFOSFW7tTXdAcpfEg2nXmxegm4mJuVeS+i109m/7HMiOQ6M12aVGGFlqJX3RhNdYM2lWg==} engines: {node: '>=12'} @@ -959,6 +1025,14 @@ packages: dev: true optional: true + /@esbuild/android-x64@0.19.12: + resolution: {integrity: sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + optional: true + /@esbuild/darwin-arm64@0.17.18: resolution: {integrity: sha512-6tY+djEAdF48M1ONWnQb1C+6LiXrKjmqjzPNPWXhu/GzOHTHX2nh8Mo2ZAmBFg0kIodHhciEgUBtcYCAIjGbjQ==} engines: {node: '>=12'} @@ -968,6 +1042,14 @@ packages: dev: true optional: true + /@esbuild/darwin-arm64@0.19.12: + resolution: {integrity: sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + optional: true + /@esbuild/darwin-x64@0.17.18: resolution: {integrity: sha512-Qq84ykvLvya3dO49wVC9FFCNUfSrQJLbxhoQk/TE1r6MjHo3sFF2tlJCwMjhkBVq3/ahUisj7+EpRSz0/+8+9A==} engines: {node: '>=12'} @@ -977,6 +1059,14 @@ packages: dev: true optional: true + /@esbuild/darwin-x64@0.19.12: + resolution: {integrity: sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + optional: true + /@esbuild/freebsd-arm64@0.17.18: resolution: {integrity: sha512-fw/ZfxfAzuHfaQeMDhbzxp9mc+mHn1Y94VDHFHjGvt2Uxl10mT4CDavHm+/L9KG441t1QdABqkVYwakMUeyLRA==} engines: {node: '>=12'} @@ -986,6 +1076,14 @@ packages: dev: true optional: true + /@esbuild/freebsd-arm64@0.19.12: + resolution: {integrity: sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + optional: true + /@esbuild/freebsd-x64@0.17.18: resolution: {integrity: sha512-FQFbRtTaEi8ZBi/A6kxOC0V0E9B/97vPdYjY9NdawyLd4Qk5VD5g2pbWN2VR1c0xhzcJm74HWpObPszWC+qTew==} engines: {node: '>=12'} @@ -995,6 +1093,14 @@ packages: dev: true optional: true + /@esbuild/freebsd-x64@0.19.12: + resolution: {integrity: sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + optional: true + /@esbuild/linux-arm64@0.17.18: resolution: {integrity: sha512-R7pZvQZFOY2sxUG8P6A21eq6q+eBv7JPQYIybHVf1XkQYC+lT7nDBdC7wWKTrbvMXKRaGudp/dzZCwL/863mZQ==} engines: {node: '>=12'} @@ -1004,6 +1110,14 @@ packages: dev: true optional: true + /@esbuild/linux-arm64@0.19.12: + resolution: {integrity: sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + optional: true + /@esbuild/linux-arm@0.17.18: resolution: {integrity: sha512-jW+UCM40LzHcouIaqv3e/oRs0JM76JfhHjCavPxMUti7VAPh8CaGSlS7cmyrdpzSk7A+8f0hiedHqr/LMnfijg==} engines: {node: '>=12'} @@ -1013,6 +1127,14 @@ packages: dev: true optional: true + /@esbuild/linux-arm@0.19.12: + resolution: {integrity: sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + optional: true + /@esbuild/linux-ia32@0.17.18: resolution: {integrity: sha512-ygIMc3I7wxgXIxk6j3V00VlABIjq260i967Cp9BNAk5pOOpIXmd1RFQJQX9Io7KRsthDrQYrtcx7QCof4o3ZoQ==} engines: {node: '>=12'} @@ -1022,6 +1144,14 @@ packages: dev: true optional: true + /@esbuild/linux-ia32@0.19.12: + resolution: {integrity: sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + optional: true + /@esbuild/linux-loong64@0.17.18: resolution: {integrity: sha512-bvPG+MyFs5ZlwYclCG1D744oHk1Pv7j8psF5TfYx7otCVmcJsEXgFEhQkbhNW8otDHL1a2KDINW20cfCgnzgMQ==} engines: {node: '>=12'} @@ -1031,6 +1161,14 @@ packages: dev: true optional: true + /@esbuild/linux-loong64@0.19.12: + resolution: {integrity: sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + optional: true + /@esbuild/linux-mips64el@0.17.18: resolution: {integrity: sha512-oVqckATOAGuiUOa6wr8TXaVPSa+6IwVJrGidmNZS1cZVx0HqkTMkqFGD2HIx9H1RvOwFeWYdaYbdY6B89KUMxA==} engines: {node: '>=12'} @@ -1040,6 +1178,14 @@ packages: dev: true optional: true + /@esbuild/linux-mips64el@0.19.12: + resolution: {integrity: sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + optional: true + /@esbuild/linux-ppc64@0.17.18: resolution: {integrity: sha512-3dLlQO+b/LnQNxgH4l9rqa2/IwRJVN9u/bK63FhOPB4xqiRqlQAU0qDU3JJuf0BmaH0yytTBdoSBHrb2jqc5qQ==} engines: {node: '>=12'} @@ -1049,6 +1195,14 @@ packages: dev: true optional: true + /@esbuild/linux-ppc64@0.19.12: + resolution: {integrity: sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + optional: true + /@esbuild/linux-riscv64@0.17.18: resolution: {integrity: sha512-/x7leOyDPjZV3TcsdfrSI107zItVnsX1q2nho7hbbQoKnmoeUWjs+08rKKt4AUXju7+3aRZSsKrJtaRmsdL1xA==} engines: {node: '>=12'} @@ -1058,6 +1212,14 @@ packages: dev: true optional: true + /@esbuild/linux-riscv64@0.19.12: + resolution: {integrity: sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + optional: true + /@esbuild/linux-s390x@0.17.18: resolution: {integrity: sha512-cX0I8Q9xQkL/6F5zWdYmVf5JSQt+ZfZD2bJudZrWD+4mnUvoZ3TDDXtDX2mUaq6upMFv9FlfIh4Gfun0tbGzuw==} engines: {node: '>=12'} @@ -1067,6 +1229,14 @@ packages: dev: true optional: true + /@esbuild/linux-s390x@0.19.12: + resolution: {integrity: sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + optional: true + /@esbuild/linux-x64@0.17.18: resolution: {integrity: sha512-66RmRsPlYy4jFl0vG80GcNRdirx4nVWAzJmXkevgphP1qf4dsLQCpSKGM3DUQCojwU1hnepI63gNZdrr02wHUA==} engines: {node: '>=12'} @@ -1076,6 +1246,14 @@ packages: dev: true optional: true + /@esbuild/linux-x64@0.19.12: + resolution: {integrity: sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + optional: true + /@esbuild/netbsd-x64@0.17.18: resolution: {integrity: sha512-95IRY7mI2yrkLlTLb1gpDxdC5WLC5mZDi+kA9dmM5XAGxCME0F8i4bYH4jZreaJ6lIZ0B8hTrweqG1fUyW7jbg==} engines: {node: '>=12'} @@ -1085,6 +1263,14 @@ packages: dev: true optional: true + /@esbuild/netbsd-x64@0.19.12: + resolution: {integrity: sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + optional: true + /@esbuild/openbsd-x64@0.17.18: resolution: {integrity: sha512-WevVOgcng+8hSZ4Q3BKL3n1xTv5H6Nb53cBrtzzEjDbbnOmucEVcZeGCsCOi9bAOcDYEeBZbD2SJNBxlfP3qiA==} engines: {node: '>=12'} @@ -1094,6 +1280,14 @@ packages: dev: true optional: true + /@esbuild/openbsd-x64@0.19.12: + resolution: {integrity: sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + optional: true + /@esbuild/sunos-x64@0.17.18: resolution: {integrity: sha512-Rzf4QfQagnwhQXVBS3BYUlxmEbcV7MY+BH5vfDZekU5eYpcffHSyjU8T0xucKVuOcdCsMo+Ur5wmgQJH2GfNrg==} engines: {node: '>=12'} @@ -1103,6 +1297,14 @@ packages: dev: true optional: true + /@esbuild/sunos-x64@0.19.12: + resolution: {integrity: sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + optional: true + /@esbuild/win32-arm64@0.17.18: resolution: {integrity: sha512-Kb3Ko/KKaWhjeAm2YoT/cNZaHaD1Yk/pa3FTsmqo9uFh1D1Rfco7BBLIPdDOozrObj2sahslFuAQGvWbgWldAg==} engines: {node: '>=12'} @@ -1112,6 +1314,14 @@ packages: dev: true optional: true + /@esbuild/win32-arm64@0.19.12: + resolution: {integrity: sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + optional: true + /@esbuild/win32-ia32@0.17.18: resolution: {integrity: sha512-0/xUMIdkVHwkvxfbd5+lfG7mHOf2FRrxNbPiKWg9C4fFrB8H0guClmaM3BFiRUYrznVoyxTIyC/Ou2B7QQSwmw==} engines: {node: '>=12'} @@ -1121,6 +1331,14 @@ packages: dev: true optional: true + /@esbuild/win32-ia32@0.19.12: + resolution: {integrity: sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + optional: true + /@esbuild/win32-x64@0.17.18: resolution: {integrity: sha512-qU25Ma1I3NqTSHJUOKi9sAH1/Mzuvlke0ioMJRthLXKm7JiSKVwFghlGbDLOO2sARECGhja4xYfRAZNPAkooYg==} engines: {node: '>=12'} @@ -1130,6 +1348,14 @@ packages: dev: true optional: true + /@esbuild/win32-x64@0.19.12: + resolution: {integrity: sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + optional: true + /@eslint-community/eslint-utils@4.4.0(eslint@8.39.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -1482,10 +1708,276 @@ packages: '@ethersproject/strings': 5.7.0 dev: false + /@fuel-ts/abi-coder@0.83.0: + resolution: {integrity: sha512-b4x+GUJoQfzppk7/ioiuAFGfkIY3abGlNf+TpxJ1q5Ty6FhViHFHZ3eumnG65F5xFo+6cyiA46f7gsEa5PWo1Q==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/crypto': 0.83.0 + '@fuel-ts/errors': 0.83.0 + '@fuel-ts/hasher': 0.83.0 + '@fuel-ts/interfaces': 0.83.0 + '@fuel-ts/math': 0.83.0 + '@fuel-ts/utils': 0.83.0 + ethers: 6.12.1 + type-fest: 3.13.1 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + + /@fuel-ts/abi-typegen@0.83.0: + resolution: {integrity: sha512-1TyIFG+ORroB9wHTytrFomZAkaMPpINlYJ1uPblmnQDi948oZtG8aRKIgQXbJ79WI0z7rQDBld+pBe205ltSlg==} + engines: {node: ^18.18.2 || ^20.0.0} + hasBin: true + dependencies: + '@fuel-ts/errors': 0.83.0 + '@fuel-ts/interfaces': 0.83.0 + '@fuel-ts/utils': 0.83.0 + '@fuel-ts/versions': 0.83.0 + commander: 9.5.0 + glob: 10.3.10 + handlebars: 4.7.7 + mkdirp: 1.0.4 + ramda: 0.29.1 + rimraf: 3.0.2 + dev: false + + /@fuel-ts/account@0.83.0: + resolution: {integrity: sha512-NilTp44m+XNqX6e26l7OHYBKsNl2UuUE6ocL+y+BpK7Pv/r8U7+tJnv09VvQQVz8xFC6U0cd2Pgnx4q/RA7S1g==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/abi-coder': 0.83.0 + '@fuel-ts/address': 0.83.0 + '@fuel-ts/crypto': 0.83.0 + '@fuel-ts/errors': 0.83.0 + '@fuel-ts/hasher': 0.83.0 + '@fuel-ts/interfaces': 0.83.0 + '@fuel-ts/math': 0.83.0 + '@fuel-ts/merkle': 0.83.0 + '@fuel-ts/transactions': 0.83.0 + '@fuel-ts/utils': 0.83.0 + '@fuel-ts/versions': 0.83.0 + '@fuels/vm-asm': 0.42.1 + '@noble/curves': 1.4.0 + ethers: 6.12.1 + events: 3.3.0 + graphql: 16.8.1 + graphql-request: 5.0.0(graphql@16.8.1) + graphql-tag: 2.12.6(graphql@16.8.1) + portfinder: 1.0.32 + ramda: 0.29.1 + tree-kill: 1.2.2 + uuid: 9.0.1 + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + dev: false + + /@fuel-ts/address@0.83.0: + resolution: {integrity: sha512-39QvU8KVqArnJdNtcjYR+IMvUWeC+uFNlVpQgHhjCq442tu3jn4459DS4bF8yHM7oqh0V467kABeqxlt/EwzHA==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/crypto': 0.83.0 + '@fuel-ts/errors': 0.83.0 + '@fuel-ts/interfaces': 0.83.0 + '@fuel-ts/utils': 0.83.0 + '@noble/hashes': 1.4.0 + bech32: 2.0.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + + /@fuel-ts/contract@0.83.0: + resolution: {integrity: sha512-Xu1ZK6bC/ftgoJzuZ0veMpKT6mxSl+xmoL45WYd80ksb8R1/1pKos+UCGNlraX1hjUfs1CAsDTYrE1Es1gXGgw==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/abi-coder': 0.83.0 + '@fuel-ts/account': 0.83.0 + '@fuel-ts/crypto': 0.83.0 + '@fuel-ts/errors': 0.83.0 + '@fuel-ts/hasher': 0.83.0 + '@fuel-ts/interfaces': 0.83.0 + '@fuel-ts/merkle': 0.83.0 + '@fuel-ts/program': 0.83.0 + '@fuel-ts/transactions': 0.83.0 + '@fuel-ts/utils': 0.83.0 + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + dev: false + + /@fuel-ts/crypto@0.83.0: + resolution: {integrity: sha512-FBur5sDro3HFxsZ4RwxuAp9CGUBHK3wKZxcPYsjc9Xo9FcyUM1tEEzv1K/Q3zOfe4Cf8jJmeTuUEavF/fW+ijQ==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/errors': 0.83.0 + '@fuel-ts/utils': 0.83.0 + '@noble/hashes': 1.4.0 + ethers: 6.12.1 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + + /@fuel-ts/errors@0.83.0: + resolution: {integrity: sha512-mgye7yyF0B28q3ZLl5yLvXXIJ2DbUoORv0saLed//oyNDpAd/u6kbAQCj4SYl7wx/BUWUO3CPuNuqPYaeS32KA==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/versions': 0.83.0 + dev: false + + /@fuel-ts/forc@0.83.0: + resolution: {integrity: sha512-UdjgGUft53ljuvVlMvNYvx4SF5DlAtgFXdFH7MmpIJ4iqZS7yIq3ImdnVZny1KWsGbMIOs1bhNQYZhJ2FlzKyw==} + hasBin: true + requiresBuild: true + dependencies: + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding + dev: false + + /@fuel-ts/fuel-core@0.83.0: + resolution: {integrity: sha512-oW+vS7fkvbY9I7fFPOsmmVxTbunZ06EvVNxj4qSDGo35Iy0g8mgkguy+INH4wfch9fT0jKmLapxc9RgsOUUiKA==} + hasBin: true + requiresBuild: true + dependencies: + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding + dev: false + + /@fuel-ts/hasher@0.83.0: + resolution: {integrity: sha512-MHacvsyGlvNBfTJZHVGsGU6AYH5V5NY0g13jawsncu99/rM2mAx+Fo0s0aqjTshs8+tFztPj3Tz4KQWMug4utw==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/crypto': 0.83.0 + '@fuel-ts/interfaces': 0.83.0 + '@fuel-ts/utils': 0.83.0 + '@noble/hashes': 1.4.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + + /@fuel-ts/interfaces@0.83.0: + resolution: {integrity: sha512-xmuTwZyxLCkBTJfaL+e/qRxxeCzlw8BcEDWFx+o3n1/SQaZGZYW/DoNG0WF1X+/EuXEVi6m8ajpDxBqx1jg76Q==} + engines: {node: ^18.18.2 || ^20.0.0} + dev: false + + /@fuel-ts/math@0.83.0: + resolution: {integrity: sha512-NosRXj+g5gMvueMtYfttdCNn7WYBk5E1WhFXXp5TZ/8QDfOROnlw/PChhtsw4UGrcHOn7HgPtxbgmdjJ07OrHA==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/errors': 0.83.0 + '@types/bn.js': 5.1.1 + bn.js: 5.2.1 + dev: false + + /@fuel-ts/merkle@0.83.0: + resolution: {integrity: sha512-99EmgfPI/aV6fN7Otfdu+LYMU63aB8pSMOVkW0TjKM/rRm785pRDuT6yjWBTxNIB/UyjB8dOe5P1FJ16d3d1VQ==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/hasher': 0.83.0 + '@fuel-ts/math': 0.83.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + + /@fuel-ts/program@0.83.0: + resolution: {integrity: sha512-y1+eBei28XxuR+c1GzbJAFHHQP8PdDGWLPeQuUkck2YdvW6z87nwtdxAM7i5NymZPv9ggu2HYe4UxGRMMc0ZaQ==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/abi-coder': 0.83.0 + '@fuel-ts/account': 0.83.0 + '@fuel-ts/address': 0.83.0 + '@fuel-ts/errors': 0.83.0 + '@fuel-ts/interfaces': 0.83.0 + '@fuel-ts/math': 0.83.0 + '@fuel-ts/transactions': 0.83.0 + '@fuel-ts/utils': 0.83.0 + '@fuels/vm-asm': 0.42.1 + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + dev: false + + /@fuel-ts/script@0.83.0: + resolution: {integrity: sha512-uICTYHDDTIIO9LVM6yCyd1+TW8kU/XlBsGHjbtO7Zl+Wt/QdZ+fXZ/fIUePQN9YtZRrTqQs1/xeS9cD6xgoCvA==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/abi-coder': 0.83.0 + '@fuel-ts/account': 0.83.0 + '@fuel-ts/address': 0.83.0 + '@fuel-ts/errors': 0.83.0 + '@fuel-ts/interfaces': 0.83.0 + '@fuel-ts/math': 0.83.0 + '@fuel-ts/program': 0.83.0 + '@fuel-ts/transactions': 0.83.0 + '@fuel-ts/utils': 0.83.0 + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + dev: false + + /@fuel-ts/transactions@0.83.0: + resolution: {integrity: sha512-RoyS2YPgaa6GEL9Ra0u9pGg9h5pRZzJf5OO6+Gr1UzNnMXWwKB2WR9yeGMph9QpKgc2TLC6L8G9T9ZEfNZNHXg==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/abi-coder': 0.83.0 + '@fuel-ts/address': 0.83.0 + '@fuel-ts/errors': 0.83.0 + '@fuel-ts/hasher': 0.83.0 + '@fuel-ts/interfaces': 0.83.0 + '@fuel-ts/math': 0.83.0 + '@fuel-ts/utils': 0.83.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + + /@fuel-ts/utils@0.83.0: + resolution: {integrity: sha512-9DxsUNZV6ZTSvsqgMwmK4p4H3LiqfdF7fS3CwGxEN+YWkt+0+LRHcm5aiNqNETdJ3kjGYLka7AZ1WNiLIw+eqQ==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/errors': 0.83.0 + '@fuel-ts/interfaces': 0.83.0 + dev: false + + /@fuel-ts/versions@0.83.0: + resolution: {integrity: sha512-yLQxdC7QDm8HyCINtXJ977eL2wMu0Xpor260r4LczYhsbvhXShwdNZP2OP1L8Hy55DiHsm8Y3nV74vSginMrSA==} + engines: {node: ^18.18.2 || ^20.0.0} + hasBin: true + dependencies: + chalk: 4.1.2 + cli-table: 0.3.11 + dev: false + + /@fuels/vm-asm@0.42.1: + resolution: {integrity: sha512-5e0IDHen26hrKc93ejYNDhQFbqi+EQ7xPpFJcUnSrz0+6zPdPhA2dtwh5UqN0fYDM5AcEFd0wpq+r7Pd2XS5AQ==} + dev: false + /@gar/promisify@1.1.3: resolution: {integrity: sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==} dev: true + /@graphql-typed-document-node/core@3.2.0(graphql@16.8.1): + resolution: {integrity: sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==} + peerDependencies: + graphql: ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 + dependencies: + graphql: 16.8.1 + dev: false + /@humanwhocodes/config-array@0.11.13: resolution: {integrity: sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==} engines: {node: '>=10.10.0'} @@ -2103,6 +2595,12 @@ packages: '@noble/hashes': 1.3.2 dev: false + /@noble/curves@1.4.0: + resolution: {integrity: sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg==} + dependencies: + '@noble/hashes': 1.4.0 + dev: false + /@noble/hashes@1.1.5: resolution: {integrity: sha512-LTMZiiLc+V4v1Yi16TD6aX2gmtKszNye0pQgbaLqkvhIqP7nVsSaJsWloGQjJfJ8offaoP5GtX3yY5swbcJxxQ==} dev: false @@ -2116,6 +2614,11 @@ packages: engines: {node: '>= 16'} dev: false + /@noble/hashes@1.4.0: + resolution: {integrity: sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==} + engines: {node: '>= 16'} + dev: false + /@noble/secp256k1@1.7.1: resolution: {integrity: sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==} dev: false @@ -3666,6 +4169,10 @@ packages: resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} dev: false + /@types/lodash@4.17.0: + resolution: {integrity: sha512-t7dhREVv6dbNj0q17X12j7yDG4bD/DHYX7o5/DbDxobP0HnGPgpRz2Ej77aL7TZT3DSw13fqUTj8J4mMnqa7WA==} + dev: false + /@types/minimatch@3.0.5: resolution: {integrity: sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==} dev: true @@ -3686,6 +4193,10 @@ packages: resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} dev: false + /@types/node@18.15.13: + resolution: {integrity: sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==} + dev: false + /@types/node@18.16.3: resolution: {integrity: sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==} @@ -4705,13 +5216,6 @@ packages: resolution: {integrity: sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==} engines: {node: '>=0.4.0'} hasBin: true - dev: false - - /acorn@8.8.2: - resolution: {integrity: sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==} - engines: {node: '>=0.4.0'} - hasBin: true - dev: true /add-stream@1.0.0: resolution: {integrity: sha512-qQLMr+8o0WC4FZGQTcJiKBVC59JylcPSrTtk6usvmIDFUOCKegapy1VHQwRbFMOFyb/inzUVqHs+eMYKDM1YeQ==} @@ -4725,6 +5229,10 @@ packages: resolution: {integrity: sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ==} dev: false + /aes-js@4.0.0-beta.5: + resolution: {integrity: sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==} + dev: false + /agent-base@6.0.2: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} @@ -4985,7 +5493,6 @@ packages: /asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - dev: true /at-least-node@1.0.0: resolution: {integrity: sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==} @@ -5147,6 +5654,10 @@ packages: resolution: {integrity: sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==} dev: false + /bech32@2.0.0: + resolution: {integrity: sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==} + dev: false + /before-after-hook@2.2.3: resolution: {integrity: sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==} dev: true @@ -5339,6 +5850,16 @@ packages: semver: 7.5.0 dev: true + /bundle-require@4.1.0(esbuild@0.19.12): + resolution: {integrity: sha512-FeArRFM+ziGkRViKRnSTbHZc35dgmR9yNog05Kn0+ItI59pOAISGvnnIwW1WgFZQW59IxD9QpJnUPkdIPfZuXg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + peerDependencies: + esbuild: '>=0.17' + dependencies: + esbuild: 0.19.12 + load-tsconfig: 0.2.5 + dev: false + /busboy@1.6.0: resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==} engines: {node: '>=10.16.0'} @@ -5544,6 +6065,13 @@ packages: engines: {node: '>=6'} dev: true + /cli-table@0.3.11: + resolution: {integrity: sha512-IqLQi4lO0nIB4tcdTpN4LCB9FI3uqrJZK7RC515EnhZ6qBaglkIgICb1wjeAqpdoOabm1+SuQtkXIPdYC93jhQ==} + engines: {node: '>= 0.2.0'} + dependencies: + colors: 1.0.3 + dev: false + /cli-width@3.0.0: resolution: {integrity: sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==} engines: {node: '>= 10'} @@ -5653,6 +6181,11 @@ packages: hasBin: true dev: true + /colors@1.0.3: + resolution: {integrity: sha512-pFGrxThWcWQ2MsAz6RtgeWe4NK2kUE1WfsrvvlctdII745EW9I0yflqhe7++M5LEc7bV2c/9/5zc8sFcpL0Drw==} + engines: {node: '>=0.1.90'} + dev: false + /columnify@1.6.0: resolution: {integrity: sha512-lomjuFZKfM6MSAnV9aCZC9sc0qGbmZdfygNv+nCpqVkSKdCxCklLtd16O0EILGkImHw9ZpHkAnHaB+8Zxq5W6Q==} engines: {node: '>=8.0.0'} @@ -5666,7 +6199,6 @@ packages: engines: {node: '>= 0.8'} dependencies: delayed-stream: 1.0.0 - dev: true /commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} @@ -5677,6 +6209,11 @@ packages: engines: {node: '>= 6'} dev: false + /commander@9.5.0: + resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==} + engines: {node: ^12.20.0 || >=14} + dev: false + /common-ancestor-path@1.0.1: resolution: {integrity: sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==} dev: true @@ -6014,7 +6551,6 @@ packages: /delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} - dev: true /delegates@1.0.0: resolution: {integrity: sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==} @@ -6356,6 +6892,36 @@ packages: '@esbuild/win32-x64': 0.17.18 dev: true + /esbuild@0.19.12: + resolution: {integrity: sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/aix-ppc64': 0.19.12 + '@esbuild/android-arm': 0.19.12 + '@esbuild/android-arm64': 0.19.12 + '@esbuild/android-x64': 0.19.12 + '@esbuild/darwin-arm64': 0.19.12 + '@esbuild/darwin-x64': 0.19.12 + '@esbuild/freebsd-arm64': 0.19.12 + '@esbuild/freebsd-x64': 0.19.12 + '@esbuild/linux-arm': 0.19.12 + '@esbuild/linux-arm64': 0.19.12 + '@esbuild/linux-ia32': 0.19.12 + '@esbuild/linux-loong64': 0.19.12 + '@esbuild/linux-mips64el': 0.19.12 + '@esbuild/linux-ppc64': 0.19.12 + '@esbuild/linux-riscv64': 0.19.12 + '@esbuild/linux-s390x': 0.19.12 + '@esbuild/linux-x64': 0.19.12 + '@esbuild/netbsd-x64': 0.19.12 + '@esbuild/openbsd-x64': 0.19.12 + '@esbuild/sunos-x64': 0.19.12 + '@esbuild/win32-arm64': 0.19.12 + '@esbuild/win32-ia32': 0.19.12 + '@esbuild/win32-x64': 0.19.12 + /escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} @@ -6731,6 +7297,22 @@ packages: - utf-8-validate dev: false + /ethers@6.12.1: + resolution: {integrity: sha512-j6wcVoZf06nqEcBbDWkKg8Fp895SS96dSnTCjiXT+8vt2o02raTn4Lo9ERUuIVU5bAjoPYeA+7ytQFexFmLuVw==} + engines: {node: '>=14.0.0'} + dependencies: + '@adraffy/ens-normalize': 1.10.1 + '@noble/curves': 1.2.0 + '@noble/hashes': 1.3.2 + '@types/node': 18.15.13 + aes-js: 4.0.0-beta.5 + tslib: 2.4.0 + ws: 8.5.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + /event-target-shim@5.0.1: resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} engines: {node: '>=6'} @@ -6802,6 +7384,11 @@ packages: tmp: 0.0.33 dev: true + /extract-files@9.0.0: + resolution: {integrity: sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ==} + engines: {node: ^10.17.0 || ^12.0.0 || >= 13.7.0} + dev: false + /eyes@0.1.8: resolution: {integrity: sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==} engines: {node: '> 0.1.90'} @@ -6975,6 +7562,15 @@ packages: cross-spawn: 7.0.3 signal-exit: 4.0.1 + /form-data@3.0.1: + resolution: {integrity: sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==} + engines: {node: '>= 6'} + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + mime-types: 2.1.35 + dev: false + /form-data@4.0.0: resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} engines: {node: '>= 6'} @@ -7044,6 +7640,49 @@ packages: requiresBuild: true optional: true + /fuels@0.83.0: + resolution: {integrity: sha512-pVa9CHL0kvo+3hu8ih2c7t+HS2527EajFTJzgWK630eUOBIWz1EJp3sCSMZSLnJN5A0I0HU7uzVvsxH+I5vgqQ==} + engines: {node: ^18.18.2 || ^20.0.0} + hasBin: true + dependencies: + '@fuel-ts/abi-coder': 0.83.0 + '@fuel-ts/abi-typegen': 0.83.0 + '@fuel-ts/account': 0.83.0 + '@fuel-ts/address': 0.83.0 + '@fuel-ts/contract': 0.83.0 + '@fuel-ts/crypto': 0.83.0 + '@fuel-ts/errors': 0.83.0 + '@fuel-ts/forc': 0.83.0 + '@fuel-ts/fuel-core': 0.83.0 + '@fuel-ts/hasher': 0.83.0 + '@fuel-ts/interfaces': 0.83.0 + '@fuel-ts/math': 0.83.0 + '@fuel-ts/merkle': 0.83.0 + '@fuel-ts/program': 0.83.0 + '@fuel-ts/script': 0.83.0 + '@fuel-ts/transactions': 0.83.0 + '@fuel-ts/utils': 0.83.0 + '@fuel-ts/versions': 0.83.0 + bundle-require: 4.1.0(esbuild@0.19.12) + chalk: 4.1.2 + chokidar: 3.5.3 + commander: 9.5.0 + esbuild: 0.19.12 + glob: 10.3.10 + handlebars: 4.7.7 + joycon: 3.1.1 + lodash.camelcase: 4.3.0 + portfinder: 1.0.32 + toml: 3.0.0 + tree-kill: 1.2.2 + yup: 0.32.11 + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + dev: false + /function-bind@1.1.1: resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==} @@ -7343,6 +7982,35 @@ packages: resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==} dev: false + /graphql-request@5.0.0(graphql@16.8.1): + resolution: {integrity: sha512-SpVEnIo2J5k2+Zf76cUkdvIRaq5FMZvGQYnA4lUWYbc99m+fHh4CZYRRO/Ff4tCLQ613fzCm3SiDT64ubW5Gyw==} + peerDependencies: + graphql: 14 - 16 + dependencies: + '@graphql-typed-document-node/core': 3.2.0(graphql@16.8.1) + cross-fetch: 3.1.5 + extract-files: 9.0.0 + form-data: 3.0.1 + graphql: 16.8.1 + transitivePeerDependencies: + - encoding + dev: false + + /graphql-tag@2.12.6(graphql@16.8.1): + resolution: {integrity: sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg==} + engines: {node: '>=10'} + peerDependencies: + graphql: ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 + dependencies: + graphql: 16.8.1 + tslib: 2.5.0 + dev: false + + /graphql@16.8.1: + resolution: {integrity: sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==} + engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0} + dev: false + /h3@1.9.0: resolution: {integrity: sha512-+F3ZqrNV/CFXXfZ2lXBINHi+rM4Xw3CDC5z2CDK3NMPocjonKipGLLDSkrqY9DOrioZNPTIdDMWfQKm//3X2DA==} dependencies: @@ -7367,7 +8035,6 @@ packages: wordwrap: 1.0.0 optionalDependencies: uglify-js: 3.17.4 - dev: true /hard-rejection@2.1.0: resolution: {integrity: sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==} @@ -8536,6 +9203,11 @@ packages: resolution: {integrity: sha512-W+oqK4H+r5sITxfxpSU+MMdr/YSWGvgZMQDIsNoBDGGy4i7GBPTtvFKibQzW06n3U3TqHjhvBJsirShsEJ6eeQ==} dev: false + /joycon@3.1.1: + resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} + engines: {node: '>=10'} + dev: false + /js-sdsl@4.4.2: resolution: {integrity: sha512-dwXFwByc/ajSV6m5bcKAPwe4yDDF6D614pxmIi5odytzxRlwqF6nwoiCek80Ixc7Cvma5awClxrzFtxCQvcM8w==} dev: false @@ -8916,6 +9588,11 @@ packages: type-fest: 0.6.0 dev: true + /load-tsconfig@0.2.5: + resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: false + /locate-path@2.0.0: resolution: {integrity: sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==} engines: {node: '>=4'} @@ -8940,6 +9617,10 @@ packages: resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==} dev: false + /lodash.camelcase@4.3.0: + resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==} + dev: false + /lodash.clonedeep@4.5.0: resolution: {integrity: sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==} dev: false @@ -9141,14 +9822,12 @@ packages: /mime-db@1.52.0: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} engines: {node: '>= 0.6'} - dev: true /mime-types@2.1.35: resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} engines: {node: '>= 0.6'} dependencies: mime-db: 1.52.0 - dev: true /mime@3.0.0: resolution: {integrity: sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==} @@ -9328,11 +10007,17 @@ packages: mkdirp: 1.0.4 dev: true + /mkdirp@0.5.6: + resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==} + hasBin: true + dependencies: + minimist: 1.2.8 + dev: false + /mkdirp@1.0.4: resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} engines: {node: '>=10'} hasBin: true - dev: true /mlly@1.4.2: resolution: {integrity: sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==} @@ -9397,6 +10082,10 @@ packages: thenify-all: 1.6.0 dev: false + /nanoclone@0.2.1: + resolution: {integrity: sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA==} + dev: false + /nanoid@3.3.7: resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} @@ -9417,7 +10106,6 @@ packages: /neo-async@2.6.2: resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} - dev: true /next-auth@4.24.5(next@13.3.4)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-3RafV3XbfIKk6rF6GlLE4/KxjTcuMCifqrmD+98ejFq73SRoj2rmzoca8u764977lH/Q7jo6Xu6yM+Re1Mz/Og==} @@ -10372,6 +11060,17 @@ packages: engines: {node: '>=10.13.0'} dev: false + /portfinder@1.0.32: + resolution: {integrity: sha512-on2ZJVVDXRADWE6jnQaX0ioEylzgBpQk8r55NE4wjXW1ZxO+BgDlY6DXwj20i0V8eB4SenDQ00WEaxfiIQPcxg==} + engines: {node: '>= 0.12.0'} + dependencies: + async: 2.6.4 + debug: 3.2.7 + mkdirp: 0.5.6 + transitivePeerDependencies: + - supports-color + dev: false + /postcss-import@15.1.0(postcss@8.4.23): resolution: {integrity: sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==} engines: {node: '>=14.0.0'} @@ -10560,6 +11259,10 @@ packages: react-is: 16.13.1 dev: false + /property-expr@2.0.6: + resolution: {integrity: sha512-SVtmxhRE/CGkn3eZY1T6pC8Nln6Fr/lu1mKSgRud0eC73whjGfoAogbn78LkD8aFL0zz3bAFerKSnOl7NlErBA==} + dev: false + /proto-list@1.2.4: resolution: {integrity: sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==} dev: true @@ -10659,6 +11362,10 @@ packages: resolution: {integrity: sha512-pNsHDxbGORSvuSScqNJ+3Km6QAVqk8CfsCBIEoDgpqLrkD2f3QM4I7d1ozJJ172OmIcoUcerZaNWqtLkRXTV3A==} dev: false + /ramda@0.29.1: + resolution: {integrity: sha512-OfxIeWzd4xdUNxlWhgFazxsA/nl3mS4/jGZI5n00uWOoSSFRhC1b6gl6xvmzUamgmqELraWp0J/qqVlXYPDPyA==} + dev: false + /randombytes@2.1.0: resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} dependencies: @@ -11259,7 +11966,6 @@ packages: /source-map@0.6.1: resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} engines: {node: '>=0.10.0'} - dev: true /spdx-correct@3.2.0: resolution: {integrity: sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==} @@ -11771,9 +12477,22 @@ packages: resolution: {integrity: sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ==} dev: false + /toml@3.0.0: + resolution: {integrity: sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==} + dev: false + + /toposort@2.0.2: + resolution: {integrity: sha512-0a5EOkAUp8D4moMi2W8ZF8jcga7BgZd91O/yabJCFY8az+XSzeGyTKs0Aoo897iV1Nj6guFq8orWDS96z91oGg==} + dev: false + /tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + /tree-kill@1.2.2: + resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} + hasBin: true + dev: false + /treeverse@3.0.0: resolution: {integrity: sha512-gcANaAnd2QDZFmHFEOF4k7uc1J/6a6z3DJMd/QwEyxLoKGiptJRwid582r7QIsFlFMIZ3SnxfS52S4hm2DHkuQ==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -11798,6 +12517,41 @@ packages: resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} dev: false + /ts-jest@29.1.0(@babel/core@7.21.8)(esbuild@0.19.12)(jest@29.5.0)(typescript@5.3.3): + resolution: {integrity: sha512-ZhNr7Z4PcYa+JjMl62ir+zPiNJfXJN6E8hSLnaUKhOgqcn8vb3e537cpkd0FuAfRK3sR1LSqM1MOhliXNgOFPA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + hasBin: true + peerDependencies: + '@babel/core': '>=7.0.0-beta.0 <8' + '@jest/types': ^29.0.0 + babel-jest: ^29.0.0 + esbuild: '*' + jest: ^29.0.0 + typescript: '>=4.3 <6' + peerDependenciesMeta: + '@babel/core': + optional: true + '@jest/types': + optional: true + babel-jest: + optional: true + esbuild: + optional: true + dependencies: + '@babel/core': 7.21.8 + bs-logger: 0.2.6 + esbuild: 0.19.12 + fast-json-stable-stringify: 2.1.0 + jest: 29.5.0(@types/node@18.16.3)(ts-node@10.9.1) + jest-util: 29.5.0 + json5: 2.2.3 + lodash.memoize: 4.1.2 + make-error: 1.3.6 + semver: 7.5.0 + typescript: 5.3.3 + yargs-parser: 21.1.1 + dev: true + /ts-jest@29.1.0(@babel/core@7.21.8)(jest@29.5.0)(typescript@5.0.4): resolution: {integrity: sha512-ZhNr7Z4PcYa+JjMl62ir+zPiNJfXJN6E8hSLnaUKhOgqcn8vb3e537cpkd0FuAfRK3sR1LSqM1MOhliXNgOFPA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -11886,7 +12640,7 @@ packages: '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.3 '@types/node': 18.16.3 - acorn: 8.8.2 + acorn: 8.11.2 acorn-walk: 8.2.0 arg: 4.1.3 create-require: 1.1.1 @@ -11919,6 +12673,10 @@ packages: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} dev: false + /tslib@2.4.0: + resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==} + dev: false + /tslib@2.5.0: resolution: {integrity: sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==} @@ -12001,6 +12759,11 @@ packages: engines: {node: '>=8'} dev: true + /type-fest@3.13.1: + resolution: {integrity: sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==} + engines: {node: '>=14.16'} + dev: false + /typed-array-buffer@1.0.0: resolution: {integrity: sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==} engines: {node: '>= 0.4'} @@ -12078,7 +12841,6 @@ packages: engines: {node: '>=0.8.0'} hasBin: true requiresBuild: true - dev: true optional: true /uint8arrays@3.1.1: @@ -12285,6 +13047,11 @@ packages: resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} hasBin: true + /uuid@9.0.1: + resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==} + hasBin: true + dev: false + /v8-compile-cache-lib@3.0.1: resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} dev: true @@ -12504,7 +13271,6 @@ packages: /wordwrap@1.0.0: resolution: {integrity: sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==} - dev: true /wrap-ansi@6.2.0: resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} @@ -12630,6 +13396,19 @@ packages: utf-8-validate: 5.0.10 dev: false + /ws@8.5.0: + resolution: {integrity: sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + dev: false + /xtend@4.0.2: resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} engines: {node: '>=0.4'} @@ -12726,6 +13505,19 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} + /yup@0.32.11: + resolution: {integrity: sha512-Z2Fe1bn+eLstG8DRR6FTavGD+MeAwyfmouhHsIUgaADz8jvFKbO/fXc2trJKZg+5EBjh4gGm3iU/t3onKlXHIg==} + engines: {node: '>=10'} + dependencies: + '@babel/runtime': 7.23.6 + '@types/lodash': 4.17.0 + lodash: 4.17.21 + lodash-es: 4.17.21 + nanoclone: 0.2.1 + property-expr: 2.0.6 + toposort: 2.0.2 + dev: false + /zone-file@2.0.0-beta.3: resolution: {integrity: sha512-6tE3PSRcpN5lbTTLlkLez40WkNPc9vw/u1J2j6DBiy0jcVX48nCkWrx2EC+bWHqC2SLp069Xw4AdnYn/qp/W5g==} engines: {node: '>=10'} From 7bd816a55a2a41967221caf365f21e149e5f3bb5 Mon Sep 17 00:00:00 2001 From: CJskii Date: Thu, 2 May 2024 17:08:35 +0100 Subject: [PATCH 2/9] feat: fuel - initial setup --- packages/fuel/README.md | 1 + packages/fuel/jest.config.ts | 195 ++++++++++++++++++++++++++++ packages/fuel/package.json | 33 +++++ packages/fuel/src/index.ts | 1 + packages/fuel/src/siwFuelMessage.ts | 43 ++++++ packages/fuel/tsconfig.json | 17 +++ 6 files changed, 290 insertions(+) create mode 100644 packages/fuel/README.md create mode 100644 packages/fuel/jest.config.ts create mode 100644 packages/fuel/package.json create mode 100644 packages/fuel/src/index.ts create mode 100644 packages/fuel/src/siwFuelMessage.ts create mode 100644 packages/fuel/tsconfig.json diff --git a/packages/fuel/README.md b/packages/fuel/README.md new file mode 100644 index 0000000..0eaed62 --- /dev/null +++ b/packages/fuel/README.md @@ -0,0 +1 @@ +# SIWx - Ethereum diff --git a/packages/fuel/jest.config.ts b/packages/fuel/jest.config.ts new file mode 100644 index 0000000..980bffd --- /dev/null +++ b/packages/fuel/jest.config.ts @@ -0,0 +1,195 @@ +/* + * For a detailed explanation regarding each configuration property and type check, visit: + * https://jestjs.io/docs/configuration + */ + +export default { + // All imported modules in your tests should be mocked automatically + // automock: false, + + // Stop running tests after `n` failures + // bail: 0, + + // The directory where Jest should store its cached dependency information + // cacheDirectory: "/tmp/jest_rs", + + // Automatically clear mock calls, instances, contexts and results before every test + clearMocks: true, + + // Indicates whether the coverage information should be collected while executing the test + // collectCoverage: false, + + // An array of glob patterns indicating a set of files for which coverage information should be collected + // collectCoverageFrom: undefined, + + // The directory where Jest should output its coverage files + // coverageDirectory: undefined, + + // An array of regexp pattern strings used to skip coverage collection + // coveragePathIgnorePatterns: [ + // "/node_modules/" + // ], + + // Indicates which provider should be used to instrument code for coverage + coverageProvider: "v8", + + // A list of reporter names that Jest uses when writing coverage reports + // coverageReporters: [ + // "json", + // "text", + // "lcov", + // "clover" + // ], + + // An object that configures minimum threshold enforcement for coverage results + // coverageThreshold: undefined, + + // A path to a custom dependency extractor + // dependencyExtractor: undefined, + + // Make calling deprecated APIs throw helpful error messages + // errorOnDeprecated: false, + + // The default configuration for fake timers + // fakeTimers: { + // "enableGlobally": false + // }, + + // Force coverage collection from ignored files using an array of glob patterns + // forceCoverageMatch: [], + + // A path to a module which exports an async function that is triggered once before all test suites + // globalSetup: undefined, + + // A path to a module which exports an async function that is triggered once after all test suites + // globalTeardown: undefined, + + // A set of global variables that need to be available in all test environments + // globals: {}, + + // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. + // maxWorkers: "50%", + + // An array of directory names to be searched recursively up from the requiring module's location + // moduleDirectories: [ + // "node_modules" + // ], + + // An array of file extensions your modules use + // moduleFileExtensions: [ + // "js", + // "mjs", + // "cjs", + // "jsx", + // "ts", + // "tsx", + // "json", + // "node" + // ], + + // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module + // moduleNameMapper: {}, + + // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader + modulePathIgnorePatterns: ["/dist/"], + + // Activates notifications for test results + // notify: false, + + // An enum that specifies notification mode. Requires { notify: true } + // notifyMode: "failure-change", + + // A preset that is used as a base for Jest's configuration + preset: "ts-jest", + + // Run tests from one or more projects + // projects: undefined, + + // Use this configuration option to add custom reporters to Jest + // reporters: undefined, + + // Automatically reset mock state before every test + // resetMocks: false, + + // Reset the module registry before running each individual test + // resetModules: false, + + // A path to a custom resolver + // resolver: undefined, + + // Automatically restore mock state and implementation before every test + // restoreMocks: false, + + // The root directory that Jest should scan for tests and modules within + // rootDir: undefined, + + // A list of paths to directories that Jest should use to search for files in + // roots: [ + // "" + // ], + + // Allows you to use a custom runner instead of Jest's default test runner + // runner: "jest-runner", + + // The paths to modules that run some code to configure or set up the testing environment before each test + // setupFiles: [], + + // A list of paths to modules that run some code to configure or set up the testing framework before each test + // setupFilesAfterEnv: [], + + // The number of seconds after which a test is considered as slow and reported as such in the results. + // slowTestThreshold: 5, + + // A list of paths to snapshot serializer modules Jest should use for snapshot testing + // snapshotSerializers: [], + + // The test environment that will be used for testing + // testEnvironment: "jest-environment-node", + + // Options that will be passed to the testEnvironment + // testEnvironmentOptions: {}, + + // Adds a location field to test results + // testLocationInResults: false, + + // The glob patterns Jest uses to detect test files + // testMatch: [ + // "**/__tests__/**/*.[jt]s?(x)", + // "**/?(*.)+(spec|test).[tj]s?(x)" + // ], + + // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped + // testPathIgnorePatterns: [ + // "/node_modules/" + // ], + + // The regexp pattern or array of patterns that Jest uses to detect test files + // testRegex: [], + + // This option allows the use of a custom results processor + // testResultsProcessor: undefined, + + // This option allows use of a custom test runner + // testRunner: "jest-circus/runner", + + // A map from regular expressions to paths to transformers + // transform: undefined, + + // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation + // transformIgnorePatterns: [ + // "/node_modules/", + // "\\.pnp\\.[^\\/]+$" + // ], + + // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them + // unmockedModulePathPatterns: undefined, + + // Indicates whether each individual test should be reported during the run + // verbose: undefined, + + // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode + // watchPathIgnorePatterns: [], + + // Whether to use watchman for file crawling + // watchman: true, +}; diff --git a/packages/fuel/package.json b/packages/fuel/package.json new file mode 100644 index 0000000..0b4f95a --- /dev/null +++ b/packages/fuel/package.json @@ -0,0 +1,33 @@ +{ + "name": "@learnweb3dao/siwfuel", + "version": "0.3.0", + "description": "", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "build": "tsc", + "test": "jest" + }, + "repository": { + "type": "git", + "url": "https://github.com/LearnWeb3DAO/siwx" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "@learnweb3dao/siwx-common": "^0.3.0", + "ethers": "5", + "fuels": "^0.83.0" + }, + "devDependencies": { + "@types/jest": "^29.5.1", + "jest": "^29.5.0", + "ts-jest": "^29.1.0", + "ts-node": "^10.9.1" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "119495621d840ebb44d9fd0ef6ca3c72539b8041" +} diff --git a/packages/fuel/src/index.ts b/packages/fuel/src/index.ts new file mode 100644 index 0000000..966232a --- /dev/null +++ b/packages/fuel/src/index.ts @@ -0,0 +1 @@ +export * from "./siwFuelMessage"; diff --git a/packages/fuel/src/siwFuelMessage.ts b/packages/fuel/src/siwFuelMessage.ts new file mode 100644 index 0000000..b8e5fe9 --- /dev/null +++ b/packages/fuel/src/siwFuelMessage.ts @@ -0,0 +1,43 @@ +import { + SiwxError, + SiwxErrorTypes, + SiwxMessage, + VerificationResponse, + VerifyParams, +} from "@learnweb3dao/siwx-common"; +import { Wallet } from "fuels"; + +export class FuelMessage extends SiwxMessage { + toMessage(): string { + return this._toMessage("Fuel"); + } + + async verify(params: VerifyParams): Promise> { + try { + const { signature } = params; + + this._verify(params); + + const message = this.toMessage(); + // const recoveredAddress = Wallet.recover(message, signature); + + // if (recoveredAddress !== this.address) { + // throw new SiwxError( + // SiwxErrorTypes.INVALID_SIGNATURE, + // `Signature does not match address ${this.address}` + // ); + // } + + return { + success: true, + data: this, + }; + } catch (error) { + return { + success: false, + error, + data: this, + }; + } + } +} diff --git a/packages/fuel/tsconfig.json b/packages/fuel/tsconfig.json new file mode 100644 index 0000000..6d5d390 --- /dev/null +++ b/packages/fuel/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es2015", + "declaration": true, + "outDir": "./dist", + "esModuleInterop": true, + "skipLibCheck": true + }, + "include": ["src/**/*"], + "exclude": [ + "node_modules", + "**/dist/**/*", + "**/__tests__/**/*", + "**/__mocks__/**/*" + ] +} From d06b0fd660238e5c2e41c1c66bf43153d5c4ff37 Mon Sep 17 00:00:00 2001 From: CJskii Date: Thu, 2 May 2024 17:57:32 +0100 Subject: [PATCH 3/9] integration: recover address --- packages/fuel/src/siwFuelMessage.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/fuel/src/siwFuelMessage.ts b/packages/fuel/src/siwFuelMessage.ts index b8e5fe9..068fb80 100644 --- a/packages/fuel/src/siwFuelMessage.ts +++ b/packages/fuel/src/siwFuelMessage.ts @@ -5,7 +5,7 @@ import { VerificationResponse, VerifyParams, } from "@learnweb3dao/siwx-common"; -import { Wallet } from "fuels"; +import { hashMessage, Signer } from "fuels"; export class FuelMessage extends SiwxMessage { toMessage(): string { @@ -19,14 +19,15 @@ export class FuelMessage extends SiwxMessage { this._verify(params); const message = this.toMessage(); - // const recoveredAddress = Wallet.recover(message, signature); + const hashedMessage = hashMessage(message); + const recoveredAddress = Signer.recoverAddress(hashedMessage, signature); - // if (recoveredAddress !== this.address) { - // throw new SiwxError( - // SiwxErrorTypes.INVALID_SIGNATURE, - // `Signature does not match address ${this.address}` - // ); - // } + if (recoveredAddress.bech32Address !== this.address) { + throw new SiwxError( + SiwxErrorTypes.INVALID_SIGNATURE, + `Signature does not match address ${this.address}` + ); + } return { success: true, From 458928fbd8974cdd3aa14c3b646f8724996633af Mon Sep 17 00:00:00 2001 From: CJskii Date: Thu, 2 May 2024 18:01:27 +0100 Subject: [PATCH 4/9] integration: test mock --- .../__tests__/fixtures/parse_negative.json | 285 ++++++++++++++++++ .../__tests__/fixtures/parse_positive.json | 220 ++++++++++++++ .../fixtures/verification_negative.json | 125 ++++++++ .../fixtures/verification_positive.json | 38 +++ packages/fuel/__tests__/siweMessage.test.ts | 77 +++++ 5 files changed, 745 insertions(+) create mode 100644 packages/fuel/__tests__/fixtures/parse_negative.json create mode 100644 packages/fuel/__tests__/fixtures/parse_positive.json create mode 100644 packages/fuel/__tests__/fixtures/verification_negative.json create mode 100644 packages/fuel/__tests__/fixtures/verification_positive.json create mode 100644 packages/fuel/__tests__/siweMessage.test.ts diff --git a/packages/fuel/__tests__/fixtures/parse_negative.json b/packages/fuel/__tests__/fixtures/parse_negative.json new file mode 100644 index 0000000..0499256 --- /dev/null +++ b/packages/fuel/__tests__/fixtures/parse_negative.json @@ -0,0 +1,285 @@ +{ + "missing domain": { + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": [ + "https://service.org/login" + ] + }, + "missing address": { + "domain": "service.org", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": [ + "https://service.org/login" + ] + }, + "missing uri": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "version": "1", + "chainId": 1, + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": [ + "https://service.org/login" + ] + }, + "missing version": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "chainId": 1, + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": [ + "https://service.org/login" + ] + }, + "missing chainId": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": [ + "https://service.org/login" + ] + }, + "missing nonce": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": [ + "https://service.org/login" + ] + }, + "missing issuedAt": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "12341234", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": [ + "https://service.org/login" + ] + }, + "domain not RFC4501 authority": { + "domain": "#notrfc4501", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": [ + "https://service.org/login" + ] + }, + "address not EIP-55": { + "domain": "service.org", + "address": "0xE5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": [ + "https://service.org/login" + ] + }, + "uri is non-RFC 3986": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": ":not_a_rfc3986_valid_uri_", + "version": "1", + "chainId": 1, + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": [ + "https://service.org/login" + ] + }, + "version not 1": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "3", + "chainId": 1, + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": [ + "https://service.org/login" + ] + }, + "not a valid chainId": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": "?", + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": [ + "https://service.org/login" + ] + }, + "nonce with less then 8 chars": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "1234567", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": [ + "https://service.org/login" + ] + }, + "non-ISO 8601 issuedAt": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "12341234", + "issuedAt": "Wed Oct 05 2011 16:48:00 GMT+0200 (CEST)", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": [ + "https://service.org/login" + ] + }, + "non-ISO 8601 expirationTime": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "Wed Oct 05 2011 16:48:00 GMT+0200 (CEST)", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": [ + "https://service.org/login" + ] + }, + "non-ISO 8601 notBefore": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "Wed Oct 05 2011 16:48:00 GMT+0200 (CEST)", + "requestId": "some_id", + "resources": [ + "https://service.org/login" + ] + }, + "first resource not-RFC 3986": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": [ + ":not_a_rfc3986_valid_uri_", + "https://service.org/login" + ] + }, + "second resource is not-RFC3986": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": [ + "https://service.org/login", + ":not_a_rfc3986_valid_uri_" + ] + } +} \ No newline at end of file diff --git a/packages/fuel/__tests__/fixtures/parse_positive.json b/packages/fuel/__tests__/fixtures/parse_positive.json new file mode 100644 index 0000000..51c73a7 --- /dev/null +++ b/packages/fuel/__tests__/fixtures/parse_positive.json @@ -0,0 +1,220 @@ +{ + "couple of optional fields": { + "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- ipfs://Qme7ss3ARVgxv6rXqVPiikMJ8u2NLgmgszg13pYrDKEoiu\n- https://example.com/my-web2-claim.json", + "fields": { + "domain": "service.org", + "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "32891757", + "issuedAt": "2021-09-30T16:25:24.000Z", + "resources": [ + "ipfs://Qme7ss3ARVgxv6rXqVPiikMJ8u2NLgmgszg13pYrDKEoiu", + "https://example.com/my-web2-claim.json" + ] + } + }, + "no optional field": { + "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "fields": { + "domain": "service.org", + "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "32891757", + "issuedAt": "2021-09-30T16:25:24.000Z" + } + }, + "timestamp without microseconds": { + "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24Z", + "fields": { + "domain": "service.org", + "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "32891757", + "issuedAt": "2021-09-30T16:25:24Z" + } + }, + "timezone not utc": { + "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24-02:00", + "fields": { + "domain": "service.org", + "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "32891757", + "issuedAt": "2021-09-30T16:25:24-02:00" + } + }, + "domain is RFC 3986 authority with IP": { + "message": "127.0.0.1 wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "fields": { + "domain": "127.0.0.1", + "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "32891757", + "issuedAt": "2021-09-30T16:25:24.000Z" + } + }, + "domain is RFC 3986 authority with userinfo": { + "message": "test@127.0.0.1 wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "fields": { + "domain": "test@127.0.0.1", + "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "32891757", + "issuedAt": "2021-09-30T16:25:24.000Z" + } + }, + "domain is RFC 3986 authority with port": { + "message": "127.0.0.1:8080 wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "fields": { + "domain": "127.0.0.1:8080", + "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "32891757", + "issuedAt": "2021-09-30T16:25:24.000Z" + } + }, + "domain is localhost authority with port": { + "message": "localhost:8080 wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "fields": { + "domain": "localhost:8080", + "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "32891757", + "issuedAt": "2021-09-30T16:25:24.000Z" + } + }, + "domain is RFC 3986 authority with userinfo and port": { + "message": "test@127.0.0.1:8080 wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "fields": { + "domain": "test@127.0.0.1:8080", + "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "32891757", + "issuedAt": "2021-09-30T16:25:24.000Z" + } + }, + "no statement": { + "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "fields": { + "domain": "service.org", + "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "32891757", + "issuedAt": "2021-09-30T16:25:24.000Z" + } + }, + "domain ipv6": { + "message": "[::cafe] wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "fields": { + "domain": "[::cafe]", + "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "uri": "https://service.org/login", + "version": "1", + "chainId": 1, + "nonce": "32891757", + "issuedAt": "2021-09-30T16:25:24.000Z" + } + }, + "uri ipv6": { + "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\n\nURI: https://[::cafe]\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "fields": { + "domain": "service.org", + "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "uri": "https://[::cafe]", + "version": "1", + "chainId": 1, + "nonce": "32891757", + "issuedAt": "2021-09-30T16:25:24.000Z" + } + }, + "uri ipv4": { + "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\n\nURI: https://127.0.0.1\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "fields": { + "domain": "service.org", + "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "uri": "https://127.0.0.1", + "version": "1", + "chainId": 1, + "nonce": "32891757", + "issuedAt": "2021-09-30T16:25:24.000Z" + } + }, + "uri with port": { + "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\n\nURI: https://127.0.0.1:4361\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "fields": { + "domain": "service.org", + "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "uri": "https://127.0.0.1:4361", + "version": "1", + "chainId": 1, + "nonce": "32891757", + "issuedAt": "2021-09-30T16:25:24.000Z" + } + }, + "uri ipv4 query params and fragment": { + "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\n\nURI: https://127.0.0.1/?query=one#begin\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "fields": { + "domain": "service.org", + "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "uri": "https://127.0.0.1/?query=one#begin", + "version": "1", + "chainId": 1, + "nonce": "32891757", + "issuedAt": "2021-09-30T16:25:24.000Z" + } + }, + "chainId not 1": { + "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 4\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "fields": { + "domain": "service.org", + "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "uri": "https://service.org/login", + "version": "1", + "chainId": 4, + "nonce": "32891757", + "issuedAt": "2021-09-30T16:25:24.000Z" + } + }, + "recovery byte starting at 0": { + "message": "www.tally.xyz wants you to sign in with your Fuel account:\n0xc95EB884FE852e241D409234bfC7045CB9E31BD7\n\nSign in with Fuel to Tally\n\nURI: https://tally.xyz\nVersion: 1\nChain ID: 1\nNonce: 15050747\nIssued At: 2022-06-30T14:08:51.382Z", + "fields": { + "domain": "www.tally.xyz", + "address": "0xc95EB884FE852e241D409234bfC7045CB9E31BD7", + "statement": "Sign in with Fuel to Tally", + "uri": "https://tally.xyz", + "version": "1", + "chainId": 1, + "nonce": "15050747", + "issuedAt": "2022-06-30T14:08:51.382Z" + } + } +} diff --git a/packages/fuel/__tests__/fixtures/verification_negative.json b/packages/fuel/__tests__/fixtures/verification_negative.json new file mode 100644 index 0000000..214fe28 --- /dev/null +++ b/packages/fuel/__tests__/fixtures/verification_negative.json @@ -0,0 +1,125 @@ +{ + "expired message": { + "domain": "login.xyz", + "address": "0x2ecA0068307e706741445764A3D6A4402aC2A5a9", + "statement": "Sign-In With Fuel Example Statement", + "uri": "https://login.xyz", + "version": "1", + "nonce": "lx2nx4so", + "issuedAt": "2022-01-05T14:27:30.883Z", + "chainId": 1, + "expirationTime": "2021-01-05T00:00:00Z", + "signature": "0x7337bc2826c7678cd6bc84f5b3b236efc969b0451f9feca2328b1d3401b030c113f19bdba359ba3f52762c66e9147311fa95fe598a1a4ec9bb383a7b4e3874241b" + }, + "domain binding": { + "domainBinding": "example.com", + "domain": "login.xyz", + "address": "0x9D85ca56217D2bb651b00f15e694EB7E713637D4", + "statement": "Sign-In With Fuel Example Statement", + "uri": "https://login.xyz", + "version": "1", + "nonce": "bTyXgcQxn2htgkjJn", + "issuedAt": "2022-01-27T17:09:38.578Z", + "chainId": 1, + "expirationTime": "2100-01-07T14:31:43.952Z", + "signature": "0xdc35c7f8ba2720df052e0092556456127f00f7707eaa8e3bbff7e56774e7f2e05a093cfc9e02964c33d86e8e066e221b7d153d27e5a2e97ccd5ca7d3f2ce06cb1b" + }, + "custom time": { + "domain": "login.xyz", + "address": "0x9D85ca56217D2bb651b00f15e694EB7E713637D4", + "statement": "Sign-In With Fuel Example Statement", + "uri": "https://login.xyz", + "version": "1", + "nonce": "bTyXgcQxn2htgkjJn", + "issuedAt": "2022-01-27T17:09:38.578Z", + "chainId": 1, + "expirationTime": "2100-01-07T14:31:43.952Z", + "signature": "0xdc35c7f8ba2720df052e0092556456127f00f7707eaa8e3bbff7e56774e7f2e05a093cfc9e02964c33d86e8e066e221b7d153d27e5a2e97ccd5ca7d3f2ce06cb1b", + "time": "2200-01-05T00:00:00Z" + }, + "custom nonce": { + "domain": "login.xyz", + "address": "0x9D85ca56217D2bb651b00f15e694EB7E713637D4", + "statement": "Sign-In With Fuel Example Statement", + "uri": "https://login.xyz", + "version": "1", + "nonce": "bTyXgcQxn2htgkjJn", + "issuedAt": "2022-01-27T17:09:38.578Z", + "chainId": 1, + "expirationTime": "2100-01-07T14:31:43.952Z", + "signature": "0xdc35c7f8ba2720df052e0092556456127f00f7707eaa8e3bbff7e56774e7f2e05a093cfc9e02964c33d86e8e066e221b7d153d27e5a2e97ccd5ca7d3f2ce06cb1b", + "matchNonce": "6548asdgf" + }, + "malformed signature": { + "domain": "login.xyz", + "address": "0x6Da01670d8fc844e736095918bbE11fE8D564163", + "statement": "Sign-In With Fuel Example Statement", + "uri": "https://login.xyz", + "version": "1", + "nonce": "rmplqh1gf", + "issuedAt": "2022-01-05T14:31:43.954Z", + "chainId": 1, + "expirationTime": "2100-01-07T14:31:43.952Z", + "signature": "0xf2e8420fc1b722bf4941f5a0464f98172a758ceda5039f622e425fb69fd19b20e444bba7c9a8a8d7e2b5e453553efe7c9460be5d211abe473fc146d51bb04d0cb1b" + }, + "wrong signature": { + "domain": "login.xyz", + "address": "0x6Da01670d8fc844e736095918bbE11fE8D564163", + "statement": "Sign-In With Fuel Example Statement", + "uri": "https://login.xyz", + "version": "1", + "nonce": "rmplqh1gf", + "issuedAt": "2022-01-05T14:31:43.954Z", + "chainId": 1, + "expirationTime": "2100-01-07T14:31:43.952Z", + "signature": "0x31df81dc02344c9156e6f71da46e2db624b38f8f806290d670d46492b834b2e7575cbce9f48169356cfb577b910d8e30732fcf23c1ac0021d08b945ed7ee118e1b" + }, + "not yet valid": { + "domain": "login.xyz", + "address": "0xE6D3Aa1F561A215E5eb1f02Ba8705385F03fCaFB", + "statement": "Sign-In With Fuel Example Statement", + "uri": "https://login.xyz", + "version": "1", + "nonce": "lx2nx4so", + "issuedAt": "2022-01-05T14:27:30.883Z", + "chainId": 1, + "notBefore": "2100-01-07T14:31:43.952Z", + "signature": "0xc2539ace78f13c7eb8c0852d38d269a6f97bebd9f7872097d2e3137b541f8bf50176062a46eeea83086bd2721423fb5755a932ff6ccc046ed482d14e4576042f1c" + }, + "invalid issuedAt": { + "domain": "login.xyz", + "address": "0xA0aEF081D1ACE5F830532d7D77Ea4c8EE0EaBCF9", + "statement": "Sign-In With Fuel Example Statement", + "uri": "https://login.xyz", + "version": "1", + "nonce": "bTyXgcQxn2htgkjJn", + "issuedAt": "2022-02-31T17:09:38.578Z", + "chainId": 1, + "signature": "0x9e837df8b56f6e0cac9b4dce52074c352a4143932b442b973963ed2f7b9987146c8e546e5662867198ec0ae9bdb2e87ffaee528375dac7bf003883714ff732701b" + }, + "invalid notBefore": { + "domain": "login.xyz", + "address": "0xA2ce2B71d77983918C8388c47576ad77E339B2F9", + "statement": "Sign-In With Fuel Example Statement", + "uri": "https://login.xyz", + "version": "1", + "nonce": "bTyXgcQxn2htgkjJn", + "issuedAt": "2022-01-30T17:09:38.578Z", + "chainId": 1, + "notBefore": "2025-02-31T17:09:38.578Z", + "expirationTime": "2100-01-07T14:31:43.952Z", + "signature": "0xa741355d0cfa938f45e9137d3b1f362e06961d2f35e01bad794b1f35d7d3e4fc5fd610d28d1b1236fdc305ec05c62b83cade54b49e221adf62e116b0c3a96f531b" + }, + "invalid expirationTime": { + "domain": "login.xyz", + "address": "0xeE5A13CfAC109487d56F9186241009Dd9A7b4Ad4", + "statement": "Sign-In With Fuel Example Statement", + "uri": "https://login.xyz", + "version": "1", + "nonce": "bTyXgcQxn2htgkjJn", + "issuedAt": "2022-01-30T17:09:38.578Z", + "chainId": 1, + "expirationTime": "2100-02-31T14:31:43.952Z", + "signature": "0x5cbe6e6735e7b5818da08890363d6154edf73593db692b64adaea9c1186712a72244971284377d2fed8286b69dafc3cf964cb4e05a8e8d07c1a6f4ede8d9470e1c" + } +} diff --git a/packages/fuel/__tests__/fixtures/verification_positive.json b/packages/fuel/__tests__/fixtures/verification_positive.json new file mode 100644 index 0000000..ca1b30e --- /dev/null +++ b/packages/fuel/__tests__/fixtures/verification_positive.json @@ -0,0 +1,38 @@ +{ + "example message": { + "domain": "login.xyz", + "address": "0x9D85ca56217D2bb651b00f15e694EB7E713637D4", + "statement": "Sign-In With Fuel Example Statement", + "uri": "https://login.xyz", + "version": "1", + "nonce": "bTyXgcQxn2htgkjJn", + "issuedAt": "2022-01-27T17:09:38.578Z", + "chainId": 1, + "expirationTime": "2100-01-07T14:31:43.952Z", + "signature": "0xdc35c7f8ba2720df052e0092556456127f00f7707eaa8e3bbff7e56774e7f2e05a093cfc9e02964c33d86e8e066e221b7d153d27e5a2e97ccd5ca7d3f2ce06cb1b" + }, + "not yet valid": { + "domain": "login.xyz", + "address": "0xE6D3Aa1F561A215E5eb1f02Ba8705385F03fCaFB", + "statement": "Sign-In With Fuel Example Statement", + "uri": "https://login.xyz", + "version": "1", + "nonce": "lx2nx4so", + "issuedAt": "2022-01-05T14:27:30.883Z", + "chainId": 1, + "notBefore": "2100-01-07T14:31:43.952Z", + "signature": "0xc2539ace78f13c7eb8c0852d38d269a6f97bebd9f7872097d2e3137b541f8bf50176062a46eeea83086bd2721423fb5755a932ff6ccc046ed482d14e4576042f1c", + "time": "2101-01-07T14:31:43.952Z" + }, + "recovery byte starting at 0": { + "domain": "www.tally.xyz", + "address": "0xc95EB884FE852e241D409234bfC7045CB9E31BD7", + "statement": "Sign in with Fuel to Tally", + "uri": "https://tally.xyz", + "version": "1", + "chainId": 1, + "nonce": "15050747", + "issuedAt": "2022-06-30T14:08:51.382Z", + "signature": "0x8c46b6eb8505939892d8e9b075f89f8277321b17b993151f37810cdda38cce6f4a85909d2b53e6a14629c74c0ac38bf4becde78ee5b2529812bf6cceaf7b2a2501" + } +} diff --git a/packages/fuel/__tests__/siweMessage.test.ts b/packages/fuel/__tests__/siweMessage.test.ts new file mode 100644 index 0000000..eaf234f --- /dev/null +++ b/packages/fuel/__tests__/siweMessage.test.ts @@ -0,0 +1,77 @@ +import { SiwxErrorTypes } from "@learnweb3dao/siwx-common"; +import { FuelMessage } from "../src"; +import { Wallet } from "ethers"; + +const parsePositiveObjects = require("./fixtures/parse_positive.json"); +const parseNegativeObjects = require("./fixtures/parse_negative.json"); +const verificationPositiveObjects = require("./fixtures/verification_positive.json"); +const verificationNegativeObjects = require("./fixtures/verification_negative.json"); + +describe("Sign in with Fuel", () => { + test.concurrent.each(Object.entries(parsePositiveObjects))( + "Generates message successfully: %s", + (_, test: any) => { + const msg = new FuelMessage(test.fields); + expect(msg.toMessage()).toBe(test.message); + } + ); + + test.concurrent.each(Object.entries(parseNegativeObjects))( + "Throws error when generating message: %s", + (_, test: any) => { + try { + new FuelMessage(test); + } catch (e) { + expect(Object.values(SiwxErrorTypes).includes(e)); + } + } + ); + + test.concurrent.each(Object.entries(verificationPositiveObjects))( + "Verifies message successfully: %s", + async (_, test: any) => { + const msg = new FuelMessage(test); + const result = await msg.verify({ + signature: test.signature, + time: test.time || test.issuedAt, + }); + expect(result.error).toBe(undefined); + expect(result.success).toBe(true); + } + ); + + test.concurrent.each(Object.entries(verificationPositiveObjects))( + "Verifies message successfully with random wallet: %s", + async (_, test: any) => { + const randomWallet = Wallet.createRandom(); + const msg = new FuelMessage(test); + msg.address = randomWallet.address; + const signature = await randomWallet.signMessage(msg.toMessage()); + const result = await msg.verify({ + signature, + time: test.time || test.issuedAt, + }); + expect(result.error).toBe(undefined); + expect(result.success).toBe(true); + } + ); + + test.concurrent.each(Object.entries(verificationNegativeObjects))( + "Throws error when verifying message: %s", + async (_, test: any) => { + try { + const msg = new FuelMessage(test); + const result = await msg.verify({ + signature: test.signature, + time: test.time || test.issuedAt, + domain: test.domainBinding, + nonce: test.matchNonce, + }); + + expect(result.success).toBe(false); + } catch (e) { + expect(Object.values(SiwxErrorTypes).includes(e)); + } + } + ); +}); From 575e3691e4630efa1833d4c9bae6d4a01088340c Mon Sep 17 00:00:00 2001 From: CJskii Date: Fri, 3 May 2024 13:12:50 +0100 Subject: [PATCH 5/9] integration: mock fuel example --- example/package.json | 1 + example/src/components/siwFuel.tsx | 58 +++++ example/src/pages/index.tsx | 2 + pnpm-lock.yaml | 352 +++++++++++++++++++++++++---- 4 files changed, 370 insertions(+), 43 deletions(-) create mode 100644 example/src/components/siwFuel.tsx diff --git a/example/package.json b/example/package.json index 2ca21ac..c6f8cc6 100644 --- a/example/package.json +++ b/example/package.json @@ -28,6 +28,7 @@ "eslint": "8.39.0", "eslint-config-next": "13.3.4", "ethers": "^5", + "fuels": "0.82.0", "next": "13.3.4", "next-auth": "^4.12.1", "postcss": "8.4.23", diff --git a/example/src/components/siwFuel.tsx b/example/src/components/siwFuel.tsx new file mode 100644 index 0000000..89cf3d3 --- /dev/null +++ b/example/src/components/siwFuel.tsx @@ -0,0 +1,58 @@ +"use client"; + +// import { FuelMessage } from "@learnweb3dao/siwfuel"; +import { getCsrfToken, signIn, useSession } from "next-auth/react"; +import { useRouter } from "next/router"; +import React, { useEffect } from "react"; +import { useAccount, useConnect, useNetwork, useSignMessage } from "wagmi"; +import { InjectedConnector } from "wagmi/connectors/injected"; +import { Provider, Wallet, BN, Address } from "fuels"; + +export const SIWFUEL: React.FC = () => { + const { address, isConnected } = useAccount(); + const { chain } = useNetwork(); + const [balance, setBalance] = React.useState(0); + + useEffect(() => { + async () => { + const provider = await Provider.create( + "https://beta-5.fuel.network/graphql" + ); + const myWallet = Wallet.fromAddress( + "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", + provider + ); + myWallet.getBalances().then((data) => { + setBalance(new BN(data[0].amount).toNumber()); + }); + }; + }, []); + + useEffect(() => { + // convert fuel address to EVM address + const bech32 = + "fuel1d5cfwekq78r0zq73g7eg0747etkaxxltrqx5tncm7lvg89awe3hswhqjhs"; + const addressInstance = Address.fromDynamicInput(bech32); + const b256 = addressInstance.toB256(); + // EVM ADDRESS = 0x6d309766c0f1c6f103d147b287fabecaedd31beb180d45cf1bf7d88397aecc6f + }, []); + + console.log(balance); + + return ( + + ); +}; diff --git a/example/src/pages/index.tsx b/example/src/pages/index.tsx index 050be2e..fb2aeae 100644 --- a/example/src/pages/index.tsx +++ b/example/src/pages/index.tsx @@ -5,6 +5,7 @@ import { SIWTezos } from "@/components/siwTezos"; import { SIWE } from "@/components/siwe"; import { SIWS } from "@/components/siws"; import { SIWStacks } from "@/components/siwstacks"; +import { SIWFUEL } from "@/components/siwFuel"; import { signOut, useSession } from "next-auth/react"; export default function Home() { @@ -41,6 +42,7 @@ export default function Home() { + ); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 08a40dd..e84af78 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -37,7 +37,7 @@ importers: version: 4.0.12 '@learnweb3dao/siwe': specifier: workspace:^ - version: link:../packages/fuel + version: link:../packages/eip155 '@learnweb3dao/siws': specifier: workspace:^ version: link:../packages/solana @@ -89,6 +89,9 @@ importers: ethers: specifier: ^5 version: 5.7.2 + fuels: + specifier: 0.82.0 + version: 0.82.0 next: specifier: 13.3.4 version: 13.3.4(@babel/core@7.21.8)(react-dom@18.2.0)(react@18.2.0) @@ -146,7 +149,7 @@ importers: version: 29.5.0(@types/node@18.16.3)(ts-node@10.9.1) ts-jest: specifier: ^29.1.0 - version: 29.1.0(@babel/core@7.23.6)(jest@29.5.0)(typescript@5.3.3) + version: 29.1.0(@babel/core@7.23.6)(esbuild@0.19.12)(jest@29.5.0)(typescript@5.3.3) ts-node: specifier: ^10.9.1 version: 10.9.1(@types/node@18.16.3)(typescript@5.3.3) @@ -171,7 +174,7 @@ importers: version: 29.5.0(@types/node@18.16.3)(ts-node@10.9.1) ts-jest: specifier: ^29.1.0 - version: 29.1.0(@babel/core@7.21.8)(esbuild@0.19.12)(jest@29.5.0)(typescript@5.3.3) + version: 29.1.0(@babel/core@7.23.6)(esbuild@0.19.12)(jest@29.5.0)(typescript@5.3.3) ts-node: specifier: ^10.9.1 version: 10.9.1(@types/node@18.16.3)(typescript@5.3.3) @@ -196,7 +199,7 @@ importers: version: 29.5.0(@types/node@18.16.3)(ts-node@10.9.1) ts-jest: specifier: ^29.1.0 - version: 29.1.0(@babel/core@7.23.6)(jest@29.5.0)(typescript@5.3.3) + version: 29.1.0(@babel/core@7.23.6)(esbuild@0.19.12)(jest@29.5.0)(typescript@5.3.3) ts-node: specifier: ^10.9.1 version: 10.9.1(@types/node@18.16.3)(typescript@5.3.3) @@ -224,7 +227,7 @@ importers: version: 29.5.0(@types/node@18.16.3)(ts-node@10.9.1) ts-jest: specifier: ^29.1.0 - version: 29.1.0(@babel/core@7.23.6)(jest@29.5.0)(typescript@5.3.3) + version: 29.1.0(@babel/core@7.23.6)(esbuild@0.19.12)(jest@29.5.0)(typescript@5.3.3) packages/starknet: dependencies: @@ -243,7 +246,7 @@ importers: version: 29.5.0(@types/node@18.16.3)(ts-node@10.9.1) ts-jest: specifier: ^29.1.0 - version: 29.1.0(@babel/core@7.21.8)(esbuild@0.19.12)(jest@29.5.0)(typescript@5.3.3) + version: 29.1.0(@babel/core@7.23.6)(esbuild@0.19.12)(jest@29.5.0)(typescript@5.3.3) ts-node: specifier: ^10.9.1 version: 10.9.1(@types/node@18.16.3)(typescript@5.3.3) @@ -271,7 +274,7 @@ importers: version: 29.5.0(@types/node@18.16.3)(ts-node@10.9.1) ts-jest: specifier: ^29.1.0 - version: 29.1.0(@babel/core@7.23.6)(jest@29.5.0)(typescript@5.3.3) + version: 29.1.0(@babel/core@7.23.6)(esbuild@0.19.12)(jest@29.5.0)(typescript@5.3.3) ts-node: specifier: ^10.9.1 version: 10.9.1(@types/node@18.16.3)(typescript@5.3.3) @@ -1708,6 +1711,23 @@ packages: '@ethersproject/strings': 5.7.0 dev: false + /@fuel-ts/abi-coder@0.82.0: + resolution: {integrity: sha512-eEgYkxZHhGlRv2vffAcKZfThTYLSvUy2M8tc1N1qT+nPL5QCJ1HtwuqxM4alCyJoMe1CxKJbNItSEy+w7fJkow==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/crypto': 0.82.0 + '@fuel-ts/errors': 0.82.0 + '@fuel-ts/hasher': 0.82.0 + '@fuel-ts/interfaces': 0.82.0 + '@fuel-ts/math': 0.82.0 + '@fuel-ts/utils': 0.82.0 + ethers: 6.12.1 + type-fest: 3.13.1 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + /@fuel-ts/abi-coder@0.83.0: resolution: {integrity: sha512-b4x+GUJoQfzppk7/ioiuAFGfkIY3abGlNf+TpxJ1q5Ty6FhViHFHZ3eumnG65F5xFo+6cyiA46f7gsEa5PWo1Q==} engines: {node: ^18.18.2 || ^20.0.0} @@ -1725,6 +1745,23 @@ packages: - utf-8-validate dev: false + /@fuel-ts/abi-typegen@0.82.0: + resolution: {integrity: sha512-K0CLVR0F893GvMe+/mwR2YoGEpB2lxa3KHxgtzWJ8qmjaVrRmRobDoF8TG+leVzaif0sGjInrEciYKFUzwvWow==} + engines: {node: ^18.18.2 || ^20.0.0} + hasBin: true + dependencies: + '@fuel-ts/errors': 0.82.0 + '@fuel-ts/interfaces': 0.82.0 + '@fuel-ts/utils': 0.82.0 + '@fuel-ts/versions': 0.82.0 + commander: 9.5.0 + glob: 10.3.10 + handlebars: 4.7.7 + mkdirp: 1.0.4 + ramda: 0.29.1 + rimraf: 3.0.2 + dev: false + /@fuel-ts/abi-typegen@0.83.0: resolution: {integrity: sha512-1TyIFG+ORroB9wHTytrFomZAkaMPpINlYJ1uPblmnQDi948oZtG8aRKIgQXbJ79WI0z7rQDBld+pBe205ltSlg==} engines: {node: ^18.18.2 || ^20.0.0} @@ -1742,6 +1779,39 @@ packages: rimraf: 3.0.2 dev: false + /@fuel-ts/account@0.82.0: + resolution: {integrity: sha512-GCORq96XikiqvCfok9EYqVBCXFW+2fsnR9HussW2F6HePg2giIRZBa4wYpYknr3pQZ3f8L4YXur1L+815nKj/w==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/abi-coder': 0.82.0 + '@fuel-ts/address': 0.82.0 + '@fuel-ts/crypto': 0.82.0 + '@fuel-ts/errors': 0.82.0 + '@fuel-ts/hasher': 0.82.0 + '@fuel-ts/interfaces': 0.82.0 + '@fuel-ts/math': 0.82.0 + '@fuel-ts/merkle': 0.82.0 + '@fuel-ts/transactions': 0.82.0 + '@fuel-ts/utils': 0.82.0 + '@fuel-ts/versions': 0.82.0 + '@fuels/vm-asm': 0.42.1 + '@noble/curves': 1.4.0 + ethers: 6.12.1 + events: 3.3.0 + graphql: 16.8.1 + graphql-request: 5.0.0(graphql@16.8.1) + graphql-tag: 2.12.6(graphql@16.8.1) + portfinder: 1.0.32 + ramda: 0.29.1 + tree-kill: 1.2.2 + uuid: 9.0.1 + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + dev: false + /@fuel-ts/account@0.83.0: resolution: {integrity: sha512-NilTp44m+XNqX6e26l7OHYBKsNl2UuUE6ocL+y+BpK7Pv/r8U7+tJnv09VvQQVz8xFC6U0cd2Pgnx4q/RA7S1g==} engines: {node: ^18.18.2 || ^20.0.0} @@ -1775,6 +1845,21 @@ packages: - utf-8-validate dev: false + /@fuel-ts/address@0.82.0: + resolution: {integrity: sha512-b8knxWYLs85J2apeCi76p5xzyMMwvdEx4vb1kuS7XiTF0VMhRGPvJ/uG9yN/zk13n9hKYNquf7xrogH6Sz+xaQ==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/crypto': 0.82.0 + '@fuel-ts/errors': 0.82.0 + '@fuel-ts/interfaces': 0.82.0 + '@fuel-ts/utils': 0.82.0 + '@noble/hashes': 1.4.0 + bech32: 2.0.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + /@fuel-ts/address@0.83.0: resolution: {integrity: sha512-39QvU8KVqArnJdNtcjYR+IMvUWeC+uFNlVpQgHhjCq442tu3jn4459DS4bF8yHM7oqh0V467kABeqxlt/EwzHA==} engines: {node: ^18.18.2 || ^20.0.0} @@ -1790,6 +1875,27 @@ packages: - utf-8-validate dev: false + /@fuel-ts/contract@0.82.0: + resolution: {integrity: sha512-HVbLWA3gbUJaVcobABdhOcLZGEpyqdEHB3qQdRZ5/gpQ8mCgMTGNXn2JHlJszDxFHRyPNNygCa2t9SPjw2Evsg==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/abi-coder': 0.82.0 + '@fuel-ts/account': 0.82.0 + '@fuel-ts/crypto': 0.82.0 + '@fuel-ts/errors': 0.82.0 + '@fuel-ts/hasher': 0.82.0 + '@fuel-ts/interfaces': 0.82.0 + '@fuel-ts/merkle': 0.82.0 + '@fuel-ts/program': 0.82.0 + '@fuel-ts/transactions': 0.82.0 + '@fuel-ts/utils': 0.82.0 + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + dev: false + /@fuel-ts/contract@0.83.0: resolution: {integrity: sha512-Xu1ZK6bC/ftgoJzuZ0veMpKT6mxSl+xmoL45WYd80ksb8R1/1pKos+UCGNlraX1hjUfs1CAsDTYrE1Es1gXGgw==} engines: {node: ^18.18.2 || ^20.0.0} @@ -1811,6 +1917,19 @@ packages: - utf-8-validate dev: false + /@fuel-ts/crypto@0.82.0: + resolution: {integrity: sha512-yTFeWR5rJFY8P3qbgTO9e+OQb15k3OFBn+RjznpSw5qvKbsHbXsfHqhPORcMI2Kz0Evkguv/50lXu2jIGW6ZAg==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/errors': 0.82.0 + '@fuel-ts/utils': 0.82.0 + '@noble/hashes': 1.4.0 + ethers: 6.12.1 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + /@fuel-ts/crypto@0.83.0: resolution: {integrity: sha512-FBur5sDro3HFxsZ4RwxuAp9CGUBHK3wKZxcPYsjc9Xo9FcyUM1tEEzv1K/Q3zOfe4Cf8jJmeTuUEavF/fW+ijQ==} engines: {node: ^18.18.2 || ^20.0.0} @@ -1824,6 +1943,13 @@ packages: - utf-8-validate dev: false + /@fuel-ts/errors@0.82.0: + resolution: {integrity: sha512-mVk/zbN39Vmi8BAYeiARCpQi0f1pQ7NtMC93BAiqsumoOmT+p4I7whq3CKal8/gD/sFfJNhkqMI3GbOcEZzq2Q==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/versions': 0.82.0 + dev: false + /@fuel-ts/errors@0.83.0: resolution: {integrity: sha512-mgye7yyF0B28q3ZLl5yLvXXIJ2DbUoORv0saLed//oyNDpAd/u6kbAQCj4SYl7wx/BUWUO3CPuNuqPYaeS32KA==} engines: {node: ^18.18.2 || ^20.0.0} @@ -1831,6 +1957,16 @@ packages: '@fuel-ts/versions': 0.83.0 dev: false + /@fuel-ts/forc@0.82.0: + resolution: {integrity: sha512-uf4a8MsfMAjAP5NJ+eeOoLPUugCbu6WYQP9iFW7TeQw8lNXhOk+i0zKDc/2LK9oScdPpbY8n+nDWip1h5W3IcA==} + hasBin: true + requiresBuild: true + dependencies: + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding + dev: false + /@fuel-ts/forc@0.83.0: resolution: {integrity: sha512-UdjgGUft53ljuvVlMvNYvx4SF5DlAtgFXdFH7MmpIJ4iqZS7yIq3ImdnVZny1KWsGbMIOs1bhNQYZhJ2FlzKyw==} hasBin: true @@ -1841,6 +1977,16 @@ packages: - encoding dev: false + /@fuel-ts/fuel-core@0.82.0: + resolution: {integrity: sha512-ZRKv7hS6JFR0k6NXAKLpYLVQ+CFPqTCSswllLYfpHQj6JPFS+P4vlX78zhwugtjGK3f4m+EfFmyjrMIjOuI5vw==} + hasBin: true + requiresBuild: true + dependencies: + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding + dev: false + /@fuel-ts/fuel-core@0.83.0: resolution: {integrity: sha512-oW+vS7fkvbY9I7fFPOsmmVxTbunZ06EvVNxj4qSDGo35Iy0g8mgkguy+INH4wfch9fT0jKmLapxc9RgsOUUiKA==} hasBin: true @@ -1851,6 +1997,19 @@ packages: - encoding dev: false + /@fuel-ts/hasher@0.82.0: + resolution: {integrity: sha512-g8BfQc57y3ASXJhjjzVtprVEbtAlR/azqstN9Ec8RlkubOIik+XCauMhUZSRmraa4nP9WueijP2QRWHXaMFD9w==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/crypto': 0.82.0 + '@fuel-ts/interfaces': 0.82.0 + '@fuel-ts/utils': 0.82.0 + '@noble/hashes': 1.4.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + /@fuel-ts/hasher@0.83.0: resolution: {integrity: sha512-MHacvsyGlvNBfTJZHVGsGU6AYH5V5NY0g13jawsncu99/rM2mAx+Fo0s0aqjTshs8+tFztPj3Tz4KQWMug4utw==} engines: {node: ^18.18.2 || ^20.0.0} @@ -1864,11 +2023,25 @@ packages: - utf-8-validate dev: false + /@fuel-ts/interfaces@0.82.0: + resolution: {integrity: sha512-wdbylQ5DjInl/3daF6ro4sD8fOo2dtwEiq8AAAgN8ezDeye2HiAQHOnALk1xbzWrEEanH2V89RsSr7UDJ8LIYg==} + engines: {node: ^18.18.2 || ^20.0.0} + dev: false + /@fuel-ts/interfaces@0.83.0: resolution: {integrity: sha512-xmuTwZyxLCkBTJfaL+e/qRxxeCzlw8BcEDWFx+o3n1/SQaZGZYW/DoNG0WF1X+/EuXEVi6m8ajpDxBqx1jg76Q==} engines: {node: ^18.18.2 || ^20.0.0} dev: false + /@fuel-ts/math@0.82.0: + resolution: {integrity: sha512-YncsMw0xlFHPVUulweHfNxR9Drxn8mi8s4d9IHUepImdKVtGs/A3jTfQhlbnh9PN/yxdruKRWaXhtH/Bq4JU6w==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/errors': 0.82.0 + '@types/bn.js': 5.1.1 + bn.js: 5.2.1 + dev: false + /@fuel-ts/math@0.83.0: resolution: {integrity: sha512-NosRXj+g5gMvueMtYfttdCNn7WYBk5E1WhFXXp5TZ/8QDfOROnlw/PChhtsw4UGrcHOn7HgPtxbgmdjJ07OrHA==} engines: {node: ^18.18.2 || ^20.0.0} @@ -1878,6 +2051,17 @@ packages: bn.js: 5.2.1 dev: false + /@fuel-ts/merkle@0.82.0: + resolution: {integrity: sha512-d4qlpTLDu3bLp9hV1uSOOdOFn8D0vutAeEqT1pAqwEaUIj6Z8I2F5iBAspyJNTxxH6qVQ7LQ328/L1+QuQKn6g==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/hasher': 0.82.0 + '@fuel-ts/math': 0.82.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + /@fuel-ts/merkle@0.83.0: resolution: {integrity: sha512-99EmgfPI/aV6fN7Otfdu+LYMU63aB8pSMOVkW0TjKM/rRm785pRDuT6yjWBTxNIB/UyjB8dOe5P1FJ16d3d1VQ==} engines: {node: ^18.18.2 || ^20.0.0} @@ -1889,6 +2073,26 @@ packages: - utf-8-validate dev: false + /@fuel-ts/program@0.82.0: + resolution: {integrity: sha512-XAA/9O1nRKXB2VprEy73Jl+XAmK7iNYvHboXXHsLDJDHkS25NJvr+HPF84RBKkCh30bQP47lUAbuvXESdp2ilw==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/abi-coder': 0.82.0 + '@fuel-ts/account': 0.82.0 + '@fuel-ts/address': 0.82.0 + '@fuel-ts/errors': 0.82.0 + '@fuel-ts/interfaces': 0.82.0 + '@fuel-ts/math': 0.82.0 + '@fuel-ts/transactions': 0.82.0 + '@fuel-ts/utils': 0.82.0 + '@fuels/vm-asm': 0.42.1 + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + dev: false + /@fuel-ts/program@0.83.0: resolution: {integrity: sha512-y1+eBei28XxuR+c1GzbJAFHHQP8PdDGWLPeQuUkck2YdvW6z87nwtdxAM7i5NymZPv9ggu2HYe4UxGRMMc0ZaQ==} engines: {node: ^18.18.2 || ^20.0.0} @@ -1909,6 +2113,26 @@ packages: - utf-8-validate dev: false + /@fuel-ts/script@0.82.0: + resolution: {integrity: sha512-XW06KhC4oT01T1VavBBO79tUyiRTOUnVeHzqLIZdWra5mWMMFxeOor8I4pH59E3hT2QH+1Y8Ai7DrPCXhMWHAQ==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/abi-coder': 0.82.0 + '@fuel-ts/account': 0.82.0 + '@fuel-ts/address': 0.82.0 + '@fuel-ts/errors': 0.82.0 + '@fuel-ts/interfaces': 0.82.0 + '@fuel-ts/math': 0.82.0 + '@fuel-ts/program': 0.82.0 + '@fuel-ts/transactions': 0.82.0 + '@fuel-ts/utils': 0.82.0 + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + dev: false + /@fuel-ts/script@0.83.0: resolution: {integrity: sha512-uICTYHDDTIIO9LVM6yCyd1+TW8kU/XlBsGHjbtO7Zl+Wt/QdZ+fXZ/fIUePQN9YtZRrTqQs1/xeS9cD6xgoCvA==} engines: {node: ^18.18.2 || ^20.0.0} @@ -1929,6 +2153,22 @@ packages: - utf-8-validate dev: false + /@fuel-ts/transactions@0.82.0: + resolution: {integrity: sha512-A0WATFOo0uhfe+u4RoLyIu4zFhmSrjijXWhaThPI89x5me+ntd6kucsCpm14q9aHJwv1yvIB2leLVSNZulwQqw==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/abi-coder': 0.82.0 + '@fuel-ts/address': 0.82.0 + '@fuel-ts/errors': 0.82.0 + '@fuel-ts/hasher': 0.82.0 + '@fuel-ts/interfaces': 0.82.0 + '@fuel-ts/math': 0.82.0 + '@fuel-ts/utils': 0.82.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + /@fuel-ts/transactions@0.83.0: resolution: {integrity: sha512-RoyS2YPgaa6GEL9Ra0u9pGg9h5pRZzJf5OO6+Gr1UzNnMXWwKB2WR9yeGMph9QpKgc2TLC6L8G9T9ZEfNZNHXg==} engines: {node: ^18.18.2 || ^20.0.0} @@ -1945,6 +2185,14 @@ packages: - utf-8-validate dev: false + /@fuel-ts/utils@0.82.0: + resolution: {integrity: sha512-xbdSS8Iws8rDsEl3R4jXyqv/jmvpoBFkQNQ6XL37C9h3x1h9iBBMxbhpg5dVRyakpZPx7Why04mEqQkKOrp6WA==} + engines: {node: ^18.18.2 || ^20.0.0} + dependencies: + '@fuel-ts/errors': 0.82.0 + '@fuel-ts/interfaces': 0.82.0 + dev: false + /@fuel-ts/utils@0.83.0: resolution: {integrity: sha512-9DxsUNZV6ZTSvsqgMwmK4p4H3LiqfdF7fS3CwGxEN+YWkt+0+LRHcm5aiNqNETdJ3kjGYLka7AZ1WNiLIw+eqQ==} engines: {node: ^18.18.2 || ^20.0.0} @@ -1953,6 +2201,15 @@ packages: '@fuel-ts/interfaces': 0.83.0 dev: false + /@fuel-ts/versions@0.82.0: + resolution: {integrity: sha512-G550LAw6tofjpVe0JqdPve1335DusBU8S+bUxw03tTeqHqLMYuOmU1VQ1cOO1KL/piXukqA+x3AxjPqa2NSosA==} + engines: {node: ^18.18.2 || ^20.0.0} + hasBin: true + dependencies: + chalk: 4.1.2 + cli-table: 0.3.11 + dev: false + /@fuel-ts/versions@0.83.0: resolution: {integrity: sha512-yLQxdC7QDm8HyCINtXJ977eL2wMu0Xpor260r4LczYhsbvhXShwdNZP2OP1L8Hy55DiHsm8Y3nV74vSginMrSA==} engines: {node: ^18.18.2 || ^20.0.0} @@ -7640,6 +7897,49 @@ packages: requiresBuild: true optional: true + /fuels@0.82.0: + resolution: {integrity: sha512-8OS6QcUjnpGKrpymtG6Awg/PjIZ4rm9jpZ6qJ92GsxoQAUgkVNGMugJlGNFaW3lWR1xevjpaw2rLn2UmCtzcHw==} + engines: {node: ^18.18.2 || ^20.0.0} + hasBin: true + dependencies: + '@fuel-ts/abi-coder': 0.82.0 + '@fuel-ts/abi-typegen': 0.82.0 + '@fuel-ts/account': 0.82.0 + '@fuel-ts/address': 0.82.0 + '@fuel-ts/contract': 0.82.0 + '@fuel-ts/crypto': 0.82.0 + '@fuel-ts/errors': 0.82.0 + '@fuel-ts/forc': 0.82.0 + '@fuel-ts/fuel-core': 0.82.0 + '@fuel-ts/hasher': 0.82.0 + '@fuel-ts/interfaces': 0.82.0 + '@fuel-ts/math': 0.82.0 + '@fuel-ts/merkle': 0.82.0 + '@fuel-ts/program': 0.82.0 + '@fuel-ts/script': 0.82.0 + '@fuel-ts/transactions': 0.82.0 + '@fuel-ts/utils': 0.82.0 + '@fuel-ts/versions': 0.82.0 + bundle-require: 4.1.0(esbuild@0.19.12) + chalk: 4.1.2 + chokidar: 3.5.3 + commander: 9.5.0 + esbuild: 0.19.12 + glob: 10.3.10 + handlebars: 4.7.7 + joycon: 3.1.1 + lodash.camelcase: 4.3.0 + portfinder: 1.0.32 + toml: 3.0.0 + tree-kill: 1.2.2 + yup: 0.32.11 + transitivePeerDependencies: + - bufferutil + - encoding + - supports-color + - utf-8-validate + dev: false + /fuels@0.83.0: resolution: {integrity: sha512-pVa9CHL0kvo+3hu8ih2c7t+HS2527EajFTJzgWK630eUOBIWz1EJp3sCSMZSLnJN5A0I0HU7uzVvsxH+I5vgqQ==} engines: {node: ^18.18.2 || ^20.0.0} @@ -12517,41 +12817,6 @@ packages: resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} dev: false - /ts-jest@29.1.0(@babel/core@7.21.8)(esbuild@0.19.12)(jest@29.5.0)(typescript@5.3.3): - resolution: {integrity: sha512-ZhNr7Z4PcYa+JjMl62ir+zPiNJfXJN6E8hSLnaUKhOgqcn8vb3e537cpkd0FuAfRK3sR1LSqM1MOhliXNgOFPA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - hasBin: true - peerDependencies: - '@babel/core': '>=7.0.0-beta.0 <8' - '@jest/types': ^29.0.0 - babel-jest: ^29.0.0 - esbuild: '*' - jest: ^29.0.0 - typescript: '>=4.3 <6' - peerDependenciesMeta: - '@babel/core': - optional: true - '@jest/types': - optional: true - babel-jest: - optional: true - esbuild: - optional: true - dependencies: - '@babel/core': 7.21.8 - bs-logger: 0.2.6 - esbuild: 0.19.12 - fast-json-stable-stringify: 2.1.0 - jest: 29.5.0(@types/node@18.16.3)(ts-node@10.9.1) - jest-util: 29.5.0 - json5: 2.2.3 - lodash.memoize: 4.1.2 - make-error: 1.3.6 - semver: 7.5.0 - typescript: 5.3.3 - yargs-parser: 21.1.1 - dev: true - /ts-jest@29.1.0(@babel/core@7.21.8)(jest@29.5.0)(typescript@5.0.4): resolution: {integrity: sha512-ZhNr7Z4PcYa+JjMl62ir+zPiNJfXJN6E8hSLnaUKhOgqcn8vb3e537cpkd0FuAfRK3sR1LSqM1MOhliXNgOFPA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -12586,7 +12851,7 @@ packages: yargs-parser: 21.1.1 dev: true - /ts-jest@29.1.0(@babel/core@7.23.6)(jest@29.5.0)(typescript@5.3.3): + /ts-jest@29.1.0(@babel/core@7.23.6)(esbuild@0.19.12)(jest@29.5.0)(typescript@5.3.3): resolution: {integrity: sha512-ZhNr7Z4PcYa+JjMl62ir+zPiNJfXJN6E8hSLnaUKhOgqcn8vb3e537cpkd0FuAfRK3sR1LSqM1MOhliXNgOFPA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true @@ -12609,6 +12874,7 @@ packages: dependencies: '@babel/core': 7.23.6 bs-logger: 0.2.6 + esbuild: 0.19.12 fast-json-stable-stringify: 2.1.0 jest: 29.5.0(@types/node@18.16.3)(ts-node@10.9.1) jest-util: 29.5.0 From aac0ce2d3d7e26a43e2d1110d743db8635539def Mon Sep 17 00:00:00 2001 From: CJskii Date: Sat, 4 May 2024 12:10:34 +0100 Subject: [PATCH 6/9] test: passed --- .../fixtures/verification_positive.json | 20 +++++++++---------- .../{siweMessage.test.ts => siwFuel.test.ts} | 15 +++++++++----- 2 files changed, 20 insertions(+), 15 deletions(-) rename packages/fuel/__tests__/{siweMessage.test.ts => siwFuel.test.ts} (89%) diff --git a/packages/fuel/__tests__/fixtures/verification_positive.json b/packages/fuel/__tests__/fixtures/verification_positive.json index ca1b30e..f82e928 100644 --- a/packages/fuel/__tests__/fixtures/verification_positive.json +++ b/packages/fuel/__tests__/fixtures/verification_positive.json @@ -1,38 +1,38 @@ { "example message": { "domain": "login.xyz", - "address": "0x9D85ca56217D2bb651b00f15e694EB7E713637D4", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", "statement": "Sign-In With Fuel Example Statement", "uri": "https://login.xyz", "version": "1", "nonce": "bTyXgcQxn2htgkjJn", "issuedAt": "2022-01-27T17:09:38.578Z", - "chainId": 1, + "chainId": "fuel_testnet_beta", "expirationTime": "2100-01-07T14:31:43.952Z", - "signature": "0xdc35c7f8ba2720df052e0092556456127f00f7707eaa8e3bbff7e56774e7f2e05a093cfc9e02964c33d86e8e066e221b7d153d27e5a2e97ccd5ca7d3f2ce06cb1b" + "signature": "0x8c4abf8ae5b3d5de1ba95168e3f09300fc72980ba53983234a89647e68fa65dbc2094cf7014d3028a5c33745acd928f350d3fa1ad3eea21f4c4e6a72200f1290" }, "not yet valid": { "domain": "login.xyz", - "address": "0xE6D3Aa1F561A215E5eb1f02Ba8705385F03fCaFB", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", "statement": "Sign-In With Fuel Example Statement", "uri": "https://login.xyz", "version": "1", "nonce": "lx2nx4so", "issuedAt": "2022-01-05T14:27:30.883Z", - "chainId": 1, + "chainId": "fuel_testnet_beta", "notBefore": "2100-01-07T14:31:43.952Z", - "signature": "0xc2539ace78f13c7eb8c0852d38d269a6f97bebd9f7872097d2e3137b541f8bf50176062a46eeea83086bd2721423fb5755a932ff6ccc046ed482d14e4576042f1c", + "signature": "0x1a02a31153c2c43c68d85474357ea1c292a52768492bba66e5dcf5b5a0c6066ba7e60a952525d1c8c62633c0416222c80582885ea709c2a4af25f8f143e71515", "time": "2101-01-07T14:31:43.952Z" }, "recovery byte starting at 0": { "domain": "www.tally.xyz", - "address": "0xc95EB884FE852e241D409234bfC7045CB9E31BD7", - "statement": "Sign in with Fuel to Tally", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", + "statement": "Sign-In With Fuel", "uri": "https://tally.xyz", "version": "1", - "chainId": 1, + "chainId": "fuel_testnet_beta", "nonce": "15050747", "issuedAt": "2022-06-30T14:08:51.382Z", - "signature": "0x8c46b6eb8505939892d8e9b075f89f8277321b17b993151f37810cdda38cce6f4a85909d2b53e6a14629c74c0ac38bf4becde78ee5b2529812bf6cceaf7b2a2501" + "signature": "0x490e1da9cd2fddbe49b95859fb98624bbb5ecdfbc7e99f3d71d0d15d560bda8c725e5c62c51bc720cfc5d758da03ab55f20759a8cb98333e02970c3b90509b91" } } diff --git a/packages/fuel/__tests__/siweMessage.test.ts b/packages/fuel/__tests__/siwFuel.test.ts similarity index 89% rename from packages/fuel/__tests__/siweMessage.test.ts rename to packages/fuel/__tests__/siwFuel.test.ts index eaf234f..95c5ad8 100644 --- a/packages/fuel/__tests__/siweMessage.test.ts +++ b/packages/fuel/__tests__/siwFuel.test.ts @@ -1,6 +1,6 @@ import { SiwxErrorTypes } from "@learnweb3dao/siwx-common"; import { FuelMessage } from "../src"; -import { Wallet } from "ethers"; +import { Wallet, Provider, Signer, hashMessage } from "fuels"; const parsePositiveObjects = require("./fixtures/parse_positive.json"); const parseNegativeObjects = require("./fixtures/parse_negative.json"); @@ -31,26 +31,31 @@ describe("Sign in with Fuel", () => { "Verifies message successfully: %s", async (_, test: any) => { const msg = new FuelMessage(test); + const result = await msg.verify({ signature: test.signature, time: test.time || test.issuedAt, }); + expect(result.error).toBe(undefined); expect(result.success).toBe(true); } ); - test.concurrent.each(Object.entries(verificationPositiveObjects))( + test.concurrent.each(Object.entries(parsePositiveObjects))( "Verifies message successfully with random wallet: %s", async (_, test: any) => { - const randomWallet = Wallet.createRandom(); - const msg = new FuelMessage(test); - msg.address = randomWallet.address; + const msg = new FuelMessage(test.fields); + + const randomWallet = Wallet.generate(); + msg.address = randomWallet.address.toString(); + const signature = await randomWallet.signMessage(msg.toMessage()); const result = await msg.verify({ signature, time: test.time || test.issuedAt, }); + expect(result.error).toBe(undefined); expect(result.success).toBe(true); } From df23155d5e6846efea86777ff477696ed4b21814 Mon Sep 17 00:00:00 2001 From: CJskii Date: Sat, 4 May 2024 12:21:43 +0100 Subject: [PATCH 7/9] test: EVM + Solana address + update JSON files --- .../__tests__/fixtures/parse_negative.json | 530 ++++++++---------- .../__tests__/fixtures/parse_positive.json | 136 +++-- .../fixtures/verification_negative.json | 20 +- packages/fuel/__tests__/siwFuel.test.ts | 2 +- 4 files changed, 342 insertions(+), 346 deletions(-) diff --git a/packages/fuel/__tests__/fixtures/parse_negative.json b/packages/fuel/__tests__/fixtures/parse_negative.json index 0499256..46aa3de 100644 --- a/packages/fuel/__tests__/fixtures/parse_negative.json +++ b/packages/fuel/__tests__/fixtures/parse_negative.json @@ -1,285 +1,247 @@ { - "missing domain": { - "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", - "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", - "uri": "https://service.org/login", - "version": "1", - "chainId": 1, - "nonce": "12341234", - "issuedAt": "2022-03-17T12:45:13.610Z", - "expirationTime": "2023-03-17T12:45:13.610Z", - "notBefore": "2022-03-17T12:45:13.610Z", - "requestId": "some_id", - "resources": [ - "https://service.org/login" - ] - }, - "missing address": { - "domain": "service.org", - "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", - "uri": "https://service.org/login", - "version": "1", - "chainId": 1, - "nonce": "12341234", - "issuedAt": "2022-03-17T12:45:13.610Z", - "expirationTime": "2023-03-17T12:45:13.610Z", - "notBefore": "2022-03-17T12:45:13.610Z", - "requestId": "some_id", - "resources": [ - "https://service.org/login" - ] - }, - "missing uri": { - "domain": "service.org", - "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", - "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", - "version": "1", - "chainId": 1, - "nonce": "12341234", - "issuedAt": "2022-03-17T12:45:13.610Z", - "expirationTime": "2023-03-17T12:45:13.610Z", - "notBefore": "2022-03-17T12:45:13.610Z", - "requestId": "some_id", - "resources": [ - "https://service.org/login" - ] - }, - "missing version": { - "domain": "service.org", - "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", - "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", - "uri": "https://service.org/login", - "chainId": 1, - "nonce": "12341234", - "issuedAt": "2022-03-17T12:45:13.610Z", - "expirationTime": "2023-03-17T12:45:13.610Z", - "notBefore": "2022-03-17T12:45:13.610Z", - "requestId": "some_id", - "resources": [ - "https://service.org/login" - ] - }, - "missing chainId": { - "domain": "service.org", - "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", - "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", - "uri": "https://service.org/login", - "version": "1", - "nonce": "12341234", - "issuedAt": "2022-03-17T12:45:13.610Z", - "expirationTime": "2023-03-17T12:45:13.610Z", - "notBefore": "2022-03-17T12:45:13.610Z", - "requestId": "some_id", - "resources": [ - "https://service.org/login" - ] - }, - "missing nonce": { - "domain": "service.org", - "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", - "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", - "uri": "https://service.org/login", - "version": "1", - "chainId": 1, - "issuedAt": "2022-03-17T12:45:13.610Z", - "expirationTime": "2023-03-17T12:45:13.610Z", - "notBefore": "2022-03-17T12:45:13.610Z", - "requestId": "some_id", - "resources": [ - "https://service.org/login" - ] - }, - "missing issuedAt": { - "domain": "service.org", - "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", - "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", - "uri": "https://service.org/login", - "version": "1", - "chainId": 1, - "nonce": "12341234", - "expirationTime": "2023-03-17T12:45:13.610Z", - "notBefore": "2022-03-17T12:45:13.610Z", - "requestId": "some_id", - "resources": [ - "https://service.org/login" - ] - }, - "domain not RFC4501 authority": { - "domain": "#notrfc4501", - "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", - "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", - "uri": "https://service.org/login", - "version": "1", - "chainId": 1, - "nonce": "12341234", - "issuedAt": "2022-03-17T12:45:13.610Z", - "expirationTime": "2023-03-17T12:45:13.610Z", - "notBefore": "2022-03-17T12:45:13.610Z", - "requestId": "some_id", - "resources": [ - "https://service.org/login" - ] - }, - "address not EIP-55": { - "domain": "service.org", - "address": "0xE5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", - "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", - "uri": "https://service.org/login", - "version": "1", - "chainId": 1, - "nonce": "12341234", - "issuedAt": "2022-03-17T12:45:13.610Z", - "expirationTime": "2023-03-17T12:45:13.610Z", - "notBefore": "2022-03-17T12:45:13.610Z", - "requestId": "some_id", - "resources": [ - "https://service.org/login" - ] - }, - "uri is non-RFC 3986": { - "domain": "service.org", - "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", - "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", - "uri": ":not_a_rfc3986_valid_uri_", - "version": "1", - "chainId": 1, - "nonce": "12341234", - "issuedAt": "2022-03-17T12:45:13.610Z", - "expirationTime": "2023-03-17T12:45:13.610Z", - "notBefore": "2022-03-17T12:45:13.610Z", - "requestId": "some_id", - "resources": [ - "https://service.org/login" - ] - }, - "version not 1": { - "domain": "service.org", - "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", - "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", - "uri": "https://service.org/login", - "version": "3", - "chainId": 1, - "nonce": "12341234", - "issuedAt": "2022-03-17T12:45:13.610Z", - "expirationTime": "2023-03-17T12:45:13.610Z", - "notBefore": "2022-03-17T12:45:13.610Z", - "requestId": "some_id", - "resources": [ - "https://service.org/login" - ] - }, - "not a valid chainId": { - "domain": "service.org", - "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", - "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", - "uri": "https://service.org/login", - "version": "1", - "chainId": "?", - "nonce": "12341234", - "issuedAt": "2022-03-17T12:45:13.610Z", - "expirationTime": "2023-03-17T12:45:13.610Z", - "notBefore": "2022-03-17T12:45:13.610Z", - "requestId": "some_id", - "resources": [ - "https://service.org/login" - ] - }, - "nonce with less then 8 chars": { - "domain": "service.org", - "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", - "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", - "uri": "https://service.org/login", - "version": "1", - "chainId": 1, - "nonce": "1234567", - "issuedAt": "2022-03-17T12:45:13.610Z", - "expirationTime": "2023-03-17T12:45:13.610Z", - "notBefore": "2022-03-17T12:45:13.610Z", - "requestId": "some_id", - "resources": [ - "https://service.org/login" - ] - }, - "non-ISO 8601 issuedAt": { - "domain": "service.org", - "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", - "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", - "uri": "https://service.org/login", - "version": "1", - "chainId": 1, - "nonce": "12341234", - "issuedAt": "Wed Oct 05 2011 16:48:00 GMT+0200 (CEST)", - "expirationTime": "2023-03-17T12:45:13.610Z", - "notBefore": "2022-03-17T12:45:13.610Z", - "requestId": "some_id", - "resources": [ - "https://service.org/login" - ] - }, - "non-ISO 8601 expirationTime": { - "domain": "service.org", - "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", - "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", - "uri": "https://service.org/login", - "version": "1", - "chainId": 1, - "nonce": "12341234", - "issuedAt": "2022-03-17T12:45:13.610Z", - "expirationTime": "Wed Oct 05 2011 16:48:00 GMT+0200 (CEST)", - "notBefore": "2022-03-17T12:45:13.610Z", - "requestId": "some_id", - "resources": [ - "https://service.org/login" - ] - }, - "non-ISO 8601 notBefore": { - "domain": "service.org", - "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", - "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", - "uri": "https://service.org/login", - "version": "1", - "chainId": 1, - "nonce": "12341234", - "issuedAt": "2022-03-17T12:45:13.610Z", - "expirationTime": "2023-03-17T12:45:13.610Z", - "notBefore": "Wed Oct 05 2011 16:48:00 GMT+0200 (CEST)", - "requestId": "some_id", - "resources": [ - "https://service.org/login" - ] - }, - "first resource not-RFC 3986": { - "domain": "service.org", - "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", - "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", - "uri": "https://service.org/login", - "version": "1", - "chainId": 1, - "nonce": "12341234", - "issuedAt": "2022-03-17T12:45:13.610Z", - "expirationTime": "2023-03-17T12:45:13.610Z", - "notBefore": "2022-03-17T12:45:13.610Z", - "requestId": "some_id", - "resources": [ - ":not_a_rfc3986_valid_uri_", - "https://service.org/login" - ] - }, - "second resource is not-RFC3986": { - "domain": "service.org", - "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", - "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", - "uri": "https://service.org/login", - "version": "1", - "chainId": 1, - "nonce": "12341234", - "issuedAt": "2022-03-17T12:45:13.610Z", - "expirationTime": "2023-03-17T12:45:13.610Z", - "notBefore": "2022-03-17T12:45:13.610Z", - "requestId": "some_id", - "resources": [ - "https://service.org/login", - ":not_a_rfc3986_valid_uri_" - ] - } -} \ No newline at end of file + "missing domain": { + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": "fuel_testnet_beta", + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": ["https://service.org/login"] + }, + "missing address": { + "domain": "service.org", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": "fuel_testnet_beta", + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": ["https://service.org/login"] + }, + "missing uri": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "version": "1", + "chainId": "fuel_testnet_beta", + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": ["https://service.org/login"] + }, + "missing version": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "chainId": "fuel_testnet_beta", + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": ["https://service.org/login"] + }, + "missing chainId": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": ["https://service.org/login"] + }, + "missing nonce": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": "fuel_testnet_beta", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": ["https://service.org/login"] + }, + "missing issuedAt": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": "fuel_testnet_beta", + "nonce": "12341234", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": ["https://service.org/login"] + }, + "domain not RFC4501 authority": { + "domain": "#notrfc4501", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": "fuel_testnet_beta", + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": ["https://service.org/login"] + }, + "address not EIP-55": { + "domain": "service.org", + "address": "0xE5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": "fuel_testnet_beta", + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": ["https://service.org/login"] + }, + "uri is non-RFC 3986": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": ":not_a_rfc3986_valid_uri_", + "version": "1", + "chainId": "fuel_testnet_beta", + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": ["https://service.org/login"] + }, + "version not 1": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "3", + "chainId": "fuel_testnet_beta", + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": ["https://service.org/login"] + }, + "not a valid chainId": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": "?", + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": ["https://service.org/login"] + }, + "nonce with less then 8 chars": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": "fuel_testnet_beta", + "nonce": "1234567", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": ["https://service.org/login"] + }, + "non-ISO 8601 issuedAt": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": "fuel_testnet_beta", + "nonce": "12341234", + "issuedAt": "Wed Oct 05 2011 16:48:00 GMT+0200 (CEST)", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": ["https://service.org/login"] + }, + "non-ISO 8601 expirationTime": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": "fuel_testnet_beta", + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "Wed Oct 05 2011 16:48:00 GMT+0200 (CEST)", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": ["https://service.org/login"] + }, + "non-ISO 8601 notBefore": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": "fuel_testnet_beta", + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "Wed Oct 05 2011 16:48:00 GMT+0200 (CEST)", + "requestId": "some_id", + "resources": ["https://service.org/login"] + }, + "first resource not-RFC 3986": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": "fuel_testnet_beta", + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": [":not_a_rfc3986_valid_uri_", "https://service.org/login"] + }, + "second resource is not-RFC3986": { + "domain": "service.org", + "address": "0xe5A12547fe4E872D192E3eCecb76F2Ce1aeA4946", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": "fuel_testnet_beta", + "nonce": "12341234", + "issuedAt": "2022-03-17T12:45:13.610Z", + "expirationTime": "2023-03-17T12:45:13.610Z", + "notBefore": "2022-03-17T12:45:13.610Z", + "requestId": "some_id", + "resources": ["https://service.org/login", ":not_a_rfc3986_valid_uri_"] + } +} diff --git a/packages/fuel/__tests__/fixtures/parse_positive.json b/packages/fuel/__tests__/fixtures/parse_positive.json index 51c73a7..0099468 100644 --- a/packages/fuel/__tests__/fixtures/parse_positive.json +++ b/packages/fuel/__tests__/fixtures/parse_positive.json @@ -1,13 +1,47 @@ { + "EVM Address": { + "message": "service.org wants you to sign in with your Fuel account:\n0x590BF0B63266D0638e274a841DEe96603d3ff2fC\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: fuel_testnet_beta\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- ipfs://Qme7ss3ARVgxv6rXqVPiikMJ8u2NLgmgszg13pYrDKEoiu\n- https://example.com/my-web2-claim.json", + "fields": { + "domain": "service.org", + "address": "0x590BF0B63266D0638e274a841DEe96603d3ff2fC", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": "fuel_testnet_beta", + "nonce": "32891757", + "issuedAt": "2021-09-30T16:25:24.000Z", + "resources": [ + "ipfs://Qme7ss3ARVgxv6rXqVPiikMJ8u2NLgmgszg13pYrDKEoiu", + "https://example.com/my-web2-claim.json" + ] + } + }, + "Solana Address": { + "message": "service.org wants you to sign in with your Fuel account:\n9grfFBRGKdv1SDaHirr1vGfq3KCTW8Je3faF25XPXgyk\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: fuel_testnet_beta\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- ipfs://Qme7ss3ARVgxv6rXqVPiikMJ8u2NLgmgszg13pYrDKEoiu\n- https://example.com/my-web2-claim.json", + "fields": { + "domain": "service.org", + "address": "9grfFBRGKdv1SDaHirr1vGfq3KCTW8Je3faF25XPXgyk", + "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", + "uri": "https://service.org/login", + "version": "1", + "chainId": "fuel_testnet_beta", + "nonce": "32891757", + "issuedAt": "2021-09-30T16:25:24.000Z", + "resources": [ + "ipfs://Qme7ss3ARVgxv6rXqVPiikMJ8u2NLgmgszg13pYrDKEoiu", + "https://example.com/my-web2-claim.json" + ] + } + }, "couple of optional fields": { - "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- ipfs://Qme7ss3ARVgxv6rXqVPiikMJ8u2NLgmgszg13pYrDKEoiu\n- https://example.com/my-web2-claim.json", + "message": "service.org wants you to sign in with your Fuel account:\nfuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: fuel_testnet_beta\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z\nResources:\n- ipfs://Qme7ss3ARVgxv6rXqVPiikMJ8u2NLgmgszg13pYrDKEoiu\n- https://example.com/my-web2-claim.json", "fields": { "domain": "service.org", - "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", "uri": "https://service.org/login", "version": "1", - "chainId": 1, + "chainId": "fuel_testnet_beta", "nonce": "32891757", "issuedAt": "2021-09-30T16:25:24.000Z", "resources": [ @@ -17,186 +51,186 @@ } }, "no optional field": { - "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "message": "service.org wants you to sign in with your Fuel account:\nfuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: fuel_testnet_beta\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", "fields": { "domain": "service.org", - "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", "uri": "https://service.org/login", "version": "1", - "chainId": 1, + "chainId": "fuel_testnet_beta", "nonce": "32891757", "issuedAt": "2021-09-30T16:25:24.000Z" } }, "timestamp without microseconds": { - "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24Z", + "message": "service.org wants you to sign in with your Fuel account:\nfuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: fuel_testnet_beta\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24Z", "fields": { "domain": "service.org", - "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", "uri": "https://service.org/login", "version": "1", - "chainId": 1, + "chainId": "fuel_testnet_beta", "nonce": "32891757", "issuedAt": "2021-09-30T16:25:24Z" } }, "timezone not utc": { - "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24-02:00", + "message": "service.org wants you to sign in with your Fuel account:\nfuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: fuel_testnet_beta\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24-02:00", "fields": { "domain": "service.org", - "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", "uri": "https://service.org/login", "version": "1", - "chainId": 1, + "chainId": "fuel_testnet_beta", "nonce": "32891757", "issuedAt": "2021-09-30T16:25:24-02:00" } }, "domain is RFC 3986 authority with IP": { - "message": "127.0.0.1 wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "message": "127.0.0.1 wants you to sign in with your Fuel account:\nfuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: fuel_testnet_beta\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", "fields": { "domain": "127.0.0.1", - "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", "uri": "https://service.org/login", "version": "1", - "chainId": 1, + "chainId": "fuel_testnet_beta", "nonce": "32891757", "issuedAt": "2021-09-30T16:25:24.000Z" } }, "domain is RFC 3986 authority with userinfo": { - "message": "test@127.0.0.1 wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "message": "test@127.0.0.1 wants you to sign in with your Fuel account:\nfuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: fuel_testnet_beta\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", "fields": { "domain": "test@127.0.0.1", - "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", "uri": "https://service.org/login", "version": "1", - "chainId": 1, + "chainId": "fuel_testnet_beta", "nonce": "32891757", "issuedAt": "2021-09-30T16:25:24.000Z" } }, "domain is RFC 3986 authority with port": { - "message": "127.0.0.1:8080 wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "message": "127.0.0.1:8080 wants you to sign in with your Fuel account:\nfuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: fuel_testnet_beta\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", "fields": { "domain": "127.0.0.1:8080", - "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", "uri": "https://service.org/login", "version": "1", - "chainId": 1, + "chainId": "fuel_testnet_beta", "nonce": "32891757", "issuedAt": "2021-09-30T16:25:24.000Z" } }, "domain is localhost authority with port": { - "message": "localhost:8080 wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "message": "localhost:8080 wants you to sign in with your Fuel account:\nfuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: fuel_testnet_beta\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", "fields": { "domain": "localhost:8080", - "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", "uri": "https://service.org/login", "version": "1", - "chainId": 1, + "chainId": "fuel_testnet_beta", "nonce": "32891757", "issuedAt": "2021-09-30T16:25:24.000Z" } }, "domain is RFC 3986 authority with userinfo and port": { - "message": "test@127.0.0.1:8080 wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "message": "test@127.0.0.1:8080 wants you to sign in with your Fuel account:\nfuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983\n\nI accept the ServiceOrg Terms of Service: https://service.org/tos\n\nURI: https://service.org/login\nVersion: 1\nChain ID: fuel_testnet_beta\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", "fields": { "domain": "test@127.0.0.1:8080", - "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", "statement": "I accept the ServiceOrg Terms of Service: https://service.org/tos", "uri": "https://service.org/login", "version": "1", - "chainId": 1, + "chainId": "fuel_testnet_beta", "nonce": "32891757", "issuedAt": "2021-09-30T16:25:24.000Z" } }, "no statement": { - "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "message": "service.org wants you to sign in with your Fuel account:\nfuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983\n\n\nURI: https://service.org/login\nVersion: 1\nChain ID: fuel_testnet_beta\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", "fields": { "domain": "service.org", - "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", "uri": "https://service.org/login", "version": "1", - "chainId": 1, + "chainId": "fuel_testnet_beta", "nonce": "32891757", "issuedAt": "2021-09-30T16:25:24.000Z" } }, "domain ipv6": { - "message": "[::cafe] wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "message": "[::cafe] wants you to sign in with your Fuel account:\nfuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983\n\n\nURI: https://service.org/login\nVersion: 1\nChain ID: fuel_testnet_beta\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", "fields": { "domain": "[::cafe]", - "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", "uri": "https://service.org/login", "version": "1", - "chainId": 1, + "chainId": "fuel_testnet_beta", "nonce": "32891757", "issuedAt": "2021-09-30T16:25:24.000Z" } }, "uri ipv6": { - "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\n\nURI: https://[::cafe]\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "message": "service.org wants you to sign in with your Fuel account:\nfuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983\n\n\nURI: https://[::cafe]\nVersion: 1\nChain ID: fuel_testnet_beta\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", "fields": { "domain": "service.org", - "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", "uri": "https://[::cafe]", "version": "1", - "chainId": 1, + "chainId": "fuel_testnet_beta", "nonce": "32891757", "issuedAt": "2021-09-30T16:25:24.000Z" } }, "uri ipv4": { - "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\n\nURI: https://127.0.0.1\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "message": "service.org wants you to sign in with your Fuel account:\nfuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983\n\n\nURI: https://127.0.0.1\nVersion: 1\nChain ID: fuel_testnet_beta\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", "fields": { "domain": "service.org", - "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", "uri": "https://127.0.0.1", "version": "1", - "chainId": 1, + "chainId": "fuel_testnet_beta", "nonce": "32891757", "issuedAt": "2021-09-30T16:25:24.000Z" } }, "uri with port": { - "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\n\nURI: https://127.0.0.1:4361\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "message": "service.org wants you to sign in with your Fuel account:\nfuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983\n\n\nURI: https://127.0.0.1:4361\nVersion: 1\nChain ID: fuel_testnet_beta\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", "fields": { "domain": "service.org", - "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", "uri": "https://127.0.0.1:4361", "version": "1", - "chainId": 1, + "chainId": "fuel_testnet_beta", "nonce": "32891757", "issuedAt": "2021-09-30T16:25:24.000Z" } }, "uri ipv4 query params and fragment": { - "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\n\nURI: https://127.0.0.1/?query=one#begin\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "message": "service.org wants you to sign in with your Fuel account:\nfuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983\n\n\nURI: https://127.0.0.1/?query=one#begin\nVersion: 1\nChain ID: fuel_testnet_beta\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", "fields": { "domain": "service.org", - "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", "uri": "https://127.0.0.1/?query=one#begin", "version": "1", - "chainId": 1, + "chainId": "fuel_testnet_beta", "nonce": "32891757", "issuedAt": "2021-09-30T16:25:24.000Z" } }, - "chainId not 1": { - "message": "service.org wants you to sign in with your Fuel account:\n0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\n\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 4\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", + "chainId not fuel_testnet_beta": { + "message": "service.org wants you to sign in with your Fuel account:\nfuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983\n\n\nURI: https://service.org/login\nVersion: 1\nChain ID: 4\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z", "fields": { "domain": "service.org", - "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", "uri": "https://service.org/login", "version": "1", "chainId": 4, @@ -205,14 +239,14 @@ } }, "recovery byte starting at 0": { - "message": "www.tally.xyz wants you to sign in with your Fuel account:\n0xc95EB884FE852e241D409234bfC7045CB9E31BD7\n\nSign in with Fuel to Tally\n\nURI: https://tally.xyz\nVersion: 1\nChain ID: 1\nNonce: 15050747\nIssued At: 2022-06-30T14:08:51.382Z", + "message": "www.tally.xyz wants you to sign in with your Fuel account:\nfuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983\n\nSign in with Fuel to Tally\n\nURI: https://tally.xyz\nVersion: 1\nChain ID: fuel_testnet_beta\nNonce: 15050747\nIssued At: 2022-06-30T14:08:51.382Z", "fields": { "domain": "www.tally.xyz", - "address": "0xc95EB884FE852e241D409234bfC7045CB9E31BD7", + "address": "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", "statement": "Sign in with Fuel to Tally", "uri": "https://tally.xyz", "version": "1", - "chainId": 1, + "chainId": "fuel_testnet_beta", "nonce": "15050747", "issuedAt": "2022-06-30T14:08:51.382Z" } diff --git a/packages/fuel/__tests__/fixtures/verification_negative.json b/packages/fuel/__tests__/fixtures/verification_negative.json index 214fe28..19c8992 100644 --- a/packages/fuel/__tests__/fixtures/verification_negative.json +++ b/packages/fuel/__tests__/fixtures/verification_negative.json @@ -7,7 +7,7 @@ "version": "1", "nonce": "lx2nx4so", "issuedAt": "2022-01-05T14:27:30.883Z", - "chainId": 1, + "chainId": "fuel_testnet_beta", "expirationTime": "2021-01-05T00:00:00Z", "signature": "0x7337bc2826c7678cd6bc84f5b3b236efc969b0451f9feca2328b1d3401b030c113f19bdba359ba3f52762c66e9147311fa95fe598a1a4ec9bb383a7b4e3874241b" }, @@ -20,7 +20,7 @@ "version": "1", "nonce": "bTyXgcQxn2htgkjJn", "issuedAt": "2022-01-27T17:09:38.578Z", - "chainId": 1, + "chainId": "fuel_testnet_beta", "expirationTime": "2100-01-07T14:31:43.952Z", "signature": "0xdc35c7f8ba2720df052e0092556456127f00f7707eaa8e3bbff7e56774e7f2e05a093cfc9e02964c33d86e8e066e221b7d153d27e5a2e97ccd5ca7d3f2ce06cb1b" }, @@ -32,7 +32,7 @@ "version": "1", "nonce": "bTyXgcQxn2htgkjJn", "issuedAt": "2022-01-27T17:09:38.578Z", - "chainId": 1, + "chainId": "fuel_testnet_beta", "expirationTime": "2100-01-07T14:31:43.952Z", "signature": "0xdc35c7f8ba2720df052e0092556456127f00f7707eaa8e3bbff7e56774e7f2e05a093cfc9e02964c33d86e8e066e221b7d153d27e5a2e97ccd5ca7d3f2ce06cb1b", "time": "2200-01-05T00:00:00Z" @@ -45,7 +45,7 @@ "version": "1", "nonce": "bTyXgcQxn2htgkjJn", "issuedAt": "2022-01-27T17:09:38.578Z", - "chainId": 1, + "chainId": "fuel_testnet_beta", "expirationTime": "2100-01-07T14:31:43.952Z", "signature": "0xdc35c7f8ba2720df052e0092556456127f00f7707eaa8e3bbff7e56774e7f2e05a093cfc9e02964c33d86e8e066e221b7d153d27e5a2e97ccd5ca7d3f2ce06cb1b", "matchNonce": "6548asdgf" @@ -58,7 +58,7 @@ "version": "1", "nonce": "rmplqh1gf", "issuedAt": "2022-01-05T14:31:43.954Z", - "chainId": 1, + "chainId": "fuel_testnet_beta", "expirationTime": "2100-01-07T14:31:43.952Z", "signature": "0xf2e8420fc1b722bf4941f5a0464f98172a758ceda5039f622e425fb69fd19b20e444bba7c9a8a8d7e2b5e453553efe7c9460be5d211abe473fc146d51bb04d0cb1b" }, @@ -70,7 +70,7 @@ "version": "1", "nonce": "rmplqh1gf", "issuedAt": "2022-01-05T14:31:43.954Z", - "chainId": 1, + "chainId": "fuel_testnet_beta", "expirationTime": "2100-01-07T14:31:43.952Z", "signature": "0x31df81dc02344c9156e6f71da46e2db624b38f8f806290d670d46492b834b2e7575cbce9f48169356cfb577b910d8e30732fcf23c1ac0021d08b945ed7ee118e1b" }, @@ -82,7 +82,7 @@ "version": "1", "nonce": "lx2nx4so", "issuedAt": "2022-01-05T14:27:30.883Z", - "chainId": 1, + "chainId": "fuel_testnet_beta", "notBefore": "2100-01-07T14:31:43.952Z", "signature": "0xc2539ace78f13c7eb8c0852d38d269a6f97bebd9f7872097d2e3137b541f8bf50176062a46eeea83086bd2721423fb5755a932ff6ccc046ed482d14e4576042f1c" }, @@ -94,7 +94,7 @@ "version": "1", "nonce": "bTyXgcQxn2htgkjJn", "issuedAt": "2022-02-31T17:09:38.578Z", - "chainId": 1, + "chainId": "fuel_testnet_beta", "signature": "0x9e837df8b56f6e0cac9b4dce52074c352a4143932b442b973963ed2f7b9987146c8e546e5662867198ec0ae9bdb2e87ffaee528375dac7bf003883714ff732701b" }, "invalid notBefore": { @@ -105,7 +105,7 @@ "version": "1", "nonce": "bTyXgcQxn2htgkjJn", "issuedAt": "2022-01-30T17:09:38.578Z", - "chainId": 1, + "chainId": "fuel_testnet_beta", "notBefore": "2025-02-31T17:09:38.578Z", "expirationTime": "2100-01-07T14:31:43.952Z", "signature": "0xa741355d0cfa938f45e9137d3b1f362e06961d2f35e01bad794b1f35d7d3e4fc5fd610d28d1b1236fdc305ec05c62b83cade54b49e221adf62e116b0c3a96f531b" @@ -118,7 +118,7 @@ "version": "1", "nonce": "bTyXgcQxn2htgkjJn", "issuedAt": "2022-01-30T17:09:38.578Z", - "chainId": 1, + "chainId": "fuel_testnet_beta", "expirationTime": "2100-02-31T14:31:43.952Z", "signature": "0x5cbe6e6735e7b5818da08890363d6154edf73593db692b64adaea9c1186712a72244971284377d2fed8286b69dafc3cf964cb4e05a8e8d07c1a6f4ede8d9470e1c" } diff --git a/packages/fuel/__tests__/siwFuel.test.ts b/packages/fuel/__tests__/siwFuel.test.ts index 95c5ad8..a238968 100644 --- a/packages/fuel/__tests__/siwFuel.test.ts +++ b/packages/fuel/__tests__/siwFuel.test.ts @@ -1,6 +1,6 @@ import { SiwxErrorTypes } from "@learnweb3dao/siwx-common"; import { FuelMessage } from "../src"; -import { Wallet, Provider, Signer, hashMessage } from "fuels"; +import { Wallet } from "fuels"; const parsePositiveObjects = require("./fixtures/parse_positive.json"); const parseNegativeObjects = require("./fixtures/parse_negative.json"); From 2f93589adc1543b2ab0c25b8e91879018e035ba1 Mon Sep 17 00:00:00 2001 From: CJskii Date: Sat, 4 May 2024 13:06:52 +0100 Subject: [PATCH 8/9] integration: fuel example --- example/package.json | 4 + example/src/components/siwFuel.tsx | 101 +++-- example/src/pages/_app.tsx | 18 +- example/src/pages/api/auth/[...nextauth].ts | 42 ++ pnpm-lock.yaml | 438 ++++++++++++++++++++ 5 files changed, 558 insertions(+), 45 deletions(-) diff --git a/example/package.json b/example/package.json index c6f8cc6..bf9cdf9 100644 --- a/example/package.json +++ b/example/package.json @@ -10,14 +10,18 @@ }, "dependencies": { "@airgap/beacon-types": "^4.0.4", + "@fuels/connectors": "^0.2.2", + "@fuels/react": "^0.18.1", "@learnweb3dao/siwe": "workspace:^", "@learnweb3dao/siws": "workspace:^", "@learnweb3dao/siwstacks": "workspace:^", "@learnweb3dao/siwstarknet": "workspace:^", "@learnweb3dao/siwtezos": "workspace:^", + "@learnweb3dao/siwfuel": "workspace:^", "@solana/web3.js": "^1.75.0", "@stacks/connect": "^7.3.1", "@stacks/network": "^6.5.2", + "@tanstack/react-query": "^5.34.1", "@taquito/beacon-wallet": "^17.0.0", "@taquito/taquito": "^17.0.0", "@types/node": "^18.16.3", diff --git a/example/src/components/siwFuel.tsx b/example/src/components/siwFuel.tsx index 89cf3d3..477f133 100644 --- a/example/src/components/siwFuel.tsx +++ b/example/src/components/siwFuel.tsx @@ -1,55 +1,72 @@ "use client"; -// import { FuelMessage } from "@learnweb3dao/siwfuel"; -import { getCsrfToken, signIn, useSession } from "next-auth/react"; -import { useRouter } from "next/router"; -import React, { useEffect } from "react"; -import { useAccount, useConnect, useNetwork, useSignMessage } from "wagmi"; -import { InjectedConnector } from "wagmi/connectors/injected"; -import { Provider, Wallet, BN, Address } from "fuels"; +import { FuelMessage } from "@learnweb3dao/siwfuel"; +import { getCsrfToken, signIn } from "next-auth/react"; +import React from "react"; +import { useConnectUI } from "@fuels/react"; +import { useIsConnected } from "@fuels/react"; +import { Fuel } from "fuels"; +import { defaultConnectors } from "@fuels/connectors"; +import { useChain, useAccount } from "@fuels/react"; export const SIWFUEL: React.FC = () => { - const { address, isConnected } = useAccount(); - const { chain } = useNetwork(); - const [balance, setBalance] = React.useState(0); - - useEffect(() => { - async () => { - const provider = await Provider.create( - "https://beta-5.fuel.network/graphql" - ); - const myWallet = Wallet.fromAddress( - "fuel1j0k43mq3g2l6spur9y0tesps6s0sdhnfq8xv2ng5ga9td250u9hqs5a983", - provider - ); - myWallet.getBalances().then((data) => { - setBalance(new BN(data[0].amount).toNumber()); + const { connect } = useConnectUI(); + const { isConnected } = useIsConnected(); + const { chain } = useChain(); + const { account } = useAccount(); + + const handleLogin = async () => { + try { + const fuel = new Fuel({ + connectors: defaultConnectors({ devMode: true }), }); - }; - }, []); - useEffect(() => { - // convert fuel address to EVM address - const bech32 = - "fuel1d5cfwekq78r0zq73g7eg0747etkaxxltrqx5tncm7lvg89awe3hswhqjhs"; - const addressInstance = Address.fromDynamicInput(bech32); - const b256 = addressInstance.toB256(); - // EVM ADDRESS = 0x6d309766c0f1c6f103d147b287fabecaedd31beb180d45cf1bf7d88397aecc6f - }, []); + const currentAccount = await fuel.currentAccount(); + + if (!currentAccount) { + connect(); + return; + } + + const message = new FuelMessage({ + domain: window.location.host, + address: currentAccount, + statement: "Sign in with Ethereum to this application.", + uri: window.location.origin, + version: "1", + chainId: chain?.consensusParameters.chainId.toString(), + nonce: await getCsrfToken(), + issuedAt: new Date().toISOString(), + }); - console.log(balance); + if (!account) { + return; + } + + const wallet = await fuel.getWallet(account); + const signedMessage = await wallet.signMessage(message.toMessage()); + + await signIn("fuel", { + message: JSON.stringify(message), + signature: signedMessage, + redirect: false, + }); + } catch (error) { + window.alert(error); + } + }; return (