tss

package
v0.0.0-...-43207eb Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func UnmarshallTransactionResultXDR

func UnmarshallTransactionResultXDR(resultXDR string) (xdr.TransactionResult, error)

Types

type Channel

type Channel interface {
	Send(payload Payload)
	Receive(payload Payload)
	Stop()
}

type MockChannel

type MockChannel struct {
	mock.Mock
}

func (*MockChannel) Receive

func (m *MockChannel) Receive(payload Payload)

func (*MockChannel) Send

func (m *MockChannel) Send(payload Payload)

func (*MockChannel) Stop

func (m *MockChannel) Stop()

type OtherCodes

type OtherCodes int32
const (
	// Do not use NoCode
	NoCode OtherCodes = 0
	// These values need to not overlap the values in xdr.TransactionResultCode
	NewCode             OtherCodes = 100
	RPCFailCode         OtherCodes = 101
	UnmarshalBinaryCode OtherCodes = 102
	EmptyCode           OtherCodes = 103
)

type OtherStatus

type OtherStatus string
const (
	NewStatus     OtherStatus = "NEW"
	NoStatus      OtherStatus = ""
	SentStatus    OtherStatus = "SENT"
	NotSentStatus OtherStatus = "NOT_SENT"
)

type Payload

type Payload struct {
	WebhookURL string
	// The hash of the transaction xdr submitted by the client - the id of the transaction submitted by a client
	TransactionHash string
	// The xdr of the transaction
	TransactionXDR string
	// Relevant fields in an RPC sendTransaction response
	RpcSubmitTxResponse RPCSendTxResponse
	// Relevant fields in the transaction list inside the RPC getTransactions response
	RpcGetIngestTxResponse RPCGetIngestTxResponse
}

type RPCGetIngestTxResponse

type RPCGetIngestTxResponse struct {
	// A status that indicated whether this transaction failed or successly made it to the ledger
	Status entities.RPCStatus
	// The error code that is derived by deserialzing the ResultXdr string in the sendTransaction response
	// list of possible errror codes: https://developers.stellar.org/docs/data/horizon/api-reference/errors/result-codes/transactions
	Code RPCTXCode
	// The raw TransactionEnvelope XDR for this transaction
	EnvelopeXDR string
	// The raw TransactionResult XDR of the envelopeXdr
	ResultXDR string
	// The unix timestamp of when the transaction was included in the ledger
	CreatedAt int64
}

func ParseToRPCGetIngestTxResponse

func ParseToRPCGetIngestTxResponse(result entities.RPCGetTransactionResult, err error) (RPCGetIngestTxResponse, error)

type RPCSendTxResponse

type RPCSendTxResponse struct {
	// The hash of the transaction submitted to RPC
	TransactionHash string
	TransactionXDR  string
	// The status of an RPC sendTransaction call. Can be one of [PENDING, DUPLICATE, TRY_AGAIN_LATER, ERROR]
	Status RPCTXStatus
	// The (optional) error code that is derived by deserialzing the errorResultXdr string in the sendTransaction response
	// list of possible errror codes: https://developers.stellar.org/docs/data/horizon/api-reference/errors/result-codes/transactions
	Code           RPCTXCode
	ErrorResultXDR string
}

func ParseToRPCSendTxResponse

func ParseToRPCSendTxResponse(transactionXDR string, result entities.RPCSendTransactionResult, err error) (RPCSendTxResponse, error)

type RPCTXCode

type RPCTXCode struct {
	TxResultCode xdr.TransactionResultCode
	OtherCodes   OtherCodes
}

func TransactionResultXDRToCode

func TransactionResultXDRToCode(errorResultXDR string) (RPCTXCode, error)

func (RPCTXCode) Code

func (c RPCTXCode) Code() int

type RPCTXStatus

type RPCTXStatus struct {
	RPCStatus   entities.RPCStatus
	OtherStatus OtherStatus
}

func (RPCTXStatus) Status

func (s RPCTXStatus) Status() string

type TSSResponse

type TSSResponse struct {
	TransactionHash       string `json:"tx_hash"`
	TransactionResultCode string `json:"tx_result_code"`
	Status                string `json:"status"`
	CreatedAt             int64  `json:"created_at"`
	EnvelopeXDR           string `json:"envelopeXdr"`
	ResultXDR             string `json:"resultXdr"`
}

type TransactionResultCode

type TransactionResultCode int32

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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