示例#1
0
        /// <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);
        }
示例#2
0
        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);
        }
示例#3
0
 public static new CreateAccountOperation FromXDR(Generated.Operation xdr)
 {
     return((CreateAccountOperation)Operation.FromXDR(xdr));
 }
示例#4
0
 public static new ChangeTrustOperation FromXDR(Generated.Operation xdr)
 {
     return((ChangeTrustOperation)Operation.FromXDR(xdr));
 }
示例#5
0
 public static new PaymentOperation FromXDR(Generated.Operation xdr)
 {
     return((PaymentOperation)Operation.FromXDR(xdr));
 }
示例#6
0
 public Builder(Generated.Operation op)
 {
     Destination = KeyPair.FromXdrPublicKey(op.Body.Destination.InnerValue);
 }
示例#7
0
 public static new AccountMergeOperation FromXDR(Generated.Operation xdr)
 {
     return((AccountMergeOperation)Operation.FromXDR(xdr));
 }