下午好!如何在Unity中正确地向服务器请求此API?我特别对Mint / burn感兴趣
https://docs.openvessel.io/integration/EZzgG67O9oXGl9CReheF/game-api/tokens
https://game-api.stage.openvessel.io/docs/ui/swagger-ui/index.html#/
此示例不起作用
IEnumerator Upload()
{
MintTokin mintTokin = new MintTokin();
mintTokin.to = walletAddress;
mintTokin.amount = 10;
var json = JsonUtility.ToJson(mintTokin);
var request = new UnityWebRequest("https://game-api.openvessel.io//tokens/manage/com.stage.mv-game.mv-collection.mv-item/mint", "POST");
byte[] bodyRaw = Encoding.UTF8.GetBytes(json);
request.uploadHandler = (UploadHandler)new UploadHandlerRaw(bodyRaw);
request.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
request.SetRequestHeader("X-Auth-Key", acesToken);
request.SetRequestHeader("X-OpenVessel-Request-Id", "ab62663d-1645-4026-ba2d-d888b9634de9");
yield return request.SendWebRequest();
if (request.error != null)
{
Debug.Log("Erro: " + request.error);
_statusText.text = request.error;
}
else
{
Debug.Log("All OK");
Debug.Log("Status Code: " + request.downloadHandler.text);
}
}
1条答案
按热度按时间iyr7buue1#
**强烈建议不要在任何游戏中使用它,因为它可能会导致无法控制地访问您的工作室钱包。应该通过Vessel控制面板进行Mint。**X-Auth-Key是与您的工作室ERC-20钱包关联的私钥。
以下步骤将对您有所帮助:
{fqTn}
。X-Auth-Key
的值不应以“0x”前缀开头,如www.example.com中的示例所示https://game-api.stage.openvessel.io/docs/ui/swagger-ui/index.html#/03%20Tokens/mintToken