> For the complete documentation index, see [llms.txt](https://the-artist-xchange.gitbook.io/the-artist-xchange/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://the-artist-xchange.gitbook.io/the-artist-xchange/docs/twaccountrouter.md).

# TWAccountRouter

## Methods

### DEFAULT\_ADMIN\_ROLE

```solidity
function DEFAULT_ADMIN_ROLE() external view returns (bytes32)
```

#### Returns

| Name | Type    | Description |
| ---- | ------- | ----------- |
| \_0  | bytes32 | undefined   |

### EXTENSION\_ADMIN\_ROLE

```solidity
function EXTENSION_ADMIN_ROLE() external view returns (bytes32)
```

#### Returns

| Name | Type    | Description |
| ---- | ------- | ----------- |
| \_0  | bytes32 | undefined   |

### SIGNER\_ROLE

```solidity
function SIGNER_ROLE() external view returns (bytes32)
```

#### Returns

| Name | Type    | Description |
| ---- | ------- | ----------- |
| \_0  | bytes32 | undefined   |

### addDeposit

```solidity
function addDeposit() external payable
```

Deposit funds for this account in Entrypoint.

### addExtension

```solidity
function addExtension(IExtension.Extension _extension) external nonpayable
```

#### Parameters

| Name        | Type                 | Description |
| ----------- | -------------------- | ----------- |
| \_extension | IExtension.Extension | undefined   |

### contractURI

```solidity
function contractURI() external view returns (string)
```

Returns the contract metadata URI.

#### Returns

| Name | Type   | Description |
| ---- | ------ | ----------- |
| \_0  | string | undefined   |

### entryPoint

```solidity
function entryPoint() external view returns (contract IEntryPoint)
```

Returns the EIP 4337 entrypoint contract.

#### Returns

| Name | Type                 | Description |
| ---- | -------------------- | ----------- |
| \_0  | contract IEntryPoint | undefined   |

### execute

```solidity
function execute(address _target, uint256 _value, bytes _calldata) external nonpayable
```

Executes a transaction (called directly from an admin, or by entryPoint)

#### Parameters

| Name       | Type    | Description |
| ---------- | ------- | ----------- |
| \_target   | address | undefined   |
| \_value    | uint256 | undefined   |
| \_calldata | bytes   | undefined   |

### executeBatch

```solidity
function executeBatch(address[] _target, uint256[] _value, bytes[] _calldata) external nonpayable
```

Executes a sequence transaction (called directly from an admin, or by entryPoint)

#### Parameters

| Name       | Type       | Description |
| ---------- | ---------- | ----------- |
| \_target   | address\[] | undefined   |
| \_value    | uint256\[] | undefined   |
| \_calldata | bytes\[]   | undefined   |

### getAllExtensions

```solidity
function getAllExtensions() external view returns (struct IExtension.Extension[] allExtensions)
```

Returns all extensions stored. Override default lugins stored in router are given precedence over default extensions in DefaultExtensionSet.

#### Returns

| Name          | Type                    | Description |
| ------------- | ----------------------- | ----------- |
| allExtensions | IExtension.Extension\[] | undefined   |

### getAllFunctionsOfExtension

```solidity
function getAllFunctionsOfExtension(string _extensionName) external view returns (struct IExtension.ExtensionFunction[])
```

*Returns all functions that belong to the given extension contract.*

#### Parameters

| Name            | Type   | Description |
| --------------- | ------ | ----------- |
| \_extensionName | string | undefined   |

#### Returns

| Name | Type                            | Description |
| ---- | ------------------------------- | ----------- |
| \_0  | IExtension.ExtensionFunction\[] | undefined   |

### getDeposit

```solidity
function getDeposit() external view returns (uint256)
```

Returns the balance of the account in Entrypoint.

#### Returns

| Name | Type    | Description |
| ---- | ------- | ----------- |
| \_0  | uint256 | undefined   |

### getExtension

```solidity
function getExtension(string _extensionName) external view returns (struct IExtension.Extension)
```

*Returns the extension metadata and functions for a given extension.*

#### Parameters

| Name            | Type   | Description |
| --------------- | ------ | ----------- |
| \_extensionName | string | undefined   |

#### Returns

| Name | Type                 | Description |
| ---- | -------------------- | ----------- |
| \_0  | IExtension.Extension | undefined   |

### getExtensionForFunction

```solidity
function getExtensionForFunction(bytes4 _functionSelector) external view returns (struct IExtension.ExtensionMetadata)
```

*Returns the extension metadata for a given function.*

#### Parameters

| Name               | Type   | Description |
| ------------------ | ------ | ----------- |
| \_functionSelector | bytes4 | undefined   |

#### Returns

| Name | Type                         | Description |
| ---- | ---------------------------- | ----------- |
| \_0  | IExtension.ExtensionMetadata | undefined   |

### getExtensionImplementation

```solidity
function getExtensionImplementation(string _extensionName) external view returns (address)
```

*Returns the extension's implementation smart contract address.*

#### Parameters

| Name            | Type   | Description |
| --------------- | ------ | ----------- |
| \_extensionName | string | undefined   |

#### Returns

| Name | Type    | Description |
| ---- | ------- | ----------- |
| \_0  | address | undefined   |

### getImplementationForFunction

```solidity
function getImplementationForFunction(bytes4 _functionSelector) external view returns (address extensionAddress)
```

*Returns the extension implementation address stored in router, for the given function.*

#### Parameters

| Name               | Type   | Description |
| ------------------ | ------ | ----------- |
| \_functionSelector | bytes4 | undefined   |

#### Returns

| Name             | Type    | Description |
| ---------------- | ------- | ----------- |
| extensionAddress | address | undefined   |

### getRoleAdmin

```solidity
function getRoleAdmin(bytes32 role) external view returns (bytes32)
```

Returns the admin role that controls the specified role.

*See {grantRole} and {revokeRole}. To change a role's admin, use {\_setRoleAdmin}.*

#### Parameters

| Name | Type    | Description                                                  |
| ---- | ------- | ------------------------------------------------------------ |
| role | bytes32 | keccak256 hash of the role. e.g. keccak256("TRANSFER\_ROLE") |

#### Returns

| Name | Type    | Description |
| ---- | ------- | ----------- |
| \_0  | bytes32 | undefined   |

### getRoleMember

```solidity
function getRoleMember(bytes32 role, uint256 index) external view returns (address member)
```

Returns the role-member from a list of members for a role, at a given index.

*Returns `member` who has `role`, at `index` of role-members list. See struct {RoleMembers}, and mapping {roleMembers}*

#### Parameters

| Name  | Type    | Description                                                  |
| ----- | ------- | ------------------------------------------------------------ |
| role  | bytes32 | keccak256 hash of the role. e.g. keccak256("TRANSFER\_ROLE") |
| index | uint256 | Index in list of current members for the role.               |

#### Returns

| Name   | Type    | Description                        |
| ------ | ------- | ---------------------------------- |
| member | address | Address of account that has `role` |

### getRoleMemberCount

```solidity
function getRoleMemberCount(bytes32 role) external view returns (uint256 count)
```

Returns total number of accounts that have a role.

*Returns `count` of accounts that have `role`. See struct {RoleMembers}, and mapping {roleMembers}*

#### Parameters

| Name | Type    | Description                                                  |
| ---- | ------- | ------------------------------------------------------------ |
| role | bytes32 | keccak256 hash of the role. e.g. keccak256("TRANSFER\_ROLE") |

#### Returns

| Name  | Type    | Description                               |
| ----- | ------- | ----------------------------------------- |
| count | uint256 | Total number of accounts that have `role` |

### grantRole

```solidity
function grantRole(bytes32 role, address account) external nonpayable
```

Grants a role to an account, if not previously granted.

*Caller must have admin role for the `role`. Emits {RoleGranted Event}.*

#### Parameters

| Name    | Type    | Description                                                  |
| ------- | ------- | ------------------------------------------------------------ |
| role    | bytes32 | keccak256 hash of the role. e.g. keccak256("TRANSFER\_ROLE") |
| account | address | Address of the account to which the role is being granted.   |

### hasRole

```solidity
function hasRole(bytes32 role, address account) external view returns (bool)
```

Checks whether an account has a particular role.

*Returns `true` if `account` has been granted `role`.*

#### Parameters

| Name    | Type    | Description                                                  |
| ------- | ------- | ------------------------------------------------------------ |
| role    | bytes32 | keccak256 hash of the role. e.g. keccak256("TRANSFER\_ROLE") |
| account | address | Address of the account for which the role is being checked.  |

#### Returns

| Name | Type | Description |
| ---- | ---- | ----------- |
| \_0  | bool | undefined   |

### hasRoleWithSwitch

```solidity
function hasRoleWithSwitch(bytes32 role, address account) external view returns (bool)
```

Checks whether an account has a particular role; role restrictions can be swtiched on and off.

*Returns `true` if `account` has been granted `role`. Role restrictions can be swtiched on and off: - If address(0) has ROLE, then the ROLE restrictions don't apply. - If address(0) does not have ROLE, then the ROLE restrictions will apply.*

#### Parameters

| Name    | Type    | Description                                                  |
| ------- | ------- | ------------------------------------------------------------ |
| role    | bytes32 | keccak256 hash of the role. e.g. keccak256("TRANSFER\_ROLE") |
| account | address | Address of the account for which the role is being checked.  |

#### Returns

| Name | Type | Description |
| ---- | ---- | ----------- |
| \_0  | bool | undefined   |

### initialize

```solidity
function initialize(address _defaultAdmin, string _contractURI) external nonpayable
```

#### Parameters

| Name           | Type    | Description |
| -------------- | ------- | ----------- |
| \_defaultAdmin | address | undefined   |
| \_contractURI  | string  | undefined   |

### isValidSigner

```solidity
function isValidSigner(address _signer) external view returns (bool)
```

Returns whether a signer is authorized to perform transactions using the wallet.

#### Parameters

| Name     | Type    | Description |
| -------- | ------- | ----------- |
| \_signer | address | undefined   |

#### Returns

| Name | Type | Description |
| ---- | ---- | ----------- |
| \_0  | bool | undefined   |

### multicall

```solidity
function multicall(bytes[] data) external nonpayable returns (bytes[] results)
```

Receives and executes a batch of function calls on this contract.

*Receives and executes a batch of function calls on this contract.*

#### Parameters

| Name | Type     | Description                                                          |
| ---- | -------- | -------------------------------------------------------------------- |
| data | bytes\[] | The bytes data that makes up the batch of function calls to execute. |

#### Returns

| Name    | Type     | Description                                                                      |
| ------- | -------- | -------------------------------------------------------------------------------- |
| results | bytes\[] | The bytes data that makes up the result of the batch of function calls executed. |

### nonce

```solidity
function nonce() external view returns (uint256)
```

Returns the nonce of the account.

#### Returns

| Name | Type    | Description |
| ---- | ------- | ----------- |
| \_0  | uint256 | undefined   |

### onERC1155BatchReceived

```solidity
function onERC1155BatchReceived(address, address, uint256[], uint256[], bytes) external nonpayable returns (bytes4)
```

#### Parameters

| Name | Type       | Description |
| ---- | ---------- | ----------- |
| \_0  | address    | undefined   |
| \_1  | address    | undefined   |
| \_2  | uint256\[] | undefined   |
| \_3  | uint256\[] | undefined   |
| \_4  | bytes      | undefined   |

#### Returns

| Name | Type   | Description |
| ---- | ------ | ----------- |
| \_0  | bytes4 | undefined   |

### onERC1155Received

```solidity
function onERC1155Received(address, address, uint256, uint256, bytes) external nonpayable returns (bytes4)
```

#### Parameters

| Name | Type    | Description |
| ---- | ------- | ----------- |
| \_0  | address | undefined   |
| \_1  | address | undefined   |
| \_2  | uint256 | undefined   |
| \_3  | uint256 | undefined   |
| \_4  | bytes   | undefined   |

#### Returns

| Name | Type   | Description |
| ---- | ------ | ----------- |
| \_0  | bytes4 | undefined   |

### onERC721Received

```solidity
function onERC721Received(address, address, uint256, bytes) external nonpayable returns (bytes4)
```

*See {IERC721Receiver-onERC721Received}. Always returns `IERC721Receiver.onERC721Received.selector`.*

#### Parameters

| Name | Type    | Description |
| ---- | ------- | ----------- |
| \_0  | address | undefined   |
| \_1  | address | undefined   |
| \_2  | uint256 | undefined   |
| \_3  | bytes   | undefined   |

#### Returns

| Name | Type   | Description |
| ---- | ------ | ----------- |
| \_0  | bytes4 | undefined   |

### removeExtension

```solidity
function removeExtension(string _extensionName) external nonpayable
```

*Removes an existing extension from the router.*

#### Parameters

| Name            | Type   | Description |
| --------------- | ------ | ----------- |
| \_extensionName | string | undefined   |

### renounceRole

```solidity
function renounceRole(bytes32 role, address account) external nonpayable
```

Revokes role from the account.

*Caller must have the `role`, with caller being the same as `account`. Emits {RoleRevoked Event}.*

#### Parameters

| Name    | Type    | Description                                                  |
| ------- | ------- | ------------------------------------------------------------ |
| role    | bytes32 | keccak256 hash of the role. e.g. keccak256("TRANSFER\_ROLE") |
| account | address | Address of the account from which the role is being revoked. |

### revokeRole

```solidity
function revokeRole(bytes32 role, address account) external nonpayable
```

Revokes role from an account.

*Caller must have admin role for the `role`. Emits {RoleRevoked Event}.*

#### Parameters

| Name    | Type    | Description                                                  |
| ------- | ------- | ------------------------------------------------------------ |
| role    | bytes32 | keccak256 hash of the role. e.g. keccak256("TRANSFER\_ROLE") |
| account | address | Address of the account from which the role is being revoked. |

### setContractURI

```solidity
function setContractURI(string _uri) external nonpayable
```

Lets a contract admin set the URI for contract-level metadata.

*Caller should be authorized to setup contractURI, e.g. contract admin. See {\_canSetContractURI}. Emits {ContractURIUpdated Event}.*

#### Parameters

| Name  | Type   | Description                                                  |
| ----- | ------ | ------------------------------------------------------------ |
| \_uri | string | keccak256 hash of the role. e.g. keccak256("TRANSFER\_ROLE") |

### supportsInterface

```solidity
function supportsInterface(bytes4 interfaceId) external view returns (bool)
```

*See {IERC165-supportsInterface}.*

#### Parameters

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| interfaceId | bytes4 | undefined   |

#### Returns

| Name | Type | Description |
| ---- | ---- | ----------- |
| \_0  | bool | undefined   |

### updateExtension

```solidity
function updateExtension(IExtension.Extension _extension) external nonpayable
```

#### Parameters

| Name        | Type                 | Description |
| ----------- | -------------------- | ----------- |
| \_extension | IExtension.Extension | undefined   |

### validateUserOp

```solidity
function validateUserOp(UserOperation userOp, bytes32 userOpHash, uint256 missingAccountFunds) external nonpayable returns (uint256 validationData)
```

#### Parameters

| Name                | Type          | Description |
| ------------------- | ------------- | ----------- |
| userOp              | UserOperation | undefined   |
| userOpHash          | bytes32       | undefined   |
| missingAccountFunds | uint256       | undefined   |

#### Returns

| Name           | Type    | Description |
| -------------- | ------- | ----------- |
| validationData | uint256 | undefined   |

### withdrawDepositTo

```solidity
function withdrawDepositTo(address payable withdrawAddress, uint256 amount) external nonpayable
```

Withdraw funds for this account from Entrypoint.

#### Parameters

| Name            | Type            | Description |
| --------------- | --------------- | ----------- |
| withdrawAddress | address payable | undefined   |
| amount          | uint256         | undefined   |

## Events

### ContractURIUpdated

```solidity
event ContractURIUpdated(string prevURI, string newURI)
```

#### Parameters

| Name    | Type   | Description |
| ------- | ------ | ----------- |
| prevURI | string | undefined   |
| newURI  | string | undefined   |

### ExtensionAdded

```solidity
event ExtensionAdded(address indexed extensionAddress, bytes4 indexed functionSelector, string functionSignature)
```

#### Parameters

| Name                       | Type    | Description |
| -------------------------- | ------- | ----------- |
| extensionAddress `indexed` | address | undefined   |
| functionSelector `indexed` | bytes4  | undefined   |
| functionSignature          | string  | undefined   |

### ExtensionRemoved

```solidity
event ExtensionRemoved(address indexed extensionAddress, bytes4 indexed functionSelector, string functionSignature)
```

#### Parameters

| Name                       | Type    | Description |
| -------------------------- | ------- | ----------- |
| extensionAddress `indexed` | address | undefined   |
| functionSelector `indexed` | bytes4  | undefined   |
| functionSignature          | string  | undefined   |

### ExtensionUpdated

```solidity
event ExtensionUpdated(address indexed oldExtensionAddress, address indexed newExtensionAddress, bytes4 indexed functionSelector, string functionSignature)
```

#### Parameters

| Name                          | Type    | Description |
| ----------------------------- | ------- | ----------- |
| oldExtensionAddress `indexed` | address | undefined   |
| newExtensionAddress `indexed` | address | undefined   |
| functionSelector `indexed`    | bytes4  | undefined   |
| functionSignature             | string  | undefined   |

### Initialized

```solidity
event Initialized(uint8 version)
```

#### Parameters

| Name    | Type  | Description |
| ------- | ----- | ----------- |
| version | uint8 | undefined   |

### RoleAdminChanged

```solidity
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)
```

#### Parameters

| Name                        | Type    | Description |
| --------------------------- | ------- | ----------- |
| role `indexed`              | bytes32 | undefined   |
| previousAdminRole `indexed` | bytes32 | undefined   |
| newAdminRole `indexed`      | bytes32 | undefined   |

### RoleGranted

```solidity
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)
```

#### Parameters

| Name              | Type    | Description |
| ----------------- | ------- | ----------- |
| role `indexed`    | bytes32 | undefined   |
| account `indexed` | address | undefined   |
| sender `indexed`  | address | undefined   |

### RoleRevoked

```solidity
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)
```

#### Parameters

| Name              | Type    | Description |
| ----------------- | ------- | ----------- |
| role `indexed`    | bytes32 | undefined   |
| account `indexed` | address | undefined   |
| sender `indexed`  | address | undefined   |
