# Registry

The registry is a singleton contract that serves as the entry point for all tokenbound account address queries.&#x20;

It allows for the deterministic calculation and deployment of Tokenbound Account addresses.

The full contract code of the Registry can be found [**here**](https://github.com/horuslabsio/TBA/blob/v3/src/registry/registry.cairo)**.**

## Functions

### `create_account`

```rust
fn create_account(
    ref self: ContractState,
    implementation_hash: felt252,
    token_contract: ContractAddress,
    token_id: u256,
    salt: felt252,
    chain_id: felt252
) -> ContractAddress
```

This function deploys a new Tokenbound Account for an NFT. It requires that the caller is the owner of the specific NFT.

#### Parameters

| Name                  | Type              | Description                                                                                       |
| --------------------- | ----------------- | ------------------------------------------------------------------------------------------------- |
| `implementation_hash` | `felt252`         | The class hash of the reference account                                                           |
| `token_contract`      | `ContractAddress` | The contract address of the NFT                                                                   |
| `token_id`            | `u256`            | The NFT token ID                                                                                  |
| `salt`                | `felt252`         | A random value that enforces the uniqueness of the deterministic address calculation for the TBA. |
| `chain_id`            | `felt252`         | The network/chain ID                                                                              |

**Returns:**&#x20;

* `account_address (ContractAddress)`: The deployed Tokenbound Account address for the provided NFT.

### `get_account`

```rust
fn get_account(
    self: @ContractState,
    implementation_hash: felt252,
    token_contract: ContractAddress,
    token_id: u256,
    salt: felt252,
    chain_id: felt252
) -> ContractAddress
```

This function calculates the address of a Tokenbound Account without deploying it. The account address is calculated deterministically using the provided contract address, token ID, and other parameters, meaning that the address will be the same each time for a given set of inputs.

#### Parameters

| Name                  | Type              | Description                                                                                      |
| --------------------- | ----------------- | ------------------------------------------------------------------------------------------------ |
| `implementation_hash` | `felt252`         | The class hash of AccountV3 (implementation contract)                                            |
| `token_contract`      | `ContractAddress` | The contract address of the NFT                                                                  |
| `token_id`            | `u256`            | The NFT token ID                                                                                 |
| `salt`                | `felt252`         | A random value that enforces the uniqueness of the deterministic address calculation for the TBA |
| `chain_id`            | `felt252`         | The Network/chain ID                                                                             |

**Returns:**&#x20;

* `account_address (ContractAddress)`: The calculated Tokenbound Account address for the provided NFT and parameters.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tbaexplorer.com/contracts/registry.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
