cardano-community / cardanosharp-koios

6 stars 6 forks source link

Error deserializing transaction info #12

Closed demogog closed 2 years ago

demogog commented 2 years ago

Describe the bug Using official nuget package fails to deserialise withdrawals part of transaction info with following error: "The JSON value could not be converted to CardanoSharp.Koios.Sdk.Contracts.TransactionPaymentAddress. Path: $[0].withdrawals[0].stake_addr"

To Reproduce Steps to reproduce the behavior:

  1. Clone repo.
  2. Open solution.
  3. Navigate to sample project.
  4. Change transactionRequest variable to contain only the following hash: "1be5e0c09cb4ff238e00717fcce4f01acc286f7b4595d44334c8b911b6ce600b"
  5. Run the project.
  6. transationInformation.Content is null and the transactionInformation.Error is not null, stating deserialisation error

Expected behavior Deserialisation without errors.

Additional context Changing the type of "StakeAddress" in TransactionWithdrawal class from TransactionPaymentAddress to string resolves the issue. Like this:

public class TransactionWithdrawal
{
        [DataMember]
        [JsonPropertyName("stake_addr")]
        public string StakeAddress { get; set; }

        [DataMember]
        [JsonPropertyName("amount")]
        public string? Amount { get; set; }
}
nothingalike commented 2 years ago

@demogog yeah i've been noticing various properties are failling. If you can throw me a PR to resolve this, we can get this fixed sooner.

demogog commented 2 years ago

@demogog yeah i've been noticing various properties are failling. If you can throw me a PR to resolve this, we can get this fixed sooner.

Here you go :) #14

nothingalike commented 2 years ago

Resolved with https://github.com/cardano-community/cardanosharp-koios/pull/14