interactor

package
v0.74.0-preview.11 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: AGPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTooManyRequests = errors.New("there are too many requests")

Functions

func InvalidResponsePayloadError

func InvalidResponsePayloadError(name InteractionName) error

func TraceIDMismatchError

func TraceIDMismatchError(expected, got string) error

func WrongResponseTypeError

func WrongResponseTypeError(expected, got InteractionName) error

Types

type CancelRequest added in v0.59.0

type CancelRequest struct{}

CancelRequest cancels a request that is waiting for user inputs. It can't cancel a request when there is no response awaited.

type Decision

type Decision struct {
	// Approved is set to true if the request is accepted by the user, false
	// otherwise.
	Approved bool `json:"approved"`
}

Decision is a generic response for the following review requests:

  • RequestPermissionsReview
  • RequestTransactionReviewForSigning
  • RequestTransactionReviewForSending

type EnteredPassphrase

type EnteredPassphrase struct {
	Passphrase string `json:"passphrase"`
}

EnteredPassphrase contains the passphrase of a given wallet the user entered. It's a response to the interactor.RequestPassphrase.

type ErrorOccurred

type ErrorOccurred struct {
	// Type is an enumeration that gives information about the origin of the error.
	// The value is the string representation of an api.ErrorType.
	Type string `json:"type"`

	// Error is the error message describing the reason of the failure.
	Error string `json:"error"`
}

ErrorOccurred is a generic notification emitted when the something failed. This notification can wrap an internal failure as much as a user input error. Receiving this notification doesn't necessarily mean the overall request failed. The request should be considered as failed when this notification is followed by the interactor.InteractionSessionEnded notification.

type Interaction

type Interaction struct {
	// TraceID is an identifier specifically made for client front-end to keep
	// track of a transaction during all of its lifetime, from transaction
	// review to sending confirmation and in-memory history.
	// It shouldn't be confused with the transaction hash that is the
	// transaction identifier.
	TraceID string `json:"traceID"`

	// Name is the name of the interaction. This helps to figure out how the
	// data payload should be parsed.
	Name InteractionName `json:"name"`

	// Data is the generic field that hold the data of the specific interaction.
	Data interface{} `json:"data"`
}

Interaction wraps the messages the JSON-RPC API sends to the wallet front-end along with information about the context.

func (*Interaction) UnmarshalJSON

func (f *Interaction) UnmarshalJSON(data []byte) error