Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce smart types for pub key hashes and wallet IDs
- Loading branch information
Showing
40 changed files
with
533 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
marlowe-dashboard-client/generated/Marlowe/Run/Wallet/V1/Types.purs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
-- File auto generated by purescript-bridge! -- | ||
module Marlowe.Run.Wallet.V1.Types where | ||
|
||
import Prelude | ||
|
||
import Control.Lazy (defer) | ||
import Data.Argonaut (encodeJson, jsonNull) | ||
import Data.Argonaut.Decode (class DecodeJson) | ||
import Data.Argonaut.Decode.Aeson ((</$\>), (</*\>), (</\>)) | ||
import Data.Argonaut.Decode.Aeson as D | ||
import Data.Argonaut.Encode (class EncodeJson) | ||
import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) | ||
import Data.Argonaut.Encode.Aeson as E | ||
import Data.Generic.Rep (class Generic) | ||
import Data.Lens (Iso', Lens', Prism', iso, prism') | ||
import Data.Lens.Iso.Newtype (_Newtype) | ||
import Data.Lens.Record (prop) | ||
import Data.Map as Map | ||
import Data.Maybe (Maybe(..)) | ||
import Data.Newtype (class Newtype, unwrap) | ||
import Data.PaymentPubKeyHash (PaymentPubKeyHash) | ||
import Data.Show.Generic (genericShow) | ||
import Data.Tuple.Nested ((/\)) | ||
import Data.WalletId (WalletId) | ||
import Type.Proxy (Proxy(Proxy)) | ||
|
||
newtype WalletInfo = WalletInfo | ||
{ walletId :: WalletId | ||
, pubKeyHash :: PaymentPubKeyHash | ||
} | ||
|
||
derive instance Eq WalletInfo | ||
|
||
instance Show WalletInfo where | ||
show a = genericShow a | ||
|
||
instance EncodeJson WalletInfo where | ||
encodeJson = defer \_ -> E.encode $ unwrap >$< | ||
( E.record | ||
{ walletId: E.value :: _ WalletId | ||
, pubKeyHash: E.value :: _ PaymentPubKeyHash | ||
} | ||
) | ||
|
||
instance DecodeJson WalletInfo where | ||
decodeJson = defer \_ -> D.decode $ | ||
( WalletInfo <$> D.record "WalletInfo" | ||
{ walletId: D.value :: _ WalletId | ||
, pubKeyHash: D.value :: _ PaymentPubKeyHash | ||
} | ||
) | ||
|
||
derive instance Generic WalletInfo _ | ||
|
||
derive instance Newtype WalletInfo _ | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
_WalletInfo :: Iso' WalletInfo | ||
{ walletId :: WalletId, pubKeyHash :: PaymentPubKeyHash } | ||
_WalletInfo = _Newtype |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.