Documentation ¶
Overview ¶
The NFTAssetRepo package provides a set of functions for interacting with a remote IPFS repository custom built to exclusively host NFT assets for the ComicCoin blockchain. It allows users to retrieve the version of the NFT store service, pin files, and retrieve files.
Index ¶
- func NewNFTAssetRepo(cfg NFTAssetRepoConfigurationProvider, logger *slog.Logger) domain.NFTAssetRepository
- func NewNFTAssetRepoWithConfiguration(logger *slog.Logger, remoteAddress string, apiKey string) domain.NFTAssetRepository
- type LastestTokenIDRepo
- type NFTAssetRepo
- type NFTAssetRepoConfigurationProvider
- type NFTAssetRepoConfigurationProviderImpl
- type TokenRepo
- func (r *TokenRepo) CommitTransaction() error
- func (r *TokenRepo) DeleteByTokenID(tokenID uint64) error
- func (r *TokenRepo) DiscardTransaction()
- func (r *TokenRepo) GetByTokenID(tokenID uint64) (*domain.Token, error)
- func (r *TokenRepo) ListAll() ([]*domain.Token, error)
- func (r *TokenRepo) OpenTransaction() error
- func (r *TokenRepo) Upsert(token *domain.Token) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNFTAssetRepo ¶
func NewNFTAssetRepo(cfg NFTAssetRepoConfigurationProvider, logger *slog.Logger) domain.NFTAssetRepository
NewNFTAssetRepo initializes a new NFTAssetRepo instance with the provided configuration and logger.
func NewNFTAssetRepoWithConfiguration ¶
func NewNFTAssetRepoWithConfiguration(logger *slog.Logger, remoteAddress string, apiKey string) domain.NFTAssetRepository
NewNFTAssetRepoWithConfiguration initializes a new NFTAssetRepo instance directly with address and API key.
Types ¶
type LastestTokenIDRepo ¶
type LastestTokenIDRepo struct {
// contains filtered or unexported fields
}
func NewLastestTokenIDRepo ¶
func NewLastestTokenIDRepo(logger *slog.Logger, db disk.Storage) *LastestTokenIDRepo
func (*LastestTokenIDRepo) CommitTransaction ¶
func (r *LastestTokenIDRepo) CommitTransaction() error
func (*LastestTokenIDRepo) DiscardTransaction ¶
func (r *LastestTokenIDRepo) DiscardTransaction()
func (*LastestTokenIDRepo) Get ¶
func (r *LastestTokenIDRepo) Get() (uint64, error)
func (*LastestTokenIDRepo) OpenTransaction ¶
func (r *LastestTokenIDRepo) OpenTransaction() error
func (*LastestTokenIDRepo) Set ¶
func (r *LastestTokenIDRepo) Set(tokenID uint64) error
type NFTAssetRepo ¶
type NFTAssetRepo struct {
// contains filtered or unexported fields
}
NFTAssetRepo handles interactions with a remote IPFS service.
func (*NFTAssetRepo) Get ¶
Get retrieves content from the IPFS service by a given CID. This method constructs the URL for the IPFS gateway and fetches the content.
func (*NFTAssetRepo) PinAddViaFilepath ¶
PinAddViaFilepath uploads a file to IPFS via the specified file path and pins it. The function prepares a multipart form request with the file content and metadata, and sends it.
type NFTAssetRepoConfigurationProvider ¶
type NFTAssetRepoConfigurationProvider interface { GetNFTAssetNodeAddress() string // Retrieves the remote IPFS service address GetNFTAssetNodeAPIKey() string // Retrieves the API key for authentication }
NFTAssetRepoConfigurationProvider is an interface for configuration providers that provide remote address and API key needed for IPFS interaction.
func NewNFTAssetRepoConfigurationProvider ¶
func NewNFTAssetRepoConfigurationProvider(remoteAddress string, apiKey string) NFTAssetRepoConfigurationProvider
NewNFTAssetRepoConfigurationProvider constructs a new configuration provider for IPFS connections with the specified remote address and API key.
type NFTAssetRepoConfigurationProviderImpl ¶
type NFTAssetRepoConfigurationProviderImpl struct {
// contains filtered or unexported fields
}
NFTAssetRepoConfigurationProviderImpl is a struct that implements NFTAssetRepoConfigurationProvider for storing IPFS connection details.
func (*NFTAssetRepoConfigurationProviderImpl) GetNFTAssetNodeAPIKey ¶
func (impl *NFTAssetRepoConfigurationProviderImpl) GetNFTAssetNodeAPIKey() string
GetNFTAssetNodeAPIKey retrieves the API key for IPFS service authentication.
func (*NFTAssetRepoConfigurationProviderImpl) GetNFTAssetNodeAddress ¶
func (impl *NFTAssetRepoConfigurationProviderImpl) GetNFTAssetNodeAddress() string
GetNFTAssetNodeAddress retrieves the remote IPFS service address.
type TokenRepo ¶
type TokenRepo struct {
// contains filtered or unexported fields
}
func NewTokenRepo ¶
func (*TokenRepo) CommitTransaction ¶
func (*TokenRepo) DeleteByTokenID ¶
func (*TokenRepo) DiscardTransaction ¶
func (r *TokenRepo) DiscardTransaction()