Skip to content

Commit

Permalink
feat: works with bundler staging
Browse files Browse the repository at this point in the history
  • Loading branch information
tomiir committed Mar 24, 2024
1 parent 9887e9f commit 56ed8fd
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 16 deletions.
24 changes: 12 additions & 12 deletions apps/laboratory/src/utils/EthersConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
}
139 changes: 137 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions packages/ethers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
21 changes: 21 additions & 0 deletions packages/ethers/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<LibraryOptions, 'defaultChain' | 'tokens'> {
Expand All @@ -48,6 +50,9 @@ export interface Web3ModalClientOptions extends Omit<LibraryOptions, 'defaultCha
connectorImages?: Record<string, string>
tokens?: Record<number, Token>
enableSmartAccounts?: boolean
smartAccount?: {
bundlerUrl: string
}
}

export type Web3ModalOptions = Omit<Web3ModalClientOptions, '_sdkVersion'>
Expand Down Expand Up @@ -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 })
}
}
}

Expand Down

0 comments on commit 56ed8fd

Please sign in to comment.