Skip to content

fix ethereum rpc requests #840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ export abstract class SmartAccountLib implements EIP155Wallet {
const userOpWithStubData: UserOperation<'v0.7'> = {
...userOpPreStubData,
...paymasterStubData,
verificationGasLimit: paymasterStubData.paymasterVerificationGasLimit ?? 0n,
signature: '0x'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ export async function approveEIP155Request(requestEvent: RequestEventArgs) {
const provider = new providers.JsonRpcProvider(EIP155_CHAINS[chainId as TEIP155Chain].rpc)
const sendTransaction = request.params[0]
const connectedWallet = await wallet.connect(provider)
const txResponse = await connectedWallet.sendTransaction(sendTransaction)
const txResponse = await connectedWallet.sendTransaction({
to: sendTransaction.to,
value: sendTransaction.value,
data: sendTransaction.data
})
const txHash = typeof txResponse === 'string' ? txResponse : txResponse?.hash
const txReceipt = await txResponse.wait()
console.log(
`Transaction broadcasted on chain ${chainId} , ${{ txHash }}, status: ${txReceipt.status}`
)
return formatJsonRpcResult(id, txHash)
} catch (error: any) {
console.error(error)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ import {
} from 'permissionless'
import { http, toHex } from 'viem'
type RequestEventArgs = Omit<SignClientTypes.EventArguments['session_request'], 'verifyContext'>
const getCallsReceipt = async (getCallParams: GetCallsParams) => {
const getCallsReceipt = async (getCallParams: GetCallsParams, caip10ChainId: string) => {
/**
* This is hardcode implementation of wallet_getCallsStatus
* as we are not maintaining the data for calls bundled right now.
* Getting directly from bundler the receipt on sepolia chain.
*/
const apiKey = process.env.NEXT_PUBLIC_PIMLICO_KEY
const localBundlerUrl = process.env.NEXT_PUBLIC_LOCAL_BUNDLER_URL
const bundlerUrl = localBundlerUrl || `https://api.pimlico.io/v1/sepolia/rpc?apikey=${apiKey}`
const chainId = caip10ChainId.split(':')[1]
const bundlerUrl = localBundlerUrl || `https://api.pimlico.io/v1/${chainId}/rpc?apikey=${apiKey}`
const bundlerClient = createBundlerClient({
entryPoint: ENTRYPOINT_ADDRESS_V07,
transport: http(bundlerUrl)
Expand Down Expand Up @@ -74,7 +75,7 @@ export async function approveEIP5792Request(requestEvent: RequestEventArgs) {
case EIP5792_METHODS.WALLET_GET_CALLS_STATUS: {
try {
const getCallParams = request.params[0] as GetCallsParams
const receipt = await getCallsReceipt(getCallParams)
const receipt = await getCallsReceipt(getCallParams, chainId)
return formatJsonRpcResult(id, receipt)
} catch (error: any) {
console.error(error)
Expand Down