Documentation
¶
Index ¶
- Constants
- Variables
- func CalcGasCost(gasLimit uint64, gasPrice *big.Int) *big.Int
- func CalculateInterfaceId(contractABI string) []byte
- func Call(ctx context.Context, c *rpc.Client, contract string, method abi.Method) (any, error)
- func CallWithInput(ctx context.Context, c *rpc.Client, contract, methodName string, abiO *abi.ABI, ...) ([]any, error)
- func CodeAt(ctx context.Context, c *rpc.Client, contract string) (string, error)
- func CreateTransaction(ctx context.Context, client *ethclient.Client, sender, to string, ...) (*types.Transaction, error)
- func DecodeABI(abiStr string) (*abi.ABI, error)
- func GetBalance(ctx context.Context, c *rpc.Client, address string) (string, error)
- func GetBalanceWithDecimals(ctx context.Context, c *rpc.Client, address string) (decimal.Decimal, error)
- func Hex2Bytes(str string) []byte
- func IsERC721()
- func IsValidAddress(addr any) bool
- func IsZeroAddress(addr any) bool
- func ParseStorageLayout(ctx context.Context, c *rpc.Client, contract, storage string) (any, error)
- func ParseVyPerStorage(ctx context.Context, c *rpc.Client, contract, abiStr string, ...) ([]types.ContractVariable, error)
- func ParseVyPerStorageLayout(ctx context.Context, c *rpc.Client, contract, storage, abiStr string) (any, error)
- func PublicKeyBytesToAddress(publicKey []byte) common.Address
- func RemoveZeroHex(s string) []byte
- func SignTransaction(tx *types.Transaction, privateKeyHex string, chainID *big.Int) (*types.Transaction, error)
- func StorageAt(ctx context.Context, c *rpc.Client, contract string, slot common.Hash) ([]byte, error)
- func SubscribeContractEvents(ctx context.Context, client *ethclient.Client, contractAddress common.Address, ...) error
- func ToDecimal(val any, decimals int) decimal.Decimal
- func ToWei(value any, decimals int) *big.Int
- func Withdraw(ctx context.Context, c *rpc.Client, from, to, privateKeyHex string) error
Constants ¶
View Source
const (
NativeTokenDecimals = 18
)
Variables ¶
View Source
var (
BscForkClient, _ = rpc.DialContext(context.Background(), "https://rpc.phalcon.blocksec.com/rpc_25d3496386cd49d79e0055b9708af0a6")
ETHClient, _ = rpc.DialContext(context.Background(), "https://eth-mainnet.g.alchemy.com/v2/qUt8liQq0Kh5rGm9VGGfLfSNLFuONhm3")
BscClient, _ = rpc.DialContext(context.Background(), "https://binance.llamarpc.com")
ArbitrumClient, _ = rpc.DialContext(context.Background(), "https://arb-mainnet.g.alchemy.com/v2/vJawUvyo1NE02qYepEe2n_AtjrX_gF5q")
BaseClient, _ = rpc.DialContext(context.Background(), "https://base-mainnet.g.alchemy.com/v2/7XuVI7nNb8mJFfDc_HlEOiFPVNz4lKAz")
MerlinClient, _ = rpc.DialContext(context.Background(), "https://rpc.merlinchain.io/api")
Sender = common.HexToAddress("0xba46dd807DD7A5bBe2eE80b6D0516A088223C574")
EthForkClient, _ = rpc.DialContext(context.Background(), "https://rpc-dev.phalcon.blocksec.com/rpc_672bb0b921e64497a127b102e9d35db6")
MantaClient, _ = rpc.DialContext(context.Background(), "https://pacific-rpc.manta.network/http")
)
View Source
var (
ErrNoData = errors.New("no data")
)
Functions ¶
func CalcGasCost ¶
CalcGasCost calculate gas cost given gas limit (units) and gas price (wei)
func CalculateInterfaceId ¶
func CallWithInput ¶
func CreateTransaction ¶
func GetBalance ¶
func GetBalanceWithDecimals ¶
func ParseStorageLayout ¶
func ParseVyPerStorage ¶
func ParseVyPerStorageLayout ¶
func PublicKeyBytesToAddress ¶
PublicKeyBytesToAddress zero address return if key is invalid
func SignTransaction ¶
func SignTransaction(tx *types.Transaction, privateKeyHex string, chainID *big.Int) (*types.Transaction, error)
func SubscribeContractEvents ¶
Types ¶
This section is empty.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.