-
Notifications
You must be signed in to change notification settings - Fork 98
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
Send ETH/ERC20 TX data #104
Comments
@lukechilds
|
Thanks @artemii235, this looks perfect!
Not too sure what you mean here? |
@lukechilds
Do you need this info for ETH side? |
Oh right, missed that, yeah we need that too to show the final TX in the chain. |
@lukechilds https://github.com/artemii235/SuperNET/releases/tag/v1.0.329 - release was published, please test it and let me know result. |
Thanks! Testing now. |
Looking good artem, but looks like it still needs a tiny tweak. I think there should be an {
"uuid": "2418498a876dba5fad5cf77af38273136621149ee2302c14b39043a5c5ba2753",
"expiration": 1532466810,
"tradeid": 10845859,
"requestid": 551717757,
"quoteid": 1186618386,
"iambob": 0,
"Bgui": "",
"Agui": "hyperdex",
"gui": "hyperdex",
"bob": "MYTH",
"bobtomic": "0x277ab4b9dde09a8e710fd755deeb9d0d9532d047",
"etomicsrc": "0xe675e3bed50682297adc795bf7756e618c32a8f3",
"srcamount": 9.63503266,
"bobtxfee": 0.00001,
"alice": "KMD",
"etomicdest": "0x30bd6328e9495be74efa11bb25b5a3f0506e85e2",
"destamount": 1.00008999,
"alicetxfee": 0.00001,
"aliceid": "606182714381762561",
"result": "success",
"status": "finished",
"finishtime": 1532451690,
"bobdeposit": "f282cccaff18c094be2bfb7b37ba8f90439cca50bc7f866200bebfe8ca09a101",
"alicepayment": "01b55e758128d8ce6eb58f581bdb950e5e0e5abd1408a2561f3efff5573f3f91",
"bobpayment": "753a94db075f9f7dbfc858ed38755d10a6d8400cf5c1312935752d4e55e510e4",
"paymentspent": "56d0b4ccd8c2d3359ed9ee40fcfd9bb52bf34f4acc3c3d7371ceca8b9edd8db4",
"Apaymentspent": "0000000000000000000000000000000000000000000000000000000000000000",
"depositspent": "0000000000000000000000000000000000000000000000000000000000000000",
"alicedexfee": "4099ae03cf22cae7702ccabde23f4eac88dddee10ed95dd82ec366cbf48ae8e4",
"method": "tradestatus",
"eth_info": {
"bobpaymentspent": {
"txid": "0x437a73b4562f61b0249ba0a141ecd813b65c41e36ec017aece2ebebfc52d6a53",
"amount": 9.63503266
},
"bobpayment": {
"txid": "0x83f47fbc74a81b07a35187e9180d13cb302059a857d2f577cbde2a68d967fca8",
"amount": 9.63503266
},
"bobdeposit": {
"txid": "0x25fda9c1c4153b7c8dc6ca919c212fa4797ca1f2ada65e747d9ce4d99ab33a8a",
"amount": 10.83941174
}
},
"values": [
1.00000999,
0,
1.00002,
1.00011,
1.12502,
0,
0.00128711,
0,
0,
0,
0
],
"sentflags": [
"alicespend",
"bobpayment",
"alicepayment",
"bobdeposit",
"myfee"
]
} It comes through correctly in the |
An alternative, and possibly neater solution would be to just expose a Something like: [
{
"stage": "myfee",
"coin": "KMD",
"txid": "4099ae03cf22cae7702ccabde23f4eac88dddee10ed95dd82ec366cbf48ae8e4",
"amount": 0.00128711
},
{
"stage": "bobdeposit",
"coin": "MYTH",
"txid": "0x25fda9c1c4153b7c8dc6ca919c212fa4797ca1f2ada65e747d9ce4d99ab33a8a",
"amount": 10.83941174
},
{
"stage": "alicepayment",
"coin": "KMD",
"txid": "01b55e758128d8ce6eb58f581bdb950e5e0e5abd1408a2561f3efff5573f3f91",
"amount": 1.00011
},
{
"stage": "bobpayment",
"coin": "MYTH",
"txid": "0x83f47fbc74a81b07a35187e9180d13cb302059a857d2f577cbde2a68d967fca8",
"amount": 9.63503266
},
{
"stage": "alicespend",
"coin": "MYTH",
"txid": "0x83f47fbc74a81b07a35187e9180d13cb302059a857d2f577cbde2a68d967fca8",
"amount": 9.63503266
}
] Then that can be used for all trades without having to do lots of checks of whether it's an etomic swap and if so which coins are etomic and get different values for each. |
We also needs to show |
@lukechilds
You can see
|
Hi Artem, ah sorry, I missed those, looks like everything is there then. So I should be able to implement everything with what we've got. But yeah, if you could refactor into At the moment we are getting the currency, stage, txid and value for each TX. And they have different naming conventions for the stage depending on which part of the code you're in and what other swap conditions are active. e.g: myfee == alicefee == alicedexfee
bobdeposit
alicepayment
bobpayment
alicespend == paymentspent == bobpaymentspent
aliceclaim == depositspent == bobdepositspent
alicereclaim == Apaymentspent == alicepaymentspent These are all the same values and we have a load of spaghetti code to pluck the right values out depending on the situation. It would be great if you could replace this with a simple If you could keep the names consistent with the ones in e.g: "sentflags": [
"alicespend",
"bobpayment",
"alicepayment",
"bobdeposit",
"myfee"
] Thanks! |
@lukechilds Ok, I will do it tomorrow and publish a new release. |
Can't wait, thanks @artemii235! |
Hey @artemii235 I noticed there is a new release (v1.0.338). Did you manage to get these tweaks in? |
@lukechilds Hi, excuse me, not yet. That release is automatic PR from jl777 dev branch. I'll finish this task today - new release will be created. |
@lukechilds https://github.com/artemii235/SuperNET/releases/tag/v1.0.342 - done, release is published, please test and let me know results. |
Great, thanks @artemii235! Will test today. |
@artemii235 Thanks, tested this looks absolutely perfect! Just to clarify:
|
@lukechilds
|
Perfect! Thanks so much for this Artem, it's made our lives a hell of a lot easier! |
Currently in the update socket messages and the
tradestatus
completion method for ETH/ERC20 swaps we get the ETOMIC TXIDs/amounts but not the ETH/ERC20 values.It would be great if you could expose the ETH/ERC20 TX data to us.
As an example, this is a current TX update object:
I see there is
bobDepositEthTx
for the ETH TXID andbobRealSat
.However it would be better if
bobDepositEthTx
could just be exposed as something liketxidEth
so we can aways use that overtxid
if it exists, then we don't have to manually search for the ETH TXID property for each TX type e.gbobDepositEthTx
,bobPaymentEthTx
etc.Also
bobRealSat
appears to be denoted in "satoshis" which doesn't really make sense for ETH/ERC20. This could cause issues if the token has a non standard decimal amount. It would be great if mm could calculate the value based on it's internal ERC20 decimal value and just exposeamountEth
.With these solutions we can just rely on using
txidEth
andamountEth
if they exist, if not, fallback totxid
andamount
.We also regenerate all trade data from the completed
tradestatus
message.An example:
This is to ensure we have correct trade data if the mm node went offline, restarted, was reverted etc. We can currently completely rebuild a BTC protocol trade with this data but not an ETH/ERC20 trade.
We need ETH/ERC20 TXIDs and amounts included to be able to do this, currently we only have ETOMIC.
The text was updated successfully, but these errors were encountered: