Documentation
¶
Index ¶
- Constants
- func CopyMap(src map[string]string) map[string]string
- func FreeRateLimiter() func(client *resty.Client, req *resty.Request) error
- func IsNoDataFound(msg string) bool
- func StructToMap(obj any) map[string]string
- func ToStringE(i any) (string, error)
- type BaseResp
- type CheckVerifyStatusReq
- type Client
- type ContractCreatorTxInfo
- type ContractCreatorTxInfoResp
- type ContractSourceCode
- type ContractSourcecodeResp
- type GasOracle
- type GasOracleResp
- type GetContractABIReq
- type GetContractCreatorTxInfoReq
- type GetContractSourceCodeReq
- type GetERC20TokenTransferEventsReq
- type GetEventLogsByAddressFilterByTopicsReq
- type GetEventLogsByAddressReq
- type GetEventLogsByTopicsReq
- type GetNormalTransactionsByAddressReq
- type Log
- type LogResp
- type Options
- type StringResp
- type TokenTransfer
- type TokenTransferList
- type Transaction
- type TransactionListResp
- type VerifySourceCodeReq
- type VerifySourceCodeResp
Constants ¶
View Source
const ( NoRecordsFound = "No records found" NoDataFound = "No data found" NoTransactionsFound = "No transactions found" ContractCodeAlreadyVerified = "Contract source code already verified" )
Variables ¶
This section is empty.
Functions ¶
func IsNoDataFound ¶ added in v1.0.5
func StructToMap ¶
Types ¶
type BaseResp ¶
type BaseResp struct {
Status int `json:"status,string"` // 1 for good, 0 for error
Message string `json:"message"` // OK for good, other words when Status equals 0
Result json.RawMessage `json:"result"`
}
type CheckVerifyStatusReq ¶ added in v1.0.1
type Client ¶
type Client interface {
GetNormalTransactionsByAddress(ctx context.Context, req GetNormalTransactionsByAddressReq) (*TransactionListResp, error)
GetERC20TokenTransferByAddress(ctx context.Context, req GetERC20TokenTransferEventsReq) (*TokenTransferList, error)
GetContractABI(ctx context.Context, req GetContractABIReq) (*StringResp, error)
GetContractSourceCode(ctx context.Context, req GetContractSourceCodeReq) (*ContractSourcecodeResp, error)
GetContractCreatorTxInfo(ctx context.Context, req GetContractCreatorTxInfoReq) (*ContractCreatorTxInfoResp, error)
VerifySourceCode(ctx context.Context, req VerifySourceCodeReq) (resp *VerifySourceCodeResp, err error)
CheckVerifyStatus(ctx context.Context, req CheckVerifyStatusReq) (resp *StringResp, err error)
GetGasOracle(ctx context.Context, chainID uint64) (*GasOracleResp, error)
GetEventLogsByAddress(ctx context.Context, req GetEventLogsByAddressReq) (*LogResp, error)
GetEventLogsByTopics(ctx context.Context, req GetEventLogsByTopicsReq) (*LogResp, error)
GetEventLogsByAddressFilterByTopics(ctx context.Context, req GetEventLogsByAddressFilterByTopicsReq) (*LogResp, error)
Debug() Client
}
Client is the interface for interacting with Etherscan API
type ContractCreatorTxInfo ¶
type ContractCreatorTxInfo struct {
ContractAddress string `json:"contractAddress"`
ContractCreator string `json:"contractCreator"`
TxHash string `json:"txHash"`
BlockNumber string `json:"blockNumber"`
Timestamp string `json:"timeStamp"`
ContractFactory string `json:"contractFactory"`
CreationBytecode string `json:"creationBytecode"`
}
type ContractCreatorTxInfoResp ¶
type ContractCreatorTxInfoResp BaseResp
func (*ContractCreatorTxInfoResp) GetData ¶
func (r *ContractCreatorTxInfoResp) GetData() ([]ContractCreatorTxInfo, error)
type ContractSourceCode ¶
type ContractSourceCode struct {
SourceCode string `json:"SourceCode"`
ABI string `json:"ABI"`
ContractName string `json:"ContractName"`
CompilerVersion string `json:"CompilerVersion"`
CompilerType string `json:"CompilerType"`
OptimizationUsed string `json:"OptimizationUsed"`
Runs string `json:"Runs"`
ConstructorArguments string `json:"ConstructorArguments"`
EVMVersion string `json:"EVMVersion"`
Library string `json:"Library"`
ContractFileName string `json:"ContractFileName"`
LicenseType string `json:"LicenseType"`
Proxy string `json:"Proxy"`
Implementation string `json:"Implementation"`
SwarmSource string `json:"SwarmSource"`
SimilarMatch string `json:"SimilarMatch"`
}
type ContractSourcecodeResp ¶
type ContractSourcecodeResp BaseResp
func (*ContractSourcecodeResp) GetData ¶
func (r *ContractSourcecodeResp) GetData() ([]ContractSourceCode, error)
type GasOracleResp ¶ added in v1.0.8
type GasOracleResp BaseResp
func (*GasOracleResp) GetData ¶ added in v1.0.8
func (r *GasOracleResp) GetData() (*GasOracle, error)
type GetContractABIReq ¶
type GetERC20TokenTransferEventsReq ¶ added in v1.0.7
type GetERC20TokenTransferEventsReq struct {
ChainID uint64 `json:"chainid"`
ContractAddress string `json:"contractAddress"`
Page uint64 `json:"page,omitempty"`
Offset uint64 `json:"offset,omitempty"`
Address string `json:"address,omitempty"`
StartBlock uint64 `json:"startblock,omitempty"`
EndBlock uint64 `json:"endblock,omitempty"`
Sort string `json:"sort,omitempty"` // asc or desc
}
type GetEventLogsByAddressFilterByTopicsReq ¶
type GetEventLogsByAddressFilterByTopicsReq struct {
ChainID uint64 `json:"chainid"`
Address string `json:"address"` // the string representing the address to check for logs
FromBlock uint64 `json:"fromBlock"` // the integer block number to start searching for logs eg. 12878196
ToBlock uint64 `json:"toBlock"` // the integer block number to stop searching for logs eg. 12879196
Topics map[string]string `json:"topics"` // topic & topicOperator
Page *int `json:"page"` // the integer page number, if pagination is enabled
Offset *int `json:"offset"` // the number of transactions displayed per page, limited to 1000 records per query, use the page parameter for subsequent records
}
type GetEventLogsByAddressReq ¶
type GetEventLogsByAddressReq struct {
ChainID uint64 `json:"chainid"`
Address string `json:"address"` // the string representing the address to check for logs
FromBlock uint64 `json:"fromBlock"` // the integer block number to start searching for logs eg. 12878196
ToBlock uint64 `json:"toBlock"` // the integer block number to stop searching for logs eg. 12879196
Page *int `json:"page"` // the integer page number, if pagination is enabled
Offset *int `json:"offset"` // the number of transactions displayed per page, limited to 1000 records per query, use the page parameter for subsequent records
}
type GetEventLogsByTopicsReq ¶
type GetEventLogsByTopicsReq struct {
ChainID uint64 `json:"chainid"`
FromBlock uint64 `json:"fromBlock"` // the integer block number to start searching for logs eg. 12878196
ToBlock uint64 `json:"toBlock"` // the integer block number to stop searching for logs eg. 12879196
Topics map[string]string `json:"topics"` // topic & topicOperator
Page *int `json:"page"` // the integer page number, if pagination is enabled
Offset *int `json:"offset"` // the number of transactions displayed per page, limited to 1000 records per query, use the page parameter for subsequent records
}
type GetNormalTransactionsByAddressReq ¶ added in v1.0.7
type GetNormalTransactionsByAddressReq struct {
ChainID uint64 `json:"chainid"`
Address string `json:"address"`
Page uint64 `json:"page"`
Offset uint64 `json:"offset"`
StartBlock uint64 `json:"startblock,omitempty"`
EndBlock uint64 `json:"endblock,omitempty"`
Sort string `json:"sort,omitempty"` // asc or desc
}
type Log ¶
type Log struct {
Address string `json:"address"`
Topics []string `json:"topics"`
Data string `json:"data"`
BlockNumber string `json:"blockNumber"`
BlockHash string `json:"blockHash"`
TimeStamp string `json:"timeStamp"`
GasPrice string `json:"gasPrice"`
GasUsed string `json:"gasUsed"`
LogIndex string `json:"logIndex"`
TransactionHash string `json:"transactionHash"`
TransactionIndex string `json:"transactionIndex"`
}
type StringResp ¶ added in v1.0.1
type StringResp struct {
Status int `json:"status,string"`
Message string `json:"message"`
Result string `json:"result"`
}
func (*StringResp) Parse ¶ added in v1.0.6
func (r *StringResp) Parse() (string, error)
type TokenTransfer ¶ added in v1.0.7
type TokenTransfer struct {
BlockNumber string `json:"blockNumber"`
TimeStamp string `json:"timeStamp"`
Hash string `json:"hash"`
Nonce string `json:"nonce"`
BlockHash string `json:"blockHash"`
From string `json:"from"`
ContractAddress string `json:"contractAddress"`
To string `json:"to"`
Value string `json:"value"`
TokenName string `json:"tokenName"`
TokenSymbol string `json:"tokenSymbol"`
TokenDecimal string `json:"tokenDecimal"`
TransactionIndex string `json:"transactionIndex"`
Gas string `json:"gas"`
GasPrice string `json:"gasPrice"`
GasUsed string `json:"gasUsed"`
CumulativeGasUsed string `json:"cumulativeGasUsed"`
Input string `json:"input"`
MethodID string `json:"methodId"`
FunctionName string `json:"functionName"`
Confirmations string `json:"confirmations"`
}
type TokenTransferList ¶ added in v1.0.7
type TokenTransferList BaseResp
func (*TokenTransferList) GetData ¶ added in v1.0.7
func (r *TokenTransferList) GetData() ([]TokenTransfer, error)
type Transaction ¶ added in v1.0.6
type Transaction struct {
BlockNumber string `json:"blockNumber"`
TimeStamp string `json:"timeStamp"`
Hash string `json:"hash"`
Nonce string `json:"nonce"`
BlockHash string `json:"blockHash"`
TransactionIndex string `json:"transactionIndex"`
From string `json:"from"`
To string `json:"to"`
Value string `json:"value"`
Gas string `json:"gas"`
GasPrice string `json:"gasPrice"`
IsError string `json:"isError"`
TxreceiptStatus string `json:"txreceipt_status"`
Input string `json:"input"`
ContractAddress string `json:"contractAddress"`
CumulativeGasUsed string `json:"cumulativeGasUsed"`
GasUsed string `json:"gasUsed"`
Confirmations string `json:"confirmations"`
MethodID string `json:"methodId"`
FunctionName string `json:"functionName"`
}
type TransactionListResp ¶ added in v1.0.6
type TransactionListResp BaseResp
func (*TransactionListResp) GetData ¶ added in v1.0.6
func (r *TransactionListResp) GetData() ([]Transaction, error)
type VerifySourceCodeReq ¶ added in v1.0.1
type VerifySourceCodeReq struct {
ChainID uint64 `json:"chainid"`
CodeFormat string `json:"codeformat"` // single file, use solidity-single-file JSON file ( recommended ), use solidity-standard-json-input
SourceCode string `json:"sourceCode"` // the Solidity source code
ContractAddress string `json:"contractaddress"` // the address your contract is deployed at
ContractName string `json:"contractname"` // the name of your contract, such as contracts/Verified.sol:Verified
CompilerVersion string `json:"compilerversion"` // compiler version used, such as v0.8.24+commit.e11b9ed9
ConstructorArguments *string `json:"constructorArguements"` // optional, include if your contract uses constructor arguments
CompilerMode *string `json:"compilermode"` // for ZK Stack, set to solc/zksync
ZkSolcVersion *string `json:"zksolcVersion"` // for ZK Stack, zkSolc version used, such as v1.3.14
}
type VerifySourceCodeResp ¶ added in v1.0.1
type VerifySourceCodeResp StringResp
func (*VerifySourceCodeResp) GetData ¶ added in v1.0.2
func (r *VerifySourceCodeResp) GetData() (string, error)
Click to show internal directories.
Click to hide internal directories.