Skip to content

Felippo001/Blockfrost-Unity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blockfrost API Unity

Blockfrost SDK for Unity. Only Cardano endpoints available (no ipfs or milkomeda)

Installation

Download and import the latest release .unitypackage

Example

using Blockfrost;
using Blockfrost.ResponseTypes.Error;

public class Example : MonoBehaviour
{

    async void Start()
    {
        // Initialize api
        var api = new BlockfrostApi(
            "<api-key>",
            false 
            // mainnet = false
            // testnet = true
        );



        // Fetch asset
        var myAsset = await api.SpecificAsset(
            "d5e6bf0500378d4f0da4e8dde6becec7621cd8cbf5cbb9b87013d4cc537061636542756432303538"
        );
        // Get image link - ipfs:// 
        var metadataImage = myAsset.onchain_metadata["image"];
        print(metadataImage);




        // Catch errors 

        try
        {
            var addressUtxos = await api.AddressUtxos("<address>");
        }
        catch (BlockfrostError e)
        {
            print(e.status_code);
            print(e.message);
        }


        try
        {
            await api.SubmitTransaction("<tx>");
        }
        catch(BlockfrostError e){}
        
    }

    
}

Endpoints

All endpoints can be seen on the official Blockfrost open api reference

License

MIT License

Author

Backi#8950