Documentation ¶
Index ¶
- func AccountBalance(block *types.BlockIdentifier, balances []*types.Balance) error
- func AccountBalanceRequest(request *types.AccountBalanceRequest) error
- func AccountIdentifier(account *types.AccountIdentifier) error
- func Amount(amount *types.Amount) error
- func BlockIdentifier(blockIdentifier *types.BlockIdentifier) error
- func BlockRequest(request *types.BlockRequest) error
- func BlockTransactionRequest(request *types.BlockTransactionRequest) error
- func Error(err *types.Error) error
- func Errors(rosettaErrors []*types.Error) error
- func MempoolRequest(request *types.MempoolRequest) error
- func MempoolTransactionRequest(request *types.MempoolTransactionRequest) error
- func MempoolTransactions(transactions []*types.TransactionIdentifier) error
- func NetworkIdentifier(network *types.NetworkIdentifier) error
- func NetworkInformation(networkInformation *types.NetworkInformation) error
- func NetworkOptions(options *types.Options) error
- func NetworkStatus(networkStatus *types.NetworkStatus) error
- func NetworkStatusRequest(request *types.NetworkStatusRequest) error
- func NetworkStatusResponse(response *types.NetworkStatusResponse) error
- func OperationIdentifier(identifier *types.OperationIdentifier, index int64) error
- func OperationStatuses(statuses []*types.OperationStatus) error
- func PartialBlockIdentifier(blockIdentifier *types.PartialBlockIdentifier) error
- func Peer(peer *types.Peer) error
- func StringArray(arrName string, arr []string) error
- func SubNetworkIdentifier(subNetworkIdentifier *types.SubNetworkIdentifier) error
- func Timestamp(timestamp int64) error
- func TransactionConstruction(response *types.TransactionConstructionResponse) error
- func TransactionConstructionRequest(request *types.TransactionConstructionRequest) error
- func TransactionIdentifier(transactionIdentifier *types.TransactionIdentifier) error
- func TransactionSubmitRequest(request *types.TransactionSubmitRequest) error
- func Version(version *types.Version) error
- type Asserter
- func (a *Asserter) Block(block *types.Block) error
- func (a *Asserter) Operation(operation *types.Operation, index int64) error
- func (a *Asserter) OperationSuccessful(operation *types.Operation) (bool, error)
- func (a *Asserter) Transaction(transaction *types.Transaction) error
- func (a *Asserter) TransactionSubmit(response *types.TransactionSubmitResponse) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccountBalance ¶
func AccountBalance( block *types.BlockIdentifier, balances []*types.Balance, ) error
AccountBalance returns an error if the provided types.BlockIdentifier is invalid, if the same types.AccountIdentifier appears in multiple types.Balance structs (should be consolidated), or if a types.Balance is considered invalid.
func AccountBalanceRequest ¶ added in v0.1.0
func AccountBalanceRequest(request *types.AccountBalanceRequest) error
AccountBalanceRequest ensures that a types.AccountBalanceRequest is well-formatted.
func AccountIdentifier ¶
func AccountIdentifier(account *types.AccountIdentifier) error
AccountIdentifier returns an error if a types.AccountIdentifier is missing an address or a provided SubAccount is missing an identifier.
func BlockIdentifier ¶
func BlockIdentifier(blockIdentifier *types.BlockIdentifier) error
BlockIdentifier ensures a types.BlockIdentifier is well-formatted.
func BlockRequest ¶ added in v0.1.0
func BlockRequest(request *types.BlockRequest) error
BlockRequest ensures that a types.BlockRequest is well-formatted.
func BlockTransactionRequest ¶ added in v0.1.0
func BlockTransactionRequest(request *types.BlockTransactionRequest) error
BlockTransactionRequest ensures that a types.BlockTransactionRequest is well-formatted.
func Errors ¶ added in v0.0.4
Errors ensures each types.Error in a slice is valid and that there is no error code collision.
func MempoolRequest ¶ added in v0.1.0
func MempoolRequest(request *types.MempoolRequest) error
MempoolRequest ensures that a types.MempoolRequest is well-formatted.
func MempoolTransactionRequest ¶ added in v0.1.0
func MempoolTransactionRequest(request *types.MempoolTransactionRequest) error
MempoolTransactionRequest ensures that a types.MempoolTransactionRequest is well-formatted.
func MempoolTransactions ¶
func MempoolTransactions( transactions []*types.TransactionIdentifier, ) error
MempoolTransactions returns an error if any types.TransactionIdentifier returns is missing a hash. The correctness of each populated MempoolTransaction is asserted by Transaction.
func NetworkIdentifier ¶
func NetworkIdentifier(network *types.NetworkIdentifier) error
NetworkIdentifier ensures a types.NetworkIdentifier has a valid blockchain and network.
func NetworkInformation ¶
func NetworkInformation(networkInformation *types.NetworkInformation) error
NetworkInformation ensures any types.NetworkInformation included in types.NetworkStatus or types.SubNetworkStatus is valid.
func NetworkOptions ¶
NetworkOptions ensures a types.Options object is valid.
func NetworkStatus ¶
func NetworkStatus(networkStatus *types.NetworkStatus) error
NetworkStatus ensures a types.NetworkStatus object is valid.
func NetworkStatusRequest ¶ added in v0.1.0
func NetworkStatusRequest(request *types.NetworkStatusRequest) error
NetworkStatusRequest ensures that a types.NetworkStatusRequest is well-formatted.
func NetworkStatusResponse ¶
func NetworkStatusResponse(response *types.NetworkStatusResponse) error
NetworkStatusResponse orchestrates assertions for all components of a types.NetworkStatus.
func OperationIdentifier ¶
func OperationIdentifier( identifier *types.OperationIdentifier, index int64, ) error
OperationIdentifier returns an error if index of the types.Operation is out-of-order or if the NetworkIndex is invalid.
func OperationStatuses ¶
func OperationStatuses(statuses []*types.OperationStatus) error
OperationStatuses ensures all items in Options.OperationStatuses are valid and that there exists at least 1 successful status.
func PartialBlockIdentifier ¶ added in v0.1.0
func PartialBlockIdentifier(blockIdentifier *types.PartialBlockIdentifier) error
PartialBlockIdentifier ensures a types.PartialBlockIdentifier is well-formatted.
func StringArray ¶
StringArray ensures all strings in an array are non-empty strings.
func SubNetworkIdentifier ¶
func SubNetworkIdentifier(subNetworkIdentifier *types.SubNetworkIdentifier) error
SubNetworkIdentifier asserts a types.SubNetworkIdentifer is valid (if not nil).
func TransactionConstruction ¶
func TransactionConstruction( response *types.TransactionConstructionResponse, ) error
TransactionConstruction returns an error if the NetworkFee is not a valid types.Amount.
func TransactionConstructionRequest ¶ added in v0.1.0
func TransactionConstructionRequest(request *types.TransactionConstructionRequest) error
TransactionConstructionRequest ensures that a types.TransactionConstructionRequest is well-formatted.
func TransactionIdentifier ¶
func TransactionIdentifier( transactionIdentifier *types.TransactionIdentifier, ) error
TransactionIdentifier returns an error if a types.TransactionIdentifier has an invalid hash.
func TransactionSubmitRequest ¶ added in v0.1.0
func TransactionSubmitRequest(request *types.TransactionSubmitRequest) error
TransactionSubmitRequest ensures that a types.TransactionSubmitRequest is well-formatted.
Types ¶
type Asserter ¶
type Asserter struct {
// contains filtered or unexported fields
}
Asserter contains all logic to perform static validation on Rosetta Server responses.
func NewOptions ¶ added in v0.0.4
func NewOptions( ctx context.Context, genesisBlockIdentifier *types.BlockIdentifier, operationTypes []string, operationStatuses []*types.OperationStatus, errors []*types.Error, ) *Asserter
NewOptions constructs a new Asserter using the provided arguments instead of using a types.NetworkStatusResponse.
func (*Asserter) Operation ¶
Operation ensures a types.Operation has a valid type, status, and amount.
func (*Asserter) OperationSuccessful ¶
OperationSuccessful returns a boolean indicating if a types.Operation is successful and should be applied in a transaction. This should only be called AFTER an operation has been validated.
func (*Asserter) Transaction ¶
func (a *Asserter) Transaction( transaction *types.Transaction, ) error
Transaction returns an error if the types.TransactionIdentifier is invalid, if any types.Operation within the types.Transaction is invalid, or if any operation index is reused within a transaction.
func (*Asserter) TransactionSubmit ¶
func (a *Asserter) TransactionSubmit( response *types.TransactionSubmitResponse, ) error
TransactionSubmit returns an error if the types.TransactionIdentifier in the response is not valid or if the Submission.Status is not contained within the provided validStatuses slice.