Closed wujood closed 3 years ago
For now i worked around this issue by parsing the rawTransaction
myself and access the Memos from there.
const api = new RippleAPI({
server: 'wss://s2.ripple.com' // Public rippled server
});
api.connect().then( async () => {
const transaction = await api.getTransaction("995570FE1E40F42DF56BFC80503BA9E3C1229619C61A1C279A76BC0805036D73", {includeRawTransaction: true});
const parsedRawTransaction = JSON.parse(transaction.rawTransaction);
const memosFromTransaction = parsedRawTransaction .Memos;
console.log("==== Memos ====")
console.log(memosFromTransaction);
api.disconnect();
}).catch(console.error);
This is of course a very expensive procedure especially in the case where you want to parse all transactions that a wallet made to scan for memos... Am i missing something here? Relativly new to this sdk.
Upon further inspection the object that is used to represent a transaction is the FormattedTransactionType
in src/transaction/types.ts
.
https://github.com/ripple/ripple-lib/blob/c9689ec2a8ab8765c3407d144225119e42ce921b/src/transaction/types.ts#L158-L163
https://github.com/ripple/ripple-lib/blob/c9689ec2a8ab8765c3407d144225119e42ce921b/src/transaction/types.ts#L113-L120
Since i am new to the ripple sdk i would guess it is not enough to just add the memo object to these types.
Well since I'm mostly used to a bit of HTML 4 sadly I'm just copying a few projects to see how much I can manage to understand. But if you think you can undo the damage Ive done be my guest
It seems that the transaction object is missing the memo data. When i request a transaction with
includeRawTransaction
it is however included inside the rawTransaction Object.Minimalistic code to reproduce: