toSmartContractAccount
Converts an account to a smart contract account and sets up various account-related methods using the provided parameters like transport, chain, entry point, and other utilities.
Import
Usage
Parameters
params
ToSmartContractAccountParams
the parameters required for converting to a smart contract account
params.transport
Transport
the transport mechanism used for communication
params.chain
Chain
the blockchain chain used in the account
params.entryPoint
EntryPoint
the entry point of the smart contract
params.source
string
the source identifier for the account
params.accountAddress
Address
the address of the account
params.getAccountInitCode
() => Promise<Hex>
a function to get the initial state code of the account
params.signMessage
(message: { message: SignableMessage }) => Promise<Hex>
a function to sign a message
params.signTypedData
(typedDataDefinition: TypedDataDefinition<typedData, primaryType>) => Promise<Hex>
a function to sign typed data
params.encodeBatchExecute
(transactions: Transaction[]) => Hex
a function to encode batch transactions
params.encodeExecute
(tx: Transaction) => Hex
a function to encode a single transaction
params.getDummySignature
() => Promise<Hex>
a function to get a dummy signature
params.signUserOperationHash
(uoHash: Hex) => Promise<Hex>
a function to sign user operations
params.encodeUpgradeToAndCall
(implementationAddress: Address, implementationCallData: Hex) => Hex
a function to encode upgrade call
Returns
Promise<SmartContractAccount>
a promise that resolves to a SmartContractAccount object with methods and properties for interacting with the smart contract account