fastnear / fastnear-api-server-rs

23 stars 4 forks source link

V1 api #3

Closed evgenykuzyakov closed 6 months ago

evgenykuzyakov commented 6 months ago

Introduce V1 API endpoint

In API V1, the API endpoints provide extra details about the contracts. E.g. the block height when the last change was made on a contract that affected a given account.

Account ID to fungible tokens (FT contracts).

Returns the list of fungible tokens (FT) contracts that the account has interacted with or received, including the block height when the last change was made on the contract that affected this given account.

Note, if the last_update_block_height is null, then no recent updates were made.

GET /v1/account/{account_id}/ft

Example: https://api.fastnear.com/v1/account/here.near/ft

curl https://api.fastnear.com/v1/account/here.near/ft

Result:

{
  "account_id": "here.tg",
  "tokens": [
    {
      "contract_id": "game.hot.tg",
      "last_update_block_height": 115041262
    },
    {
      "contract_id": "usdt.tether-token.near",
      "last_update_block_height": null
    }
  ]
}

Account ID to non-fungible tokens (NFT contracts).

Returns the list of non-fungible tokens (NFT) contracts that the account has interacted with or received, including the block height when the last change was made on the contract that affected this given account.

Note, if the last_update_block_height is null, then no recent updates were made.

GET /v1/account/{account_id}/nft

Example: https://api.fastnear.com/v1/account/sharddog.near/nft

curl https://api.fastnear.com/v1/account/sharddog.near/nft

Result:

{
  "account_id": "sharddog.near",
  "tokens": [
    {
      "contract_id": "mint.sharddog.near",
      "last_update_block_height": 115034954
    },
    {
      "contract_id": "open.sharddog.near",
      "last_update_block_height": null
    },
    {
      "contract_id": "humansofbrazil.sharddog.near",
      "last_update_block_height": null
    },
    {
      "contract_id": "nft.bluntdao.near",
      "last_update_block_height": null
    },
    {
      "contract_id": "ndcconstellationnft.sharddog.near",
      "last_update_block_height": null
    },
    {
      "contract_id": "mmc.sharddog.near",
      "last_update_block_height": null
    },
    {
      "contract_id": "nft.genadrop.near",
      "last_update_block_height": null
    },
    {
      "contract_id": "harvestmoon.sharddog.near",
      "last_update_block_height": null
    },
    {
      "contract_id": "comic.sharddog.near",
      "last_update_block_height": 114988538
    },
    {
      "contract_id": "meteor.sharddog.near",
      "last_update_block_height": null
    },
    {
      "contract_id": "nstreetwolves.near",
      "last_update_block_height": null
    },
    {
      "contract_id": "starpause.mintbase1.near",
      "last_update_block_height": null
    },
    {
      "contract_id": "rubenm4rcusstore.mintbase1.near",
      "last_update_block_height": null
    },
    {
      "contract_id": "rogues-genesis.nfts.fewandfar.near",
      "last_update_block_height": null
    },
    {
      "contract_id": "nft.regens.near",
      "last_update_block_height": null
    },
    {
      "contract_id": "mmc-mint.sharddog.near",
      "last_update_block_height": null
    },
    {
      "contract_id": "badges.devhub.near",
      "last_update_block_height": null
    },
    {
      "contract_id": "secretnft.devhub.near",
      "last_update_block_height": null
    },
    {
      "contract_id": "giveaway.mydev.near",
      "last_update_block_height": null
    },
    {
      "contract_id": "mintv2.sharddog.near",
      "last_update_block_height": 114973604
    },
    {
      "contract_id": "nearvidia.sharddog.near",
      "last_update_block_height": null
    },
    {
      "contract_id": "claim.sharddog.near",
      "last_update_block_height": 115039779
    }
  ]
}