Documentation ¶
Overview ¶
Package sdk : a go-fvm-sdk for creation actors.
Index ¶
- Variables
- func Abort(ctx context.Context, code ferrors.ExitCode, msg string)
- func AvailableGas(ctx context.Context) (uint64, error)
- func BalanceOf(ctx context.Context, actorID abi.ActorID) (*abi.TokenAmount, error)
- func BaseFee(ctx context.Context) (abi.TokenAmount, error)
- func BatchVerifySeals(ctx context.Context, sealVerifyInfos []proof.SealVerifyInfo) ([]bool, error)
- func Caller(ctx context.Context) (abi.ActorID, error)
- func CallerAddress(ctx context.Context) (address.Address, error)
- func Charge(ctx context.Context, name string, compute uint64) error
- func ComputeUnsealedSectorCid(ctx context.Context, proofType abi.RegisteredSealProof, pieces []abi.PieceInfo) (cid.Cid, error)
- func Constructor(ctx context.Context, state cbor.Marshaler) error
- func CreateActor(ctx context.Context, actorID abi.ActorID, codeCid cid.Cid, ...) error
- func CurrEpoch(ctx context.Context) (abi.ChainEpoch, error)
- func CurrentBalance(ctx context.Context) abi.TokenAmount
- func EmitEvent(ctx context.Context, evt types.ActorEvent) error
- func Exit(ctx context.Context, code ferrors.ExitCode, data []byte, msg string)
- func ExitWithBlkId(ctx context.Context, code ferrors.ExitCode, blkId types.BlockID, msg string)
- func Get(ctx context.Context, cid cid.Cid) ([]byte, error)
- func GetActorCodeCid(ctx context.Context, addr address.Address) (cid.Cid, error)
- func GetBeaconRandomness(ctx context.Context, dst crypto.DomainSeparationTag, round abi.ChainEpoch, ...) (abi.Randomness, error)
- func GetBlock(ctx context.Context, id types.BlockID, size *uint32) ([]byte, error)
- func GetBuiltinActorType(ctx context.Context, codeCid cid.Cid) (types.ActorType, error)
- func GetChainRandomness(ctx context.Context, dst crypto.DomainSeparationTag, round abi.ChainEpoch, ...) (abi.Randomness, error)
- func GetCodeCidForType(ctx context.Context, actorT types.ActorType) (cid.Cid, error)
- func HashBlake2b(ctx context.Context, data []byte) ([32]byte, error)
- func InitializeAccount(ctx context.Context, addr address.Address) (abi.ActorID, error)
- func IsAccountAddress(ctx context.Context, addr address.Address) bool
- func IsNil(obj interface{}) bool
- func LoadState(ctx context.Context, state cbor.Unmarshaler)
- func LoadStateFromCid(ctx context.Context, cid cid.Cid, state cbor.Unmarshaler)
- func LookupDelegatedAddress(ctx context.Context, actorID abi.ActorID) (address.Address, error)
- func MethodNumber(ctx context.Context) (abi.MethodNum, error)
- func MsgGasPremium(ctx context.Context) (abi.TokenAmount, error)
- func MustAddressFromActorId(actorId abi.ActorID) address.Address
- func MustCborMarshal(obj cbor.Marshaler) []byte
- func NextActorAddress(ctx context.Context) (address.Address, error)
- func Origin(ctx context.Context) (abi.ActorID, error)
- func OriginAddress(ctx context.Context) (address.Address, error)
- func ParamsRaw(ctx context.Context, id types.BlockID) (*types.ParamsRaw, error)
- func Put(ctx context.Context, mhCode uint64, mhSize uint32, codec uint64, data []byte) (cid.Cid, error)
- func PutBlock(ctx context.Context, codec types.Codec, data []byte) (types.BlockID, error)
- func Receiver(ctx context.Context) (abi.ActorID, error)
- func ReceiverAddress(ctx context.Context) (address.Address, error)
- func ResolveAddress(ctx context.Context, addr address.Address) (abi.ActorID, error)
- func ResolveOrInitAddress(ctx context.Context, addr address.Address) (abi.ActorID, error)
- func Root(ctx context.Context) (cid.Cid, error)
- func SameAddress(ctx context.Context, addrA, addrB address.Address) bool
- func SaveState(ctx context.Context, state cbor.Marshaler) cid.Cid
- func SelfDestruct(ctx context.Context, addr addr.Address) error
- func Send(ctx context.Context, to address.Address, method abi.MethodNum, ...) (*types.Receipt, error)
- func SetRoot(ctx context.Context, c cid.Cid) error
- func TipsetCid(ctx context.Context, epoch abi.ChainEpoch) (*cid.Cid, error)
- func TipsetTimestamp(ctx context.Context) (uint64, error)
- func TotalFilCircSupply(ctx context.Context) (abi.TokenAmount, error)
- func ValueReceived(ctx context.Context) (abi.TokenAmount, error)
- func VerifyAggregateSeals(ctx context.Context, info *types.AggregateSealVerifyProofAndInfos) (bool, error)
- func VerifyConsensusFault(ctx context.Context, h1 []byte, h2 []byte, extra []byte) (*runtime.ConsensusFault, error)
- func VerifyPost(ctx context.Context, info *proof.WindowPoStVerifyInfo) (bool, error)
- func VerifyReplicaUpdate(ctx context.Context, info *types.ReplicaUpdateInfo) (bool, error)
- func VerifySeal(ctx context.Context, info *proof.SealVerifyInfo) (bool, error)
- func VerifySignature(ctx context.Context, signature *crypto.Signature, signer *address.Address, ...) (bool, error)
- func Version(ctx context.Context) (network.Version, error)
- type Logger
- type MethodInfo
- type SendOption
Constants ¶
This section is empty.
Variables ¶
var WriteCborArray = internal.WriteCborArray[cbor.Marshaler]
WriteCborArray marshal cbor array to bytes
Functions ¶
func BaseFee ¶
func BaseFee(ctx context.Context) (abi.TokenAmount, error)
BaseFee gets the base fee for the current epoch.
func BatchVerifySeals ¶
BatchVerifySeals batch verifies seals
func CallerAddress ¶
CallerAddress return caller address
func ComputeUnsealedSectorCid ¶
func ComputeUnsealedSectorCid( ctx context.Context, proofType abi.RegisteredSealProof, pieces []abi.PieceInfo, ) (cid.Cid, error)
ComputeUnsealedSectorCid computes an unsealed sector CID (CommD) from its constituent piece CIDs (CommPs) and sizes.
func Constructor ¶
Constructor construct a acor with initialize state
func CreateActor ¶
func CreateActor(ctx context.Context, actorID abi.ActorID, codeCid cid.Cid, addr address.Address) error
CreateActor Creates a new actor of the specified type in the state tree, under the provided address. TODO this syscall will change to calculate the address internally.
func CurrEpoch ¶
func CurrEpoch(ctx context.Context) (abi.ChainEpoch, error)
CurrEpoch get network current epoch
func CurrentBalance ¶
func CurrentBalance(ctx context.Context) abi.TokenAmount
CurrentBalance gets the current balance for the calling actor.
func EmitEvent ¶
func EmitEvent(ctx context.Context, evt types.ActorEvent) error
EmitEvent emit event to fvm
func ExitWithBlkId ¶
ExitWithBlkId abort contract with specify block id and exit message avoid to create block again sometimes
func Get ¶
Get get a block. It's valid to call this on:
1. All CIDs returned by prior calls to `get_root`... 2. All CIDs returned by prior calls to `put`... 3. Any children of a blocks returned by prior calls to `get`...
...during the current invocation.
func GetActorCodeCid ¶
GetActorCodeCid look up the code ID at an actor address. Returns `None` if the actor cannot be found.
func GetBeaconRandomness ¶
func GetBeaconRandomness(ctx context.Context, dst crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) (abi.Randomness, error)
GetBeaconRandomness gets 32 bytes of randomness from the beacon system (currently Drand). The supplied output buffer must have at least 32 bytes of capacity. If this syscall succeeds, exactly 32 bytes will be written starting at the supplied offset.
func GetBlock ¶
GetBlock gets the data of the block referenced by BlockId. If the caller knows the size, this function will read the block in a single syscall. Otherwise, any block over 1KiB will take two syscalls.
func GetBuiltinActorType ¶
GetBuiltinActorType determines whether the supplied CodeCID belongs to a built-in actor type, and to which.
func GetChainRandomness ¶
func GetChainRandomness(ctx context.Context, dst crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) (abi.Randomness, error)
GetChainRandomness gets 32 bytes of randomness from the ticket chain. The supplied output buffer must have at least 32 bytes of capacity. If this syscall succeeds, exactly 32 bytes will be written starting at the supplied offset.
func GetCodeCidForType ¶
GetCodeCidForType Returns the CodeCID for a built-in actor type. Aborts with IllegalArgument if the supplied type is invalid.
func HashBlake2b ¶
HashBlake2b hashes input data using blake2b with 256 bit output.
func InitializeAccount ¶
InitializeAccount create an account actor for address
func IsAccountAddress ¶
IsAccountAddress use check whether specific address is action type
func LoadState ¶
func LoadState(ctx context.Context, state cbor.Unmarshaler)
LoadState loads actors current state
func LoadStateFromCid ¶
func LoadStateFromCid(ctx context.Context, cid cid.Cid, state cbor.Unmarshaler)
LoadStateFromCid load actor state by message cid
func LookupDelegatedAddress ¶
LookupDelegatedAddress look up the address at an actor ID. Returns `None` if the actor cannot be found.
func MethodNumber ¶
MethodNumber method number
func MsgGasPremium ¶
func MsgGasPremium(ctx context.Context) (abi.TokenAmount, error)
MsgGasPremium gaspremium in message
func MustAddressFromActorId ¶
MustAddressFromActorId convert actor id to address, panic if marshal fail, used it carefully
func MustCborMarshal ¶
MustCborMarshal marshal obj to bytes, panic if marshal fail, used it carefully
func NextActorAddress ¶
NextActorAddress generates a new actor address for an actor deployed by the calling actor.
func OriginAddress ¶
OriginAddress return message origin caller address
func Put ¶
func Put(ctx context.Context, mhCode uint64, mhSize uint32, codec uint64, data []byte) (cid.Cid, error)
Put store a block. The block will only be persisted in the state-tree if the CID is "linked in" to the actor's state-tree before the end of the current invocation.
func ReceiverAddress ¶
ReceiverAddress return message to address
func ResolveAddress ¶
ResolveAddress resolves the ID address of an actor. Returns `None` if the address cannot be resolved. Successfully resolving an address doesn't necessarily mean the actor exists (e.g., if the addresss was already an actor ID).
func ResolveOrInitAddress ¶
ResolveOrInitAddress get actor id from address, if not found create one
func Root ¶
Root Get the IPLD root CID. Fails if the actor doesn't have state (before the first call to `set_root` and after actor deletion).
func SameAddress ¶
SameAddress check if two address is the same actor
func SelfDestruct ¶
SelfDestruct destroys the calling actor, sending its current balance to the supplied address, which cannot be itself.
Fails if the beneficiary doesn't exist or is the actor being deleted.
func Send ¶
func Send(ctx context.Context, to address.Address, method abi.MethodNum, params types.RawBytes, value abi.TokenAmount, opts ...SendOption) (*types.Receipt, error)
Send call another actor
func SetRoot ¶
SetRoot set the actor's state-tree root.
Fails if:
- The new root is not in the actor's "reachable" set. - Fails if the actor has been deleted.
func TipsetCid ¶
func TipsetCid(ctx context.Context, epoch abi.ChainEpoch) (*cid.Cid, error)
TipsetCid gets cid
func TipsetTimestamp ¶
TipsetTimestamp gets Timestamp
func TotalFilCircSupply ¶
func TotalFilCircSupply(ctx context.Context) (abi.TokenAmount, error)
TotalFilCircSupply gets the circulating supply.
func ValueReceived ¶
func ValueReceived(ctx context.Context) (abi.TokenAmount, error)
ValueReceived the amount was transferred in message
func VerifyAggregateSeals ¶
func VerifyAggregateSeals(ctx context.Context, info *types.AggregateSealVerifyProofAndInfos) (bool, error)
VerifyAggregateSeals verifies aggregate proof of replication of sectors
func VerifyConsensusFault ¶
func VerifyConsensusFault( ctx context.Context, h1 []byte, h2 []byte, extra []byte, ) (*runtime.ConsensusFault, error)
VerifyConsensusFault verifies that two block headers provide proof of a consensus fault: - both headers mined by the same actor - headers are different - first header is of the same or lower epoch as the second - at least one of the headers appears in the current chain at or after epoch `earliest` - the headers provide evidence of a fault (see the spec for the different fault types). The parameters are all serialized block headers. The third "extra" parameter is consulted only for the "parent grinding fault", in which case it must be the sibling of h1 (same parent tipset) and one of the blocks in the parent of h2 (i.e. h2's grandparent). Returns None and an error if the headers don't prove a fault.
func VerifyPost ¶
VerifyPost verifies a sector seal proof.
func VerifyReplicaUpdate ¶
VerifyReplicaUpdate verifies sector replica update
func VerifySeal ¶
VerifySeal verifies a sector seal proof.
Types ¶
type Logger ¶
type Logger interface { Enabled(ctx context.Context) bool Log(ctx context.Context, args ...interface{}) Logf(ctx context.Context, format string, a ...interface{}) StoreArtifact(ctx context.Context, name string, data []byte) }
Logger is a debug-only logger that uses the FVM syscalls.
type MethodInfo ¶
type MethodInfo struct { // use alias name instead of function name Alias string // function gen tool get method params and return by this field Func interface{} // indicate whether this method is a readonly function, not need to send message when invoke this query state Readonly bool }
MethodInfo used to mark actor export function.
type SendOption ¶
type SendOption func(cfg sendCfg)
SendOption options for set send params
func WithGasLimit ¶
func WithGasLimit(gasLimit uint64) SendOption
WithGasLimit used to set gas limit for send call
func WithReadonly ¶
func WithReadonly() SendOption
WithReadonly used to set readonly mode for send call
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package adt provides amt array and map for contract to store something big, avoid to load big data most code move from https://github.com/filecoin-project/specs-actors/tree/master/actors/util/adt
|
Package adt provides amt array and map for contract to store something big, avoid to load big data most code move from https://github.com/filecoin-project/specs-actors/tree/master/actors/util/adt |
Package ferrors fvm errors
|
Package ferrors fvm errors |
Package frc42dispatch implement frc42 reference https://github.com/filecoin-project/FIPs/blob/master/FRCs/frc-0042.md
|
Package frc42dispatch implement frc42 reference https://github.com/filecoin-project/FIPs/blob/master/FRCs/frc-0042.md |
Package internal definite type/function for both sys and sdk
|
Package internal definite type/function for both sys and sdk |
Package sys is used to interact with fvm and in this package non-fvm file used to index for ide, this can be convenient for development file with _call suffix defines the wasm export function file with _simulate used to simulate system call, useful for actor unit test others file was wrap for _call file, make the type and style more closely match the standard of go
|
Package sys is used to interact with fvm and in this package non-fvm file used to index for ide, this can be convenient for development file with _call suffix defines the wasm export function file with _simulate used to simulate system call, useful for actor unit test others file was wrap for _call file, make the type and style more closely match the standard of go |
simulated
Package simulated is simulated of fvm
|
Package simulated is simulated of fvm |
Package types go-fvm-sdk types
|
Package types go-fvm-sdk types |