Docs

Account

import "@thirdweb-dev/contracts/smart-wallet/non-upgradeable/Account.sol";

This contract inherits from the BaseAccount contract.

The Account smart wallet is a non-upgradable, simple smart wallet that comes with all the basic benefits of account abstraction, alongside the default features:

  • Have multiple owners
  • Execute transactions (single and batched).
  • Send and receive native tokens.
  • Send and receive ERC-721 and ERC-1155 NFTs.
  • Multicall-able.
  • Store contract metadata.

Developers should use this wallet if they do not anticipate making any future upgrades to their users’ wallets.

App developers can issue Account smart wallets programmatically by deploying an AccountFactory smart contract.

View on GitHub

Detected Extensions

Once deployed, you can use the features made available by these extensions on the SDK and dashboard:

Click on each feature to learn more about what functions are available.

Usage

Import the contract and inherit from it. This is an example contract demonstrating one way that you could override the functionality to create a token bound account.

import "@thirdweb-dev/contracts/smart-wallet/non-upgradable/Account.sol";
import "@thirdweb-dev/contracts/eip/interface/IERC721.sol";

contract TokenBoundAccount is Account {
    uint256 chainId;
    address tokenContract;
    uint256 tokenId;

    constructor(
        IEntryPoint _entrypoint,
        address _factory
    ) Account(_entrypoint, _factory) {
        _disableInitializers();
    }

    function isValidSigner(
        address _signer
    ) public view override returns (bool) {
        return (isOwner(_signer));
    }

    function isOwner(address _signer) public view returns (bool) {
        if (chainId != block.chainid) {
            revert("Invalid chainId");
        }
        return _signer == IERC721(tokenContract).ownerOf(tokenId);
    }

    function initialize(
        address _admin,
        bytes calldata _data
    ) public override initializer {
        super.initialize(_admin);
        (chainId, tokenContract, tokenId) = abi.decode(
            _data,
            (uint256, address, uint256)
        );
    }
}

Functions to Override

The following functions have been implemented on this contract & are available to be overridden to add custom logic: