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

feat: new function to update token metadata on s3 #174

Merged
merged 17 commits into from
Jul 20, 2022
Merged

Conversation

tuliomir
Copy link
Contributor

@tuliomir tuliomir commented Jun 20, 2022

This PR aims to build a new route with the functionality to update the token metadata on S3.

It is a dependency of HathorNetwork/hathor-wallet-service#235, which listens to new transactions, identifies NFT's and calls the explorer-service lambda to create/update the S3 metadata for them.

Acceptance Criteria

  • Should have a new lambda put_dag_metadata_handler receiving the token's metadata as a JSON on the payload

@tuliomir tuliomir added the enhancement New feature or request label Jun 20, 2022
@tuliomir tuliomir self-assigned this Jun 20, 2022
@tuliomir tuliomir requested a review from pedroferreira1 July 4, 2022 12:14
@tuliomir tuliomir marked this pull request as ready for review July 4, 2022 12:14
@tuliomir tuliomir requested a review from r4mmer as a code owner July 4, 2022 12:14
serverless.yml Show resolved Hide resolved
serverless.yml Outdated
@@ -23,6 +23,10 @@ provider:
- ${env:AWS_SUBNET_ID_1}
- ${env:AWS_SUBNET_ID_2}
- ${env:AWS_SUBNET_ID_3}
apiGateway:
apiKeys:
- name: updateS3Key
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the stage on the apikey name.
This will make serverless create a different apikey for each stage (like described here).

And should the apikey be an updateS3Key or should we name it like an admin key?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a recent design change, this functionality will be used directly via lambda call, bypassing the apiGateway. So the keys were removed.

serverless.yml Outdated
@@ -71,6 +75,7 @@ custom:
s3:
host: localhost
directory: /tmp
buckets: hathor-explorer-metadata-dev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dev? Why not hathor-explorer-metadata?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was changed on e5ba6ac to use the METADATA_BUCKET environment variable, changing with the run context.

@tuliomir tuliomir requested a review from r4mmer July 18, 2022 00:17
Comment on lines -287 to +288
handler: handlers/get_dag_metadata_handler.handle
handler: handlers/dag_metadata_handler.handle_get
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: the get_dag_metadata_handler.py file was renamed to dag_metadata_handler.py to accomodate both the get and put operations on S3.

handlers/dag_metadata_handler.py Outdated Show resolved Hide resolved
usecases/metadata.py Outdated Show resolved Hide resolved
usecases/metadata.py Outdated Show resolved Hide resolved
gateways/metadata_gateway.py Show resolved Hide resolved
@pedroferreira1 pedroferreira1 self-requested a review July 20, 2022 11:31
@pedroferreira1 pedroferreira1 requested a review from r4mmer July 20, 2022 11:32
@tuliomir tuliomir merged commit 966751d into dev Jul 20, 2022
@tuliomir tuliomir deleted the feat/update-token-s3 branch July 20, 2022 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants