Esempio n. 1
0
        public static string CreateTransactionResultXDR(XDR.OperationResult.OperationResultTr operationResultTr)
        {
            var transactionResult = new XDR.TransactionResult();

            transactionResult.Result = new XDR.TransactionResult.TransactionResultResult();
            transactionResult.Result.Discriminant.InnerValue = XDR.TransactionResultCode.TransactionResultCodeEnum.txFAILED;
            transactionResult.Result.Results = new XDR.OperationResult[1];
            transactionResult.Ext            = new XDR.TransactionResult.TransactionResultExt();
            transactionResult.FeeCharged     = new XDR.Int64(100L);

            var operationResult = new XDR.OperationResult();

            operationResult.Tr = operationResultTr;

            transactionResult.Result.Results[0] = operationResult;

            var outputStream = new XDR.XdrDataOutputStream();

            XDR.TransactionResult.Encode(outputStream, transactionResult);
            return(Convert.ToBase64String(outputStream.ToArray()));
        }
 public static void Encode(XdrDataOutputStream stream, UpgradeEntryMeta encodedUpgradeEntryMeta)
 {
     LedgerUpgrade.Encode(stream, encodedUpgradeEntryMeta.Upgrade);
     LedgerEntryChanges.Encode(stream, encodedUpgradeEntryMeta.Changes);
 }
Esempio n. 3
0
 public static void Encode(XdrDataOutputStream stream, TransactionResultCode value)
 {
     stream.WriteInt((int)value.InnerValue);
 }
 public static void Encode(XdrDataOutputStream stream, EndSponsoringFutureReservesResultCode value)
 {
     stream.WriteInt((int)value.InnerValue);
 }
Esempio n. 5
0
 public static void Encode(XdrDataOutputStream stream, Auth encodedAuth)
 {
     stream.WriteInt(encodedAuth.Unused);
 }
Esempio n. 6
0
        public static void Encode(XdrDataOutputStream stream, Thresholds encodedThresholds)
        {
            int Thresholdssize = encodedThresholds.InnerValue.Length;

            stream.Write(encodedThresholds.InnerValue, 0, Thresholdssize);
        }
 public static void Encode(XdrDataOutputStream stream, BucketMetadata encodedBucketMetadata)
 {
     Uint32.Encode(stream, encodedBucketMetadata.LedgerVersion);
     BucketMetadataExt.Encode(stream, encodedBucketMetadata.Ext);
 }
Esempio n. 8
0
        public static void Encode(XdrDataOutputStream stream, Uint256 encodedUint256)
        {
            int uint256size = encodedUint256.InnerValue.Length;

            stream.Write(encodedUint256.InnerValue, 0, uint256size);
        }
 public static void Encode(XdrDataOutputStream stream, PathPaymentStrictReceiveResultCode value)
 {
     stream.WriteInt((int)value.InnerValue);
 }
Esempio n. 10
0
 public static void Encode(XdrDataOutputStream stream, String64 encodedString64)
 {
     stream.WriteString(encodedString64.InnerValue);
 }
 public static void Encode(XdrDataOutputStream stream, AccountEntryV1 encodedAccountEntryV1)
 {
     Liabilities.Encode(stream, encodedAccountEntryV1.Liabilities);
     AccountEntryV1Ext.Encode(stream, encodedAccountEntryV1.Ext);
 }
Esempio n. 12
0
 public static void Encode(XdrDataOutputStream stream, TimeBounds encodedTimeBounds)
 {
     TimePoint.Encode(stream, encodedTimeBounds.MinTime);
     TimePoint.Encode(stream, encodedTimeBounds.MaxTime);
 }
Esempio n. 13
0
        public static void Encode(XdrDataOutputStream stream, SignatureHint encodedSignatureHint)
        {
            int SignatureHintsize = encodedSignatureHint.InnerValue.Length;

            stream.Write(encodedSignatureHint.InnerValue, 0, SignatureHintsize);
        }
Esempio n. 14
0
 public static void Encode(XdrDataOutputStream stream, DontHave encodedDontHave)
 {
     MessageType.Encode(stream, encodedDontHave.Type);
     Uint256.Encode(stream, encodedDontHave.ReqHash);
 }
 public static void Encode(XdrDataOutputStream stream, AccountMergeResultCode value)
 {
     stream.WriteInt((int)value.InnerValue);
 }
 public static void Encode(XdrDataOutputStream stream, ClaimClaimableBalanceResultCode value)
 {
     stream.WriteInt((int)value.InnerValue);
 }
Esempio n. 17
0
 public static void Encode(XdrDataOutputStream stream, SignedSurveyRequestMessage encodedSignedSurveyRequestMessage)
 {
     Signature.Encode(stream, encodedSignedSurveyRequestMessage.RequestSignature);
     SurveyRequestMessage.Encode(stream, encodedSignedSurveyRequestMessage.Request);
 }
        public static void Encode(XdrDataOutputStream stream, Curve25519Public encodedCurve25519Public)
        {
            int keysize = encodedCurve25519Public.Key.Length;

            stream.Write(encodedCurve25519Public.Key, 0, keysize);
        }
Esempio n. 19
0
 public static void Encode(XdrDataOutputStream stream, LedgerEntry encodedLedgerEntry)
 {
     Uint32.Encode(stream, encodedLedgerEntry.LastModifiedLedgerSeq);
     LedgerEntryData.Encode(stream, encodedLedgerEntry.Data);
     LedgerEntryExt.Encode(stream, encodedLedgerEntry.Ext);
 }
Esempio n. 20
0
 public static void Encode(XdrDataOutputStream stream, ThresholdIndexes value)
 {
     stream.WriteInt((int)value.InnerValue);
 }
Esempio n. 21
0
 public static void Encode(XdrDataOutputStream stream, ManageBuyOfferResultCode value)
 {
     stream.WriteInt((int)value.InnerValue);
 }
Esempio n. 22
0
 public static void Encode(XdrDataOutputStream stream, SCPStatement encodedSCPStatement)
 {
     NodeID.Encode(stream, encodedSCPStatement.NodeID);
     Uint64.Encode(stream, encodedSCPStatement.SlotIndex);
     SCPStatementPledges.Encode(stream, encodedSCPStatement.Pledges);
 }
Esempio n. 23
0
 public static void Encode(XdrDataOutputStream stream, AllowTrustResultCode value)
 {
     stream.WriteInt((int)value.InnerValue);
 }
Esempio n. 24
0
        public static void Encode(XdrDataOutputStream stream, StellarMessage encodedStellarMessage)
        {
            stream.WriteInt((int)encodedStellarMessage.Discriminant.InnerValue);
            switch (encodedStellarMessage.Discriminant.InnerValue)
            {
            case MessageType.MessageTypeEnum.ERROR_MSG:
                Error.Encode(stream, encodedStellarMessage.Error);
                break;

            case MessageType.MessageTypeEnum.HELLO:
                Hello.Encode(stream, encodedStellarMessage.Hello);
                break;

            case MessageType.MessageTypeEnum.AUTH:
                Auth.Encode(stream, encodedStellarMessage.Auth);
                break;

            case MessageType.MessageTypeEnum.DONT_HAVE:
                DontHave.Encode(stream, encodedStellarMessage.DontHave);
                break;

            case MessageType.MessageTypeEnum.GET_PEERS:
                break;

            case MessageType.MessageTypeEnum.PEERS:
                int peerssize = encodedStellarMessage.Peers.Length;
                stream.WriteInt(peerssize);
                for (int i = 0; i < peerssize; i++)
                {
                    PeerAddress.Encode(stream, encodedStellarMessage.Peers[i]);
                }
                break;

            case MessageType.MessageTypeEnum.GET_TX_SET:
                Uint256.Encode(stream, encodedStellarMessage.TxSetHash);
                break;

            case MessageType.MessageTypeEnum.TX_SET:
                TransactionSet.Encode(stream, encodedStellarMessage.TxSet);
                break;

            case MessageType.MessageTypeEnum.TRANSACTION:
                TransactionEnvelope.Encode(stream, encodedStellarMessage.Transaction);
                break;

            case MessageType.MessageTypeEnum.GET_SCP_QUORUMSET:
                Uint256.Encode(stream, encodedStellarMessage.QSetHash);
                break;

            case MessageType.MessageTypeEnum.SCP_QUORUMSET:
                SCPQuorumSet.Encode(stream, encodedStellarMessage.QSet);
                break;

            case MessageType.MessageTypeEnum.SCP_MESSAGE:
                SCPEnvelope.Encode(stream, encodedStellarMessage.Envelope);
                break;

            case MessageType.MessageTypeEnum.GET_SCP_STATE:
                Uint32.Encode(stream, encodedStellarMessage.GetSCPLedgerSeq);
                break;
            }
        }
Esempio n. 25
0
 public static void Encode(XdrDataOutputStream stream, Uint64 encodedUint64)
 {
     stream.WriteLong(encodedUint64.InnerValue);
 }
 public static void Encode(XdrDataOutputStream stream, OfferEntryFlags value)
 {
     stream.WriteInt((int)value.InnerValue);
 }
 public static void Encode(XdrDataOutputStream stream, SignerKeyType value)
 {
     stream.WriteInt((int)value.InnerValue);
 }
            public static void Encode(XdrDataOutputStream stream, OperationResultTr encodedOperationResultTr)
            {
                stream.WriteInt((int)encodedOperationResultTr.Discriminant.InnerValue);
                switch (encodedOperationResultTr.Discriminant.InnerValue)
                {
                case OperationType.OperationTypeEnum.CREATE_ACCOUNT:
                    CreateAccountResult.Encode(stream, encodedOperationResultTr.CreateAccountResult);
                    break;

                case OperationType.OperationTypeEnum.PAYMENT:
                    PaymentResult.Encode(stream, encodedOperationResultTr.PaymentResult);
                    break;

                case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_RECEIVE:
                    PathPaymentStrictReceiveResult.Encode(stream, encodedOperationResultTr.PathPaymentStrictReceiveResult);
                    break;

                case OperationType.OperationTypeEnum.MANAGE_SELL_OFFER:
                    ManageSellOfferResult.Encode(stream, encodedOperationResultTr.ManageSellOfferResult);
                    break;

                case OperationType.OperationTypeEnum.CREATE_PASSIVE_SELL_OFFER:
                    ManageSellOfferResult.Encode(stream, encodedOperationResultTr.CreatePassiveSellOfferResult);
                    break;

                case OperationType.OperationTypeEnum.SET_OPTIONS:
                    SetOptionsResult.Encode(stream, encodedOperationResultTr.SetOptionsResult);
                    break;

                case OperationType.OperationTypeEnum.CHANGE_TRUST:
                    ChangeTrustResult.Encode(stream, encodedOperationResultTr.ChangeTrustResult);
                    break;

                case OperationType.OperationTypeEnum.ALLOW_TRUST:
                    AllowTrustResult.Encode(stream, encodedOperationResultTr.AllowTrustResult);
                    break;

                case OperationType.OperationTypeEnum.ACCOUNT_MERGE:
                    AccountMergeResult.Encode(stream, encodedOperationResultTr.AccountMergeResult);
                    break;

                case OperationType.OperationTypeEnum.INFLATION:
                    InflationResult.Encode(stream, encodedOperationResultTr.InflationResult);
                    break;

                case OperationType.OperationTypeEnum.MANAGE_DATA:
                    ManageDataResult.Encode(stream, encodedOperationResultTr.ManageDataResult);
                    break;

                case OperationType.OperationTypeEnum.BUMP_SEQUENCE:
                    BumpSequenceResult.Encode(stream, encodedOperationResultTr.BumpSeqResult);
                    break;

                case OperationType.OperationTypeEnum.MANAGE_BUY_OFFER:
                    ManageBuyOfferResult.Encode(stream, encodedOperationResultTr.ManageBuyOfferResult);
                    break;

                case OperationType.OperationTypeEnum.PATH_PAYMENT_STRICT_SEND:
                    PathPaymentStrictSendResult.Encode(stream, encodedOperationResultTr.PathPaymentStrictSendResult);
                    break;

                case OperationType.OperationTypeEnum.CREATE_CLAIMABLE_BALANCE:
                    CreateClaimableBalanceResult.Encode(stream, encodedOperationResultTr.CreateClaimableBalanceResult);
                    break;

                case OperationType.OperationTypeEnum.CLAIM_CLAIMABLE_BALANCE:
                    ClaimClaimableBalanceResult.Encode(stream, encodedOperationResultTr.ClaimClaimableBalanceResult);
                    break;

                case OperationType.OperationTypeEnum.BEGIN_SPONSORING_FUTURE_RESERVES:
                    BeginSponsoringFutureReservesResult.Encode(stream, encodedOperationResultTr.BeginSponsoringFutureReservesResult);
                    break;

                case OperationType.OperationTypeEnum.END_SPONSORING_FUTURE_RESERVES:
                    EndSponsoringFutureReservesResult.Encode(stream, encodedOperationResultTr.EndSponsoringFutureReservesResult);
                    break;

                case OperationType.OperationTypeEnum.REVOKE_SPONSORSHIP:
                    RevokeSponsorshipResult.Encode(stream, encodedOperationResultTr.RevokeSponsorshipResult);
                    break;

                case OperationType.OperationTypeEnum.CLAWBACK:
                    ClawbackResult.Encode(stream, encodedOperationResultTr.ClawbackResult);
                    break;

                case OperationType.OperationTypeEnum.CLAWBACK_CLAIMABLE_BALANCE:
                    ClawbackClaimableBalanceResult.Encode(stream, encodedOperationResultTr.ClawbackClaimableBalanceResult);
                    break;

                case OperationType.OperationTypeEnum.SET_TRUST_LINE_FLAGS:
                    SetTrustLineFlagsResult.Encode(stream, encodedOperationResultTr.SetTrustLineFlagsResult);
                    break;
                }
            }
Esempio n. 29
0
 public static void Encode(XdrDataOutputStream stream, ErrorCode value)
 {
     stream.WriteInt((int)value.InnerValue);
 }
Esempio n. 30
0
 public static void Encode(XdrDataOutputStream stream, RevokeSponsorshipResultCode value)
 {
     stream.WriteInt((int)value.InnerValue);
 }