parser

package
v0.0.0-...-efbd42f Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 9 Imported by: 9

Documentation

Index

Constants

View Source
const DefaultTimeout = 10

Variables

View Source
var (
	ErrCallEndpoint        = errors.New("ERROR CALL ENPOINT")
	ErrNotFound            = errors.New("NOT FOUND")
	ErrInternalError       = errors.New("INTERNAL ERROR")
	ErrUnproceesableEntity = errors.New("UNPROCESSABLE")
	ErrBadRequest          = errors.New("BAD REQUEST")
)

Functions

This section is empty.

Types

type ParseData

type ParseData struct {
	PayloadID int `bson:"payloadid"`
	Fields    interface{}
}

type ParseVaaFunc

type ParseVaaFunc func(vaa *sdk.VAA) (*ParseVaaWithStandarizedPropertiesdResponse, error)

ParseVaaFunc represent a parse vaa function.

type ParseVaaResponse

type ParseVaaResponse struct {
	ChainID        uint16      `json:"chainId"`
	EmitterAddress string      `json:"address"`
	Sequence       string      `json:"sequence"`
	AppID          string      `json:"appId"`
	Result         interface{} `json:"result"`
}

ParseVaaResponse represent a parse vaa response.

type ParseVaaWithStandarizedPropertiesdResponse

type ParseVaaWithStandarizedPropertiesdResponse struct {
	ParsedPayload          interface{}            `json:"parsedPayload"`
	StandardizedProperties StandardizedProperties `json:"standardizedProperties"`
}

ParseVaaWithStandarizedPropertiesdResponse represent a parse vaa response.

type ParserVAAAPIClient

type ParserVAAAPIClient struct {
	Client  http.Client
	BaseURL string
	Logger  *zap.Logger
}

ParserVAAAPIClient parse vaa api client.

func NewParserVAAAPIClient

func NewParserVAAAPIClient(timeout int64, baseURL string, logger *zap.Logger) (ParserVAAAPIClient, error)

NewParserVAAAPIClient create new instances of ParserVAAAPIClient.

func (ParserVAAAPIClient) ParsePayload

func (c ParserVAAAPIClient) ParsePayload(chainID uint16, address, sequence string, vaa []byte) (*ParseVaaResponse, error)

ParsePayload invoke the endpoint to parse a VAA from the VAAParserAPI.

func (*ParserVAAAPIClient) ParseVaaWithStandarizedProperties

func (c *ParserVAAAPIClient) ParseVaaWithStandarizedProperties(vaa *sdk.VAA) (*ParseVaaWithStandarizedPropertiesdResponse, error)

ParseVaaWithStandarizedProperties invoke the endpoint to parse a VAA from the VAAParserAPI.

type StandardizedProperties

type StandardizedProperties struct {
	AppIds       []string    `json:"appIds" bson:"appIds"`
	FromChain    sdk.ChainID `json:"fromChain" bson:"fromChain"`
	FromAddress  string      `json:"fromAddress" bson:"fromAddress"`
	ToChain      sdk.ChainID `json:"toChain" bson:"toChain"`
	ToAddress    string      `json:"toAddress" bson:"toAddress"`
	TokenChain   sdk.ChainID `json:"tokenChain" bson:"tokenChain"`
	TokenAddress string      `json:"tokenAddress" bson:"tokenAddress"`
	Amount       string      `json:"amount" bson:"amount"`
	FeeAddress   string      `json:"feeAddress" bson:"feeAddress"`
	FeeChain     sdk.ChainID `json:"feeChain" bson:"feeChain"`
	Fee          string      `json:"fee" bson:"fee"`
}

StandardizedProperties represent a standardized properties.

Jump to

Keyboard shortcuts

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