Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Decode unsigned tx set #78

Closed
mrtestyboy781 opened this issue Feb 14, 2022 · 5 comments
Closed

Feature request: Decode unsigned tx set #78

mrtestyboy781 opened this issue Feb 14, 2022 · 5 comments

Comments

@mrtestyboy781
Copy link

As far as I can tell, if you have an unsigned tx string, there isn't a way to decode it into a MoneroTxWallet, which is printable with .toString()

I am looking to replicate something like the monero rpc command describe_transfer but with an offline wallet. The idea would be to allow a user to print the details of an unsigned tx, before signing it. Like

offlineWallet = openWalletFull(...)

moneroTxWallet.fromHex(unsigned_tx_str).toString()

.... if looks okay, then.....

offlineWallet.signTxs(unsigned_tx_str)
@mrtestyboy781 mrtestyboy781 changed the title Decode unsigned tx set Feature request: Decode unsigned tx set Feb 14, 2022
@woodser
Copy link
Owner

woodser commented Mar 3, 2022

wallet.describeTxSet(new MoneroTxSet().setUnsignedTxHex(unsignedTxHex)); should work.

This is a good use case to make simpler.

@woodser
Copy link
Owner

woodser commented May 9, 2022

This is now supported with a convenience method in v0.7.0:

await wallet.describeUnsignedTxSet(unsignedTxHex: string)

Thanks.

@woodser woodser closed this as completed May 9, 2022
@mrtestyboy781
Copy link
Author

thank you!

@mrtestyboy781
Copy link
Author

Finally got a chance to test this and unfortunately got an error

Error during command execution: TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'MoneroTxWallet'
    |     property 'state' -> object with constructor 'Object'
    |     property 'outgoingTransfer' -> object with constructor 'MoneroOutgoingTransfer'
    |     property 'state' -> object with constructor 'Object'
    --- property 'tx' closes the circle

On tx

4d6f6e65726f20756e7369676e65642074782073657405a6c9000d29dc3bbc55848013dacf56b84a1d9c3a3d8ee1bb8f8ed07e27487a7ec340ea13ec8ebeeb029c167ea65fe8653c6b243f1a5073279ca602873b9ce4a282977f5824751752b1b4c73e9f7176ea62b4d227529470604a6ed0c0d0df9f92236c144ac047e3938ab3126fa881c495c08570bdb70b1cd7970a531030e9c2a465dbbc341e674304c7bdcb8d7a3be613e2571c9e0d6c67f37e692cac3fcc475cb8189b3210e010655a8bf1085289622af4a7a8d5e7f5bcf2e4cbaab2065972b985b761b9c6233881435fcecaac336455d30baf6f4911dc2473f804dc131d06716e4cd6ed570963467b1d172d18aca0a1e13cc0f03be99d3b23070d919774cdaaedf3850a716912949a281e6abefb662637bc34b580a7e9c958d753c4f43ef8d2fc2970991948975e3699e6584be34f3cdd0e0e913c24750d173375d12dc05a90066e917fab5253a7d6cc21d9a266427a842bbfd27e4de70a334a75185de125c288be73ef58dcb5656a7ded5d0b6aca559b11776a77db5e0f8e1f2cb15d129ea6934cfb44ab0d54bebe15e686ba77b6041b90f11f253835a3d8aa0d637775df52ba2b4a774ced462a82434ba4561c5d7cb88712170665c50e5a9254a6e00df7ee8df7acf8d70725e72d7fb9159be26deb159b445c483fb64cd3a22f39637c3ee362b2dac5063c15602c71165d9d89ccd3629612aeaa1fe92d9dab7c8ac040f897e986f5bf5f56ba21d56211674f7f37cbad0a85805e138f340798467f1365c414566b535dd8f36cfffdb733a1b7d9de708750dec97fed2df960fdaec7fcdc90d68e54af2f498849e63ae710b4a97563551b94a39d5e845a13b8d865db871875ab4ed39cef5ebc4bda81d5f2c988de450ae4f54caf2e5a299f4ff388092bb835c5825bbbe1ee99f1237ebb80348764b50775ba7045d89836087fed6c82ce78407f0bf2596d499d0613baf079b3ee1b11a6230a690ffe19f42ddf20ca435b0b263ef52930e7a8a5ff7e4dc8a1e0ed88e5e6864857de17777581c259a083512dd5b79b96aded1fb2fe9aca215fd3b4460ae99aea112623daf2cc8d335702a9584e28b8720afa38bfaa7abff910330a0d88c18aaaac9652fcb83b26551ccf07b85e75048479a2f829fb180bbd4a8b3b75fe2222a87add446e5d8234b6a397a96841673252fd1c2018354a676335d87e37bb5b6ac28fe46f17c2d112e9ba098750c8a1860b2048ebb2f0db46b3002ed8d7ca26b922945d57b468637777c94f1be507875f8f5f99ba105888c610ab6a2a83773d0d0d888c5f392af8e714b2ac3023fc0f286e12e9c458e2529e6b83a2d2d5ed512d65494dba62e01fc1912de6e4228d0cf4ad2ef33bfe2b37e6908529848b98ea13872e6550c47ba88eed31ea111aa7fd69df4bc99aa4571787d6d2e97492456f7a648686e82c170abd94a615c8744df87172c3b2baf60cd41003372e12da348b2f7fda545485921ac1e9630379e311e3141564f2263463ce221f358f4301d6cc3d8048f910cc445a9bd01950a63fc27e982bbce263f58cd2048d61f2ee7b6dd98cfe36dea56abc1f7cc08fd27969db23488b82b22f43ca35f4168421b0ccb0192117e4c507bf9d93316eedcde799195b8707595e8355970cadb12d1991f81cf29174348a73d769d9a4dab8a43756ba167c7cbe6dfda2f1cbfb1a2aabd6b9a625f66b2cbf0c5c3962d0725bde7ad941bfcbe961a845bdc6b7146b6e82843c83f661c218102f3de4ee7c2869b1ec51777830ee5e816c1eb4545d27021ad09e0046a5506464143f4d7b94f0bce1d1249783bb26733948218ad31f0f4f664c17286f427c5c4dd785a55989f5917f43d2cb953aaad5a3bb9fab5a1dad6edcb35643157f0f29d70d8f29af4ab30d2922c61cb5de6e8591f638bdee8f75440d15aa10ffadc90c37cfba5c61395c515e67d2b118f54dac14d08a940bdd535e09c01f995b8a025b659818a6da3f10c12c84f41787458e5153d1358949b37403dfa5109cb6ef823a7e3713c993151877cfe6d8349663971a2a37f7a8c33d396f714569c0b47fe1b65cba9e78ffbb731d1aeef1b0bf9dab1793a3573751abeb54c119d5bdf83007d283f19537f179e9943f9fbcbbcd7a81acd72fe43f0a1c095040ef6f2e85004c69c682be85ca8838a4dccb3b1cdedd85245253d5b07a84dc1c037426ad6cd53a895834b08537d70652bcbaddd3a8ffb54577e6cb6fe67034336916bda150dd0681ae96e4d6fda92ed06e68895b442818f7d8de54d731a52eaf9e2ff18786229364d1416560605130bde5bd7cd8dffd925962b5e24943c1cdfb1b220e8b6580e5ad54b2b8e6c3f7a3b3087b526a75d6a82cc8073b3dad910de50ea66cb91dfc7fb6c1f3146bedbaf22feb03277ebc44c057411f1933b227347a6db9b6f11354dab266f6f338a8fc66b6898a8ddd0a7982aed6a7a4653c1e7a831ff738cb3641f47a9cd5f4d3e06b71d13948d57f7da7be9ef247bbe8ff2c887c4313e980660176283d380b73fbd41381bf9961134531a9f73c845b57b028981b58999bb5622e1f7962de9d4c3a765d5a31247bdf35252a65614a6c96183f2d044319aee10fdbd027197f847168da04c5267ef07022cefa93d43c538e33455a8891deb6ad20d5b23c6bad3a8ee7cb578c477957a24e8595f6d38316296afe2f45ccee8e298f98576006c8725da435265c3032bc796b340a58a440a3149802dfdb1cc59556b82814c605

with test wallet

essential blip point lied boil guest adjust fewest logic vein huge fidget towel mirror feline birth tulips among scrub petals tawny maps aptitude boat petals

@woodser
Copy link
Owner

woodser commented May 26, 2022

You should be passing a string to the function, which is tested:

let describedTxSet = await offlineWallet.describeUnsignedTxSet(unsignedTxHex);
for (let tx of describedTxSet.getTxs()) console.log(tx.toString());

https://github.com/monero-ecosystem/monero-javascript/blob/a07c29b94a6d6bf30f543ed628ec1419c5c56509/src/test/TestMoneroWalletCommon.js#L4849

If you still have problems, feel free to post code for review. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants