/
Address.purs
119 lines (85 loc) · 3.38 KB
/
Address.purs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
-- File auto generated by purescript-bridge! --
module Ledger.Address 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.PubKeyHash (PubKeyHash)
import Data.Show.Generic (genericShow)
import Data.Tuple.Nested ((/\))
import Plutus.V1.Ledger.Crypto (PubKey)
import Type.Proxy (Proxy(Proxy))
newtype PaymentPubKey = PaymentPubKey { unPaymentPubKey :: PubKey }
derive instance Eq PaymentPubKey
derive instance Ord PaymentPubKey
instance Show PaymentPubKey where
show a = genericShow a
instance EncodeJson PaymentPubKey where
encodeJson = defer \_ -> E.encode $ unwrap >$<
( E.record
{ unPaymentPubKey: E.value :: _ PubKey }
)
instance DecodeJson PaymentPubKey where
decodeJson = defer \_ -> D.decode $
( PaymentPubKey <$> D.record "PaymentPubKey"
{ unPaymentPubKey: D.value :: _ PubKey }
)
derive instance Generic PaymentPubKey _
derive instance Newtype PaymentPubKey _
--------------------------------------------------------------------------------
_PaymentPubKey :: Iso' PaymentPubKey { unPaymentPubKey :: PubKey }
_PaymentPubKey = _Newtype
--------------------------------------------------------------------------------
newtype StakePubKey = StakePubKey { unStakePubKey :: PubKey }
derive instance Eq StakePubKey
derive instance Ord StakePubKey
instance Show StakePubKey where
show a = genericShow a
instance EncodeJson StakePubKey where
encodeJson = defer \_ -> E.encode $ unwrap >$<
( E.record
{ unStakePubKey: E.value :: _ PubKey }
)
instance DecodeJson StakePubKey where
decodeJson = defer \_ -> D.decode $
( StakePubKey <$> D.record "StakePubKey"
{ unStakePubKey: D.value :: _ PubKey }
)
derive instance Generic StakePubKey _
derive instance Newtype StakePubKey _
--------------------------------------------------------------------------------
_StakePubKey :: Iso' StakePubKey { unStakePubKey :: PubKey }
_StakePubKey = _Newtype
--------------------------------------------------------------------------------
newtype StakePubKeyHash = StakePubKeyHash { unStakePubKeyHash :: PubKeyHash }
derive instance Eq StakePubKeyHash
derive instance Ord StakePubKeyHash
instance Show StakePubKeyHash where
show a = genericShow a
instance EncodeJson StakePubKeyHash where
encodeJson = defer \_ -> E.encode $ unwrap >$<
( E.record
{ unStakePubKeyHash: E.value :: _ PubKeyHash }
)
instance DecodeJson StakePubKeyHash where
decodeJson = defer \_ -> D.decode $
( StakePubKeyHash <$> D.record "StakePubKeyHash"
{ unStakePubKeyHash: D.value :: _ PubKeyHash }
)
derive instance Generic StakePubKeyHash _
derive instance Newtype StakePubKeyHash _
--------------------------------------------------------------------------------
_StakePubKeyHash :: Iso' StakePubKeyHash { unStakePubKeyHash :: PubKeyHash }
_StakePubKeyHash = _Newtype