submitter

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Keypair        keypair.KP
	Seed           string
	SequenceNumber uint64
	Mutex          sync.Mutex
}

Account represents account used to signing and sending transactions

type TransactionSubmitter

type TransactionSubmitter struct {
	Aurora        hc.ClientInterface
	Accounts      map[string]*Account // seed => *Account
	AccountsMutex sync.Mutex
	Database      db.Database
	Network       string
	// contains filtered or unexported fields
}

TransactionSubmitter submits transactions to HcNet Network

func NewTransactionSubmitter

func NewTransactionSubmitter(
	aurora hc.ClientInterface,
	database db.Database,
	networkPassphrase string,
	now func() time.Time,
) (ts TransactionSubmitter)

NewTransactionSubmitter creates a new TransactionSubmitter

func (*TransactionSubmitter) InitAccount

func (ts *TransactionSubmitter) InitAccount(seed string) (err error)

InitAccount loads an account and returns error if it fails

func (*TransactionSubmitter) LoadAccount

func (ts *TransactionSubmitter) LoadAccount(seed string) (*Account, error)

LoadAccount loads current state of HcNet account and creates a map entry if it didn't exist

func (*TransactionSubmitter) SignAndSubmitRawTransaction

func (ts *TransactionSubmitter) SignAndSubmitRawTransaction(paymentID *string, seed string, tx *xdr.Transaction) (response hProtocol.TransactionSuccess, err error)

SignAndSubmitRawTransaction will: - update sequence number of the transaction to the current one, - sign it, - submit it to the network.

func (*TransactionSubmitter) SubmitAndSave

func (ts *TransactionSubmitter) SubmitAndSave(paymentID *string, sourceAccount, txeB64, txHash string) (response hProtocol.TransactionSuccess, err error)

SubmitAndSave sumbits a transaction to aurora and saves the details in the bridge server database.

func (*TransactionSubmitter) SubmitTransaction

func (ts *TransactionSubmitter) SubmitTransaction(paymentID *string, seed string, operation []txnbuild.Operation, memo txnbuild.Memo) (hProtocol.TransactionSuccess, error)

SubmitTransaction builds and submits transaction to HcNet network

type TransactionSubmitterInterface

type TransactionSubmitterInterface interface {
	SubmitTransaction(paymentID *string, seed string, operation []txnbuild.Operation, memo txnbuild.Memo) (response hProtocol.TransactionSuccess, err error)
	SignAndSubmitRawTransaction(paymentID *string, seed string, tx *xdr.Transaction) (response hProtocol.TransactionSuccess, err error)
}

TransactionSubmitterInterface helps mocking TransactionSubmitter

Jump to

Keyboard shortcuts

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