Skip to content

Conversation

@pwltr
Copy link
Contributor

@pwltr pwltr commented Jul 5, 2022

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 (#46). I'd be willing to look further into that in the future.

Changes

  • refactored all main functions in lib.rs to return a JSON serializable result
  • moved print lines to cli.rs, use the results from lib
  • improve error messages, handle more errors
  • ignored wallet & watchtower files
  • commited Cargo.lock

Todo

  • refactor the rest of the functions
  • handle all possible errors in lib.rs (and down the call stack, replace .unwrap()s)

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

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

Successfully merging this pull request may close these issues.

1 participant