Git Product home page Git Product logo

mx-api-service's Introduction

Unified REST API facade for providing data related to the Multiversx blockchain.

Quick start

  1. Run npm install in the project directory
  2. Optionally make edits to config.yaml or create config.custom.yaml
  3. Run npm run init in the project directory (to create default plugins structure)

Dependencies

  1. Redis Server is required to be installed docs.
  2. MySQL Server is required to be installed docs. This can be avoided by adding in the config file the following: database.enabled: false.
  3. MongoDB Server is required to be installed docs. This can be avoided by adding in the config file the following: database.enabled: false.
  4. ffmpeg is required to be installed docs.

You can use docker-compose up in a separate terminal to use a local docker container for all these dependencies.

After running the sample, you can stop the Docker container with docker-compose down

Available Scripts

This is an Multiversx project built on Nest.js framework.

npm run start:prod

​ Runs the app in the production mode. Make requests to http://localhost:3001.

Running the app

# development watch mode
$ npm run start:watch

# development debug mode
$ npm run start:debug

# development mode
$ npm run start:dev

# production mode
$ npm run start:prod

Requests can be made to http://localhost:4001. The app will reload when you'll make edits (if opened in watch mode). You will also see any lint errors in the console.​

npm run test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

It depends on the following external systems:

It uses on the following internal systems:

  • redis: used to cache various data, for performance purposes
  • rabbitmq: pub/sub for sending mainly NFT process information from the transaction processor instance to the queue worker instance

An API instance can be started with the following behavior:

  • public API: provides REST API for the consumers
  • private API: used to report prometheus metrics & health checks
  • transaction processor & completed: fetches real-time transactions & logs from the blockchain; takes action based on various events, such as clearing cache values and publishing events on a queue
  • cache warmer: used to proactively fetch data & pushes it to cache, to improve performance & scalability
  • elastic updater: used to attach various extra information to items in the elasticsearch, for not having to fetch associated data from other external systems when performing listing requests
  • events notifier: perform various decisions based on incoming logs & events

It depends on the following optional external systems:

  • events notifier rabbitmq: queue that pushes logs & events which are handled internally e.g. to trigger NFT media fetch
  • data: provides EGLD price information for transactions
  • xexchange: provides price information regarding various tokens listed on the xExchange
  • ipfs: ipfs gateway for fetching mainly NFT metadata & media files
  • media: ipfs gateway which will be used as prefix for NFT media & metadata returned in the NFT details
  • media internal: caching layer for ipfs data to fetch from a centralized system such as S3 for performance reasons
  • AWS S3: used to process newly minted NFTs & uploads their thumbnails
  • github: used to fetch provider profile & node information from github

It uses the following optional internal systems:

  • mysql database: used to store mainly NFT media & metadata information
  • mongo database: used to store mainly NFT media & metadata information

mx-api-service's People

Contributors

adrianscanteie avatar alexandrupislariu avatar andrei-x1 avatar berciuliviu avatar bogdan-rosianu avatar cfaur09 avatar constantintovisi avatar cristianfodor avatar dragos-rebegea avatar filipbaciiu avatar florincoz avatar gabrielmatei avatar gfusee avatar johnykes avatar mihaieremia avatar ramonalobont avatar tanghel avatar vladbucur1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mx-api-service's Issues

Search in data object on transactions API doesn't work

Hi guys. Please enlighten me :)

I'm calling this endpoint /tokens/{identifier}/transactions/ and I want to filter the results on an action name (buyNft). To do this I'm adding the search parameter, like this /tokens/{identifier}/transactions/?search=buyNft - when I do this, no results are returned. I've also tried encoding the parameter and I get the same end result - nothing is displayed.

Am I doing this wrong or is filtering using the search parameter broken?

please add a license

There is no license that grants persons to use the code in this repository.

No License

When you make a creative work (which includes code), the work is under exclusive copyright by default. Unless you include a license that specifies otherwise, nobody else can copy, distribute, or modify your work without being at risk of take-downs, shake-downs, or litigation. Once the work has other contributors (each a copyright holder), “nobody” starts including you.

ESDTTransfer information not completely displayed.

Looking at this txHash: 1ddabee0be2e5542e4564d9463974bf310a805e51d2a08486f2719064e417b1d on the devnet, you will notice that getting the /transactions/{txHash} endpoint does not include the tokenIdentifier and tokenValue fields of the response.

Similarly, the value transferred in that transaction is not reflected on the receiver's balance.

sum aggregation

Hi.

I'm trying to calculate the sum of all transactions of a certain type.
(Basically i filter the transactions by the data field and i want the sum of the 'value' field)
Buy i'm receiving the following error.

Any idea?

2022-04-10 19 54 49

Token Identifier != Ticker

For ESDTs like AERO/RIDE/WEGLD/LKMEX the API returns the Token Identifier and the Ticker correctly.
For a lot of other ESDTs both Testnet and Mainnet (tested by me) the Token Identifier is EQUAL to Ticker which is not correct and needs to be manipulated by the developers (even when using elrond-sdks (C# tested)).

[BUG] royalties missing from GET /nfts/{indentifier}

Retrieving an NFT via it's identifier using the /nfts/{identifier} route does not return a royalties property as stated in the model.

Example Call:
https://devnet-api.elrond.com/nfts/KEOUF-b9f0a9-01

Note that there is no royalties on the received model.

LKMEX vs LP LKMEX-EGLD

Hello, it's not necessary an issue but I couldn't find anything related to how you make the difference between these 2. They share the same collection, the same difference is the attributes property.

Is it a bug? Even though in maiar.exchange it sets them correctly.

A reference on how I could distinguish them would be awesome. Couldn't find anything in docs.elrond.com

image

https://api.elrond.com/accounts/erd1793tlju2h2ps3f5klqy3rkyj88h9njgx40ys5pkyz0cufhecxhrsenyyam/nfts?collections=EGLDMEXF-5bcc57,EGLDUSDCF-8600f8,MEXFARM-e7af52,EGLDMEXF-a4d81e,EGLDUSDCF-e3e01e,MEXFARM-5d1dbb,EGLDRIDEF-6c5d7c,EGLDMEXFL-ef2065,EGLDUSDCFL-f0031c,MEXFARML-28d646,EGLDRIDEFL-74b819,MEXRIDEF-bf0320,METARIDE-a68897,METARIDELK-bd8cda,LKFARM-9d1ea8&size=600

Thanks in advance.

Keep up the good work! :D

/transactions/{txHash} and /transaction?withOperations=true shows different amount of data

Hi guys,
I have noticed an issue.
Are there any differences between these two methods in terms of information about transaction?

/transaction/{txHash} 

and

/transaction?miniBlockHash=hash?withLogs=true?withOperations=true?withScResults=true

The problem is when I use the first method, it returns 22 amount of the operations, but the second one returns 25.
I use this transaction: 89467b8d941a8b1db9b4e97a77b245f4ec3eed4b92bcf6723c447b629e49f4d9

Please, take a look:
@tanghel

https://api.elrond.com/transactions?withLogs=true&withOperations=true&withScResults=true&miniBlockHash=d7fbec5a0ab83202804d7667daeb9c6f133dbffe465042379ff764f63ae7b5aa
https://api.elrond.com/transactions/89467b8d941a8b1db9b4e97a77b245f4ec3eed4b92bcf6723c447b629e49f4d9

Possible to use DOTENV for Continuous Deployment Services

Hello,

I would like to use this repo with a continuous deployments service which means I can not directly configure the configurations on the server because it gets overwrited.

Is it possible to do at the moment to use DOTENV environment variables?

Thank you :)

endpoint /transactions with after query param doesn't work as expected

Hello,

I was trying to filter nft transactions on devnet after a certain timestamp using the after query param

https://devnet-api.elrond.com/transactions?after=1621677797000&status=success&token=DTST-32dcad-04 returns no results even though https://devnet-explorer.elrond.com/transactions/64a08821f9b5fa731d0931c4214a28000c4f1a9ef6adc716b02ca248999bb03c the transaction is after the provided timestamp.

If I remove the after parameter: https://devnet-api.elrond.com/transactions?status=success&token=DTST-32dcad-04 the endpoint works as expected.

I need the after parameter to not recalculate the same transactions with subsequent snapshots. Am I missing something ?

Thanks @tanghel

/accounts/{address}/nfts/count endpoint error

‘collections’ field returns an unexpected number of NFTs

Details (DevNet):
Wallet NFTs:

  1. OAGNFT-c14676: 92x SFTs
  2. TECOL-9f6df5: 5x NFTs
    Query:
    https://devnet-api.elrond.com/accounts/erd16nlhrnlm30qkpy8q52u95aaw0gjtx33xmlp62g5p4kj4mje04drq5y2tlw/nfts/count?collections=TECOL-9f6df5
    returns 6 and should return 5.

Other details:
https://devnet-api.elrond.com/accounts/erd16nlhrnlm30qkpy8q52u95aaw0gjtx33xmlp62g5p4kj4mje04drq5y2tlw/nfts?collections=TECOL-9f6df5
This returns an array with 5 NFTs which is correct.

Differences in metadata and media generated on the NFT responses

I wonder why there are differences between responses on NFTs even in the same collection. Let's take two NFTs from the same collection on the devnet. This one is ok.

https://devnet-explorer.elrond.com/nfts/EROBOT-251416-12

As you can see, it has a proper media object and a proper metadata object. This is why there is a preview when hovering over the assets.

But this one doesn't have that:

https://devnet-explorer.elrond.com/nfts/EROBOT-251416-0d

The media object has default values, and there is no metadata object at all.

They are from the same collection. The base CID is also the same: QmeDxANT39K8UgQo4FXQxJGJYDXMUXggMVTMcUAZznNs6q

I've tried many combinations using CIDs without the file name, using CID v0 and v1, and I can't find the rule for that.
Is this a known bug, or do I not get something?

API returning duplicate values for straight forward queries

1/
https://api.elrond.com/accounts/erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8/nfts?collection=WARRIORZ-2f0986&from=0&size=10000
this query returns -> 1953 nfts and if we group by identifiers I get 1941 (at this moment). This should not happen.

2/
Querying elastricsearch I get some results like this, with "pending" showing for _id and address. What are these because the NFT is not in any pending transaction when I look in explorer?
{
"_index": "accountsesdt-000001",
"_type": "_doc",
"_id": "pending-erd1p6ycskykk7ygp5mukpn9f5fyjy6vjft4jxt9x93g9372k8y0x7jq902wmr-WARRIORZ-2f0986-1944",
"_score": 13.246108,
"_source": {
"address": "pending-erd1p6ycskykk7ygp5mukpn9f5fyjy6vjft4jxt9x93g9372k8y0x7jq902wmr",
"balance": "1",
"balanceNum": 0,
"token": "WARRIORZ-2f0986",
"identifier": "WARRIORZ-2f0986-1944",
"tokenNonce": 6468
}
}

Thank you!

Owner missing from API call

If I try to call the following
https://api.elrond.com/nfts?from=0&size=1&withOwner=true&type=NonFungibleESDT - with from=0 I get the owner
On the other side if I call
https://api.elrond.com/nfts?from=1&size=1&withOwner=true&type=NonFungibleESDT - with from=1 ( or whatever number other then 0 ) I do not get the owner

Also does not work with collection code. I've tried with ESCU-ee0923

Account SC results endpoint not working properly.

The "/accounts/

/sc-results" endpoint does is not working properly.

image

In this image you can see that the receiver of the transaction is "erd14ud93aymz9u6f3vy4k3l9hsw4sdc9sc5hjvwtjhazfs6dake982sn94twp"

The transaction hash is "dfa70a468088caba3dfb743015c48f9f1dad689805f139caec38c8a6ad006247".

But as you can see, the hash is not in the sc-results.

image

I want to mention that the code that uses this endpoint works perfectly on the devnet and testnet.

I want to be able to get NFTs/Collections by Name

Hello,

I'm trying to return some NFTs and Collections from your API by the Name field and I see no way to do that.
I need to have that functionality in order to have a search working for my UI.

Can you add a new query string param that would return all nfts/collections that have in the name a specified string?

Ex: when I call https://devnet-api.elrond.com/nfts?name="asd" I get all NFTs that have NFT.Name.Contains("asd") == true

Split Data vs API

Hello! :)

The type definitions (types in "entities" folders (nft, account, etc...)) are usefull when we make request to the api.
It must be separated to another repository/npm so we can use type without importing the whole api.elrond.com framework.

ex:

import { Account } from "@elrondnetwork/api-types"

const accounts:Account[] = await axios.get("https://api.elrond.com/accounts").data;

Thanks in advance! ;)

Théo

Impossible to fetch larger NFT accounts due to API limitations

Hey guys,

I'm hosting an NFT explorer and because of your API it is impossible for me to make it right. Let me show you what I mean:

I would like to fetch people's NFTs lazy/in batches using the from parameter in /accounts/{address}/nfts. However, the from parameter isn't working, as seen in this images:
Bildschirmfoto von 2022-02-24 13-24-41
Bildschirmfoto von 2022-02-24 13-24-51

As you can see, from does not change anything about the result. This is the main issue. Here is the address I used.

That's why I decided that there is no way around but fetching everything at once (and splitting result on the frontend) for my use case.

But even there is an error. Currently, one can fetch at most 621 NFTs of somebody at a time:
Bildschirmfoto von 2022-02-24 13-36-42
Bildschirmfoto von 2022-02-24 13-36-49

Everything larger results in an empty array as response. Here is the address I used.

These 2 things combined make it impossible for me to fetch accounts with >621 NFTs. Splitting/Lazy Loading isn't possible because of from, and fetching everything at once isn't possible due to your API returning an empty array when the size is larger than 621.

Given these circumstances, how is it possible for me to consistently fetch NFT accounts?

Thanks and best regards,
Boris Pöhland

/accounts endpoint has incorrect limit checking

The value of the parameters from and size for the /account endpoint are summed for some reason and if the result exceeds 10000 an error is returned complaining that the sum of these parameters must be less than 10000.
If I want to retrieve accounts from range [20000,25000] I cannot, since I would have to set the parameter 'from' to 20000 and size to 5000 and the sum would be greater than 10000.

Request URI error creation

Endpoints where a field is implemented as array[string] the API creates an incorrect URI which returns 'Internal server error 500'.

For example,

  1. /accounts/{address}/nfts - 'tags' field => the output URL is: tags=TAG1&tags=TAG2 which returns 'Internal server error 500'
  2. /nfts - 'tags' field is implemented with text-box where tags should be separated with comma -> this is working as expected

I believe everywhere where field is implemented with array[string] the API creates an incorrect URI.

/account/{address}/collections not working as expected

Hello together,

I was looking for an endpoint that returns me the collections that an address holds. Best case would even be choosing how many of the NFTs of that collection one wants to display, but I think this is already implemented with the nftSize query param of that endpoint.

So for example, this is how a request-response would look like:
Request: https://api.elrond.com/accounts/{address}/collections?nftSize=3
Response:

{
  'REALM-579543': [
      {
          /* nft object 1 */
      },
      {
          /* nft object 2 */
      },
      {
          /* nft object 3 */
      },
  ],
  'OGS-3f1408': [
      {
          /* nft object 1 */
      },
      {
          /* nft object 2 */
      },
      {
          /* nft object 3 */
      },
  ],
},

I would already be satisfied with a string array of collection tickers as response, in that case ['REALM-579543', 'OGS-3f1408']

The problem is, that whatever address I lookup, I always get an empty response.

I think this functionality is important to be included. Otherwise, in order to lookup what collections a wallet has, one has to fetch all NFTs of that wallet, which is very expensive.

Thanks for your help and I hope that the endpoint will be fixed!

Best regards,
Boris

/nfts endpoint error

1. 'collections' array[string] field to get all NFTs from multiple collections - nice to have
2. 'identifiers' is not working as name says
a. can be used with value: 'NFT1_identifier,NFT2_identifier' -> OK
b. can be used with value: 'Collection_identifier' -> NOT EXPECTED, NFT_identifier != Collection_identifier, Collection_identifier should be used only with 'collection' textbox field
c. can NOT be used with value: 'Collection1_identifier,Collection2_identifier' -> OK (this should be implemented as point 1 above)
3. The response from
/nfts?identifiers=XYZ
/nfts/XYZ
Is not the same!!
Also the same pattern is applicable for /tokens and /collections.
4. /nfts?withOwner=ABCD returns error 400 - Validation failed (optional boolean string is expected)
Also the description for 'withSupply' and 'withOwner' is wrong

/account/{address}/nfts doesn't return timestamp

Good morning! :)

In the response description of the /account/{address}/nfts endpoint is a timestamp:
Screenshot_20220423-082159.jpg

However, when actually querying the endpoint, the timestamp is not returned.

I assume the timestamp is the time at which the NFT arrived in one's wallet, right?

Because it would be cool to have this information, so that NFTs can be sorted by "Newest first".

Thanks for your help

Boris

Getting owners through endpoint is not stable

Getting owners through endpoint /collections/{collection}/nfts?from+size+withOwners is returning different values almost each run.

This is the code I'm using (just ignore the auto-conversion for code from github):

class NFT
{
public string Identifier { get; set; }
public string Owner { get; set; }
}

private async void GetOwners_Click(object sender, EventArgs e)
{
List nfts = new List();
int from = 0;
while(true)
{
var req = await new HttpClient().GetAsync($"https://api.elrond.com/collections/NEONCYBERS-1442a8/nfts?from={from}&size=100&withOwner=true");
string content = await req.Content.ReadAsStringAsync();
var respNfts = JsonConvert.DeserializeObject<List>(content);
if (respNfts.Count == 0)
break;

    nfts.AddRange(respNfts);
    from += 100;
}
var owners = nfts.Select(n => n.Owner).Distinct();
var identifiers = nfts.Select(n => n.Identifier).Distinct();

StreamWriter sw = new StreamWriter($"{DateTime.Now.ToString("dd.MM.yyyy HH.mm.ss")}.txt");
sw.WriteLine($"Total Owners: {owners.Count()}");
sw.WriteLine($"Total Identifiers: {identifiers.Count()}");
sw.WriteLine($"Total Results: {nfts.Count}");
sw.WriteLine(JsonConvert.SerializeObject(nfts.OrderBy(n=>n.Identifier), Newtonsoft.Json.Formatting.Indented));

}

In 5 runs the results are the following:

  1. Total Owners: 446
    Total Identifiers: 1480
    Total Results: 1500
  2. Total Owners: 449
    Total Identifiers: 1490
    Total Results: 1500
  3. Total Owners: 454
    Total Identifiers: 1499
    Total Results: 1500
  4. Total Owners: 454
    Total Identifiers: 1500
    Total Results: 1500
  5. Total Owners: 454
    Total Identifiers: 1500
    Total Results: 1500

446, 1480, 1500.txt
449, 1490, 1500.txt
454, 1499, 1500.txt
454, 1500, 1500.txt
454, 1500, 1500_2.txt

So,

  • The total results is 1500 which is fine because there are 1500 NFTs in the collection.
  • The total number of distinct owners is different in runs
  • The total number of distinct identifiers is different in runs

This is a major issue, the API returns duplicate 'identifier' results and we cannot get the owners.
Observed: The errors seem to be like in the middle of the 100 results so I guess is not a pagination issue.

/tokens with identifier returns different responses

I'm making the same request: https://api.elrond.com/tokens?identifiers=ZPAY-247875 multiple times, at a distance of 1-2 seconds and i get different responses...

the difference is that "minted" property is replace with "supply" and "circulatingSupply"

Response 1:
[
{
"identifier": "ZPAY-247875",
"name": "ZoidPay",
"ticker": "ZPAY",
"owner": "erd136kalm60ndyyps7paexvz38pf09f58f7nzqg8tw60p9pq7ygyspsx6ux89",
"minted": "700000000000000000000000000",
"burnt": "0",
"decimals": 18,
"isPaused": false,
"assets": {
"website": "https://www.zoidpay.com",
"description": "Shop Anything from Anywhere with Crypto",
"social": {
"email": "[email protected]",
"blog": "https://medium.com/zoidcoin-network",
"twitter": "https://twitter.com/zoidpay",
"whitepaper": "https://drive.google.com/file/d/1ZRwyAikfe22v9treyjeJoKi83W5U0y1j/view?usp=sharing",
"coinmarketcap": "https://coinmarketcap.com/currencies/zoidpay/",
"coingecko": "https://www.coingecko.com/en/coins/zoid-pay"
},
"status": "active",
"pngUrl": "https://media.elrond.com/tokens/asset/ZPAY-247875/logo.png",
"svgUrl": "https://media.elrond.com/tokens/asset/ZPAY-247875/logo.svg"
},
"transactions": 68622,
"accounts": 36588,
"canUpgrade": true,
"canMint": false,
"canBurn": false,
"canChangeOwner": true,
"canPause": false,
"canFreeze": false,
"canWipe": false
}
]

Response 2:
[
{
"identifier": "ZPAY-247875",
"name": "ZoidPay",
"ticker": "ZPAY",
"owner": "erd136kalm60ndyyps7paexvz38pf09f58f7nzqg8tw60p9pq7ygyspsx6ux89",
"decimals": 18,
"isPaused": false,
"assets": {
"website": "https://www.zoidpay.com",
"description": "Shop Anything from Anywhere with Crypto",
"social": {
"email": "[email protected]",
"blog": "https://medium.com/zoidcoin-network",
"twitter": "https://twitter.com/zoidpay",
"whitepaper": "https://drive.google.com/file/d/1ZRwyAikfe22v9treyjeJoKi83W5U0y1j/view?usp=sharing",
"coinmarketcap": "https://coinmarketcap.com/currencies/zoidpay/",
"coingecko": "https://www.coingecko.com/en/coins/zoid-pay"
},
"status": "active",
"pngUrl": "https://media.elrond.com/tokens/asset/ZPAY-247875/logo.png",
"svgUrl": "https://media.elrond.com/tokens/asset/ZPAY-247875/logo.svg"
},
"transactions": 68622,
"accounts": 36588,
"canUpgrade": true,
"canMint": false,
"canBurn": false,
"canChangeOwner": true,
"canPause": false,
"canFreeze": false,
"canWipe": false,
"supply": "700000000",
"circulatingSupply": "700000000"
}
]

I've hit a server with a bad deploy? :D

NFTs metada not updated

We changed the metada of the NFT using erdpy function, but the api.elrond does not show changes :(

The elrond gateway displays the updated value, but not the api. Is it the cache thing and it will updated eventually?

Can't retrieve logs from /transactions endpoint

It seems like I can (no longer?) retrieve the smart contract event logs using the transactions endpoint:

Expect the following to work:
https://devnet-api.elrond.com/transactions?withOperations=true&withScResults=true&hashes=46cea958a6dacd5eacec9bce8743de19ec6be2a7d9e2c3d3cbdaf45790539385&fields=logs

The following does work so the data is generally available in the api:
https://devnet-api.elrond.com/transactions/46cea958a6dacd5eacec9bce8743de19ec6be2a7d9e2c3d3cbdaf45790539385?fields=logs

Any help would be appreciated :)

PS: Of course, my real use case involves more than just one transaction, I want to parse all transactions concerning our token.
PPS: The /tokens/:ident/transactions endpoint has the same shortcomings as the normal transactions endpoint, which means I also get no event logs

Missing documentation for the smart contract querying change

Hey!

Up until shortly, I was able to use /vm-values/int and /vm-values/string to query smart contract data.

I believe you replaced these 2 endpoints with /query, however I can't figure out how to use it without 500 Internal Server Error...

The swagger docs explain nothing about how to use the endpoint.

Could you shed a light on an example usage?

Here's one of my old requests that doesn't work anymore now:

POST https://devnet-api.elrond.com/vm-values/int
Body:
{
	"scAddress": "erd1qqqqqqqqqqqqqpgq9n3hue8hkpjtd4w74jjlctgxltkuarj9jz0sak8w36",
	"funcName": "getNftPrice"
}

Response:

{
	"data": null,
	"error": "doGetVMValue: sending request error",
	"code": "bad_request"
}

Burned NFT still accessible/counted in the api

Hi,

It seems like burned NFT are still counted in the /nfts/count api.
I created a collection of 500 then burned 5 and re minted 5 and the api return a total supply of 505 wich is "false" since I burned 5 of them using the built-in burn function.

Collection NFTs supply endpoint

I believe an endpoint /collections/{identifier}/supply to get the number of NFTs/SFTs in the collection is very nice to have :).

Can't retrieve NFT attributes created from SC on the API

Hi,

I tried to mint some NFT from a SC but it seems that it broke the attributes.

#[derive(TypeAbi, TopEncode, TopDecode)]
 pub struct AttributesNFT {
    attr: u64,
 }

 let attributes = AttributesNFT {
    number: 5u64,
 };

 let nft_nonce = self.send().esdt_nft_create(
   &token, 
   &amount_one, 
   &name,
   &royalties, 
   &hash, 
   &attributes, 
   &uris 
 );

I keep my code as simple as possible.

All the attributes result retrieve from the /nfts/{identifier} looks like : "AAAAAAAAAE="

To see if my previous code work I added the following code after the mint.

  let token_info = self.blockchain().get_esdt_token_data(
        &self.blockchain().get_sc_address(),
        &self.nft_token_id().get(),
        nft_nonce,
    );
    
    let decoded_attr = token_info.decode_attributes::<AttributesNFT>()?;

    require!(attributes.attr == decoded_attr.attr, "attr not the same");

I go throught the require, meaning that my nft have the right attr.

Here is the last NFT I mint on the devnet with the problem.
TATTR-bf65ea-01

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.