< Summary

Class:TransactionBridge
Assembly:TransactionHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/TransactionHUD/TransactionBridge.cs
Covered lines:0
Uncovered lines:12
Coverable lines:12
Total lines:56
Line coverage:0% (0 of 12)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
RequestWeb3ApiUse(...)0%42600%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/TransactionHUD/TransactionBridge.cs

#LineLine coverage
 1using UnityEngine;
 2
 3public class TransactionBridge : MonoBehaviour
 4{
 5    public ITransactionHUDController transactionController;
 6
 7    [System.Serializable]
 8    class RequestWeb3ApiUseMessage
 9    {
 10        [System.Serializable]
 11        public class RequestWeb3ApiUsePayload
 12        {
 13            public string sceneId;
 14            public string message;
 15            public string toAddress;
 16            public float amount;
 17            public string currency;
 18        }
 19        public string id;
 20        public string requestType;
 21        public RequestWeb3ApiUsePayload payload;
 22    }
 23
 24    public void RequestWeb3ApiUse(string payload)
 25    {
 026        if (transactionController == null)
 027            return;
 28
 029        var model = JsonUtility.FromJson<RequestWeb3ApiUseMessage>(payload);
 30
 031        var requestType = DCL.TransactionHUDModel.Type.REQUIRE_PAYMENT;
 032        switch (model.requestType)
 33        {
 34            case "requirePayment":
 035                requestType = DCL.TransactionHUDModel.Type.REQUIRE_PAYMENT;
 036                break;
 37            case "signMessage":
 038                requestType = DCL.TransactionHUDModel.Type.SIGN_MESSAGE;
 039                break;
 40            case "sendAsync":
 041                requestType = DCL.TransactionHUDModel.Type.SEND_ASYNC;
 42                break;
 43        }
 44
 045        transactionController.ShowTransaction(new DCL.TransactionHUDModel.Model
 46        {
 47            id = model.id,
 48            requestType = requestType,
 49            sceneId = model.payload.sceneId,
 50            message = model.payload.message,
 51            toAddress = model.payload.toAddress,
 52            amount = model.payload.amount,
 53            currency = model.payload.currency
 54        });
 055    }
 56}