relays

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: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RelayDoc

type RelayDoc struct {
	ID   string `bson:"_id"`
	Data struct {
		Status      string     `bson:"status"`
		ReceivedAt  time.Time  `bson:"receivedAt"`
		CompletedAt *time.Time `bson:"completedAt"`
		ToTxHash    *string    `bson:"toTxHash"`
		Metadata    *struct {
			Attempts                 int   `bson:"attempts"`
			ExecutionStartTime       int64 `bson:"executionStartTime"`
			EmitterChain             int   `bson:"emitterChain"`
			DidMatchDeliveryProvider bool  `bson:"didMatchDeliveryProvider"`
			DidParse                 bool  `bson:"didParse"`
			Instructions             struct {
				EncodedExecutionInfo   string `bson:"encodedExecutionInfo"`
				RefundAddress          string `bson:"refundAddress"`
				SourceDeliveryProvider string `bson:"sourceDeliveryProvider"`
				SenderAddress          string `bson:"senderAddress"`
				VaaKeys                []any  `bson:"vaaKeys"`
				ExtraReceiverValue     struct {
					Hex         string `bson:"_hex"`
					IsBigNumber bool   `bson:"_isBigNumber"`
				} `bson:"extraReceiverValue"`
				TargetAddress          string `bson:"targetAddress"`
				RequestedReceiverValue struct {
					Hex         string `bson:"_hex"`
					IsBigNumber bool   `bson:"_isBigNumber"`
				} `bson:"requestedReceiverValue"`
				RefundChainID          int    `bson:"refundChainId"`
				RefundDeliveryProvider string `bson:"refundDeliveryProvider"`
				TargetChainID          int    `bson:"targetChainId"`
			} `bson:"instructions"`
			DeliveryRecord struct {
				MaxRefund                   string   `bson:"maxRefund"`
				Budget                      string   `bson:"budget"`
				TargetChainAssetPriceUSD    float64  `bson:"targetChainAssetPriceUSD"`
				WalletNonce                 int      `bson:"walletNonce"`
				TransactionHashes           []string `bson:"transactionHashes"`
				HasAdditionalVaas           bool     `bson:"hasAdditionalVaas"`
				AdditionalVaasDidFetch      bool     `bson:"additionalVaasDidFetch"`
				WalletAcquisitionEndTime    int64    `bson:"walletAcquisitionEndTime"`
				WalletAcquisitionDidSucceed bool     `bson:"walletAcquisitionDidSucceed"`
				WalletBalanceAfter          string   `bson:"walletBalanceAfter"`
				ResultLog                   struct {
					TransactionHash   string `bson:"transactionHash"`
					VaaHash           string `bson:"vaaHash"`
					RefundStatus      string `bson:"refundStatus"`
					RevertString      string `bson:"revertString"`
					Status            string `bson:"status"`
					GasUsed           string `bson:"gasUsed"`
					SourceChain       string `bson:"sourceChain"`
					SourceVaaSequence string `bson:"sourceVaaSequence"`
				} `bson:"resultLog"`
				ResultString                  string  `bson:"resultString"`
				AdditionalVaaKeysPrintable    string  `bson:"additionalVaaKeysPrintable"`
				BudgetUsd                     float64 `bson:"budgetUsd"`
				WalletAcquisitionStartTime    int64   `bson:"walletAcquisitionStartTime"`
				GasUnitsEstimate              int     `bson:"gasUnitsEstimate"`
				EstimatedTransactionFeeEther  string  `bson:"estimatedTransactionFeeEther"`
				TargetChainDecimals           int     `bson:"targetChainDecimals"`
				DeliveryInstructionsPrintable struct {
					Payload                string `bson:"payload"`
					EncodedExecutionInfo   string `bson:"encodedExecutionInfo"`
					RefundDeliveryProvider string `bson:"refundDeliveryProvider"`
					SourceDeliveryProvider string `bson:"sourceDeliveryProvider"`
					SenderAddress          string `bson:"senderAddress"`
					TargetAddress          string `bson:"targetAddress"`
					RequestedReceiverValue string `bson:"requestedReceiverValue"`
					ExtraReceiverValue     string `bson:"extraReceiverValue"`
					RefundChainID          string `bson:"refundChainId"`
					RefundAddress          string `bson:"refundAddress"`
					VaaKeys                []any  `bson:"vaaKeys"`
					TargetChainID          string `bson:"targetChainId"`
				} `bson:"deliveryInstructionsPrintable"`
				WalletAddress              string  `bson:"walletAddress"`
				GasUsed                    int     `bson:"gasUsed"`
				GasPrice                   string  `bson:"gasPrice"`
				ReceiverValue              string  `bson:"receiverValue"`
				MaxRefundUsd               float64 `bson:"maxRefundUsd"`
				GasPriceEstimate           string  `bson:"gasPriceEstimate"`
				TransactionDidSubmit       bool    `bson:"transactionDidSubmit"`
				EstimatedTransactionFee    string  `bson:"estimatedTransactionFee"`
				TransactionSubmitTimeStart int64   `bson:"transactionSubmitTimeStart"`
				TransactionSubmitTimeEnd   int64   `bson:"transactionSubmitTimeEnd"`
				ResultLogDidParse          bool    `bson:"resultLogDidParse"`
				ChainID                    int     `bson:"chainId"`
				ReceiverValueUsd           float64 `bson:"receiverValueUsd"`
				WalletBalanceBefore        string  `bson:"walletBalanceBefore"`
			} `bson:"deliveryRecord"`
			RawVaaHex            string `bson:"rawVaaHex"`
			PayloadType          int    `bson:"payloadType"`
			MaxAttempts          int    `bson:"maxAttempts"`
			DidError             bool   `bson:"didError"`
			ExecutionEndTime     int64  `bson:"executionEndTime"`
			EmitterAddress       string `bson:"emitterAddress"`
			DidSubmitTransaction bool   `bson:"didSubmitTransaction"`
			Sequence             string `bson:"sequence"`
		} `bson:"metadata"`
		Sequence       string     `bson:"sequence"`
		Vaa            string     `bson:"vaa"`
		FromTxHash     string     `bson:"fromTxHash"`
		MaxAttempts    int        `bson:"maxAttempts"`
		AddedTimes     int        `bson:"addedTimes"`
		ErrorMessage   any        `bson:"errorMessage"`
		EmitterChain   int        `bson:"emitterChain"`
		EmitterAddress string     `bson:"emitterAddress"`
		FailedAt       *time.Time `bson:"failedAt"`
	} `bson:"data"`
	Event  string `bson:"event"`
	Origin string `bson:"origin"`
}

type RelaysQuery

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

func Query

func Query() *RelaysQuery

func (*RelaysQuery) SetChain

func (q *RelaysQuery) SetChain(chainId vaa.ChainID) *RelaysQuery

func (*RelaysQuery) SetEmitter

func (q *RelaysQuery) SetEmitter(emitter string) *RelaysQuery

func (*RelaysQuery) SetSequence

func (q *RelaysQuery) SetSequence(sequence string) *RelaysQuery

type Repository

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

func NewRepository

func NewRepository(db *mongo.Database, logger *zap.Logger) *Repository

func (*Repository) FindOne

func (r *Repository) FindOne(ctx context.Context, q *RelaysQuery) (*RelayDoc, error)

type Service

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

func NewService

func NewService(dao *Repository, logger *zap.Logger) *Service

NewService create a new Service.

func (*Service) FindByVAA

func (s *Service) FindByVAA(
	ctx context.Context,
	chainID vaa.ChainID,
	emitterAddr *types.Address,
	seq string,
) (*RelayDoc, error)

Find by VAA by chainID, emitter address, sequence

Jump to

Keyboard shortcuts

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