-
Notifications
You must be signed in to change notification settings - Fork 211
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
[ADP-3344] Implement REST-like IO
interface for Deposit Wallet
#4769
Conversation
ae3a5b0
to
cbc4689
Compare
2825954
to
33aec0f
Compare
lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/IO/Resource.hs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
This pull requests implements a REST-like `IO` interface for the Deposit Wallet. This interface corresponds more closely to an HTTP interface. Essentially, the main difference between `Cardano.Wallet.Deposit.IO` and `Cardano.Wallet.Deposit.REST` is that the latter postpones the need to initialize the wallet. Instead of working with a `WalletInstance`, the latter module now works with a `WalletResource`, which is roughly a `TVar (Maybe WalletInstance)`. This mutable variable starts with `Nothing` and the function `putWallet` can be used to initialize the wallet, putting a `Just` in the mutable variable. In turn, a module `Cardano.Wallet.Deposit.IO.Resource` implements a data type `Resource` that encapsulate the idea of `TVar (Maybe WalletInstance)` and is (reasonably) safe to use in a concurrent environment. ### Comments * Not implemented yet: `withWalletResource` inspects the database directory and loads a wallet if necessary. ### Issue Number ADP-3344
0b30e73
to
5f29dce
Compare
5f29dce
to
a3874e9
Compare
a3874e9
to
19cecf8
Compare
Looks good to me as well, thank you! 👍 The error type |
19cecf8
to
053d8b1
Compare
This pull requests implements a REST-like
IO
interface for the Deposit Wallet. This interface corresponds more closely to an HTTP interface.Essentially, the main difference between
Cardano.Wallet.Deposit.IO
andCardano.Wallet.Deposit.REST
is that the latter postpones the need to initialize the wallet. Instead of working with aWalletInstance
, the latter module now works with aWalletResource
, which is roughly aTVar (Maybe WalletInstance)
. This mutable variable starts withNothing
and the functionputWallet
can be used to initialize the wallet, putting aJust
in the mutable variable.In turn, a module
Cardano.Wallet.Deposit.IO.Resource
implements a data typeResource
that encapsulate the idea ofTVar (Maybe WalletInstance)
and is (reasonably) safe to use in a concurrent environment.Comments
withWalletResource
inspects the database directory and loads a wallet if necessary.Issue Number
ADP-3344