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)

Personal Sign

Request

Signs message with wallet

There are two params

  • The string to sign

  • The address of the signer

curl --location --request POST "localhost:9680/rpc" \
--header 'Content-Type: application/json' \
--data-raw '{
    "request": {
        "method": "personal_sign",
        "params": ["helloo!", "0x638105aa1b69406560f6428aeface3db9da83c64"]
    },
    "chain": {
        "chainId": "1"
    }
}'
using System.Collections;
using UnityEngine;
using UnityEngine.Networking;

public class PersonalSign : MonoBehaviour
{
    void Start()
    {
        StartCoroutine(Sign());
    }

    private IEnumerator Sign()
    {
        string jsonString = "{ \"request\": { \"method\": \"personal_sign\", \"params\": [\"helloo!\", \"0x638105aa1b69406560f6428aeface3db9da83c64\"] }, \"chain\": { \"chainId\": \"5\" } }";
        byte[] jsonBytes = System.Text.Encoding.UTF8.GetBytes(jsonString);

        UnityWebRequest request = new UnityWebRequest("localhost:9680/rpc", "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);
    }
}
#include "HyperPlayUtils.h"
#include "Endpoints/RpcCall.h"

void OnRpcResponse(FString Response, int32 StatusCode)
{
	const bool bWasSuccessful = HyperPlayUtils::StatusCodeIsSuccess(StatusCode);

	UE_LOG(LogTemp, Display, TEXT("Rpc Personal Sign Success: %s"), bWasSuccessful ? "true" : "false");
	UE_LOG(LogTemp, Display, TEXT("Rpc Personal Sign Response: %s"), *Response);
}

int main(){
   const FString request("{\"method\": \"personal_sign\",\"params\": [\"helloo!\", \"0x638105aa1b69406560f6428aeface3db9da83c64\"]}")

	URpcCall* RpcCallInstance = URpcCall::RpcCall(nullptr,
		request,
		1);
	RpcCallInstance->GetOnCompletedDelegate().AddRaw(this, &OnRpcResponse);
	RpcCallInstance->Activate();
}

Response

0x248664217cb1dfb3fa5fad290c053c9aaab8812d0fe9d7ad493b5857b4bc43e93efa51c1fdedff937d0b0919f8f6326c511e688a3fce631cd309b524f518bd081c

Errors will have an HTTP response status 500-599

{
  "message": "error description here"
}
PreviousSend ContractNextSign Typed Data v3

Last updated 1 year ago

đŸ•šī¸