예제 #1
0
        // Array request, string service, Action<string> callback, string callbackUrl
        public async Task <Texture2D> GetRequestQR()
        {
            // Uri for request transaction
            string baseRequestUri = "", trxRequestUri = "";

            // Get RSA key(public key, private key)
            Util.GetRSAKey(out pubKey, out privKey);

            // URI for usage
            baseRequestUri += "meta://information?u=" + usage;

            // URI for request
            baseRequestUri += "&r=" + string.Join(",", request);

            // URI for callbackUrl and callback
            if (!string.IsNullOrEmpty(callbackUrl))
            {
                baseRequestUri += "&c=" + WWW.EscapeURL(callbackUrl);
            }
            else
            {
                baseRequestUri += "&c=https%3A%2F%2F0s5eebblre.execute-api.ap-northeast-2.amazonaws.com/dev?key=" + session;
            }

            // URI for AA or SP metaID - Should pass parameter with metaID string
            //this.trxRequestUri += "&m=" + metaID

            // URI for public key
            baseRequestUri += "&p=" + WWW.EscapeURL(pubKey);

            Debug.Log("Request baseRequestUri: " + baseRequestUri);

            // URI for IPFS
            IPFSClass ipfs = new IPFSClass();

            trxRequestUri = await ipfs.IpfsAdd(baseRequestUri);

            Debug.Log("Request trxRequestUri(IPFS hash): " + trxRequestUri);

            // Polling request using timer
            timer = new Timer {
                Interval = 2000
            };
            timer.Elapsed  += HttpRequest;
            timer.AutoReset = true;
            timer.Enabled   = true;
            timer.Start();

            // Make QRCode for request
            QRcode.QRcode metaQR = new QRcode.QRcode();
            return(metaQR.MakeQR(256, trxRequestUri));
        }
예제 #2
0
        // Array request, string service, Action<string> callback, string callbackUrl
        public async Task <Texture2D> SendTransaction()
        {
            // Uri for transaction
            string baseRequestUri = "meta://transaction?", trxRequestUri = "";

            // URI for to, value, data
            baseRequestUri += "t=" + to + "&v=" + HexBigIntegerConvertorExtensions.ToHex(value, true) + "&d=" + HexStringUTF8ConvertorExtensions.ToHexUTF8(data);

            // URI for usage
            baseRequestUri += "&u=" + usage;

            // URI for callbackUrl and callback
            if (!string.IsNullOrEmpty(callbackUrl))
            {
                baseRequestUri += "&c=" + WWW.EscapeURL(callbackUrl);
            }
            else
            {
                baseRequestUri += "&c=https%3A%2F%2F0s5eebblre.execute-api.ap-northeast-2.amazonaws.com/dev?key=" + session;
            }

            Debug.Log("Transaction baseRequestUri: " + baseRequestUri);

            // URI for IPFS
            IPFSClass ipfs = new IPFSClass();

            trxRequestUri = await ipfs.IpfsAdd(baseRequestUri);

            Debug.Log("Transaction trxRequestUri(IPFS hash): " + trxRequestUri);

            // Polling request using timer
            timer = new Timer {
                Interval = 2000
            };
            timer.Elapsed  += HttpRequest;
            timer.AutoReset = true;
            timer.Enabled   = true;
            timer.Start();

            // Make QRCode for request
            QRcode.QRcode metaQR = new QRcode.QRcode();
            return(metaQR.MakeQR(256, trxRequestUri));
        }