types

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0, MIT Imports: 30 Imported by: 4

Documentation

Index

Constants

View Source
const (
	EthAddressLength = 20
	EthHashLength    = 32
)
View Source
const Eip1559TxType = 2
View Source
const EthBloomSize = 2048
View Source
const MessageVersion = 0

Variables

View Source
var (
	AttoFil  = NewInt(1)
	FemtoFil = BigMul(AttoFil, NewInt(1000))
	PicoFil  = BigMul(FemtoFil, NewInt(1000))
	NanoFil  = BigMul(PicoFil, NewInt(1000))
)
View Source
var (
	EmptyEthBloom  = [EthBloomSize / 8]byte{}
	FullEthBloom   = [EthBloomSize / 8]byte{}
	EmptyEthHash   = EthHash{}
	EmptyUncleHash = One(ParseEthHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347")) // Keccak-256 of an RLP of an empty array
	EmptyRootHash  = One(ParseEthHash("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")) // Keccak-256 hash of the RLP of null
	EmptyEthInt    = EthUint64(0)
	EmptyEthNonce  = [8]byte{0, 0, 0, 0, 0, 0, 0, 0}
)
View Source
var Eip155ChainID = 314

mainnet

View Source
var EmptyInt = BigInt{}
View Source
var ErrActorNotFound = errors.New("actor not found")
View Source
var ErrInvalidAddress = errors.New("invalid Filecoin Eth address")
View Source
var (
	EthBigIntZero = EthBigInt{Int: big.Zero().Int}
)
View Source
var TotalFilecoinInt = FromFil(params.FilBase)
View Source
var ZeroAddress address.Address = One(address.NewFromString("f3yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaby2smx7a"))
View Source
var ZeroFIL = fbig.NewInt(0)

Functions

func BigCmp

func BigCmp(a, b BigInt) int

func BigDivFloat

func BigDivFloat(num, den BigInt) float64

func DecodeHexString

func DecodeHexString(s string) ([]byte, error)

func DecodeHexStringTrimSpace

func DecodeHexStringTrimSpace(s string) ([]byte, error)

func DecodeRLP

func DecodeRLP(data []byte) (interface{}, error)

func EncodeRLP

func EncodeRLP(val interface{}) ([]byte, error)

func EthAddressFromPubKey

func EthAddressFromPubKey(pubk []byte) ([]byte, error)

EthAddressFromPubKey returns the Ethereum address corresponding to an uncompressed secp256k1 public key.

func EthBloomSet

func EthBloomSet(f EthBytes, data []byte)

func IsEthAddress

func IsEthAddress(addr address.Address) bool

func One

func One[R any](r R, err error) R

func SetEip155ChainID

func SetEip155ChainID(val int)

Types

type Actor

type Actor = ActorV5

func (*Actor) Empty

func (t *Actor) Empty() bool

Empty tests whether the actor's code is defined.

func (*Actor) IncrementSeqNum

func (t *Actor) IncrementSeqNum()

IncrementSeqNum increments the seq number.

type ActorV4

type ActorV4 struct {
	// Code is a CID of the VM code for this actor's implementation (or a constant for actors implemented in Go code).
	// Code may be nil for an uninitialized actor (which exists because it has received a balance).
	Code cid.Cid
	// Head is the CID of the root of the actor's state tree.
	Head cid.Cid
	// Nonce is the number expected on the next message from this actor.
	// Messages are processed in strict, contiguous order.
	Nonce uint64
	// Balance is the amount of attoFIL in the actor's account.
	Balance abi.TokenAmount
}

Actor is the central abstraction of entities in the system.

Both individual accounts, as well as contracts (user & system level) are represented as actors. An actor has the following core functionality implemented on a system level: - track a Filecoin balance, using the `Balance` field - execute code stored in the `Code` field - read & write memory - replay protection, using the `Nonce` field

Value sent to a non-existent address will be tracked as an empty actor that has a Balance but nil Code and Memory. You must nil check Code cids before comparing them.

More specific capabilities for individual accounts or contract specific must be implemented inside the code.

Not safe for concurrent access.

func AsActorV4

func AsActorV4(a *ActorV5) *ActorV4

func (*ActorV4) MarshalCBOR

func (t *ActorV4) MarshalCBOR(w io.Writer) error

func (*ActorV4) UnmarshalCBOR

func (t *ActorV4) UnmarshalCBOR(r io.Reader) (err error)

type ActorV5

type ActorV5 struct {
	// Identifies the type of actor (string coded as a CID), see `chain/actors/actors.go`.
	Code    cid.Cid
	Head    cid.Cid
	Nonce   uint64
	Balance BigInt
	// Deterministic Address
	Address *address.Address
}

Actor State for state tree version 5

func AsActorV5

func AsActorV5(a *ActorV4) *ActorV5

func (*ActorV5) MarshalCBOR

func (t *ActorV5) MarshalCBOR(w io.Writer) error

func (*ActorV5) UnmarshalCBOR

func (t *ActorV5) UnmarshalCBOR(r io.Reader) (err error)

type BigInt

type BigInt = big2.Int

func BigAdd

func BigAdd(a, b BigInt) BigInt

func BigDiv

func BigDiv(a, b BigInt) BigInt

func BigFromBytes

func BigFromBytes(b []byte) BigInt

func BigFromString

func BigFromString(s string) (BigInt, error)

func BigMod

func BigMod(a, b BigInt) BigInt

func BigMul

func BigMul(a, b BigInt) BigInt

func BigSub

func BigSub(a, b BigInt) BigInt

func FromFil

func FromFil(i uint64) BigInt

func NewInt

func NewInt(i uint64) BigInt

type ChainMsg

type ChainMsg interface {
	Cid() cid.Cid
	VMMessage() *Message
	ToStorageBlock() (blocks.Block, error)
	// FIXME: This is the *message* length, this name is misleading.
	ChainLength() int
	cbor.Marshaler
	cbor.Unmarshaler
}

type EthAddress

type EthAddress [EthAddressLength]byte

func CastEthAddress

func CastEthAddress(b []byte) (EthAddress, error)

CastEthAddress interprets bytes as an EthAddress, performing some basic checks.

func EthAddressFromActorID added in v1.15.0

func EthAddressFromActorID(id abi.ActorID) EthAddress

func EthAddressFromFilecoinAddress

func EthAddressFromFilecoinAddress(addr address.Address) (EthAddress, error)

func GetContractEthAddressFromCode

func GetContractEthAddressFromCode(sender EthAddress, salt [32]byte, initcode []byte) (EthAddress, error)

func ParseEthAddress

func ParseEthAddress(s string) (EthAddress, error)

ParseEthAddress parses an Ethereum address from a hex string.

func TryEthAddressFromFilecoinAddress

func TryEthAddressFromFilecoinAddress(addr address.Address, allowID bool) (EthAddress, bool, error)

This API assumes that if an ID address is passed in, it doesn't have an equivalent delegated address

func (EthAddress) IsMaskedID

func (ea EthAddress) IsMaskedID() bool

func (EthAddress) MarshalJSON

func (ea EthAddress) MarshalJSON() ([]byte, error)

func (EthAddress) String

func (ea EthAddress) String() string

func (EthAddress) ToFilecoinAddress

func (ea EthAddress) ToFilecoinAddress() (address.Address, error)

func (*EthAddress) UnmarshalJSON

func (ea *EthAddress) UnmarshalJSON(b []byte) error

type EthAddressList

type EthAddressList []EthAddress

EthAddressSpec represents a list of addresses. The JSON decoding must treat a string as equivalent to an array with one value, for example "0x8888f1f195afa192cfee86069858" must be decoded as [ "0x8888f1f195afa192cfee86069858" ]

func (*EthAddressList) UnmarshalJSON

func (e *EthAddressList) UnmarshalJSON(b []byte) error

type EthBigInt

type EthBigInt big.Int

EthBigInt represents a large integer whose zero value serializes to "0x0".

func (EthBigInt) MarshalJSON

func (e EthBigInt) MarshalJSON() ([]byte, error)

func (EthBigInt) String

func (e EthBigInt) String() string

func (*EthBigInt) UnmarshalJSON

func (e *EthBigInt) UnmarshalJSON(b []byte) error

type EthBlock

type EthBlock struct {
	Hash             EthHash    `json:"hash"`
	ParentHash       EthHash    `json:"parentHash"`
	Sha3Uncles       EthHash    `json:"sha3Uncles"`
	Miner            EthAddress `json:"miner"`
	StateRoot        EthHash    `json:"stateRoot"`
	TransactionsRoot EthHash    `json:"transactionsRoot"`
	ReceiptsRoot     EthHash    `json:"receiptsRoot"`
	LogsBloom        EthBytes   `json:"logsBloom"`
	Difficulty       EthUint64  `json:"difficulty"`
	TotalDifficulty  EthUint64  `json:"totalDifficulty"`
	Number           EthUint64  `json:"number"`
	GasLimit         EthUint64  `json:"gasLimit"`
	GasUsed          EthUint64  `json:"gasUsed"`
	Timestamp        EthUint64  `json:"timestamp"`
	Extradata        EthBytes   `json:"extraData"`
	MixHash          EthHash    `json:"mixHash"`
	Nonce            EthNonce   `json:"nonce"`
	BaseFeePerGas    EthBigInt  `json:"baseFeePerGas"`
	Size             EthUint64  `json:"size"`
	// can be []EthTx or []string depending on query params
	Transactions []interface{} `json:"transactions"`
	Uncles       []EthHash     `json:"uncles"`
}

func NewEthBlock

func NewEthBlock(hasTransactions bool) EthBlock

type EthBlockNumberOrHash added in v1.14.0

type EthBlockNumberOrHash struct {
	// PredefinedBlock can be one of "earliest", "pending" or "latest". We could merge this
	// field with BlockNumber if the latter could store negative numbers representing
	// each predefined value (e.g. -1 for "earliest", -2 for "pending" and -3 for "latest")
	PredefinedBlock *string `json:"-"`

	BlockNumber      *EthUint64 `json:"blockNumber,omitempty"`
	BlockHash        *EthHash   `json:"blockHash,omitempty"`
	RequireCanonical bool       `json:"requireCanonical,omitempty"`
}

func NewEthBlockNumberOrHashFromHexString added in v1.14.0

func NewEthBlockNumberOrHashFromHexString(str string) (EthBlockNumberOrHash, error)

func NewEthBlockNumberOrHashFromNumber added in v1.14.0

func NewEthBlockNumberOrHashFromNumber(number EthUint64) EthBlockNumberOrHash

func NewEthBlockNumberOrHashFromPredefined added in v1.14.0

func NewEthBlockNumberOrHashFromPredefined(predefined string) EthBlockNumberOrHash

func (EthBlockNumberOrHash) MarshalJSON added in v1.14.0

func (e EthBlockNumberOrHash) MarshalJSON() ([]byte, error)

func (*EthBlockNumberOrHash) UnmarshalJSON added in v1.14.0

func (e *EthBlockNumberOrHash) UnmarshalJSON(b []byte) error

type EthBytes

type EthBytes []byte

EthBytes represent arbitrary bytes. A nil or empty slice serializes to "0x".

func (EthBytes) MarshalJSON

func (e EthBytes) MarshalJSON() ([]byte, error)

func (EthBytes) String

func (e EthBytes) String() string

func (*EthBytes) UnmarshalJSON

func (e *EthBytes) UnmarshalJSON(b []byte) error

type EthCall

type EthCall struct {
	From     *EthAddress `json:"from"`
	To       *EthAddress `json:"to"`
	Gas      EthUint64   `json:"gas"`
	GasPrice EthBigInt   `json:"gasPrice"`
	Value    EthBigInt   `json:"value"`
	Data     EthBytes    `json:"data"`
}

func (*EthCall) UnmarshalJSON

func (c *EthCall) UnmarshalJSON(b []byte) error

type EthCallTraceAction added in v1.15.0

type EthCallTraceAction struct {
	CallType string     `json:"callType"`
	From     EthAddress `json:"from"`
	To       EthAddress `json:"to"`
	Gas      EthUint64  `json:"gas"`
	Value    EthBigInt  `json:"value"`
	Input    EthBytes   `json:"input"`
}

type EthCallTraceResult added in v1.15.0

type EthCallTraceResult struct {
	GasUsed EthUint64 `json:"gasUsed"`
	Output  EthBytes  `json:"output"`
}

type EthCreateTraceAction added in v1.15.0

type EthCreateTraceAction struct {
	From  EthAddress `json:"from"`
	Gas   EthUint64  `json:"gas"`
	Value EthBigInt  `json:"value"`
	Init  EthBytes   `json:"init"`
}

type EthCreateTraceResult added in v1.15.0

type EthCreateTraceResult struct {
	Address *EthAddress `json:"address,omitempty"`
	GasUsed EthUint64   `json:"gasUsed"`
	Code    EthBytes    `json:"code"`
}

type EthEstimateGasParams added in v1.15.0

type EthEstimateGasParams struct {
	Tx       EthCall
	BlkParam *EthBlockNumberOrHash
}

EthEstimateGasParams handles raw jsonrpc params for eth_estimateGas

func (EthEstimateGasParams) MarshalJSON added in v1.15.0

func (e EthEstimateGasParams) MarshalJSON() ([]byte, error)

func (*EthEstimateGasParams) UnmarshalJSON added in v1.15.0

func (e *EthEstimateGasParams) UnmarshalJSON(b []byte) error

type EthFeeHistory

type EthFeeHistory struct {
	OldestBlock   EthUint64      `json:"oldestBlock"`
	BaseFeePerGas []EthBigInt    `json:"baseFeePerGas"`
	GasUsedRatio  []float64      `json:"gasUsedRatio"`
	Reward        *[][]EthBigInt `json:"reward,omitempty"`
}

type EthFeeHistoryParams

type EthFeeHistoryParams struct {
	BlkCount          EthUint64
	NewestBlkNum      string
	RewardPercentiles *[]float64
}

EthFeeHistoryParams handles raw jsonrpc params for eth_feeHistory

func (EthFeeHistoryParams) MarshalJSON

func (e EthFeeHistoryParams) MarshalJSON() ([]byte, error)

func (*EthFeeHistoryParams) UnmarshalJSON

func (e *EthFeeHistoryParams) UnmarshalJSON(b []byte) error

type EthFilterID

type EthFilterID EthHash

func (EthFilterID) MarshalJSON

func (h EthFilterID) MarshalJSON() ([]byte, error)

func (EthFilterID) String

func (h EthFilterID) String() string

func (*EthFilterID) UnmarshalJSON

func (h *EthFilterID) UnmarshalJSON(b []byte) error

type EthFilterResult

type EthFilterResult struct {
	Results []interface{}
}

FilterResult represents the response from executing a filter: a list of block hashes, a list of transaction hashes or a list of logs This is a union type. Only one field will be populated. The JSON encoding must produce an array of the populated field.

func (EthFilterResult) MarshalJSON

func (h EthFilterResult) MarshalJSON() ([]byte, error)

func (*EthFilterResult) UnmarshalJSON

func (h *EthFilterResult) UnmarshalJSON(b []byte) error

type EthFilterSpec

type EthFilterSpec struct {
	// Interpreted as an epoch (in hex) or one of "latest" for last mined block, "earliest" for first,
	// "pending" for not yet committed messages.
	// Optional, default: "latest".
	FromBlock *string `json:"fromBlock,omitempty"`

	// Interpreted as an epoch (in hex) or one of "latest" for last mined block, "earliest" for first,
	// "pending" for not yet committed messages.
	// Optional, default: "latest".
	ToBlock *string `json:"toBlock,omitempty"`

	// Actor address or a list of addresses from which event logs should originate.
	// Optional, default nil.
	// The JSON decoding must treat a string as equivalent to an array with one value, for example
	// "0x8888f1f195afa192cfee86069858" must be decoded as [ "0x8888f1f195afa192cfee86069858" ]
	Address EthAddressList `json:"address"`

	// List of topics to be matched.
	// Optional, default: empty list
	Topics EthTopicSpec `json:"topics"`

	// Restricts event logs returned to those emitted from messages contained in this tipset.
	// If BlockHash is present in the filter criteria, then neither FromBlock nor ToBlock are allowed.
	// Added in EIP-234
	BlockHash *EthHash `json:"blockHash,omitempty"`
}

type EthHash

type EthHash [EthHashLength]byte

func EthHashFromCid

func EthHashFromCid(c cid.Cid) (EthHash, error)

func EthHashFromTxBytes

func EthHashFromTxBytes(b []byte) EthHash

func ParseEthHash

func ParseEthHash(s string) (EthHash, error)

func (EthHash) MarshalJSON

func (h EthHash) MarshalJSON() ([]byte, error)

func (EthHash) String

func (h EthHash) String() string

func (EthHash) ToCid

func (h EthHash) ToCid() cid.Cid

Should ONLY be used for blocks and Filecoin messages. Eth transactions expect a different hashing scheme.

func (*EthHash) UnmarshalJSON

func (h *EthHash) UnmarshalJSON(b []byte) error

type EthHashList

type EthHashList []EthHash

EthHashList represents a list of EthHashes. The JSON decoding treats string values as equivalent to arrays with one value.

func (*EthHashList) UnmarshalJSON

func (e *EthHashList) UnmarshalJSON(b []byte) error

type EthLog

type EthLog struct {
	// Address is the address of the actor that produced the event log.
	Address EthAddress `json:"address"`

	// Data is the value of the event log, excluding topics
	Data EthBytes `json:"data"`

	// List of topics associated with the event log.
	Topics []EthHash `json:"topics"`

	// Indicates whether the log was removed due to a chain reorganization.
	Removed bool `json:"removed"`

	// LogIndex is the index of the event log in the sequence of events produced by the message execution.
	// (this is the index in the events AMT on the message receipt)
	LogIndex EthUint64 `json:"logIndex"`

	// TransactionIndex is the index in the tipset of the transaction that produced the event log.
	// The index corresponds to the sequence of messages produced by ChainGetParentMessages
	TransactionIndex EthUint64 `json:"transactionIndex"`

	// TransactionHash is the hash of the RLP message that produced the event log.
	TransactionHash EthHash `json:"transactionHash"`

	// BlockHash is the hash of the tipset containing the message that produced the log.
	BlockHash EthHash `json:"blockHash"`

	// BlockNumber is the epoch of the tipset containing the message.
	BlockNumber EthUint64 `json:"blockNumber"`
}

EthLog represents the results of an event filter execution.

type EthNonce

type EthNonce [8]byte

func (EthNonce) MarshalJSON

func (n EthNonce) MarshalJSON() ([]byte, error)

func (EthNonce) String

func (n EthNonce) String() string

func (*EthNonce) UnmarshalJSON

func (n *EthNonce) UnmarshalJSON(b []byte) error

type EthSubscribeParams

type EthSubscribeParams struct {
	EventType string
	Params    *EthSubscriptionParams
}

EthSubscribeParams handles raw jsonrpc params for eth_subscribe

func (EthSubscribeParams) MarshalJSON

func (e EthSubscribeParams) MarshalJSON() ([]byte, error)

func (*EthSubscribeParams) UnmarshalJSON

func (e *EthSubscribeParams) UnmarshalJSON(b []byte) error

type EthSubscriptionID

type EthSubscriptionID EthHash

An opaque identifier generated by the Lotus node to refer to an active subscription.

func (EthSubscriptionID) MarshalJSON

func (h EthSubscriptionID) MarshalJSON() ([]byte, error)

func (EthSubscriptionID) String

func (h EthSubscriptionID) String() string

func (*EthSubscriptionID) UnmarshalJSON

func (h *EthSubscriptionID) UnmarshalJSON(b []byte) error

type EthSubscriptionParams

type EthSubscriptionParams struct {
	// List of topics to be matched.
	// Optional, default: empty list
	Topics EthTopicSpec `json:"topics,omitempty"`

	// Actor address or a list of addresses from which event logs should originate.
	// Optional, default nil.
	// The JSON decoding must treat a string as equivalent to an array with one value, for example
	// "0x8888f1f195afa192cfee86069858" must be decoded as [ "0x8888f1f195afa192cfee86069858" ]
	Address EthAddressList `json:"address"`
}

type EthSubscriptionResponse

type EthSubscriptionResponse struct {
	// The persistent identifier for the subscription which can be used to unsubscribe.
	SubscriptionID EthSubscriptionID `json:"subscription"`

	// The object matching the subscription. This may be a Block (tipset), a Transaction (message) or an EthLog
	Result interface{} `json:"result"`
}

type EthSyncingResult added in v1.14.0

type EthSyncingResult struct {
	DoneSync      bool
	StartingBlock EthUint64
	CurrentBlock  EthUint64
	HighestBlock  EthUint64
}

func (EthSyncingResult) MarshalJSON added in v1.14.0

func (sr EthSyncingResult) MarshalJSON() ([]byte, error)

type EthTopicSpec

type EthTopicSpec []EthHashList

TopicSpec represents a specification for matching by topic. An empty spec means all topics will be matched. Otherwise topics are matched conjunctively in the first dimension of the slice and disjunctively in the second dimension. Topics are matched in order. An event log with topics [A, B] will be matched by the following topic specs: [] "all" [[A]] "A in first position (and anything after)" [nil, [B] ] "anything in first position AND B in second position (and anything after)" [[A], [B]] "A in first position AND B in second position (and anything after)" [[A, B], [A, B]] "(A OR B) in first position AND (A OR B) in second position (and anything after)"

The JSON decoding must treat string values as equivalent to arrays with one value, for example { "A", [ "B", "C" ] } must be decoded as [ [ A ], [ B, C ] ]

type EthTrace added in v1.14.0

type EthTrace struct {
	Type         string `json:"type"`
	Error        string `json:"error,omitempty"`
	Subtraces    int    `json:"subtraces"`
	TraceAddress []int  `json:"traceAddress"`
	Action       any    `json:"action"`
	Result       any    `json:"result"`

	Parent *EthTrace `json:"-"`

	// if a subtrace makes a call to GetBytecode, we store a pointer to that subtrace here
	// which we then lookup when checking for delegatecall (InvokeContractDelegate)
	LastByteCode *EthTrace `json:"-"`
}

type EthTraceBlock added in v1.14.0

type EthTraceBlock struct {
	*EthTrace
	BlockHash           EthHash `json:"blockHash"`
	BlockNumber         int64   `json:"blockNumber"`
	TransactionHash     EthHash `json:"transactionHash"`
	TransactionPosition int     `json:"transactionPosition"`
}

type EthTraceReplayBlockTransaction added in v1.14.0

type EthTraceReplayBlockTransaction struct {
	Output          EthBytes    `json:"output"`
	StateDiff       *string     `json:"stateDiff"`
	Trace           []*EthTrace `json:"trace"`
	TransactionHash EthHash     `json:"transactionHash"`
	VMTrace         *string     `json:"vmTrace"`
}

type EthTx

type EthTx struct {
	ChainID              EthUint64   `json:"chainId"`
	Nonce                EthUint64   `json:"nonce"`
	Hash                 EthHash     `json:"hash"`
	BlockHash            *EthHash    `json:"blockHash"`
	BlockNumber          *EthUint64  `json:"blockNumber"`
	TransactionIndex     *EthUint64  `json:"transactionIndex"`
	From                 EthAddress  `json:"from"`
	To                   *EthAddress `json:"to"`
	Value                EthBigInt   `json:"value"`
	Type                 EthUint64   `json:"type"`
	Input                EthBytes    `json:"input"`
	Gas                  EthUint64   `json:"gas"`
	MaxFeePerGas         EthBigInt   `json:"maxFeePerGas"`
	MaxPriorityFeePerGas EthBigInt   `json:"maxPriorityFeePerGas"`
	AccessList           []EthHash   `json:"accessList"`
	V                    EthBigInt   `json:"v"`
	R                    EthBigInt   `json:"r"`
	S                    EthBigInt   `json:"s"`
}

func EthTxFromSignedEthMessage

func EthTxFromSignedEthMessage(smsg *SignedMessage) (EthTx, error)

EthTxFromSignedEthMessage does NOT populate: - BlockHash - BlockNumber - TransactionIndex - From - Hash

func (*EthTx) ToEthTxArgs

func (tx *EthTx) ToEthTxArgs() EthTxArgs

func (*EthTx) TxHash

func (tx *EthTx) TxHash() (EthHash, error)

type EthTxArgs

type EthTxArgs struct {
	ChainID              int         `json:"chainId"`
	Nonce                int         `json:"nonce"`
	To                   *EthAddress `json:"to"`
	Value                big.Int     `json:"value"`
	MaxFeePerGas         big.Int     `json:"maxFeePerGas"`
	MaxPriorityFeePerGas big.Int     `json:"maxPriorityFeePerGas"`
	GasLimit             int         `json:"gasLimit"`
	Input                []byte      `json:"input"`
	V                    big.Int     `json:"v"`
	R                    big.Int     `json:"r"`
	S                    big.Int     `json:"s"`
}

func EthTxArgsFromUnsignedEthMessage

func EthTxArgsFromUnsignedEthMessage(msg *Message) (EthTxArgs, error)

func ParseEthTxArgs

func ParseEthTxArgs(data []byte) (*EthTxArgs, error)

func (*EthTxArgs) HashedOriginalRlpMsg

func (tx *EthTxArgs) HashedOriginalRlpMsg() ([]byte, error)

func (*EthTxArgs) Sender

func (tx *EthTxArgs) Sender() (address.Address, error)

func (*EthTxArgs) Signature

func (tx *EthTxArgs) Signature() (*typescrypto.Signature, error)

func (*EthTxArgs) ToRlpSignedMsg

func (tx *EthTxArgs) ToRlpSignedMsg() ([]byte, error)

func (*EthTxArgs) ToRlpUnsignedMsg

func (tx *EthTxArgs) ToRlpUnsignedMsg() ([]byte, error)

func (*EthTxArgs) ToSignedMessage

func (tx *EthTxArgs) ToSignedMessage() (*SignedMessage, error)

func (*EthTxArgs) ToUnsignedMessage

func (tx *EthTxArgs) ToUnsignedMessage(from address.Address) (*Message, error)

func (*EthTxArgs) TxHash

func (tx *EthTxArgs) TxHash() (EthHash, error)

type EthTxReceipt

type EthTxReceipt struct {
	TransactionHash  EthHash     `json:"transactionHash"`
	TransactionIndex EthUint64   `json:"transactionIndex"`
	BlockHash        EthHash     `json:"blockHash"`
	BlockNumber      EthUint64   `json:"blockNumber"`
	From             EthAddress  `json:"from"`
	To               *EthAddress `json:"to"`
	// Logs
	// LogsBloom
	StateRoot         EthHash     `json:"root"`
	Status            EthUint64   `json:"status"`
	ContractAddress   *EthAddress `json:"contractAddress"`
	CumulativeGasUsed EthUint64   `json:"cumulativeGasUsed"`
	GasUsed           EthUint64   `json:"gasUsed"`
	EffectiveGasPrice EthBigInt   `json:"effectiveGasPrice"`
	LogsBloom         EthBytes    `json:"logsBloom"`
	Logs              []EthLog    `json:"logs"`
	Type              EthUint64   `json:"type"`
}

type EthUint64

type EthUint64 uint64

func EthUint64FromBytes

func EthUint64FromBytes(b []byte) (EthUint64, error)

Parse a uint64 from big-endian encoded bytes.

func EthUint64FromHex

func EthUint64FromHex(s string) (EthUint64, error)

func (EthUint64) Hex

func (e EthUint64) Hex() string

func (EthUint64) MarshalJSON

func (e EthUint64) MarshalJSON() ([]byte, error)

func (*EthUint64) UnmarshalJSON

func (e *EthUint64) UnmarshalJSON(b []byte) error

UnmarshalJSON should be able to parse these types of input: 1. a JSON string containing a hex-encoded uint64 starting with 0x 2. a JSON string containing an uint64 in decimal 3. a string containing an uint64 in decimal

type FIL

type FIL BigInt

func MustParseFIL

func MustParseFIL(s string) FIL

func ParseFIL

func ParseFIL(s string) (FIL, error)

func (FIL) Format

func (f FIL) Format(s fmt.State, ch rune)

func (FIL) MarshalJSON

func (f FIL) MarshalJSON() ([]byte, error)

func (FIL) MarshalText

func (f FIL) MarshalText() (text []byte, err error)

func (FIL) Nano

func (f FIL) Nano() string

func (FIL) Short

func (f FIL) Short() string

func (FIL) String

func (f FIL) String() string

func (FIL) Unitless

func (f FIL) Unitless() string

func (*FIL) UnmarshalJSON

func (f *FIL) UnmarshalJSON(by []byte) error

func (*FIL) UnmarshalText

func (f *FIL) UnmarshalText(text []byte) error

type Message

type Message struct {
	Version uint64

	To   address.Address
	From address.Address
	// When receiving a message from a user account the nonce in
	// the message must match the expected nonce in the from actor.
	// This prevents replay attacks.
	Nonce uint64

	Value abi.TokenAmount

	GasLimit   int64
	GasFeeCap  abi.TokenAmount
	GasPremium abi.TokenAmount

	Method abi.MethodNum
	Params []byte
}

func DecodeMessage

func DecodeMessage(b []byte) (*Message, error)

func (*Message) ChainLength

func (m *Message) ChainLength() int

func (*Message) Cid

func (m *Message) Cid() cid.Cid

func (*Message) EffectiveGasPremium added in v1.12.0

func (m *Message) EffectiveGasPremium(baseFee abi.TokenAmount) abi.TokenAmount

EffectiveGasPremium returns the effective gas premium claimable by the miner given the supplied base fee.

Filecoin clamps the gas premium at GasFeeCap - BaseFee, if lower than the specified premium.

func (*Message) EqualCall

func (m *Message) EqualCall(o *Message) bool

func (*Message) Equals

func (m *Message) Equals(o *Message) bool

func (*Message) MarshalCBOR

func (t *Message) MarshalCBOR(w io.Writer) error

func (*Message) MarshalJSON

func (m *Message) MarshalJSON() ([]byte, error)

func (*Message) RequiredFunds

func (m *Message) RequiredFunds() abi.TokenAmount

func (*Message) Serialize

func (m *Message) Serialize() ([]byte, error)

func (*Message) SerializeWithCid

func (m *Message) SerializeWithCid() (cid.Cid, []byte, error)

func (*Message) SigningBytes

func (m *Message) SigningBytes(sigType crypto.SigType) ([]byte, error)

func (*Message) String

func (m *Message) String() string

func (*Message) ToStorageBlock

func (m *Message) ToStorageBlock() (blocks.Block, error)

func (*Message) UnmarshalCBOR

func (t *Message) UnmarshalCBOR(r io.Reader) (err error)

func (*Message) VMMessage

func (m *Message) VMMessage() *Message

func (*Message) ValidForBlockInclusion

func (m *Message) ValidForBlockInclusion(minGas int64, version network.Version) error

type RawMessage

type RawMessage Message

type RawSignedMessage

type RawSignedMessage SignedMessage

type SignedMessage

type SignedMessage struct {
	Message   Message
	Signature crypto.Signature
}

SignedMessage contains a message and its signature

func (*SignedMessage) ChainLength

func (smsg *SignedMessage) ChainLength() int

nolint

func (*SignedMessage) Cid

func (smsg *SignedMessage) Cid() cid.Cid

func (*SignedMessage) MarshalCBOR

func (t *SignedMessage) MarshalCBOR(w io.Writer) error

func (*SignedMessage) MarshalJSON

func (sm *SignedMessage) MarshalJSON() ([]byte, error)

func (*SignedMessage) Serialize

func (smsg *SignedMessage) Serialize() ([]byte, error)

Serialize return message binary

func (*SignedMessage) SerializeWithCid

func (smsg *SignedMessage) SerializeWithCid() (cid.Cid, []byte, error)

Serialize return message binary

func (*SignedMessage) String

func (smsg *SignedMessage) String() string

String return message json string

func (*SignedMessage) ToStorageBlock

func (smsg *SignedMessage) ToStorageBlock() (blocks.Block, error)

func (*SignedMessage) UnmarshalCBOR

func (t *SignedMessage) UnmarshalCBOR(r io.Reader) (err error)

func (*SignedMessage) VMMessage

func (smsg *SignedMessage) VMMessage() *Message

Jump to

Keyboard shortcuts

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