public static IPAddrType Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 0: return(Create(IPAddrTypeEnum.IPv4));

            case 1: return(Create(IPAddrTypeEnum.IPv6));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
        public static LedgerSCPMessages Decode(IByteReader stream)
        {
            LedgerSCPMessages decodedLedgerSCPMessages = new LedgerSCPMessages();

            decodedLedgerSCPMessages.LedgerSeq = Uint32.Decode(stream);
            int messagessize = XdrEncoding.DecodeInt32(stream);

            decodedLedgerSCPMessages.Messages = new SCPEnvelope[messagessize];
            for (int i = 0; i < messagessize; i++)
            {
                decodedLedgerSCPMessages.Messages[i] = SCPEnvelope.Decode(stream);
            }
            return(decodedLedgerSCPMessages);
        }
Beispiel #3
0
        public static BucketEntryType Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 0: return(Create(BucketEntryTypeEnum.LIVEENTRY));

            case 1: return(Create(BucketEntryTypeEnum.DEADENTRY));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
Beispiel #4
0
        public static TransactionEnvelope Decode(IByteReader stream)
        {
            TransactionEnvelope decodedTransactionEnvelope = new TransactionEnvelope();

            decodedTransactionEnvelope.Tx = Transaction.Decode(stream);
            int signaturessize = XdrEncoding.DecodeInt32(stream);

            decodedTransactionEnvelope.Signatures = new DecoratedSignature[signaturessize];
            for (int i = 0; i < signaturessize; i++)
            {
                decodedTransactionEnvelope.Signatures[i] = DecoratedSignature.Decode(stream);
            }
            return(decodedTransactionEnvelope);
        }
Beispiel #5
0
        public static Hello Decode(IByteReader stream)
        {
            Hello decodedHello = new Hello();

            decodedHello.LedgerVersion     = Uint32.Decode(stream);
            decodedHello.OverlayVersion    = Uint32.Decode(stream);
            decodedHello.OverlayMinVersion = Uint32.Decode(stream);
            decodedHello.NetworkID         = Hash.Decode(stream);
            decodedHello.VersionStr        = XdrEncoding.ReadString(stream);
            decodedHello.ListeningPort     = XdrEncoding.DecodeInt32(stream);
            decodedHello.PeerID            = NodeID.Decode(stream);
            decodedHello.Cert  = AuthCert.Decode(stream);
            decodedHello.Nonce = Uint256.Decode(stream);
            return(decodedHello);
        }
        public static StellarValue Decode(IByteReader stream)
        {
            StellarValue decodedStellarValue = new StellarValue();

            decodedStellarValue.TxSetHash = Hash.Decode(stream);
            decodedStellarValue.CloseTime = Uint64.Decode(stream);
            int upgradessize = XdrEncoding.DecodeInt32(stream);

            decodedStellarValue.Upgrades = new UpgradeType[upgradessize];
            for (int i = 0; i < upgradessize; i++)
            {
                decodedStellarValue.Upgrades[i] = UpgradeType.Decode(stream);
            }
            decodedStellarValue.Ext = StellarValueExt.Decode(stream);
            return(decodedStellarValue);
        }
        public static OperationResultCode Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 0: return(Create(OperationResultCodeEnum.opINNER));

            case -1: return(Create(OperationResultCodeEnum.opBAD_AUTH));

            case -2: return(Create(OperationResultCodeEnum.opNO_ACCOUNT));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
Beispiel #8
0
        public static EnvelopeType Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 1: return(Create(EnvelopeTypeEnum.ENVELOPE_TYPE_SCP));

            case 2: return(Create(EnvelopeTypeEnum.ENVELOPE_TYPE_TX));

            case 3: return(Create(EnvelopeTypeEnum.ENVELOPE_TYPE_AUTH));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
Beispiel #9
0
        public static LedgerUpgradeType Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 1: return(Create(LedgerUpgradeTypeEnum.LEDGER_UPGRADE_VERSION));

            case 2: return(Create(LedgerUpgradeTypeEnum.LEDGER_UPGRADE_BASE_FEE));

            case 3: return(Create(LedgerUpgradeTypeEnum.LEDGER_UPGRADE_MAX_TX_SET_SIZE));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
Beispiel #10
0
        public static ManageOfferEffect Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 0: return(Create(ManageOfferEffectEnum.MANAGE_OFFER_CREATED));

            case 1: return(Create(ManageOfferEffectEnum.MANAGE_OFFER_UPDATED));

            case 2: return(Create(ManageOfferEffectEnum.MANAGE_OFFER_DELETED));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
Beispiel #11
0
        public static AssetType Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 0: return(Create(AssetTypeEnum.ASSET_TYPE_NATIVE));

            case 1: return(Create(AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4));

            case 2: return(Create(AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
Beispiel #12
0
        public static AccountFlags Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 1: return(Create(AccountFlagsEnum.AUTH_REQUIRED_FLAG));

            case 2: return(Create(AccountFlagsEnum.AUTH_REVOCABLE_FLAG));

            case 4: return(Create(AccountFlagsEnum.AUTH_IMMUTABLE_FLAG));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
        public static CryptoKeyType Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 0: return(Create(CryptoKeyTypeEnum.KEY_TYPE_ED25519));

            case 1: return(Create(CryptoKeyTypeEnum.KEY_TYPE_PRE_AUTH_TX));

            case 2: return(Create(CryptoKeyTypeEnum.KEY_TYPE_HASH_X));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
Beispiel #14
0
        public static TransactionMeta Decode(IByteReader stream)
        {
            TransactionMeta decodedTransactionMeta = new TransactionMeta();

            decodedTransactionMeta.Discriminant = XdrEncoding.DecodeInt32(stream);
            switch (decodedTransactionMeta.Discriminant)
            {
            case 0:
                int operationssize = XdrEncoding.DecodeInt32(stream);
                decodedTransactionMeta.Operations = new OperationMeta[operationssize];
                for (int i = 0; i < operationssize; i++)
                {
                    decodedTransactionMeta.Operations[i] = OperationMeta.Decode(stream);
                }
                break;
            }
            return(decodedTransactionMeta);
        }
Beispiel #15
0
        public static ThresholdIndexes Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 0: return(Create(ThresholdIndexesEnum.THRESHOLD_MASTER_WEIGHT));

            case 1: return(Create(ThresholdIndexesEnum.THRESHOLD_LOW));

            case 2: return(Create(ThresholdIndexesEnum.THRESHOLD_MED));

            case 3: return(Create(ThresholdIndexesEnum.THRESHOLD_HIGH));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
        public static SCPStatementType Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 0: return(Create(SCPStatementTypeEnum.SCP_ST_PREPARE));

            case 1: return(Create(SCPStatementTypeEnum.SCP_ST_CONFIRM));

            case 2: return(Create(SCPStatementTypeEnum.SCP_ST_EXTERNALIZE));

            case 3: return(Create(SCPStatementTypeEnum.SCP_ST_NOMINATE));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
        public static LedgerEntryType Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 0: return(Create(LedgerEntryTypeEnum.ACCOUNT));

            case 1: return(Create(LedgerEntryTypeEnum.TRUSTLINE));

            case 2: return(Create(LedgerEntryTypeEnum.OFFER));

            case 3: return(Create(LedgerEntryTypeEnum.DATA));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
Beispiel #18
0
        public static PathPaymentOp Decode(IByteReader stream)
        {
            PathPaymentOp decodedPathPaymentOp = new PathPaymentOp();

            decodedPathPaymentOp.SendAsset   = Asset.Decode(stream);
            decodedPathPaymentOp.SendMax     = Int64.Decode(stream);
            decodedPathPaymentOp.Destination = AccountID.Decode(stream);
            decodedPathPaymentOp.DestAsset   = Asset.Decode(stream);
            decodedPathPaymentOp.DestAmount  = Int64.Decode(stream);
            int pathsize = XdrEncoding.DecodeInt32(stream);

            decodedPathPaymentOp.Path = new Asset[pathsize];
            for (int i = 0; i < pathsize; i++)
            {
                decodedPathPaymentOp.Path[i] = Asset.Decode(stream);
            }
            return(decodedPathPaymentOp);
        }
Beispiel #19
0
        public static LedgerEntryChangeType Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 0: return(Create(LedgerEntryChangeTypeEnum.LEDGER_ENTRY_CREATED));

            case 1: return(Create(LedgerEntryChangeTypeEnum.LEDGER_ENTRY_UPDATED));

            case 2: return(Create(LedgerEntryChangeTypeEnum.LEDGER_ENTRY_REMOVED));

            case 3: return(Create(LedgerEntryChangeTypeEnum.LEDGER_ENTRY_STATE));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
        public static AccountMergeResultCode Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 0: return(Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_SUCCESS));

            case -1: return(Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_MALFORMED));

            case -2: return(Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_NO_ACCOUNT));

            case -3: return(Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_IMMUTABLE_SET));

            case -4: return(Create(AccountMergeResultCodeEnum.ACCOUNT_MERGE_HAS_SUB_ENTRIES));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
Beispiel #21
0
        public static ErrorCode Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 0: return(Create(ErrorCodeEnum.ERR_MISC));

            case 1: return(Create(ErrorCodeEnum.ERR_DATA));

            case 2: return(Create(ErrorCodeEnum.ERR_CONF));

            case 3: return(Create(ErrorCodeEnum.ERR_AUTH));

            case 4: return(Create(ErrorCodeEnum.ERR_LOAD));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
        public static ManageDataResultCode Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 0: return(Create(ManageDataResultCodeEnum.MANAGE_DATA_SUCCESS));

            case -1: return(Create(ManageDataResultCodeEnum.MANAGE_DATA_NOT_SUPPORTED_YET));

            case -2: return(Create(ManageDataResultCodeEnum.MANAGE_DATA_NAME_NOT_FOUND));

            case -3: return(Create(ManageDataResultCodeEnum.MANAGE_DATA_LOW_RESERVE));

            case -4: return(Create(ManageDataResultCodeEnum.MANAGE_DATA_INVALID_NAME));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
Beispiel #23
0
        public static ChangeTrustResultCode Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 0: return(Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_SUCCESS));

            case -1: return(Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_MALFORMED));

            case -2: return(Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_NO_ISSUER));

            case -3: return(Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_INVALID_LIMIT));

            case -4: return(Create(ChangeTrustResultCodeEnum.CHANGE_TRUST_LOW_RESERVE));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
Beispiel #24
0
        public static CreateAccountResultCode Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 0: return(Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_SUCCESS));

            case -1: return(Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_MALFORMED));

            case -2: return(Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_UNDERFUNDED));

            case -3: return(Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_LOW_RESERVE));

            case -4: return(Create(CreateAccountResultCodeEnum.CREATE_ACCOUNT_ALREADY_EXIST));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
        public static MemoType Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 0: return(Create(MemoTypeEnum.MEMO_NONE));

            case 1: return(Create(MemoTypeEnum.MEMO_TEXT));

            case 2: return(Create(MemoTypeEnum.MEMO_ID));

            case 3: return(Create(MemoTypeEnum.MEMO_HASH));

            case 4: return(Create(MemoTypeEnum.MEMO_RETURN));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
Beispiel #26
0
        public static AllowTrustResultCode Decode(IByteReader stream)
        {
            int value = XdrEncoding.DecodeInt32(stream);

            switch (value)
            {
            case 0: return(Create(AllowTrustResultCodeEnum.ALLOW_TRUST_SUCCESS));

            case -1: return(Create(AllowTrustResultCodeEnum.ALLOW_TRUST_MALFORMED));

            case -2: return(Create(AllowTrustResultCodeEnum.ALLOW_TRUST_NO_TRUST_LINE));

            case -3: return(Create(AllowTrustResultCodeEnum.ALLOW_TRUST_TRUST_NOT_REQUIRED));

            case -4: return(Create(AllowTrustResultCodeEnum.ALLOW_TRUST_CANT_REVOKE));

            default:
                throw new System.Exception("Unknown enum value: " + value);
            }
        }
Beispiel #27
0
        public static SCPQuorumSet Decode(IByteReader stream)
        {
            SCPQuorumSet decodedSCPQuorumSet = new SCPQuorumSet();

            decodedSCPQuorumSet.Threshold = Uint32.Decode(stream);
            int validatorssize = XdrEncoding.DecodeInt32(stream);

            decodedSCPQuorumSet.Validators = new PublicKey[validatorssize];
            for (int i = 0; i < validatorssize; i++)
            {
                decodedSCPQuorumSet.Validators[i] = PublicKey.Decode(stream);
            }
            int innerSetssize = XdrEncoding.DecodeInt32(stream);

            decodedSCPQuorumSet.InnerSets = new SCPQuorumSet[innerSetssize];
            for (int i = 0; i < innerSetssize; i++)
            {
                decodedSCPQuorumSet.InnerSets[i] = SCPQuorumSet.Decode(stream);
            }
            return(decodedSCPQuorumSet);
        }
Beispiel #28
0
        public static SCPNomination Decode(IByteReader stream)
        {
            SCPNomination decodedSCPNomination = new SCPNomination();

            decodedSCPNomination.QuorumSetHash = Hash.Decode(stream);
            int votessize = XdrEncoding.DecodeInt32(stream);

            decodedSCPNomination.Votes = new Value[votessize];
            for (int i = 0; i < votessize; i++)
            {
                decodedSCPNomination.Votes[i] = Value.Decode(stream);
            }
            int acceptedsize = XdrEncoding.DecodeInt32(stream);

            decodedSCPNomination.Accepted = new Value[acceptedsize];
            for (int i = 0; i < acceptedsize; i++)
            {
                decodedSCPNomination.Accepted[i] = Value.Decode(stream);
            }
            return(decodedSCPNomination);
        }
        public static InflationResult Decode(IByteReader stream)
        {
            InflationResult decodedInflationResult = new InflationResult();

            decodedInflationResult.Discriminant = InflationResultCode.Decode(stream);
            switch (decodedInflationResult.Discriminant.InnerValue)
            {
            case InflationResultCode.InflationResultCodeEnum.INFLATION_SUCCESS:
                int payoutssize = XdrEncoding.DecodeInt32(stream);
                decodedInflationResult.Payouts = new InflationPayout[payoutssize];
                for (int i = 0; i < payoutssize; i++)
                {
                    decodedInflationResult.Payouts[i] = InflationPayout.Decode(stream);
                }
                break;

            default:
                break;
            }
            return(decodedInflationResult);
        }
            public static TransactionResultResult Decode(IByteReader stream)
            {
                TransactionResultResult decodedTransactionResultResult = new TransactionResultResult();

                decodedTransactionResultResult.Discriminant = TransactionResultCode.Decode(stream);
                switch (decodedTransactionResultResult.Discriminant.InnerValue)
                {
                case TransactionResultCode.TransactionResultCodeEnum.txSUCCESS:
                case TransactionResultCode.TransactionResultCodeEnum.txFAILED:
                    int resultssize = XdrEncoding.DecodeInt32(stream);
                    decodedTransactionResultResult.Results = new OperationResult[resultssize];
                    for (int i = 0; i < resultssize; i++)
                    {
                        decodedTransactionResultResult.Results[i] = OperationResult.Decode(stream);
                    }
                    break;

                default:
                    break;
                }
                return(decodedTransactionResultResult);
            }