/// <summary> /// Generates Operation XDR object. /// </summary> /// <returns></returns> public Generated.Operation ToXdr() { var xdr = new Generated.Operation(); if (SourceAccount != null) { xdr.SourceAccount = SourceAccount.AccountId; } xdr.Body = ToOperationBody(); return xdr; }
/// <summary> /// Generates Operation XDR object. /// </summary> /// <returns></returns> public Generated.Operation ToXdr() { var xdr = new Generated.Operation(); if (SourceAccount != null) { xdr.SourceAccount = SourceAccount.AccountId; } xdr.Body = ToOperationBody(); return(xdr); }
public static Operation FromXdr(Generated.Operation xdr) { var body = xdr.Body; Operation operation = null; switch (body.Discriminant.InnerValue) { case Generated.OperationType.OperationTypeEnum.CREATE_ACCOUNT: operation = new CreateAccountOperation.Builder(body.CreateAccountOp).Build(); break; case Generated.OperationType.OperationTypeEnum.PAYMENT: operation = new PaymentOperation.Builder(body.PaymentOp).Build(); break; case Generated.OperationType.OperationTypeEnum.PATH_PAYMENT: //operation = new PathPaymentOperation.Builder(body.getPathPaymentOp()).build(); break; case Generated.OperationType.OperationTypeEnum.MANAGE_OFFER: //operation = new ManagerOfferOperation.Builder(body.getManageOfferOp()).build(); break; case Generated.OperationType.OperationTypeEnum.CREATE_PASSIVE_OFFER: //operation = new CreatePassiveOfferOperation.Builder(body.getCreatePassiveOfferOp()).build(); break; case Generated.OperationType.OperationTypeEnum.SET_OPTIONS: //operation = new SetOptionsOperation.Builder(body.getSetOptionsOp()).build(); break; case Generated.OperationType.OperationTypeEnum.CHANGE_TRUST: operation = new ChangeTrustOperation.Builder(body.ChangeTrustOp).Build(); break; case Generated.OperationType.OperationTypeEnum.ALLOW_TRUST: //operation = new AllowTrustOperation.Builder(body.getAllowTrustOp()).build(); break; case Generated.OperationType.OperationTypeEnum.ACCOUNT_MERGE: //operation = new AccountMergeOperation.Builder(body).build(); break; default: throw new Exception("Unknown operation body " + body.Discriminant.InnerValue); } if (xdr.SourceAccount != null) { operation.SourceAccount = KeyPair.FromXdrPublicKey(xdr.SourceAccount.InnerValue); } return(operation); }
public static new ChangeTrustOperation FromXDR(Generated.Operation xdr) { return((ChangeTrustOperation)Operation.FromXDR(xdr)); }
public static new PaymentOperation FromXDR(Generated.Operation xdr) { return((PaymentOperation)Operation.FromXDR(xdr)); }
public static new CreateAccountOperation FromXDR(Generated.Operation xdr) { return((CreateAccountOperation)Operation.FromXDR(xdr)); }