Documentation ¶
Index ¶
- Variables
- func MakeGetAssetsEndpoint(s Service) endpoint.Endpoint
- func MakeGetBalanceEndpoint(s Service) endpoint.Endpoint
- func MakeGetNFTsEndpoint(s Service) endpoint.Endpoint
- func MakeGetTokenBalanceEndpoint(s Service) endpoint.Endpoint
- func MakeHTTPHandler(e Endpoints, log logger) http.Handler
- type Balance
- type BalanceResponse
- type Endpoints
- type GetTokenBalanceRequest
- type NFTsResponse
- type Service
- type TokenBalanceResponse
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidParameter = errors.New("invalid parameter") ErrNotFound = errors.New("not found") )
Predefined package errors
Functions ¶
func MakeGetAssetsEndpoint ¶
MakeGetAssetsEndpoint returns an endpoint function for the GetAssets method.
func MakeGetBalanceEndpoint ¶
MakeGetBalanceEndpoint returns an endpoint function for the GetBalance method.
func MakeGetNFTsEndpoint ¶
MakeGetNFTsEndpoint returns an endpoint function for the GetNFTs method.
func MakeGetTokenBalanceEndpoint ¶
MakeGetTokenBalanceEndpoint returns an endpoint function for the GetTokenBalance method.
func MakeHTTPHandler ¶
MakeHTTPHandler ...
Types ¶
type Balance ¶
type Balance struct { Pubkey string Mint string IsNative bool Balance types.TokenAmount Metadata *metadata.Metadata }
Balance is a type that represents a token/SOL balance of a wallet. It includes the token metadata.
type BalanceResponse ¶
type BalanceResponse struct {
Balances []Balance `json:"balances"`
}
type Endpoints ¶
type Endpoints struct { GetBalance endpoint.Endpoint GetAssets endpoint.Endpoint GetNFTs endpoint.Endpoint GetTokenBalance endpoint.Endpoint }
Endpoints collection of profile service
func MakeEndpoints ¶
func MakeEndpoints(s Service, m ...endpoint.Middleware) Endpoints
Init endpoints
type GetTokenBalanceRequest ¶
type GetTokenBalanceRequest struct { WalletAddr string `json:"wallet_addr"` TokenMint string `json:"mint"` }
GetTokenBalanceRequest is a request payload for the GetTokenBalance method.
type NFTsResponse ¶
type NFTsResponse struct {
NFTs []token_metadata.Metadata `json:"nfts"`
}
NFTsResponse is a response for the GetNFTs method.
type Service ¶
type Service interface { // GetSOLBalance returns the SOL balance of a wallet GetSOLBalance(ctx context.Context, walletAddr string) (Balance, error) // Get balance for specified token GetTokenBalance(ctx context.Context, walletAddr, tokenMint string) (types.TokenAmount, error) // Get balance for all fungible tokens GetFungibleTokens(ctx context.Context, walletAddr string) ([]Balance, error) // Get balance for all fungible assets GetFungibleAssets(ctx context.Context, walletAddr string) ([]Balance, error) // Get all non-fungible tokens GetNonFungibleTokens(ctx context.Context, walletAddr string) ([]token_metadata.Metadata, error) }
Service interface
func NewService ¶
func NewService(solana solanaClient) Service
NewService is a factory function, returns a new instance of the Service interface implementation
type TokenBalanceResponse ¶
type TokenBalanceResponse struct {
Balance types.TokenAmount `json:"balance"`
}