question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TransactionResponse constructor fails for text memo

See original GitHub issue

Problem In the class stellar_dotnet_sdk.responses.TransactionResponse processing of MemoText currently is not possible. For example, this text memo cad98atrnpbwtn9qiozjpd5m6o is used as a deposit address for a user.

This code should work with text memo: https://github.com/elucidsoft/dotnet-stellar-sdk/blob/master/stellar-dotnet-sdk/responses/TransactionResponse.cs#L78

Solution Update getter and setter of MemoValue property

public Memo Memo
        {
            get
            {
                switch (MemoType)
                {
                    case "none":
                        return Memo.None();
                    case "id":
                        return Memo.Id(ulong.Parse(MemoValue));
                    case "hash":
                        return Memo.Hash(Convert.FromBase64String(MemoValue));
                    case "return":
                        return Memo.ReturnHash(Convert.FromBase64String(MemoValue));
                   // Code below should be added
                    case "text":
                        return Memo.Text(MemoValue);
                    default:
                        throw new ArgumentException(nameof(MemoType));
                }
            }
            private set
            {
                switch (value)
                {
                    case MemoNone _:
                        MemoType = "none";
                        MemoValue = null;
                        return;
                    case MemoId id:
                        MemoType = "id";
                        MemoValue = id.IdValue.ToString();
                        return;
                    case MemoHash h:
                        MemoType = "hash";
                        MemoValue = Convert.ToBase64String(h.MemoBytes);
                        return;
                    case MemoReturnHash r:
                        MemoType = "return";
                        MemoValue = Convert.ToBase64String(r.MemoBytes);
                        return;
                   // Code below should be added
                   case MemoText r:
                        MemoType = "text";
                        MemoValue = value;
                        return;
                    default:
                        throw new ArgumentException(nameof(value));
                }
            }
        }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:6

github_iconTop GitHub Comments

1reaction
fracekcommented, Jun 4, 2020

The fix was merged in master. I will close once we release a new version.

0reactions
fracekcommented, Jun 5, 2020

Version 4.2.24 was published on nuget. The bug should be fixed now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is the JsonRpcSigner sendTransaction slow? #340
When we call a method that requires signature on a contract, we are finding that, while MetaMask returns a transaction hash immediately upon ......
Read more >
Contract - Ethers.js
A Contract is an abstraction of code that has been deployed to the blockchain. A Contract may be sent transactions, which will trigger...
Read more >
TransactionRecord - Hedera
Field Type Label receipt ​TransactionReceipt​ ​ transactionHash bytes ​ consensusTimestamp ​Timestamp​ ​
Read more >
ethersproject/providers
5, import { Provider, TransactionRequest, TransactionResponse } from ... SERVER_ERROR && error.error && typeof(error.error.message) === "string") {.
Read more >
Writing Solidity tests for array length & contents (chai)
In my deployed Remix contract, I'm able to call, for example, nameToFavoriteNumber with the string of the user I've added, and the supplied ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found