Skip to content
This repository has been archived by the owner on Mar 2, 2023. It is now read-only.

Step 3: Claim 100 CCD #6

Open
jatitoam opened this issue Feb 23, 2023 · 0 comments
Open

Step 3: Claim 100 CCD #6

jatitoam opened this issue Feb 23, 2023 · 0 comments
Assignees
Milestone

Comments

@jatitoam
Copy link
Contributor

jatitoam commented Feb 23, 2023

Add a new /preregistration/claimccd/:account?signature=<signature> (PUT) endpoint to claim 100 CCD and have it transferred from a main account to the account in the query.

Validations should be returning using 4xx error and a json document:

{
   "error": "<specific error>"
}

Validations:

  • Account in invalid format (regex): 406
  • Account not found in the preregistration collection AND in the account collection (it needs to be in both): 404
  • Signature not sent: 406
  • Signature not base64: 406
  • Unencoded signature not json format: 406
  • Validation fails (using concordium-sdk): 403
  • Preregistration document has a 100ccd field with value true: 406
  • 1000 or more preregistration documents have a 100ccd field with value true: 406

Important:

After signature verification (using concordium-sdk) the nonce needs to be cleared in the account document to invalidate it (if validation passes or fails).

Procedure:

If all validations pass, two things need to happen:

  1. 100 CCD need to be transferred from a main account (stored in the .env file with its private key) to the account sent and validated in the API query: https://github.com/Concordium/concordium-node-sdk-js/tree/main/packages/common#create-a-simple-transfer
  2. Once the transfer has been confirmed (wait and confirm until the transaction block has completely succeeded), update the preregistration document belonging to the account and add a 100ccd field with value true.

If any of those 2 steps fail, send a 500 http code.

If everything succeeds, return a 201 http code:

{
   "result": "true"
}
@jatitoam jatitoam converted this from a draft issue Feb 23, 2023
@CongThuong CongThuong moved this from Todo to In Progress in Web3 pre-registration Feb 24, 2023
CongThuong pushed a commit to CongThuong/web3-id-preregistration-backend that referenced this issue Feb 24, 2023
CongThuong pushed a commit to CongThuong/web3-id-preregistration-backend that referenced this issue Feb 24, 2023
@CongThuong CongThuong moved this from In Progress to Awaiting review in Web3 pre-registration Feb 24, 2023
@CongThuong CongThuong moved this from Awaiting review to Todo in Web3 pre-registration Feb 25, 2023
@jatitoam jatitoam added this to the Testnet beta milestone Feb 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Development

No branches or pull requests

2 participants