HOW TO Contribute to the open source code:
Here is the open source code of the plugin: https://github.com/ThugzLabs/Thugz-Solana-for-Unreal-Engine-5.3-SOURCE-PROJECT/tree/main
It is designed for the 5.3 version of Unreal Engine. If you want to contribute, please create a branch from the develop branch and code what you want, then merge to develop when you have finished.
You can create a pull request to merge your code into the main branch if you believe your code improves the plugin. Your code will then be reviewed by our team, and if approved, it will be merged into the main branch. Don't forget to comment on your code and indicate your contribution.
HOW TO USE IT
If you downloaded the plugin from the Unreal Engine marketplace, install it from the Epic Games launcher on the engine version of your choice and proceed to step 3
If you get the packaged plugin from the GitHub repo, follow these steps:
1/ Download the last package and unzip
- Download the last release of your engine version from our repository:
- Unreal Engine Version 5.4: Release V6.0 for UE5.4
- Unreal Engine version 5.3: Release Solana Wallet management
- Create a "Plugins" directory inside your project directory and unzip the packaged plugin downloaded in your new "Plugins" directory:
2/ If your project is a blueprint only, follow these steps (else, skip this step and go to step 3)
Create an empty C++ class to convert it into a C++ project:
Wait for the code to be added to the project and then accept the popup:
Then click no:
Then exit from the Unreal Editor and go to your project directory. Find your .uproject file and generate Visual Studio files:
Wait for the generation of the files. Once it’s finished, launch your project (double-click the .uproject file). Click Yes here:
And wait until your project is loaded (it can take several minutes).
3/ Verify the plugin
Launch your project and go to the plugin panel to verify that the Thugz Plugin is correctly activated. If not, activate it and restart the project.
We provide a widget test that can be used to understand how the plugin works. It is commented to help you understand how you can implement its features inside your game.
4/ Functions provided by the Plugins.
Transverse Function that can be used for any Blockchain or any API
- GetLastJsonResponse: Retrieve the JSON response of the last API call made by an API request (like MakeHelloMoonAPIRequest, MoralisAPIRequest or…)
- Input: None
- Output:
- JSON: The String formatted as JSON which contains the response of the API
- FString GetLastTokenJsonResponse(): Another function to retrieve the JSON response of the last API call made by an API request which is specific for the native token balance: HelloMoonRequestForTokenBalance and MakeMoraliseRequestForSOLBalance
- Input: None
- Output:
- JSON: The String formatted as JSON which contains the response of the API
The following function is a set to retrieve the Image of a NFT (whatever is the Blockchain: tested with Solana and Ethereum)
- MakeURIRequest(const FString& URL): HTTP request which will retrieve the JSON from the GET URI:
- Input:
- String: The URI you want to retrieve the MetaData
- Output:
- JSON: The String formatted as JSON which contains the MetaData response of the URI
- ParseImageURL(const FString& JsonString, FString& OutImageURL): This request comes just after the MakeURIRequest. It parses the JSON in entry to retrieve the Image URL.
- Input:
- String: The JSON you want to retrieve the URL Image (The response of MakeURIRequest)
- Output:
- String: The URL String of the image
- DownloadImageAndCreateTexture(const FString& URL, UTexture2D*& OutTexture): This request comes just after the ParseImageURL. It downloads the image in the URL and stores it inside a 2D texture to be used in Unreal Engine.
- Input:
- String: The URL string of the image you want to download (The response of ParseImageURL)
- Output:
- 2DTexture: The Image
Function for SOLANA Blockchain which does not require any API
- GenerateSolanaKeyPair(FString& OutPublicKey, FString& OutPrivateKey): This function uses the libsodium library, which employs a cryptographic mechanism based on the Ed25519 elliptic curve. It will generate a new key pair: a private key and a public key, in hexadecimal format. The public key will correspond to the address of the created account, and the private key will be its access code. The public key format needs to be converted to match the commonly used formatting (see the encodeBase58 function):
- Input: None
- Output:
- String: Private Key of the Solana account created in hexadecimal
- String: Public Key of the Solana account created in hexadecimal
- FString EncodeBase58(const TArray<uint8>& Data): This function takes a byte array (binary data) and converts it into a Base58 string. This encoding is used to make the data more human-readable and avoid confusing characters like "0", "O", "l", and "I". Here we use this function after GenerateSolanaKeyPair to encode the public key of the account created
- Input:
- Array of Int: The Hexadecimal key you want to encode (The public key retrieved by the GenerateSolanaKeyPair function)
- Output:
- String: the Solana public address encoded in Base58
- FString GetSolanaAddressFromPrivateKey(const FString& PrivateKey, FString& PublicKeyHex): This function retrieves the public Solana address directly formatted in base58 (the address used by the Solana Blockchain and tools) using the private key.
- Input:
- String: The private key of your account
- Output:
- String: the public address of your account (the one formatted in base58, the one you want)
- String: The public key in Hexadecimal
Function using HelloMoon API for SOLANA Blockchain
- MakeHelloMoonAPIRequest: This function makes an API call using Solana HelloMoon API to query the NFTs owned by the Wallet account provided as input. This function must use the transverse function: GetLastJsonResponse to retrieve the JSON response inside a string variable. The program must wait for the responses to arrive from the URL so don’t hesitate to put a delay between the two functions (see our widget example code)
- Input:
- Account: The public key of the wallet account to query
- Barear: The HelloMoon API to use for the query
- Output: None
- ConvertSOLJSONtoStruct: Takes a String in a JSON format as input and converts it inside an Unreal Engine Structure. It works only with a JSON provided by the MakeHelloMoonAPIRequest
- Input:
- JSON: The String formatted as JSON
- Output:
- Struct: The structure with the JSON Value formatted in the structure value. This structure will be split into a table that will contain as many entries as NFTs owned.
- HelloMoonRequestForTokenBalance: This function makes an API call using Solana HelloMoon API to query the Solana Balance of a Solana account provided as input
- Input:
- Account: The public key of the wallet account to query
- API Key: The HelloMoon API key to use for the query (barear)
- Output:
- String: The JSON response of the API
- GetTokenBalanceFromJsonHelloMoon: Takes a String in a JSON format as input and converts it into a UE double variable. The JSON String must be the one retrieved by the HelloMoonRequestForTokenBalance
- Input:
- JSON: The String formatted as JSON
- Output:
- Double: The Solana Balance of the account inside the JSON
Function using MORALIS API for SOLANA Blockchain
- MakeMoraliseRequestForSOLBalance: This function makes an API call using Moralis API to query the Solana Balance of a Solana account provided as input
- Input:
- Account: The public key of the wallet account to query
- API Key: The HelloMoon API key to use for the query (barear)
- Output:
- String: The JSON response of the API
- GetTokenBalanceFromJsonMoralis: Takes a String in a JSON format as input and converts it into a UE double variable. The JSON String must be the one retrieved by the MakeMoraliseRequestForSOLBalance
- Input:
- JSON: The String formatted as JSON
- Output:
- Double: The Solana Balance of the account inside the JSON
Function using MORALIS API for EVM Blockchain
- MoralisAPIRequest: This function makes an API call using EVM Moralis API to query the NFTs owned by the Wallet account provided as input. The Blockchain queried is EVM. This function must use GetLastJsonResponse to retrieve the JSON response inside a variable. The program must wait for the responses to arrive from the URL so don’t hesitate to put a delay between the two functions (see our widget example code)
- Input:
- Account: The public key of the wallet account to query
- API Key: The Moralis API to use for the query
- Blockchain: The Blockchain of the account. For the moment, only eth and polygon have been tested (but other EVM chains should work)
- Output: None
- ConvertEVMJSONtoStruct: Takes a String in a JSON format as input and converts it inside an Unreal Engine Structure. It works only with a JSON provided by the MoralisAPIRequest
- Input:
- JSON: The String formatted as JSON
- Output:
- Struct: The structure with the JSON Value formatted in the structure value. This structure will be split into a table that will contain as many entries as NFTs owned.
- Input: None
- Output:
- JSON: The String formatted as JSON which contains the response of the API
- Input: None
- Output:
- JSON: The String formatted as JSON which contains the response of the API
- MakeURIRequest(const FString& URL): HTTP request which will retrieve the JSON from the GET URI:
- Input:
- String: The URI you want to retrieve the MetaData
- Output:
- JSON: The String formatted as JSON which contains the MetaData response of the URI
- Input:
- ParseImageURL(const FString& JsonString, FString& OutImageURL): This request comes just after the MakeURIRequest. It parses the JSON in entry to retrieve the Image URL.
- Input:
- String: The JSON you want to retrieve the URL Image (The response of MakeURIRequest)
- Output:
- String: The URL String of the image
- Input:
- DownloadImageAndCreateTexture(const FString& URL, UTexture2D*& OutTexture): This request comes just after the ParseImageURL. It downloads the image in the URL and stores it inside a 2D texture to be used in Unreal Engine.
- Input:
- String: The URL string of the image you want to download (The response of ParseImageURL)
- Output:
- 2DTexture: The Image
- Input:
Function for SOLANA Blockchain which does not require any API
- GenerateSolanaKeyPair(FString& OutPublicKey, FString& OutPrivateKey): This function uses the libsodium library, which employs a cryptographic mechanism based on the Ed25519 elliptic curve. It will generate a new key pair: a private key and a public key, in hexadecimal format. The public key will correspond to the address of the created account, and the private key will be its access code. The public key format needs to be converted to match the commonly used formatting (see the encodeBase58 function):
- Input: None
- Output:
- String: Private Key of the Solana account created in hexadecimal
- String: Public Key of the Solana account created in hexadecimal
- FString EncodeBase58(const TArray<uint8>& Data): This function takes a byte array (binary data) and converts it into a Base58 string. This encoding is used to make the data more human-readable and avoid confusing characters like "0", "O", "l", and "I". Here we use this function after GenerateSolanaKeyPair to encode the public key of the account created
- Input:
- Array of Int: The Hexadecimal key you want to encode (The public key retrieved by the GenerateSolanaKeyPair function)
- Output:
- String: the Solana public address encoded in Base58
- FString GetSolanaAddressFromPrivateKey(const FString& PrivateKey, FString& PublicKeyHex): This function retrieves the public Solana address directly formatted in base58 (the address used by the Solana Blockchain and tools) using the private key.
- Input:
- String: The private key of your account
- Output:
- String: the public address of your account (the one formatted in base58, the one you want)
- String: The public key in Hexadecimal
Function using HelloMoon API for SOLANA Blockchain
- MakeHelloMoonAPIRequest: This function makes an API call using Solana HelloMoon API to query the NFTs owned by the Wallet account provided as input. This function must use the transverse function: GetLastJsonResponse to retrieve the JSON response inside a string variable. The program must wait for the responses to arrive from the URL so don’t hesitate to put a delay between the two functions (see our widget example code)
- Input:
- Account: The public key of the wallet account to query
- Barear: The HelloMoon API to use for the query
- Output: None
- ConvertSOLJSONtoStruct: Takes a String in a JSON format as input and converts it inside an Unreal Engine Structure. It works only with a JSON provided by the MakeHelloMoonAPIRequest
- Input:
- JSON: The String formatted as JSON
- Output:
- Struct: The structure with the JSON Value formatted in the structure value. This structure will be split into a table that will contain as many entries as NFTs owned.
- HelloMoonRequestForTokenBalance: This function makes an API call using Solana HelloMoon API to query the Solana Balance of a Solana account provided as input
- Input:
- Account: The public key of the wallet account to query
- API Key: The HelloMoon API key to use for the query (barear)
- Output:
- String: The JSON response of the API
- GetTokenBalanceFromJsonHelloMoon: Takes a String in a JSON format as input and converts it into a UE double variable. The JSON String must be the one retrieved by the HelloMoonRequestForTokenBalance
- Input:
- JSON: The String formatted as JSON
- Output:
- Double: The Solana Balance of the account inside the JSON
Function using MORALIS API for SOLANA Blockchain
- MakeMoraliseRequestForSOLBalance: This function makes an API call using Moralis API to query the Solana Balance of a Solana account provided as input
- Input:
- Account: The public key of the wallet account to query
- API Key: The HelloMoon API key to use for the query (barear)
- Output:
- String: The JSON response of the API
- GetTokenBalanceFromJsonMoralis: Takes a String in a JSON format as input and converts it into a UE double variable. The JSON String must be the one retrieved by the MakeMoraliseRequestForSOLBalance
- Input:
- JSON: The String formatted as JSON
- Output:
- Double: The Solana Balance of the account inside the JSON
Function using MORALIS API for EVM Blockchain
- MoralisAPIRequest: This function makes an API call using EVM Moralis API to query the NFTs owned by the Wallet account provided as input. The Blockchain queried is EVM. This function must use GetLastJsonResponse to retrieve the JSON response inside a variable. The program must wait for the responses to arrive from the URL so don’t hesitate to put a delay between the two functions (see our widget example code)
- Input:
- Account: The public key of the wallet account to query
- API Key: The Moralis API to use for the query
- Blockchain: The Blockchain of the account. For the moment, only eth and polygon have been tested (but other EVM chains should work)
- Output: None
- ConvertEVMJSONtoStruct: Takes a String in a JSON format as input and converts it inside an Unreal Engine Structure. It works only with a JSON provided by the MoralisAPIRequest
- Input:
- JSON: The String formatted as JSON
- Output:
- Struct: The structure with the JSON Value formatted in the structure value. This structure will be split into a table that will contain as many entries as NFTs owned.
- Input: None
- Output:
- String: Private Key of the Solana account created in hexadecimal
- String: Public Key of the Solana account created in hexadecimal
- Input:
- Array of Int: The Hexadecimal key you want to encode (The public key retrieved by the GenerateSolanaKeyPair function)
- Output:
- String: the Solana public address encoded in Base58
- Input:
- String: The private key of your account
- Output:
- String: the public address of your account (the one formatted in base58, the one you want)
- String: The public key in Hexadecimal
- MakeHelloMoonAPIRequest: This function makes an API call using Solana HelloMoon API to query the NFTs owned by the Wallet account provided as input. This function must use the transverse function: GetLastJsonResponse to retrieve the JSON response inside a string variable. The program must wait for the responses to arrive from the URL so don’t hesitate to put a delay between the two functions (see our widget example code)
- Input:
- Account: The public key of the wallet account to query
- Barear: The HelloMoon API to use for the query
- Output: None
- Input:
- ConvertSOLJSONtoStruct: Takes a String in a JSON format as input and converts it inside an Unreal Engine Structure. It works only with a JSON provided by the MakeHelloMoonAPIRequest
- Input:
- JSON: The String formatted as JSON
- Output:
- Struct: The structure with the JSON Value formatted in the structure value. This structure will be split into a table that will contain as many entries as NFTs owned.
- Input:
- HelloMoonRequestForTokenBalance: This function makes an API call using Solana HelloMoon API to query the Solana Balance of a Solana account provided as input
- Input:
- Account: The public key of the wallet account to query
- API Key: The HelloMoon API key to use for the query (barear)
- Output:
- String: The JSON response of the API
- Input:
- GetTokenBalanceFromJsonHelloMoon: Takes a String in a JSON format as input and converts it into a UE double variable. The JSON String must be the one retrieved by the HelloMoonRequestForTokenBalance
- Input:
- JSON: The String formatted as JSON
- Output:
- Double: The Solana Balance of the account inside the JSON
- Input:
Function using MORALIS API for SOLANA Blockchain
- MakeMoraliseRequestForSOLBalance: This function makes an API call using Moralis API to query the Solana Balance of a Solana account provided as input
- Input:
- Account: The public key of the wallet account to query
- API Key: The HelloMoon API key to use for the query (barear)
- Output:
- String: The JSON response of the API
- GetTokenBalanceFromJsonMoralis: Takes a String in a JSON format as input and converts it into a UE double variable. The JSON String must be the one retrieved by the MakeMoraliseRequestForSOLBalance
- Input:
- JSON: The String formatted as JSON
- Output:
- Double: The Solana Balance of the account inside the JSON
Function using MORALIS API for EVM Blockchain
- MoralisAPIRequest: This function makes an API call using EVM Moralis API to query the NFTs owned by the Wallet account provided as input. The Blockchain queried is EVM. This function must use GetLastJsonResponse to retrieve the JSON response inside a variable. The program must wait for the responses to arrive from the URL so don’t hesitate to put a delay between the two functions (see our widget example code)
- Input:
- Account: The public key of the wallet account to query
- API Key: The Moralis API to use for the query
- Blockchain: The Blockchain of the account. For the moment, only eth and polygon have been tested (but other EVM chains should work)
- Output: None
- ConvertEVMJSONtoStruct: Takes a String in a JSON format as input and converts it inside an Unreal Engine Structure. It works only with a JSON provided by the MoralisAPIRequest
- Input:
- JSON: The String formatted as JSON
- Output:
- Struct: The structure with the JSON Value formatted in the structure value. This structure will be split into a table that will contain as many entries as NFTs owned.
- Input:
- Account: The public key of the wallet account to query
- API Key: The HelloMoon API key to use for the query (barear)
- Output:
- String: The JSON response of the API
- Input:
- JSON: The String formatted as JSON
- Output:
- Double: The Solana Balance of the account inside the JSON
- MoralisAPIRequest: This function makes an API call using EVM Moralis API to query the NFTs owned by the Wallet account provided as input. The Blockchain queried is EVM. This function must use GetLastJsonResponse to retrieve the JSON response inside a variable. The program must wait for the responses to arrive from the URL so don’t hesitate to put a delay between the two functions (see our widget example code)
- Input:
- Account: The public key of the wallet account to query
- API Key: The Moralis API to use for the query
- Blockchain: The Blockchain of the account. For the moment, only eth and polygon have been tested (but other EVM chains should work)
- Output: None
- Input:
- ConvertEVMJSONtoStruct: Takes a String in a JSON format as input and converts it inside an Unreal Engine Structure. It works only with a JSON provided by the MoralisAPIRequest
- Input:
- JSON: The String formatted as JSON
- Output:
- Struct: The structure with the JSON Value formatted in the structure value. This structure will be split into a table that will contain as many entries as NFTs owned.
- Input:
If you want to use the HelloMoon API, don't forget to put a HelloMoon API bearer in order to test our plugin: https://www.hellomoon.io/developers
This Bearer can be retrieved here: https://www.hellomoon.io/developers
If you want to use the Moralis API, don’t forget to put the API keys: https://moralis.io/
For any support, join us on discord: https://discord.gg/thugz-life-889994637215932416
Follow us on X: https://twitter.com/Thugz_NFT and https://twitter.com/War_Thugz and our GitHub: Thugz Labs (github.com)