Skip to content

Commit

Permalink
Merge pull request #163 from pimlicolabs/reduce-chainid-call
Browse files Browse the repository at this point in the history
use client's chain id if possible
  • Loading branch information
plusminushalf authored Apr 10, 2024
2 parents 8e154cf + 9cb81f6 commit 7057b1a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/silent-candles-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"permissionless": patch
---

Performance improvement - reduced network call for chain id
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export async function signerToBiconomySmartAccount<
fallbackHandlerAddress,
index
}),
getChainId(client)
client.chain?.id ?? getChainId(client)
])

if (!accountAddress) throw new Error("Account address not found")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export async function signerToEcdsaKernelSmartAccount<
deployedAccountAddress,
factoryAddress
}),
getChainId(client)
client.chain?.id ?? getChainId(client)
])

if (!accountAddress) throw new Error("Account address not found")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ export async function signerToSafeSmartAccount<
setupTransactions = []
}: SignerToSafeSmartAccountParameters<entryPoint, TSource, TAddress>
): Promise<SafeSmartAccount<entryPoint, TTransport, TChain>> {
const chainId = await getChainId(client)
const chainId = client.chain?.id ?? (await getChainId(client))

const viemSigner: LocalAccount = {
...signer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export async function signerToSimpleSmartAccount<
owner: viemSigner.address,
index
}),
getChainId(client)
client.chain?.id ?? getChainId(client)
])

if (!accountAddress) throw new Error("Account address not found")
Expand Down

0 comments on commit 7057b1a

Please sign in to comment.