util

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 47 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GENESIS_TS   = uint64(1598306430)
	T_GENESIS_TS = uint64(1667326410)
)
View Source
var DIAL_ADDR = ""
View Source
var TOKEN = ""
View Source
var WAD = big.NewInt(1000000000000000000)

Functions

func AddressToEVM

func AddressToEVM(ctx context.Context, addr string, lapi *lotusapi.FullNodeStruct, allowEVMIDs bool) (common.Address, error)

func AddressToNative

func AddressToNative(ctx context.Context, addr string, lapi *lotusapi.FullNodeStruct, allowEVMIDs bool) (address.Address, error)

func CheckIDNotEVMActorType

func CheckIDNotEVMActorType(ctx context.Context, filAddr address.Address, lapi lotusapi.FullNode) error

using f0 ID addresses to interact with EVM or EthAccount actor types is forbidden

func ConvertSectorType

func ConvertSectorType(sector *miner.SectorOnChainInfo) *miner8.SectorOnChainInfo

the SimpleQAPower bool is missing here on the conversion

func DelegatedFromEthAddr

func DelegatedFromEthAddr(addr common.Address) (address.Address, error)

func DeriveAddrFromPk

func DeriveAddrFromPk(pk *ecdsa.PrivateKey) (common.Address, address.Address, error)

func DeriveAddrFromPkString

func DeriveAddrFromPkString(pk string) (common.Address, address.Address, error)

func DeriveAddressFromPk

func DeriveAddressFromPk(pk *ecdsa.PrivateKey) (common.Address, error)

func DeriveNativeFromSECP256K1KeyString

func DeriveNativeFromSECP256K1KeyString(pk string) (address.Address, error)

derives a native filecoin f1 addr from a private key string

func EpochHeightToTimestamp

func EpochHeightToTimestamp(height *big.Int, chainID *big.Int) time.Time

func HumanReadableRevert

func HumanReadableRevert(errMsg error) error

func IsZeroAddress

func IsZeroAddress(address common.Address) bool

IsZeroAddress validate if it's a 0 address

func MethodStrToBytes

func MethodStrToBytes(methodStr constants.Method) ([4]byte, error)

func MsigProposeFEVMTx

func MsigProposeFEVMTx(
	ctx context.Context,
	senderAddr address.Address,
	msigAddr address.Address,
	contractAddr common.Address,
	nonce uint64,
	abi *abi.ABI,
	methodName string,
	args []interface{},
) (*ltypes.Message, error)

func MsigProposeFEVMTxWithValue

func MsigProposeFEVMTxWithValue(
	ctx context.Context,
	senderAddr address.Address,
	msigAddr address.Address,
	contractAddr common.Address,
	nonce uint64,
	abi *abi.ABI,
	methodName string,
	args []interface{},
	value *big.Int,
) (*ltypes.Message, error)

func Multiread

func Multiread(tasks []TaskFunc) ([]interface{}, error)

@dev executes a list of tasks in parallel and returns the results.

func ParseAddress

func ParseAddress(ctx context.Context, addr string, lapi lotusapi.FullNode, allowEVMIDs bool) (common.Address, error)

func SetupSuite

func SetupSuite(t *testing.T) (*api.FullNodeStruct, jsonrpc.ClientCloser)

func SimulateFVMMsg

func SimulateFVMMsg(ctx context.Context, msg *filtypes.Message, lClient *lotusapi.FullNodeStruct) error

func StringifyArg

func StringifyArg(arg interface{}) string

func TeardownSuite

func TeardownSuite(close jsonrpc.ClientCloser)

func ToAtto

func ToAtto(bal *big.Float) *big.Int

func ToByte4Selector

func ToByte4Selector(bytes []byte) [4]byte

func ToFIL

func ToFIL(atto *big.Int) *big.Float

func TruncateAddr

func TruncateAddr(addr string) string

func TxPostProcess

func TxPostProcess(tx *types.Transaction, err error) (*types.Transaction, error)

Types

type TaskFunc

type TaskFunc func() (interface{}, error)

Jump to

Keyboard shortcuts

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