Skip to content
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

Add indexation AssetId -> (ContractId, SubId) #2425

Closed
xgreenx opened this issue Nov 10, 2024 · 0 comments · Fixed by #2445
Closed

Add indexation AssetId -> (ContractId, SubId) #2425

xgreenx opened this issue Nov 10, 2024 · 0 comments · Fixed by #2445
Assignees

Comments

@xgreenx
Copy link
Collaborator

xgreenx commented Nov 10, 2024

Definition of done

GraphQL provides a new endpoint that returns information about the asset like:

  • SubId
  • ContractId
  • Total amount in the network

Implementation details

First, we need to add a new indexation table into the off-chain database.

If the off chain worker sees Mint or Burn receipt, it indexes the information about sub id, contract id and updates total amount.

@maschad maschad self-assigned this Nov 18, 2024
AurelienFT added a commit that referenced this issue Jan 13, 2025
**Note:**
Please merge #2463 first

---

## Linked Issues/PRs
- Closes #2425

- Related to FuelLabs/fuels-ts#3373

- It's based on top of #2463
in order to have access to several mechanisms (like `IndexationError`)
implemented previously for other indexes.

## Description
<!-- List of detailed changes -->

This introduces a new GraphQL endpoint that returns info about an asset.
Similarly to other indexes, the asset metadata index is only available
when the client was started with no database and was able to sync from
scratch. If the index is not available, this endpoint will return an
error:
```
{
  "data": null,
  "errors": [
    {
      "message": "Asset metadata index is not available",
      "locations": [...],
    }
  ]
}
```

The off-chain worker indexes `Mint` and `Burn` events to store this
metadata about an `AssetId`.

## Checklist
- [x] New behavior is reflected in tests


### Before requesting review
- [x] I have reviewed the code myself

### After merging, notify other teams

[Add or remove entries as needed]

- [ ] [TS SDK](https://github.com/FuelLabs/fuels-ts/)

---------

Co-authored-by: Rafał Chabowski <[email protected]>
Co-authored-by: Green Baneling <[email protected]>
Co-authored-by: AurelienFT <[email protected]>
Co-authored-by: AurelienFT <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants