Ejemplo n.º 1
0
        /// <summary>
        /// The coroutine for getting the details of a transaction.
        /// </summary>
        /// <param name="txHash"> The transaction hash. </param>
        /// <param name="promise"> Promise returning the transaction. </param>
        /// <returns> The transaction request to await. </returns>
        private static IEnumerator _GetTransactionDetailsCoroutine(string txHash, EthCallPromise <Transaction> promise)
        {
            if (!AddressUtils.IsValidTransactionHash(txHash))
            {
                throw new ArgumentException("Expected valid Ethereum transaction hash.");
            }

            var request = new EthGetTransactionByHashUnityRequest(EthereumNetworkManager.CurrentNetwork.NetworkUrl);

            yield return(request.SendRequest(txHash));

            promise.Build(request, () => request.Result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The coroutine for getting the transaction count of an ethereum address.
        /// </summary>
        /// <param name="address"> The address to get the transaction count for. </param>
        /// <param name="promise"> Promise returning the transaction count. </param>
        /// <returns> The transaction count request to await. </returns>
        private static IEnumerator _GetAddressTransactionCount(string address, EthCallPromise <BigInteger> promise)
        {
            if (!AddressUtils.IsValidEthereumAddress(address))
            {
                throw new ArgumentException("Expected valid Ethereum address.");
            }

            var request = new EthGetTransactionCountUnityRequest(EthereumNetworkManager.CurrentNetwork.NetworkUrl);

            yield return(request.SendRequest(address, BlockParameter.CreateLatest()));

            promise.Build(request, () => request.Result.Value);
        }