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

Fire events when swap status changes. #645

Closed
lukechilds opened this issue Mar 6, 2018 · 6 comments
Closed

Fire events when swap status changes. #645

lukechilds opened this issue Mar 6, 2018 · 6 comments

Comments

@lukechilds
Copy link
Contributor

Doing a trade that I have issues, if I monitor the socket for events that match the tradeid I just started I get the following messages in this exact order:

Method: "request"

{  
  "gui":"hyperdex",
  "aliceid":"5125066954189504513",
  "tradeid":1032989607,
  "base":"CHIPS",
  "etomicsrc":"",
  "rel":"KMD",
  "etomicdest":"",
  "timestamp":1520244703,
  "txfee":"10000",
  "satoshis":"66693352",
  "desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d",
  "destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm",
  "desttxid":"1f47deddc2fa9830cede0ed27393df19224481325f12c3f390c9de866c2dbf2d",
  "destvout":0,
  "feetxid":"8fb63de55bd189c56205b4cedeb9c0cb6df78dbbafff95d782e12090cc2cc6c3",
  "feevout":1,
  "desttxfee":"1000",
  "destsatoshis":"10001000",
  "price":0.14997746,
  "pubkey":"0000000000000000000000000000000000000000000000000000000000000000",
  "method":"request"
},

Method: "request"

{  
  "gui":"hyperdex",
  "aliceid":"5125066954189504513",
  "tradeid":1032989607,
  "base":"CHIPS",
  "etomicsrc":"",
  "rel":"KMD",
  "etomicdest":"",
  "timestamp":1520244703,
  "txfee":"10000",
  "satoshis":"66693352",
  "desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d",
  "destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm",
  "desttxid":"1f47deddc2fa9830cede0ed27393df19224481325f12c3f390c9de866c2dbf2d",
  "destvout":0,
  "feetxid":"8fb63de55bd189c56205b4cedeb9c0cb6df78dbbafff95d782e12090cc2cc6c3",
  "feevout":1,
  "desttxfee":"1000",
  "destsatoshis":"10001000",
  "price":0.14997746,
  "pubkey":"0000000000000000000000000000000000000000000000000000000000000000",
  "method2":"request",
  "method":"request"
},

Method: "reserved"

{  
  "gui":"simplegui",
  "aliceid":"5125066954189504513",
  "tradeid":1032989607,
  "base":"CHIPS",
  "etomicsrc":"",
  "rel":"KMD",
  "etomicdest":"",
  "address":"R9VWtVVfb9tq9nnBtcDWTsEhkKnihWwTm7",
  "timestamp":1520244703,
  "txid":"cd0be5d4a74a87ef358fb9141e413a9d6575d0884e3d7107377e9aab20d4b8ec",
  "vout":0,
  "srchash":"0c9494c8aac1912365bdd0f813c284afa47d730ed692df126b68d4a1e1d23026",
  "txfee":"10000",
  "quotetime":1520244706,
  "satoshis":"67893386",
  "desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d",
  "txid2":"7de8e0ba69c02e81e70090604115f1ce8ef74e6415fdd45833460bcf195de065",
  "vout2":0,
  "destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm",
  "desttxid":"1f47deddc2fa9830cede0ed27393df19224481325f12c3f390c9de866c2dbf2d",
  "destvout":0,
  "feetxid":"8fb63de55bd189c56205b4cedeb9c0cb6df78dbbafff95d782e12090cc2cc6c3",
  "feevout":1,
  "desttxfee":"1000",
  "destsatoshis":"10001000",
  "price":0.14732618,
  "requestid":2335056889,
  "quoteid":2581356427,
  "pending":1520244793,
  "method2":"reserved",
  "method":"reserved"
},

Method: "connect"

{  
  "gui":"hyperdex",
  "aliceid":"5125066954189504513",
  "tradeid":1032989607,
  "base":"CHIPS",
  "etomicsrc":"",
  "rel":"KMD",
  "etomicdest":"",
  "address":"R9VWtVVfb9tq9nnBtcDWTsEhkKnihWwTm7",
  "timestamp":1520244703,
  "txid":"cd0be5d4a74a87ef358fb9141e413a9d6575d0884e3d7107377e9aab20d4b8ec",
  "vout":0,
  "srchash":"0c9494c8aac1912365bdd0f813c284afa47d730ed692df126b68d4a1e1d23026",
  "txfee":"10000",
  "quotetime":1520244706,
  "satoshis":"67893386",
  "desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d",
  "txid2":"7de8e0ba69c02e81e70090604115f1ce8ef74e6415fdd45833460bcf195de065",
  "vout2":0,
  "destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm",
  "desttxid":"1f47deddc2fa9830cede0ed27393df19224481325f12c3f390c9de866c2dbf2d",
  "destvout":0,
  "feetxid":"8fb63de55bd189c56205b4cedeb9c0cb6df78dbbafff95d782e12090cc2cc6c3",
  "feevout":1,
  "desttxfee":"1000",
  "destsatoshis":"10001000",
  "price":0.14732618,
  "requestid":752044033,
  "quoteid":1062537885,
  "pubkey":"0c9494c8aac1912365bdd0f813c284afa47d730ed692df126b68d4a1e1d23026",
  "method":"connect"
},

Method: "connect"

{  
  "gui":"hyperdex",
  "aliceid":"5125066954189504513",
  "tradeid":1032989607,
  "base":"CHIPS",
  "etomicsrc":"",
  "rel":"KMD",
  "etomicdest":"",
  "address":"R9VWtVVfb9tq9nnBtcDWTsEhkKnihWwTm7",
  "timestamp":1520244703,
  "txid":"cd0be5d4a74a87ef358fb9141e413a9d6575d0884e3d7107377e9aab20d4b8ec",
  "vout":0,
  "srchash":"0c9494c8aac1912365bdd0f813c284afa47d730ed692df126b68d4a1e1d23026",
  "txfee":"10000",
  "quotetime":1520244706,
  "satoshis":"67893386",
  "desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d",
  "txid2":"7de8e0ba69c02e81e70090604115f1ce8ef74e6415fdd45833460bcf195de065",
  "vout2":0,
  "destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm",
  "desttxid":"1f47deddc2fa9830cede0ed27393df19224481325f12c3f390c9de866c2dbf2d",
  "destvout":0,
  "feetxid":"8fb63de55bd189c56205b4cedeb9c0cb6df78dbbafff95d782e12090cc2cc6c3",
  "feevout":1,
  "desttxfee":"1000",
  "destsatoshis":"10001000",
  "price":0.14732618,
  "requestid":752044033,
  "quoteid":1062537885,
  "pubkey":"0c9494c8aac1912365bdd0f813c284afa47d730ed692df126b68d4a1e1d23026",
  "method2":"connect",
  "method":"connect"
},

Method: "connected"

{  
  "gui":"simplegui",
  "aliceid":"5125066954189504513",
  "tradeid":1032989607,
  "base":"CHIPS",
  "etomicsrc":"",
  "rel":"KMD",
  "etomicdest":"",
  "address":"R9VWtVVfb9tq9nnBtcDWTsEhkKnihWwTm7",
  "timestamp":1520244703,
  "txid":"cd0be5d4a74a87ef358fb9141e413a9d6575d0884e3d7107377e9aab20d4b8ec",
  "vout":0,
  "srchash":"0c9494c8aac1912365bdd0f813c284afa47d730ed692df126b68d4a1e1d23026",
  "txfee":"10000",
  "quotetime":1520244710,
  "satoshis":"67893386",
  "desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d",
  "txid2":"7de8e0ba69c02e81e70090604115f1ce8ef74e6415fdd45833460bcf195de065",
  "vout2":0,
  "destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm",
  "desttxid":"1f47deddc2fa9830cede0ed27393df19224481325f12c3f390c9de866c2dbf2d",
  "destvout":0,
  "feetxid":"8fb63de55bd189c56205b4cedeb9c0cb6df78dbbafff95d782e12090cc2cc6c3",
  "feevout":1,
  "desttxfee":"1000",
  "destsatoshis":"10001000",
  "price":0.14732618,
  "requestid":752044033,
  "quoteid":2598729467,
  "pair":"tcp://5.9.253.195:10180",
  "proof":[  

  ],
  "method2":"connected",
  "method":"connected"
},

Method: undefined

{  
  "gui":"hyperdex",
  "aliceid":"5125066954189504513",
  "tradeid":1032989607,
  "base":"CHIPS",
  "etomicsrc":"",
  "rel":"KMD",
  "etomicdest":"",
  "address":"R9VWtVVfb9tq9nnBtcDWTsEhkKnihWwTm7",
  "timestamp":1520244703,
  "txid":"cd0be5d4a74a87ef358fb9141e413a9d6575d0884e3d7107377e9aab20d4b8ec",
  "vout":0,
  "srchash":"0c9494c8aac1912365bdd0f813c284afa47d730ed692df126b68d4a1e1d23026",
  "txfee":"10000",
  "quotetime":1520244710,
  "satoshis":"67893386",
  "desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d",
  "txid2":"7de8e0ba69c02e81e70090604115f1ce8ef74e6415fdd45833460bcf195de065",
  "vout2":0,
  "destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm",
  "desttxid":"1f47deddc2fa9830cede0ed27393df19224481325f12c3f390c9de866c2dbf2d",
  "destvout":0,
  "feetxid":"8fb63de55bd189c56205b4cedeb9c0cb6df78dbbafff95d782e12090cc2cc6c3",
  "feevout":1,
  "desttxfee":"1000",
  "destsatoshis":"10001000",
  "price":0.14732618,
  "requestid":752044033,
  "quoteid":2598729467,
  "result":"success"
},

Method: "tradestatus"

{  
  "expiration":1520260303,
  "tradeid":1032989607,
  "requestid":752044033,
  "quoteid":2598729467,
  "iambob":0,
  "Bgui":"",
  "Agui":"hyperdex",
  "gui":"hyperdex",
  "bob":"CHIPS",
  "srcamount":0.67883386,
  "bobtxfee":0.0001,
  "alice":"KMD",
  "destamount":0.1,
  "alicetxfee":0.00001,
  "aliceid":"5125066954189504513",
  "sentflags":[  
     "alicespend",
     "bobpayment",
     "alicepayment",
     "bobdeposit",
     "myfee"
  ],
  "values":[  
     0.67893386,
     0,
     0.67903386,
     0.10002,
     0.76388809,
     0,
     0.0001287,
     0,
     0,
     0,
     0
  ],
  "result":"success",
  "status":"finished",
  "finishtime":1520244941,
  "bobdeposit":"4dd019a969ffdb29ba153a7dc00608354d970135f10695e724d036584f077f84",
  "alicepayment":"eb36c58702087f537b472b5f2b5587b0eac1692958b7d68afb22ecbaeaa9ed68",
  "bobpayment":"13c8b816e18b1e082457b90552aef6fb291027f2f76d713512f86a3ece712b87",
  "paymentspent":"597fe0bb6997024de9dfe9fc805f8824a6ebe79ca778c98b2ed1fb85f439fb42",
  "Apaymentspent":"0000000000000000000000000000000000000000000000000000000000000000",
  "depositspent":"0000000000000000000000000000000000000000000000000000000000000000",
  "method":"tradestatus"
}

This is looking much better than before, however I'm not 100% sure what all the events are signifying. Especially the one with an undefined method property. Are you able to clarify on this?

This looks like it allows us to reliably know when a trade is pending/complete. However, it doesn't provide much insight into the actual state/progress of the atomic swap.

With our (inefficient) polling solution we would get realtime updates on bobdeposit/alicepayment/bobpayment/paymentspent status.

It would be great if you could fire a new event every time there is new progress with the swap.

So each time the trade progresses, e.g new bobdeposit/alicepayment/bobpayment/paymentspent activity, we get a new event, and can update the UI on the progress of the trade.

Is this data that you have internally in mm? That you can just fire over to us when you get it?

@jl777
Copy link
Owner

jl777 commented Mar 6, 2018

I am sending all state changes to a swap, but you need to key on requestid/quoteid then each time a new tx comes in, you will see the event

@jl777
Copy link
Owner

jl777 commented Mar 6, 2018

the undefined is probably from one of the logging events that wasnt via the command processing

@lukechilds
Copy link
Contributor Author

I am sending all state changes to a swap, but you need to key on requestid/quoteid then each time a new tx comes in, you will see the event

Filtering by requestid/quoteid is resulting in less events, more details in this comment: #643 (comment)

@jl777
Copy link
Owner

jl777 commented Mar 7, 2018

here is a raw log of events: https://komodo-platform.slack.com/files/U02QSHX81/F9KQX8459/-.sh

there are plenty of "update" method printouts. ignore the garbage at the end, that is due to removing the null char at the end, need to fix the echo app

@jl777
Copy link
Owner

jl777 commented Mar 7, 2018

are you sure you are running the latest version with the "update" method in it?

@lukechilds
Copy link
Contributor Author

Resolved #643 (comment)

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