Copyright | Aleksandr Krupenkin 2016-2021 |
---|---|
License | Apache-2.0 |
Maintainer | mail@akru.me |
Stability | experimental |
Portability | noportable |
Safe Haskell | None |
Language | Haskell2010 |
JSON encoded contract ABI parsers.
Synopsis
- newtype ContractAbi = ContractAbi {
- unAbi :: [Declaration]
- data Declaration
- = DConstructor {
- conInputs :: [FunctionArg]
- | DFunction {
- funName :: Text
- funConstant :: Bool
- funInputs :: [FunctionArg]
- funOutputs :: Maybe [FunctionArg]
- | DEvent { }
- | DFallback {
- falPayable :: Bool
- = DConstructor {
- data FunctionArg = FunctionArg {
- funArgName :: Text
- funArgType :: Text
- funArgComponents :: Maybe [FunctionArg]
- data EventArg = EventArg {
- eveArgName :: Text
- eveArgType :: Text
- eveArgIndexed :: Bool
- data StateMutability
- signature :: Declaration -> Text
- methodId :: Declaration -> Text
- eventId :: Declaration -> Text
- data SolidityType
- parseSolidityFunctionArgType :: FunctionArg -> Either ParseError SolidityType
- parseSolidityEventArgType :: EventArg -> Either ParseError SolidityType
Contract ABI declarations
newtype ContractAbi Source #
Contract Abi is a list of method / event declarations
ContractAbi | |
|
Instances
data Declaration Source #
Elementary contract interface item
DConstructor | |
| |
DFunction | |
| |
DEvent | |
DFallback | |
|
Instances
data FunctionArg Source #
Method argument
FunctionArg | |
|
Instances
Event argument
EventArg | |
|
data StateMutability Source #
Instances
Method/Event id encoder
signature :: Declaration -> Text Source #
Take a signature by given decl, e.g. foo(uint,string)
methodId :: Declaration -> Text Source #
Generate method selector by given method Delcaration
eventId :: Declaration -> Text Source #
Generate event topic0
hash by givent event Delcaration
Solidity type parser
data SolidityType Source #
Solidity types and parsers
SolidityBool | |
SolidityAddress | |
SolidityUint Int | |
SolidityInt Int | |
SolidityString | |
SolidityBytesN Int | |
SolidityBytes | |
SolidityTuple [SolidityType] | |
SolidityVector [Int] SolidityType | |
SolidityArray SolidityType |
Instances
Eq SolidityType Source # | |
Defined in Language.Solidity.Abi (==) :: SolidityType -> SolidityType -> Bool # (/=) :: SolidityType -> SolidityType -> Bool # | |
Show SolidityType Source # | |
Defined in Language.Solidity.Abi showsPrec :: Int -> SolidityType -> ShowS # show :: SolidityType -> String # showList :: [SolidityType] -> ShowS # |