Skip to content

completed the APIs and testing#7

Open
perperj-super wants to merge 1 commit intomasterfrom
integration
Open

completed the APIs and testing#7
perperj-super wants to merge 1 commit intomasterfrom
integration

Conversation

@perperj-super
Copy link
Copy Markdown
Owner

Description

  • Built APIs for interacting with smart contracts
  • Unit testing, integration testing, and e2e testing

Motivation and Context

  • Setup emulator account to test apis
  • Should satisfy all the test cases

API Endpoints

  • 1: Mint

    • This resolver should create an ExampleNFT on the blockchain and send it to our local development account (0x01cf0e2f2f715450).
      • Sample input:
        {
          "name": "A sample name.",
          "description": "A sample description."
          "thumbail": "A sample thumbnail."
        }
      • Sample output:
        {
          "transactionId": "e0b97916b821adc178390f075bb44bb6e42d0617ec2c51bf966f40506e79d690"
        }
  • 2: Find Many

    • This resolver should take an address as input and return all the NFTs owned by the address. If no address is specified, return all ExampleNFTs in our local account (0x01cf0e2f2f715450). Add pagination(defualt: 5 results per page).
      • Sample input:
        {
          "address": "0x01cf0e2f2f715450"
          
          // In your submission, feel free to add more fields for pagination. Example:
          // "limit": 5,
          // "offset": 0
        }
        
      • Sample output:
        {
          "data": [
            {
              "name": "<some string>",
              "description": "<some string>",
              "file": {
                "url": "<A fake URL>"
              }
            },
            ...
          ]
        }
  • 3: Find One

    • This resolver should take an address and NFT ID as input. It should check if the account has the NFT corresponding to the given ID and if it does it should return its metadata. If the NFT does not exist, it should return a 404 (Not Found) response. If no address is specified, use our local account (0x01cf0e2f2f715450). If no NFT ID is specified it should return a 400 (Bad Request) response.
      • Sample input:
        {
          "id": 0,
          "address": "0x01cf0e2f2f715450"
        }
        
      • Sample output:
        {
          "data": {
            "name": "<some string>",
            "description": "<some string>",
            "file": {
              "url": "<A fake URL>"
            }
          }
        }
  • 4: Burn

    • This resolver should take an NFT ID as input and delete the ExampleNFT with the corresponding ID from our development account (0x01cf0e2f2f715450).
      • Sample input:
        {
          // The ID of the NFT to transfer
          "id": 0
        }
      • Sample output:
        {
          "transactionId": "e0b97916b821adc178390f075bb44bb6e42d0617ec2c51bf966f40506e79d690"
        }
  • 5: Transfer

    • This resolver should transfer a specific ExampleNFT from our development account (0x01cf0e2f2f715450) to the specified address.
      • Sample input:
        {
          // The ID of the NFT to transfer
          "id": 0,
        
          // The address of the account that will receive the NFT
          "receiver": "0x01cf0e2f2f715450"
        }
      • Sample output:
        {
          "transactionId": "e0b97916b821adc178390f075bb44bb6e42d0617ec2c51bf966f40506e79d690"
        }

Testing requirements

  • In addition to code review please test this work in local development
  • Please check if our unit and integration tests cover all edge cases
  • Please check if our e2e tests cover all edge cases

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 this pull request may close these issues.

1 participant