-
Notifications
You must be signed in to change notification settings - Fork 79
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
Fix/state issue #180
Fix/state issue #180
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewed
@@ -67,6 +67,7 @@ export type SmartAccountState = { | |||
isDeployed: boolean // chain specific | |||
entryPointAddress: string // chain specific? | |||
implementationAddress: string | |||
factoryAddress: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did we have to add this? does this impact anywhere else when this is being used, since it's not optional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initializeContracts function now requires SmartAccountState instead of ISmartAccount. It's necessary to include the factoryAddress field in SmartAccountState, previously required in ISmartAccount. This change doesn't cause any issues because the factoryAddress is only set in the getAddress function, which has the needed information.
@@ -46,6 +48,7 @@ import { JsonRpcProvider, Provider, Web3Provider } from '@ethersproject/provider | |||
import { IRelayer, RestRelayer, FallbackRelayer, IFallbackRelayer } from '@biconomy/relayer' | |||
import * as _ from 'lodash' | |||
import TransactionManager, { | |||
getSmartWalletFactoryContract, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getSmartWalletFactoryContract is directly exported from transactions package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've taken out a step that used to get account information (getSmartAccountByOwner API) and we now get an address directly from the factory contract instead. To do this, we need to create a factory instance within the getAddress function, which is why we need to bring this function over from the transaction package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
// // } | ||
|
||
// if (isFallbackEnabled) { | ||
// return this.sendFallbackTransaction(transactionDto) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's remove this whole method also
this.sendFallbackTransaction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved
@@ -8,5 +8,6 @@ export default TransactionManager | |||
export * from './AccountUtils' | |||
export * from './Execution' | |||
export * from './MultiSend' | |||
export * from './utils/FetchContractsInfo' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see
@@ -483,7 +483,7 @@ class TransactionManager { | |||
const connectedWallet = smartAccountState.address | |||
walletContract = walletContract.attach(connectedWallet) | |||
|
|||
const isDeployed = smartAccountState.isDeployed | |||
const isDeployed = await this.contractUtils.isDeployed(chainId, smartAccountState.address) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is this reflected / needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, the batching function decided whether to fetch the nonce from the proxy or just use 0 based on the value of smartAccountState.isDeployed. If a new transaction was sent before resetting the SDK, right after deploying the wallet, this could lead to an invalid nonce error.
@@ -52,7 +52,7 @@ class ContractUtils { | |||
initializeContracts( | |||
signer: Signer, | |||
readProvider: ethers.providers.JsonRpcProvider, | |||
walletInfo: ISmartAccount, | |||
walletInfo: SmartAccountState, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what was the type earlier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ISmartAccount same as returned by getSmartAccountByOwner. This function called initializeContracts is set up using data we get from getSmartAccountByOwner api consumption.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's merge and pass it on to QA
This PR has following changes