Ejemplo n.º 1
0
    async private void Mint()
    {
        EnjinIdentity      userIdentity  = AccountManager.instance.userIdentity;
        EnjinAdminIdentity adminIdentity = AccountManager.instance.adminIdentity;

        Debug.Log(receiverAddress);

        string receiverAddress = userIdentity.GetEthereumAddress().Reduce(() => {
            throw new System.Exception("Can't find any ETH address");
        });

        Debug.Log(receiverAddress);

        string tokenID = "";

        string[] receivers = new string[] { receiverAddress };
        int[]    amounts   = new int[] { 1 };

        IRequestHandler mintRequestHandler =
            adminIdentity.CreateMintItemRequestHandler(tokenID, receivers, amounts);

        await mintRequestHandler.RegisterCallback(RequestEventType.MintPending, (requestEvent) => {
            Debug.Log("Completed Mint Pending");
        });

        await mintRequestHandler.RegisterCallback(RequestEventType.MintBroadcast, (requestEvent) => {
            Debug.Log("Completed Mint Broadcast");
        });

        await mintRequestHandler.RegisterCallback(RequestEventType.MintExecuted, (requestEvent) => {
            Debug.Log("Completed Mint Executed");
        });
    }
Ejemplo n.º 2
0
    async public void LoginAdmin()
    {
        string    email    = "*****@*****.**";
        string    password = "******";
        EnjinUser user     = await EnjinUser.Login(email, password);

        Option <EnjinIdentity> adminIdentityOption = await user.GetIdentityForAppId(APP_ID);

        EnjinIdentity identity = adminIdentityOption.Reduce(() => {
            throw new System.Exception("User ID not found");
        });

        adminAddress  = identity.GetEthereumAddress().Reduce("");
        adminIdentity = identity.asAdmin();
    }