Wallets

Integrating the READYgg Crypto Wallet

Important note:

We are currently working on the wallets v2 API. The API presented here is no more supported by the latest version of the READYgg SDK. Please contact the READYgg team if you have questions.

In order to purchase NFTs the user needs to create a crypto wallet. During wallet creation, the user must provide a password to access the wallet later. It is important to inform the user that the password must be written down or otherwise stored since neither Ready nor developers can recover the wallet password if forgotten. The NFT virtual items are sold for "rgn-coin" currency. You can sell non-NFT items for custom in-game currency, or also for the "rgn-coin".

Check user primary wallet

using RGN.Modules.Wallets;

namespace SomeNamespace
{
    internal sealed class CheckUsersPrimaryWallet
    {
        public async void IsUserHaveWalletAsync()
        {
            IsUserHavePrimaryWalletResponseData result =
                await WalletsModule.I.IsUserHavePrimaryWalletAsync();
            UnityEngine.Debug.Log(result.isUserHavePrimaryWallet);
            UnityEngine.Debug.Log(result.address);
        }
    }
}

Response:

Return IsUserHavePrimaryWalletResponseData object, which contains the following fields:

  • isUserHavePrimaryWallet (bool) - true if the user already created a primary wallet

  • address (string) - the primary wallet address on the blockchain

Retrieve user wallets

API call:

using RGN.Modules.Wallets;

namespace SomeNamespace
{
    internal sealed class GetUserWallets
    {
        public async void GetWalletsAsync()
        {
            GetUserWalletsResponseData result =
                await WalletsModule.I.GetUserWalletsAsync();
            for (int i = 0; i < result.wallets.Length; i++)
            {
                var wallet = result.wallets[i];
                UnityEngine.Debug.Log(wallet.address);
            }
        }
    }
}

Response:

Return GetUserWalletsResponseData object, which contains the following fields:

  • RGNWallet[] wallets - list of wallet objects

Details of RGNWallet:

  • address (string) - the blockchain public address of the wallet

Creating new wallet

When creating a wallet, you can use a password, and leave the field blank if this is not necessary.

API call:

using RGN.Modules.Wallets;

namespace SomeNamespace
{
    internal sealed class CreateNewWallet
    {
        public async void CreateWalletAsync()
        {
            string password = "123456abcdefABCDEF";
            CreateWalletResponseData result =
                await WalletsModule.I.CreateWalletAsync(password);
            UnityEngine.Debug.Log(result.address);
            UnityEngine.Debug.Log(result.wallet_created);
            UnityEngine.Debug.Log(result.success);
            UnityEngine.Debug.Log(result.error);
        }
    }
}

Response:

Return CreateWalletResponseData object, which contains the following fields:

  • address (string) - address of the created wallet

  • wallet_created (bool) - is wallet was created

  • success (bool) - if the wallet was created this will have true value

  • error (string) - In case the wallet was not created this field will contain additional information