diff --git a/apps/laboratory/src/utils/EthersConstants.ts b/apps/laboratory/src/utils/EthersConstants.ts index 0832dfc6b1..eae3d5f908 100644 --- a/apps/laboratory/src/utils/EthersConstants.ts +++ b/apps/laboratory/src/utils/EthersConstants.ts @@ -16,18 +16,18 @@ import { export const EthersConstants = { chains: [ - mainnet, - arbitrum, - polygon, - avalanche, - binanceSmartChain, - optimism, - gnosis, - zkSync, - zora, - base, - celo, - aurora, + // mainnet, + // arbitrum, + // polygon, + // avalanche, + // binanceSmartChain, + // optimism, + // gnosis, + // zkSync, + // zora, + // base, + // celo, + // aurora, sepolia ] } diff --git a/package-lock.json b/package-lock.json index 21fc7b55d1..99ae138b56 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,6 +39,31 @@ "vitest": "1.1.1" } }, + "../walletconnect-monorepo/providers/ethereum-provider": { + "name": "@walletconnect/ethereum-provider", + "version": "2.11.3", + "license": "Apache-2.0", + "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", + "@walletconnect/sign-client": "2.11.3", + "@walletconnect/types": "2.11.3", + "@walletconnect/universal-provider": "2.11.3", + "@walletconnect/utils": "2.11.3", + "events": "^3.3.0", + "permissionless": "^0.1.10", + "viem": "^2.8.13" + }, + "devDependencies": { + "ethereum-test-network": "0.1.6", + "ethers": "5.6.9", + "uint8arrays": "^3.1.0", + "web3": "1.7.5" + } + }, "apps/gallery": { "name": "@apps/gallery", "version": "4.1.1", @@ -30186,13 +30211,15 @@ "license": "Apache-2.0", "dependencies": { "@coinbase/wallet-sdk": "3.9.1", - "@walletconnect/ethereum-provider": "2.11.1", + "@walletconnect/ethereum-provider": "file:../../../walletconnect-monorepo/providers/ethereum-provider", "@web3modal/polyfills": "4.1.1", "@web3modal/scaffold": "4.1.1", "@web3modal/scaffold-react": "4.1.1", "@web3modal/scaffold-utils": "4.1.1", "@web3modal/scaffold-vue": "4.1.1", - "valtio": "1.11.2" + "permissionless": "0.0.36", + "valtio": "1.11.2", + "viem": "^2.8.18" }, "devDependencies": { "react": "18.2.0", @@ -30227,6 +30254,53 @@ } } }, + "packages/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==", + "dependencies": { + "@noble/hashes": "1.3.2" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "packages/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==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "packages/ethers/node_modules/@scure/bip32": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.2.tgz", + "integrity": "sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA==", + "dependencies": { + "@noble/curves": "~1.2.0", + "@noble/hashes": "~1.3.2", + "@scure/base": "~1.1.2" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "packages/ethers/node_modules/@scure/bip39": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", + "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", + "dependencies": { + "@noble/hashes": "~1.3.0", + "@scure/base": "~1.1.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "packages/ethers/node_modules/@vue/compiler-core": { "version": "3.4.3", "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.3.tgz", @@ -30326,6 +30400,18 @@ "integrity": "sha512-rIwlkkP1n4uKrRzivAKPZIEkHiuwY5mmhMJ2nZKCBLz8lTUlE73rQh4n1OnnMurXt1vcUNyH4ZPfdh8QweTjpQ==", "dev": true }, + "packages/ethers/node_modules/@walletconnect/ethereum-provider": { + "resolved": "../walletconnect-monorepo/providers/ethereum-provider", + "link": true + }, + "packages/ethers/node_modules/permissionless": { + "version": "0.0.36", + "resolved": "https://registry.npmjs.org/permissionless/-/permissionless-0.0.36.tgz", + "integrity": "sha512-1/+N3zzFn2vjKZm6aol3eXsFO34d68/GAhKypq2iucFEPrgM5sdq3I5sOK+RrKuGIy8/Bix+IoHhtg0XCDPMOA==", + "peerDependencies": { + "viem": "^2.0.0" + } + }, "packages/ethers/node_modules/postcss": { "version": "8.4.35", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.35.tgz", @@ -30354,6 +30440,35 @@ "node": "^10 || ^12 || >=14" } }, + "packages/ethers/node_modules/viem": { + "version": "2.8.18", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.8.18.tgz", + "integrity": "sha512-Kq3kwkKziJ8rQeLkmdbSLheHDnA+tx2EdLKLmQ3N4FVtjKYjBP9tPL1r+fI6KltVUM1TDOhIHOdslDSp57VMMg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "dependencies": { + "@adraffy/ens-normalize": "1.10.0", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", + "@scure/bip32": "1.3.2", + "@scure/bip39": "1.2.1", + "abitype": "1.0.0", + "isows": "1.0.3", + "ws": "8.13.0" + }, + "peerDependencies": { + "typescript": ">=5.0.4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "packages/ethers/node_modules/vue": { "version": "3.4.3", "resolved": "https://registry.npmjs.org/vue/-/vue-3.4.3.tgz", @@ -30375,6 +30490,26 @@ } } }, + "packages/ethers/node_modules/ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "packages/ethers5": { "name": "@web3modal/ethers5", "version": "4.1.1", diff --git a/packages/ethers/package.json b/packages/ethers/package.json index edc7ba2435..81a997ea73 100644 --- a/packages/ethers/package.json +++ b/packages/ethers/package.json @@ -44,13 +44,15 @@ }, "dependencies": { "@coinbase/wallet-sdk": "3.9.1", - "@walletconnect/ethereum-provider": "2.11.1", + "@walletconnect/ethereum-provider": "file:../../../walletconnect-monorepo/providers/ethereum-provider", "@web3modal/polyfills": "4.1.1", "@web3modal/scaffold": "4.1.1", "@web3modal/scaffold-react": "4.1.1", "@web3modal/scaffold-utils": "4.1.1", "@web3modal/scaffold-vue": "4.1.1", - "valtio": "1.11.2" + "permissionless": "0.0.36", + "valtio": "1.11.2", + "viem": "^2.8.18" }, "peerDependencies": { "@web3modal/siwe": "4.1.1", diff --git a/packages/ethers/src/client.ts b/packages/ethers/src/client.ts index 28fb539015..85c82e055b 100644 --- a/packages/ethers/src/client.ts +++ b/packages/ethers/src/client.ts @@ -37,6 +37,8 @@ import type { EthereumProviderOptions } from '@walletconnect/ethereum-provider' import type { Eip1193Provider } from 'ethers' import { W3mFrameProvider, W3mFrameHelpers, W3mFrameRpcConstants } from '@web3modal/wallet' import type { CombinedProvider } from '@web3modal/scaffold-utils/ethers' +import { createPimlicoPaymasterClient } from 'permissionless/clients/pimlico' +import { http } from 'viem' // -- Types --------------------------------------------------------------------- export interface Web3ModalClientOptions extends Omit { @@ -48,6 +50,9 @@ export interface Web3ModalClientOptions extends Omit tokens?: Record enableSmartAccounts?: boolean + smartAccount?: { + bundlerUrl: string + } } export type Web3ModalOptions = Omit @@ -435,6 +440,22 @@ export class Web3Modal extends Web3ModalScaffold { description: this.metadata ? this.metadata.description : '', url: this.metadata ? this.metadata.url : '', icons: this.metadata ? this.metadata.icons : [''] + }, + optionalMethods: ['eth_signUserOperation'], + smartAccountConfig: { + bundlerUrl: + // 'https://api.pimlico.io/v2/sepolia/rpc?apikey=7fcebd0d-53e8-411c-9c88-5af50c9959bf', + 'https://api-staging.pimlico.io/v2/sepolia/rpc?apikey=a1ddf855-1258-438d-925b-903301301e2e', + paymasterMiddleware: (entryPoint, userOperation) => { + const paymasterClient = createPimlicoPaymasterClient({ + transport: http( + // 'https://api.pimlico.io/v2/sepolia/rpc?apikey=7fcebd0d-53e8-411c-9c88-5af50c9959bf' + 'https://api-staging.pimlico.io/v2/sepolia/rpc?apikey=a1ddf855-1258-438d-925b-903301301e2e' + ) + }) + + return paymasterClient.sponsorUserOperation({ userOperation, entryPoint }) + } } }