public static bool TryGetPayment(this ExecutionContext context, Operation.OperationBody operation, stellar_dotnet_sdk.KeyPair source, PaymentResults pResult, byte[] transactionHash, out PaymentBase payment) { if (context == null) { throw new ArgumentNullException(nameof(context)); } payment = null; int asset; //check supported deposit operations is overkill, but we need to keep SupportedDepositOperations up to date bool result = false; if (!SupportedDepositOperations.Contains(operation.Discriminant.InnerValue)) { return(false); } switch (operation.Discriminant.InnerValue) { case OperationTypeEnum.PAYMENT: if (!context.TryGetAsset(operation.PaymentOp.Asset, out asset)) { return(result); } var amount = operation.PaymentOp.Amount.InnerValue; var destKeypair = stellar_dotnet_sdk.KeyPair.FromPublicKey(operation.PaymentOp.Destination.Ed25519.InnerValue); if (context.Constellation.Vault.Equals((RawPubKey)destKeypair.PublicKey)) { payment = new Deposit { Destination = new RawPubKey() { Data = source.PublicKey }, Amount = amount, Asset = asset, TransactionHash = transactionHash } } ; else if (context.Constellation.Vault.Equals((RawPubKey)source.PublicKey)) { payment = new Withdrawal { TransactionHash = transactionHash } } ; if (payment != null) { payment.PaymentResult = pResult; result = true; } break; case OperationTypeEnum.PATH_PAYMENT_STRICT_SEND: case OperationTypeEnum.PATH_PAYMENT_STRICT_RECEIVE: //TODO: handle path payment break; case OperationTypeEnum.ACCOUNT_MERGE: //TODO: handle account merge break; } return(result); }