Documentation ¶
Overview ¶
Copyright © 2022 uscan team
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Constants
- Variables
- type Account
- type AccountResp
- type BkSim
- type Block
- type BlockNonce
- type BlockResp
- type Bloom
- type CallFrame
- type CompilerVersion
- type Contract
- type ContractStatus
- type ContractType
- type ContractVerity
- type ContractVerityInfo
- type ContractVerityInfoResp
- type ContractVerityTmp
- type Deserializer
- type Erc1155Transfer
- type Erc1155TxResp
- type Erc20Transfer
- type Erc20TxResp
- type Erc721Transfer
- type Erc721TxResp
- type EventTransferData
- type ExecutionResult
- type Holder
- type HolderResp
- type Home
- type HomeBlock
- type HomeTx
- type InternalTx
- type InternalTxKey
- type InternalTxResp
- type Inventory
- type InventoryResp
- type LicenseType
- type ListBlockResp
- type ListTransactionResp
- type Log
- type Pager
- type Rt
- type RtLogResp
- type RtResp
- type SearchFilter
- type Serializer
- type StructLogRes
- type StructLogs
- type TokenNum
- type TokensTransferred
- type TraceTx
- type TraceTx2
- type TraceTx2Resp
- type TraceTxResp
- type TransactionBaseResp
- type Tx
- type TxResp
- type TxSim
- type ValidateContractMetadata
- type ValidateContractReq
- type ValidateContractTmpReq
Constants ¶
const ( Erc20Flag byte = 0x01 Erc721Flag byte = 0x02 Erc1155Flag byte = 0x04 )
const ( SoliditySingleFile = "solidity-single-file" SolidityStandardJsonInput = "solidity-standard-json-input" )
Variables ¶
var (
ErrorInvalidByte = errors.New("invalid byte")
)
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { Owner common.Address `rlp:"-"` Erc20 bool `rlp:"-"` Erc721 bool `rlp:"-"` Erc1155 bool `rlp:"-"` ErcFlag byte BlockNumber field.BigInt Balance field.BigInt Name, Symbol string TokenTotalSupply field.BigInt NftTotalSupply field.BigInt Decimals field.BigInt // erc20 decimals Creator common.Address TxHash common.Hash Retry field.BigInt }
type AccountResp ¶
type AccountResp struct { Owner string `json:"owner"` Balance string `json:"balance"` BlockNumber *string `json:"blockNumber"` Creator *string `json:"creator"` TxHash *string `json:"txHash"` Code *string `json:"code"` Name string `json:"name"` Symbol string `json:"symbol"` TokenTotalSupply *string `json:"tokenTotalSupply"` NftTotalSupply *string `json:"nftTotalSupply"` Decimals uint64 `json:"decimals"` //CreatedTime uint64 `json:"createdTime"` Erc20 bool `json:"erc20"` Erc721 bool `json:"erc721"` Erc1155 bool `json:"erc1155"` }
type Block ¶
type Block struct { Number *field.BigInt `json:"number" rlp:"-"` Hash common.Hash `json:"hash"` ParentHash common.Hash `json:"parentHash"` UncleHash common.Hash `json:"sha3Uncles"` Coinbase common.Address `json:"miner"` Root common.Hash `json:"stateRoot"` TxHash common.Hash `json:"transactionsRoot"` ReceiptHash common.Hash `json:"receiptsRoot"` Bloom Bloom `json:"logsBloom"` Difficulty field.BigInt `json:"difficulty"` GasLimit field.BigInt `json:"gasLimit"` GasUsed field.BigInt `json:"gasUsed"` TimeStamp field.BigInt `json:"timestamp"` Extra []byte `json:"extraData"` MixDigest common.Hash `json:"mixHash"` Nonce BlockNonce `json:"nonce"` BaseFee field.BigInt `json:"baseFeePerGas"` Size field.BigInt `json:"size"` TotalDifficulty field.BigInt `json:"totalDifficulty"` Transactions []common.Hash `json:"transactions" rlp:"-"` TransactionTotal field.BigInt `json:"-"` }
type BlockNonce ¶
type BlockNonce [8]byte
func (BlockNonce) MarshalText ¶
func (n BlockNonce) MarshalText() ([]byte, error)
MarshalText encodes n as a hex string with 0x prefix.
func (*BlockNonce) UnmarshalText ¶
func (n *BlockNonce) UnmarshalText(input []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
type BlockResp ¶
type BlockResp struct { BaseFeePerGas *string `json:"baseFeePerGas"` Difficulty string `json:"difficulty"` ExtraData []byte `json:"extraData"` GasLimit string `json:"gasLimit"` // int64 改成string GasUsed string `json:"gasUsed"` // int64 改成string Hash string `json:"hash"` LogsBloom string `json:"logsBloom"` Miner string `json:"miner"` MixHash string `json:"mixHash"` Nonce string `json:"nonce"` Number string `json:"number"` ParentHash string `json:"parentHash"` ReceiptsRoot string `json:"receiptsRoot"` Sha3Uncles string `json:"sha3Uncles"` Size string `json:"size"` StateRoot string `json:"stateRoot"` Timestamp uint64 `json:"timestamp"` TotalDifficulty uint64 `json:"totalDifficulty"` Transactions []string `json:"transactions"` TransactionsTotal uint64 `json:"transactionsTotal"` TransactionsRoot string `json:"transactionsRoot"` }
type Bloom ¶
type Bloom [types.BloomByteLength]byte
func (Bloom) MarshalText ¶
MarshalText encodes b as a hex string with 0x prefix.
func (*Bloom) UnmarshalText ¶
UnmarshalText b as a hex string with 0x prefix.
type CallFrame ¶
type CallFrame struct { Type string `json:"type"` From common.Address `json:"from"` To common.Address `json:"to,omitempty"` Value field.BigInt `json:"value,omitempty"` Gas field.BigInt `json:"gas"` GasUsed field.BigInt `json:"gasUsed"` Input hexutil.Bytes `json:"input"` Output hexutil.Bytes `json:"output,omitempty"` Error string `json:"error,omitempty"` Calls []*CallFrame `json:"calls,omitempty"` }
func (*CallFrame) JsonToString ¶
type CompilerVersion ¶
type Contract ¶
type ContractStatus ¶
func (*ContractStatus) Marshal ¶
func (b *ContractStatus) Marshal() ([]byte, error)
func (*ContractStatus) Unmarshal ¶
func (b *ContractStatus) Unmarshal(bin []byte) error
type ContractType ¶
type ContractType uint8
const ( UnKnow ContractType = iota EIP20 EIP721 EIP1155 )
type ContractVerity ¶
type ContractVerity struct { ContractName string `json:"contractName"` CompilerVersion string `json:"compilerVersion"` Optimization uint64 `json:"optimization"` Runs uint64 `json:"runs"` EVMVersion string `json:"evmVersion"` LicenseType uint64 `json:"licenseType"` ABI string `json:"abi"` Metadata string `json:"metadata"` CodeHash string `json:"codeHash"` Object string `json:"object"` }
func (*ContractVerity) Marshal ¶
func (b *ContractVerity) Marshal() ([]byte, error)
func (*ContractVerity) Unmarshal ¶
func (b *ContractVerity) Unmarshal(bin []byte) (err error)
type ContractVerityInfo ¶
type ContractVerityInfo struct { ContractName string `json:"contractName"` CompilerVersion string `json:"compilerVersion"` Optimization uint64 `json:"optimization"` Runs uint64 `json:"runs"` EVMVersion string `json:"evmVersion"` LicenseType uint64 `json:"licenseType"` ABI string `json:"abi"` Metadata map[string]string `json:"metadata"` Object string `json:"object"` }
type ContractVerityInfoResp ¶
type ContractVerityInfoResp struct { Contract *ContractVerityInfo `json:"contract"` ProxyContractAddress string `json:"proxyContractAddress"` ProxyContract *ContractVerityInfo `json:"proxyContract"` }
type ContractVerityTmp ¶
type ContractVerityTmp struct { Address string ContractName string CompilerType string CompilerVersion string CompilerFileName string LicenseType uint64 SourceCode string Optimization uint64 Runs uint64 EVMVersion string // 当前默认default Status int // 0:handling 1 success 2 fail }
func (*ContractVerityTmp) Marshal ¶
func (b *ContractVerityTmp) Marshal() ([]byte, error)
func (*ContractVerityTmp) Unmarshal ¶
func (b *ContractVerityTmp) Unmarshal(bin []byte) (err error)
type Deserializer ¶
type Erc1155Transfer ¶
type Erc1155Transfer struct { TransactionHash common.Hash BlockNumber field.BigInt Contract common.Address Method []byte From common.Address To common.Address TokenID field.BigInt Quantity field.BigInt TimeStamp field.BigInt }
func (*Erc1155Transfer) Marshal ¶
func (b *Erc1155Transfer) Marshal() ([]byte, error)
func (*Erc1155Transfer) Unmarshal ¶
func (b *Erc1155Transfer) Unmarshal(bin []byte) error
type Erc1155TxResp ¶
type Erc1155TxResp struct { TransactionHash string `json:"transactionHash"` BlockHash string `json:"blockHash"` BlockNumber string `json:"blockNumber"` Contract string `json:"contract"` ContractName string `json:"contractName"` ContractSymbol string `json:"contractSymbol"` ContractDecimals uint64 `json:"contractDecimals"` Method string `json:"method"` From string `json:"from"` FromName string `json:"fromName"` FromSymbol string `json:"fromSymbol"` FromContract bool `json:"fromContract"` To string `json:"to"` ToName string `json:"toName"` ToSymbol string `json:"toSymbol"` ToContract bool `json:"toContract"` TokenID string `json:"tokenID"` Value string `json:"value"` CreatedTime uint64 `json:"createdTime"` }
type Erc20Transfer ¶
type Erc20Transfer struct { TransactionHash common.Hash BlockNumber field.BigInt Contract common.Address Method []byte From common.Address To common.Address Amount field.BigInt TimeStamp field.BigInt }
func (*Erc20Transfer) Marshal ¶
func (b *Erc20Transfer) Marshal() ([]byte, error)
func (*Erc20Transfer) Unmarshal ¶
func (b *Erc20Transfer) Unmarshal(bin []byte) error
type Erc20TxResp ¶
type Erc20TxResp struct { TransactionHash string `json:"transactionHash"` BlockHash string `json:"blockHash"` BlockNumber string `json:"blockNumber"` Contract string `json:"contract"` ContractName string `json:"contractName"` ContractSymbol string `json:"contractSymbol"` ContractDecimals uint64 `json:"contractDecimals"` Method string `json:"method"` From string `json:"from"` FromName string `json:"fromName"` FromSymbol string `json:"fromSymbol"` FromContract bool `json:"fromContract"` To string `json:"to"` ToName string `json:"toName"` ToSymbol string `json:"toSymbol"` ToContract bool `json:"toContract"` Value string `json:"value"` CreatedTime uint64 `json:"createdTime"` }
type Erc721Transfer ¶
type Erc721Transfer struct { TransactionHash common.Hash BlockNumber field.BigInt Contract common.Address Method []byte From common.Address To common.Address TokenId field.BigInt TimeStamp field.BigInt }
func (*Erc721Transfer) Marshal ¶
func (b *Erc721Transfer) Marshal() ([]byte, error)
func (*Erc721Transfer) Unmarshal ¶
func (b *Erc721Transfer) Unmarshal(bin []byte) error
type Erc721TxResp ¶
type Erc721TxResp struct { TransactionHash string `json:"transactionHash"` BlockHash string `json:"blockHash"` BlockNumber string `json:"blockNumber"` Contract string `json:"contract"` ContractName string `json:"contractName"` ContractSymbol string `json:"contractSymbol"` ContractDecimals uint64 `json:"contractDecimals"` Method string `json:"method"` From string `json:"from"` FromName string `json:"fromName"` FromSymbol string `json:"fromSymbol"` FromContract bool `json:"fromContract"` To string `json:"to"` ToName string `json:"toName"` ToSymbol string `json:"toSymbol"` ToContract bool `json:"toContract"` TokenID string `json:"tokenID"` CreatedTime uint64 `json:"createdTime"` }
type EventTransferData ¶
type EventTransferData struct { ContractType ContractType `json:"contractType"` From string `json:"from"` To string `json:"to"` Contract string `json:"contract"` ContractName string `json:"contractName"` ContractSymbol string `json:"contractSymbol"` ContractDecimals uint64 `json:"contractDecimals"` TokenIDToNums []*TokenNum `json:"tokenIDToNums"` Value string `json:"value"` }
type ExecutionResult ¶
type ExecutionResult struct { Gas uint64 `json:"gas"` Failed bool `json:"failed"` ReturnValue string `json:"returnValue"` StructLogs StructLogs `json:"structLogs"` }
func (*ExecutionResult) JsonToString ¶
func (c *ExecutionResult) JsonToString() string
type Holder ¶
func ByteToHolder ¶
type HolderResp ¶
type Home ¶
type InternalTx ¶
type InternalTx struct { TransactionHash common.Hash `rlp:"-"` BlockNumber field.BigInt Status bool CallType string Depth string From common.Address To common.Address Amount field.BigInt GasLimit field.BigInt TimeStamp field.BigInt }
func (*InternalTx) Marshal ¶
func (b *InternalTx) Marshal() ([]byte, error)
func (*InternalTx) Unmarshal ¶
func (b *InternalTx) Unmarshal(bin []byte) error
type InternalTxKey ¶
func (*InternalTxKey) Marshal ¶
func (b *InternalTxKey) Marshal() ([]byte, error)
func (*InternalTxKey) Unmarshal ¶
func (b *InternalTxKey) Unmarshal(bin []byte) error
type InternalTxResp ¶
type InternalTxResp struct { TransactionHash string `json:"transactionHash"` BlockNumber string `json:"blockNumber"` Status bool `json:"status"` CallType string `json:"callType"` Depth string `json:"depth"` From string `json:"from"` To string `json:"to"` Amount string `json:"amount"` GasLimit string `json:"gasLimit"` CreatedTime uint64 `json:"createdTime"` }
type Inventory ¶
func ByteToInventory ¶
type InventoryResp ¶
type LicenseType ¶
type ListBlockResp ¶
type ListBlockResp struct { Number string `json:"number"` Timestamp uint64 `json:"timestamp"` TransactionsTotal uint64 `json:"transactionsTotal"` Miner string `json:"miner"` GasLimit string `json:"gasLimit"` // int64 改成string GasUsed string `json:"gasUsed"` // int64 改成string BaseFeePerGas *string `json:"baseFeePerGas"` }
type ListTransactionResp ¶
type ListTransactionResp struct { Hash string `json:"hash"` // transaction Hash Method string `json:"method"` BlockHash string `json:"blockHash"` BlockNumber string `json:"blockNumber"` From string `json:"from"` To string `json:"to"` ToName string `json:"toName"` ToSymbol string `json:"toSymbol"` ToContract bool `json:"toContract"` Gas *string `json:"gas"` GasPrice *string `json:"gasPrice"` Value *string `json:"value"` CreatedTime uint64 `json:"createTime"` }
type Log ¶
type Rt ¶
type Rt struct { TxHash common.Hash `json:"transactionHash" rlp:"-"` Type field.BigInt `json:"type,omitempty"` PostState hexutil.Bytes `json:"root"` Status field.BigInt `json:"status"` CumulativeGasUsed field.BigInt `json:"cumulativeGasUsed"` Bloom Bloom `json:"logsBloom"` Logs []*Log `json:"logs"` ContractAddress *common.Address `json:"contractAddress"` GasUsed field.BigInt `json:"gasUsed"` EffectiveGasPrice field.BigInt `json:"effectiveGasPrice"` ExistInternalTx bool ReturnErr string }
type RtResp ¶
type RtResp struct { ContractAddress *string `json:"contractAddress"` ContractAddressName string `json:"contractAddressName"` ContractAddressSymbol string `json:"contractAddressSymbol"` CumulativeGasUsed *string `json:"cumulativeGasUsed"` EffectiveGasPrice *string `json:"effectiveGasPrice"` GasUsed string `json:"gasUsed"` LogsBloom *string `json:"logsBloom"` Root string `json:"root"` Status uint64 `json:"status"` ErrorReturn string `json:"errorReturn"` }
type SearchFilter ¶
type Serializer ¶
type StructLogRes ¶
type StructLogs ¶
type StructLogs []StructLogRes
func (*StructLogs) JsonToString ¶
func (c *StructLogs) JsonToString() string
type TokensTransferred ¶
type TokensTransferred struct { From string `json:"from"` FromHex string `json:"fromHex"` To string `json:"to"` ToHex string `json:"toHex"` Address string `json:"address"` AddressName string `json:"addressName"` AddressSymbol string `json:"addressSymbol"` AddressDecimals uint64 `json:"addressDecimals"` AddressType string `json:"addressType"` AddressValue string `json:"addressValue"` TokenID string `json:"tokenID"` }
type TraceTx2Resp ¶
type TraceTx2Resp struct {
Res string `json:"res"`
}
type TraceTxResp ¶
type TransactionBaseResp ¶
type Tx ¶
type Tx struct { Hash common.Hash `json:"hash" rlp:"-"` BlockNum field.BigInt `json:"blockNumber"` GasTipCap field.BigInt `json:"maxPriorityFeePerGas"` GasFeeCap field.BigInt `json:"maxFeePerGas"` GasPrice field.BigInt `json:"gasPrice"` Nonce field.BigInt `json:"nonce"` Gas field.BigInt `json:"gas"` From common.Address `json:"from"` To *common.Address `json:"to"` // nil means contract creation Value field.BigInt `json:"value"` Method hexutil.Bytes `json:"-"` Data hexutil.Bytes `json:"input"` TimeStamp field.BigInt `json:"-"` // Signature values V field.BigInt `json:"v"` R field.BigInt `json:"r"` S field.BigInt `json:"s"` }
type TxResp ¶
type TxResp struct { Hash string `json:"hash"` Method string `json:"method"` BlockHash string `json:"blockHash"` BlockNumber string `json:"blockNumber"` From string `json:"from"` FromName string `json:"fromName"` FromSymbol string `json:"fromSymbol"` FromContract bool `json:"fromContract"` To string `json:"to"` ToName string `json:"toName"` ToSymbol string `json:"toSymbol"` ToContract bool `json:"toContract"` Gas string `json:"gas"` // change string GasPrice string `json:"gasPrice"` Value string `json:"value"` CreatedTime uint64 `json:"createTime"` MaxFeePerGas *string `json:"maxFeePerGas"` MaxPriorityFeePerGas *string `json:"maxPriorityFeePerGas"` Input string `json:"input"` Nonce string `json:"nonce"` // change string V string `json:"v"` R string `json:"r"` S string `json:"s"` TotalLogs int `json:"totalLogs"` TokensTransferred []*EventTransferData `json:"tokensTransferred"` BaseFeePerGas *string `json:"baseFeePerGas"` GasLimit string `json:"gasLimit"` // change string MethodName string `json:"methodName"` Logs []*RtLogResp `json:"logs"` RtResp // 新增 }
type ValidateContractMetadata ¶
type ValidateContractMetadata struct { CompilerVersions []*CompilerVersion `json:"compilerVersions"` LicenseTypes []*LicenseType `json:"licenseTypes"` CompilerTypes []string `json:"compilerTypes"` }
func (*ValidateContractMetadata) Marshal ¶
func (b *ValidateContractMetadata) Marshal() ([]byte, error)
func (*ValidateContractMetadata) Unmarshal ¶
func (b *ValidateContractMetadata) Unmarshal(bin []byte) (err error)
type ValidateContractReq ¶
type ValidateContractReq struct { ContractAddress string `json:"contractAddress"` ContractName string `json:"contractName"` CompilerType string `json:"compilerType"` // solidity-single-file / solidity-standard-json-input CompilerVersion string `json:"compilerVersion"` CompilerFileName string `json:"compilerFileName"` LicenseType uint64 `json:"licenseType"` // int SourceCode string `json:"sourceCode"` Optimization uint64 `json:"optimization"` // bool Runs uint64 `json:"runs"` // int EVMVersion string `json:"evmVersion"` // 默认:default }
type ValidateContractTmpReq ¶
type ValidateContractTmpReq struct { ContractAddress []string `json:"contractAddress"` ContractName []string `json:"contractName"` CompilerType []string `json:"compilerType"` // solidity-single-file / solidity-standard-json-input CompilerVersion []string `json:"compilerVersion"` CompilerFileName []string `json:"compilerFileName"` LicenseType []string `json:"licenseType"` // int SourceCode []string `json:"sourceCode"` Optimization []string `json:"optimization"` // bool Runs []string `json:"runs"` // int EVMVersion []string `json:"evmVersion"` // 默认:default }
func (*ValidateContractTmpReq) ToValidateContractReq ¶
func (r *ValidateContractTmpReq) ToValidateContractReq() *ValidateContractReq