elucidsoft / dotnet-stellar-sdk

Stellar API SDK for .NET 6.x
Apache License 2.0
117 stars 55 forks source link

Unknown TransactionResult type #388

Open jopmiddelkamp opened 1 year ago

jopmiddelkamp commented 1 year ago

Hi guys,

I found a bug. Did you base your code on one of the official SDKs that are maintained by the Stellar team? If so could you tell me which one it is. Then maybe I could add the code myself to speed up the process.

Describe the bug When I execute a fee bump operation in my transaction and I read the Result property I receive the following error:

Unknown TransactionResult type
   at stellar_dotnet_sdk.responses.TransactionResult.FromXdr(TransactionResult result)
   at stellar_dotnet_sdk.responses.TransactionResult.FromXdr(String encoded)
   at stellar_dotnet_sdk.responses.SubmitTransactionResponse.get_Result()
   ...

To Reproduce The code to get this error is


    public async Task<string> FeeBumpTransaction(Transaction transaction)
    {
        var feeBumpTransaction = TransactionBuilder.BuildFeeBumpTransaction(
            _config.SignerKeyPair,
            transaction,
            _config.MaximumFee
        );

        feeBumpTransaction.Sign(_config.SignerKeyPair, Network);

        var response = await Invoke(
            Server.SubmitTransaction(feeBumpTransaction)!
        ).ConfigureAwait(false);

        if (response!.IsSuccess())
        {
            return response.Hash;
        }

        var result = response.Result; // <<<---- HAPPENS HERE

        ...
    }

The result can be checked here:

TransactionResult
  feeCharged: 20006
  result: [txFeeBumpInnerFailed]
    innerResultPair
      transactionHash: qtaF0b1+XhxJmwq+95jr0VmUCLUuv/8RR0fqFYzSOk0=
      result
        feeCharged: 100
        result: [txFailed]
          results: Array[1]
            [0]: [opInner]
              tr: [payment]
                paymentResult: [paymentUnderfunded]
        ext: [undefined]
  ext: [undefined]

Expected behavior I would expect the result to be of a type TransactionResultFeeBumpInnerFailed or something like that.

Additional context The code is running on a .NET 7 Web API.

elucidsoft commented 1 year ago

Would you be willing to submit a PR to fix this?

jopmiddelkamp commented 1 year ago

If it is simply porting code from another base SDK that is officially maintained by Stellar I would. That is why I asked the question. Otherwise I'll probably will look for a workaround to save some time for now.

elucidsoft commented 1 year ago

Ok, I will take a look.

jopmiddelkamp commented 1 year ago

Allright, thanks!

jopmiddelkamp commented 1 year ago

Any status update by any chance?

elucidsoft commented 1 year ago

Sorry my day job has been brutal lately, it's still on my radar. Hopefully soon!

jopmiddelkamp commented 1 year ago

@elucidsoft do you maybe have some time for a short call to point me in the right direction to fix this issue myself?