diff --git a/single-factor-auth-web/sfa-web-ton-telegram-example/.env b/single-factor-auth-web/sfa-web-ton-telegram-example/.env index 75a4abe6..6f0ca220 100644 --- a/single-factor-auth-web/sfa-web-ton-telegram-example/.env +++ b/single-factor-auth-web/sfa-web-ton-telegram-example/.env @@ -1,5 +1,2 @@ VITE_SERVER_URL="http://localhost:3000" # server-url -VITE_W3A_VERIFIER_NAME="" # w3a-verifier-name -VITE_W3A_CLIENT_ID="" # w3a-client-id from web3auth dashboard -REACT_APP_SERVER_URL="http://localhost:3000" # server-url NODE_ENV="development" \ No newline at end of file diff --git a/single-factor-auth-web/sfa-web-ton-telegram-example/.env.example b/single-factor-auth-web/sfa-web-ton-telegram-example/.env.example index 0a8173e5..05bd6365 100644 --- a/single-factor-auth-web/sfa-web-ton-telegram-example/.env.example +++ b/single-factor-auth-web/sfa-web-ton-telegram-example/.env.example @@ -1,3 +1,2 @@ VITE_SERVER_URL="" # server-url -VITE_W3A_VERIFIER_NAME="" # w3a-verifier-name -VITE_W3A_CLIENT_ID="" # w3a-client-id from web3auth dashboard \ No newline at end of file +NODE_ENV="" # development (if testing, only then mocking of Telegram MiniApp env will work) \ No newline at end of file diff --git a/single-factor-auth-web/sfa-web-ton-telegram-example/README.md b/single-factor-auth-web/sfa-web-ton-telegram-example/README.md index 9ef6835b..7cbd8b0d 100644 --- a/single-factor-auth-web/sfa-web-ton-telegram-example/README.md +++ b/single-factor-auth-web/sfa-web-ton-telegram-example/README.md @@ -3,67 +3,55 @@ [![Web3Auth](https://img.shields.io/badge/Web3Auth-SDK-blue)](https://web3auth.io/docs/sdk/core-kit/sfa-web) [![Web3Auth](https://img.shields.io/badge/Web3Auth-Community-cyan)](https://community.web3auth.io) -[Join our Community Portal](https://community.web3auth.io/) to get support and stay up to date with the latest news and updates. +This example demonstrates how to use Web3Auth with Telegram Login in a React-Vite frontend with an Express backend. The server handles Telegram OAuth and issues JWT tokens for the Web3Auth SDK. -This example demonstrates how to use Web3Auth with Telegram Login in a React Vite frontend. Express is used to create the Telegram OAuth server that issues JWT tokens for the Web3Auth SDK. +Check out our detailed guides to help you build and integrate Web3Auth into your Telegram Mini App: +- [Server-Side Setup Guide](https://web3auth.io/docs/guides/telegram-miniapp-server) - Learn to set up authentication, JWT tokens, and user sessions +- [Client-Side Development Guide](https://web3auth.io/docs/guides/telegram-miniapp-client) - Implement frontend integration with Telegram UI and Web3Auth -## How to Use +## Quick Start Guide -### Download Manually +### Download the Example ```bash -npx degit Web3Auth/web3auth-core-kit-examples/single-factor-auth-web/sfa-web-telegram-example w3a-sfa-web-telegram-example +npx degit Web3Auth/web3auth-core-kit-examples/single-factor-auth-web/sfa-web-ton-telegram-example w3a-sfa-web-ton-telegram-example ``` -### Setup - -1. Create a `.env` file in the `server/api` directory with the following content: +### Server Configuration +1. Create a `.env` file in the `server/api` directory: ```bash -TELEGRAM_BOT_NAME="" # e.g. @your_bot_name -TELEGRAM_BOT_TOKEN="" # e.g. 1234567890:ABCDEF -SERVER_URL="" # e.g. http://localhost:3000 -CLIENT_URL="" # e.g. http://localhost:5173 -JWT_KEY_ID="" # e.g. your_key_id +TELEGRAM_BOT_TOKEN="" # Token provided by BotFather upon bot creation +JWT_KEY_ID="" # Create one using https://web3auth.io/docs/auth-provider-setup/byo-jwt-provider#generate-jwt +APP_URL="" # Your frontend URL (e.g., http://localhost:5173) ``` -2. Create a `.env.local` file in the root directory with the following content: +### Client Configuration +1. Create a `.env.local` file in the root directory: ```bash -VITE_SERVER_URL="" # e.g. http://localhost:3000 -VITE_W3A_VERIFIER_NAME="" # e.g. w3a-telegram-demo -VITE_W3A_CLIENT_ID="" # e.g. your_client_id +VITE_SERVER_URL="" # Your server URL (e.g., http://localhost:3000) ``` -Follow [this Telegram guide](https://web3auth.io/docs/guides/telegram) to follow along. - -Install & Run: +### Installation & Running +Start the server: ```bash cd w3a-example/server npm install -## start server -# server will be running on localhost:8080 -cd api -node index.js -# use ngrok to expose the server to the internet -# ngrok http 3000 -# copy the ngrok url and update the SERVER_URL in the .env file -# also update the telegram bot domain to the ngrok url - +npm run start # Server runs on localhost:3000 +``` -## now, start the client +Start the client: +```bash cd .. npm install -npm run start -# client will be running on localhost:5173 +npm run start # Client runs on localhost:5173 ``` -## Important Links +## Resources -- [Website](https://web3auth.io) -- [Docs](https://web3auth.io/docs) -- [Guides](https://web3auth.io/docs/guides) -- [SDK / API References](https://web3auth.io/docs/sdk) -- [Pricing](https://web3auth.io/pricing.html) +- [Documentation](https://web3auth.io/docs) - [Community Portal](https://community.web3auth.io) + +[Join our Community Portal](https://community.web3auth.io/) to get support and stay up to date with the latest news and updates. \ No newline at end of file diff --git a/single-factor-auth-web/sfa-web-ton-telegram-example/package-lock.json b/single-factor-auth-web/sfa-web-ton-telegram-example/package-lock.json index 12f2bb0c..6efb0bf7 100644 --- a/single-factor-auth-web/sfa-web-ton-telegram-example/package-lock.json +++ b/single-factor-auth-web/sfa-web-ton-telegram-example/package-lock.json @@ -21,9 +21,12 @@ "@types/react": "^18.0.28", "@types/react-dom": "^18.0.10", "@vitejs/plugin-react": "^4.3.1", + "@web3auth/auth-adapter": "^9.4.0", "@web3auth/base": "^9.3.0", "@web3auth/base-provider": "^9.3.0", + "@web3auth/ethereum-provider": "^9.4.0", "@web3auth/single-factor-auth": "^9.2.0", + "@web3auth/solana-provider": "^9.4.0", "lucide-react": "^0.454.0", "react": "^18.3.1", "react-dom": "^18.3.1", @@ -31,7 +34,8 @@ "tonweb": "^0.0.66", "typescript": "^5.0.4", "vite": "^5.4.1", - "web-vitals": "^3.1.1" + "web-vitals": "^3.1.1", + "web3": "^4.15.0" }, "devDependencies": { "buffer": "^6.0.3", @@ -46,6 +50,12 @@ "integrity": "sha512-Ff9+ksdQQB3rMncgqDK78uLznstjyfIf2Arnh22pW8kBpLs6rpKDwgnZT46hin5Hl1WzazzK64DOrhSwYpS7bQ==", "license": "MIT" }, + "node_modules/@adraffy/ens-normalize": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", + "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==", + "license": "MIT" + }, "node_modules/@ampproject/remapping": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", @@ -6564,6 +6574,73 @@ "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==", "license": "MIT" }, + "node_modules/@solana/buffer-layout": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz", + "integrity": "sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==", + "license": "MIT", + "peer": true, + "dependencies": { + "buffer": "~6.0.3" + }, + "engines": { + "node": ">=5.10" + } + }, + "node_modules/@solana/web3.js": { + "version": "1.95.4", + "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.95.4.tgz", + "integrity": "sha512-sdewnNEA42ZSMxqkzdwEWi6fDgzwtJHaQa5ndUGEJYtoOnM6X5cvPmjoTUp7/k7bRrVAxfBgDnvQQHD6yhlLYw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@babel/runtime": "^7.25.0", + "@noble/curves": "^1.4.2", + "@noble/hashes": "^1.4.0", + "@solana/buffer-layout": "^4.0.1", + "agentkeepalive": "^4.5.0", + "bigint-buffer": "^1.1.5", + "bn.js": "^5.2.1", + "borsh": "^0.7.0", + "bs58": "^4.0.1", + "buffer": "6.0.3", + "fast-stable-stringify": "^1.0.0", + "jayson": "^4.1.1", + "node-fetch": "^2.7.0", + "rpc-websockets": "^9.0.2", + "superstruct": "^2.0.2" + } + }, + "node_modules/@solana/web3.js/node_modules/base-x": { + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.10.tgz", + "integrity": "sha512-7d0s06rR9rYaIWHkpfLIFICM/tkSVdoPC9qYAQRpxn9DdKNWNsKC0uk++akckyLq16Tx2WIinnZ6WRriAt6njQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/@solana/web3.js/node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "license": "MIT", + "peer": true, + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/@swc/helpers": { + "version": "0.5.15", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz", + "integrity": "sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "tslib": "^2.8.0" + } + }, "node_modules/@telegram-apps/bridge": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@telegram-apps/bridge/-/bridge-1.3.0.tgz", @@ -6760,9 +6837,9 @@ } }, "node_modules/@toruslabs/base-controllers": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/@toruslabs/base-controllers/-/base-controllers-6.2.2.tgz", - "integrity": "sha512-9kCeHqtUcTUD9zj1FnY8lbMWaRCceP9dn6s7XdSwuC/wS+rqIxrNwgfwfbvGUl9ZgcskJ7lyNXQqAwZ92Xlzig==", + "version": "6.2.4", + "resolved": "https://registry.npmjs.org/@toruslabs/base-controllers/-/base-controllers-6.2.4.tgz", + "integrity": "sha512-VRki0iYnSL3Chy2W/mwk2dc3tiLuSR5a/dwaapCNn3SgMGIEgnJMwq1wNQO1l5eaHgl3eN7b/IL8Y2DfqHnW4g==", "license": "ISC", "dependencies": { "@ethereumjs/util": "^9.1.0", @@ -6803,9 +6880,9 @@ } }, "node_modules/@toruslabs/constants": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/@toruslabs/constants/-/constants-14.0.0.tgz", - "integrity": "sha512-c0lrqxxiR0FL+XdtbX+77PWTeB8izFUrnPwkF2pjjfXlMJLukAWPLhALpmZmqlGmJApT8kJbMN7be2LurAGa1g==", + "version": "14.1.1", + "resolved": "https://registry.npmjs.org/@toruslabs/constants/-/constants-14.1.1.tgz", + "integrity": "sha512-+/ur6lXjMto4FdJR5Y6HqFiEX/8hea9usgwt99neV3IT46auC5NyVdiG6qmohuy67ThLt7IMCIyuJY78eC875g==", "license": "MIT", "engines": { "node": ">=18.x", @@ -6917,11 +6994,12 @@ } }, "node_modules/@toruslabs/secure-pub-sub": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@toruslabs/secure-pub-sub/-/secure-pub-sub-1.0.0.tgz", - "integrity": "sha512-Xv8SExIJ4/DBw5QHcSN+EGPMddZ2du4NcI9jztLde1K/0Hfnurqw6CcAniU6zpKVRVCRwjiauYCNYIRPBi2M4g==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@toruslabs/secure-pub-sub/-/secure-pub-sub-1.1.0.tgz", + "integrity": "sha512-OFN0Zsa37+c9aStHd4wzau+IYPY+gve9fBPDuPSIuS06cz/bov39DvCP0LaTQUKxK4eQMZENcPu6PeyBvQYQQA==", "license": "MIT", "dependencies": { + "@toruslabs/constants": "^14.1.1", "@toruslabs/eccrypto": "^5.0.0", "@toruslabs/http-helpers": "^7.0.0", "@toruslabs/metadata-helpers": "^6.0.0", @@ -6937,11 +7015,12 @@ } }, "node_modules/@toruslabs/session-manager": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@toruslabs/session-manager/-/session-manager-3.1.0.tgz", - "integrity": "sha512-VTaYjTTGTqpUm14YWRsSmY0Tt5z7evC0aOdVW7Ahw/jzyb1witNL4Va2+7XzunziEkLJS3luH+LkziHx67jyQg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@toruslabs/session-manager/-/session-manager-3.2.0.tgz", + "integrity": "sha512-t+EGFZhn8pxZ5Gjhxr99qNmK20zZD/RYEMRROBuwsETyy/QU17H6dKhqIb306GjmwUPkz2VKKTtJcOg9Ifijuw==", "license": "MIT", "dependencies": { + "@toruslabs/constants": "^14.1.1", "@toruslabs/eccrypto": "^5.0.4", "@toruslabs/http-helpers": "^7.0.0", "@toruslabs/metadata-helpers": "^6.0.0" @@ -6951,9 +7030,22 @@ "npm": ">=9.x" }, "optionalDependencies": { - "@rollup/rollup-linux-x64-gnu": "^4.22.4" + "@rollup/rollup-linux-x64-gnu": "^4.24.4" } }, + "node_modules/@toruslabs/session-manager/node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.26.0.tgz", + "integrity": "sha512-ZuwpfjCwjPkAOxpjAEjabg6LRSfL7cAJb6gSQGZYjGhadlzKKywDkCUnJ+KEfrNY1jH5EEoSIKLCb572jSiglA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, "node_modules/@toruslabs/starkware-crypto": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@toruslabs/starkware-crypto/-/starkware-crypto-4.0.0.tgz", @@ -7070,6 +7162,16 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/estree": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", @@ -7209,6 +7311,23 @@ "@types/jest": "*" } }, + "node_modules/@types/uuid": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz", + "integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==", + "license": "MIT", + "peer": true + }, + "node_modules/@types/ws": { + "version": "7.4.7", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", + "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/yargs": { "version": "17.0.33", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz", @@ -7297,17 +7416,17 @@ } }, "node_modules/@web3auth/auth": { - "version": "9.4.1", - "resolved": "https://registry.npmjs.org/@web3auth/auth/-/auth-9.4.1.tgz", - "integrity": "sha512-V5JNBc7VeHDmP+9VN4obAIav/NbkyZXEVJ3rD9C4SdbO/ZF3Hc+G8SdVPymJlR2JrBCsuPJiFsUatBl1hx+FSg==", + "version": "9.5.1", + "resolved": "https://registry.npmjs.org/@web3auth/auth/-/auth-9.5.1.tgz", + "integrity": "sha512-+4VQg0JxD4B1iX8TXOqX6GeC4JfQdjmyux6nEHKF9TtxIJvuAdVTXEx48q/CeOSHBAfwjyGrj0Xiik1ZDBIzlg==", "license": "MIT", "dependencies": { "@ethereumjs/util": "^9.1.0", - "@toruslabs/constants": "^14.0.0", + "@toruslabs/constants": "^14.1.1", "@toruslabs/ffjavascript": "^4.0.0", "@toruslabs/metadata-helpers": "^6.0.0", - "@toruslabs/secure-pub-sub": "^1.0.0", - "@toruslabs/session-manager": "^3.0.0", + "@toruslabs/secure-pub-sub": "^1.1.0", + "@toruslabs/session-manager": "^3.2.0", "@toruslabs/starkware-crypto": "^4.0.0", "@toruslabs/tweetnacl-js": "^1.0.4", "base64url": "^3.0.1", @@ -7320,9 +7439,9 @@ "events": "^3.3.0", "fast-safe-stringify": "^2.1.1", "json-stable-stringify": "^1.1.1", - "loglevel": "^1.9.1", + "loglevel": "^1.9.2", "once": "^1.4.0", - "pump": "^3.0.0", + "pump": "^3.0.2", "readable-stream": "^4.5.2", "ts-custom-error": "^3.3.1", "typed-emitter": "^2.1.0" @@ -7333,22 +7452,54 @@ }, "optionalDependencies": { "@nx/nx-linux-x64-gnu": "^19.6.3", - "@rollup/rollup-linux-x64-gnu": "^4.21.1" + "@rollup/rollup-linux-x64-gnu": "^4.24.4" }, "peerDependencies": { "@babel/runtime": "7.x" } }, + "node_modules/@web3auth/auth-adapter": { + "version": "9.4.0", + "resolved": "https://registry.npmjs.org/@web3auth/auth-adapter/-/auth-adapter-9.4.0.tgz", + "integrity": "sha512-2MX2Ytv6gx+Q8Na3mlqQPaToNIG5WQ33oU8QFwovb2KGskQlphFhR4FDwVKQVFRyVvpbYtw3cTrfyihf4kDHcw==", + "license": "ISC", + "dependencies": { + "@web3auth/auth": "^9.5.0", + "@web3auth/base": "^9.4.0", + "@web3auth/base-provider": "^9.4.0", + "deepmerge": "^4.3.1" + }, + "engines": { + "node": ">=18.x", + "npm": ">=9.x" + }, + "peerDependencies": { + "@babel/runtime": "^7.x" + } + }, + "node_modules/@web3auth/auth/node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.26.0.tgz", + "integrity": "sha512-ZuwpfjCwjPkAOxpjAEjabg6LRSfL7cAJb6gSQGZYjGhadlzKKywDkCUnJ+KEfrNY1jH5EEoSIKLCb572jSiglA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, "node_modules/@web3auth/base": { - "version": "9.3.0", - "resolved": "https://registry.npmjs.org/@web3auth/base/-/base-9.3.0.tgz", - "integrity": "sha512-S1X3i83T7HWr+pF+qBG6nAh49bhE/91LzQxQqSTMQ3f0NGdaMWtuQK3QewyO+G71+9+yrhIS0vggnXyAgY9NaA==", + "version": "9.4.0", + "resolved": "https://registry.npmjs.org/@web3auth/base/-/base-9.4.0.tgz", + "integrity": "sha512-wdqopG1XPcLZHiOigTCJpE8pCWta0f6SjJ5bDHFmicpol0Goc/Egfs/kdH+qnzCIjkL+loWSVl3Vxp9ee1NwpQ==", "license": "ISC", "dependencies": { - "@toruslabs/base-controllers": "^6.2.2", - "@toruslabs/constants": "^14.0.0", + "@toruslabs/base-controllers": "^6.2.4", + "@toruslabs/constants": "^14.1.1", "@toruslabs/http-helpers": "^7.0.0", - "@web3auth/auth": "^9.4.1", + "@web3auth/auth": "^9.5.0", "jwt-decode": "^4.0.0", "loglevel": "^1.9.2", "ts-custom-error": "^3.3.1" @@ -7362,14 +7513,14 @@ } }, "node_modules/@web3auth/base-provider": { - "version": "9.3.0", - "resolved": "https://registry.npmjs.org/@web3auth/base-provider/-/base-provider-9.3.0.tgz", - "integrity": "sha512-WiBpeVvyzmrjLQ8XNZMTWdtukDivuEvX8nOwT5FjyWBow5f06GViDRIRhB1D/M8n3xtsID8O/7qb8Gr6lw48zw==", + "version": "9.4.0", + "resolved": "https://registry.npmjs.org/@web3auth/base-provider/-/base-provider-9.4.0.tgz", + "integrity": "sha512-hnQCpqrcP8TKvcsYC+uq6IOAH+pLQ3uQXPxXpWRG7pokFTDvQHYJXWpdc5wDmCOy6c815b8hXmHd7lmgl1t1Dg==", "license": "ISC", "dependencies": { - "@toruslabs/base-controllers": "^6.2.2", - "@web3auth/auth": "^9.4.1", - "@web3auth/base": "^9.3.0", + "@toruslabs/base-controllers": "^6.2.4", + "@web3auth/auth": "^9.5.0", + "@web3auth/base": "^9.4.0", "json-rpc-random-id": "^1.0.1" }, "engines": { @@ -7380,6 +7531,33 @@ "@babel/runtime": "7.x" } }, + "node_modules/@web3auth/ethereum-provider": { + "version": "9.4.0", + "resolved": "https://registry.npmjs.org/@web3auth/ethereum-provider/-/ethereum-provider-9.4.0.tgz", + "integrity": "sha512-sxEtACBtiTFvOoiFuvsRBo7Jd1vT2j4Z+SvdY6oCRtobCXud1f96FPPZbdUbu/K9CFr55+ymVTzJ803KUKn9+w==", + "license": "ISC", + "dependencies": { + "@ethereumjs/util": "^9.1.0", + "@toruslabs/base-controllers": "^6.2.4", + "@toruslabs/eccrypto": "^5.0.4", + "@toruslabs/http-helpers": "^7.0.0", + "@web3auth/auth": "^9.5.0", + "@web3auth/base": "^9.4.0", + "@web3auth/base-provider": "^9.4.0", + "assert": "^2.1.0", + "bignumber.js": "^9.1.2", + "bn.js": "^5.2.1", + "ethers": "^6.13.4", + "jsonschema": "^1.4.1" + }, + "engines": { + "node": ">=18.x", + "npm": ">=9.x" + }, + "peerDependencies": { + "@babel/runtime": "7.x" + } + }, "node_modules/@web3auth/single-factor-auth": { "version": "9.2.0", "resolved": "https://registry.npmjs.org/@web3auth/single-factor-auth/-/single-factor-auth-9.2.0.tgz", @@ -7403,6 +7581,30 @@ "@babel/runtime": "^7.x" } }, + "node_modules/@web3auth/solana-provider": { + "version": "9.4.0", + "resolved": "https://registry.npmjs.org/@web3auth/solana-provider/-/solana-provider-9.4.0.tgz", + "integrity": "sha512-8oEIAGtLv8oBV1/9XDxUjauPmlJKUnHP0cCHPsm84C/k706mJlH+mx+zIvNACf6W01603K8H6Clx2oCIyiCJRw==", + "license": "ISC", + "dependencies": { + "@toruslabs/base-controllers": "^6.2.4", + "@toruslabs/tweetnacl-js": "^1.0.4", + "@web3auth/auth": "^9.5.0", + "@web3auth/base": "^9.4.0", + "@web3auth/base-provider": "^9.4.0", + "bn.js": "^5.2.1", + "bs58": "^5.0.0", + "json-rpc-random-id": "^1.0.1" + }, + "engines": { + "node": ">=18.x", + "npm": ">=9.x" + }, + "peerDependencies": { + "@babel/runtime": "^7.x", + "@solana/web3.js": "^1.x" + } + }, "node_modules/@webassemblyjs/ast": { "version": "1.12.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.12.1.tgz", @@ -7589,6 +7791,21 @@ "license": "Apache-2.0", "peer": true }, + "node_modules/abitype": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-0.7.1.tgz", + "integrity": "sha512-VBkRHTDZf9Myaek/dO3yMmOzB/y2s3Zo6nVU7yaw1G+TvCHAjwaJzNGN9yo4K5D8bU/VZXKP1EJpRhFr862PlQ==", + "license": "MIT", + "peerDependencies": { + "typescript": ">=4.9.4", + "zod": "^3 >=3.19.1" + }, + "peerDependenciesMeta": { + "zod": { + "optional": true + } + } + }, "node_modules/abort-controller": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", @@ -7639,6 +7856,12 @@ "acorn": "^8" } }, + "node_modules/aes-js": { + "version": "4.0.0-beta.5", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", + "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==", + "license": "MIT" + }, "node_modules/agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", @@ -7653,6 +7876,19 @@ "node": ">= 6.0.0" } }, + "node_modules/agentkeepalive": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", + "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", + "license": "MIT", + "peer": true, + "dependencies": { + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, "node_modules/aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -8331,6 +8567,20 @@ "node": ">=0.6" } }, + "node_modules/bigint-buffer": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/bigint-buffer/-/bigint-buffer-1.1.5.tgz", + "integrity": "sha512-trfYco6AoZ+rKhKnxA0hgX0HAbVP/s808/EuDSe2JDzUnCp/xAsli35Orvk67UrTEcwuxZqYZDmfA2RXJgxVvA==", + "hasInstallScript": true, + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "bindings": "^1.3.0" + }, + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/bignumber.js": { "version": "9.1.2", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", @@ -8340,6 +8590,16 @@ "node": "*" } }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, "node_modules/bip39": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.1.0.tgz", @@ -8410,6 +8670,38 @@ "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", "license": "MIT" }, + "node_modules/borsh": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/borsh/-/borsh-0.7.0.tgz", + "integrity": "sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "bn.js": "^5.2.0", + "bs58": "^4.0.0", + "text-encoding-utf-8": "^1.0.2" + } + }, + "node_modules/borsh/node_modules/base-x": { + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.10.tgz", + "integrity": "sha512-7d0s06rR9rYaIWHkpfLIFICM/tkSVdoPC9qYAQRpxn9DdKNWNsKC0uk++akckyLq16Tx2WIinnZ6WRriAt6njQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/borsh/node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "license": "MIT", + "peer": true, + "dependencies": { + "base-x": "^3.0.2" + } + }, "node_modules/bowser": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz", @@ -8582,6 +8874,21 @@ "license": "MIT", "peer": true }, + "node_modules/bufferutil": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.8.tgz", + "integrity": "sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, "node_modules/builtins": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz", @@ -9315,6 +9622,18 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/crc-32": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", + "license": "Apache-2.0", + "bin": { + "crc32": "bin/crc32.njs" + }, + "engines": { + "node": ">=0.8" + } + }, "node_modules/cross-fetch": { "version": "3.1.8", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", @@ -9638,6 +9957,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/delay": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", + "integrity": "sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -10135,6 +10467,23 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "license": "MIT", + "peer": true + }, + "node_modules/es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "es6-promise": "^4.0.3" + } + }, "node_modules/esbuild": { "version": "0.21.5", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", @@ -10307,6 +10656,79 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/ethers": { + "version": "6.13.4", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.13.4.tgz", + "integrity": "sha512-21YtnZVg4/zKkCQPjrDj38B1r4nQvTZLopUGMLQ1ePU2zV/joCfDC3t3iKQjWRzjjjbzR+mdAIoikeBRNkdllA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/ethers-io/" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "license": "MIT", + "dependencies": { + "@adraffy/ens-normalize": "1.10.1", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", + "@types/node": "22.7.5", + "aes-js": "4.0.0-beta.5", + "tslib": "2.7.0", + "ws": "8.17.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/ethers/node_modules/@noble/curves": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", + "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.3.2" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ethers/node_modules/@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", + "license": "MIT", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ethers/node_modules/@types/node": { + "version": "22.7.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.5.tgz", + "integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==", + "license": "MIT", + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/ethers/node_modules/tslib": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", + "license": "0BSD" + }, + "node_modules/ethers/node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "license": "MIT" + }, "node_modules/ethjs-unit": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", @@ -10336,6 +10758,12 @@ "node": ">=6" } }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "license": "MIT" + }, "node_modules/events": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", @@ -10725,6 +11153,15 @@ "optional": true, "peer": true }, + "node_modules/eyes": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", + "integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==", + "peer": true, + "engines": { + "node": "> 0.1.90" + } + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -10762,8 +11199,15 @@ "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", "license": "MIT" }, - "node_modules/fast-xml-parser": { - "version": "4.5.0", + "node_modules/fast-stable-stringify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz", + "integrity": "sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==", + "license": "MIT", + "peer": true + }, + "node_modules/fast-xml-parser": { + "version": "4.5.0", "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.5.0.tgz", "integrity": "sha512-/PlTQCI96+fZMAOLMZK4CWG1ItCbfZ/0jx7UIJFChPNrx7tcEgerUgWbeieCM9MfHInUDyK8DWYZ+YrywDJuTg==", "funding": [ @@ -10851,6 +11295,13 @@ "optional": true, "peer": true }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "license": "MIT", + "peer": true + }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -11586,6 +12037,16 @@ "node": ">=10.17.0" } }, + "node_modules/humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "ms": "^2.0.0" + } + }, "node_modules/iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", @@ -12402,6 +12863,16 @@ "react-native-securerandom": "^0.1.1" } }, + "node_modules/isomorphic-ws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", + "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", + "license": "MIT", + "peer": true, + "peerDependencies": { + "ws": "*" + } + }, "node_modules/jackspeak": { "version": "3.4.3", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", @@ -12419,6 +12890,69 @@ "@pkgjs/parseargs": "^0.11.0" } }, + "node_modules/jayson": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/jayson/-/jayson-4.1.2.tgz", + "integrity": "sha512-5nzMWDHy6f+koZOuYsArh2AXs73NfWYVlFyJJuCedr93GpY+Ku8qq10ropSXVfHK+H0T6paA88ww+/dV+1fBNA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/connect": "^3.4.33", + "@types/node": "^12.12.54", + "@types/ws": "^7.4.4", + "commander": "^2.20.3", + "delay": "^5.0.0", + "es6-promisify": "^5.0.0", + "eyes": "^0.1.8", + "isomorphic-ws": "^4.0.1", + "json-stringify-safe": "^5.0.1", + "JSONStream": "^1.3.5", + "uuid": "^8.3.2", + "ws": "^7.5.10" + }, + "bin": { + "jayson": "bin/jayson.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jayson/node_modules/@types/node": { + "version": "12.20.55", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", + "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", + "license": "MIT", + "peer": true + }, + "node_modules/jayson/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "license": "MIT", + "peer": true + }, + "node_modules/jayson/node_modules/ws": { + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/jest-diff": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", @@ -12912,6 +13446,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "license": "ISC", + "peer": true + }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -12944,6 +13485,42 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", + "engines": [ + "node >= 0.2.0" + ], + "license": "MIT", + "peer": true + }, + "node_modules/jsonschema": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.1.tgz", + "integrity": "sha512-S6cATIPVv1z0IlxdN+zUk5EPjkGCdnhN4wVSBlvoUO1tOLJootbo9CquNJmbIh4yikWHiUedhRYrNPn1arpEmQ==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "license": "(MIT OR Apache-2.0)", + "peer": true, + "dependencies": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + }, + "bin": { + "JSONStream": "bin.js" + }, + "engines": { + "node": "*" + } + }, "node_modules/jwt-decode": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-4.0.0.tgz", @@ -14635,6 +15212,19 @@ "node": ">= 6.13.0" } }, + "node_modules/node-gyp-build": { + "version": "4.8.3", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.3.tgz", + "integrity": "sha512-EMS95CMJzdoSKoIiXo8pxKoL8DYxwIZXYlLmgPb8KUv794abpnLK6ynsCAWNliOjREKruYKdzbh76HHYUHX7nw==", + "license": "MIT", + "optional": true, + "peer": true, + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -16389,6 +16979,40 @@ "fsevents": "~2.3.2" } }, + "node_modules/rpc-websockets": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-9.0.4.tgz", + "integrity": "sha512-yWZWN0M+bivtoNLnaDbtny4XchdAIF5Q4g/ZsC5UC61Ckbp0QczwO8fg44rV3uYmY4WHd+EZQbn90W1d8ojzqQ==", + "license": "LGPL-3.0-only", + "peer": true, + "dependencies": { + "@swc/helpers": "^0.5.11", + "@types/uuid": "^8.3.4", + "@types/ws": "^8.2.2", + "buffer": "^6.0.3", + "eventemitter3": "^5.0.1", + "uuid": "^8.3.2", + "ws": "^8.5.0" + }, + "funding": { + "type": "paypal", + "url": "https://paypal.me/kozjak" + }, + "optionalDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + } + }, + "node_modules/rpc-websockets/node_modules/@types/ws": { + "version": "8.5.13", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.13.tgz", + "integrity": "sha512-osM/gWBTPKgHV8XkTunnegTRIsvF6owmf5w+JtAfOw472dptdm0dlGv4xCt6GwQRcC2XVOvvRE/0bAoQcL2QkA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -16828,9 +17452,7 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", - "license": "MIT", - "optional": true, - "peer": true + "license": "MIT" }, "node_modules/setprototypeof": { "version": "1.2.0", @@ -17577,6 +18199,16 @@ "optional": true, "peer": true }, + "node_modules/superstruct": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-2.0.2.tgz", + "integrity": "sha512-uV+TFRZdXsqXTL2pRvujROjdZQ4RAlBUS5BTh9IGm+jTqQntYThciG/qu57Gs69yjnVUSqdxF9YLmSnpupBW9A==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -17907,6 +18539,12 @@ "license": "MIT", "peer": true }, + "node_modules/text-encoding-utf-8": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz", + "integrity": "sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==", + "peer": true + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -17953,7 +18591,6 @@ "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", "license": "MIT", - "optional": true, "peer": true }, "node_modules/through2": { @@ -18552,6 +19189,21 @@ "optional": true, "peer": true }, + "node_modules/utf-8-validate": { + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", + "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, "node_modules/util": { "version": "0.12.5", "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", @@ -18589,7 +19241,6 @@ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", "license": "MIT", - "optional": true, "peer": true, "bin": { "uuid": "dist/bin/uuid" @@ -18733,6 +19384,387 @@ "integrity": "sha512-c0rhqNcHXRkY/ogGDJQxZ9Im9D19hDihbzSQJrsioex+KnFgmMzBiy57Z1EjkhX/+OjyBpclDCzz2ITtjokFmg==", "license": "Apache-2.0" }, + "node_modules/web3": { + "version": "4.15.0", + "resolved": "https://registry.npmjs.org/web3/-/web3-4.15.0.tgz", + "integrity": "sha512-0QWDWE4gDWldXb4KWq++K8m/A9zsR0LpJLtVT39/b4OjfdW0d4mE0qAUd3UocxuKTh1eG5pOCfumbGS5l6p1qg==", + "license": "LGPL-3.0", + "dependencies": { + "web3-core": "^4.7.0", + "web3-errors": "^1.3.0", + "web3-eth": "^4.11.0", + "web3-eth-abi": "^4.4.0", + "web3-eth-accounts": "^4.3.0", + "web3-eth-contract": "^4.7.1", + "web3-eth-ens": "^4.4.0", + "web3-eth-iban": "^4.0.7", + "web3-eth-personal": "^4.1.0", + "web3-net": "^4.1.0", + "web3-providers-http": "^4.2.0", + "web3-providers-ws": "^4.0.8", + "web3-rpc-methods": "^1.3.0", + "web3-rpc-providers": "^1.0.0-rc.3", + "web3-types": "^1.9.0", + "web3-utils": "^4.3.2", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14.0.0", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-core": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-4.7.0.tgz", + "integrity": "sha512-skP4P56fhlrE+rIuS4WY9fTdja1DPml2xrrDmv+vQhPtmSFBs7CqesycIRLQh4dK1D4de/a23tkX6DLYdUt3nA==", + "license": "LGPL-3.0", + "dependencies": { + "web3-errors": "^1.3.0", + "web3-eth-accounts": "^4.2.1", + "web3-eth-iban": "^4.0.7", + "web3-providers-http": "^4.2.0", + "web3-providers-ws": "^4.0.8", + "web3-types": "^1.8.1", + "web3-utils": "^4.3.2", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + }, + "optionalDependencies": { + "web3-providers-ipc": "^4.0.7" + } + }, + "node_modules/web3-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/web3-errors/-/web3-errors-1.3.0.tgz", + "integrity": "sha512-j5JkAKCtuVMbY3F5PYXBqg1vWrtF4jcyyMY1rlw8a4PV67AkqlepjGgpzWJZd56Mt+TvHy6DA1F/3Id8LatDSQ==", + "license": "LGPL-3.0", + "dependencies": { + "web3-types": "^1.7.0" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth": { + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-4.11.0.tgz", + "integrity": "sha512-nZIJ/8FOOj5aEXoS8p9puuX5jLyzewZv3nXqoKNtu531/vA/yIiU/EtPnAV62RvVMcbDSiF/BLVFdBZCsVMJbg==", + "license": "LGPL-3.0", + "dependencies": { + "setimmediate": "^1.0.5", + "web3-core": "^4.7.0", + "web3-errors": "^1.3.0", + "web3-eth-abi": "^4.4.0", + "web3-eth-accounts": "^4.3.0", + "web3-net": "^4.1.0", + "web3-providers-ws": "^4.0.8", + "web3-rpc-methods": "^1.3.0", + "web3-types": "^1.9.0", + "web3-utils": "^4.3.2", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth-abi": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-4.4.0.tgz", + "integrity": "sha512-RQzt9W93OgFBwOdNGcc9ulCyYt4zmRAMkKGbEdp3wcN4vmwTlRhh21+akj2ND4bg3C3RUiP4yprYgDEyN0/Fmg==", + "license": "LGPL-3.0", + "dependencies": { + "abitype": "0.7.1", + "web3-errors": "^1.3.0", + "web3-types": "^1.9.0", + "web3-utils": "^4.3.2", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth-accounts": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-4.3.0.tgz", + "integrity": "sha512-7UX3rJiNgHYoqrO1WRPks/9J5Mh2x5N9HAd9QsOM8zfKY2rwSyCIIQM03OFXDEQRZ/ztycKTHgeLStmhlUUKIQ==", + "license": "LGPL-3.0", + "dependencies": { + "@ethereumjs/rlp": "^4.0.1", + "crc-32": "^1.2.2", + "ethereum-cryptography": "^2.0.0", + "web3-errors": "^1.3.0", + "web3-types": "^1.9.0", + "web3-utils": "^4.3.2", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth-accounts/node_modules/@ethereumjs/rlp": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-4.0.1.tgz", + "integrity": "sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw==", + "license": "MPL-2.0", + "bin": { + "rlp": "bin/rlp" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/web3-eth-contract": { + "version": "4.7.1", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-4.7.1.tgz", + "integrity": "sha512-D9nHCclq4lj2CX1sOrGga1UFA9CNBWZV6NGwNr6WjbBGIFl9ui2mivE9c3vNGEfSMnvKEq/zE83N+eGOwcWZlg==", + "license": "LGPL-3.0", + "dependencies": { + "@ethereumjs/rlp": "^5.0.2", + "web3-core": "^4.7.0", + "web3-errors": "^1.3.0", + "web3-eth": "^4.11.0", + "web3-eth-abi": "^4.4.0", + "web3-types": "^1.9.0", + "web3-utils": "^4.3.2", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth-ens": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-4.4.0.tgz", + "integrity": "sha512-DeyVIS060hNV9g8dnTx92syqvgbvPricE3MerCxe/DquNZT3tD8aVgFfq65GATtpCgDDJffO2bVeHp3XBemnSQ==", + "license": "LGPL-3.0", + "dependencies": { + "@adraffy/ens-normalize": "^1.8.8", + "web3-core": "^4.5.0", + "web3-errors": "^1.2.0", + "web3-eth": "^4.8.0", + "web3-eth-contract": "^4.5.0", + "web3-net": "^4.1.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth-iban": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-4.0.7.tgz", + "integrity": "sha512-8weKLa9KuKRzibC87vNLdkinpUE30gn0IGY027F8doeJdcPUfsa4IlBgNC4k4HLBembBB2CTU0Kr/HAOqMeYVQ==", + "license": "LGPL-3.0", + "dependencies": { + "web3-errors": "^1.1.3", + "web3-types": "^1.3.0", + "web3-utils": "^4.0.7", + "web3-validator": "^2.0.3" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-eth-personal": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-4.1.0.tgz", + "integrity": "sha512-RFN83uMuvA5cu1zIwwJh9A/bAj0OBxmGN3tgx19OD/9ygeUZbifOL06jgFzN0t+1ekHqm3DXYQM8UfHpXi7yDQ==", + "license": "LGPL-3.0", + "dependencies": { + "web3-core": "^4.6.0", + "web3-eth": "^4.9.0", + "web3-rpc-methods": "^1.3.0", + "web3-types": "^1.8.0", + "web3-utils": "^4.3.1", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-net": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-4.1.0.tgz", + "integrity": "sha512-WWmfvHVIXWEoBDWdgKNYKN8rAy6SgluZ0abyRyXOL3ESr7ym7pKWbfP4fjApIHlYTh8tNqkrdPfM4Dyi6CA0SA==", + "license": "LGPL-3.0", + "dependencies": { + "web3-core": "^4.4.0", + "web3-rpc-methods": "^1.3.0", + "web3-types": "^1.6.0", + "web3-utils": "^4.3.0" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-providers-http": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-4.2.0.tgz", + "integrity": "sha512-IPMnDtHB7dVwaB7/mMxAZzyq7d5ezfO1+Vw0bNfAeIi7gaDlJiggp85SdyAfOgov8AMUA/dyiY72kQ0KmjXKvQ==", + "license": "LGPL-3.0", + "dependencies": { + "cross-fetch": "^4.0.0", + "web3-errors": "^1.3.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-providers-http/node_modules/cross-fetch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", + "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", + "license": "MIT", + "dependencies": { + "node-fetch": "^2.6.12" + } + }, + "node_modules/web3-providers-ipc": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-4.0.7.tgz", + "integrity": "sha512-YbNqY4zUvIaK2MHr1lQFE53/8t/ejHtJchrWn9zVbFMGXlTsOAbNoIoZWROrg1v+hCBvT2c9z8xt7e/+uz5p1g==", + "license": "LGPL-3.0", + "optional": true, + "dependencies": { + "web3-errors": "^1.1.3", + "web3-types": "^1.3.0", + "web3-utils": "^4.0.7" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-providers-ws": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-4.0.8.tgz", + "integrity": "sha512-goJdgata7v4pyzHRsg9fSegUG4gVnHZSHODhNnn6J93ykHkBI1nz4fjlGpcQLUMi4jAMz6SHl9Ibzs2jj9xqPw==", + "license": "LGPL-3.0", + "dependencies": { + "@types/ws": "8.5.3", + "isomorphic-ws": "^5.0.0", + "web3-errors": "^1.2.0", + "web3-types": "^1.7.0", + "web3-utils": "^4.3.1", + "ws": "^8.17.1" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-providers-ws/node_modules/@types/ws": { + "version": "8.5.3", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz", + "integrity": "sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/web3-providers-ws/node_modules/isomorphic-ws": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz", + "integrity": "sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==", + "license": "MIT", + "peerDependencies": { + "ws": "*" + } + }, + "node_modules/web3-rpc-methods": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/web3-rpc-methods/-/web3-rpc-methods-1.3.0.tgz", + "integrity": "sha512-/CHmzGN+IYgdBOme7PdqzF+FNeMleefzqs0LVOduncSaqsppeOEoskLXb2anSpzmQAP3xZJPaTrkQPWSJMORig==", + "license": "LGPL-3.0", + "dependencies": { + "web3-core": "^4.4.0", + "web3-types": "^1.6.0", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-rpc-providers": { + "version": "1.0.0-rc.3", + "resolved": "https://registry.npmjs.org/web3-rpc-providers/-/web3-rpc-providers-1.0.0-rc.3.tgz", + "integrity": "sha512-aeFPYgvHjsf2yQi3CSQA9Ie4xnmO7VmNkY098rA7AWvhgyjVgIWlrVgZjUn55FXtthbiiTRm/CLriv99UeOfGQ==", + "license": "LGPL-3.0", + "dependencies": { + "web3-errors": "^1.3.0", + "web3-providers-http": "^4.2.0", + "web3-providers-ws": "^4.0.8", + "web3-types": "^1.9.0", + "web3-utils": "^4.3.2", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-types": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/web3-types/-/web3-types-1.9.0.tgz", + "integrity": "sha512-I520KBPoXqEaM/ybj6xHD1E3gRb8/WdudLQaRBvJNQSSfHuPW9P2sD59mbhm6dsKtnje+T90dIxSyzVVFlEdlg==", + "license": "LGPL-3.0", + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-utils": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.3.2.tgz", + "integrity": "sha512-bEFpYEBMf6ER78Uvj2mdsCbaLGLK9kABOsa3TtXOEEhuaMy/RK0KlRkKoZ2vmf/p3hB8e1q5erknZ6Hy7AVp7A==", + "license": "LGPL-3.0", + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "eventemitter3": "^5.0.1", + "web3-errors": "^1.3.0", + "web3-types": "^1.8.1", + "web3-validator": "^2.0.6" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, + "node_modules/web3-validator": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/web3-validator/-/web3-validator-2.0.6.tgz", + "integrity": "sha512-qn9id0/l1bWmvH4XfnG/JtGKKwut2Vokl6YXP5Kfg424npysmtRLe9DgiNBM9Op7QL/aSiaA0TVXibuIuWcizg==", + "license": "LGPL-3.0", + "dependencies": { + "ethereum-cryptography": "^2.0.0", + "util": "^0.12.5", + "web3-errors": "^1.2.0", + "web3-types": "^1.6.0", + "zod": "^3.21.4" + }, + "engines": { + "node": ">=14", + "npm": ">=6.12.0" + } + }, "node_modules/webcrypto-core": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/webcrypto-core/-/webcrypto-core-1.8.1.tgz", @@ -19239,8 +20271,6 @@ "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", "license": "MIT", - "optional": true, - "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/single-factor-auth-web/sfa-web-ton-telegram-example/package.json b/single-factor-auth-web/sfa-web-ton-telegram-example/package.json index 40b17732..0491489c 100644 --- a/single-factor-auth-web/sfa-web-ton-telegram-example/package.json +++ b/single-factor-auth-web/sfa-web-ton-telegram-example/package.json @@ -27,9 +27,12 @@ "@types/react": "^18.0.28", "@types/react-dom": "^18.0.10", "@vitejs/plugin-react": "^4.3.1", + "@web3auth/auth-adapter": "^9.4.0", "@web3auth/base": "^9.3.0", "@web3auth/base-provider": "^9.3.0", + "@web3auth/ethereum-provider": "^9.4.0", "@web3auth/single-factor-auth": "^9.2.0", + "@web3auth/solana-provider": "^9.4.0", "lucide-react": "^0.454.0", "react": "^18.3.1", "react-dom": "^18.3.1", @@ -37,7 +40,8 @@ "tonweb": "^0.0.66", "typescript": "^5.0.4", "vite": "^5.4.1", - "web-vitals": "^3.1.1" + "web-vitals": "^3.1.1", + "web3": "^4.15.0" }, "devDependencies": { "buffer": "^6.0.3", diff --git a/single-factor-auth-web/sfa-web-ton-telegram-example/server/api/.env.example b/single-factor-auth-web/sfa-web-ton-telegram-example/server/api/.env.example index c7a8568c..3444e01a 100644 --- a/single-factor-auth-web/sfa-web-ton-telegram-example/server/api/.env.example +++ b/single-factor-auth-web/sfa-web-ton-telegram-example/server/api/.env.example @@ -1,5 +1,3 @@ -TELEGRAM_BOT_NAME="" TELEGRAM_BOT_TOKEN="" -SERVER_URL="" -CLIENT_URL="" -JWT_KEY_ID="" \ No newline at end of file +JWT_KEY_ID="" +APP_URL="" \ No newline at end of file diff --git a/single-factor-auth-web/sfa-web-ton-telegram-example/server/api/telegram.js b/single-factor-auth-web/sfa-web-ton-telegram-example/server/api/telegram.js index fdcb3da1..13ad9869 100644 --- a/single-factor-auth-web/sfa-web-ton-telegram-example/server/api/telegram.js +++ b/single-factor-auth-web/sfa-web-ton-telegram-example/server/api/telegram.js @@ -1,3 +1,4 @@ +// Custom Webhook for Telegram Bot for replying to /start command import { Telegraf } from "telegraf"; export default async function handler(req, res) { diff --git a/single-factor-auth-web/sfa-web-ton-telegram-example/src/App.css b/single-factor-auth-web/sfa-web-ton-telegram-example/src/App.css index d46f818a..798c686d 100644 --- a/single-factor-auth-web/sfa-web-ton-telegram-example/src/App.css +++ b/single-factor-auth-web/sfa-web-ton-telegram-example/src/App.css @@ -1,317 +1,523 @@ -@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap'); +@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap"); :root { - --bg-color: #f8faff; - --text-color: #1a1b25; - --border-color: #e0e0e0; - --hover-bg: rgba(0, 0, 0, 0.05); - --box-shadow: rgba(0, 0, 0, 0.08); - --card-bg: #ffffff; + --bg-color: #f8faff; + --text-color: #1a1b25; + --border-color: #e0e0e0; + --hover-bg: rgba(0, 0, 0, 0.05); + --box-shadow: rgba(0, 0, 0, 0.08); + --card-bg: #ffffff; + --title-gradient: linear-gradient(90deg, #00b7f7, #627eea, #8a2be2); } :root.dark-mode { - --bg-color: #0F1221; - --text-color: #ffffff; - --border-color: #2a2d3d; - --hover-bg: rgba(255, 255, 255, 0.1); - --box-shadow: rgba(0, 0, 0, 0.3); - --card-bg: #1a1f35; -} - -/* Base styles */ -html, body { - max-width: 100vw; - overflow-x: hidden; - margin: 0; - padding: 0; + --bg-color: #0f1221; + --text-color: #ffffff; + --border-color: #2a2d3d; + --hover-bg: rgba(255, 255, 255, 0.1); + --box-shadow: rgba(0, 0, 0, 0.3); + --card-bg: #1a1f35; } +html, body { - font-family: 'Inter', sans-serif; - background: var(--bg-color); - color: var(--text-color); - min-height: 100vh; - transition: background-color 0.3s ease; + max-width: 100vw; + overflow-x: hidden; + margin: 0; + padding: 0; + font-family: "Inter", sans-serif; + background: var(--bg-color); + color: var(--text-color); + -webkit-tap-highlight-color: transparent; } -/* Container */ .container { - width: 100%; - max-width: min(600px, 90%); - margin: 0 auto; - padding: 16px; - min-height: 100vh; - display: flex; - flex-direction: column; - justify-content: space-between; - box-sizing: border-box; -} - -/* Header section */ + width: 100%; + max-width: min(600px, 90%); + margin: 0 auto; + padding: 16px; + min-height: 100vh; + display: flex; + flex-direction: column; +} + .header { - display: flex; - flex-direction: column; - align-items: center; - text-align: center; - gap: 8px; - margin-bottom: 24px; + display: flex; + flex-direction: column; + align-items: center; + text-align: center; + gap: 8px; + margin-bottom: 24px; } .logo-container { - position: relative; - width: 100%; - display: flex; - align-items: center; - justify-content: center; - margin-bottom: 16px; + position: relative; + width: 100%; + display: flex; + align-items: center; + justify-content: center; + margin-bottom: 16px; } .web3auth-logo { - width: min(180px, 40%); - height: auto; - margin: 0 auto; - filter: drop-shadow(0 2px 4px var(--box-shadow)); + width: min(180px, 40%); + height: auto; + margin: 0 auto; + filter: drop-shadow(0 2px 4px var(--box-shadow)); } .theme-toggle { - position: absolute; - right: 0; - top: 50%; - transform: translateY(-50%); - padding: 8px; - border-radius: 50%; - background: var(--card-bg); - border: 1px solid var(--border-color); - cursor: pointer; - display: flex; - align-items: center; - justify-content: center; - transition: all 0.3s ease; + position: absolute; + right: 0; + top: 50%; + transform: translateY(-50%); + padding: 8px; + border-radius: 50%; + background: var(--card-bg); + border: 1px solid var(--border-color); + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + transition: all 0.3s ease; } .theme-toggle:hover { - background-color: var(--hover-bg); + background-color: var(--hover-bg); } .theme-toggle svg { - width: 20px; - height: 20px; - color: var(--text-color); + width: 20px; + height: 20px; + color: var(--text-color); } -/* Title and description */ .title { - font-size: clamp(1.5rem, 4vw, 2rem); - font-weight: 800; - margin: 0; - letter-spacing: -0.5px; - background: linear-gradient(to right, #66D4F6, #4D92FF, #BB65FF); - -webkit-background-clip: text; - background-clip: text; - -webkit-text-fill-color: transparent; + font-size: clamp(1.5rem, 4vw, 2rem); + font-weight: 800; + margin: 0; + letter-spacing: -0.5px; + background: var(--title-gradient); + -webkit-background-clip: text; + background-clip: text; + -webkit-text-fill-color: transparent; } .description { - font-size: clamp(0.9rem, 3vw, 1.1rem); - font-weight: 500; - line-height: 1.5; - margin: 8px 0 16px; - text-align: center; - color: var(--text-color); - opacity: 0.9; - max-width: 500px; - padding: 0 16px; -} - -/* Grid layout */ + font-size: clamp(0.9rem, 3vw, 1.1rem); + font-weight: 500; + line-height: 1.5; + margin: 8px 0 16px; + text-align: center; + color: var(--text-color); + opacity: 0.9; + max-width: 500px; + padding: 0 16px; +} + .grid { - display: flex; - flex-direction: column; - gap: 12px; - margin: 16px 0; -} - -/* Info boxes */ -.user-info-box, .info-box { - padding: 16px; - margin: 0; - border: 1px solid var(--border-color); - border-radius: 12px; - background: var(--card-bg); - box-shadow: 0 4px 12px var(--box-shadow); - width: 100%; - cursor: pointer; - transition: all 0.3s ease; - box-sizing: border-box; + display: flex; + flex-direction: column; + gap: 12px; + margin: 16px 0; + flex: 1; +} + +.chain-selector { + position: relative; + width: 100%; + margin-bottom: 16px; +} + +.chain-selector-button { + width: 100%; + padding: 12px; + background: var(--card-bg); + border: 1px solid var(--border-color); + border-radius: 12px; + color: var(--text-color); + font-weight: 600; + display: flex; + justify-content: space-between; + align-items: center; + cursor: pointer; + transition: all 0.3s ease; +} + +.chain-dropdown { + position: absolute; + top: 100%; + left: 0; + right: 0; + background: var(--card-bg); + border: 1px solid var(--border-color); + border-radius: 12px; + margin-top: 4px; + overflow: hidden; + z-index: 10; + box-shadow: 0 4px 12px var(--box-shadow); +} + +.chain-option { + width: 100%; + padding: 12px; + background: none; + border: none; + color: var(--text-color); + cursor: pointer; + text-align: left; + transition: background-color 0.3s ease; +} + +.chain-option:hover { + background-color: var(--hover-bg); +} + +.chain-option.selected { + background-color: var(--hover-bg); + font-weight: 600; +} + +.info-box, +.user-info-box { + padding: 16px; + margin: 0; + border: 1px solid var(--border-color); + border-radius: 12px; + background: var(--card-bg); + box-shadow: 0 4px 12px var(--box-shadow); + transition: all 0.3s ease; } .user-info-box { - display: flex; - align-items: center; - justify-content: flex-start; - gap: 15px; - flex-wrap: wrap; + display: flex; + align-items: center; + gap: 15px; + flex-wrap: wrap; } -.info-box:hover { - background-color: var(--hover-bg); - border-color: var(--text-color); - transform: translateY(-2px); +.user-avatar { + width: 50px; + height: 50px; + border-radius: 50%; + object-fit: cover; } -/* User info */ .user-info { - display: flex; - flex-direction: column; - gap: 8px; + flex: 1; + min-width: 200px; + display: flex; + flex-direction: column; + gap: 8px; } .user-info p { - margin: 0; - display: flex; - align-items: center; - gap: 8px; -} - -.user-info strong { - color: var(--text-color); + margin: 0; + display: flex; + align-items: center; + gap: 8px; } .id-with-logo { - display: flex; - align-items: center; - gap: 8px; + display: flex; + align-items: center; + gap: 8px; } .telegram-logo { - width: 20px; - height: 20px; + width: 20px; + height: 20px; } -.user-avatar { - width: 50px; - height: 50px; - border-radius: 50%; - object-fit: cover; +.info-box-content { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 10px; +} + +.network-info, +.balance-info { + font-size: 0.9rem; + margin-bottom: 12px; + padding: 8px; + background: var(--hover-bg); + border-radius: 8px; + display: flex; + gap: 8px; + align-items: center; } -/* Info box content */ -.info-box-content { - display: flex; - align-items: flex-start; - justify-content: space-between; - gap: 10px; - width: 100%; +.ellipsed-text { + width: 100%; + word-wrap: break-word; + word-break: break-all; + font-family: monospace; + font-size: clamp(0.75rem, 2.5vw, 0.9rem); } -.info-box-content p { - margin: 0; - flex: 1; - text-align: left; - min-width: 0; +.copyable-content-container { + position: relative; + width: 100%; } -.info-box-content strong { - display: block; - margin-bottom: 5px; +.copyable-content { + display: flex; + align-items: center; + gap: 8px; + padding: 8px; + border-radius: 8px; + transition: all 0.2s ease; } -.ellipsed-text { - display: block; - width: 100%; - word-wrap: break-word; - word-break: break-all; - font-family: monospace; - font-size: clamp(0.75rem, 2.5vw, 0.9rem); - text-align: left; +.copyable-content.long-pressing { + background: var(--hover-bg); + transform: scale(0.98); +} + +.copy-button { + padding: 8px; + background: transparent; + border: none; + cursor: pointer; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + transition: all 0.2s ease; } -/* Copy icon */ .copy-icon { - color: var(--text-color); - opacity: 0.6; - transition: all 0.2s ease; - flex-shrink: 0; - margin-top: 4px; + color: var(--text-color); + opacity: 0.6; + transition: all 0.2s ease; } .copy-icon.success { - color: #4CAF50; - opacity: 1; + color: #4caf50; + opacity: 1; +} + +.copy-feedback { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: var(--card-bg); + display: flex; + align-items: center; + justify-content: center; + border-radius: 8px; + animation: fadeInOut 2s ease; +} + +.feedback-content { + display: flex; + align-items: center; + gap: 8px; + color: #4caf50; +} + +.touch-chain-switcher { + width: 100%; + overflow: hidden; + position: relative; + border-radius: 12px; + background: var(--card-bg); + border: 1px solid var(--border-color); + margin-bottom: 16px; +} + +.chain-buttons-container { + display: flex; + overflow-x: auto; + scroll-snap-type: x mandatory; + -webkit-overflow-scrolling: touch; + scrollbar-width: none; + padding: 16px; + gap: 12px; +} + +.chain-buttons-container::-webkit-scrollbar { + display: none; +} + +.chain-button { + flex: 1 0 auto; + padding: 12px 24px; + text-align: center; + border-radius: 8px; + background: transparent; + border: none; + color: var(--text-color); + cursor: pointer; + transition: all 0.3s ease; + scroll-snap-align: center; +} + +.chain-button.selected { + background: var(--hover-bg); + font-weight: 600; +} + +.network-label { + font-size: 0.8rem; + opacity: 0.7; + margin-top: 4px; +} + +.swipe-indicator { + display: flex; + justify-content: center; + gap: 8px; + padding: 8px; } -.info-box:hover .copy-icon { - opacity: 1; +.indicator-dot { + width: 6px; + height: 6px; + border-radius: 50%; + background: var(--border-color); + transition: all 0.3s ease; +} + +.indicator-dot.active { + background: var(--text-color); + transform: scale(1.2); +} + +.loading-placeholder { + height: 1em; + background: linear-gradient(90deg, var(--border-color) 0%, var(--hover-bg) 50%, var(--border-color) 100%); + background-size: 200% 100%; + animation: loading 2s infinite linear; + border-radius: 4px; +} + +.breathing-outline { + position: relative; + overflow: hidden; +} + +.breathing-outline::before { + content: ""; + position: absolute; + top: 0; + left: -100%; + width: 200%; + height: 100%; + background: linear-gradient( + 90deg, + transparent 0%, + rgba(102, 212, 246, 0.1) 25%, + rgba(77, 146, 255, 0.1) 50%, + rgba(187, 101, 255, 0.1) 75%, + transparent 100% + ); + animation: shimmer 2s infinite linear; } -/* Footer */ .footer { - display: flex; - justify-content: center; - padding: 16px 0; - margin-top: 16px; - position: relative; - border-top: 1px solid var(--border-color); + margin-top: auto; + padding: 16px 0; + border-top: 1px solid var(--border-color); + display: flex; + justify-content: center; } .learn-more-button { - padding: 12px 24px; - font-weight: 600; - text-align: center; - border-radius: 8px; - text-decoration: none; - transition: all 0.3s ease; - color: var(--text-color); - background: var(--card-bg); - border: 1px solid var(--border-color); - box-shadow: 0 2px 8px var(--box-shadow); + padding: 12px 24px; + font-weight: 600; + text-align: center; + border-radius: 8px; + text-decoration: none; + color: var(--text-color); + background: var(--card-bg); + border: 1px solid var(--border-color); + box-shadow: 0 2px 8px var(--box-shadow); + transition: all 0.3s ease; } .learn-more-button:hover { - background-color: var(--hover-bg); - border-color: var(--text-color); + background: var(--hover-bg); + border-color: var(--text-color); } -/* Responsive adjustments */ -@media (max-height: 700px) { - .container { - padding: 12px; - } - - .header { - gap: 6px; - margin-bottom: 16px; - } - - .logo-container { - margin-bottom: 12px; - } - - .grid { - gap: 8px; - } - - .user-info-box, .info-box { - padding: 12px; - } - - .footer { - padding: 12px 0; - margin-top: 12px; - } +@keyframes shimmer { + 0% { + transform: translateX(0); + } + 100% { + transform: translateX(50%); + } } -.breathing-outline { - border: 2px dashed rgba(0, 0, 0, 0.2); - border-radius: 8px; - animation: breathing 1.5s ease-in-out infinite; +@keyframes loading { + 0% { + background-position: 200% 0; + } + 100% { + background-position: -200% 0; + } +} + +@keyframes fadeInOut { + 0% { + opacity: 0; + } + 10% { + opacity: 1; + } + 90% { + opacity: 1; + } + 100% { + opacity: 0; + } } -@keyframes breathing { - 0%, 100% { - border-color: rgba(0, 0, 0, 0.2); +@media (max-height: 700px) { + .container { + padding: 12px; + } + + .header { + gap: 6px; + margin-bottom: 16px; + } + + .logo-container { + margin-bottom: 12px; + } + + .grid { + gap: 8px; } - 50% { - border-color: rgba(0, 0, 0, 0.5); + + .info-box, + .user-info-box { + padding: 12px; } + + .footer { + padding: 12px 0; + } +} + +.swipe-instructions { + font-size: 0.85rem; + font-weight: 500; + text-align: center; + color: var(--text-color); + opacity: 0.8; + margin-bottom: 8px; + background: var(--hover-bg); + padding: 6px 12px; + border-radius: 8px; + transition: opacity 0.3s ease; +} + +.swipe-instructions:hover { + opacity: 1; } diff --git a/single-factor-auth-web/sfa-web-ton-telegram-example/src/App.tsx b/single-factor-auth-web/sfa-web-ton-telegram-example/src/App.tsx index ff226aad..4f627192 100644 --- a/single-factor-auth-web/sfa-web-ton-telegram-example/src/App.tsx +++ b/single-factor-auth-web/sfa-web-ton-telegram-example/src/App.tsx @@ -1,84 +1,491 @@ -import { useEffect, useState } from "react"; +import { useEffect, useState, useCallback, useRef } from "react"; import { Web3Auth } from "@web3auth/single-factor-auth"; -import { CHAIN_NAMESPACES, WEB3AUTH_NETWORK } from "@web3auth/base"; -import { CommonPrivateKeyProvider } from "@web3auth/base-provider"; -import { getHttpEndpoint } from "@orbs-network/ton-access"; -import TonRPC from "./tonRpc"; +import { CHAIN_NAMESPACES, CustomChainConfig, WEB3AUTH_NETWORK } from "@web3auth/base"; +import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider"; +import TonRPC from "./RPC/tonRpc"; +import EthereumRPC from "./RPC/ethRPC-web3"; +import SolanaRPC from "./RPC/solanaRPC"; +import type { IRPC, RPCResponse } from "./RPC/IRPC"; import { useLaunchParams, User } from "@telegram-apps/sdk-react"; import { useTelegramMock } from "./hooks/useMockTelegramInitData"; -import { Sun, Moon, Copy, Check } from "lucide-react"; +import { Sun, Moon, Copy, Check, ChevronDown } from "lucide-react"; import TelegramLogo from "./assets/TelegramLogo.svg"; import web3AuthLogoLight from "./assets/web3AuthLogoLight.svg"; import web3AuthLogoDark from "./assets/web3AuthLogoDark.svg"; import "./App.css"; -const verifier = "w3a-telegram-demo"; -const clientId = "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ"; +const VERIFIER = "w3a-telegram-demo"; +const CLIENT_ID = "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ"; -// Gravatar fallback URL with a default image -const getGravatarUrl = (identifier: string) => { - const hash = identifier.toLowerCase(); // Use identifier directly for simplicity - return `https://www.gravatar.com/avatar/${hash}?d=mp`; +const generateGenericAvatarUrl = (name: string) => `https://ui-avatars.com/api/?name=${encodeURIComponent(name)}&background=random`; + +const CHAINS = { + ETH: { + name: "Ethereum", + networkName: "Sepolia", + config: { + chainNamespace: CHAIN_NAMESPACES.EIP155, + chainId: "0xaa36a7", + rpcTarget: "https://ethereum-sepolia-rpc.publicnode.com", + displayName: "Sepolia Testnet", + blockExplorerUrl: "https://sepolia.etherscan.io", + ticker: "ETH", + tickerName: "Ethereum", + } as CustomChainConfig, + }, + TON: { + name: "TON", + networkName: "Testnet", + }, + SOLANA: { + name: "Solana", + networkName: "Devnet", + }, +} as const; + +interface ChainData { + address: string | null; + signedMessage: string | null; + balance: string | null; + isLoadingAddress: boolean; + isLoadingMessage: boolean; + isLoadingBalance: boolean; + error?: string; + currentChain?: keyof typeof CHAINS; +} + +interface CachedChainData { + [chain: string]: { + address: string | null; + signedMessage: string | null; + balance: string | null; + } | null; +} + +const getFallbackAvatar = (user: User) => { + const name = `${user.firstName} ${user.lastName || ""}`.trim(); + return user.photoUrl || generateGenericAvatarUrl(name); +}; + +// CopyableContent Component +const CopyableContent = ({ content, type, isTouchDevice }: { content: string; type: "address" | "message"; isTouchDevice: boolean }) => { + const [isLongPressing, setIsLongPressing] = useState(false); + const [showCopiedFeedback, setShowCopiedFeedback] = useState(false); + const longPressTimer = useRef(); + const feedbackTimer = useRef(); + + const handleCopy = useCallback(async () => { + try { + await navigator.clipboard.writeText(content); + + if (isTouchDevice && "vibrate" in navigator) { + navigator.vibrate([50]); + } + + setShowCopiedFeedback(true); + + if (feedbackTimer.current) { + clearTimeout(feedbackTimer.current); + } + + feedbackTimer.current = setTimeout(() => { + setShowCopiedFeedback(false); + }, 2000); + } catch (err) { + console.error("Failed to copy:", err); + } + }, [content, isTouchDevice]); + + const handleTouchStart = useCallback(() => { + if (!isTouchDevice) return; + + setIsLongPressing(true); + longPressTimer.current = setTimeout(() => { + handleCopy(); + }, 500); + }, [isTouchDevice, handleCopy]); + + const handleTouchEnd = useCallback(() => { + if (longPressTimer.current) { + clearTimeout(longPressTimer.current); + } + setIsLongPressing(false); + }, []); + + useEffect(() => { + return () => { + if (longPressTimer.current) clearTimeout(longPressTimer.current); + if (feedbackTimer.current) clearTimeout(feedbackTimer.current); + }; + }, []); + + return ( +
+
+
+ {content} +
+ + + + {showCopiedFeedback && ( +
+
+ + Copied! +
+
+ )} +
+
+ ); +}; + +// Chain Switcher Component +const ChainSwitcher = ({ + selectedChain, + onChainSelect, + isLoading, +}: { + selectedChain: keyof typeof CHAINS; + onChainSelect: (chain: keyof typeof CHAINS) => void; + isLoading: boolean; +}) => { + const { platform } = useLaunchParams() || {}; + const isTouchDevice = ["android", "android_x", "ios", "weba"].includes(platform || ""); + + return isTouchDevice ? ( + + ) : ( + + ); +}; + +// Touch-optimized Chain Switcher +const TouchChainSwitcher = ({ + selectedChain, + onChainSelect, + isLoading, +}: { + selectedChain: keyof typeof CHAINS; + onChainSelect: (chain: keyof typeof CHAINS) => void; + isLoading: boolean; +}) => { + const containerRef = useRef(null); + const [touchStart, setTouchStart] = useState(0); + const [touchEnd, setTouchEnd] = useState(0); + const minSwipeDistance = 50; + + const handleTouchStart = (e: React.TouchEvent) => { + setTouchStart(e.touches[0].clientX); + }; + + const handleTouchMove = (e: React.TouchEvent) => { + setTouchEnd(e.touches[0].clientX); + }; + + const handleTouchEnd = () => { + const distance = touchStart - touchEnd; + const isLeftSwipe = distance > minSwipeDistance; + const isRightSwipe = distance < -minSwipeDistance; + + const chains = Object.keys(CHAINS); + const currentIndex = chains.indexOf(selectedChain); + + if (isLeftSwipe && currentIndex < chains.length - 1) { + handleChainChange(chains[currentIndex + 1]); + } else if (isRightSwipe && currentIndex > 0) { + handleChainChange(chains[currentIndex - 1]); + } + }; + + const handleChainChange = (chain: string) => { + if ("vibrate" in navigator) { + navigator.vibrate(50); + } + if (!isLoading) { + onChainSelect(chain as keyof typeof CHAINS); + } + }; + + return ( +
+

Swipe to switch chains

+
+ {Object.entries(CHAINS).map(([key, value]) => ( +
handleChainChange(key)} className={`chain-button ${selectedChain === key ? "selected" : ""}`}> + {value.name} +
{value.networkName}
+
+ ))} +
+
+ {Object.keys(CHAINS).map((key) => ( +
+ ))} +
+
+ ); +}; + +// Desktop Chain Switcher +const DesktopChainSwitcher = ({ + selectedChain, + onChainSelect, + isLoading, +}: { + selectedChain: keyof typeof CHAINS; + onChainSelect: (chain: keyof typeof CHAINS) => void; + isLoading: boolean; +}) => { + const [isOpen, setIsOpen] = useState(false); + + const handleSelect = (chain: keyof typeof CHAINS) => { + if (!isLoading) { + onChainSelect(chain); + setIsOpen(false); + } + }; + + return ( +
+

Select another chain

+ + + {isOpen && ( +
+ {Object.entries(CHAINS).map(([key, value]) => ( + + ))} +
+ )} +
+ ); +}; + +// InfoBox Component with Network & Balance +const InfoBox = ({ + chainData, + selectedChain, + isTouchDevice, + type, +}: { + chainData: ChainData; + selectedChain: keyof typeof CHAINS; + isTouchDevice: boolean; + type: "address" | "message"; +}) => { + const content = type === "address" ? chainData.address : chainData.signedMessage; + const isLoading = type === "address" ? chainData.isLoadingAddress : chainData.isLoadingMessage; + const label = type === "address" ? `${CHAINS[selectedChain].name} Account` : "Signed Message"; + + return ( +
+
+ Network: {CHAINS[selectedChain].networkName} +
+ + {type === "address" && ( +
+ Balance: + {chainData.isLoadingBalance ? ( +
+ ) : ( + + {chainData.balance || "0"} {CHAINS[selectedChain].name} + + )} +
+ )} + +
+
+ {label}: + {isLoading ? ( +
+ ) : ( + content && + )} +
+
+
+ ); }; function App() { + const [selectedChain, setSelectedChain] = useState("ETH"); const [web3authSfa, setWeb3authSfa] = useState(null); const [web3AuthInitialized, setWeb3AuthInitialized] = useState(false); const [userData, setUserData] = useState(null); - const [tonAccountAddress, setTonAccountAddress] = useState(null); - const [signedMessage, setSignedMessage] = useState(null); const [isDarkMode, setIsDarkMode] = useState(false); - const [copiedStates, setCopiedStates] = useState<{ [key: string]: boolean }>({ - account: false, - message: false, + const [chainData, setChainData] = useState({ + address: null, + signedMessage: null, + balance: null, + isLoadingAddress: true, + isLoadingMessage: true, + isLoadingBalance: true, + error: undefined, + currentChain: "ETH", }); + const [chainDataCache, setChainDataCache] = useState({}); - const { initDataRaw, initData } = useLaunchParams() || {}; + const { platform, initDataRaw, initData } = useLaunchParams() || {}; + const isTouchDevice = ["android", "android_x", "ios", "weba"].includes(platform || ""); useTelegramMock(); - const toggleDarkMode = () => { - setIsDarkMode(!isDarkMode); - }; - + // Load cache from localStorage on mount useEffect(() => { - if (isDarkMode) { - document.documentElement.classList.add("dark-mode"); - document.body.classList.add("dark-mode"); + const storageKey = getStorageKey(userData?.id?.toString()); + const cachedData = localStorage.getItem(storageKey); + if (cachedData) { + try { + const parsed = JSON.parse(cachedData); + console.log(`[LocalStorage] Loaded cache for key: ${storageKey}`, parsed); + setChainDataCache(parsed); + } catch (error) { + console.error(`[LocalStorage] Error parsing data for key: ${storageKey}`, error); + } } else { - document.documentElement.classList.remove("dark-mode"); - document.body.classList.remove("dark-mode"); + console.log(`[LocalStorage] No cache found for key: ${storageKey}`); } - }, [isDarkMode]); + }, [userData?.id]); + // Save cache to localStorage when it changes useEffect(() => { - const initializeWeb3Auth = async () => { + if (Object.keys(chainDataCache).length > 0) { + const storageKey = getStorageKey(userData?.id?.toString()); + console.log(`[LocalStorage] Saving cache for key: ${storageKey}`, chainDataCache); + localStorage.setItem(storageKey, JSON.stringify(chainDataCache)); + } + }, [chainDataCache, userData?.id]); + + const toggleDarkMode = useCallback(() => { + setIsDarkMode((prev) => !prev); + }, []); + + const getIdTokenFromServer = useCallback(async (initDataRaw: string, photoUrl?: string) => { + const isMocked = !!sessionStorage.getItem("____mocked"); + const response = await fetch(`${import.meta.env.VITE_SERVER_URL}/auth/telegram`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ initDataRaw, isMocked, photoUrl }), + }); + const data = await response.json(); + return data.token; + }, []); + + const getStorageKey = (telegramId: string | null | undefined): string => { + return `chainDataCache_${telegramId || "default"}`; + }; + + const getChainData = useCallback( + async (forceRefresh = false) => { try { - const testnetRpc = await getHttpEndpoint({ - network: "testnet", - protocol: "json-rpc", + console.log(`[getChainData] Invoked for chain: ${selectedChain}, forceRefresh: ${forceRefresh}`); + let rpc: IRPC; + + switch (selectedChain) { + case "TON": + rpc = await TonRPC.getInstance(web3authSfa.provider); + break; + case "ETH": + rpc = EthereumRPC.getInstance(web3authSfa.provider); + break; + case "SOLANA": + rpc = await SolanaRPC.getInstance(web3authSfa.provider); + break; + default: + throw new Error(`Unsupported chain: ${selectedChain}`); + } + + const [addressResponse, messageResponse, balanceResponse] = await Promise.all([ + rpc.getAccounts(), + rpc.signMessage(`Hello from ${selectedChain}`), + rpc.getBalance(), + ]); + + setChainData({ + address: addressResponse.data || null, + signedMessage: messageResponse.data || null, + balance: balanceResponse.data || null, + isLoadingAddress: false, + isLoadingMessage: false, + isLoadingBalance: false, }); - const chainConfig = { - chainNamespace: CHAIN_NAMESPACES.OTHER, - chainId: "testnet", - rpcTarget: testnetRpc, - displayName: "TON Testnet", - ticker: "TON", - tickerName: "Toncoin", - }; + setChainDataCache((prev) => ({ + ...prev, + [selectedChain]: { + address: addressResponse.data, + signedMessage: messageResponse.data, + balance: balanceResponse.data, + }, + })); + } catch (error) { + console.error(`[getChainData] Error fetching data for chain ${selectedChain}:`, error); + setChainData((prev) => ({ + ...prev, + error: error.message || "An error occurred", + isLoadingAddress: false, + isLoadingMessage: false, + isLoadingBalance: false, + })); + } + }, + [selectedChain, web3authSfa, setChainDataCache] + ); - const privateKeyProvider = new CommonPrivateKeyProvider({ config: { chainConfig } }); + useEffect(() => { + const initializeWeb3Auth = async () => { + try { + const privateKeyProvider = new EthereumPrivateKeyProvider({ + config: { chainConfig: CHAINS.ETH.config }, + }); - const web3authInstance = new Web3Auth({ - clientId, + const web3auth = new Web3Auth({ + clientId: CLIENT_ID, web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET, usePnPKey: false, privateKeyProvider, }); - setWeb3authSfa(web3authInstance); - await web3authInstance.init(); + setWeb3authSfa(web3auth); + await web3auth.init(); setWeb3AuthInitialized(true); } catch (error) { console.error("Error initializing Web3Auth:", error); @@ -88,13 +495,6 @@ function App() { initializeWeb3Auth(); }, []); - // Set user data directly from initData if available - useEffect(() => { - if (initData && initData.user) { - setUserData(initData.user); - } - }, [initData]); - useEffect(() => { const connectWeb3Auth = async () => { if (web3authSfa && web3AuthInitialized && initDataRaw) { @@ -103,65 +503,85 @@ function App() { await web3authSfa.logout(); } - const idToken = await getIdTokenFromServer(initDataRaw, initData?.user?.photoUrl); - if (!idToken) return; - - await web3authSfa.connect({ - verifier, - verifierId: initData?.user?.id.toString(), - idToken: idToken, - }); - - // Set TON account address and signed message after connecting - const tonRpc = new TonRPC(web3authSfa.provider); - const tonAddress = await tonRpc.getAccounts(); - setTonAccountAddress(tonAddress); + if (web3authSfa.status === "ready") { + const idToken = await getIdTokenFromServer(initDataRaw, initData?.user?.photoUrl); + await web3authSfa.connect({ + verifier: VERIFIER, + verifierId: initData?.user?.id?.toString() || "", + idToken, + }); + } - const messageToSign = "Hello, TON!"; - const signedMsg = await tonRpc.signMessage(messageToSign); - setSignedMessage(signedMsg); + if (web3authSfa.status === "connected") { + if (chainDataCache[selectedChain]) { + setChainData({ + ...chainDataCache[selectedChain]!, + isLoadingAddress: false, + isLoadingMessage: false, + isLoadingBalance: false, + error: undefined, + }); + } else { + await getChainData(false); + } + } } catch (error) { console.error("Error during Web3Auth connection:", error); } } }; - if (web3AuthInitialized && initDataRaw) { - connectWeb3Auth(); - } - }, [initDataRaw, web3authSfa, web3AuthInitialized, initData?.user?.photoUrl]); + connectWeb3Auth(); + }, [initDataRaw, web3authSfa, web3AuthInitialized, getIdTokenFromServer, getChainData, chainDataCache, selectedChain, initData?.user]); - const getIdTokenFromServer = async (initDataRaw: string, photoUrl: string | undefined) => { - const isMocked = !!sessionStorage.getItem("____mocked"); - const response = await fetch(`${import.meta.env.VITE_SERVER_URL}/auth/telegram`, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ initDataRaw, isMocked, photoUrl }), - }); - const data = await response.json(); - return data.token; - }; + useEffect(() => { + document.documentElement.classList.toggle("dark-mode", isDarkMode); + document.body.classList.toggle("dark-mode", isDarkMode); + }, [isDarkMode]); - const copyToClipboard = async (text: string, type: "account" | "message") => { - try { - await navigator.clipboard.writeText(text); - setCopiedStates((prev) => ({ - ...prev, - [type]: true, - })); - - setTimeout(() => { - setCopiedStates((prev) => ({ - ...prev, - [type]: false, - })); - }, 2000); - } catch (err) { - console.error("Failed to copy text:", err); + useEffect(() => { + if (initData?.user) { + setUserData(initData.user); } - }; + }, [initData]); + + const switchChain = useCallback( + async (chain: keyof typeof CHAINS) => { + console.log(`[switchChain] Switching to chain: ${chain}`); + // Immediately set loading state and clear current data + setChainData({ + address: null, + signedMessage: null, + balance: null, + isLoadingAddress: true, + isLoadingMessage: true, + isLoadingBalance: true, + error: undefined, + }); + + // Update selected chain after clearing data + setSelectedChain(chain); + + // Check cache immediately + if (chainDataCache[chain]) { + console.log(`[switchChain] Using cached data for chain: ${chain}`); + setChainData({ + ...chainDataCache[chain]!, + isLoadingAddress: false, + isLoadingMessage: false, + isLoadingBalance: false, + error: undefined, + }); + return; + } else { + console.log(`[switchChain] No cache found for chain: ${chain}, fetching new data`); + if (web3authSfa && web3AuthInitialized) { + await getChainData(true); // Force refresh for new chain + } + } + }, + [web3authSfa, web3AuthInitialized, getChainData, chainDataCache] + ); return (
@@ -181,56 +601,49 @@ function App() {
-
+ + +
{userData ? ( <> - User avatar + User avatar { + const target = e.target as HTMLImageElement; + target.src = generateGenericAvatarUrl("User"); + }} + />

- ID: {userData?.id} + ID: {userData.id}

Telegram Logo

- Username: {userData?.username} + Username: {userData.username}

- Name: {`${userData?.firstName} ${userData?.lastName || ""}`} + Name: {userData.firstName} {userData.lastName || ""}

) : ( -

Loading user info...

+
+
+
)}
-
tonAccountAddress && copyToClipboard(tonAccountAddress, "account")} - > -
-

- TON Account: - {tonAccountAddress || "Loading..."} -

- {tonAccountAddress && - (copiedStates.account ? : )} -
-
+ -
signedMessage && copyToClipboard(signedMessage, "message")} - > -
-

- Signed Message: - {signedMessage || "Loading..."} -

- {signedMessage && (copiedStates.message ? : )} -
-
+