Пример #1
0
        public async Task <string> BroadcastTransactionAsync(string signedTransaction)
        {
            var result = await new TransactionHttp(_nemUrl).Announce(SignedTransaction.FromJson(signedTransaction));

            // see https://nemproject.github.io/#nemRequestResult
            // for meaning of the code

            switch (result.Code)
            {
            case 0:
            case 1:
                // success
                break;

            case 3:
            case 9:
                throw new BlockchainException(BlockchainErrorCode.BuildingShouldBeRepeated, "Transaction expired");

            case 7:
                throw new BlockchainException(BlockchainErrorCode.BuildingShouldBeRepeated, "Transaction hash duplicated");

            case 5:
                throw new BlockchainException(BlockchainErrorCode.NotEnoughBalance, "Not enough balance");

            default:
                throw new ArgumentException(result.Message);
            }

            return(null);
        }