Documentation
¶
Index ¶
- Constants
- type AddressDecoder
- type AddressEncodeDecoder
- type AddressEncoder
- type Client
- type ClientOptions
- type Tx
- func (tx Tx) From() address.Address
- func (tx Tx) Hash() pack.Bytes
- func (tx Tx) Nonce() pack.U256
- func (tx Tx) Payload() contract.CallData
- func (tx Tx) Serialize() (pack.Bytes, error)
- func (tx Tx) Sighashes() ([]pack.Bytes32, error)
- func (tx *Tx) Sign(signatures []pack.Bytes65, pubkey pack.Bytes) error
- func (tx Tx) To() address.Address
- func (tx Tx) Value() pack.U256
- type TxBuilder
Constants ¶
const ( // AuthorizationKey is the header key used for authorization AuthorizationKey = "Authorization" // DefaultClientRPCURL is the RPC websocket URL used by default, to // interact with the filecoin lotus node. DefaultClientRPCURL = "ws://127.0.0.1:1234/rpc/v0" // DefaultClientAuthToken is the auth token used to instantiate the lotus // client. A valid lotus auth token is required to write messages to the // filecoin storage. To do read-only queries, auth token is not required. DefaultClientAuthToken = "" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressDecoder ¶
type AddressDecoder struct{}
AddressDecoder implements the address.Decoder interface.
func (AddressDecoder) DecodeAddress ¶
func (addrDecoder AddressDecoder) DecodeAddress(addr address.Address) (address.RawAddress, error)
DecodeAddress implements the address.Decoder interface. It receives a human readable address and decodes it to an address represented by raw bytes.
type AddressEncodeDecoder ¶
type AddressEncodeDecoder struct {
AddressEncoder
AddressDecoder
}
AddressEncodeDecoder implements the address.EncodeDecoder interface
func NewAddressEncodeDecoder ¶
func NewAddressEncodeDecoder() AddressEncodeDecoder
NewAddressEncodeDecoder constructs a new AddressEncodeDecoder.
type AddressEncoder ¶
type AddressEncoder struct{}
AddressEncoder implements the address.Encoder interface.
func (AddressEncoder) EncodeAddress ¶
func (encoder AddressEncoder) EncodeAddress(raw address.RawAddress) (address.Address, error)
EncodeAddress implements the address.Encoder interface. It receives a raw address and encodes it to a human-readable stringified address.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client holds options to connect to a filecoin lotus node, and the underlying RPC client instance.
func NewClient ¶
func NewClient(opts ClientOptions) (*Client, error)
NewClient creates and returns a new JSON-RPC client to the Filecoin node
type ClientOptions ¶
ClientOptions are used to parameterise the behaviour of the Client.
func DefaultClientOptions ¶
func DefaultClientOptions() ClientOptions
DefaultClientOptions returns ClientOptions with the default settings. These settings are valid for use with the default local deployment of the multichain. In production, the rpc-url and authentication token should be changed.
func (ClientOptions) WithAuthToken ¶
func (opts ClientOptions) WithAuthToken(authToken string) ClientOptions
WithAuthToken returns a modified version of the options with the given authentication token.
func (ClientOptions) WithRPCURL ¶
func (opts ClientOptions) WithRPCURL(rpcURL string) ClientOptions
WithRPCURL returns a modified version of the options with the given API rpc-url
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx represents a filecoin transaction, encapsulating a message and its signature.
func (Tx) From ¶
From returns the address that is sending the transaction. Generally, this is also the address that must sign the transaction.
func (Tx) Hash ¶
Hash returns the hash that uniquely identifies the transaction. Generally, hashes are irreversible hash functions that consume the content of the transaction.
func (Tx) Nonce ¶
Nonce returns the nonce used to order the transaction with respect to all other transactions signed and submitted by the sender.
func (Tx) Payload ¶
Payload returns arbitrary data that is associated with the transaction. Generally, this payload is used to send notes between external accounts, or invoke business logic on a contract.
func (Tx) Serialize ¶
Serialize the transaction into bytes. Generally, this is the format in which the transaction will be submitted by the client.
func (Tx) Sighashes ¶
Sighashes returns the digests that must be signed before the transaction can be submitted by the client.
func (*Tx) Sign ¶
Sign the transaction by injecting signatures for the required sighashes. The serialized public key used to sign the sighashes must also be specified.
type TxBuilder ¶
type TxBuilder struct {
// contains filtered or unexported fields
}
TxBuilder represents a transaction builder that builds transactions to be broadcasted to the filecoin network. The TxBuilder is configured using a gas price and gas limit.
func NewTxBuilder ¶
NewTxBuilder creates a new transaction builder.