HyperPlay API Docs
  • ๐ŸŸฃHyperPlay
  • ๐ŸŽฎOverview
  • โฌ‡๏ธInstall HyperPlay
  • โ“FAQ
  • Developer Docs
    • ๐Ÿ“œPublish / List a Game
      • โš’๏ธBuilding with HyperPlay
      • ๐Ÿ“ƒPublishing Your Game
      • ๐Ÿ›ณ๏ธCI/CD Automation
      • ๐Ÿ–ฅ๏ธDeveloper Portal
      • ๐Ÿ“›HyperPlay Store Badges
      • ๐ŸŽจHyperPlay Hex Codes
      • ๐Ÿ†˜Feedback & Developer Support
      • ๐Ÿฉน[Beta] Patching
    • โŒจ๏ธDesign Considerations
      • Unreal Engine Integration
      • Unity Integration
    • ๐Ÿ•น๏ธAPI for Native Games (EVM)
      • Get Accounts
      • Sign-in With Ethereum
      • Get Balance
      • Call Contract Example
      • Send Transaction
      • Send Contract
      • Personal Sign
      • Sign Typed Data v3
      • Sign Typed Data v4
      • Add or Switch Network
      • Add Token
      • RPC Raw
    • ๐ŸŽฑAPI for Native Games (Non-EVM)
      • Sui Blockchain
        • Get Accounts
        • Get Balance
        • Get Object
        • Send Transaction
        • Send Contract
        • Personal Sign
    • ๐ŸŒAPI for Browser Games (EVM)
    • ๐Ÿš€Quests
      • How to Create a Quest
    • ๐ŸชStore APIs
      • Listings by Popularity
    • ๐ŸทCompatibility Layer
      • Benefits of using a Compatibility Layer
      • Downsides and Limitations of the Compatibility Layer
      • FAQ
  • ๐Ÿ”‘Access Configs
    • How to create Access Codes
    • How to token gate a Release Branch
Powered by GitBook
On this page
  • Request
  • Response
  1. Developer Docs
  2. API for Native Games (EVM)

RPC Raw

Request

HyperPlayโ€™s API includes chainId in the request body for better UX and security.

rpcRaw

  • Does not require chainId

  • Allows multiple RPC calls

curl --location 'localhost:9680/rpcRaw' \
--header 'Content-Type: application/json' \
--data '[
    {
      "method": "eth_accounts"
    },
    {
      "method": "eth_getBalance",
      "params": ["0x87885AaEEdED51C7e3858a782644F5d89759f245", "latest"]
    }
]
'
using System.Collections;
using UnityEngine;
using UnityEngine.Networking;

public class RawRpc: MonoBehaviour
{
    void Start()
    {
        StartCoroutine(Send());
    }

    private IEnumerator Send()
    {
        string jsonString = "[ { \"method\": \"eth_accounts\" }, { \"method\": \"eth_getBalance\", \"params\": [\"0x87885AaEEdED51C7e3858a782644F5d89759f245\", \"latest\"] } ]";
        byte[] jsonBytes = System.Text.Encoding.UTF8.GetBytes(jsonString);

        UnityWebRequest request = new UnityWebRequest("localhost:9680/rpcRaw", "POST");
        request.uploadHandler = new UploadHandlerRaw(jsonBytes);
        request.downloadHandler = new DownloadHandlerBuffer();
        request.SetRequestHeader("Content-Type", "application/json");

        yield return request.SendWebRequest();
        Debug.Log(request.error);
        Debug.Log(request.downloadHandler.text);
    }
}

Response

[
    {
        "result": [
            "0x638105AA1B69406560f6428aEFACe3DB9da83c64"
        ],
        "id": -1,
        "jsonrpc": "2.0"
    },
    {
        "result": "0x5ff309feea9f67c21",
        "id": -1,
        "jsonrpc": "2.0"
    }
]

Errors will have an HTTP response status 500-599

{
  "message": "error description here"
}
PreviousAdd TokenNextAPI for Native Games (Non-EVM)

Last updated 1 year ago

๐Ÿ•น๏ธ