Documentation ¶
Index ¶
- type Alien
- type FightDb
- type FightDto
- type Nft
- type Store
- func (s Store) CreateFight(fight FightDto, hunterUser UserNfts, zombieUser UserNfts, mintingUser User) (int, error)
- func (s Store) GetAlienByFightId(fightId int) (*Alien, error)
- func (s Store) GetFightForPaymentLastFifteen(lovelace int64) (*FightDb, error)
- func (s Store) GetFightForUtxo(utxo string, index int) ([]FightDb, error)
- func (s Store) GetFightsForUser(user User) ([]FightDb, error)
- func (s Store) GetFightsForUserAndId(user User, fightId int) ([]FightDb, error)
- func (s Store) GetListedNftByName(name string) ([]UserNfts, error)
- func (s Store) GetListedNfts(nftType string, limit int, random bool) ([]UserNfts, error)
- func (s Store) GetListedNftsByName(nftType string, name string) ([]UserNfts, error)
- func (s Store) GetMintedFights() ([]FightDb, error)
- func (s Store) GetNextAvailableAlien() (*Alien, error)
- func (s Store) GetNftByName(name string) (*Nft, error)
- func (s Store) GetNftHighestPercentMinimum(minimum int, limit int) ([]Nft, error)
- func (s Store) GetNftMostLoses(limit int) ([]Nft, error)
- func (s Store) GetNftMostWins(limit int) ([]Nft, error)
- func (s Store) GetNftsOwnedByUser(userID int) ([]UserNfts, error)
- func (s Store) GetQueuedFight() ([]FightDb, error)
- func (s Store) GetStagedFights() ([]FightDb, error)
- func (s Store) GetUserByID(userID int) (*User, error)
- func (s Store) GetUserByNftkeyID(nftKeyUserID string) (*User, error)
- func (s Store) InsertUser(nftkeyID, accessToken, refreshToken string) error
- func (s Store) InsertZcNftOwnedByUser(userID int, nftID int) error
- func (s Store) MoveFightFromMintedToConfirmed(ctx context.Context, fightID int) error
- func (s Store) MoveFightFromPendingToQueued(ctx context.Context, fightID int, alienID int, utxo string, utxoIndex int) error
- func (s Store) MoveFightFromQueuedToStaged(ctx context.Context, alienID int, alienIpfs string, fightID int, ...) error
- func (s Store) MoveFightFromStagedToMinted(ctx context.Context, fightID int, txHash string) error
- func (s Store) RemoveZcNftNotOwnedByUser(userID int, nftID int) error
- func (s Store) RemoveZcNftOwnedByUser(userID int, nftID int) error
- func (s Store) SetLastAssetCheckTime(nftkeyID string, now time.Time) error
- func (s Store) UpdateNftListPrice(listPrice *int16, userID, nftID int) error
- func (s Store) UpdateTweetID(ctx context.Context, fightID int, tweetID string) error
- func (s Store) UpdatedUser(nftkeyID, accessToken, refreshToken string) error
- type User
- type UserNfts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alien ¶
type Alien struct { ID int `db:"id"` FightID sql.NullInt64 `db:"fight_id"` Ipfs sql.NullString `db:"ipfs_hash"` Name string `db:"name"` ReadableName string `db:"readable_name"` Background string `db:"background"` Skin string `db:"skin"` Clothes string `db:"clothes"` Eyes string `db:"eyes"` Mouth string `db:"mouth"` Hand string `db:"hand"` Hat string `db:"hat"` Collection string `db:"collection"` Site string `db:"site"` Twitter string `db:"twitter"` Copyright string `db:"copyright"` }
Alient struct for zfc alien
type FightDb ¶
type FightDb struct { ID int `db:"id"` ZombieName string `db:"zombie_name"` HunterName string `db:"hunter_name"` Status string `db:"status"` CreatedDate time.Time `db:"created_date"` MintedDate sql.NullTime `db:"minted_date"` PaymentAmountLovelace int64 `db:"payment_amount_lovelace"` PaymentAddress string `db:"payment_address"` IncomingUtxo sql.NullString `db:"incoming_utxo"` IncomingUtxoInt sql.NullInt64 `db:"incoming_utxo_index"` IPFS sql.NullString `db:"ipfs_fight"` IPFSAlien sql.NullString `db:"ipfs_alien"` Background sql.NullString `db:"background"` ZombieLifeBar sql.NullInt64 `db:"zclifebar"` HunterLifeBar sql.NullInt64 `db:"zhlifebar"` ZombieRecord sql.NullString `db:"zombie_record"` HunterRecord sql.NullString `db:"hunter_record"` ZombieKo sql.NullBool `db:"zombie_ko"` HunterKo sql.NullBool `db:"hunter_ko"` Collection string `db:"collection"` Site string `db:"site"` Twitter string `db:"twitter"` Copyright string `db:"copyright"` HunterAmountAda int `db:"hunter_amount_ada"` HunterSendAddress sql.NullString `db:"hunter_send_address"` ZombieAmountAda int `db:"zombie_amount_ada"` ZombieSendAddress sql.NullString `db:"zombie_send_address"` TxID sql.NullString `db:"tx_id"` TweetID sql.NullString `db:"tweet_id"` }
FightDb struct for fight db
type FightDto ¶
type FightDto struct { ID int ZombieName string `json:"zombieName"` HunterName string `json:"hunterName"` PaymentAmountLovelace int64 `json:"paymentAmountLovelace"` PaymentAmountAda string `json:"paymentAmountAda"` PaymentAddress string `json:"paymentAddress"` Status string `json:"status"` CreatedDate *time.Time `json:"createdDate"` MintedDate *time.Time `json:"mintedDate,omitempty"` FightIPFS string `json:"fightIPFS,omitempty"` AlienIPFS string `json:"alienIPFS,omitempty"` MinutesUntilExpired int `json:"minutesUntilExpired,omitempty"` Winner string `json:"winner"` Loser string `json:"loser"` TweetLink string `json:"tweetLink"` HunterSendAddress string ZombieSendAddress string }
FightDto dto for fight
type Store ¶
Store struct to store Db
func (Store) CreateFight ¶
func (s Store) CreateFight(fight FightDto, hunterUser UserNfts, zombieUser UserNfts, mintingUser User) (int, error)
CreateFight persist a new fight
func (Store) GetAlienByFightId ¶
GetAlienByFightId get alient by fight id
func (Store) GetFightForPaymentLastFifteen ¶
GetFightForPaymentLastFifteen get fight for utxo and index
func (Store) GetFightForUtxo ¶
GetFightForUtxo get fight for utxo and index
func (Store) GetFightsForUser ¶
GetFightsForUser get fights for user
func (Store) GetFightsForUserAndId ¶
GetFightsForUserAndId get fights for user and id
func (Store) GetListedNftByName ¶
GetListedNftByName get nft by name
func (Store) GetListedNfts ¶
GetListedNfts get all nfts listed
func (Store) GetListedNftsByName ¶
func (Store) GetMintedFights ¶
GetMintedFights get minted fights
func (Store) GetNextAvailableAlien ¶
GetNextAvailableAlien get next available alien
func (Store) GetNftHighestPercentMinimum ¶
func (Store) GetNftsOwnedByUser ¶
GetNftsOwnedByUser Gets owned nfts by user
func (Store) GetQueuedFight ¶
GetQueuedFight get fight for utxo and index
func (Store) GetStagedFights ¶
GetStagedFights get fight for utxo and index
func (Store) GetUserByID ¶
GetUserByNftkeyID Gets a user using their nftkey id
func (Store) GetUserByNftkeyID ¶
GetUserByNftkeyID Gets a user using their nftkey id
func (Store) InsertUser ¶
InsertUser inserts a new user into the db
func (Store) InsertZcNftOwnedByUser ¶
InsertZcNftOwnedByUser inserts nft owned by user
func (Store) MoveFightFromMintedToConfirmed ¶
func (Store) MoveFightFromPendingToQueued ¶
func (Store) MoveFightFromQueuedToStaged ¶
func (Store) MoveFightFromStagedToMinted ¶
func (Store) RemoveZcNftNotOwnedByUser ¶
RemoveZcNftNotOwnedByUser removes nft not owned by user
func (Store) RemoveZcNftOwnedByUser ¶
RemoveZcNftOwnedByUser remove nft owned by user
func (Store) SetLastAssetCheckTime ¶
SetLastAssetCheckTime updates last asset check time
func (Store) UpdateNftListPrice ¶
UpdateNftListPrice update list price
func (Store) UpdateTweetID ¶
func (Store) UpdatedUser ¶
UpdatedUser updates a new user in the db
type User ¶
type User struct { ID int `db:"id"` NftkeymeID string `db:"nftkeyme_id"` NftkeymeAccessToken string `db:"nftkeyme_access_token"` NftkeymeRefreshToken string `db:"nftkeyme_refresh_token"` LastAssetCheckTime sql.NullTime `db:"last_asset_check_time"` }
User struct to store user info
type UserNfts ¶
type UserNfts struct { UserID int `db:"zfc_user_id"` NftID int `db:"nft_id"` NftName string `db:"name"` NftType string `db:"nft_type"` ListAmount sql.NullInt16 `db:"amount_ada"` ListDate sql.NullTime `db:"listed_date"` Wins int `db:"wins"` Loses int `db:"loses"` }
UserNfts struct to hold nfts owned by user