Skip to content

Commit 41a500b

Browse files
committed
add UnimplementedSolanaService
1 parent d80daab commit 41a500b

File tree

2 files changed

+50
-12
lines changed

2 files changed

+50
-12
lines changed

pkg/loop/internal/example-relay/main.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,6 @@ type relayer struct {
7474

7575
func (r *relayer) Name() string { return r.lggr.Name() }
7676

77-
func (r *relayer) EVM() (types.EVMService, error) {
78-
return nil, nil
79-
}
80-
81-
func (r *relayer) TON() (types.TONService, error) {
82-
return nil, nil
83-
}
84-
85-
func (r *relayer) Solana() (types.SolanaService, error) {
86-
return nil, nil
87-
}
88-
8977
func (r *relayer) Start(ctx context.Context) error {
9078
var names []string
9179
// Test database connection with dummy query

pkg/types/relayer.go

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,3 +481,53 @@ func (ues *UnimplementedEVMService) GetTransactionStatus(ctx context.Context, tr
481481
func (ues *UnimplementedEVMService) GetForwarderForEOA(ctx context.Context, eoa, ocr2AggregatorID evm.Address, pluginType string) (forwarder evm.Address, err error) {
482482
return evm.Address{}, status.Errorf(codes.Unimplemented, "method GetForwarderForEOA not implemented")
483483
}
484+
485+
var _ SolanaService = &UnimplementedSolanaService{}
486+
487+
// UnimplementedSolanaService implements the SolanaService interface with stubbed methods that return codes.Unimplemented errors or panic.
488+
// It is meant to be embedded in real SolanaService implementations in order to get default behavior for new methods without having
489+
// to react to each change.
490+
// In the future, embedding this type may be required to implement SolanaService (through use of an unexported method).
491+
type UnimplementedSolanaService struct{}
492+
493+
func (uss *UnimplementedSolanaService) SubmitTransaction(ctx context.Context, req solana.SubmitTransactionRequest) (*solana.SubmitTransactionReply, error) {
494+
return nil, status.Errorf(codes.Unimplemented, "method SubmitTransaction not implemented")
495+
}
496+
497+
func (uss *UnimplementedSolanaService) RegisterLogTracking(ctx context.Context, req solana.LPFilterQuery) error {
498+
return status.Errorf(codes.Unimplemented, "method RegisterLogTracking not implemented")
499+
}
500+
501+
func (uss *UnimplementedSolanaService) UnregisterLogTracking(ctx context.Context, filterName string) error {
502+
return status.Errorf(codes.Unimplemented, "method UnregisterLogTracking not implemented")
503+
}
504+
func (uss *UnimplementedSolanaService) QueryTrackedLogs(ctx context.Context, filterQuery []query.Expression, limitAndSort query.LimitAndSort) ([]*solana.Log, error) {
505+
return nil, status.Errorf(codes.Unimplemented, "method QueryTrackedLogs not implemented")
506+
}
507+
func (uss *UnimplementedSolanaService) GetBalance(ctx context.Context, req solana.GetBalanceRequest) (*solana.GetBalanceReply, error) {
508+
return nil, status.Errorf(codes.Unimplemented, "method GetBalance not implemented")
509+
}
510+
func (uss *UnimplementedSolanaService) GetAccountInfoWithOpts(ctx context.Context, req solana.GetAccountInfoRequest) (*solana.GetAccountInfoReply, error) {
511+
return nil, status.Errorf(codes.Unimplemented, "method GetAccountInfoWithOpts not implemented")
512+
}
513+
func (uss *UnimplementedSolanaService) GetMultipleAccountsWithOpts(ctx context.Context, req solana.GetMultipleAccountsRequest) (*solana.GetMultipleAccountsReply, error) {
514+
return nil, status.Errorf(codes.Unimplemented, "method GetMultipleAccountsWithOpts not implemented")
515+
}
516+
func (uss *UnimplementedSolanaService) GetBlock(ctx context.Context, req solana.GetBlockRequest) (*solana.GetBlockReply, error) {
517+
return nil, status.Errorf(codes.Unimplemented, "method GetBlock not implemented")
518+
}
519+
func (uss *UnimplementedSolanaService) GetSlotHeight(ctx context.Context, req solana.GetSlotHeightRequest) (*solana.GetSlotHeightReply, error) {
520+
return nil, status.Errorf(codes.Unimplemented, "method GetSlotHeight not implemented")
521+
}
522+
func (uss *UnimplementedSolanaService) GetTransaction(ctx context.Context, req solana.GetTransactionRequest) (*solana.GetTransactionReply, error) {
523+
return nil, status.Errorf(codes.Unimplemented, "method GetTransaction not implemented")
524+
}
525+
func (uss *UnimplementedSolanaService) GetFeeForMessage(ctx context.Context, req solana.GetFeeForMessageRequest) (*solana.GetFeeForMessageReply, error) {
526+
return nil, status.Errorf(codes.Unimplemented, "method GetFeeForMessage not implemented")
527+
}
528+
func (uss *UnimplementedSolanaService) GetSignatureStatuses(ctx context.Context, req solana.GetSignatureStatusesRequest) (*solana.GetSignatureStatusesReply, error) {
529+
return nil, status.Errorf(codes.Unimplemented, "method GetSignatureStatuses not implemented")
530+
}
531+
func (uss *UnimplementedSolanaService) SimulateTX(ctx context.Context, req solana.SimulateTXRequest) (*solana.SimulateTXReply, error) {
532+
return nil, status.Errorf(codes.Unimplemented, "method SimulateTX not implemented")
533+
}

0 commit comments

Comments
 (0)