Documentation ¶
Index ¶
- Constants
- Variables
- func FindTronTransaction(block *api.BlockExtention, txId string) (*api.TransactionExtention, error)
- func GetAllPlatform() []model.Platform
- func GetHttpProxyDialOption() (*grpc.DialOption, error)
- func GetInfuraApiUrlFromEnvironmentVariable() (string, error)
- func GetInfuraApiUrlV2(key string) string
- func IsNotFound(err error) bool
- func NewError(code Code, rpcError error) error
- func NewEthereumError(err error) error
- func NewTronClient() (*client.GrpcClient, error)
- func ParseEthereumTransactionFromAddress(t *types.Transaction) string
- func ToTronAddress(addr common.Address) address.Address
- type BlockChainService
- type BlockListener
- type Code
- type DataSendingBlockListener
- type EthereumBlockChainService
- type EthereumClient
- type EthereumContractUsdtTransfer
- type EthereumServiceAssembler
- func (a *EthereumServiceAssembler) BlockToTransactions(block *types.Block) []*model.Transaction
- func (a *EthereumServiceAssembler) ToBlock(block *types.Block) *model.Block
- func (a *EthereumServiceAssembler) ToTransaction(t *types.Transaction) *model.Transaction
- func (a *EthereumServiceAssembler) ToUsdtTransferArguments(data *[]byte) (*EthereumContractUsdtTransfer, error)
- type EthereumTransaction
- type EthereumTransactions
- type GetContractAbiResponse
- type GetContractCommand
- type GetContractResponse
- type Status
- type TronBlockChainAssembler
- func (a *TronBlockChainAssembler) GetTransferArguments(service *TronBlockChainService) (*abi.Arguments, error)
- func (a *TronBlockChainAssembler) GetTransferContract(contract *core.Transaction_Contract) (*core.TransferContract, error)
- func (a *TronBlockChainAssembler) IsTransferContract(contract *core.Transaction_Contract) bool
- func (a *TronBlockChainAssembler) ToBlock(block *api.BlockExtention, service *TronBlockChainService) (*model.Block, error)
- func (a *TronBlockChainAssembler) ToTransaction(args *abi.Arguments, t *api.TransactionExtention, ...) (*model.Transaction, error)
- func (a *TronBlockChainAssembler) ToTransactions(args *abi.Arguments, block *api.BlockExtention) []*model.Transaction
- func (a *TronBlockChainAssembler) TransactionFromContract(arg *abi.Arguments, t *api.TransactionExtention, tc *core.Transaction_Contract) (*model.Transaction, error)
- func (a *TronBlockChainAssembler) TransactionFromTransfer(t *api.TransactionExtention, tc *core.Transaction_Contract) *model.Transaction
- type TronBlockChainService
- type TronHttpClient
Constants ¶
View Source
const ( InfuraApiUrl string = "https://mainnet.infura.io/v3/" EthereumUsdtAddress string = "0xdAC17F958D2ee523a2206206994597C13D831ec7" EthereumEmptyAddress string = "0x0000000000000000000000000000000000000000" EthereumUsdtAbi string = `` /* 342-byte string literal not displayed */ )
Variables ¶
View Source
var EthereumUsdtMethodTransfer []byte = []byte{0xa9, 0x5, 0x9c, 0xbb}
View Source
var TronTriggerSmartyContract string = "type.googleapis.com/protocol.TriggerSmartContract"
View Source
var TronUsdtAddress string = "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
Functions ¶
func FindTronTransaction ¶
func FindTronTransaction(block *api.BlockExtention, txId string) (*api.TransactionExtention, error)
func GetAllPlatform ¶
func GetHttpProxyDialOption ¶
func GetHttpProxyDialOption() (*grpc.DialOption, error)
func GetInfuraApiUrlV2 ¶
func IsNotFound ¶
func NewEthereumError ¶
func NewTronClient ¶
func NewTronClient() (*client.GrpcClient, error)
func ParseEthereumTransactionFromAddress ¶
func ParseEthereumTransactionFromAddress(t *types.Transaction) string
Types ¶
type BlockChainService ¶
type BlockListener ¶
type DataSendingBlockListener ¶
type DataSendingBlockListener struct {
// contains filtered or unexported fields
}
func NewDataSendingBlockListener ¶
func NewDataSendingBlockListener(channel chan interface{}) *DataSendingBlockListener
func (*DataSendingBlockListener) AfterQuerying ¶
func (l *DataSendingBlockListener) AfterQuerying(blok *model.Block, err error)
func (*DataSendingBlockListener) AfterRawQuerying ¶
func (l *DataSendingBlockListener) AfterRawQuerying(block interface{}, err error)
func (*DataSendingBlockListener) BeforeQuerying ¶
func (l *DataSendingBlockListener) BeforeQuerying(height *big.Int)
type EthereumBlockChainService ¶
type EthereumBlockChainService struct {
// contains filtered or unexported fields
}
func NewEthereumBlockChainService ¶
func NewEthereumBlockChainService(url string, listeners []BlockListener) (*EthereumBlockChainService, error)
func (*EthereumBlockChainService) GetLatestBlock ¶
func (s *EthereumBlockChainService) GetLatestBlock() (*model.Block, error)
type EthereumClient ¶
type EthereumClient struct { Client *ethclient.Client Assembler *EthereumServiceAssembler Channel chan interface{} }
func NewEthereumClient ¶
func NewEthereumClient(url string, channel chan interface{}) (*EthereumClient, error)
func (*EthereumClient) GetNowBlock ¶
func (s *EthereumClient) GetNowBlock() (*types.Header, error)
func (*EthereumClient) GetTransactions ¶
func (s *EthereumClient) GetTransactions(number *big.Int) ([]*model.Transaction, error)
type EthereumServiceAssembler ¶
func NewEthereumServiceAssembler ¶
func NewEthereumServiceAssembler() (*EthereumServiceAssembler, error)
func (*EthereumServiceAssembler) BlockToTransactions ¶
func (a *EthereumServiceAssembler) BlockToTransactions(block *types.Block) []*model.Transaction
func (*EthereumServiceAssembler) ToBlock ¶
func (a *EthereumServiceAssembler) ToBlock(block *types.Block) *model.Block
func (*EthereumServiceAssembler) ToTransaction ¶
func (a *EthereumServiceAssembler) ToTransaction(t *types.Transaction) *model.Transaction
func (*EthereumServiceAssembler) ToUsdtTransferArguments ¶
func (a *EthereumServiceAssembler) ToUsdtTransferArguments(data *[]byte) (*EthereumContractUsdtTransfer, error)
type EthereumTransaction ¶
type EthereumTransaction struct { BlockHash string `json:"block_hash"` BlockNumber uint64 `json:"block_number"` Type uint8 `json:"type"` Hash string `json:"hash"` Nonce uint64 `json:"nonce"` ChainID *big.Int `json:"chain_id"` AccessList types.AccessList `json:"access_list"` Data string `json:"data"` Gas uint64 `json:"gas"` GasPrice *big.Int `json:"gas_price"` GasTipCap *big.Int `json:"gas_tip_cap"` GasFeeCap *big.Int `json:"gas_fee_cap"` From string `json:"from"` To string `json:"to"` Value *big.Int `json:"value"` Time time.Time `json:"time"` }
func (*EthereumTransaction) FromTransaction ¶
func (t *EthereumTransaction) FromTransaction(block *types.Block, tx *types.Transaction)
type EthereumTransactions ¶
type EthereumTransactions []*EthereumTransaction
func (*EthereumTransactions) FromTransactions ¶
func (t *EthereumTransactions) FromTransactions(block *types.Block, txs types.Transactions) *EthereumTransactions
FromTransactions converts a list of Ethereum transactions to a list of EthereumTransaction
type GetContractAbiResponse ¶
type GetContractAbiResponse struct {
Entrys []interface{} `json:"entrys"`
}
type GetContractCommand ¶
type GetContractResponse ¶
type GetContractResponse struct { Bytecode string `json:"bytecode"` Abi GetContractAbiResponse `json:"abi"` }
type TronBlockChainAssembler ¶
type TronBlockChainAssembler struct {
// contains filtered or unexported fields
}
func NewTronBlockChainAssembler ¶
func NewTronBlockChainAssembler() *TronBlockChainAssembler
func (*TronBlockChainAssembler) GetTransferArguments ¶
func (a *TronBlockChainAssembler) GetTransferArguments( service *TronBlockChainService, ) (*abi.Arguments, error)
func (*TronBlockChainAssembler) GetTransferContract ¶
func (a *TronBlockChainAssembler) GetTransferContract( contract *core.Transaction_Contract) (*core.TransferContract, error)
func (*TronBlockChainAssembler) IsTransferContract ¶
func (a *TronBlockChainAssembler) IsTransferContract( contract *core.Transaction_Contract) bool
func (*TronBlockChainAssembler) ToBlock ¶
func (a *TronBlockChainAssembler) ToBlock( block *api.BlockExtention, service *TronBlockChainService, ) (*model.Block, error)
func (*TronBlockChainAssembler) ToTransaction ¶
func (a *TronBlockChainAssembler) ToTransaction( args *abi.Arguments, t *api.TransactionExtention, tc *core.Transaction_Contract) (*model.Transaction, error)
func (*TronBlockChainAssembler) ToTransactions ¶
func (a *TronBlockChainAssembler) ToTransactions(args *abi.Arguments, block *api.BlockExtention) []*model.Transaction
func (*TronBlockChainAssembler) TransactionFromContract ¶
func (a *TronBlockChainAssembler) TransactionFromContract( arg *abi.Arguments, t *api.TransactionExtention, tc *core.Transaction_Contract) (*model.Transaction, error)
func (*TronBlockChainAssembler) TransactionFromTransfer ¶
func (a *TronBlockChainAssembler) TransactionFromTransfer( t *api.TransactionExtention, tc *core.Transaction_Contract) *model.Transaction
type TronBlockChainService ¶
type TronBlockChainService struct {
// contains filtered or unexported fields
}
func NewTronBlockChainService ¶
func NewTronBlockChainService(client *client.GrpcClient, listeners []BlockListener) *TronBlockChainService
func (*TronBlockChainService) GetLatestBlock ¶
func (service *TronBlockChainService) GetLatestBlock() (*model.Block, error)
func (*TronBlockChainService) GetSmartContractABI ¶
func (service *TronBlockChainService) GetSmartContractABI(address string) (*core.SmartContract_ABI, error)
type TronHttpClient ¶
type TronHttpClient struct { }
func NewTronHttpClient ¶
func NewTronHttpClient() *TronHttpClient
func (*TronHttpClient) GetContract ¶
func (c *TronHttpClient) GetContract(id string) (*GetContractResponse, error)
Click to show internal directories.
Click to hide internal directories.