utils

package
v1.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FungibleAdminName = "fungibleadmin"
	Pellcore0Name     = "pellcore0"
	Pellcore0Mnemonic = "" /* 146-byte string literal not displayed */

	DefaultXmsgTimeout = 4 * time.Minute
)
View Source
const (
	DefaultReceiptTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

func Assert

func Assert(conidtion bool, msg ...any)

func CheckNonce

func CheckNonce(
	ctx context.Context,
	client *ethclient.Client,
	addr ethcommon.Address,
	expectedNonce uint64,
) error

func GenKeypair

func GenKeypair() (string, ethcommon.Address, sdk.AccAddress)

gen new account. private_key, eth_address, pell_address

func IsEthAddress

func IsEthAddress(address string) bool

IsEthAddress checks if a string is a valid Ethereum address, with or without the '0x' prefix.

func IsTerminalStatus

func IsTerminalStatus(status xmsgtypes.XmsgStatus) bool

func MustWaitForTxReceipt

func MustWaitForTxReceipt(
	ctx context.Context,
	client *ethclient.Client,
	tx *ethtypes.Transaction,
	logger infoLogger,
	receiptTimeout time.Duration,
) *ethtypes.Receipt

MustWaitForTxReceipt waits until a broadcasted tx to be mined and return its receipt timeout and panic after 30s.

func ScriptPKToAddress

func ScriptPKToAddress(scriptPKHex string, params *chaincfg.Params) string

ScriptPKToAddress is a hex string for P2WPKH script

func TraceTx

func TraceTx(ctx context.Context, tx *ethtypes.Transaction, rpcURL string) (string, error)

TraceTx traces the tx and returns the trace result

func WaitForBlockHeight

func WaitForBlockHeight(
	ctx context.Context,
	height int64,
	rpcURL string,
	logger infoLogger,
)

WaitForBlockHeight waits until the block height reaches the given height

func WaitXmsgMinedByInTxHash

func WaitXmsgMinedByInTxHash(
	ctx context.Context,
	inTxHash string,
	xmsgClient xmsgtypes.QueryClient,
	logger infoLogger,
	xmsgTimeout time.Duration,
) *xmsgtypes.Xmsg

WaitXmsgMinedByInTxHash waits until xmsg is mined; returns the xmsgIndex (the last one)

func WaitXmsgMinedByIndex

func WaitXmsgMinedByIndex(
	ctx context.Context,
	xmsgIndex string,
	xmsgClient xmsgtypes.QueryClient,
	logger infoLogger,
	xmsgTimeout time.Duration,
) *xmsgtypes.Xmsg

WaitXmsgMinedByIndex waits until xmsg is mined; returns the xmsgIndex

func WaitXmsgsMinedByInTxHash

func WaitXmsgsMinedByInTxHash(
	ctx context.Context,
	inTxHash string,
	xmsgClient xmsgtypes.QueryClient,
	xmsgsCount int,
	logger infoLogger,
	xmsgTimeout time.Duration,
) []*xmsgtypes.Xmsg

WaitXmsgsMinedByInTxHash waits until xmsg is mined; returns the xmsgIndex (the last one)

Types

type NoopLogger

type NoopLogger struct{}

func (NoopLogger) Info

func (nl NoopLogger) Info(_ string, _ ...interface{})

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL