Skip to content

Commit

Permalink
Merge pull request #176 from pimlicolabs/fix/#175
Browse files Browse the repository at this point in the history
Add eth_accounts as a fallback
  • Loading branch information
plusminushalf authored Apr 19, 2024
2 parents 3b8d9af + 597013e commit e687e75
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/thin-eagles-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"permissionless": patch
---

Added eth_accounts as a fallback in providerToSmartAccountSigner
6 changes: 3 additions & 3 deletions packages/permissionless/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import {
createBundlerClient
} from "./clients/createBundlerClient"
import { createSmartAccountClient } from "./clients/createSmartAccountClient"
import {
type SmartAccountClient,
type SmartAccountClientConfig
import type {
SmartAccountClient,
SmartAccountClientConfig
} from "./clients/createSmartAccountClient"
import type { BundlerActions } from "./clients/decorators/bundler"
import { bundlerActions } from "./clients/decorators/bundler"
Expand Down
10 changes: 9 additions & 1 deletion packages/permissionless/utils/providerToSmartAccountSigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ export const providerToSmartAccountSigner = async (
) => {
let account: Hex
if (!params) {
;[account] = await provider.request({ method: "eth_requestAccounts" })
try {
;[account] = await provider.request({
method: "eth_requestAccounts"
})
} catch {
;[account] = await provider.request({
method: "eth_accounts"
})
}
} else {
account = params.signerAddress
}
Expand Down

0 comments on commit e687e75

Please sign in to comment.