messagesigner

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: Apache-2.0, MIT Imports: 15 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SigningBytes added in v1.20.0

func SigningBytes(msg *types.Message, sigType address.Protocol) ([]byte, error)

Types

type MessageSigner

type MessageSigner struct {
	// contains filtered or unexported fields
}

MessageSigner keeps track of nonces per address, and increments the nonce when signing a message

func NewMessageSigner

func NewMessageSigner(wallet api.Wallet, mpool messagepool.MpoolNonceAPI, ds dtypes.MetadataDS) *MessageSigner

func (*MessageSigner) GetSignedMessage added in v1.17.2

func (ms *MessageSigner) GetSignedMessage(ctx context.Context, uuid uuid.UUID) (*types.SignedMessage, error)

func (*MessageSigner) NextNonce added in v1.19.0

func (ms *MessageSigner) NextNonce(ctx context.Context, addr address.Address) (uint64, error)

NextNonce gets the next nonce for the given address. If there is no nonce in the datastore, gets the nonce from the message pool.

func (*MessageSigner) SaveNonce added in v1.19.0

func (ms *MessageSigner) SaveNonce(ctx context.Context, addr address.Address, nonce uint64) error

SaveNonce increments the nonce for this address and writes it to the datastore

func (*MessageSigner) SignMessage

func (ms *MessageSigner) SignMessage(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec, cb func(*types.SignedMessage) error) (*types.SignedMessage, error)

SignMessage increments the nonce for the message From address, and signs the message

func (*MessageSigner) StoreSignedMessage added in v1.17.2

func (ms *MessageSigner) StoreSignedMessage(ctx context.Context, uuid uuid.UUID, message *types.SignedMessage) error

type MsgSigner added in v1.19.0

type MsgSigner interface {
	SignMessage(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec, cb func(*types.SignedMessage) error) (*types.SignedMessage, error)
	GetSignedMessage(ctx context.Context, uuid uuid.UUID) (*types.SignedMessage, error)
	StoreSignedMessage(ctx context.Context, uuid uuid.UUID, message *types.SignedMessage) error
	NextNonce(ctx context.Context, addr address.Address) (uint64, error)
	SaveNonce(ctx context.Context, addr address.Address, nonce uint64) error
}

Jump to

Keyboard shortcuts

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