public static void Encode(IByteWriter stream, Signature encodedSignature) { int SignatureSize = encodedSignature.InnerValue.Length; XdrEncoding.EncodeInt32(SignatureSize, stream); XdrEncoding.WriteFixOpaque(stream, (uint)SignatureSize, encodedSignature.InnerValue); }
public static void Encode(IByteWriter stream, UpgradeType encodedUpgradeType) { int UpgradeTypeSize = encodedUpgradeType.InnerValue.Length; XdrEncoding.EncodeInt32(UpgradeTypeSize, stream); XdrEncoding.WriteFixOpaque(stream, (uint)UpgradeTypeSize, encodedUpgradeType.InnerValue); }
public static TransactionResultCode Decode(IByteReader stream) { int value = XdrEncoding.DecodeInt32(stream); switch (value) { case 0: return(Create(TransactionResultCodeEnum.txSUCCESS)); case -1: return(Create(TransactionResultCodeEnum.txFAILED)); case -2: return(Create(TransactionResultCodeEnum.txTOO_EARLY)); case -3: return(Create(TransactionResultCodeEnum.txTOO_LATE)); case -4: return(Create(TransactionResultCodeEnum.txMISSING_OPERATION)); case -5: return(Create(TransactionResultCodeEnum.txBAD_SEQ)); case -6: return(Create(TransactionResultCodeEnum.txBAD_AUTH)); case -7: return(Create(TransactionResultCodeEnum.txINSUFFICIENT_BALANCE)); case -8: return(Create(TransactionResultCodeEnum.txNO_ACCOUNT)); case -9: return(Create(TransactionResultCodeEnum.txINSUFFICIENT_FEE)); case -10: return(Create(TransactionResultCodeEnum.txBAD_AUTH_EXTRA)); case -11: return(Create(TransactionResultCodeEnum.txINTERNAL_ERROR)); default: throw new System.Exception("Unknown enum value: " + value); } }
public static PaymentResultCode Decode(IByteReader stream) { int value = XdrEncoding.DecodeInt32(stream); switch (value) { case 0: return(Create(PaymentResultCodeEnum.PAYMENT_SUCCESS)); case -1: return(Create(PaymentResultCodeEnum.PAYMENT_MALFORMED)); case -2: return(Create(PaymentResultCodeEnum.PAYMENT_UNDERFUNDED)); case -3: return(Create(PaymentResultCodeEnum.PAYMENT_SRC_NO_TRUST)); case -4: return(Create(PaymentResultCodeEnum.PAYMENT_SRC_NOT_AUTHORIZED)); case -5: return(Create(PaymentResultCodeEnum.PAYMENT_NO_DESTINATION)); case -6: return(Create(PaymentResultCodeEnum.PAYMENT_NO_TRUST)); case -7: return(Create(PaymentResultCodeEnum.PAYMENT_NOT_AUTHORIZED)); case -8: return(Create(PaymentResultCodeEnum.PAYMENT_LINE_FULL)); case -9: return(Create(PaymentResultCodeEnum.PAYMENT_NO_ISSUER)); default: throw new System.Exception("Unknown enum value: " + value); } }
public static Uint32 Decode(IByteReader stream) { Uint32 decodedUint32 = new Uint32(); decodedUint32.InnerValue = XdrEncoding.DecodeUInt32(stream); return(decodedUint32); }
public static Memo Decode(IByteReader stream) { Memo decodedMemo = new Memo(); decodedMemo.Discriminant = MemoType.Decode(stream); switch (decodedMemo.Discriminant.InnerValue) { case MemoType.MemoTypeEnum.MEMO_NONE: break; case MemoType.MemoTypeEnum.MEMO_TEXT: decodedMemo.Text = XdrEncoding.ReadString(stream); break; case MemoType.MemoTypeEnum.MEMO_ID: decodedMemo.Id = Uint64.Decode(stream); break; case MemoType.MemoTypeEnum.MEMO_HASH: decodedMemo.Hash = Hash.Decode(stream); break; case MemoType.MemoTypeEnum.MEMO_RETURN: decodedMemo.RetHash = Hash.Decode(stream); break; } return(decodedMemo); }
public static String32 Decode(IByteReader stream) { String32 decodedString32 = new String32(); decodedString32.InnerValue = XdrEncoding.ReadString(stream); return(decodedString32); }
public static void Encode(IByteWriter stream, AccountEntry encodedAccountEntry) { AccountID.Encode(stream, encodedAccountEntry.AccountID); Int64.Encode(stream, encodedAccountEntry.Balance); SequenceNumber.Encode(stream, encodedAccountEntry.SeqNum); Uint32.Encode(stream, encodedAccountEntry.NumSubEntries); if (encodedAccountEntry.InflationDest != null) { XdrEncoding.EncodeInt32(1, stream); AccountID.Encode(stream, encodedAccountEntry.InflationDest); } else { XdrEncoding.EncodeInt32(0, stream); } Uint32.Encode(stream, encodedAccountEntry.Flags); String32.Encode(stream, encodedAccountEntry.HomeDomain); Thresholds.Encode(stream, encodedAccountEntry.Thresholds); int signerssize = encodedAccountEntry.Signers.Length; XdrEncoding.EncodeInt32(signerssize, stream); for (int i = 0; i < signerssize; i++) { Signer.Encode(stream, encodedAccountEntry.Signers[i]); } AccountEntryExt.Encode(stream, encodedAccountEntry.Ext); }
public static void Encode(IByteWriter stream, SCPStatementPrepare encodedSCPStatementPrepare) { Hash.Encode(stream, encodedSCPStatementPrepare.QuorumSetHash); SCPBallot.Encode(stream, encodedSCPStatementPrepare.Ballot); if (encodedSCPStatementPrepare.Prepared != null) { XdrEncoding.EncodeInt32(1, stream); SCPBallot.Encode(stream, encodedSCPStatementPrepare.Prepared); } else { XdrEncoding.EncodeInt32(0, stream); } if (encodedSCPStatementPrepare.PreparedPrime != null) { XdrEncoding.EncodeInt32(1, stream); SCPBallot.Encode(stream, encodedSCPStatementPrepare.PreparedPrime); } else { XdrEncoding.EncodeInt32(0, stream); } Uint32.Encode(stream, encodedSCPStatementPrepare.NC); Uint32.Encode(stream, encodedSCPStatementPrepare.NH); }
public static OperationType Decode(IByteReader stream) { int value = XdrEncoding.DecodeInt32(stream); switch (value) { case 0: return(Create(OperationTypeEnum.CREATE_ACCOUNT)); case 1: return(Create(OperationTypeEnum.PAYMENT)); case 2: return(Create(OperationTypeEnum.PATH_PAYMENT)); case 3: return(Create(OperationTypeEnum.MANAGE_OFFER)); case 4: return(Create(OperationTypeEnum.CREATE_PASSIVE_OFFER)); case 5: return(Create(OperationTypeEnum.SET_OPTIONS)); case 6: return(Create(OperationTypeEnum.CHANGE_TRUST)); case 7: return(Create(OperationTypeEnum.ALLOW_TRUST)); case 8: return(Create(OperationTypeEnum.ACCOUNT_MERGE)); case 9: return(Create(OperationTypeEnum.INFLATION)); case 10: return(Create(OperationTypeEnum.MANAGE_DATA)); default: throw new System.Exception("Unknown enum value: " + value); } }
public static void Encode(IByteWriter stream, Memo encodedMemo) { XdrEncoding.EncodeInt32((int)encodedMemo.Discriminant.InnerValue, stream); switch (encodedMemo.Discriminant.InnerValue) { case MemoType.MemoTypeEnum.MEMO_NONE: break; case MemoType.MemoTypeEnum.MEMO_TEXT: XdrEncoding.WriteString(stream, encodedMemo.Text); break; case MemoType.MemoTypeEnum.MEMO_ID: Uint64.Encode(stream, encodedMemo.Id); break; case MemoType.MemoTypeEnum.MEMO_HASH: Hash.Encode(stream, encodedMemo.Hash); break; case MemoType.MemoTypeEnum.MEMO_RETURN: Hash.Encode(stream, encodedMemo.RetHash); break; } }
public static Uint64 Decode(IByteReader stream) { Uint64 decodedUint64 = new Uint64(); decodedUint64.InnerValue = XdrEncoding.DecodeUInt64(stream); return(decodedUint64); }
public static String64 Decode(IByteReader stream) { String64 decodedString64 = new String64(); decodedString64.InnerValue = XdrEncoding.ReadString(stream); return(decodedString64); }
public static SetOptionsResultCode Decode(IByteReader stream) { int value = XdrEncoding.DecodeInt32(stream); switch (value) { case 0: return(Create(SetOptionsResultCodeEnum.SET_OPTIONS_SUCCESS)); case -1: return(Create(SetOptionsResultCodeEnum.SET_OPTIONS_LOW_RESERVE)); case -2: return(Create(SetOptionsResultCodeEnum.SET_OPTIONS_TOO_MANY_SIGNERS)); case -3: return(Create(SetOptionsResultCodeEnum.SET_OPTIONS_BAD_FLAGS)); case -4: return(Create(SetOptionsResultCodeEnum.SET_OPTIONS_INVALID_INFLATION)); case -5: return(Create(SetOptionsResultCodeEnum.SET_OPTIONS_CANT_CHANGE)); case -6: return(Create(SetOptionsResultCodeEnum.SET_OPTIONS_UNKNOWN_FLAG)); case -7: return(Create(SetOptionsResultCodeEnum.SET_OPTIONS_THRESHOLD_OUT_OF_RANGE)); case -8: return(Create(SetOptionsResultCodeEnum.SET_OPTIONS_BAD_SIGNER)); case -9: return(Create(SetOptionsResultCodeEnum.SET_OPTIONS_INVALID_HOME_DOMAIN)); default: throw new System.Exception("Unknown enum value: " + value); } }
public static void Encode(IByteWriter stream, Value encodedValue) { int ValueSize = encodedValue.InnerValue.Length; XdrEncoding.EncodeInt32(ValueSize, stream); XdrEncoding.WriteFixOpaque(stream, (uint)ValueSize, encodedValue.InnerValue); }
public static AccountEntry Decode(IByteReader stream) { AccountEntry decodedAccountEntry = new AccountEntry(); decodedAccountEntry.AccountID = AccountID.Decode(stream); decodedAccountEntry.Balance = Int64.Decode(stream); decodedAccountEntry.SeqNum = SequenceNumber.Decode(stream); decodedAccountEntry.NumSubEntries = Uint32.Decode(stream); int inflationDestPresent = XdrEncoding.DecodeInt32(stream); if (inflationDestPresent != 0) { decodedAccountEntry.InflationDest = AccountID.Decode(stream); } decodedAccountEntry.Flags = Uint32.Decode(stream); decodedAccountEntry.HomeDomain = String32.Decode(stream); decodedAccountEntry.Thresholds = Thresholds.Decode(stream); int signerssize = XdrEncoding.DecodeInt32(stream); decodedAccountEntry.Signers = new Signer[signerssize]; for (int i = 0; i < signerssize; i++) { decodedAccountEntry.Signers[i] = Signer.Decode(stream); } decodedAccountEntry.Ext = AccountEntryExt.Decode(stream); return(decodedAccountEntry); }
public static void Encode(IByteWriter stream, AssetAlphaNum4 encodedAssetAlphaNum4) { int assetCodesize = encodedAssetAlphaNum4.AssetCode.Length; XdrEncoding.WriteFixOpaque(stream, (uint)assetCodesize, encodedAssetAlphaNum4.AssetCode); AccountID.Encode(stream, encodedAssetAlphaNum4.Issuer); }
public static Auth Decode(IByteReader stream) { Auth decodedAuth = new Auth(); decodedAuth.Unused = XdrEncoding.DecodeInt32(stream); return(decodedAuth); }
public static SetOptionsOp Decode(IByteReader stream) { SetOptionsOp decodedSetOptionsOp = new SetOptionsOp(); int inflationDestPresent = XdrEncoding.DecodeInt32(stream); if (inflationDestPresent != 0) { decodedSetOptionsOp.InflationDest = AccountID.Decode(stream); } int clearFlagsPresent = XdrEncoding.DecodeInt32(stream); if (clearFlagsPresent != 0) { decodedSetOptionsOp.ClearFlags = Uint32.Decode(stream); } int setFlagsPresent = XdrEncoding.DecodeInt32(stream); if (setFlagsPresent != 0) { decodedSetOptionsOp.SetFlags = Uint32.Decode(stream); } int masterWeightPresent = XdrEncoding.DecodeInt32(stream); if (masterWeightPresent != 0) { decodedSetOptionsOp.MasterWeight = Uint32.Decode(stream); } int lowThresholdPresent = XdrEncoding.DecodeInt32(stream); if (lowThresholdPresent != 0) { decodedSetOptionsOp.LowThreshold = Uint32.Decode(stream); } int medThresholdPresent = XdrEncoding.DecodeInt32(stream); if (medThresholdPresent != 0) { decodedSetOptionsOp.MedThreshold = Uint32.Decode(stream); } int highThresholdPresent = XdrEncoding.DecodeInt32(stream); if (highThresholdPresent != 0) { decodedSetOptionsOp.HighThreshold = Uint32.Decode(stream); } int homeDomainPresent = XdrEncoding.DecodeInt32(stream); if (homeDomainPresent != 0) { decodedSetOptionsOp.HomeDomain = String32.Decode(stream); } int signerPresent = XdrEncoding.DecodeInt32(stream); if (signerPresent != 0) { decodedSetOptionsOp.Signer = Signer.Decode(stream); } return(decodedSetOptionsOp); }
public static Error Decode(IByteReader stream) { Error decodedError = new Error(); decodedError.Code = ErrorCode.Decode(stream); decodedError.Msg = XdrEncoding.ReadString(stream); return(decodedError); }
public static Curve25519Public Decode(IByteReader stream) { Curve25519Public decodedCurve25519Public = new Curve25519Public(); int keysize = 32; decodedCurve25519Public.Key = XdrEncoding.ReadFixOpaque(stream, (uint)keysize); return(decodedCurve25519Public); }
public static Curve25519Secret Decode(IByteReader stream) { Curve25519Secret decodedCurve25519Secret = new Curve25519Secret(); int keysize = 32; decodedCurve25519Secret.Key = XdrEncoding.ReadFixOpaque(stream, (uint)keysize); return(decodedCurve25519Secret); }
public static HmacSha256Key Decode(IByteReader stream) { HmacSha256Key decodedHmacSha256Key = new HmacSha256Key(); int keysize = 32; decodedHmacSha256Key.Key = XdrEncoding.ReadFixOpaque(stream, (uint)keysize); return(decodedHmacSha256Key); }
public static Thresholds Decode(IByteReader stream) { Thresholds decodedThresholds = new Thresholds(); int Thresholdssize = 4; decodedThresholds.InnerValue = XdrEncoding.ReadFixOpaque(stream, (uint)Thresholdssize); return(decodedThresholds); }
public static Signature Decode(IByteReader stream) { Signature decodedSignature = new Signature(); int Signaturesize = XdrEncoding.DecodeInt32(stream); decodedSignature.InnerValue = XdrEncoding.ReadFixOpaque(stream, (uint)Signaturesize); return(decodedSignature); }
public static HmacSha256Mac Decode(IByteReader stream) { HmacSha256Mac decodedHmacSha256Mac = new HmacSha256Mac(); int macsize = 32; decodedHmacSha256Mac.Mac = XdrEncoding.ReadFixOpaque(stream, (uint)macsize); return(decodedHmacSha256Mac); }
public static Value Decode(IByteReader stream) { Value decodedValue = new Value(); int Valuesize = XdrEncoding.DecodeInt32(stream); decodedValue.InnerValue = XdrEncoding.ReadFixOpaque(stream, (uint)Valuesize); return(decodedValue); }
public static UpgradeType Decode(IByteReader stream) { UpgradeType decodedUpgradeType = new UpgradeType(); int UpgradeTypesize = XdrEncoding.DecodeInt32(stream); decodedUpgradeType.InnerValue = XdrEncoding.ReadFixOpaque(stream, (uint)UpgradeTypesize); return(decodedUpgradeType); }
public static Hash Decode(IByteReader stream) { Hash decodedHash = new Hash(); int Hashsize = 32; decodedHash.InnerValue = XdrEncoding.ReadFixOpaque(stream, (uint)Hashsize); return(decodedHash); }
public static Uint256 Decode(IByteReader stream) { Uint256 decodedUint256 = new Uint256(); int uint256size = 32; decodedUint256.InnerValue = XdrEncoding.ReadFixOpaque(stream, (uint)uint256size); return(decodedUint256); }