What is the Multifungible Library ?
The Multifungible Library is a cross-platform library written in C++ that allows to seamlessly create and manage non-fungible tokens (NFTs) and semi-fungible tokens (SFTs) in the Multivers X blockchain. Works with any programming language capable of loading libraries.
Its main goal is to facilitate the integration of MultiversX blockchain operations on any project by providing an extensive set of methods.
Each method takes a simple input and performs a unique task on the blockchain of either modification or querying. When finished, the function returns a completion code and an information message so that the caller (your application) can easily decide what to do.
Features:
- Create encrypted wallets of unique public/private key pairs.
- Issue NFT or SFT collections.
- Manage the rights of a collection.
- Create Non-fungible tokens belonging to a collection.
- Transfer any kind of token to another address.
- Query the blockchain for useful information.
- Simulate every transaction before broadcasting it to the network, thus avoiding wasting EGLD on fees for unproductive actions.
Example of the outputs of some library functions:
Wallet1: erd1suej7d7yl5x95quuh38ur9x0vj2tdvy3rzuqx9n4dnulskyxvl0q0ec3n0
Wallet2: erd1qmsw2udd0mr68v69ph0v5au3z4rvhq5pg2za3ysj0umx9n8r5ltq090usv
Issued collection: ABCD-012345
Issued token: ABCD-012345-01
Creation stopped successfully
Sent 10 units of ABCD-012345-01 to erd1qmsw2udd0mr68v69ph0v5au3z4rvhq5pg2za3ysj0umx9n8r5ltq090usv successfully
true
true
Installation and usage
This library can be installed as an SDK on Windows and Linux. It can also be compiled as a dynamic-linked library (DLL) or a linux dynamic library (.so).
Up and running
You can download the pre-compiled libraries for Windows and Linux, and directly implement them in your C programs, python scripts, or any other language that allows loading DLLs and shared objects. Here are some examples on how to load and use the library:
C example
Python example
Windows installation
If you wish to compile the library on Windows yourself, download the latest sources from the GitHub page by clicking the 'Download' button on the upper right corner. Additionally, you need to install the following libraries:
OpenSSL 3.0.8 or higher
- Follow the tutorial to install OpenSSL on windows. Here is a small summary of the steps:
- Open the x64 Native tools command prompt
- Run:
perl Configure VC-WIN64A --prefix=C:\local\openssl3.0.8
(you may replace the prefix with the installation path of your choice). - Run:
nmake
- Run:
nmake install
- The OpenSSL headers and libraries will be installed in the installation path you provided.
Sodium
- Download here the latest pre-builts for GNU compiler.
- Uncompress the .tar.gz into your location of choice. The resulting folder will contain the static library and the headers.
Google tests (optional)
- To run the Google tests, download the latest release here.
- Uncompress the .zip and open a terminal.
- Type
cd googletest
- Type
mkdir build
- Type
cd build
- Type
cmake ..
- Type
cmake --build .
- This will create the libgtest.a library. Make sure to know where you store them, along with the include directory.
Linux installation
- If you wish to compile the library on Linux yourself, download the latest sources from the GitHub page by clicking the Download button on the upper right corner. Additionally, you will need the latest version of OpenSSL 3 and libsodium.
- You will need to install OpenSSL 3 and libsodium. If your Linux distro supports the Advanced Packaging Tool (APT), run the install.sh script. If not, you will need to manually install the packages corresponding to the OpenSSL static libraries, the OpenSSL include files, the libsodium static libraries and the libsodium include files. In most distros, the libraries go by the names of openssl and libsodium, and the include files go by the names of openssl-dev and libsodium-dev.
- To install the libsodium library, go to this page, and download the latest stable release. Then, run the commands
./configure
,make && make check
andsudo make install
- If you wish to run the Google tests suite, install googletests on your system. You can run the installgtest.sh file and it will install it for you (if your distro uses APT, if not, you'll need to do it manually). You can also install it manually by typing
sudo apt-get install libgtest-dev
, thencd /usr/src/gtest
andsudo cmake CMakeLists.txt
followed bysudo make
.
MacOS installation
- If you wish to compile the library on MacOS yourself, download the latest sources from the GitHub page by clicking the Download button on the upper right corner. Additionally, you will need the latest version of OpenSSL 3 and libsodium.
- You will need to install OpenSSL 3 and libsodium. Install brew, and run the install_macos.sh script. This will install libsodium and openssl.
- If you wish to run the Google tests suite, install googletests on your system:
brew install googletest
.
Compilation
Library
A compilation script is provided for windows (windows-compile.bat
), linux (linux-compile.sh
) and MacOS (macos-compile.sh
). Please, modify it and set the value of the following macros:
- MULTIFUNGIBLE_NETWORK: Select the network in which the library will run (Local, Testnet, Devnet, Mainnet). Example:
-DMULTIFUNGIBLE_NETWORK=Mainnet
(without " "). - MULTIFUNGIBLE_CONFIG_FILE: Select the location of the config file that the library will use during execution. You can set it to
./config.toml
if you are going to place it next to the executable that will load the Multifungible library. Example:-DMULTIFUNGIBLE_CONFIG_FILE="./config.toml"
. - __SIMULATE__: Specifies if every interaction with the blockchain should be simulated first with MultiversX simulation tool. Example:
-D__SIMULATE__=true
. By default, it is set to false.
If you are compiling on windows with windows-compile.bat
, please set the following macros as well:
- CMAKE_C_COMPILER: Select the location of the C compiler. Example:
-DCMAKE_C_COMPILER="C:/TDM-GCC-64/bin/gcc.exe"
. - CMAKE_CXX_COMPILER: Select the location of the C++ compiler. Example:
-DCMAKE_CXX_COMPILER="C:/TDM-GCC-64/bin/g++.exe"
. - LIBSODIUM_INCLUDE_PATH: Select the path to the sodium folder, which contains the headers of the libsodium library. Example:
-DLIBSODIUM_INCLUDE_PATH="C:/libsodium/include"
. - LIBSODIUM_LIB_PATH: Select the path to the compiled libsodium library (
libsodium.a
). Example:-DLIBSODIUM_LIB_PATH="C:/libsodium/lib"
. - OPENSSL_INCLUDE_PATH: Select the path to the openssl folder, containing the headers of the openssl library. Example:
-DOPENSSL_INCLUDE_PATH="C:/openssl3.0.8/include"
. - OPENSSL_LIB_PATH: Select the path to the compiled openssl library (
libcrypto.lib
andlibssl.lib
). Example:-DOPENSSL_LIB_PATH="C:/openssl3.0.8/lib"
.
The script will compile either a DLL (if you're using windows) or a shared object (if you're using Linux) into the ./bin
folder. This is the file that you need to have in your programs (along with config.toml
) if you want to access Multifungible's functions.
Google tests
A compilation script is provided for windows (windows-compile-gtests.bat
), linux (linux-compile-gtests.sh
) and MacOS (macos-compile-gtests.sh
). Please, modify it and set the value of the following macros:
- BUILD_TESTS: This macro turns the Google test compilation ON. It is set to OFF by default. To use it,
-DBUILD_TESTS=ON
. - MULTIFUNGIBLE_NETWORK: Set the network to Local with the parameter
-DMULTIFUNGIBLE_NETWORK=Local
. - MULTIFUNGIBLE_CONFIG_FILE: Set the location of the config file to
../config folder/config.toml
.
If you are compiling on windows, please set the following macros as well:
- GOOGLETESTS_INCLUDE_PATH: Select the location of the Google test headers folder. Example:
-DGOOGLETESTS_INCLUDE_PATH="C:/GoogleTests/include"
. - GOOGLETESTS_LIB_PATH: Select the location of the Google test lib folder. Example:
-DGOOGLETESTS_LIB_PATH="C:/GoogleTests/lib"
.
The script will compile an executable into the ./bin
folder. This is the file that you need to execute in order to run the tests on the Testnet.
Command Line Interface
A compilation script is provided for windows (windows-compile-cli.bat
), linux (linux-compile-cli.sh
) and MacOS (macos-compile-cli.sh
). Please, modify it and set the value of the following macros:
- MULTIFUNGIBLE_NETWORK: Set the network to Local with the parameter
-DMULTIFUNGIBLE_NETWORK=Local
. - MULTIFUNGIBLE_CONFIG_FILE: Set the location of the config file to
../config folder/config.toml
.
If you are compiling on windows, please set the following macros as well:
- GOOGLETESTS_INCLUDE_PATH: Select the location of the Google test headers folder. Example:
-DGOOGLETESTS_INCLUDE_PATH="C:/GoogleTests/include"
. - GOOGLETESTS_LIB_PATH: Select the location of the Google test lib folder. Example:
-DGOOGLETESTS_LIB_PATH="C:/GoogleTests/lib"
.
The script will compile an executable into the
In order to run the test suite, you will need to navigate to the
Here are some important guidelines on how to use Multifungible:
./bin
folder.
Run tests
./bin
folder and perform the following actions:
'./test'
folder. To create them, run the executable with the option -c
, like this: .\Multifungible.exe -c
. This will create a main wallet and display its address on the console. The program will block until you click ENTER after you complete the next step.sudo xnetwork
. When asked to configure the address that will receive 1.000.000 EGLD, enter the address shown on the Multifungible console. Once the local testnet is up and running, click ENTER on the Multifungible console. This will make a few transactions to load additional wallets with enough EGLD..\Multifungible.exe -s
..\Multifungible.exe
. This will run all the tests one by oneHow to use?
Multivers X concepts
Basic definitions
There are some terms that you need to be familiar with in order to use this library to the fullest. These are given in the following table:
Name | Description |
---|---|
Collection |
A collection is an element in the blockchain that allows for the creation of non-fungible tokens and semi-fungible tokens. Collections have properties, as well as roles that select addresses possess, and an owner (also known as manager) that is unique. A collection can only issue either non-fungible tokens or semi-fungible tokens, but not both. When a collection is created, the blockchain assigns it a name based on the ticker provided which has the form TIC-XXXXXX, where TIC is the provided ticker, and XXXXXX is a unique hexadecimal number generated by the blcokchain. |
Token |
A token is an element in the blockchain that allows for the existence of ownership. Tokens are issued from a collection by an address that has the right to do so on that collection. Tokens have attributes that give them a meaning to the owner. Tokens accept a certain number of operations on them like transfers to other addresses, or the modification of their attributes. The operations that can be performed on them are determined by their collection's properties. The blockchain ensures the uniqueness of the token by giving it a unique ID of the form ABCD-012345-01, where ABCD-012345 is the ID of the collection to which the token belongs, and 01 is a hexadecimal number called nonce, which distinguishes tokens on a same collection from each other. |
NFT |
An NFT is a non-fungible token. It is a unique token in the blockchain, that only one address owns, and that cannot be copied. |
SFT |
An SFT is a semi-fungible token. It is a token in the blockchain for which there can be multiple instances. Multiple addresses can own many instances of this token. |
Owner of a collection |
The owner or manager of a collection is the address that possesses management rights. When a collection is issued, the owner is set to the issuer of the collection. This privilege can be transferred to another address by the owner itself. Only one address can be the owner of a collection at a given time. |
Token issuer of a collection |
The token issuer of a collection is the address that possesses the ability to issue new tokens on the collection. There can only be one account at a given time with this ability. |
Owner of a token |
The owner of a token is the address that the blockchain recognizes as being its proprietary. To acquire the token, the owner must have received it from another address. Only select addresses or contracts possessing the ESDTNFTCreate role can issue tokens from a collection. |
Property |
A property of a collection is a part of the definition of a collection that specifies which operations are allowed to be performed on the collection. Properties can be set upon the issuance of a collection, and can be changed later if the canUpgrade property is set on issuance. |
Role |
Roles are special abilities that addresses may possess on a collection. These abilities allow for the addresses possessing them to perform certain actions like issue new tokens, modify token attributes or burn tokens. |
Attribute |
Attributes are the part of a token's definition which gives it a special meaning. There are two types of attribute: URIs to IPFS media files (of supported type), and an URI to an IPFS JSON file (which contains data that the creator of the token considered relevant to give it meaning). |
Properties table
Name | Description |
---|---|
canFreeze |
Allow the manager of a collection to prevent transfers to and from a specific account. |
canWipe |
Allow the manager of a collection to wipe the tokens that a frozen account possesses. |
canPause |
Allow the manager of a collection to halt or resume the ability to transact with tokens of the collection (appart from minting and burning). |
canTransferNFTCreateRole |
Allow the token issuer of a collection to transfer this ability to another account. |
canChangeOwner |
Allow to change the manager of a collection. |
canUpgrade |
Allow the manager to upgrade the properties of the collection. |
canAddSpecialRoles |
Allow the manager to add roles on the collection to a chosen address. |
Roles table
Name | Applied to | Description |
---|---|---|
ESDTRoleNFTCreate |
NFT/SFT | Allow an address to issue new tokens on the collection, and add them to its own balance. Only one address can posess this role at a given time. |
ESDTRoleNFTBurn |
NFT/SFT | Allow to erase existing tokens owned by the address posessing this role. |
ESDTRoleNFTUpdateAttributes |
NFT | Allow to update the attributes of a token owned by the address posessing this role. |
ESDTRoleNFTAddURI |
NFT | Allow to add an URI to a token owned by the address posessing this role. |
ESDTRoleNFTAddQuantity |
SFT | Allow an address to add a quantity of tokens of an existing token from a collection, and add them to its balance. |
ESDTTransferRole |
NFT/SFT | Allow to restrict which addresses can transfer tokens from the collection. If at least one address possesses this role, only the addresses possessing the role can freely transfer tokens. Other addresses, however, can still transfer tokens to addressess possessing the role. When the role is removed from all addresses, the token can be transferable again with no restrictions. |
Functions
These are the functions that can be called either as a C++ SDK library, or as DLL/shared object exportable functions.
Create Wallet
returnCodeAndChar createWallet
Creates a JSON wallet file of the specified name on the hard drive, and encrypts it with the specified password. This kind of wallet is made of one and only private-public key pair. If the provided name contains folders, the folders must exists beforehand, otherwise the wallet will not be saved.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to encrypt the JSON file. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Public address of the created wallet if the operation successful. Error information if it wasn't |
Usage example:
Result:
Load Wallet
returnCodeAndChar loadWallet
Loads a JSON wallet file of the specified name on the hard drive, and decrypts it with the specified password.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Public address of the created wallet if the operation successful. Error information if it wasn't |
Usage example:
Result:
Issue SFT Collection
returnCodeAndChar issueSFTCollection
Issues an SFT collection on the blockchain with the attributes provided in the arguments. Needs 0.05 EGLD.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_sftName |
char * |
Name to give to the collection. Must be alphanumeric, between 3 and 20 characters. |
p_sftTicker |
char * |
Ticker to give to the collection. Must be alphanumeric, between 3 and 10 characters. |
p_canFreeze |
bool |
Allow the manager of the collection to prevent transfers to and from a specific account. |
p_canWipe |
bool |
Allow the manager of the collection to wipe the tokens that a frozen account possesses. |
p_canPause |
bool |
Allow the manager of the collection to halt or resume the ability to transact with tokens of the collection (appart from minting and burning) |
p_canTransferNFTCreateRole |
bool |
Allow the token issuer of the collection to transfer this ability to another account. |
p_canChangeOwner |
bool |
Allow to change the manager of the collection. |
p_canUpgrade |
bool |
Allow the manager to upgrade the properties of the collection. |
p_canAddSpecialRoles |
bool |
Allow the manager to add roles on the collection to a chosen address. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Collection ID if the operation was successful. Error information if it wasn't. |
Usage example:
Result:
Issue NFT Collection
returnCodeAndChar issueNFTCollection
Issues an NFT collection on the blockchain with the attributes provided in the arguments. Needs 0.05 EGLD.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_nftName |
char * |
Name to give to the collection. Must be alphanumeric, between 3 and 20 characters. |
p_nftTicker |
char * |
Ticker to give to the collection. Must be alphanumeric, between 3 and 10 characters. |
p_canFreeze |
bool |
Allow the manager of the collection to prevent transfers to and from a specific account. |
p_canWipe |
bool |
Allow the manager of the collection to wipe the tokens that a frozen account possesses. |
p_canPause |
bool |
Allow the manager of the collection to halt or resume the ability to transact with tokens of the collection (appart from minting and burning). |
p_canTransferNFTCreateRole |
bool |
Allow the token issuer of the collection to transfer this ability to another account. |
p_canChangeOwner |
bool |
Allow to change the manager of the collection. |
p_canUpgrade |
bool |
Allow the manager to upgrade the properties of the collection. |
p_canAddSpecialRoles |
bool |
Allow the manager to add roles on the collection to a chosen address. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Collection ID if the operation was successful. Error information if it wasn't. |
Usage example:
Result:
Issue SFT Token
returnCodeAndChar issueSemiFungibleToken
Issues an SFT collection on the blockchain with the attributes provided in the arguments. Needs 0.05 EGLD.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_collectionID |
char * |
ID of the collection (Ex: ABCD-012345). |
p_name |
char * |
Name to give to the token. |
p_emitAmount |
char * |
Number of tokens to emit in string format. |
p_royalties |
char * |
Royalties that the creator will receive each time the token is transfered. Should be a numeric value between 0 an 10000 (0 meaning 0% and 10000 meaning 100%) represented as a string. |
p_attributes |
char * |
Additional information about the token. Should have the format metadata:ipfsCID/fileName.json;tags:tag1,tag2,tag3, where metadata:ipfsCID/fileName.json is an IPFS address to a JSON containing a representation of the attributes of the token. |
p_uri |
char * |
URL to a media file representing the token in some way. The media should be of a type supported by Multivers X. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Token ID if the operation was successful. Error information if it wasn't. |
Usage example:
Result:
Issue ESDT Token
returnCodeAndChar issueESDTToken
Issues an ESDT on the blockchain with the attributes provided in the arguments. Needs 0.05 EGLD.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_esdtName |
char * |
Name to give to the ESDT token. |
p_esdtTicker |
char * |
Ticker to give to the collection. Must be alphanumeric, between 3 and 10 characters. |
p_initialSupply |
char * |
Initial supply to mint and give to the issuer. |
p_nbDecimals |
char * |
Number of decimals into which you will allow to subdivide the token (between 0 and 18). |
p_canFreeze |
bool |
Allow the manager of the collection to prevent transfers to and from a specific account. |
p_canWipe |
bool |
Allow the manager of the collection to wipe the tokens that a frozen account possesses. |
p_canPause |
bool |
Allow the manager of the collection to halt or resume the ability to transact with tokens of the collection (appart from minting and burning) |
p_canChangeOwner |
bool |
Allow to change the manager of the collection. |
p_canUpgrade |
bool |
Allow the manager to upgrade the properties of the collection. |
p_canAddSpecialRoles |
bool |
Allow the manager to add roles on the collection to a chosen address. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Token ID if the operation was successful. Error information if it wasn't. |
Usage example:
Result:
Issue NFT Token
returnCodeAndChar issueNonFungibleToken
Issues an NFT collection on the blockchain with the attributes provided in the arguments. Needs 0.05 EGLD.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_collectionID |
char * |
ID of the collection (Ex: ABCD-012345). |
p_name |
char * |
Name to give to the token. |
p_royalties |
char * |
Royalties that the creator will receive each time the token is transfered. Should be a numeric value between 0 an 10000 (0 meaning 0% and 10000 meaning 100%) represented as a string. |
p_attributes |
char * |
Additional information about the token. Should have the format metadata:ipfsCID/fileName.json;tags:tag1,tag2,tag3, where metadata:ipfsCID/fileName.json is an IPFS address to a JSON containing a representation of the attributes of the token. |
p_uri |
char * |
URL to a media file representing the token in some way. The media should be of a type supported by Multivers X. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Token ID if the operation was successful. Error information if it wasn't. |
Usage example:
Result:
Add role to collection
returnCodeAndChar addCollectionRole
Give a role on a collection to an address. The collection must have the property canAddSpecialRoles. The roles that can be given to an SFT collection are ESDTRoleNFTCreate, ESDTRoleNFTBurn, ESDTTransferRole and ESDTRoleNFTAddQuantity. The roles that can be given to an NFT collection are ESDTRoleNFTCreate, ESDTRoleNFTBurn, ESDTTransferRole, ESDTRoleNFTUpdateAttributes and ESDTRoleNFTAddURI. For more information, click here.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_collectionID |
char * |
ID of the collection (Ex: ABCD-012345). |
p_address |
char * |
Public address of the account to take the role on the collection. |
p_role |
char * |
Role to give to the account on the collection. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Remove role from collection
returnCodeAndChar removeCollectionRole
Remove a role on a collection from an address. The roles that can be given to an SFT collection are ESDTRoleNFTBurn, ESDTTransferRole and ESDTRoleNFTAddQuantity. The roles that can be given to an NFT collection are ESDTRoleNFTBurn, ESDTTransferRole, ESDTRoleNFTUpdateAttributes and ESDTRoleNFTAddURI. The role ESDTRoleNFTCreate can only be removed by calling stopTokenCreation. The collection must have the property canAddSpecialRoles.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_collectionID |
char * |
ID of the collection (Ex: ABCD-012345). |
p_address |
char * |
Public address of the account that has the role on the collection. |
p_role |
char * |
Role to remove from the account on the collection. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Add URI
returnCodeAndChar addURI
Add an URI (to a suported media file) to a token of an NFT collection. The public address of the wallet must possess the role ESDTRoleNFTAddURI. More information here.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_tokenID |
char * |
ID of the NFT (Ex: ABCD-012345-01, which is a collection ID and a nonce, separated by a '-', in hexadecimal). |
p_uri |
char * |
URI to add to the token (Ex: ipfs://ipfsCID/myfile.png). |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Upgrade Attributes
returnCodeAndChar upgradeAttribute
Upgrade the attributes (usually a link to a JSON and a set of tags) of an NFT token. The address performing the upgrade must have the ESDTRoleNFTUpdateAttributes role.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_tokenID |
char * |
ID of the NFT (Ex: ABCD-012345-01, which is a collection ID and a nonce, separated by a '-', in hexadecimal). |
p_attribute |
char * |
New attribute to give to the token (in the format metadata:ipfsCID/song.json;tags:song,beautiful,music). |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Add SFT quantity
returnCodeAndChar addSFTQuantity
Add a quantity of SFT tokens to an existing token. The public address of the wallet must possess the role ESDTRoleNFTAddQuantity.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_tokenID |
char * |
ID of the SFT (Ex: ABCD-012345-01, which is a collection ID and a nonce, separated by a '-', in hexadecimal). |
p_quantity |
char * |
Quantity of new tokens to add to the existing number of SFT tokens of an SFT collection, represented as a string. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Mint ESDT quantity
returnCodeAndChar mintESDTQuantity
Mint a quantity of ESDT tokens. The public address of the wallet must possess the role ESDTRoleLocalMint.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_tokenID |
char * |
ID of the ESDT (Ex: ABCD-012345). |
p_quantity |
char * |
Quantity of new tokens to add to the existing number of ESDT tokens, represented as a string. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Burn NFT or SFT quantity
returnCodeAndChar burnSFTQuantity
Burn a quantity of SFT tokens from an existing token, or a single NFT. The public address of the wallet must possess the role ESDTRoleNFTBurn.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_tokenID |
char * |
ID of the NFT or SFT (Ex: ABCD-012345-01, which is a collection ID and a nonce, separated by a '-', in hexadecimal). |
p_quantity |
char * |
Quantity of tokens to burn from the existing number of SFT tokens of an SFT collection, represented as a string. If the token is an NFT, the quantity to burn is 1. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Burn ESDT quantity
returnCodeAndChar burnESDTQuantity
Burn a quantity of ESDT tokens. The public address of the wallet must possess the role ESDTRoleLocalBurn.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_tokenID |
char * |
ID of the ESDT (Ex: ABCD-012345). |
p_quantity |
char * |
Quantity of tokens to burn from the existing number of ESDT tokens on the address. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Wipe NFT
returnCodeAndChar wipeNFT
Wipe (delete from the blockchain) an NFT owned by an address. The collection must have the property canWipe.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_tokenID |
char * |
ID of the NFT (Ex: ABCD-012345-01, which is a collection ID and a nonce, separated by a '-', in hexadecimal). |
p_ownerAddress |
char * |
Public address of the owner of the token. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Wipe ESDT
returnCodeAndChar wipeESDT
Wipe (delete from the blockchain) all the ESDT tokens owned by an address. The collection must have the property canWipe.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_tokenID |
char * |
ID of the ESDT (Ex: ABCD-012345). |
p_ownerAddress |
char * |
Public address of the owner of the token. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Freeze NFT
returnCodeAndChar freezeNFT
Freeze (block the ability to send the token to another address) an NFT owned by an address. The collection must have the property canFreeze.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_tokenID |
char * |
ID of the NFT (Ex: ABCD-012345-01, which is a collection ID and a nonce, separated by a '-', in hexadecimal). |
p_ownerAddress |
char * |
Public address of the owner of the token. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Freeze ESDT
returnCodeAndChar freezeESDT
Freeze (block the ability to send the token to another address) an ESDT owned by an address. The collection must have the property canFreeze.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_tokenID |
char * |
ID of the ESDT (Ex: ABCD-012345). |
p_ownerAddress |
char * |
Public address of the owner of the token. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Unfreeze NFT
returnCodeAndChar unfreezeNFT
Unfreeze (restore the ability to send the token to another address) an NFT owned by an address. The collection must have the property canFreeze.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_tokenID |
char * |
ID of the NFT (Ex: ABCD-012345-01, which is a collection ID and a nonce, separated by a '-', in hexadecimal). |
p_ownerAddress |
char * |
Public address of the owner of the token. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Unfreeze ESDT
returnCodeAndChar unfreezeESDT
Unfreeze (restore the ability to send the token to another address) an ESDT owned by an address. The collection must have the property canFreeze.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_tokenID |
char * |
ID of the ESDT (Ex: ABCD-012345). |
p_ownerAddress |
char * |
Public address of the owner of the token. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Transfer NFT Creation role
returnCodeAndChar transferCreationRole
Transfer the creation role (the ability to issue new tokens) of an NFT or SFT collection from an account to another. Only one account can possess this role at a given time. The collection must have the property canTransferNFTCreateRole.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_collectionID |
char * |
ID of the NFT or SFT collection (Ex: ABCD-012345). |
p_address |
char * |
Public address to transfer the role to. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Stop NFT or SFT creation
returnCodeAndChar stopTokenCreation
Stop the ability to create new tokens on an NFT or SFT collection. This method can be called by the manager of a collection, and removes the creation role (ESDTRoleNFTCreate) from whoever possesses it.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_collectionID |
char * |
ID of the NFT or SFT collection (Ex: ABCD-012345). |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Pause transactions
returnCodeAndChar pauseTransactions
Pauses the hability to send or receive tokens from the given collection. The collection must have the property canPause.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_collectionID |
char * |
ID of the NFT or SFT collection (Ex: ABCD-012345). |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Resume transactions
returnCodeAndChar unPauseTransactions
Resumes the hability to send or receive tokens from the given collection. The collection must have the property canPause.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_collectionID |
char * |
ID of the NFT or SFT collection (Ex: ABCD-012345). |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Upgrade Properties
returnCodeAndChar upgradeProperties
Upgrade the properties of an NFT or SFT collection. The collection must have been issued with the property canUpgrade. The available properties are canFreeze, canWipe, canPause, canTransferNFTCreateRole, canChangeOwner and canAddSpecialRoles.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_collectionID |
char * |
ID of the NFT or SFT collection (Ex: ABCD-012345). |
p_property |
char * |
Property of the collection to upgrade. |
p_newValue |
bool |
Boolean indicating whether the collection now possesses the property or not. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Transfer Ownership
returnCodeAndChar transferOwnership
Transfer the ownership of a collection, giving the management rights to the new address. The collection must have the property canChangeOwner.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_collectionID |
char * |
ID of the NFT or SFT collection (Ex: ABCD-012345). |
p_address |
char * |
Public address of the new owner of the collection. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Send NFT token
returnCodeAndChar NFTTransaction
Send an NFT token to an address.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_destinationAddress |
char * |
Public address to send the token to. |
p_tokenID |
char * |
ID of the NFT (Ex: ABCD-012345-0a, which is a collection ID and a nonce, separated by a '-', in hexadecimal). |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Send SFT token
returnCodeAndChar SFTTransaction
Send an SFT token to an address.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_destinationAddress |
char * |
Public address to send the token to. |
p_tokenID |
char * |
ID of the SFT (Ex: ABCD-012345-0a, which is a collection ID and a nonce, separated by a '-', in hexadecimal). |
p_amount |
char * |
Amount of tokens of the collection to send. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Send ESDT token
returnCodeAndChar ESDTTransaction
Send an ESDT token to an address.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_destinationAddress |
char * |
Public address to send the token to. |
p_tokenID |
char * |
ID of the ESDT (Ex: ABCD-012345). |
p_amount |
char * |
Amount of tokens to send. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Send Multi-token Transaction
returnCodeAndChar MultiTransaction
Send a multiple transaction to an address.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_destinationAddress |
char * |
Public address to send the token to. |
p_otherParamsCount |
int |
Number of transactions to make. |
p_otherParams |
char ** |
Array containing the following: Token type ('NFT', 'SFT', 'ESDT'), token name (a char *), quantity to send (a char *). |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Send EGLD
returnCodeAndChar EGLDTransaction
Send EGLD to an address.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Absolute or relative path to the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_destinationAddress |
char * |
Public address to send the token to. |
p_amount |
char * |
Quantity of EGLD to send, represented as a string. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
Information about the success or failure of the operation. |
Usage example:
Result:
Retrieve Owned Tokens
returnCodeAndChar getOwnedTokens
Retrieve the list of all the NFT or SFT tokens a given address possesses.
Arguments:
Name | Type | Description |
---|---|---|
p_address |
char * |
Public address to retrieve the information from. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
If successful, returns a list of JSONs separated by carriage returns. Each JSON contains the corresponding fields returned by the MultiversX API. |
Usage example:
Result:
{
"collection": "CTST-1a26d8",
"creator": "erd1suej7d7yl5x95quuh38ur9x0vj2tdvy3rzuqx9n4dnulskyxvl0q0ec3n0",
"identifier": "CTST-1a26d8-01",
"isWhitelistedStorage": false,
"media": [
{
"fileSize": 29512,
"fileType": "image/png",
"originalUrl": "https://media.elrond.com/nfts/thumbnail/default.png",
"thumbnailUrl": "https://media.elrond.com/nfts/thumbnail/default.png",
"url": "https://media.elrond.com/nfts/thumbnail/default.png"
}
],
"metadata": {},
"name": "tokenTest",
"nonce": 1,
"royalties": 75,
"ticker": "CTST-1a26d8",
"type": "NonFungibleESDT"
}
{
"balance": "5",
"collection": "CTST-1e8d85",
"creator": "erd1suej7d7yl5x95quuh38ur9x0vj2tdvy3rzuqx9n4dnulskyxvl0q0ec3n0",
"identifier": "CTST-1e8d85-01",
"isWhitelistedStorage": false,
"media": [
{
"fileSize": 29512,
"fileType": "image/png",
"originalUrl": "https://media.elrond.com/nfts/thumbnail/default.png",
"thumbnailUrl": "https://media.elrond.com/nfts/thumbnail/default.png",
"url": "https://media.elrond.com/nfts/thumbnail/default.png"
}
],
"metadata": {},
"name": "tokenTest",
"nonce": 1,
"royalties": 75,
"ticker": "CTST-1e8d85",
"type": "SemiFungibleESDT"
}
Retrieve Token Balance
returnCodeAndChar getAddressTokenBalance
Retrieve the balance of an NFT or SFT token a given address possesses.
Arguments:
Name | Type | Description |
---|---|---|
p_address |
char * |
Public address to retrieve the information from. |
p_tokenID |
char * |
ID of the NFT (Ex: ABCD-012345-01, which is a collection ID and a nonce, separated by a '-', in hexadecimal). |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
If successful, returns the balance as a decimal integer in string format. |
Usage example:
Result:
5
Retrieve ESDT Balance
returnCodeAndChar getAddressESDTBalance
Retrieve the balance of an ESDT token a given address possesses.
Arguments:
Name | Type | Description |
---|---|---|
p_address |
char * |
Public address to retrieve the information from. |
p_tokenID |
char * |
ID of the ESDT (Ex: ABCD-012345). |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
If successful, returns the balance as a decimal integer in string format. |
Usage example:
Result:
500
Retrieve Token Properties
returnCodeAndChar getTokenProperties
Retrieve the properties of an NFT or SFT token.
Arguments:
Name | Type | Description |
---|---|---|
p_tokenID |
char * |
ID of the NFT or SFT token (Ex: ABCD-012345-01, which is a collection ID and a nonce, separated by a '-', in hexadecimal). |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
If successful, returns a JSON with the token properties returned by the MultiversX API. |
Usage example:
Result:
{
"attributes": "bWV0YWRhdGE6aHR0cHM6Ly9pcGZzLmlvL2lwZnMvYmFmeWJlaWZqbnR3ZWpjN2s3ZGVkZmFhdnJhdmhub3NjN3hlNGNldTV6bW9iamhoYm9iMzJ1eXU1N20vOTMuanNvbjt0YWdzOmEsYixj",
"collection": "CTST-d07d34",
"creator": "erd1suej7d7yl5x95quuh38ur9x0vj2tdvy3rzuqx9n4dnulskyxvl0q0ec3n0",
"identifier": "CTST-d07d34-01",
"isWhitelistedStorage": false,
"media": [
{
"fileSize": 29512,
"fileType": "image/png",
"originalUrl": "https://media.elrond.com/nfts/thumbnail/default.png",
"thumbnailUrl": "https://media.elrond.com/nfts/thumbnail/default.png",
"url": "https://media.elrond.com/nfts/thumbnail/default.png"
}
],
"metadata": {
"error": {
"code": "ipfs_error",
"message": "IPFS error when fetching metadata: Invalid URL - ERR_ID:00004",
"timestamp": 1682024029
}
},
"name": "tokenTest",
"nonce": 1,
"owner": "erd1suej7d7yl5x95quuh38ur9x0vj2tdvy3rzuqx9n4dnulskyxvl0q0ec3n0",
"rarities": {},
"royalties": 75,
"tags": [
"a",
"b",
"c"
],
"ticker": "CTST-d07d34",
"timestamp": 1682023992,
"type": "NonFungibleESDT",
"uris": [
""
]
}
Retrieve ESDT Properties
returnCodeAndChar getESDTProperties
Retrieve the properties of an ESDT token.
Arguments:
Name | Type | Description |
---|---|---|
p_tokenID |
char * |
ID of the ESDT token (Ex: ABCD-012345). |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
If successful, returns a JSON with the token properties returned by the MultiversX API. |
Usage example:
Result:
{
"accounts": 1,
"accountsLastUpdatedAt": 1713611499,
"burnt": "0",
"canAddSpecialRoles": true,
"canBurn": false,
"canChangeOwner": false,
"canFreeze": false,
"canMint": false,
"canPause": false,
"canUpgrade": false,
"canWipe": false,
"circulatingSupply": "5",
"decimals": 2,
"identifier": "MTK-ba9c28",
"initialMinted": "500",
"isPaused": false,
"mexPairType": "experimental",
"minted": "0",
"name": "mytoken",
"owner": "erd14mk5z67j4gakdvg9l662g8c4a3tcmg364uptxsmqgtfew0hc95nq5awhgj",
"roles": [
{
"canLocalBurn": false,
"canLocalMint": false,
"roles": [
"ESDTRoleBurnForAll"
]
}
],
"supply": "5",
"ticker": "MTK-ba9c28",
"transactions": 0,
"transactionsLastUpdatedAt": 1713611710,
"transfers": 1,
"transfersLastUpdatedAt": 1713612162,
"type": "FungibleESDT"
}
Get Owned Token Properties
returnCodeAndChar getOwnedTokenProperties
Retrieves the information of a token, provided that the given address owns the token (this allows to call a method of the proxy, and therefore, retrieve the information faster than from the API).
Arguments:
Name | Type | Description |
---|---|---|
p_tokenID |
char * |
ID of the NFT (Ex: ABCD-012345-01, which is a collection ID and a nonce, separated by a '-', in hexadecimal). |
p_address |
char * |
Public address that owns the token. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
If successful, returns a JSON with the token properties returned by the MultiversX API. |
Usage example:
Result:
{
"blockInfo": {
"hash": "b0388f2cf04da8c68b2b11ab2799985eed9fed0c623b7b8fac3db740413f26c7",
"nonce": 1282199,
"rootHash": "f493071e79a1e1c40ae66780dc5c59dcd1dcd6a37d638c5c209b28900b1c3c33"
},
"tokenData": {
"balance": "5",
"creator": "erd1suej7d7yl5x95quuh38ur9x0vj2tdvy3rzuqx9n4dnulskyxvl0q0ec3n0",
"hash": "MDA=",
"name": "tokenTest",
"nonce": 1,
"royalties": "7500",
"tokenIdentifier": "ABCD-012345",
"uris": [
""
]
}
}
Get Collection Properties
returnCodeAndChar getCollectionProperties
Retrieves the properties of the given collection. Useful to quickly retrieve the manager of the collection.
Arguments:
Name | Type | Description |
---|---|---|
p_collectionID |
char * |
ID of the NFT or SFT collection (Ex: ABCD-012345). |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
If successful, returns the collection name, the type of collection, the address of the manager of the collection, the number of decimals, ..., and a list of properties the collection possesses. |
Usage example:
Result:
collectionTest
SemiFungibleESDT
erd1suej7d7yl5x95quuh38ur9x0vj2tdvy3rzuqx9n4dnulskyxvl0q0ec3n0
0
0
NumDecimals-0
IsPaused-false
CanUpgrade-true
CanMint-false
CanBurn-false
CanChangeOwner-true
CanPause-true
CanFreeze-true
CanWipe-true
CanAddSpecialRoles-true
CanTransferNFTCreateRole-true
NFTCreateStopped-false
NumWiped-0
Ownership Proof
returnCodeAndChar buildProofOfOwnershipOfKeyPair
Signs the given plaintext with the private key of the provided wallet. This allows to generate a ciphertext that can be decrypted with the public key of the given wallet. Thus, the user can prove that he is the owner of the key pair. This can be useful to prove the ownership of a token in the blockchain.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Name of the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_plainText |
char * |
Plaintext to generate signature from. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
If successful, returns the cryptographic signature of the provided plaintext. |
Usage example:
Result:
Collection Ownership Proof
returnCodeAndChar getProofOfCollectionOwnership
Returns a string boolean telling whether the given collection is owned by the given wallet or not.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Name of the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_plainText |
char * |
Plaintext to generate signature from. |
p_collectionID |
char * |
ID of the NFT or SFT collection (Ex: ABCD-012345). |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
If successful, returns the string "true". If not, returns the string "false". |
Usage example:
Result:
Sign Message
returnCodeAndChar signMessage
Returns a string signature of the provided message.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Name of the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_plainText |
char * |
Plaintext to generate signature from. |
p_computeHash |
bool |
Wether we want to serialize the plaintext into a Keccak hash or not. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
If successful, returns the hashed string. |
Usage example:
Result:
Token Ownership Proof
returnCodeAndChar getProofOfTokenOwnership
Returns a string boolean telling whether the given token is owned by the given wallet or not.
Arguments:
Name | Type | Description |
---|---|---|
p_walletName |
char * |
Name of the JSON file on the hard-drive. |
p_password |
char * |
Password to decrypt the JSON file. |
p_plainText |
char * |
Plaintext to generate signature from. |
p_tokenID |
char * |
ID of the NFT (Ex: ABCD-012345-01, which is a collection ID and a nonce, separated by a '-', in hexadecimal). |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
If successful, returns the string "true". If not, returns the string "false". |
Usage example:
Result:
Get Collection Owner
returnCodeAndChar getOwnerAddress
Gets the address of the current owner/manager of an NFT or SFT collection.
Arguments:
Name | Type | Description |
---|---|---|
p_collectionID |
char * |
ID of the NFT or SFT collection (Ex: ABCD-012345). |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
If successful, returns the address of the owner of the collection. |
Usage example:
Result:
Get Emitted collections
returnCodeAndChar getEmittedCollections
Gets the list of collections emitted by a given address. "Owner" field actually represents the issuer, not the address that has ownership of the collection.
Arguments:
Name | Type | Description |
---|---|---|
p_address |
char * |
Public address from which to retrieve the list of the emitted tokens. |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
If successful, returns a list of the collection IDs of the emitted collections, separated by carriage returns. |
Usage example:
Result:
{
"canAddSpecialRoles":true,
"canChangeOwner":true,
"canFreeze":true,
"canPause":true,
"canTransfer":false,
"canTransferNftCreateRole":true,
"canUpgrade":true,
"canWipe":true,
"collection":"ABC-51755b",
"name":"abc",
"owner":"erd1suej7d7yl5x95quuh38ur9x0vj2tdvy3rzuqx9n4dnulskyxvl0q0ec3n0",
"roles":[
{"address":"erd1suej7d7yl5x95quuh38ur9x0vj2tdvy3rzuqx9n4dnulskyxvl0q0ec3n0",
"canAddQuantity":true,
"canAddUri":false,
"canBurn":true,
"canCreate":true,
"canTransfer":true,
"canUpdateAttributes":false,
"roles":["ESDTRoleNFTCreate","ESDTTransferRole","ESDTRoleNFTAddQuantity","ESDTRoleNFTBurn"]
}
],
"ticker":"ABC-51755b",
"timestamp":1672268028,
"type":"SemiFungibleESDT"
}
Get Roles and Addresses
returnCodeAndChar getRolesAndAddresses
For each role that a given collection has, retrieves a list of addresses possessing the role.
Arguments:
Name | Type | Description |
---|---|---|
p_collectionID |
char * |
ID of the NFT or SFT collection (Ex: ABCD-012345). |
Return Value:
returnCodeAndChar
structure containing the following fields:
Name | Type | Description |
---|---|---|
retCode |
int |
0 if the operation was successful, 1 if it wasn't. |
message |
char * |
If successful, returns a JSON in which the keys are a comma-separated string of MultiversX roles, and the values are arrays of public addresses which possess the roles of their keys. |
Usage example:
Result:
{
"ESDTRoleBurnForAll":[""],
"ESDTRoleNFTCreate,ESDTRoleNFTAddQuantity":["erd1suej7d7yl5x95quuh38ur9x0vj2tdvy3rzuqx9n4dnulskyxvl0q0ec3n0"]
}
FAQs
Under which license is this library?
This work is under the MIT license.
I can't compile on Linux.
If you're having problems compiling in Linux, make sure you have installed all the necessary libraries on your distribution. If the problem persists, make sure you are using a relatively recent version of the distro.