SiaFoundation / walletd

A new Sia wallet
https://sia.tech/software/walletd
MIT License
14 stars 9 forks source link

Add /wallet/transaction and /wallet/siacoins #2

Closed chris124567 closed 2 years ago

chris124567 commented 2 years ago

Add /wallet/transaction and /wallet/siacoins in accordance with the specification laid out at https://api.sia.tech/.

lukechampine commented 2 years ago

my preference would be a /wallet/fund endpoint, like in renterd. It's a bit more work for the client, but much more flexible.

chris124567 commented 2 years ago

Do we want to keep /wallet/siacoins? I guess the question is how backwards compatible do we want to be with the v1 API.

lukechampine commented 2 years ago

hmm. I guess I do think we'll want a route like /wallet/siacoins -- not for backwards compatibility, but simply because it's a common operation, and calling one route is much more convenient than calling /wallet/fund, /wallet/sign, /txpool/broadcast.

Broadly speaking, my position on "high-level" routes like this is that:

  1. They should be added sparingly, for operations that are common and otherwise annoying
  2. They shouldn't do anything that you couldn't do yourself with multiple calls to low-level routes

In other words, they should be like bash aliases. :)

(Let's call it /wallet/send, though, so that it can be used for either SC or SF)

chris124567 commented 2 years ago

Took a crack at it. It's a little complicated because you still have to fund the fee in SC even if you're sending SF.

chris124567 commented 2 years ago

Merging the FundTransactionSiacoins and FundTransactionSiafunds into one function made a lot of things much more simple :+1:

lukechampine commented 2 years ago

nice