public static OperationBody Decode(XdrDataInputStream stream) { OperationBody decodedOperationBody = new OperationBody(); OperationType discriminant = OperationType.Decode(stream); decodedOperationBody.Discriminant = discriminant; switch (decodedOperationBody.Discriminant.InnerValue) { case OperationType.OperationTypeEnum.CREATE_ACCOUNT: decodedOperationBody.CreateAccountOp = CreateAccountOp.Decode(stream); break; case OperationType.OperationTypeEnum.PAYMENT: decodedOperationBody.PaymentOp = PaymentOp.Decode(stream); break; case OperationType.OperationTypeEnum.PATH_PAYMENT: decodedOperationBody.PathPaymentOp = PathPaymentOp.Decode(stream); break; case OperationType.OperationTypeEnum.MANAGE_OFFER: decodedOperationBody.ManageOfferOp = ManageOfferOp.Decode(stream); break; case OperationType.OperationTypeEnum.CREATE_PASSIVE_OFFER: decodedOperationBody.CreatePassiveOfferOp = CreatePassiveOfferOp.Decode(stream); break; case OperationType.OperationTypeEnum.SET_OPTIONS: decodedOperationBody.SetOptionsOp = SetOptionsOp.Decode(stream); break; case OperationType.OperationTypeEnum.CHANGE_TRUST: decodedOperationBody.ChangeTrustOp = ChangeTrustOp.Decode(stream); break; case OperationType.OperationTypeEnum.ALLOW_TRUST: decodedOperationBody.AllowTrustOp = AllowTrustOp.Decode(stream); break; case OperationType.OperationTypeEnum.ACCOUNT_MERGE: decodedOperationBody.Destination = AccountID.Decode(stream); break; case OperationType.OperationTypeEnum.INFLATION: break; case OperationType.OperationTypeEnum.MANAGE_DATA: decodedOperationBody.ManageDataOp = ManageDataOp.Decode(stream); break; case OperationType.OperationTypeEnum.BUMP_SEQUENCE: decodedOperationBody.BumpSequenceOp = BumpSequenceOp.Decode(stream); break; } return(decodedOperationBody); }
public static void Encode(XdrDataOutputStream stream, OperationBody encodedOperationBody) { stream.WriteInt((int)encodedOperationBody.Discriminant.InnerValue); switch (encodedOperationBody.Discriminant.InnerValue) { case OperationType.OperationTypeEnum.CREATE_ACCOUNT: CreateAccountOp.Encode(stream, encodedOperationBody.CreateAccountOp); break; case OperationType.OperationTypeEnum.PAYMENT: PaymentOp.Encode(stream, encodedOperationBody.PaymentOp); break; case OperationType.OperationTypeEnum.PATH_PAYMENT: PathPaymentOp.Encode(stream, encodedOperationBody.PathPaymentOp); break; case OperationType.OperationTypeEnum.MANAGE_OFFER: ManageOfferOp.Encode(stream, encodedOperationBody.ManageOfferOp); break; case OperationType.OperationTypeEnum.CREATE_PASSIVE_OFFER: CreatePassiveOfferOp.Encode(stream, encodedOperationBody.CreatePassiveOfferOp); break; case OperationType.OperationTypeEnum.SET_OPTIONS: SetOptionsOp.Encode(stream, encodedOperationBody.SetOptionsOp); break; case OperationType.OperationTypeEnum.CHANGE_TRUST: ChangeTrustOp.Encode(stream, encodedOperationBody.ChangeTrustOp); break; case OperationType.OperationTypeEnum.ALLOW_TRUST: AllowTrustOp.Encode(stream, encodedOperationBody.AllowTrustOp); break; case OperationType.OperationTypeEnum.ACCOUNT_MERGE: AccountID.Encode(stream, encodedOperationBody.Destination); break; case OperationType.OperationTypeEnum.INFLATION: break; case OperationType.OperationTypeEnum.MANAGE_DATA: ManageDataOp.Encode(stream, encodedOperationBody.ManageDataOp); break; case OperationType.OperationTypeEnum.BUMP_SEQUENCE: BumpSequenceOp.Encode(stream, encodedOperationBody.BumpSequenceOp); break; } }
public static void Encode(IByteWriter stream, PathPaymentOp encodedPathPaymentOp) { Asset.Encode(stream, encodedPathPaymentOp.SendAsset); Int64.Encode(stream, encodedPathPaymentOp.SendMax); AccountID.Encode(stream, encodedPathPaymentOp.Destination); Asset.Encode(stream, encodedPathPaymentOp.DestAsset); Int64.Encode(stream, encodedPathPaymentOp.DestAmount); int pathsize = encodedPathPaymentOp.Path.Length; XdrEncoding.EncodeInt32(pathsize, stream); for (int i = 0; i < pathsize; i++) { Asset.Encode(stream, encodedPathPaymentOp.Path[i]); } }
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; }
public static void Encode(XdrDataOutputStream stream, PathPaymentOp encodedPathPaymentOp) { Asset.Encode(stream, encodedPathPaymentOp.SendAsset); Int64.Encode(stream, encodedPathPaymentOp.SendMax); AccountID.Encode(stream, encodedPathPaymentOp.Destination); Asset.Encode(stream, encodedPathPaymentOp.DestAsset); Int64.Encode(stream, encodedPathPaymentOp.DestAmount); var pathsize = encodedPathPaymentOp.Path.Length; stream.WriteInt(pathsize); for (var i = 0; i < pathsize; i++) { Asset.Encode(stream, encodedPathPaymentOp.Path[i]); } }
public static void Encode(IByteWriter stream, PathPaymentOp encodedPathPaymentOp) { Asset.Encode(stream, encodedPathPaymentOp.SendAsset); Int64.Encode(stream, encodedPathPaymentOp.SendMax); AccountID.Encode(stream, encodedPathPaymentOp.Destination); Asset.Encode(stream, encodedPathPaymentOp.DestAsset); Int64.Encode(stream, encodedPathPaymentOp.DestAmount); int pathsize = encodedPathPaymentOp.Path.Length; XdrEncoding.EncodeInt32(pathsize, stream); for (int i = 0; i < pathsize; i++) { Asset.Encode(stream, encodedPathPaymentOp.Path[i]); } }
public static PathPaymentOp Decode(XdrDataInputStream stream) { var 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); var pathsize = stream.ReadInt(); decodedPathPaymentOp.Path = new Asset[pathsize]; for (var i = 0; i < pathsize; i++) { decodedPathPaymentOp.Path[i] = Asset.Decode(stream); } return(decodedPathPaymentOp); }
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); }