From 29567bcc01bf7bfac406957c7f69444474c2e722 Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Sun, 28 Apr 2024 12:22:25 +0800 Subject: [PATCH 01/11] updated --- packages/types/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/types/README.md b/packages/types/README.md index 4f45a25..c4887a7 100644 --- a/packages/types/README.md +++ b/packages/types/README.md @@ -11,12 +11,12 @@ npm install @multiplechain/types ## Usage You can import all of the types at once: -```javascript +```typescript import type * as types from '@multiplechain/types'; ``` Or you import the types one by one: -```javascript +```typescript import type { // Providers ProviderInterface, From 04a669ecb434d2ba30de13eb1cbc5a6d544ee7af Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Sun, 28 Apr 2024 15:38:48 +0800 Subject: [PATCH 02/11] updated --- packages/networks/boilerplate/index.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/networks/boilerplate/index.html b/packages/networks/boilerplate/index.html index 7704205..37b3b80 100644 --- a/packages/networks/boilerplate/index.html +++ b/packages/networks/boilerplate/index.html @@ -113,10 +113,12 @@ border-radius: 10px; padding: 20px; box-shadow: 0 8px 30px rgba(74,58,150, .2); - max-width: 400px; + max-width: 450px; width: 100%; box-sizing: border-box; font-family: Arial, Helvetica, sans-serif; + max-height: 400px; + overflow-y: auto; } .info { @@ -129,6 +131,12 @@ color: #000; } + .info span img { + width: 20px; + height: 20px; + margin-left: 10px; + } + .action-btn { width: 100%; padding: 10px; From 1ae7f506b57cab329861dbe003f1faf82538710e Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Sun, 28 Apr 2024 17:09:07 +0800 Subject: [PATCH 03/11] updated --- packages/networks/boilerplate/index.html | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/networks/boilerplate/index.html b/packages/networks/boilerplate/index.html index 37b3b80..236da6d 100644 --- a/packages/networks/boilerplate/index.html +++ b/packages/networks/boilerplate/index.html @@ -10,8 +10,8 @@ .wallet-list-wrapper { position: absolute; top: 50%; - left: 50%; - transform: translate(-50%, -50%); + left: 20%; + transform: translate(0, -50%); background: #fff; border-radius: 10px; padding: 20px; @@ -108,7 +108,7 @@ position: absolute; top: 50%; left: 50%; - transform: translate(-50%, -50%); + transform: translate(0, -50%); background: #fff; border-radius: 10px; padding: 20px; @@ -234,7 +234,6 @@ }) document.querySelector('.methods').style.display = 'block' - document.querySelector('.wallet-list-wrapper').style.display = 'none' const sender = await wallet.getAddress() document.querySelector('.adapter-id').innerText = wallet.getId() @@ -246,6 +245,7 @@ document.querySelector('.chain-id').innerText = await wallet.getChainId() document.querySelector('.connected-address').innerText = sender + document.querySelector('.action-result .sign-message').innerText = '' document.querySelector('.action-btn.sign-message').onclick = async () => { const result = await wallet.signMessage('Hello World') document.querySelector('.action-result .sign-message').innerText = result @@ -254,6 +254,7 @@ const receiver = '0xbBa4d06D1cEf94b35aDeCfDa893523907fdD36DE'; const tokenAddress = '0x4294cb0dD25dC9140B5127f247cBd47Eeb673431'; + document.querySelector('.action-result .send-coin').innerText = '' document.querySelector('.action-btn.send-coin').onclick = async () => { const coin = new Boilerplate.assets.Coin(); const signer = await coin.transfer(sender, receiver, 0.00001) @@ -261,6 +262,7 @@ document.querySelector('.action-result .send-coin').innerText = result } + document.querySelector('.action-result .send-token').innerText = '' document.querySelector('.action-btn.send-token').onclick = async () => { const token = new Boilerplate.assets.Token(tokenAddress); const signer = await token.transfer(sender, receiver, 0.1) @@ -310,6 +312,7 @@ } const container = document.querySelector('.wallet-list-container') + container.innerHTML = '' let adapters = Boilerplate.browser.adapters @@ -342,7 +345,6 @@ Object.values(adapters).forEach(adapter => { container.innerHTML += adapterTemplate(adapter) }) - \ No newline at end of file From 4bf88f4af52acddd4ed651003938ec2c2d80b281 Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Sun, 28 Apr 2024 17:09:47 +0800 Subject: [PATCH 04/11] added web3modal adapter --- packages/networks/evm-chains/index.html | 28 +- packages/networks/evm-chains/package.json | 3 + packages/networks/evm-chains/pnpm-lock.yaml | 712 ++++++++++++++++++ .../src/browser/adapters/Web3Modal.ts | 172 +++++ .../evm-chains/src/browser/adapters/index.ts | 1 + .../networks/evm-chains/src/browser/index.ts | 9 +- .../evm-chains/src/services/Networks.ts | 10 + 7 files changed, 923 insertions(+), 12 deletions(-) create mode 100644 packages/networks/evm-chains/src/browser/adapters/Web3Modal.ts diff --git a/packages/networks/evm-chains/index.html b/packages/networks/evm-chains/index.html index a47fdee..28f5a06 100644 --- a/packages/networks/evm-chains/index.html +++ b/packages/networks/evm-chains/index.html @@ -10,8 +10,8 @@ .wallet-list-wrapper { position: absolute; top: 50%; - left: 50%; - transform: translate(-50%, -50%); + left: 20%; + transform: translate(0, -50%); background: #fff; border-radius: 10px; padding: 20px; @@ -108,15 +108,17 @@ position: absolute; top: 50%; left: 50%; - transform: translate(-50%, -50%); + transform: translate(0, -50%); background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 8px 30px rgba(74,58,150, .2); - max-width: 400px; + max-width: 450px; width: 100%; box-sizing: border-box; font-family: Arial, Helvetica, sans-serif; + max-height: 400px; + overflow-y: auto; } .info { @@ -129,6 +131,12 @@ color: #000; } + .info span img { + width: 20px; + height: 20px; + margin-left: 10px; + } + .action-btn { width: 100%; padding: 10px; @@ -233,11 +241,16 @@ const wallet = new EvmChains.browser.Wallet(adapter) const adapterProvider = await wallet.connect(provider, { - projectId: '113d9f5689edd84ff230c2a6d679c80c' + projectId: '113d9f5689edd84ff230c2a6d679c80c', + metadata: { + name: 'MultipleChain', + description: 'MultipleChain is a best standard', + url: 'http://localhost:3000/', + icons: [] + } }) document.querySelector('.methods').style.display = 'block' - document.querySelector('.wallet-list-wrapper').style.display = 'none' const sender = await wallet.getAddress() document.querySelector('.adapter-id').innerText = wallet.getId() @@ -249,6 +262,7 @@ document.querySelector('.chain-id').innerText = await wallet.getChainId() document.querySelector('.connected-address').innerText = sender + document.querySelector('.action-result .sign-message').innerText = '' document.querySelector('.action-btn.sign-message').onclick = async () => { const result = await wallet.signMessage('Hello World') document.querySelector('.action-result .sign-message').innerText = result @@ -257,6 +271,7 @@ const receiver = '0xbBa4d06D1cEf94b35aDeCfDa893523907fdD36DE'; const tokenAddress = '0x4294cb0dD25dC9140B5127f247cBd47Eeb673431'; + document.querySelector('.action-result .send-coin').innerText = '' document.querySelector('.action-btn.send-coin').onclick = async () => { const coin = new EvmChains.assets.Coin(); const signer = await coin.transfer(sender, receiver, 0.00001) @@ -264,6 +279,7 @@ document.querySelector('.action-result .send-coin').innerText = result } + document.querySelector('.action-result .send-token').innerText = '' document.querySelector('.action-btn.send-token').onclick = async () => { const token = new EvmChains.assets.Token(tokenAddress); const signer = await token.transfer(sender, receiver, 0.1) diff --git a/packages/networks/evm-chains/package.json b/packages/networks/evm-chains/package.json index ce369c5..88f746d 100644 --- a/packages/networks/evm-chains/package.json +++ b/packages/networks/evm-chains/package.json @@ -57,6 +57,9 @@ "@wagmi/chains": "^1.8.0", "@walletconnect/ethereum-provider": "^2.12.2", "@walletconnect/modal": "^2.6.2", + "@web3modal/core": "^4.1.11", + "@web3modal/ethers": "^4.1.11", + "@web3modal/scaffold-utils": "^4.1.11", "ethers": "^6.11.1" } } \ No newline at end of file diff --git a/packages/networks/evm-chains/pnpm-lock.yaml b/packages/networks/evm-chains/pnpm-lock.yaml index 36b2436..ecb1cea 100644 --- a/packages/networks/evm-chains/pnpm-lock.yaml +++ b/packages/networks/evm-chains/pnpm-lock.yaml @@ -20,6 +20,15 @@ dependencies: '@walletconnect/modal': specifier: ^2.6.2 version: 2.6.2(react@18.2.0) + '@web3modal/core': + specifier: ^4.1.11 + version: 4.1.11(react@18.2.0) + '@web3modal/ethers': + specifier: ^4.1.11 + version: 4.1.11(ethers@6.11.1)(react@18.2.0) + '@web3modal/scaffold-utils': + specifier: ^4.1.11 + version: 4.1.11(react@18.2.0) ethers: specifier: ^6.11.1 version: 6.11.1 @@ -30,6 +39,54 @@ packages: resolution: {integrity: sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==} dev: false + /@coinbase/wallet-sdk@3.9.1: + resolution: {integrity: sha512-cGUE8wm1/cMI8irRMVOqbFWYcnNugqCtuy2lnnHfgloBg+GRLs9RsrkOUDMdv/StfUeeKhCDyYudsXXvcL1xIA==} + dependencies: + bn.js: 5.2.1 + buffer: 6.0.3 + clsx: 1.2.1 + eth-block-tracker: 7.1.0 + eth-json-rpc-filters: 6.0.1 + eventemitter3: 5.0.1 + keccak: 3.0.4 + preact: 10.20.2 + sha.js: 2.4.11 + transitivePeerDependencies: + - supports-color + dev: false + + /@ethereumjs/common@3.2.0: + resolution: {integrity: sha512-pksvzI0VyLgmuEF2FA/JR/4/y6hcPq8OUail3/AvycBaW1d5VSauOZzqGvJ3RTmR4MU35lWE8KseKOsEhrFRBA==} + dependencies: + '@ethereumjs/util': 8.1.0 + crc-32: 1.2.2 + dev: false + + /@ethereumjs/rlp@4.0.1: + resolution: {integrity: sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw==} + engines: {node: '>=14'} + hasBin: true + dev: false + + /@ethereumjs/tx@4.2.0: + resolution: {integrity: sha512-1nc6VO4jtFd172BbSnTnDQVr9IYBFl1y4xPzZdtkrkKIncBCkdbgfdRV+MiTkJYAtTxvV12GRZLqBFT1PNK6Yw==} + engines: {node: '>=14'} + dependencies: + '@ethereumjs/common': 3.2.0 + '@ethereumjs/rlp': 4.0.1 + '@ethereumjs/util': 8.1.0 + ethereum-cryptography: 2.1.3 + dev: false + + /@ethereumjs/util@8.1.0: + resolution: {integrity: sha512-zQ0IqbdX8FZ9aw11vP+dZkKDkS+kgIvQPHnSAXzP9pLu+Rfu3D3XEeLbicvoXJTYnhZiPmsZUxgdzXwNKxRPbA==} + engines: {node: '>=14'} + dependencies: + '@ethereumjs/rlp': 4.0.1 + ethereum-cryptography: 2.1.3 + micro-ftch: 0.3.1 + dev: false + /@lit-labs/ssr-dom-shim@1.2.0: resolution: {integrity: sha512-yWJKmpGE6lUURKAaIltoPIE/wrbY3TEkqQt+X0m+7fQNnAv0keydnYvbiJFP1PnMhizmIWRWOG5KLhYyc/xl+g==} dev: false @@ -40,6 +97,83 @@ packages: '@lit-labs/ssr-dom-shim': 1.2.0 dev: false + /@lit/reactive-element@2.0.4: + resolution: {integrity: sha512-GFn91inaUa2oHLak8awSIigYz0cU0Payr1rcFsrkf5OJ5eSPxElyZfKh0f2p9FsTiZWXQdWGJeXZICEfXXYSXQ==} + dependencies: + '@lit-labs/ssr-dom-shim': 1.2.0 + dev: false + + /@metamask/eth-json-rpc-provider@1.0.1: + resolution: {integrity: sha512-whiUMPlAOrVGmX8aKYVPvlKyG4CpQXiNNyt74vE1xb5sPvmx5oA7B/kOi/JdBvhGQq97U1/AVdXEdk2zkP8qyA==} + engines: {node: '>=14.0.0'} + dependencies: + '@metamask/json-rpc-engine': 7.3.3 + '@metamask/safe-event-emitter': 3.1.1 + '@metamask/utils': 5.0.2 + transitivePeerDependencies: + - supports-color + dev: false + + /@metamask/json-rpc-engine@7.3.3: + resolution: {integrity: sha512-dwZPq8wx9yV3IX2caLi9q9xZBw2XeIoYqdyihDDDpuHVCEiqadJLwqM3zy+uwf6F1QYQ65A8aOMQg1Uw7LMLNg==} + engines: {node: '>=16.0.0'} + dependencies: + '@metamask/rpc-errors': 6.2.1 + '@metamask/safe-event-emitter': 3.1.1 + '@metamask/utils': 8.4.0 + transitivePeerDependencies: + - supports-color + dev: false + + /@metamask/rpc-errors@6.2.1: + resolution: {integrity: sha512-VTgWkjWLzb0nupkFl1duQi9Mk8TGT9rsdnQg6DeRrYEFxtFOh0IF8nAwxM/4GWqDl6uIB06lqUBgUrAVWl62Bw==} + engines: {node: '>=16.0.0'} + dependencies: + '@metamask/utils': 8.4.0 + fast-safe-stringify: 2.1.1 + transitivePeerDependencies: + - supports-color + dev: false + + /@metamask/safe-event-emitter@2.0.0: + resolution: {integrity: sha512-/kSXhY692qiV1MXu6EeOZvg5nECLclxNXcKCxJ3cXQgYuRymRHpdx/t7JXfsK+JLjwA1e1c1/SBrlQYpusC29Q==} + dev: false + + /@metamask/safe-event-emitter@3.1.1: + resolution: {integrity: sha512-ihb3B0T/wJm1eUuArYP4lCTSEoZsClHhuWyfo/kMX3m/odpqNcPfsz5O2A3NT7dXCAgWPGDQGPqygCpgeniKMw==} + engines: {node: '>=12.0.0'} + dev: false + + /@metamask/utils@5.0.2: + resolution: {integrity: sha512-yfmE79bRQtnMzarnKfX7AEJBwFTxvTyw3nBQlu/5rmGXrjAeAMltoGxO62TFurxrQAFMNa/fEjIHNvungZp0+g==} + engines: {node: '>=14.0.0'} + dependencies: + '@ethereumjs/tx': 4.2.0 + '@types/debug': 4.1.12 + debug: 4.3.4 + semver: 7.6.0 + superstruct: 1.0.4 + transitivePeerDependencies: + - supports-color + dev: false + + /@metamask/utils@8.4.0: + resolution: {integrity: sha512-dbIc3C7alOe0agCuBHM1h71UaEaEqOk2W8rAtEn8QGz4haH2Qq7MoK6i7v2guzvkJVVh79c+QCzIqphC3KvrJg==} + engines: {node: '>=16.0.0'} + dependencies: + '@ethereumjs/tx': 4.2.0 + '@noble/hashes': 1.3.3 + '@scure/base': 1.1.5 + '@types/debug': 4.1.12 + debug: 4.3.4 + pony-cause: 2.1.11 + semver: 7.6.0 + superstruct: 1.0.4 + uuid: 9.0.1 + transitivePeerDependencies: + - supports-color + dev: false + /@motionone/animation@10.17.0: resolution: {integrity: sha512-ANfIN9+iq1kGgsZxs+Nz96uiNcPLGTXwfNo2Xz/fcJXniPYpaz/Uyrfa+7I5BPLxCP82sh7quVDudf1GABqHbg==} dependencies: @@ -417,6 +551,16 @@ packages: '@stablelib/wipe': 1.0.1 dev: false + /@types/debug@4.1.12: + resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==} + dependencies: + '@types/ms': 0.7.34 + dev: false + + /@types/ms@0.7.34: + resolution: {integrity: sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==} + dev: false + /@types/node@18.15.13: resolution: {integrity: sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==} dev: false @@ -440,6 +584,46 @@ packages: optional: true dev: false + /@walletconnect/core@2.11.1: + resolution: {integrity: sha512-T57Vd7YdbHPsy3tthBuwrhaZNafN0+PqjISFRNeJy/bsKdXxpJg2hGSARuOTpCO7V6VcaatqlaSMuG3DrnG5rA==} + dependencies: + '@walletconnect/heartbeat': 1.2.1 + '@walletconnect/jsonrpc-provider': 1.0.13 + '@walletconnect/jsonrpc-types': 1.0.3 + '@walletconnect/jsonrpc-utils': 1.0.8 + '@walletconnect/jsonrpc-ws-connection': 1.0.14 + '@walletconnect/keyvaluestorage': 1.1.1 + '@walletconnect/logger': 2.1.2 + '@walletconnect/relay-api': 1.0.10 + '@walletconnect/relay-auth': 1.0.4 + '@walletconnect/safe-json': 1.0.2 + '@walletconnect/time': 1.0.2 + '@walletconnect/types': 2.11.1 + '@walletconnect/utils': 2.11.1 + events: 3.3.0 + isomorphic-unfetch: 3.1.0 + lodash.isequal: 4.5.0 + uint8arrays: 3.1.1 + transitivePeerDependencies: + - '@azure/app-configuration' + - '@azure/cosmos' + - '@azure/data-tables' + - '@azure/identity' + - '@azure/keyvault-secrets' + - '@azure/storage-blob' + - '@capacitor/preferences' + - '@netlify/blobs' + - '@planetscale/database' + - '@react-native-async-storage/async-storage' + - '@upstash/redis' + - '@vercel/kv' + - bufferutil + - encoding + - ioredis + - uWebSockets.js + - utf-8-validate + dev: false + /@walletconnect/core@2.12.2: resolution: {integrity: sha512-7Adv/b3pp9F42BkvReaaM4KS8NEvlkS7AMtwO3uF/o6aRMKtcfTJq9/jgWdKJh4RP8pPRTRFjCw6XQ/RZtT4aQ==} dependencies: @@ -486,6 +670,41 @@ packages: tslib: 1.14.1 dev: false + /@walletconnect/ethereum-provider@2.11.1(react@18.2.0): + resolution: {integrity: sha512-UfQH0ho24aa2M1xYmanbJv2ggQPebKmQytp2j20QEvURJ2R0v7YKWZ+0PfwOs6o6cuGw6gGxy/0WQXQRZSAsfg==} + dependencies: + '@walletconnect/jsonrpc-http-connection': 1.0.7 + '@walletconnect/jsonrpc-provider': 1.0.13 + '@walletconnect/jsonrpc-types': 1.0.3 + '@walletconnect/jsonrpc-utils': 1.0.8 + '@walletconnect/modal': 2.6.2(react@18.2.0) + '@walletconnect/sign-client': 2.11.1 + '@walletconnect/types': 2.11.1 + '@walletconnect/universal-provider': 2.11.1 + '@walletconnect/utils': 2.11.1 + events: 3.3.0 + transitivePeerDependencies: + - '@azure/app-configuration' + - '@azure/cosmos' + - '@azure/data-tables' + - '@azure/identity' + - '@azure/keyvault-secrets' + - '@azure/storage-blob' + - '@capacitor/preferences' + - '@netlify/blobs' + - '@planetscale/database' + - '@react-native-async-storage/async-storage' + - '@types/react' + - '@upstash/redis' + - '@vercel/kv' + - bufferutil + - encoding + - ioredis + - react + - uWebSockets.js + - utf-8-validate + dev: false + /@walletconnect/ethereum-provider@2.12.2(react@18.2.0): resolution: {integrity: sha512-vBl2zCnNm2iPaomJdr5YT16cT7aa8cH2WFs6879XPngU5i7HXS3bU6TamhyhKKl13sdIfifmCkCC+RWn5GdPMw==} dependencies: @@ -670,6 +889,38 @@ packages: tslib: 1.14.1 dev: false + /@walletconnect/sign-client@2.11.1: + resolution: {integrity: sha512-s3oKSx6/F5X2WmkV1jfJImBFACf9Km5HpTb+n5q+mobJVpUQw/clvoVyIrNNppLhm1V1S/ylHXh0qCrDppDpCA==} + dependencies: + '@walletconnect/core': 2.11.1 + '@walletconnect/events': 1.0.1 + '@walletconnect/heartbeat': 1.2.1 + '@walletconnect/jsonrpc-utils': 1.0.8 + '@walletconnect/logger': 2.1.2 + '@walletconnect/time': 1.0.2 + '@walletconnect/types': 2.11.1 + '@walletconnect/utils': 2.11.1 + events: 3.3.0 + transitivePeerDependencies: + - '@azure/app-configuration' + - '@azure/cosmos' + - '@azure/data-tables' + - '@azure/identity' + - '@azure/keyvault-secrets' + - '@azure/storage-blob' + - '@capacitor/preferences' + - '@netlify/blobs' + - '@planetscale/database' + - '@react-native-async-storage/async-storage' + - '@upstash/redis' + - '@vercel/kv' + - bufferutil + - encoding + - ioredis + - uWebSockets.js + - utf-8-validate + dev: false + /@walletconnect/sign-client@2.12.2: resolution: {integrity: sha512-cM0ualXj6nVvLqS4BDNRk+ZWR+lubcsz/IHreH+3wYrQ2sV+C0fN6ctrd7MMGZss0C0qacWCx0pm62ZBuoKvqA==} dependencies: @@ -708,6 +959,32 @@ packages: tslib: 1.14.1 dev: false + /@walletconnect/types@2.11.1: + resolution: {integrity: sha512-UbdbX+d6MOK0AXKxt5imV3KvAcLVpZUHylaRDIP5ffwVylM/p4DHnKppil1Qq5N+IGDr3RsUwLGFkKjqsQYRKw==} + dependencies: + '@walletconnect/events': 1.0.1 + '@walletconnect/heartbeat': 1.2.1 + '@walletconnect/jsonrpc-types': 1.0.3 + '@walletconnect/keyvaluestorage': 1.1.1 + '@walletconnect/logger': 2.1.2 + events: 3.3.0 + transitivePeerDependencies: + - '@azure/app-configuration' + - '@azure/cosmos' + - '@azure/data-tables' + - '@azure/identity' + - '@azure/keyvault-secrets' + - '@azure/storage-blob' + - '@capacitor/preferences' + - '@netlify/blobs' + - '@planetscale/database' + - '@react-native-async-storage/async-storage' + - '@upstash/redis' + - '@vercel/kv' + - ioredis + - uWebSockets.js + dev: false + /@walletconnect/types@2.12.2: resolution: {integrity: sha512-9CmwTlPbrFTzayTL9q7xM7s3KTJkS6kYFtH2m1/fHFgALs6pIUjf1qAx1TF2E4tv7SEzLAIzU4NqgYUt2vWXTg==} dependencies: @@ -734,6 +1011,38 @@ packages: - uWebSockets.js dev: false + /@walletconnect/universal-provider@2.11.1: + resolution: {integrity: sha512-BJvPYByIfbBYF4x8mqDV79ebQX0tD54pp8itsqrHWn0qKZeJyIH8sQ69yY0GnbJrzoFS3ZLULdC0yDxWDeuRGw==} + dependencies: + '@walletconnect/jsonrpc-http-connection': 1.0.7 + '@walletconnect/jsonrpc-provider': 1.0.13 + '@walletconnect/jsonrpc-types': 1.0.3 + '@walletconnect/jsonrpc-utils': 1.0.8 + '@walletconnect/logger': 2.1.2 + '@walletconnect/sign-client': 2.11.1 + '@walletconnect/types': 2.11.1 + '@walletconnect/utils': 2.11.1 + events: 3.3.0 + transitivePeerDependencies: + - '@azure/app-configuration' + - '@azure/cosmos' + - '@azure/data-tables' + - '@azure/identity' + - '@azure/keyvault-secrets' + - '@azure/storage-blob' + - '@capacitor/preferences' + - '@netlify/blobs' + - '@planetscale/database' + - '@react-native-async-storage/async-storage' + - '@upstash/redis' + - '@vercel/kv' + - bufferutil + - encoding + - ioredis + - uWebSockets.js + - utf-8-validate + dev: false + /@walletconnect/universal-provider@2.12.2: resolution: {integrity: sha512-0k5ZgSkABopQLVhkiwl2gRGG7dAP4SWiI915pIlyN5sRvWV+qX1ALhWAmRcdv0TXWlKHDcDgPJw/q2sCSAHuMQ==} dependencies: @@ -766,6 +1075,40 @@ packages: - utf-8-validate dev: false + /@walletconnect/utils@2.11.1: + resolution: {integrity: sha512-wRFDHN86dZ05mCET1H3912odIeQa8j7cZKxl1FlWRpV2YsILj9HCYSX6Uq2brwO02Kv2vryke44G1r8XI/LViA==} + dependencies: + '@stablelib/chacha20poly1305': 1.0.1 + '@stablelib/hkdf': 1.0.1 + '@stablelib/random': 1.0.2 + '@stablelib/sha256': 1.0.1 + '@stablelib/x25519': 1.0.3 + '@walletconnect/relay-api': 1.0.10 + '@walletconnect/safe-json': 1.0.2 + '@walletconnect/time': 1.0.2 + '@walletconnect/types': 2.11.1 + '@walletconnect/window-getters': 1.0.1 + '@walletconnect/window-metadata': 1.0.1 + detect-browser: 5.3.0 + query-string: 7.1.3 + uint8arrays: 3.1.1 + transitivePeerDependencies: + - '@azure/app-configuration' + - '@azure/cosmos' + - '@azure/data-tables' + - '@azure/identity' + - '@azure/keyvault-secrets' + - '@azure/storage-blob' + - '@capacitor/preferences' + - '@netlify/blobs' + - '@planetscale/database' + - '@react-native-async-storage/async-storage' + - '@upstash/redis' + - '@vercel/kv' + - ioredis + - uWebSockets.js + dev: false + /@walletconnect/utils@2.12.2: resolution: {integrity: sha512-zf50HeS3SfoLv1N9GPl2IXTZ9TsXfet4usVAsZmX9P6/Xzq7d/7QakjVQCHH/Wk1O9XkcsfeoZoUhRxoMJ5uJw==} dependencies: @@ -813,6 +1156,160 @@ packages: tslib: 1.14.1 dev: false + /@web3modal/common@4.1.11: + resolution: {integrity: sha512-zcoaixcI3dLC/D0QlhpT8MNCd717O1/3r1AemC5/9Wbk2F+YKXkzJZHmWlXoTvlTw9DH07rJzs9YTPxFyn855w==} + dependencies: + bignumber.js: 9.1.2 + dayjs: 1.11.10 + dev: false + + /@web3modal/core@4.1.11(react@18.2.0): + resolution: {integrity: sha512-e475IIWywEtgH1CCB2Pl1C/wgPu0NzAvtTMOPSGNoHsw1ID2n6j/o4CURQb2HJjOoYQjTKKVkzXa44vFh2p9xw==} + dependencies: + '@web3modal/common': 4.1.11 + '@web3modal/wallet': 4.1.11 + valtio: 1.11.2(react@18.2.0) + transitivePeerDependencies: + - '@types/react' + - react + dev: false + + /@web3modal/ethers@4.1.11(ethers@6.11.1)(react@18.2.0): + resolution: {integrity: sha512-hW5iaC3wFyT9AnLx6Nk7CwTl4KTbPvJoyQIzTXpKXn+aEX9+uOj+/tGaUjqQsyAPyd/hIX2HITIrItIu/wQn4g==} + peerDependencies: + ethers: '>=6.0.0' + react: '>=17' + react-dom: '>=17' + vue: '>=3' + peerDependenciesMeta: + react: + optional: true + react-dom: + optional: true + vue: + optional: true + dependencies: + '@coinbase/wallet-sdk': 3.9.1 + '@walletconnect/ethereum-provider': 2.11.1(react@18.2.0) + '@web3modal/polyfills': 4.1.11 + '@web3modal/scaffold': 4.1.11(react@18.2.0) + '@web3modal/scaffold-react': 4.1.11(react@18.2.0) + '@web3modal/scaffold-utils': 4.1.11(react@18.2.0) + '@web3modal/scaffold-vue': 4.1.11(react@18.2.0) + '@web3modal/siwe': 4.1.11(react@18.2.0) + ethers: 6.11.1 + react: 18.2.0 + valtio: 1.11.2(react@18.2.0) + transitivePeerDependencies: + - '@azure/app-configuration' + - '@azure/cosmos' + - '@azure/data-tables' + - '@azure/identity' + - '@azure/keyvault-secrets' + - '@azure/storage-blob' + - '@capacitor/preferences' + - '@netlify/blobs' + - '@planetscale/database' + - '@react-native-async-storage/async-storage' + - '@types/react' + - '@upstash/redis' + - '@vercel/kv' + - bufferutil + - encoding + - ioredis + - supports-color + - uWebSockets.js + - utf-8-validate + dev: false + + /@web3modal/polyfills@4.1.11: + resolution: {integrity: sha512-+aMmjGrLCKLo4gVAdWgFdOX2ZjExciSLw/YlZ01wLO8Yj3bZbCZ7sjBc9xndHOVMK0QyUzBtpCOpYMJzi+59jg==} + dependencies: + buffer: 6.0.3 + dev: false + + /@web3modal/scaffold-react@4.1.11(react@18.2.0): + resolution: {integrity: sha512-vouJHj77ZNKvR/Uyb3Hfc2UFSA4ZrrHmA0vbioCbgIh+V1rYT5XcAZDEu4AAo1qJ5NBRU1pkClVwAmQuWGY43w==} + peerDependencies: + react: '>=17' + react-dom: '>=17' + peerDependenciesMeta: + react: + optional: true + react-dom: + optional: true + dependencies: + '@web3modal/scaffold': 4.1.11(react@18.2.0) + react: 18.2.0 + transitivePeerDependencies: + - '@types/react' + dev: false + + /@web3modal/scaffold-utils@4.1.11(react@18.2.0): + resolution: {integrity: sha512-nsS9yK5tp1N/VfecLLPc8H/dGJCzn0jElWjRS92VfGPhOSiEh5PIrPyCl9o6wUZsp4fH1YUsoSY2EFpPsuCWgw==} + dependencies: + '@web3modal/core': 4.1.11(react@18.2.0) + '@web3modal/polyfills': 4.1.11 + valtio: 1.11.2(react@18.2.0) + transitivePeerDependencies: + - '@types/react' + - react + dev: false + + /@web3modal/scaffold-vue@4.1.11(react@18.2.0): + resolution: {integrity: sha512-PmIfD2TlKkZZa6V0sqwDtZ7t62BEk5JjCHd380QaZwGTbPEwS99leTWLKBTaxAPShK2p7+aj2Txss63wIXLRFg==} + peerDependencies: + vue: '>=3' + peerDependenciesMeta: + vue: + optional: true + dependencies: + '@web3modal/scaffold': 4.1.11(react@18.2.0) + transitivePeerDependencies: + - '@types/react' + - react + dev: false + + /@web3modal/scaffold@4.1.11(react@18.2.0): + resolution: {integrity: sha512-n8bP3cJNQxV8OD3s8bSj8QDbZvjn8a1Ui81jo2a3rIxOUAlD/cKRM8ivmNxiUdBMae8GP5CLiWtkIptmSLw40Q==} + dependencies: + '@web3modal/common': 4.1.11 + '@web3modal/core': 4.1.11(react@18.2.0) + '@web3modal/siwe': 4.1.11(react@18.2.0) + '@web3modal/ui': 4.1.11 + '@web3modal/wallet': 4.1.11 + lit: 3.1.0 + transitivePeerDependencies: + - '@types/react' + - react + dev: false + + /@web3modal/siwe@4.1.11(react@18.2.0): + resolution: {integrity: sha512-gndcNA351mkAR0wUsO4dLS9CbpcFo+AQ2CUXF0Jx83DwaBStCVsX3yllfnYKh/gpVetF3B48mRUt9TTTJJ79dA==} + dependencies: + '@web3modal/core': 4.1.11(react@18.2.0) + '@web3modal/scaffold-utils': 4.1.11(react@18.2.0) + lit: 3.1.0 + valtio: 1.11.2(react@18.2.0) + transitivePeerDependencies: + - '@types/react' + - react + dev: false + + /@web3modal/ui@4.1.11: + resolution: {integrity: sha512-lentHZvUpNjVasvNI8/jrVPIAV1M5zJKZ4Q4AeYwUJdEtlRon1uq10MRylmvlZAjWb98U130uJy245Fz87Th/w==} + dependencies: + lit: 3.1.0 + qrcode: 1.5.3 + dev: false + + /@web3modal/wallet@4.1.11: + resolution: {integrity: sha512-6eJSpNcrBxufJFEQu9+ZOMUZxPqa8438RvfYKCU9nLXwoBtweo6ecpQw2yhXDlrfG+uJZhFabtPxROabn2M8Kg==} + dependencies: + '@web3modal/polyfills': 4.1.11 + zod: 3.22.4 + dev: false + /acorn@8.11.3: resolution: {integrity: sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==} engines: {node: '>=0.4.0'} @@ -843,6 +1340,12 @@ packages: picomatch: 2.3.1 dev: false + /async-mutex@0.2.6: + resolution: {integrity: sha512-Hs4R+4SPgamu6rSGW8C7cV9gaWUKEHykfzCCvIRuaVv636Ju10ZdeUbvb4TBEW0INuq2DHZqXbK4Nd3yG4RaRw==} + dependencies: + tslib: 2.4.0 + dev: false + /atomic-sleep@1.0.0: resolution: {integrity: sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==} engines: {node: '>=8.0.0'} @@ -855,6 +1358,10 @@ packages: possible-typed-array-names: 1.0.0 dev: false + /base64-js@1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + dev: false + /bignumber.js@9.1.2: resolution: {integrity: sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==} dev: false @@ -864,6 +1371,10 @@ packages: engines: {node: '>=8'} dev: false + /bn.js@5.2.1: + resolution: {integrity: sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==} + dev: false + /braces@3.0.2: resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} engines: {node: '>=8'} @@ -871,6 +1382,13 @@ packages: fill-range: 7.0.1 dev: false + /buffer@6.0.3: + resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + dev: false + /call-bind@1.0.7: resolution: {integrity: sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==} engines: {node: '>= 0.4'} @@ -925,6 +1443,11 @@ packages: wrap-ansi: 6.2.0 dev: false + /clsx@1.2.1: + resolution: {integrity: sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==} + engines: {node: '>=6'} + dev: false + /color-convert@2.0.1: resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} engines: {node: '>=7.0.0'} @@ -949,6 +1472,12 @@ packages: resolution: {integrity: sha512-L2rLOcK0wzWSfSDA33YR+PUHDG10a8px7rUHKWbGLP4YfbsMed2KFUw5fczvDPbT98DDe3LEzviswl810apTEw==} dev: false + /crc-32@1.2.2: + resolution: {integrity: sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==} + engines: {node: '>=0.8'} + hasBin: true + dev: false + /cross-fetch@3.1.8: resolution: {integrity: sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==} dependencies: @@ -975,6 +1504,22 @@ packages: optional: true dev: false + /dayjs@1.11.10: + resolution: {integrity: sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==} + dev: false + + /debug@4.3.4: + resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + dev: false + /decamelize@1.2.0: resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==} engines: {node: '>=0.10.0'} @@ -1051,6 +1596,43 @@ packages: engines: {node: '>= 0.4'} dev: false + /eth-block-tracker@7.1.0: + resolution: {integrity: sha512-8YdplnuE1IK4xfqpf4iU7oBxnOYAc35934o083G8ao+8WM8QQtt/mVlAY6yIAdY1eMeLqg4Z//PZjJGmWGPMRg==} + engines: {node: '>=14.0.0'} + dependencies: + '@metamask/eth-json-rpc-provider': 1.0.1 + '@metamask/safe-event-emitter': 3.1.1 + '@metamask/utils': 5.0.2 + json-rpc-random-id: 1.0.1 + pify: 3.0.0 + transitivePeerDependencies: + - supports-color + dev: false + + /eth-json-rpc-filters@6.0.1: + resolution: {integrity: sha512-ITJTvqoCw6OVMLs7pI8f4gG92n/St6x80ACtHodeS+IXmO0w+t1T5OOzfSt7KLSMLRkVUoexV7tztLgDxg+iig==} + engines: {node: '>=14.0.0'} + dependencies: + '@metamask/safe-event-emitter': 3.1.1 + async-mutex: 0.2.6 + eth-query: 2.1.2 + json-rpc-engine: 6.1.0 + pify: 5.0.0 + dev: false + + /eth-query@2.1.2: + resolution: {integrity: sha512-srES0ZcvwkR/wd5OQBRA1bIJMww1skfGS0s8wlwK3/oNP4+wnds60krvu5R1QbpRQjMmpG5OMIWro5s7gvDPsA==} + dependencies: + json-rpc-random-id: 1.0.1 + xtend: 4.0.2 + dev: false + + /eth-rpc-errors@4.0.3: + resolution: {integrity: sha512-Z3ymjopaoft7JDoxZcEb3pwdGh7yiYMhOwm2doUt6ASXlMavpNlK6Cre0+IMl2VSGyEU9rkiperQhp5iRxn5Pg==} + dependencies: + fast-safe-stringify: 2.1.1 + dev: false + /ethereum-cryptography@2.1.3: resolution: {integrity: sha512-BlwbIL7/P45W8FGW2r7LGuvoEZ+7PWsniMvQ4p5s2xCyw9tmaDlpfsN9HjAucbF+t/qpVHwZUisgfK24TCW8aA==} dependencies: @@ -1105,6 +1687,10 @@ packages: engines: {node: '>=6'} dev: false + /fast-safe-stringify@2.1.1: + resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} + dev: false + /fill-range@7.0.1: resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} engines: {node: '>=8'} @@ -1246,6 +1832,10 @@ packages: resolution: {integrity: sha512-8Sb3veuYCyrZL+VBt9LJfZjLUPWVvqn8tG28VqYNFCo43KHcKuq+b4EiXGeuaLAQWL2YmyDgMp2aSpH9JHsEQg==} dev: false + /ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + dev: false + /inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} dev: false @@ -1365,6 +1955,28 @@ packages: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} dev: false + /json-rpc-engine@6.1.0: + resolution: {integrity: sha512-NEdLrtrq1jUZyfjkr9OCz9EzCNhnRyWtt1PAnvnhwy6e8XETS0Dtc+ZNCO2gvuAoKsIn2+vCSowXTYE4CkgnAQ==} + engines: {node: '>=10.0.0'} + dependencies: + '@metamask/safe-event-emitter': 2.0.0 + eth-rpc-errors: 4.0.3 + dev: false + + /json-rpc-random-id@1.0.1: + resolution: {integrity: sha512-RJ9YYNCkhVDBuP4zN5BBtYAzEl03yq/jIIsyif0JY9qyJuQQZNeDK7anAPKKlyEtLSj2s8h6hNh2F8zO5q7ScA==} + dev: false + + /keccak@3.0.4: + resolution: {integrity: sha512-3vKuW0jV8J3XNTzvfyicFR5qvxrSAGl7KIhvgOu5cmWwM7tZRj3fMbj/pfIf4be7aznbc+prBWGjywox/g2Y6Q==} + engines: {node: '>=10.0.0'} + requiresBuild: true + dependencies: + node-addon-api: 2.0.2 + node-gyp-build: 4.8.0 + readable-stream: 3.6.2 + dev: false + /keyvaluestorage-interface@1.0.0: resolution: {integrity: sha512-8t6Q3TclQ4uZynJY9IGr2+SsIGwK9JHcO6ootkHCGA0CrQCRy+VkouYNO2xicET6b9al7QKzpebNow+gkpCL8g==} dev: false @@ -1403,12 +2015,26 @@ packages: lit-html: 2.8.0 dev: false + /lit-element@4.0.5: + resolution: {integrity: sha512-iTWskWZEtn9SyEf4aBG6rKT8GABZMrTWop1+jopsEOgEcugcXJGKuX5bEbkq9qfzY+XB4MAgCaSPwnNpdsNQ3Q==} + dependencies: + '@lit-labs/ssr-dom-shim': 1.2.0 + '@lit/reactive-element': 2.0.4 + lit-html: 3.1.3 + dev: false + /lit-html@2.8.0: resolution: {integrity: sha512-o9t+MQM3P4y7M7yNzqAyjp7z+mQGa4NS4CxiyLqFPyFWyc4O+nodLrkrxSaCTrla6M5YOLaT3RpbbqjszB5g3Q==} dependencies: '@types/trusted-types': 2.0.7 dev: false + /lit-html@3.1.3: + resolution: {integrity: sha512-FwIbqDD8O/8lM4vUZ4KvQZjPPNx7V1VhT7vmRB8RBAO0AU6wuTVdoXiu2CivVjEGdugvcbPNBLtPE1y0ifplHA==} + dependencies: + '@types/trusted-types': 2.0.7 + dev: false + /lit@2.8.0: resolution: {integrity: sha512-4Sc3OFX9QHOJaHbmTMk28SYgVxLN3ePDjg7hofEft2zWlehFL3LiAuapWc4U/kYwMYJSh2hTCPZ6/LIC7ii0MA==} dependencies: @@ -1417,6 +2043,14 @@ packages: lit-html: 2.8.0 dev: false + /lit@3.1.0: + resolution: {integrity: sha512-rzo/hmUqX8zmOdamDAeydfjsGXbbdtAFqMhmocnh2j9aDYqbu0fjXygjCa0T99Od9VQ/2itwaGrjZz/ZELVl7w==} + dependencies: + '@lit/reactive-element': 2.0.4 + lit-element: 4.0.5 + lit-html: 3.1.3 + dev: false + /locate-path@5.0.0: resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} engines: {node: '>=8'} @@ -1440,10 +2074,21 @@ packages: engines: {node: 14 || >=16.14} dev: false + /lru-cache@6.0.0: + resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} + engines: {node: '>=10'} + dependencies: + yallist: 4.0.0 + dev: false + /merge-stream@2.0.0: resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} dev: false + /micro-ftch@0.3.1: + resolution: {integrity: sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg==} + dev: false + /micromatch@4.0.5: resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} engines: {node: '>=8.6'} @@ -1488,6 +2133,10 @@ packages: engines: {node: '>=4'} dev: false + /ms@2.1.2: + resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + dev: false + /multiformats@9.9.0: resolution: {integrity: sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg==} dev: false @@ -1496,6 +2145,10 @@ packages: resolution: {integrity: sha512-lHwIAJbmLSjF9VDRm9GoVOy9AGp3aIvkjv+Kvz9h16QR3uSVYH78PNQUnT2U4X53mhlnV2M7wrhibQ3GHicDmg==} dev: false + /node-addon-api@2.0.2: + resolution: {integrity: sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==} + dev: false + /node-addon-api@7.1.0: resolution: {integrity: sha512-mNcltoe1R8o7STTegSOHdnJNN7s5EUvhoS7ShnTHDyOSd+8H+UdWODq6qSv67PjC8Zc5JRT8+oLAMCr0SIXw7g==} engines: {node: ^16 || ^18 || >= 20} @@ -1522,6 +2175,11 @@ packages: engines: {node: '>= 6.13.0'} dev: false + /node-gyp-build@4.8.0: + resolution: {integrity: sha512-u6fs2AEUljNho3EYTJNBfImO5QTo/J/1Etd+NVdCj7qWKUSN/bSLkZwhDv7I+w/MSC6qJ4cknepkAYykDdK8og==} + hasBin: true + dev: false + /normalize-path@3.0.0: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} @@ -1606,6 +2264,16 @@ packages: engines: {node: '>=8.6'} dev: false + /pify@3.0.0: + resolution: {integrity: sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==} + engines: {node: '>=4'} + dev: false + + /pify@5.0.0: + resolution: {integrity: sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA==} + engines: {node: '>=10'} + dev: false + /pino-abstract-transport@0.5.0: resolution: {integrity: sha512-+KAgmVeqXYbTtU2FScx1XS3kNyfZ5TrXY07V96QnUSFqo2gAqlvmaxH67Lj7SWazqsMabf+58ctdTcBgnOLUOQ==} dependencies: @@ -1647,11 +2315,20 @@ packages: engines: {node: '>=10.13.0'} dev: false + /pony-cause@2.1.11: + resolution: {integrity: sha512-M7LhCsdNbNgiLYiP4WjsfLUuFmCfnjdF6jKe2R9NKl4WFN+HZPGHJZ9lnLP7f9ZnKe3U9nuWD0szirmj+migUg==} + engines: {node: '>=12.0.0'} + dev: false + /possible-typed-array-names@1.0.0: resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==} engines: {node: '>= 0.4'} dev: false + /preact@10.20.2: + resolution: {integrity: sha512-S1d1ernz3KQ+Y2awUxKakpfOg2CEmJmwOP+6igPx6dgr6pgDvenqYviyokWso2rhHvGtTlWWnJDa7RaPbQerTg==} + dev: false + /process-warning@1.0.0: resolution: {integrity: sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q==} dev: false @@ -1735,6 +2412,14 @@ packages: engines: {node: '>=10'} dev: false + /semver@7.6.0: + resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==} + engines: {node: '>=10'} + hasBin: true + dependencies: + lru-cache: 6.0.0 + dev: false + /set-blocking@2.0.0: resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} dev: false @@ -1751,6 +2436,14 @@ packages: has-property-descriptors: 1.0.2 dev: false + /sha.js@2.4.11: + resolution: {integrity: sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==} + hasBin: true + dependencies: + inherits: 2.0.4 + safe-buffer: 5.2.1 + dev: false + /shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'} @@ -1824,6 +2517,11 @@ packages: engines: {node: '>=12'} dev: false + /superstruct@1.0.4: + resolution: {integrity: sha512-7JpaAoX2NGyoFlI9NBh66BQXGONc+uE+MRS5i2iOBKuS4e+ccgMDjATgZldkah+33DakBxDHiss9kvUcGAO8UQ==} + engines: {node: '>=14.0.0'} + dev: false + /system-architecture@0.1.0: resolution: {integrity: sha512-ulAk51I9UVUyJgxlv9M6lFot2WP3e7t8Kz9+IS6D4rVba1tR9kON+Ey69f+1R4Q8cd45Lod6a4IcJIxnzGc/zA==} engines: {node: '>=18'} @@ -1976,6 +2674,11 @@ packages: which-typed-array: 1.1.14 dev: false + /uuid@9.0.1: + resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==} + hasBin: true + dev: false + /valtio@1.11.2(react@18.2.0): resolution: {integrity: sha512-1XfIxnUXzyswPAPXo1P3Pdx2mq/pIqZICkWN60Hby0d9Iqb+MEIpqgYVlbflvHdrp2YR/q3jyKWRPJJ100yxaw==} engines: {node: '>=12.20.0'} @@ -2113,10 +2816,19 @@ packages: optional: true dev: false + /xtend@4.0.2: + resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} + engines: {node: '>=0.4'} + dev: false + /y18n@4.0.3: resolution: {integrity: sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==} dev: false + /yallist@4.0.0: + resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} + dev: false + /yargs-parser@18.1.3: resolution: {integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==} engines: {node: '>=6'} diff --git a/packages/networks/evm-chains/src/browser/adapters/Web3Modal.ts b/packages/networks/evm-chains/src/browser/adapters/Web3Modal.ts new file mode 100644 index 0000000..b7c227d --- /dev/null +++ b/packages/networks/evm-chains/src/browser/adapters/Web3Modal.ts @@ -0,0 +1,172 @@ +import icons from './icons.ts' +import type { EIP1193Provider } from './EIP6963.ts' +import type { Chain } from '@web3modal/scaffold-utils/ethers' +import type { CustomWallet, Metadata } from '@web3modal/core' +import { createWeb3Modal, defaultConfig } from '@web3modal/ethers' +import type { Web3Modal as Web3ModalType } from '@web3modal/ethers' +import { ErrorTypeEnum, WalletPlatformEnum } from '@multiplechain/types' +import { networks, type EvmNetworkConfigInterface } from '../../index.ts' +import type { WalletAdapterInterface, ProviderInterface } from '@multiplechain/types' + +interface Web3ModalOps { + projectId: string + themeMode?: 'dark' | 'light' + enableEIP6963?: boolean + enableInjected?: boolean + enableCoinbase?: boolean + rpcUrl?: string + defaultChainId?: number + metadata: Metadata + customWallets?: CustomWallet[] +} + +export interface Web3ModalAdapterInterface extends Omit { + connect: (provider?: ProviderInterface, ops?: Web3ModalOps) => Promise +} + +let modal: Web3ModalType + +const chains: Chain[] = networks + .getAll() + .map((network: any) => { + return { + chainId: network.id, + name: network.name ?? network.nativeCurrency.symbol, + currency: network.nativeCurrency.symbol, + explorerUrl: network.explorerUrl, + rpcUrl: network.rpcUrl + } + }) + .filter((network: any) => network) + +let currentNetwork: Chain +let clickedAnyWallet = false +let connectRejectMethod: (reason?: any) => void +let connectResolveMethod: (value: EIP1193Provider | PromiseLike) => void + +const web3Modal = (ops: Web3ModalOps): Web3ModalType => { + if (modal !== undefined) { + return modal + } + + const ethersConfig = defaultConfig({ + metadata: ops.metadata, + enableEIP6963: ops.enableEIP6963, + enableInjected: ops.enableInjected, + enableCoinbase: ops.enableCoinbase + }) + + modal = createWeb3Modal({ + chains, + ethersConfig, + projectId: ops.projectId, + themeMode: ops.themeMode, + customWallets: ops.customWallets, + allowUnsupportedChain: true, + themeVariables: { + '--w3m-z-index': 999999999999 + } + }) + + modal.subscribeEvents(async (event) => { + if (event.data.event === 'SELECT_WALLET') { + clickedAnyWallet = true + } + if (event.data.event === 'MODAL_CLOSE') { + if (clickedAnyWallet) { + clickedAnyWallet = false + } else { + connectRejectMethod(new Error(ErrorTypeEnum.CLOSED_WALLETCONNECT_MODAL)) + } + } + }) + + modal.subscribeProvider(async ({ provider, chainId }) => { + if (provider === undefined) { + return + } + if (currentNetwork.chainId !== chainId) { + await modal.switchNetwork(currentNetwork.chainId as number).catch(() => { + connectRejectMethod(new Error(ErrorTypeEnum.WALLET_CONNECT_REJECTED)) + }) + } + connectResolveMethod(provider as EIP1193Provider) + }) + + return modal +} + +const Web3Modal: Web3ModalAdapterInterface = { + id: 'web3modal', + name: 'Web3Modal', + icon: icons.web3modal, + platforms: [WalletPlatformEnum.UNIVERSAL], + isDetected: () => true, + isConnected: () => { + if (modal === undefined) { + return false + } + return modal.getIsConnected() + }, + disconnect: async () => { + Object.keys(localStorage) + .filter((x) => { + return ( + x.startsWith('wc@2') || + x.startsWith('@w3m') || + x.startsWith('W3M') || + x.startsWith('-walletlink') + ) + }) + .forEach((x) => { + localStorage.removeItem(x) + }) + + if (modal?.disconnect !== undefined) { + await modal.disconnect() + } + }, + connect: async (provider?: ProviderInterface, ops?: Web3ModalOps): Promise => { + if (provider === undefined) { + throw new Error('Provider is required') + } + + if (ops === undefined) { + throw new Error('Ops is required') + } + + if (ops.projectId === undefined) { + throw new Error('Project ID is required') + } + + if (ops.metadata === undefined) { + throw new Error('Metadata is required') + } + + const network = provider.network as EvmNetworkConfigInterface + + currentNetwork = { + chainId: network.id, + name: network.name ?? network.nativeCurrency.symbol, + currency: network.nativeCurrency.symbol, + explorerUrl: network.explorerUrl, + rpcUrl: network.rpcUrl + } + + return await new Promise((resolve, reject) => { + try { + const modal = web3Modal(ops) + connectRejectMethod = async (reason) => { + await modal.disconnect() + reject(reason) + } + connectResolveMethod = resolve + void modal.open({ view: 'Connect' }) + } catch (error) { + reject(error) + } + }) + } +} + +export default Web3Modal diff --git a/packages/networks/evm-chains/src/browser/adapters/index.ts b/packages/networks/evm-chains/src/browser/adapters/index.ts index 303bad6..9cc32f0 100644 --- a/packages/networks/evm-chains/src/browser/adapters/index.ts +++ b/packages/networks/evm-chains/src/browser/adapters/index.ts @@ -1,6 +1,7 @@ import './types.ts' // global types export { default as Phantom } from './Phantom.ts' export { default as MetaMask } from './MetaMask.ts' +export { default as Web3Modal } from './Web3Modal.ts' export { default as OkxWallet } from './OkxWallet.ts' export { default as XdefiWallet } from './XdefiWallet.ts' export { default as TrustWallet } from './TrustWallet.ts' diff --git a/packages/networks/evm-chains/src/browser/index.ts b/packages/networks/evm-chains/src/browser/index.ts index 52eac57..81835ab 100644 --- a/packages/networks/evm-chains/src/browser/index.ts +++ b/packages/networks/evm-chains/src/browser/index.ts @@ -3,11 +3,8 @@ import { switcher } from './adapters/switcher.ts' import * as adapterList from './adapters/index.ts' import { WalletPlatformEnum } from '@multiplechain/types' import type { EIP6963ProviderDetail, EIP1193Provider } from './adapters/EIP6963.ts' -import type { - WalletAdapterListType, - WalletAdapterInterface, - RegisterWalletAdapterType -} from '@multiplechain/types' +import type { WalletAdapterInterface, RegisterWalletAdapterType } from '@multiplechain/types' +import type { Web3ModalAdapterInterface } from './adapters/Web3Modal.ts' const EIP6963AdapterUUIDIndex: Record = { 'app.phantom': 'phantom', @@ -18,7 +15,7 @@ const EIP6963AdapterUUIDIndex: Record = { 'io.xdefi': 'xdefiwallet' } -const adapters: WalletAdapterListType = { +const adapters: Record = { ...adapterList } diff --git a/packages/networks/evm-chains/src/services/Networks.ts b/packages/networks/evm-chains/src/services/Networks.ts index ee24153..3ab739c 100644 --- a/packages/networks/evm-chains/src/services/Networks.ts +++ b/packages/networks/evm-chains/src/services/Networks.ts @@ -70,7 +70,17 @@ const getMainnets = (): EvmNetworkConfigInterface[] => { return Object.values(networks).filter((network) => !(network.testnet ?? false)) } +const getAll = (): EvmNetworkConfigInterface[] => { + return Object.values(networks) +} + +const add = (key: string, network: EvmNetworkConfigInterface): void => { + networks[key] = network +} + export default { + add, + getAll, findById, findByKey, findByName, From fd0d79e6c2e606d77fca036270fa0dd806bde3ae Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Sun, 28 Apr 2024 19:11:35 +0800 Subject: [PATCH 05/11] fixed type problems --- packages/networks/evm-chains/src/browser/Wallet.ts | 14 +++++++++----- .../evm-chains/src/browser/adapters/MetaMask.ts | 14 ++++++++------ .../evm-chains/src/browser/adapters/TrustWallet.ts | 3 ++- .../evm-chains/src/browser/adapters/Web3Modal.ts | 13 +++++++++---- .../evm-chains/src/browser/adapters/types.ts | 9 +++++---- 5 files changed, 33 insertions(+), 20 deletions(-) diff --git a/packages/networks/evm-chains/src/browser/Wallet.ts b/packages/networks/evm-chains/src/browser/Wallet.ts index 9b085ab..420645a 100644 --- a/packages/networks/evm-chains/src/browser/Wallet.ts +++ b/packages/networks/evm-chains/src/browser/Wallet.ts @@ -10,6 +10,7 @@ import { import { Provider } from '../services/Provider.ts' import type { EIP1193Provider } from './adapters/EIP6963.ts' import { toHex } from '@multiplechain/utils' +import type { Web3ModalAdapterInterface, Web3ModalOps } from './adapters/Web3Modal.ts' const rejectMap = (error: any, reject: (a: any) => any): any => { console.error('MultipleChain EVM Wallet Error:', error) @@ -68,8 +69,8 @@ const rejectMap = (error: any, reject: (a: any) => any): any => { return reject(error) } -export class Wallet implements WalletInterface { - adapter: WalletAdapterInterface +export class Wallet implements Omit { + adapter: WalletAdapterInterface | Web3ModalAdapterInterface walletProvider: EIP1193Provider @@ -79,7 +80,7 @@ export class Wallet implements WalletInterface { * @param {WalletAdapterInterface} adapter * @param {Provider} provider */ - constructor(adapter: WalletAdapterInterface, provider?: Provider) { + constructor(adapter: WalletAdapterInterface | Web3ModalAdapterInterface, provider?: Provider) { this.adapter = adapter this.networkProvider = provider ?? Provider.instance } @@ -153,10 +154,13 @@ export class Wallet implements WalletInterface { /** * @param {ProviderInterface} provider - * @param {Object | WalletConnectOps} ops + * @param {Object | WalletConnectOps | Web3ModalOps} ops * @returns {Promise} */ - async connect(provider?: ProviderInterface, ops?: object | WalletConnectOps): Promise { + async connect( + provider?: ProviderInterface, + ops?: object | WalletConnectOps | Web3ModalOps + ): Promise { return await new Promise((resolve, reject) => { this.adapter .connect(provider, ops) diff --git a/packages/networks/evm-chains/src/browser/adapters/MetaMask.ts b/packages/networks/evm-chains/src/browser/adapters/MetaMask.ts index c57ed56..eead4b8 100644 --- a/packages/networks/evm-chains/src/browser/adapters/MetaMask.ts +++ b/packages/networks/evm-chains/src/browser/adapters/MetaMask.ts @@ -1,9 +1,12 @@ import icons from './icons.ts' import { switcher } from './switcher.ts' +import type { WindowEthereum } from './types.ts' import type { EIP1193Provider } from './EIP6963.ts' import { WalletPlatformEnum } from '@multiplechain/types' import type { WalletAdapterInterface, ProviderInterface } from '@multiplechain/types' +const metamaskProvider = window?.ethereum as unknown as WindowEthereum + const MetaMask: WalletAdapterInterface = { id: 'metamask', name: 'MetaMask', @@ -11,21 +14,20 @@ const MetaMask: WalletAdapterInterface = { provider: window.ethereum, downloadLink: 'https://metamask.io/download/', platforms: [WalletPlatformEnum.BROWSER, WalletPlatformEnum.MOBILE], - isDetected: () => Boolean(window?.ethereum?.isMetaMask), + isDetected: () => Boolean(metamaskProvider.isMetaMask), createDeepLink: (url: string): string => `https://metamask.app.link/dapp/${url}`, isConnected: async () => { - return Boolean((await window?.ethereum?.request({ method: 'eth_accounts' })).length) + return Boolean((await metamaskProvider.request({ method: 'eth_accounts' })).length) }, connect: async (provider?: ProviderInterface): Promise => { - const metamask = window.ethereum return await new Promise((resolve, reject) => { try { - metamask + metamaskProvider ?.request({ method: 'eth_requestAccounts' }) .then(() => { - switcher(metamask, provider) + switcher(metamaskProvider, provider) .then(() => { - resolve(metamask) + resolve(metamaskProvider) }) .catch((error: any) => { reject(error) diff --git a/packages/networks/evm-chains/src/browser/adapters/TrustWallet.ts b/packages/networks/evm-chains/src/browser/adapters/TrustWallet.ts index 52960c6..529b6db 100644 --- a/packages/networks/evm-chains/src/browser/adapters/TrustWallet.ts +++ b/packages/networks/evm-chains/src/browser/adapters/TrustWallet.ts @@ -1,11 +1,12 @@ import icons from './icons.ts' import { switcher } from './switcher.ts' +import type { WindowEthereum } from './types.ts' import type { EIP1193Provider } from './EIP6963.ts' import { WalletPlatformEnum } from '@multiplechain/types' import type { WalletAdapterInterface, ProviderInterface } from '@multiplechain/types' // eslint-disable-next-line -const trustWalletProvider = window?.ethereum?.isTrust ? window.ethereum : window.trustwallet +const trustWalletProvider = (window?.ethereum?.isTrust ? window.ethereum : window.trustwallet) as unknown as WindowEthereum const TrustWallet: WalletAdapterInterface = { id: 'trustwallet', diff --git a/packages/networks/evm-chains/src/browser/adapters/Web3Modal.ts b/packages/networks/evm-chains/src/browser/adapters/Web3Modal.ts index b7c227d..f679a16 100644 --- a/packages/networks/evm-chains/src/browser/adapters/Web3Modal.ts +++ b/packages/networks/evm-chains/src/browser/adapters/Web3Modal.ts @@ -8,7 +8,7 @@ import { ErrorTypeEnum, WalletPlatformEnum } from '@multiplechain/types' import { networks, type EvmNetworkConfigInterface } from '../../index.ts' import type { WalletAdapterInterface, ProviderInterface } from '@multiplechain/types' -interface Web3ModalOps { +export interface Web3ModalOps { projectId: string themeMode?: 'dark' | 'light' enableEIP6963?: boolean @@ -21,7 +21,7 @@ interface Web3ModalOps { } export interface Web3ModalAdapterInterface extends Omit { - connect: (provider?: ProviderInterface, ops?: Web3ModalOps) => Promise + connect: (provider?: ProviderInterface, ops?: Web3ModalOps | object) => Promise } let modal: Web3ModalType @@ -86,7 +86,7 @@ const web3Modal = (ops: Web3ModalOps): Web3ModalType => { return } if (currentNetwork.chainId !== chainId) { - await modal.switchNetwork(currentNetwork.chainId as number).catch(() => { + await modal.switchNetwork(currentNetwork.chainId).catch(() => { connectRejectMethod(new Error(ErrorTypeEnum.WALLET_CONNECT_REJECTED)) }) } @@ -126,7 +126,12 @@ const Web3Modal: Web3ModalAdapterInterface = { await modal.disconnect() } }, - connect: async (provider?: ProviderInterface, ops?: Web3ModalOps): Promise => { + connect: async ( + provider?: ProviderInterface, + _ops?: Web3ModalOps | object + ): Promise => { + const ops = _ops as Web3ModalOps + if (provider === undefined) { throw new Error('Provider is required') } diff --git a/packages/networks/evm-chains/src/browser/adapters/types.ts b/packages/networks/evm-chains/src/browser/adapters/types.ts index 73629b4..8edd9f2 100644 --- a/packages/networks/evm-chains/src/browser/adapters/types.ts +++ b/packages/networks/evm-chains/src/browser/adapters/types.ts @@ -1,5 +1,10 @@ import type { EIP1193Provider } from './EIP6963.ts' +export interface WindowEthereum extends EIP1193Provider { + isTrust?: boolean + isMetaMask?: boolean +} + declare global { interface Window { okxwallet?: EIP1193Provider @@ -12,10 +17,6 @@ declare global { phantom?: { ethereum?: EIP1193Provider } - ethereum?: EIP1193Provider & { - isTrust?: boolean - isMetaMask?: boolean - } trustwallet?: EIP1193Provider } } From 3d0ba8e4f794d4813ea61515bc6963341eadfc1e Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Sun, 28 Apr 2024 19:31:56 +0800 Subject: [PATCH 06/11] fixed type problems --- .../networks/boilerplate/src/browser/index.ts | 8 +++----- packages/networks/evm-chains/src/browser/index.ts | 15 ++++++++------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/networks/boilerplate/src/browser/index.ts b/packages/networks/boilerplate/src/browser/index.ts index 16137ee..c95f448 100644 --- a/packages/networks/boilerplate/src/browser/index.ts +++ b/packages/networks/boilerplate/src/browser/index.ts @@ -7,9 +7,7 @@ import type { } from '@multiplechain/types' -const adapters: WalletAdapterListType = { - ...adapterList -} +const adapters: WalletAdapterListType = {} const registerAdapter: RegisterWalletAdapterType = (adapter: WalletAdapterInterface): void => { if (Object.values(adapters).find((a) => a.id === adapter.id) !== undefined) { @@ -23,6 +21,6 @@ export * from '../index.ts' export const browser = { Wallet, - adapters, - registerAdapter + registerAdapter, + adapters: Object.assign(adapters, adapterList) } diff --git a/packages/networks/evm-chains/src/browser/index.ts b/packages/networks/evm-chains/src/browser/index.ts index 81835ab..6a9a9fe 100644 --- a/packages/networks/evm-chains/src/browser/index.ts +++ b/packages/networks/evm-chains/src/browser/index.ts @@ -3,8 +3,11 @@ import { switcher } from './adapters/switcher.ts' import * as adapterList from './adapters/index.ts' import { WalletPlatformEnum } from '@multiplechain/types' import type { EIP6963ProviderDetail, EIP1193Provider } from './adapters/EIP6963.ts' -import type { WalletAdapterInterface, RegisterWalletAdapterType } from '@multiplechain/types' -import type { Web3ModalAdapterInterface } from './adapters/Web3Modal.ts' +import type { + WalletAdapterInterface, + WalletAdapterListType, + RegisterWalletAdapterType +} from '@multiplechain/types' const EIP6963AdapterUUIDIndex: Record = { 'app.phantom': 'phantom', @@ -15,9 +18,7 @@ const EIP6963AdapterUUIDIndex: Record = { 'io.xdefi': 'xdefiwallet' } -const adapters: Record = { - ...adapterList -} +const adapters: WalletAdapterListType = {} const registerAdapter: RegisterWalletAdapterType = (adapter: WalletAdapterInterface): void => { if (EIP6963AdapterUUIDIndex[adapter.id] !== undefined) { @@ -84,8 +85,8 @@ export * from '../index.ts' export const browser = { Wallet, switcher, - adapters, registerAdapter, toEIP6963ProviderDetail, - fromEIP6963ProviderDetail + fromEIP6963ProviderDetail, + adapters: Object.assign(adapters, adapterList) } From 0deb458aee96ca240b4d2aa341d460d00d69c187 Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Sun, 28 Apr 2024 19:32:21 +0800 Subject: [PATCH 07/11] fixed --- packages/networks/evm-chains/src/browser/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/networks/evm-chains/src/browser/index.ts b/packages/networks/evm-chains/src/browser/index.ts index 6a9a9fe..3faf3a1 100644 --- a/packages/networks/evm-chains/src/browser/index.ts +++ b/packages/networks/evm-chains/src/browser/index.ts @@ -23,7 +23,7 @@ const adapters: WalletAdapterListType = {} const registerAdapter: RegisterWalletAdapterType = (adapter: WalletAdapterInterface): void => { if (EIP6963AdapterUUIDIndex[adapter.id] !== undefined) { console.warn( - `Adapter is not registered, because it is already registered defualtly: ${adapter.id}` + `Adapter is not registered, because it is already registered default: ${adapter.id}` ) return } From 135d35468723d04c67aa85c7e5554025d3d03ad8 Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Sun, 28 Apr 2024 20:06:50 +0800 Subject: [PATCH 08/11] first release and fixed different type problem for platforms --- packages/networks/evm-chains/package.json | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/networks/evm-chains/package.json b/packages/networks/evm-chains/package.json index 88f746d..4995b02 100644 --- a/packages/networks/evm-chains/package.json +++ b/packages/networks/evm-chains/package.json @@ -1,8 +1,7 @@ { "name": "@multiplechain/evm-chains", - "version": "0.3.38", + "version": "0.3.42", "type": "module", - "types": "dist/index.d.ts", "main": "dist/index.cjs", "module": "dist/index.es.js", "unpkg": "dist/index.umd.js", @@ -10,9 +9,14 @@ "jsdelivr": "dist/index.umd.js", "exports": { ".": { - "import": "./dist/index.es.js", - "require": "./dist/index.cjs", - "types": "./dist/index.d.ts" + "import": { + "default": "./dist/index.es.js", + "types": "./dist/browser/index.d.ts" + }, + "require": { + "default": "./dist/index.cjs", + "types": "./dist/index.d.ts" + } } }, "files": [ From 0e517f4046206c2469a067445d0e1ac441cf1ecf Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Sun, 28 Apr 2024 20:08:05 +0800 Subject: [PATCH 09/11] updated --- packages/networks/boilerplate/package.json | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/networks/boilerplate/package.json b/packages/networks/boilerplate/package.json index 87146fa..cbbc39c 100644 --- a/packages/networks/boilerplate/package.json +++ b/packages/networks/boilerplate/package.json @@ -2,7 +2,6 @@ "name": "@multiplechain/evm-chains", "version": "0.1.0", "type": "module", - "types": "dist/index.d.ts", "main": "dist/index.cjs", "module": "dist/index.es.js", "unpkg": "dist/index.umd.js", @@ -10,9 +9,14 @@ "jsdelivr": "dist/index.umd.js", "exports": { ".": { - "import": "./dist/index.es.js", - "require": "./dist/index.cjs", - "types": "./dist/index.d.ts" + "import": { + "default": "./dist/index.es.js", + "types": "./dist/browser/index.d.ts" + }, + "require": { + "default": "./dist/index.cjs", + "types": "./dist/index.d.ts" + } } }, "files": [ From b7c2379b359cebcd0327c02e57c721b3baf024e8 Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Tue, 30 Apr 2024 17:32:48 +0800 Subject: [PATCH 10/11] updated --- packages/networks/boilerplate/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/networks/boilerplate/package.json b/packages/networks/boilerplate/package.json index cbbc39c..1cac0e3 100644 --- a/packages/networks/boilerplate/package.json +++ b/packages/networks/boilerplate/package.json @@ -1,5 +1,5 @@ { - "name": "@multiplechain/evm-chains", + "name": "@multiplechain/boilerplate", "version": "0.1.0", "type": "module", "main": "dist/index.cjs", From 17b5165a8138e25908ed9d4cdbd8f691ffa48fc7 Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Tue, 30 Apr 2024 17:47:12 +0800 Subject: [PATCH 11/11] updated --- .../boilerplate/src/browser/Wallet.ts | 25 +++++++++++++------ .../networks/boilerplate/src/browser/index.ts | 1 - 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/packages/networks/boilerplate/src/browser/Wallet.ts b/packages/networks/boilerplate/src/browser/Wallet.ts index bda683c..ac2d5cd 100644 --- a/packages/networks/boilerplate/src/browser/Wallet.ts +++ b/packages/networks/boilerplate/src/browser/Wallet.ts @@ -4,15 +4,22 @@ import type { WalletPlatformEnum, TransactionSignerInterface } from '@multiplechain/types' +import { Provider } from '../services/Provider' export class Wallet implements WalletInterface { adapter: WalletAdapterInterface + walletProvider: object + + networkProvider: Provider + /** * @param {WalletAdapterInterface} adapter + * @param {Provider} provider */ - constructor(adapter: WalletAdapterInterface) { + constructor(adapter: WalletAdapterInterface, provider?: Provider) { this.adapter = adapter + this.networkProvider = provider ?? Provider.instance } /** @@ -46,7 +53,7 @@ export class Wallet implements WalletInterface { /** * @returns {string} */ - getDownloadLink(): string { + getDownloadLink(): string | undefined { return this.adapter.downloadLink } @@ -55,7 +62,11 @@ export class Wallet implements WalletInterface { * @param {object} ops * @returns {string} */ - createDeepLink(url: string, ops?: object): string { + createDeepLink(url: string, ops?: object): string | null { + if (this.adapter.createDeepLink === undefined) { + return null + } + return this.adapter.createDeepLink(url, ops) } @@ -71,15 +82,15 @@ export class Wallet implements WalletInterface { /** * @returns {boolean} */ - isDetected(): boolean { - return this.adapter.isDetected() + async isDetected(): Promise { + return await this.adapter.isDetected() } /** * @returns {boolean} */ - isConnected(): boolean { - return this.adapter.isConnected() + async isConnected(): Promise { + return await this.adapter.isConnected() } /** diff --git a/packages/networks/boilerplate/src/browser/index.ts b/packages/networks/boilerplate/src/browser/index.ts index c95f448..787e9bd 100644 --- a/packages/networks/boilerplate/src/browser/index.ts +++ b/packages/networks/boilerplate/src/browser/index.ts @@ -6,7 +6,6 @@ import type { RegisterWalletAdapterType } from '@multiplechain/types' - const adapters: WalletAdapterListType = {} const registerAdapter: RegisterWalletAdapterType = (adapter: WalletAdapterInterface): void => {