fetchai / ledger-subquery

This is the Fetch Ledger SubQuery project, an indexer for the Fetch network.
MIT License
2 stars 10 forks source link

chore: promote account to primitive #230

Closed bryanchriswhite closed 1 year ago

bryanchriswhite commented 1 year ago

Rationale

In the graph of the current schema, the Account and Transaction entities could be sharing an edge as the Transaction entity already contains a signerAddress field which would accurately represent this as a foreign key. I think this is more accurate representation of the graph and increases ease of use of and reasoning about the API. I see two options to establish this edge:

  1. Using signerAddress directly as the foreign key
    • breaks convention in naming the field after the related model
    • is backwards incompatible (i.e. would have to be included in v1.x release if we wanted to do it)
  2. Add new field
    • duplicates account ID scaling with number of indexed transactions
    • can deprecate signerAddress in a future release
    • good excuse to prioritize putting a plan together for deprecation
      • it's likely going to be difficult to avoid entirely despite graphql's flexibility

Changes

Going for option 2:

Depends on / TODO

After #229 is merged, to rebase onto main run:

# assumes remote is named "origin", substitute if not
git fetch origin
git checkout chore/account-primitive
# assumes remote is named "origin", substitute if not
git rebase --onto origin/main origin/refactor/python-models chore/account-primitive
git push --force-with-lease origin chore/account-primitive

Code Review Checklist (to be filled out by reviewer)

bryanchriswhite commented 1 year ago

End-to-end tests passed at commit 812e9f3