| Copyright | Aleksandr Krupenkin 2016-2021 |
|---|---|
| License | Apache-2.0 |
| Maintainer | mail@akru.me |
| Stability | experimental |
| Portability | noportable |
| Safe Haskell | None |
| Language | Haskell2010 |
Language.Solidity.Abi
Description
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
Constructors
| ContractAbi | |
Fields
| |
Instances
| Eq ContractAbi Source # | |
Defined in Language.Solidity.Abi | |
| Ord ContractAbi Source # | |
Defined in Language.Solidity.Abi Methods compare :: ContractAbi -> ContractAbi -> Ordering # (<) :: ContractAbi -> ContractAbi -> Bool # (<=) :: ContractAbi -> ContractAbi -> Bool # (>) :: ContractAbi -> ContractAbi -> Bool # (>=) :: ContractAbi -> ContractAbi -> Bool # max :: ContractAbi -> ContractAbi -> ContractAbi # min :: ContractAbi -> ContractAbi -> ContractAbi # | |
| Show ContractAbi Source # | |
Defined in Language.Solidity.Abi Methods showsPrec :: Int -> ContractAbi -> ShowS # show :: ContractAbi -> String # showList :: [ContractAbi] -> ShowS # | |
| ToJSON ContractAbi Source # | |
Defined in Language.Solidity.Abi Methods toJSON :: ContractAbi -> Value # toEncoding :: ContractAbi -> Encoding # toJSONList :: [ContractAbi] -> Value # toEncodingList :: [ContractAbi] -> Encoding # | |
| FromJSON ContractAbi Source # | |
Defined in Language.Solidity.Abi | |
data Declaration Source #
Elementary contract interface item
Constructors
| DConstructor | |
Fields
| |
| DFunction | |
Fields
| |
| DEvent | |
| DFallback | |
Fields
| |
Instances
| Eq Declaration Source # | |
Defined in Language.Solidity.Abi | |
| Ord Declaration Source # | |
Defined in Language.Solidity.Abi Methods compare :: Declaration -> Declaration -> Ordering # (<) :: Declaration -> Declaration -> Bool # (<=) :: Declaration -> Declaration -> Bool # (>) :: Declaration -> Declaration -> Bool # (>=) :: Declaration -> Declaration -> Bool # max :: Declaration -> Declaration -> Declaration # min :: Declaration -> Declaration -> Declaration # | |
| Show Declaration Source # | |
Defined in Language.Solidity.Abi Methods showsPrec :: Int -> Declaration -> ShowS # show :: Declaration -> String # showList :: [Declaration] -> ShowS # | |
| ToJSON Declaration Source # | |
Defined in Language.Solidity.Abi Methods toJSON :: Declaration -> Value # toEncoding :: Declaration -> Encoding # toJSONList :: [Declaration] -> Value # toEncodingList :: [Declaration] -> Encoding # | |
| FromJSON Declaration Source # | |
Defined in Language.Solidity.Abi | |
data FunctionArg Source #
Method argument
Constructors
| FunctionArg | |
Fields
| |
Instances
| Eq FunctionArg Source # | |
Defined in Language.Solidity.Abi | |
| Ord FunctionArg Source # | |
Defined in Language.Solidity.Abi Methods compare :: FunctionArg -> FunctionArg -> Ordering # (<) :: FunctionArg -> FunctionArg -> Bool # (<=) :: FunctionArg -> FunctionArg -> Bool # (>) :: FunctionArg -> FunctionArg -> Bool # (>=) :: FunctionArg -> FunctionArg -> Bool # max :: FunctionArg -> FunctionArg -> FunctionArg # min :: FunctionArg -> FunctionArg -> FunctionArg # | |
| Show FunctionArg Source # | |
Defined in Language.Solidity.Abi Methods showsPrec :: Int -> FunctionArg -> ShowS # show :: FunctionArg -> String # showList :: [FunctionArg] -> ShowS # | |
| ToJSON FunctionArg Source # | |
Defined in Language.Solidity.Abi Methods toJSON :: FunctionArg -> Value # toEncoding :: FunctionArg -> Encoding # toJSONList :: [FunctionArg] -> Value # toEncodingList :: [FunctionArg] -> Encoding # | |
| FromJSON FunctionArg Source # | |
Defined in Language.Solidity.Abi | |
Event argument
Constructors
| EventArg | |
Fields
| |
data StateMutability Source #
Constructors
| SMPure | |
| SMView | |
| SMPayable | |
| SMNonPayable |
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
Constructors
| 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 | |
| Show SolidityType Source # | |
Defined in Language.Solidity.Abi Methods showsPrec :: Int -> SolidityType -> ShowS # show :: SolidityType -> String # showList :: [SolidityType] -> ShowS # | |