Documentation
¶
Index ¶
- Constants
- func DumpNodeNoExit(whatever any)
- func DumpNodeWithExit(whatever any)
- func EventToABI(method *abi.Event) (string, error)
- func GetCurrentPath() (string, error)
- func GetLocalSourcesPath() string
- func IsSemanticVersionGreaterOrEqualTo(versionStr string, version SemanticVersion) bool
- func IsSemanticVersionLowerOrEqualTo(versionStr string, version SemanticVersion) bool
- func Keccak256(data []byte) []byte
- func MethodToABI(method *abi.Method) (string, error)
- func PathExists(path string) bool
- func SimplifyImportPaths(content string) string
- func StripExtraSPDXLines(content string) string
- func StripImportPaths(content string) string
- func ToABI(data []byte) (*abi.ABI, error)
- func ToJSON(data any) ([]byte, error)
- func ToJSONPretty(data any) ([]byte, error)
- func ToProtoJSON(data any) ([]byte, error)
- func WriteToFile(path string, data []byte) error
- type AccountType
- type AddressType
- type ArgumentABI
- type LogEventType
- type MethodABI
- type Network
- type NetworkID
- type NormalizationInfo
- type NormalizeType
- type SemanticVersion
- type SimulatorType
- type Strategy
- type TransactionMethodType
Constants ¶
const ( AnvilNetwork Network = "anvil" Ethereum Network = "ethereum" Bsc Network = "bsc" Polygon Network = "polygon" Avalanche Network = "avalanche" Fantom Network = "fantom" Arbitrum Network = "arbitrum" Optimism Network = "optimism" // Mainnets EthereumNetworkID NetworkID = 1 BscNetworkID NetworkID = 56 PolygonNetworkID NetworkID = 137 AvalancheNetworkID NetworkID = 43114 FantomNetworkID NetworkID = 250 ArbitrumNetworkID NetworkID = 42161 OptimismNetworkID NetworkID = 10 // Testnets RopstenNetworkID NetworkID = 3 RinkebyNetworkID NetworkID = 4 GoerliNetworkID NetworkID = 5 KovanNetworkID NetworkID = 42 BscTestnetNetworkID NetworkID = 97 MumbaiNetworkID NetworkID = 80001 FujiNetworkID NetworkID = 43113 FantomTestNetworkID NetworkID = 4002 ArbitrumRinkebyID NetworkID = 421611 OptimismKovanID NetworkID = 69 )
const ( HeadStrategy Strategy = "head" ArchiveStrategy Strategy = "archive" ZeroAddressRecipient AddressType = "zero_address" AddressRecipient AddressType = "address" ContractRecipient AddressType = "contract" UnknownTransactionMethodType TransactionMethodType = "unknown" ContractCreationType TransactionMethodType = "contract_creation" TransferMethodType TransactionMethodType = "transfer" UnknownLogEventType LogEventType = "unknown" AnvilSimulator SimulatorType = "anvil" SimulatorAccountType AccountType = "simulator" SimpleAccountType AccountType = "simple" KeystoreAccountType AccountType = "keystore" )
Variables ¶
This section is empty.
Functions ¶
func DumpNodeNoExit ¶
func DumpNodeNoExit(whatever any)
DumpNodeNoExit prints a formatted JSON representation of the provided interface without exiting the program. This function is primarily used for debugging purposes.
func DumpNodeWithExit ¶
func DumpNodeWithExit(whatever any)
DumpNodeWithExit prints a formatted JSON representation of the provided interface and exits the program. This function is primarily used for debugging purposes.
func EventToABI ¶ added in v0.3.2
EventToABI converts a Event object to its JSON ABI representation.
func GetCurrentPath ¶ added in v0.3.2
GetCurrentPath returns the current working directory.
func GetLocalSourcesPath ¶
func GetLocalSourcesPath() string
GetLocalSourcesPath returns the absolute path to the local sources directory.
func IsSemanticVersionGreaterOrEqualTo ¶ added in v0.3.1
func IsSemanticVersionGreaterOrEqualTo(versionStr string, version SemanticVersion) bool
IsSemanticVersionGreaterOrEqualTo checks if the version represented by the string is greater than or equal to the provided SemanticVersion.
func IsSemanticVersionLowerOrEqualTo ¶ added in v0.3.1
func IsSemanticVersionLowerOrEqualTo(versionStr string, version SemanticVersion) bool
IsSemanticVersionLowerOrEqualTo checks if the version represented by the string is lower than or equal to the provided SemanticVersion.
func MethodToABI ¶ added in v0.3.2
MethodToABI converts a Method object to its JSON ABI representation.
func PathExists ¶ added in v0.3.2
PathExists returns true if the given path exists.
func SimplifyImportPaths ¶
SimplifyImportPaths simplifies the paths in import statements as file will already be present in the directory for future consumption and is rather corrupted for import paths to stay the same.
func StripExtraSPDXLines ¶
StripExtraSPDXLines removes the extra SPDX lines from the content. This is used when passing combined source to the solc compiler as it will complain about the extra SPDX lines.
func StripImportPaths ¶
StripImportPaths removes the import paths entirely from the content.
func ToJSONPretty ¶
ToJSONPretty returns a pretty-printed JSON representation of the provided interface. This function is primarily used for debugging purposes.
func ToProtoJSON ¶
ToProtoJSON converts a Go struct to its JSON representation.
func WriteToFile ¶
WriteToFile writes the provided data byte array to a file at the provided path.
Types ¶
type AccountType ¶ added in v0.3.2
type AccountType string
func (AccountType) String ¶ added in v0.3.2
func (t AccountType) String() string
type AddressType ¶ added in v0.3.2
type AddressType string
func (AddressType) String ¶ added in v0.3.2
func (r AddressType) String() string
type ArgumentABI ¶ added in v0.3.2
type ArgumentABI struct {
Name string `json:"name"`
Type string `json:"type"`
Indexed bool `json:"indexed,omitempty"`
}
ArgumentABI represents the JSON structure of a method's argument.
type LogEventType ¶ added in v0.3.2
type LogEventType string
func (LogEventType) String ¶ added in v0.3.2
func (t LogEventType) String() string
type MethodABI ¶ added in v0.3.2
type MethodABI struct {
Name string `json:"name"`
Type string `json:"type"` // "function", "constructor", etc.
Inputs []ArgumentABI `json:"inputs,omitempty"`
Outputs []ArgumentABI `json:"outputs,omitempty"`
StateMutability string `json:"stateMutability,omitempty"`
Constant bool `json:"constant,omitempty"`
Payable bool `json:"payable,omitempty"`
}
MethodABI represents the JSON structure of a method's ABI.
type NormalizationInfo ¶ added in v0.3.1
NormalizationInfo represents the result of a type normalization. It includes the normalized type name and a flag indicating whether the type name was actually normalized.
type NormalizeType ¶ added in v0.3.1
type NormalizeType struct{}
NormalizeType provides methods for normalizing type names.
func NewNormalizeType ¶ added in v0.3.1
func NewNormalizeType() *NormalizeType
NewNormalizeType creates and returns a new NormalizeType instance.
func (*NormalizeType) Normalize ¶ added in v0.3.1
func (n *NormalizeType) Normalize(typeName string) NormalizationInfo
Normalize attempts to normalize the given type name. It returns the NormalizationInfo which contains the normalized type name and a flag indicating if the provided type name was actually normalized.
type SemanticVersion ¶ added in v0.3.1
type SemanticVersion struct {
Major int `json:"major"`
Minor int `json:"minor"`
Patch int `json:"patch"`
}
SemanticVersion represents a version in the format Major.Minor.Patch.
func ParseSemanticVersion ¶ added in v0.3.1
func ParseSemanticVersion(version string) SemanticVersion
ParseSemanticVersion converts a string representation of a version into a SemanticVersion struct. It expects the version string to be in the format "Major.Minor.Patch".
type SimulatorType ¶ added in v0.3.2
type SimulatorType string
func (SimulatorType) String ¶ added in v0.3.2
func (t SimulatorType) String() string
type TransactionMethodType ¶ added in v0.3.2
type TransactionMethodType string
func (TransactionMethodType) String ¶ added in v0.3.2
func (t TransactionMethodType) String() string