Skip to content

Unreal client SDK for interacting with the Nibiru blockchain.

License

Notifications You must be signed in to change notification settings

VAR-META-Tech/unreal-nibi

Repository files navigation

Unreal-Nibi-SDK

Unreal-Nibi-SDK is a cpp package written in C++ to help developers integrate Nibiru blockchain technology into their cpp and Unreal projects.

Project Layout

  1. UnrealExample/:: This directory contains Wallet example Unreal Project using Unreal-Nibi-SDK.
  2. Resource/:: A place for various resources needed for the project, like images, data files, or other assets.
  3. libs/: This directory houses a Go package specifically designed for connecting to and interacting with the blockchain, facilitating the initialization of the client for seamless integration with the project.
  4. test/: This directory hosts Go unit test files to ensure the functionality, reliability, and performance of the associated components within the project.

Features

  1. Creating a Wallet: Generate new blockchain wallets to securely manage funds and conduct transactions.
  2. Querying: Retrieve detailed information from the blockchain, such as transaction history, account balances, or smart contract data.
  3. Transfer Token: Seamlessly transfer tokens between blockchain addresses with built-in security measures.
  4. Mint NFT: Create unique and non-fungible tokens (NFTs) on the blockchain, enabling the creation and management of digital assets.

Requirements

Platforms Unreal Version Installation Status
MacOS Unity engine 5.4 3rd lib build config Fully Tested
Windows Unity engine 5.4 3rd lib build config, visual studio 2022 (with desktop and game development c++) Fully Tested

Installation

FOR MACOS

Installation Guide

This guide provides step-by-step instructions for installing and setting up our library which is compatible macOS platforms. Ensure you have the following prerequisites installed to build the project:

Prerequisites

Go : https://go.dev/doc/install

Visual Studio Code with C++ development environment

Installation Steps

  1. Install Xcode
  2. Install Visual Studio Code with C++ development environment
  3. Install Go
  4. Install Unreal 5.4.1 and Launch UE (You need to create Epic Games account)

Project Setup

You can run setup.sh to do all these steps to set up the project environment:

  1. Build the project:
    rm -f unreal_nibi_sdk.dylib
    go build -o unreal_nibi_sdk.dylib -buildmode=c-shared ./api.go
  2. To check Project Build Success
     gcc -o sdk_test sdk_test.c unreal_nibi_sdk.dylib -lpthread
  3. Test some function in Project:
     ./sdk_test
  4. Settup library to use for Unreal Project:
     install_name_tool -id @rpath/unreal_nibi_sdk.dylib unreal_nibi_sdk.dylib
NibiruSettup.mp4

FOR WINDOWS

Installation Guide

This guide provides step-by-step instructions for installing and setting up our library which is compatible Windows platforms. Ensure you have the following prerequisites installed to build the project:

Prerequisites

Go : https://go.dev/doc/install

Visual Studio 2022 with C++ development environment for Desktop and Game Screenshot 2024-05-13 at 07 10 38

Installation Steps

  1. Install Visual Studio 2022 with C++ development environment
  2. Install Go
  3. Install Unreal 5.4.1

Project Setup

Do all these steps to set up the project environment:

  1. Build the project: Need copy wasmvm.dll to mingw64 path: C:\TDM-GCC-64\lib
    go build -ldflags="-w" -o unreal_nibi_sdk.dll -buildmode=c-shared ./api.go
  2. To check Project Build Success and Test some function in Project:
     C:\TDM-GCC-64\bin\x86_64-w64-mingw32-gcc.exe -o sdk_test sdk_test.c unreal_nibi_sdk.dll
     ./sdk_test.exe

Example Unreal Project

An Example unreal project can be found in the following path:
./UnrealExample/NibiruUnreal.uproject.

UnrealNibiru.mp4

Follow these steps to run the Unreal Project Demo:

  1. Click NibiruUnreal.uproject in the ./UnrealExample/NibiruUnreal/NibiruUnreal.uproject and waiting for Unreal open this project.

    For windows, you should Generate Visual Studio Files

    Screenshot 2024-05-13 at 07 30 57

    After that open .sln file to build and run project example

    Screenshot 2024-05-13 at 07 43 17

    NOTE: In Windows when you play program in first time with throw an exception, please continue to run

  2. To run Unreal Project you need to open NibiruLevel and Click Button Play:

NOTE: You can see NibiruLevel into Content Drawer:

  1. After Click Button Play : The project is now ready for Demo.

  2. To view the Unreal C++ code, you can open NibiruUnreal.code-workspace in the ./UnrealExample/NibiruUnreal/ by VS Code.

NOTE: You can open NibiruUnreal.code-workspace by Unreal Editer: Click Tools -> Open Visual Studio Code.

Integration sdk lib with Unreal Project

For Unreal project please reference example in NibiruUnreal, you need define Build.cs to integration unreal_nibi_sdk library with Unreal engine. Here is an example:

using UnrealBuildTool;
using System.IO;
public class NibiruUnreal : ModuleRules
{
	public NibiruUnreal(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
		bEnableExceptions = true;
		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
		PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
		PrivateDependencyModuleNames.AddRange(new string[] { });

		if (Target.Platform == UnrealTargetPlatform.Mac)
		{
			string unreal_nibi_sdk_LibPath = Path.Combine(ModuleDirectory, "../../../../", "unreal_nibi_sdk.dylib");
			string destinationDirectory = Target.ProjectFile.Directory.FullName;
			File.Copy(unreal_nibi_sdk_LibPath, Path.Combine(destinationDirectory, "unreal_nibi_sdk.dylib"), true);
			PublicAdditionalLibraries.Add(Path.Combine(destinationDirectory, "unreal_nibi_sdk.dylib"));
			PublicIncludePaths.AddRange(new string[] { Path.Combine(ModuleDirectory, "../../../") });
			PublicIncludePaths.AddRange(new string[] { Path.Combine(ModuleDirectory, "../../../../") });
		} else if (Target.Platform == UnrealTargetPlatform.Win64)
		{
			string unreal_nibi_sdk_LibPath = Path.Combine(ModuleDirectory, "../../../../", "unreal_nibi_sdk.dll");
			string cosmos_LibPath = Path.Combine(ModuleDirectory, "../../../../", "wasmvm.dll");
			string destinationDirectory = Target.ProjectFile.Directory.FullName + "/Binaries/Win64";
			File.Copy(unreal_nibi_sdk_LibPath, Path.Combine(destinationDirectory, "unreal_nibi_sdk.dll"), true);
			File.Copy(cosmos_LibPath, Path.Combine(destinationDirectory, "wasmvm.dll"), true);
            //PublicDelayLoadDLLs.Add(Path.Combine(destinationDirectory, "unreal_nibi_sdk.dll"));
            //PublicDelayLoadDLLs.Add(Path.Combine(destinationDirectory, "wasmvm.dll"));
            PublicIncludePaths.AddRange(new string[] { Path.Combine(ModuleDirectory, "../../../") });
			PublicIncludePaths.AddRange(new string[] { Path.Combine(ModuleDirectory, "../../../../") });
		}
		CppStandard = CppStandardVersion.Cpp17;
	}
}

Using Unreal-Nibi-SDK with Blueprint

Create Wallet

Transfer Transaction

Faucet

Testing

To run unit test. You can do the following cmd:

go test ./test/...

Go API

You can check out this file to see what APIs we using: gonibi.md

Deploy CW721 contract

The CW721 contract is a specification for non-fungible tokens (NFTs) built on the CosmWasm platform. Inspired by Ethereum's ERC721 standard, CW721 introduces enhancements tailored to the CosmWasm ecosystem. These enhancements aim to provide a robust framework for creating and managing NFTs within decentralized applications (dApps) on the CosmWasm network.

You can check out this file to see how to deploy CW721 contract and Mint an NFT ./deploy_cw721.md

License

This project is licensed under the Apache-2.0 License. Refer to the LICENSE.txt file for details.

About

Unreal client SDK for interacting with the Nibiru blockchain.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •