public void GetExchangeRatesCallback(BlockchainWebChecker.ResponseData data) { if (debugLevel > 0) { Debug.Log("BitcoinSDKGui: GetExchangeRatesCallback"); } messageLog += "GetExchangeRatesCallback\n"; if (debugLevel > 1) { messageLog += data.message; } // convert currency to BTC float sourceCurrencyAmount = float.Parse(availableAssets[currentBtcAsset].sourceCurrencyAmountStr); float targetBtc = BlockchainWebChecker.instance.dataMgr.convertCurrencyToBtc(sourceCurrencyAmount, availableAssets[currentBtcAsset].sourceCurrencyTypeStr); float targetSatoshi = targetBtc * satoshiToBtc; int targetSatoshiInt = Mathf.RoundToInt(targetSatoshi); Debug.Log("BitcoinSDKGui: GetExchangeRatesCallback: " + sourceCurrencyAmount + " " + availableAssets[currentBtcAsset].sourceCurrencyTypeStr + " => " + targetBtc + " btc => (" + targetSatoshi + ") " + targetSatoshiInt + " satoshi"); messageLog += sourceCurrencyAmount.ToString() + " USD => " + targetBtc + " btc => (" + targetSatoshi + ") " + targetSatoshiInt + " satoshi"; availableAssets[currentBtcAsset].currencyAmountStr = targetSatoshiInt.ToString(); LoggingText.GetComponent <Text>().text = messageLog; requestMoney(); }
// verify public void GetTXHashCallback(BlockchainWebChecker.ResponseData data) { Debug.Log("BitcoinSDKGui: GetTXHashCallback"); messageLog += "GetTXHashCallback\n"; if (debugLevel > 1) { messageLog += data.message; } currencyAmountStr = InputField_TargetAmount.GetComponentInChildren <InputField>().text; long amount = long.Parse(currencyAmountStr); bool verifyTest = BlockchainWebChecker.instance.dataMgr.verifyTransaction(sendToWalletAddress, amount); if (verifyTest) { messageLog += "verified " + amount + "\n"; } else { messageLog += "verify failed! \n"; } LoggingText.GetComponent <Text>().text = messageLog; }
public void GetExchangeRatesCallback(BlockchainWebChecker.ResponseData data) { if (debugLevel > 0) { Debug.Log("BitcoinSDKGui: GetExchangeRatesCallback"); } messageLog += "GetExchangeRatesCallback\n"; if (debugLevel > 1) { messageLog += data.message; } // convert currency to BTC string sourceCurrencyAmountStr = InputField_SourceAmount.GetComponentInChildren <UnityEngine.UI.InputField>().text; float sourceCurrencyAmount = float.Parse(sourceCurrencyAmountStr); float targetBtc = BlockchainWebChecker.instance.dataMgr.convertCurrencyToBtc(sourceCurrencyAmount, "USD"); float targetSatoshi = targetBtc * satoshiToBtc; int targetSatoshiInt = Mathf.RoundToInt(targetSatoshi); Debug.Log("BitcoinSDKGui: GetExchangeRatesCallback: " + sourceCurrencyAmount + " USD => " + targetBtc + " btc => (" + targetSatoshi + ") " + targetSatoshiInt + " satoshi"); messageLog += sourceCurrencyAmount.ToString() + " USD => " + targetBtc + " btc => (" + targetSatoshi + ") " + targetSatoshiInt + " satoshi"; string currencyAmountStr = targetSatoshiInt.ToString(); InputField_TargetAmount.GetComponentInChildren <UnityEngine.UI.InputField>().text = currencyAmountStr; LoggingText.GetComponent <Text>().text = messageLog; }
// verify public void GetTXHashCallback(BlockchainWebChecker.ResponseData data) { Debug.Log("BitcoinSDKGui: GetTXHashCallback"); messageLog += "GetTXHashCallback\n"; if (debugLevel > 1) { messageLog += data.message; } long amount = long.Parse(availableAssets[currentBtcAsset].currencyAmountStr); bool verifyTest = BlockchainWebChecker.instance.dataMgr.verifyTransaction(availableAssets[currentBtcAsset].sendToWalletAddress, amount); if (verifyTest) { messageLog += "verified " + amount + "\n"; objectGroups[currentBtcAsset].RawImage_Lock1.GetComponentInChildren <RawImage>().texture = unlockTexture; string jsonStr = JsonUtility.ToJson(availableAssets[currentBtcAsset]); messageLog += jsonStr + "\n"; PlayerPrefs.SetString("Asset" + currentBtcAsset, jsonStr); if (debugLevel > 0) { Debug.Log("BitcoinSDKSimpleGui: save playerprefs asset " + currentBtcAsset); } messageLog += "BitcoinSDKSimpleGui: save playerprefs asset " + currentBtcAsset; } else { messageLog += "verify failed! \n"; objectGroups[currentBtcAsset].RawImage_Lock1.GetComponentInChildren <RawImage>().texture = lockTexture; } LoggingText.GetComponent <Text>().text = messageLog; }
// verify public void GetTXHashCallback(BlockchainWebChecker.ResponseData data) { Debug.Log("BitcoinSDKTest: GetTXHashCallback"); messageLog += "GetTXHashCallback\n"; if (debugLevel > 1) { messageLog += data.message; } long amount = long.Parse(currencyAmountStr); bool verifyTest = BlockchainWebChecker.instance.dataMgr.verifyTransaction(sendToWalletAddress, amount); if (verifyTest) { messageLog += "verified " + amount + "\n"; } else { messageLog += "verify failed! \n"; } }
public void GetExchangeRatesCallback(BlockchainWebChecker.ResponseData data) { Debug.Log("BitcoinSDKTest: GetExchangeRatesCallback"); messageLog += "GetExchangeRatesCallback\n"; if (debugLevel > 1) { messageLog += data.message; } // convert currency to BTC float sourceCurrencyAmount = float.Parse(sourceCurrencyAmountStr); float targetBtc = BlockchainWebChecker.instance.dataMgr.convertCurrencyToBtc(sourceCurrencyAmount, "USD"); float targetSatoshi = targetBtc * satoshiToBtc; int targetSatoshiInt = Mathf.RoundToInt(targetSatoshi); Debug.Log("BitcoinSDKTest: GetExchangeRatesCallback: " + sourceCurrencyAmount + " USD => " + targetBtc + " btc => (" + targetSatoshi + ") " + targetSatoshiInt + " satoshi"); messageLog += sourceCurrencyAmount.ToString() + " USD => " + targetBtc + " btc => (" + targetSatoshi + ") " + targetSatoshiInt + " satoshi"; currencyAmountStr = targetSatoshiInt.ToString(); }