Skip to main content

Ronin Waypoint Unity SDK v0.3.0

Overview

The Ronin Waypoint Unity SDK lets developers integrate the account and wallet features of the Ronin Waypoint service into Unity games deployed to mobile platforms (Android and iOS) and desktop platforms (Windows and macOS). After the integration, users can sign in to your game with their Ronin Waypoint account and connect their keyless wallet for instant in-game transactions.

User experience varies depending on the platform:

  • Mobile users interact with Ronin Waypoint through a native WebView.
  • Desktop users interact with Ronin Waypoint through an overlay window in the Mavis Hub app.

Whenever the implementation differs between platforms, this guide specifies the platform-specific steps.

GitHub repository: skymavis/waypoint-unity.

Features

  • Authorize users: let users sign in to your app with Ronin Waypoint to connect their keyless wallet and an optional externally owned account (EOA) wallet.
  • Send transactions: transfer RON, ERC-20 tokens, and make contract calls for in-game transactions.
  • Sign messages and typed data: have users sign messages and structured data to prove ownership of their wallet and authorize transactions.

Prerequisites

Unity version:

For desktop games distributed through Mavis Hub:

  • To distribute your game through Mavis Hub, contact your Sky Mavis point of contact.
  • Install Mavis Hub with latest version.
  • .Net v3.1 or later.

For mobile games:

Setup

Developer Console setup

  1. Register your app in the Developer Console and configure the mandatory Ronin Waypoint settings, including:
    • Redirect URI: the URI to which Ronin Waypoint redirects the user after authorization.
    • Origin URI: the URI from which your app sends requests to Ronin Waypoint.
  2. Copy the Client ID from the Developer Console to use in the initialization step.

For more information about these steps, see Setup and configuration.

Installation

  1. Download the Unity package waypoint.unitypackage (ver 0.3.0) release from the GitHub repository.
  2. Set up your project:
    1. Import the downloaded waypoint.unitypackage file by selecting the Unity menu option Assets > Import package > Custom Package and importing waypoint.unitypackage.

    2. Install the required package Newtonsoft by adding the following line to your project's manifest.json file:

      "com.unity.nuget.newtonsoft-json": "3.2.1"
    3. In Unity Editor, go to Build Settings, choose the platform you are deploying, and click Switch Platform.

Platform-specific settings

  1. Go to Project Settings > Player > Settings for Android > Publishing Settings and select the following:

    • Custom Main Manifest
    • Custom Main Gradle Template
    • Custom Gradle Properties Template
  2. In the Assets/Plugins/Android directory of your Unity app, add required dependencies to the mainTemplate.gradle file:

    dependencies {
    implementation ("androidx.browser:browser:1.8.0")
    }

    Your mainTemplate.gradle file should look like this:

    apply plugin: 'com.android.library'
    **APPLY_PLUGINS**

    dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation ("androidx.browser:browser:1.8.0")
    **DEPS**}

    Gradle automatically downloads the required dependencies when building the app.

  3. Instruct Gradle to use the AndroidX libraries by adding the following line to your gradleTemplate.properties file:

    android.useAndroidX=true

    Your gradleTemplate.properties file should look like this:

    org-gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
    org-gradle-parallel=true
    unityStreamingAssets=**STREAMING_ASSETS**
    android.useAndroidX=true
    **ADDITIONAL_PROPERTIES**

Initialization

Step 1. Initialize Ronin Waypoint

  1. After registering your app in the Developer Console, you receive a Client ID. Use this Client ID at the next step.

  2. Initialize the Waypoint client:

    void Init(string waypointOrigin, string clientId, string deeplinkSchema, string rpcUrl, int chainId)

    Parameters:

    • waypointOrigin: the base URL of Ronin Waypoint for all API calls as https://waypoint.roninchain.com.
    • clientId: the client ID registered in the Developer Console.
    • deeplinkSchema: the redirect URI registered in the Developer Console.
    • rpcUrl: the RPC endpoint through which you want to connect to Ronin. In this example, the public RPC for the Saigon testnet https://saigon-testnet.roninchain.com/rpc. For other endpoints, see RPC endpoints.
    • chainId: the ID of the Ronin chain you want to connect to. Use 2021 for the Saigon testnet and 2020 for the Ronin mainnet.

    Example:

    void Start()
    {
    string waypointOrigin = "https://waypoint.roninchain.com";
    string clientId = "${YOUR_CLIENT_ID}";
    string deeplinkSchema = "mydapp";
    string rpcUrl = "https://saigon-testnet.roninchain.com/rpc";
    int chainId = 2021;
    // Initialize Waypoint
    SkyMavis.Waypoint.Init(waypointOrigin, clientId, deeplinkSchema, rpcUrl, chainId);
    }

Step 2. Create a response listener

Ronin Waypoint returns responses to your app through a redirect URI that you registered in the Developer Console.

For mobile platforms, the redirect URI is the deep link of your app.

Parameters:

  • id: a unique random identifier used to manage requests from the client to Ronin Waypoint.

Example:

    public async Task<string> WaitForWaypointResponse(string id)
{
string responseData = null;
string currentId = id;
void dataCallback(string state, string data) { if (currentId == state) responseData = data; }
SkyMavis.Waypoint.BindOnResponse(dataCallback);
while (string.IsNullOrEmpty(responseData) && currentId == _responseId) await Task.Yield();
SkyMavis.Waypoint.UnBindOnResponse(dataCallback);
return responseData;
}

Return:

  • responseData: the response data of Ronin Waypoint. For more information, see Response types.

Usage

User authorization

Signs in a user with Ronin Waypoint and connects the user's wallet. If the user doesn't have a Ronin Waypoint account, they can create one during the sign-up process.

Diagrams for sign-in with Ronin Waypoint

Fresh sign-in with Ronin Waypoint:

Full sign-in flow:

  1. Log in the user with the Ronin Waypoint service:

    • Use the OnAuthorize function to log in to a Ronin Waypoint account, connect the user's wallet, and return an ID token and the user's wallet addresses.

      static string OnAuthorize(string[] scopes = null)

      Parameters:

      • scope: the OAuth 2.0 scope. The openid, profile, email, wallet scopes are available for authorization. In Authorize function, to ask your users to create their keyless wallet if they don't have one, you need to include wallet scope.

      For details of OnAuthorize function response, see authorization response.

      Example:

      public async void OnAuthorizeClicked()
      {
      string[] scopes = new string[] { "email", "profile", "openid", "wallet" };
      _responseId = SkyMavis.Waypoint.OnAuthorize(scopes);
      string responseData = await WaitForMavisIdResponse(_responseId);
      Debug.Log("Authorize response : " + responseData);
      }
  2. Verify the user with the ID token:

    1. After the user logs in with the Ronin Waypoint service, you need to verify the ID token data in your server. For more information, see Verify the ID token programmatically.
    2. Issue a new access token for the client.
    3. Optionally, get the user's profile by following the steps in Get user profile.

Wallet interactions

RON transfer

Use the SendTransaction function to send RON tokens to a recipient's address. The function returns a transaction response containing the transaction hash.

string SendTransaction(string receiverAddress, string value)

Parameters:

  • receiverAddress: the recipient address.
  • value: the amount of RON to send, specified in wei (1 RON = 10^18 wei).

Example: transfer 0.1 RON to another address.

public async void OnSendTransactionClicked()
{
string receiverAddress = "0xD36deD8E1927dCDD76Bfe0CC95a5C1D65c0a807a";
string value = "100000000000000000";

_responseId = SkyMavis.Waypoint.SendTransaction(receiverAddress, value);
string responseData = await WaitForWaypointResponse(_responseId);
Debug.Log("Send response data in Unity : " + responseData);
}

Message signing

Use the OnPersonalSign function to sign plain text messages with the user's wallet. The function returns a transaction response containing the signature.

static string OnPersonalSign(string message)

Parameters:

  • message: the message to sign.

Example: sign the message accepting the terms and conditions.

public async void OnPersonalSignClicked()
{
string message = "Hello Axie Infinity";

_responseId = SkyMavis.Waypoint.OnPersonalSign(message);
string responseData = await WaitForWaypointResponse(_responseId);
Debug.Log("Personal sign response: " + responseData);
}

Typed data signing

Use the OnSignTypeData function to sign typed data structured according to the EIP-712 standard, returning a transaction response containing the signature.

string OnSignTypeData(string typedData)

Parameters:

  • typedData: a JSON string that specifies the EIP-712 typed structured data to be signed by the user.

Example: sign typed data for an order on Axie Marketplace.

public async void OnSignTypedDataClicked()
{

string typedData = @"{""types"":{""Asset"":[{""name"":""erc"",""type"":""uint8""},{""name"":""addr"",""type"":""address""},{""name"":""id"",""type"":""uint256""},{""name"":""quantity"",""type"":""uint256""}],""Order"":[{""name"":""maker"",""type"":""address""},{""name"":""kind"",""type"":""uint8""},{""name"":""assets"",""type"":""Asset[]""},{""name"":""expiredAt"",""type"":""uint256""},{""name"":""paymentToken"",""type"":""address""},{""name"":""startedAt"",""type"":""uint256""},{""name"":""basePrice"",""type"":""uint256""},{""name"":""endedAt"",""type"":""uint256""},{""name"":""endedPrice"",""type"":""uint256""},{""name"":""expectedState"",""type"":""uint256""},{""name"":""nonce"",""type"":""uint256""},{""name"":""marketFeePercentage"",""type"":""uint256""}],""EIP712Domain"":[{""name"":""name"",""type"":""string""},{""name"":""version"",""type"":""string""},{""name"":""chainId"",""type"":""uint256""},{""name"":""verifyingContract"",""type"":""address""}]}, ""domain"":{""name"":""MarketGateway"",""version"":""1"",""chainId"":2021,""verifyingContract"":""0xfff9ce5f71ca6178d3beecedb61e7eff1602950e""},""primaryType"":""Order"",""message"":{""maker"":""0xd761024b4ef3336becd6e802884d0b986c29b35a"",""kind"":""1"",""assets"":[{""erc"":""1"",""addr"":""0x32950db2a7164ae833121501c797d79e7b79d74c"",""id"":""2730069"",""quantity"":""0""}],""expiredAt"":""1721709637"",""paymentToken"":""0xc99a6a985ed2cac1ef41640596c5a5f9f4e19ef5"",""startedAt"":""1705984837"",""basePrice"":""500000000000000000"",""endedAt"":""0"",""endedPrice"":""0"",""expectedState"":""0"",""nonce"":""0"",""marketFeePercentage"":""425""}}";

_responseId = SkyMavis.Waypoint.OnSignTypeData(typedData);
string responseData = await WaitForWaypointResponse(_responseId);
Debug.Log("Sign typed data response " + responseData);
}

Contract function calls

Use the OnCallContract function to execute a function on a smart contract, returning a transaction response containing the transaction hash.

string OnCallContract(string contractAddress, string data, string value = "0x0")

Parameters:

  • contractAddress: the address of the smart contract on which to execute the transaction.
  • data: the transaction data to send to the smart contract, encoded as a hex string. For help with encoding, use Function data encoder utility.
  • value: the amount of RON in wei (1 RON = 10^18 wei) to send along with the transaction. For non-payable smart contracts, the value is 0x0.

Example: allow another contract to spend 1 AXS on user's behalf.

public async void OnApproveErc20Clicked()
{
// Contract address
string contractAddress = "0x3c4e17b9056272ce1b49f6900d8cfd6171a1869d";
// Readable ABI string for the function
string readableAbi = "function approve(address _spender, uint256 _value)";
// Approve 1 AXS
var approveParams = new { _spender = "0x6B190089ed7F75Fe17B3b0A17F6ebd69f72c3F63", _value = 1000000000000000000 };
try
{
var data = ABI.EncodeFunctionData(readableAbi, approveParams);
Debug.Log("Approve data: " + data);
_responseId = SkyMavis.Waypoint.OnCallContract(contractAddress, data);
string responseData = await WaitForWaypointResponse(_responseId);
Debug.Log(responseData);
}
catch (System.Exception e)
{
Debug.Log("Error in call contract: " + e.Message);
}

}

Utilities

Function data encoder

The EncodeFunctionData utility encodes function data for smart contract interactions.

string EncodeFunctionData(string ABI, object values)

Parameters:

  • ABI: a readable ABI string that defines the function to call on the smart contract.
  • values: an array of values to pass as parameters to the smart contract function specified in the ABI.

The following sections provide some examples of how to use utility.

Swap tokens on Katana

This example sends a transaction to the Katana decentralized exchange to swap RON for AXS.

using SkyMavis.Utils;

public async void OnSwapRonToAxsClicked()
{
// Contract addresses
string katanaAddress = "0xDa44546C0715ae78D454fE8B84f0235081584Fe0";
string ronAddress = "0xa959726154953bae111746e265e6d754f48570e6";
string axsAddress = "0x3c4e17b9056272ce1b49f6900d8cfd6171a1869d";
// Wallet address
string walletAddress = "0x6B190089ed7F75Fe17B3b0A17F6ebd69f72c3F63";
// Readable ABI string for the function
string readableAbi = "function swapExactRONForTokens(uint256 _amountOutMin, address[] _path, address _to, uint256 _deadline)";

// Values to pass as parameters to the called function
var value = "1000000000000000000";

var swapParams = new
{
// 0.1 RON
_amountOutMin = "0",
_path = new string[] { ronAddress, axsAddress },
_to = walletAddress,
_deadline = "1814031305"
};

try
{
// Encode data using the EncodeFunctionData utility
var data = ABI.EncodeFunctionData(readableAbi, swapParams);
// Send transaction to Katana contract
_responseId = SkyMavis.Waypoint.OnCallContract(katanaAddress, data, value);
// Wait for the response
string responseData = await WaitForWaypointResponse(_responseId);
Debug.Log(responseData);
}
catch (System.Exception e)
{
Debug.Log("Error in call contract: " + e.Message);
}
}

Activate Atia's Blessing

Sends a transaction to the Atia Shrine smart contract to activate the "Atia's Blessing" feature in Axie Infinity games. This is a daily check-in feature.

using SkyMavis.Utils;
public async void onClickAtiaBlessing()
{

string walletAddress = "0x6b190089ed7f75fe17b3b0a17f6ebd69f72c3f63";
string atiaShrineContractAddress = "0xd5c5afefad9ea288acbaaebeacec5225dd3d6d2b";

string readableAbi = "function activateStreak(address to)";
Debug.Log(readableAbi);
var values = new string[] { walletAddress };

try
{
var data = ABI.EncodeFunctionData(readableAbi, values);
_responseId = SkyMavis.Waypoint.OnCallContract(atiaShrineContractAddress, data);
string responseData = await WaitForWaypointResponse(_responseId);
Debug.Log("Atia blessing response data in Unity " + responseData);

}
catch (System.Exception e)
{
Debug.Log("Error in Atita's blessing : " + e.Message);
}

}

Smart contract reader

You can use the Skynet class to read data from smart contracts using the Skynet REST API.

Make sure to initialize the Skynet class with the required parameters before using it.

class Skynet(ApiKey, ownerAddress, NftContractAddresses, ERC20ContractAddresses);

Parameters:

  • ApiKey: your app's API key from the Developer Console.
  • ownerAddress: the user's keyless wallet address.
  • NftContractAddresses: an array of contract addresses for ERC-721 tokens.
  • ERC20ContractAddresses: an array of contract addresses for ERC-20 tokens.

Example:

var SkynetAPI = "${SKYNET_API_KEY}";
var ownerAddress = "${RONIN_WALLET_ADDRESS}";
var NftContractAddresses = new string[] { Constants.Mainnet.ERC721.AxieContractAddress };
var ERC20ContractAddresses = new string[] { Constants.Mainnet.ERC20.AXSContractAddress, Constants.Mainnet.ERC20.SLPContractAddress, Constants.Mainnet.ERC20.WRONContractAddress, Constants.Mainnet.ERC20.WETHContractAddress };
var skynet = Skynet(SkynetAPI, ownerAddress, NftContractAddresses, ERC20ContractAddresses);

The following sections provide examples of how to use the Skynet class.

Get total NFTs of address

Use the GetTotalNFTs function to fetch the total count of NFTs defined in NftContractAddresses for the specified ownerAddress.

async Task<object> GetTotalNFTs()

Returns:

{
items: object[] {
createdAtBlock: string,
createdAtBlockTime: integer,
ownerAddresses: string,
rawMetadata: array,
tokenId: integer,
tokenName: string,
tokenStandard: string,
tokenSymbol: string,
tokenURI: string,
updatedAtBlock: integer,
updatedAtBlockTime: integer
},
paging: object {
total: integer
}
}

Example:

// Initialize Skynet
var skynet = InitializeSkynet();

// Get the total NFTs of the owner address
var response = await skynet.GetTotalNFTs();

Debug.Log("Result: Total NFTs of address: " + response);

Get NFT metadata by token ID

Use the GetNFTsMetadata function to fetch metadata for an NFT using its token ID within the specified NftContractAddresses and ownerAddress.

async Task<object> GetNFTsMetadata(string[] tokenIds)

Parameters:

  • tokenIds: an array of token IDs for which to retrieve metadata.

Example:

// Initialize Skynet
var skynet = InitializeSkynet();

// Get the NFT metadata by token ID
var tokenIds = new string[] {${NFT_TOKEN_ID}};
var response = await skynet.GetNFTsMetadata(tokenIds);

Debug.Log("Result: NFT metadata with tokenIds: " + response);

Get total ERC-20 balances of address

Use the GetERC20TokenBalances function to fetch the total balance of ERC-20 tokens defined in Erc20ContractAddresses for the specified ownerAddress.

async Task<object> GetERC20TokenBalances()

Returns:

items: object[] {
balance: string
contractAddress: string
decimals: integer
ownerAddress: string
tokenId: string
tokenName: string
tokenStandard: string
tokenSymbol: string
},
paging : object {
total : integer
}

Example:

// Initialize Skynet
var skynet = InitializeSkynet();
// Get the total ERC-20 balances of the owner address
var response = await skynet.GetERC20TokenBalances();
var result = await response.Content.ReadAsStringAsync();

Debug.Log("Result: Total token balances of owner address: " + result);

Execute an RPC call

Use the CallRPC function to execute an RPC call to Ronin.

Task<string> CallRPC(string contractAddress, string data)

Parameters:

  • contractAddress: the address of the smart contract to call.
  • data: the data to send to the smart contract, encoded as a hex string.

Example:

using SkyMavis.Utils;

// Initialize Skynet
var skynet = InitializeSkynet();
// ABI for the allowance function
var allowanceOfABI = @"{""constant"":true,""inputs"":[{""internalType"":""address"",""name"":""_owner"",""type"":""address""},{""internalType"":""address"",""name"":""_spender"",""type"":""address""}],""name"":""allowance"",""outputs"":[{""internalType"":""uint256"",""name"":""_value"",""type"":""uint256""}],""payable"":false,""stateMutability"":""view"",""type"":""function""}";
// Assign values for the ABI parameters
var args = new object[] { "0x2d62c27ce2e9e66bb8a667ce1b60f7cb02fa9810", Constants.Mainnet.KatanaAddress };
// Encode data using the EncodeFunctionData utility
var data = ABI.EncodeFunctionData(allowanceOfABI, args);
// Send RPC call to check amount of AXS tokens user allowed Katana contract to spend
var result = await skynet.CallRPC(Constants.Mainnet.ERC20.AXSContractAddress, data);
// Process result: remove "0x", parse hex string to BigInteger, and format value to get Ether balance
result = result.StartsWith("0x") ? result.Substring(2) : result;
BigInteger weiValue = BigInteger.Parse(result, System.Globalization.NumberStyles.HexNumber);
BigInteger divisor = BigInteger.Pow(10, 18);
decimal formatedValue = (decimal)weiValue / (decimal)divisor;

Debug.Log("Formatted Ether balance: " + formatedValue);

Reference

Function summary

FunctionDescription
OnAuthorizeSigns user in to Ronin Waypoint and returns their wallet address.
OnGetIDTokenReturns the user's ID token and keyless wallet address for Mavis Hub users.
SendTransactionSends RON tokens to a recipient address.
OnPersonalSignSigns plain text messages with the user's wallet.
OnSignTypeDataSigns structured data following the EIP-712 standard.
OnCallContractExecutes functions on smart contracts.
EncodeFunctionDataEncodes function data for smart contract interactions.
SkynetReads data from smart contracts using the Skynet REST API.
GetTotalNFTsA Skynet function that fetches the total count of NFTs for the specified owner address.
GetNFTsMetadataA Skynet function that fetches metadata for NFTs using their token IDs.
GetERC20TokenBalancesA Skynet function that fetches the total balance of ERC-20 tokens for the specified owner address.
CallRPCA Skynet function that executes an RPC call to Ronin.

Response types

Authorization response

For mobile platforms, Ronin Waypoint returns an authorization response directly to your game after a user connects their wallet.

For desktop platforms, Ronin Waypoint returns an authorization response to the Mavis Hub client, then the client returns the response to your game.

Authorization success

Mobile:

mydapp://callback?state=2ab49965-249a-48c7-896e-90967778383b&method=auth&version=1.4&type=success&data=ey...&address=0x16...ac&secondary_address=0x68...38

Response parameters:

  • state: a unique random identifier used to manage requests from the client to Ronin Waypoint.
  • method: the method used for the request (auth).
  • version: the version of the Ronin Waypoint service.
  • type: the response type (success).
  • data: the ID token that contains encoded user information.
  • address: the user's keyless wallet address.
  • secondary_address: the user's secondary wallet address, if available.

Desktop:

"type": "success",
"data": {
"idToken": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjAxOGZjOTE0LWM5NTAtNzg1MS04MDBjLWEwMzZjNDM2ZDg1ZCIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2lkLnNreW1hdmlzLmNvbSIsInN1YiI6IjFlZjc5NzM1LWYyNjItNmJhNS1iMTQzLTQzMjI1MGJkNzBmOCIsImF1ZCI6WyJlYzYyYzA2Zi0xZTU2LTQ0ZGEtODY2NS00OTNkMWJiNTY5NWYiXSwiZXhwIjoxNzI5MTQ2OTA2LCJuYmYiOjE3MjkxNDY2MDYsImlhdCI6MTcyOTE0NjYwNiwianRpIjoiMDE5Mjk5MmItNTIwZi03NzVmLWI2MGUtNWVmZDI1MWQyMWViIiwic2lkIjoiYXBwLm1hdmlzaHViLnNlc3Npb24iLCJlbWFpbCI6ImRlbW8td2F5cG9pbnRAeW9wbWFpbC5jb20iLCJyb2xlcyI6WyJ1c2VyIl19.Vu-1id_JYcET8zwL_BWzyBg2DRYBvBdTRNkjHYPtwBhWx1JvIHnkc7uy6gEQVkkME1IXcS--_xo_RAMEZwd6N83k4YVAbsFva-TnGJJU-ncL99BnxTzjlM-buMYh70psaFNwlmRZzVqRzXci07omPKerkuCToPeVVW7BomWXrta1QEoMuSYYyZbK7uoe-UC_DDm_N8qjGJZrtm8kZb32yc9twfTQg1F7aIo-H8a0pN4ae8QKztrZNXvdrP_ibF2WMmHu0JjEY0GFbqkolzERsood3UkD10mQwFJx5Feo7OOPzGpDegnwN7wSw-1FRyKvs9LZYLM65daxuIoO4Kddp44_QzBl2C28gvXaOpuOQFeUoj_pXzLrwuZqPa9Gh28gPcGUwfiks7acK4z-cOucpYRC1RxNqBMhG65CGafnpJ1A5e7TDXxK6Z4s7TvGMoX_wZnqx-6rh1FjwCTy2ZSBgJwvWjQfmqR2WdSoTOnpaDpgsVFQ1aDPn77tVp3fUL4yFmpHbfCAUgQXn5N-w2OxEApN2H_28XM3r6b3Ef2foQ_CgVeEdm71kp_bCQ4QNQqFWy8Mun7wlyRe6AjcGoxaRcnhj5fMXC7i029cUqVeXCIKbSqfmlTfqFXxVI4ui0_-SlIkNqzJ_Hcpech3wEq_5Fh77FrnfsSNR3Exjx7snbQ",
"accountWallet": {
"identity": "0xb6679a20926e0f4bb71511aa70a94d2b4f7b6674",
"secondary": "0x68a8b3cd8164f3e0e6b0510d97208c518340bf38"
}
}

Response parameters:

  • state: a unique random identifier used to manage requests from the client to Ronin Waypoint.
  • type: the response type (success).
  • idToken: the ID token that contains encoded user information.
  • identity: the user's keyless wallet address.
  • secondary: the user's secondary wallet address, if available.
Authorization error
mydapp://callback?state=84d18549-df10-451f-8235-184b594e3706&method=auth&version=1.4&type=fail&code=1000&message=%5BWALLET_USER_CANCEL%5D+User+rejected

Response parameters:

  • type: the response type (fail).
  • code: the error code.
  • message: a message describing the error. For more information, see Error codes.

Transaction response

Ronin Waypoint returns a transaction response after a user sends a transaction, signs a message, signs typed data, or calls a contract on the blockchain.

Transaction success
mydapp://callback?state=0bccde82-01d5-4403-90fd-f8edcfdd2ed4&method=send&version=1.4&type=success&data=0x3a...0d

Response parameters:

  • state: a unique random identifier used to manage requests from the client to Ronin Waypoint.
  • method: the method used for the request (send for transactions and sign for signing).
  • version: the version of the Ronin Waypoint service.
  • type: the response type (success).
  • data: the transaction hash.
Transaction error
mydapp://callback?state=84d18549-df10-451f-8235-184b594e3706&method=send&version=1.4&type=fail&code=1000&message=%5BWALLET_USER_CANCEL%5D+User+rejected

Response parameters:

  • type: the response type (fail).
  • code: the error code.
  • message: a message describing the error.

Example app

The Unity SDK includes an example app that demonstrates the SDK features. To run the app, follow these steps:

  1. Clone the skymavis/waypoint-unity repository, then add it as a new project in Unity Hub.
  2. In Build Settings, select the platform you want to deploy to, then click Switch Platform.
  3. Click Build and Run to open the app on the selected platform.

Make sure to fill in the client ID and redirect URI that you registered in the Developer Console.

For more information, see the official Unity documentation.