Documentation ¶
Index ¶
- Constants
- Variables
- func ReplaceIncompatiableEvmResponses(body []byte) []byte
- type Client
- func (client *Client) DefaultGasLimit() uint64
- func (client *Client) FetchBalance(ctx context.Context, addr xc.Address) (xc.AmountBlockchain, error)
- func (client *Client) FetchDecimals(ctx context.Context, contract xc.ContractAddress) (int, error)
- func (client *Client) FetchLegacyTxInfo(ctx context.Context, txHashStr xc.TxHash) (xc.LegacyTxInfo, error)
- func (client *Client) FetchLegacyTxInput(ctx context.Context, from xc.Address, to xc.Address) (xc.TxInput, error)
- func (client *Client) FetchNativeBalance(ctx context.Context, addr xc.Address) (xc.AmountBlockchain, error)
- func (cli *Client) FetchStakeBalance(ctx context.Context, args xcclient.StakedBalanceArgs) ([]*xcclient.StakedBalance, error)
- func (cli *Client) FetchStakingInput(ctx context.Context, args xcbuilder.StakeArgs) (xc.StakeTxInput, error)
- func (client *Client) FetchTransferInput(ctx context.Context, args xcbuilder.TransferArgs) (xc.TxInput, error)
- func (client *Client) FetchTxInfo(ctx context.Context, txHashStr xc.TxHash) (xclient.TxInfo, error)
- func (client *Client) FetchUnsimulatedInput(ctx context.Context, from xc.Address) (*tx_input.TxInput, error)
- func (cli *Client) FetchUnstakingInput(ctx context.Context, args xcbuilder.StakeArgs) (xc.UnstakeTxInput, error)
- func (client *Client) FetchValidator(ctx context.Context, validator string) (*GetValidatorResponse, error)
- func (client *Client) FetchValidatorBalance(ctx context.Context, validator string) (*xcclient.StakedBalance, error)
- func (cli *Client) FetchWithdrawInput(ctx context.Context, args xcbuilder.StakeArgs) (xc.WithdrawTxInput, error)
- func (cli *Client) Get(path string, response any) error
- func (cli *Client) GetAndPrint(path string) error
- func (client *Client) GetNonce(ctx context.Context, from xc.Address) (uint64, error)
- func (cli *Client) Post(path string, requestBody any, response any) error
- func (cli *Client) Send(method string, path string, requestBody any, response any) error
- func (client *Client) SimulateGasWithLimit(ctx context.Context, from xc.Address, trans *tx.Tx) (uint64, error)
- func (client *Client) SubmitTx(ctx context.Context, trans xc.Tx) error
- func (client *Client) TraceEthMovements(ctx context.Context, txHash common.Hash) (tx.SourcesAndDests, error)
- func (client *Client) TraceTransaction(ctx context.Context, txHash common.Hash) (*TraceTransactionResult, error)
- func (client *Client) TxPoolContentFrom(ctx context.Context, from common.Address) (*TxPoolResult, error)
- type Error
- type GetValidatorResponse
- type TraceTransactionArgs
- type TraceTransactionResult
- type TraceTransactionType
- type TxPoolPendingMap
- type TxPoolResult
- type TxPoolTxInfo
- type Validator
- type ValidatorDetails
- type ValidatorStatus
Constants ¶
const DEFAULT_GAS_PRICE = 20_000_000_000
const DEFAULT_GAS_TIP = 3_000_000_000
Variables ¶
var ERC20 abi.ABI
Functions ¶
Types ¶
type Client ¶
type Client struct { Asset xc.ITask EthClient *ethclient.Client ChainId *big.Int Interceptor *utils.HttpInterceptor }
Client for EVM
func (*Client) DefaultGasLimit ¶
func (*Client) FetchBalance ¶
func (client *Client) FetchBalance(ctx context.Context, addr xc.Address) (xc.AmountBlockchain, error)
Fetch the balance of the asset that this client is configured for
func (*Client) FetchDecimals ¶
func (*Client) FetchLegacyTxInfo ¶
func (client *Client) FetchLegacyTxInfo(ctx context.Context, txHashStr xc.TxHash) (xc.LegacyTxInfo, error)
FetchLegacyTxInfo returns tx info for a EVM tx
func (*Client) FetchLegacyTxInput ¶
func (*Client) FetchNativeBalance ¶
func (client *Client) FetchNativeBalance(ctx context.Context, addr xc.Address) (xc.AmountBlockchain, error)
Fetch the balance of the native asset that this client is configured for
func (*Client) FetchStakeBalance ¶
func (cli *Client) FetchStakeBalance(ctx context.Context, args xcclient.StakedBalanceArgs) ([]*xcclient.StakedBalance, error)
func (*Client) FetchStakingInput ¶
func (*Client) FetchTransferInput ¶
func (*Client) FetchTxInfo ¶
func (*Client) FetchUnsimulatedInput ¶
func (client *Client) FetchUnsimulatedInput(ctx context.Context, from xc.Address) (*tx_input.TxInput, error)
FetchLegacyTxInput returns tx input for a EVM tx
func (*Client) FetchUnstakingInput ¶
func (*Client) FetchValidator ¶
func (client *Client) FetchValidator(ctx context.Context, validator string) (*GetValidatorResponse, error)
Fetch validator using beacon API
func (*Client) FetchValidatorBalance ¶
func (*Client) FetchWithdrawInput ¶
func (*Client) GetAndPrint ¶
func (*Client) SimulateGasWithLimit ¶
func (client *Client) SimulateGasWithLimit(ctx context.Context, from xc.Address, trans *tx.Tx) (uint64, error)
Simulate a transaction to get the estimated gas limit
func (*Client) TraceEthMovements ¶
func (*Client) TraceTransaction ¶
func (client *Client) TraceTransaction(ctx context.Context, txHash common.Hash) (*TraceTransactionResult, error)
Implements debug_traceTransaction, which is supported on GETH and most RPC providers, but likely not implemented on public nodes. This will reveal ETH transfers in internal transactions and removes the need for us to manually parse "multi transfers".
func (*Client) TxPoolContentFrom ¶
func (client *Client) TxPoolContentFrom(ctx context.Context, from common.Address) (*TxPoolResult, error)
Get current pending transaction queue for a given address
type GetValidatorResponse ¶
type TraceTransactionArgs ¶
type TraceTransactionArgs struct {
Tracer string `json:"tracer"`
}
type TraceTransactionResult ¶
type TraceTransactionResult struct { Gas hexutil.Uint `json:"gas"` GasUsed hexutil.Uint `json:"gasUsed"` To common.Address `json:"to"` From common.Address `json:"from"` Input hexutil.Bytes `json:"input"` Value hexutil.Big `json:"value"` Type TraceTransactionType `json:"type"` Calls []*TraceTransactionResult `json:"calls"` }
func FlattenTraceResult ¶
func FlattenTraceResult(result *TraceTransactionResult, traces []*TraceTransactionResult) []*TraceTransactionResult
Recurse through all of the traces and provide them as a linear set of traces.
type TraceTransactionType ¶
type TraceTransactionType string
var CALL TraceTransactionType = "CALL"
var DELEGATE_CALL TraceTransactionType = "DELEGATECALL"
type TxPoolPendingMap ¶
type TxPoolPendingMap struct { }
type TxPoolResult ¶
type TxPoolResult struct { // map of nonce to txinfo Pending map[string]*TxPoolTxInfo `json:"pending"` }
func (*TxPoolResult) InfoFor ¶
func (result *TxPoolResult) InfoFor(address string) (*TxPoolTxInfo, bool)
return first pending tx for a given address (should only be 1 entry..)
func (*TxPoolResult) PendingCount ¶
func (result *TxPoolResult) PendingCount() int
type TxPoolTxInfo ¶
type Validator ¶
type Validator struct { Index string `json:"index"` Balance string `json:"balance"` Status ValidatorStatus `json:"status"` Validator ValidatorDetails `json:"validator"` }
type ValidatorDetails ¶
type ValidatorDetails struct { Pubkey string `json:"pubkey"` WithdrawalCredentials string `json:"withdrawal_credentials"` EffectiveBalance string `json:"effective_balance"` Slashed bool `json:"slashed"` ActivationEligibilityEpoch string `json:"activation_eligibility_epoch"` ActivationEpoch string `json:"activation_epoch"` ExitEpoch string `json:"exit_epoch"` WithdrawableEpoch string `json:"withdrawable_epoch"` }
type ValidatorStatus ¶
type ValidatorStatus string
func (ValidatorStatus) ToState ¶
func (s ValidatorStatus) ToState() (xcclient.StakeState, bool)