bitcoin-teleport / teleport-transactions

CoinSwap implementation
Other
236 stars 70 forks source link

Refactor lib to return JSON serializable #54

Open pwltr opened 2 years ago

pwltr commented 2 years ago

Hi, I'm working on a desktop (taker) GUI at https://github.com/pwltr/coinportal. It's built with Tauri which uses a foreign function interface-like abstraction to allow the Frontend to invoke Rust functions directly. For that to work I need Rust to return JSON serializable responses from the functions I want to call.

I'm pretty new to Rust and this was mainly a POC for a GUI. Would a change like this be interesting? This may also serve as a first step towards a full JSON RPC for teleport (https://github.com/bitcoin-teleport/teleport-transactions/issues/46). I'd be willing to look further into that in the future.

Changes

Todo

Tests

All tests are passing, except for test_standard_coinswap. It runs until the end but is marked as failed. Not sure what's wrong there.

[2022-07-05T13:57:46Z INFO  teleport::taker_protocol] ===> Sending HashPreimage to localhost:16102
[2022-07-05T13:57:46Z INFO  teleport::taker_protocol] <=== Received PrivateKeyHandover from localhost:16102
[2022-07-05T13:57:46Z INFO  teleport::taker_protocol] ===> Sending PrivateKeyHandover to localhost:16102
[2022-07-05T13:57:46Z INFO  teleport::taker_protocol] Successfully Completed Coinswap
[2022-07-05T13:57:52Z INFO  teleport::watchtower_protocol] watchtower ended with err Protocol("kill flag is true")
test test_standard_coinswap ... FAILED