Sign Typed Data v3

Request

This method follows EIP-712 https://eips.ethereum.org/EIPS/eip-712

Ask the user to sign typed data

Learn more: https://docs.metamask.io/guide/signing-data.html#sign-typed-data-v3

#include "HyperPlayUtils.h"
#include "Endpoints/RpcCall.h"
#include "Endpoints/GetAccounts.h"

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

    UE_LOG(LogTemp, Display, TEXT("Rpc get accounts Success: %s"), bWasSuccessful ? "true" : "false");
    UE_LOG(LogTemp, Display, TEXT("Rpc sign typed data v3 Response: %s"), *Response);
}

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

    UE_LOG(LogTemp, Display, TEXT("SendContract Success: %s"), bWasSuccessful ? "true" : "false");
    UE_LOG(LogTemp, Display, TEXT("SendContract Response: %s"), *Response);

    const FString request("{\"method\":\"eth_signTypedData_v3\",\"params\":[\""
        + Response
        + "\",\"{\\\"types\\\": {\\\"EIP712Domain\\\": [{\\\"name\\\": \\\"name\\\",\\\"type\\\": \\\"string\\\"},{\\\"name\\\": \\\"version\\\",\\\"type\\\": \\\"string\\\"}],\\\"LoginData\\\": [{\\\"name\\\": \\\"game\\\",\\\"type\\\": \\\"string\\\"},{\\\"name\\\": \\\"contents\\\",\\\"type\\\": \\\"string\\\"}]},\\\"primaryType\\\": \\\"LoginData\\\",\\\"domain\\\": {\\\"name\\\": \\\"HyperPlay\\\",\\\"version\\\": \\\"1\\\"},\\\"message\\\": {\\\"game\\\": \\\"HyperPlay FPS Demo\\\",\\\"contents\\\": \\\"Sign this message to log in!\\\"}}\"]}");

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

int main(){
UGetAccounts* GetAccountsInstance = UGetAccounts::GetAccounts(nullptr, 5, "");
GetAccountsInstance->GetOnCompletedDelegate().AddRaw(this, &OnAcctResponse);
GetAccountsInstance->Activate();
}