transactions

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(
	transaction *Transaction,
	referenceBlockID flow.Identifier,
	builder *templates.TransactionBuilder,
	tType Type,
	proposer, payer keys.Authorizer,
	authorizers []keys.Authorizer) error

Types

type GormStore

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

func NewGormStore

func NewGormStore(db *gorm.DB) *GormStore

func (*GormStore) GetOrCreateTransaction

func (s *GormStore) GetOrCreateTransaction(txId string) (t *Transaction)

func (*GormStore) InsertTransaction

func (s *GormStore) InsertTransaction(t *Transaction) error

func (*GormStore) Transaction

func (s *GormStore) Transaction(txId string) (t Transaction, err error)

func (*GormStore) TransactionForAccount added in v0.6.0

func (s *GormStore) TransactionForAccount(tType Type, address, txId string) (t Transaction, err error)

func (*GormStore) Transactions

func (s *GormStore) Transactions(o datastore.ListOptions) (tt []Transaction, err error)

func (*GormStore) TransactionsForAccount added in v0.6.0

func (s *GormStore) TransactionsForAccount(tType Type, address string, o datastore.ListOptions) (tt []Transaction, err error)

func (*GormStore) UpdateTransaction

func (s *GormStore) UpdateTransaction(t *Transaction) error

type JSONResponse added in v0.6.0

type JSONResponse struct {
	TransactionId   string       `json:"transactionId"`
	TransactionType Type         `json:"transactionType"`
	Events          []flow.Event `json:"events,omitempty"`
	CreatedAt       time.Time    `json:"createdAt"`
	UpdatedAt       time.Time    `json:"updatedAt"`
}

Transaction JSON HTTP response

type Service

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

Service defines the API for transaction HTTP handlers.

func NewService

func NewService(
	cfg *configs.Config,
	store Store,
	km keys.Manager,
	fc *client.Client,
	wp *jobs.WorkerPool,
) *Service

NewService initiates a new transaction service.

func (*Service) Create

func (s *Service) Create(c context.Context, sync bool, proposerAddress string, raw templates.Raw, tType Type) (*jobs.Job, *Transaction, error)

func (*Service) Details

func (s *Service) Details(ctx context.Context, transactionId string) (*Transaction, error)

Details returns a specific transaction.

func (*Service) DetailsForAccount added in v0.6.0

func (s *Service) DetailsForAccount(ctx context.Context, tType Type, address, transactionId string) (*Transaction, error)

DetailsForAccount returns a specific transaction.

func (*Service) ExecuteScript

func (s *Service) ExecuteScript(ctx context.Context, raw templates.Raw) (cadence.Value, error)

Execute a script

func (*Service) GetOrCreateTransaction

func (s *Service) GetOrCreateTransaction(transactionId string) *Transaction

func (*Service) List

func (s *Service) List(limit, offset int) ([]Transaction, error)

List returns all transactions in the datastore.

func (*Service) ListForAccount added in v0.6.0

func (s *Service) ListForAccount(tType Type, address string, limit, offset int) ([]Transaction, error)

ListForAccount returns all transactions in the datastore for a given account.

func (*Service) UpdateTransaction

func (s *Service) UpdateTransaction(t *Transaction) error

type Store

type Store interface {
	Transactions(opt datastore.ListOptions) ([]Transaction, error)
	Transaction(txId string) (Transaction, error)
	TransactionsForAccount(tType Type, address string, opt datastore.ListOptions) ([]Transaction, error)
	TransactionForAccount(tType Type, address, txId string) (Transaction, error)
	GetOrCreateTransaction(txId string) *Transaction
	InsertTransaction(*Transaction) error
	UpdateTransaction(*Transaction) error
}

Store manages data regarding transactions.

type Transaction

type Transaction struct {
	TransactionId   string         `gorm:"column:transaction_id;primaryKey"`
	TransactionType Type           `gorm:"column:transaction_type;index"`
	ProposerAddress string         `gorm:"column:proposer_address;index"`
	CreatedAt       time.Time      `gorm:"column:created_at"`
	UpdatedAt       time.Time      `gorm:"column:updated_at"`
	DeletedAt       gorm.DeletedAt `gorm:"column:deleted_at;index"`
	Events          []flow.Event   `gorm:"-"`
}

Transaction is the database model for all transactions.

func (Transaction) TableName added in v0.6.0

func (Transaction) TableName() string

func (Transaction) ToJSONResponse added in v0.6.0

func (t Transaction) ToJSONResponse() JSONResponse

type Type

type Type int
const (
	Unknown Type = iota
	General
	FtSetup
	FtTransfer
	NftSetup
	NftTransfer
)

func StatusFromText

func StatusFromText(text string) Type

func (Type) MarshalText

func (s Type) MarshalText() ([]byte, error)

func (Type) String

func (i Type) String() string

func (*Type) UnmarshalText

func (s *Type) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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