Skip to content

Commit

Permalink
feat: get info from collection in indexer and hook
Browse files Browse the repository at this point in the history
Signed-off-by: Norman Meier <[email protected]>
  • Loading branch information
n0izn0iz committed Feb 17, 2024
1 parent b87a1be commit 2abbbdb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
INDEXER_NETWORK_ID=teritori-testnet
TERITORI_MINTER_CODE_IDS=10
TENDERMINT_WEBSOCKET_ENDPOINT=wss://rpc.testnet.teritori.com/websocket
TERITORI_COLLECTION_WHITELIST=tori1qv4yn5rpu8v6sdgxww65rdpftujuzdgw5xw3tffhf633qxrzuemqgxctfl,0x43cc70bf324d716782628bed38af97e4afe92f69,0x916ad9d549907ccbbaf9ba65526826bfc3a9c0c4,tori162skshe30f43kv2q2rw6we2mu3pvz43lm2zrg4hq50jdd2fjjdjsvm8mc7,tori1zxzv4j9dxarfhxhkxm5cfnv06vy6g4l80adjwaq3dxdzmh5jm8rsrkzz65,tori18etjzrma5604af50jjklk3wlkqcsxdrvmy6jzw5naw2t7kyv4rys3kpwky,tori10z8um7u47e24rv68ghd43tspeztmqy3cc283gvc3pj48zxs5ljdqn84deq,tori1afwrcs58afaka6ltynevwcvq8zhejr3ssn703c0hky5emh890vzsry5wp5
TERITORI_COLLECTION_WHITELIST=tori1gelslcq8jg38rl69xvjmt6j560ks9fypldke5g9er06jgy5n535s048jg5,0x43cc70bf324d716782628bed38af97e4afe92f69,0x916ad9d549907ccbbaf9ba65526826bfc3a9c0c4,tori162skshe30f43kv2q2rw6we2mu3pvz43lm2zrg4hq50jdd2fjjdjsvm8mc7,tori1zxzv4j9dxarfhxhkxm5cfnv06vy6g4l80adjwaq3dxdzmh5jm8rsrkzz65,tori18etjzrma5604af50jjklk3wlkqcsxdrvmy6jzw5naw2t7kyv4rys3kpwky,tori10z8um7u47e24rv68ghd43tspeztmqy3cc283gvc3pj48zxs5ljdqn84deq,tori1afwrcs58afaka6ltynevwcvq8zhejr3ssn703c0hky5emh890vzsry5wp5

PUBLIC_TENOR_KEY=AIzaSyA8TpVfoyoBaDdLww6wJ1Xe0OVN-Hi8qPE

Expand Down
20 changes: 18 additions & 2 deletions go/internal/indexerhandler/premium_feed.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ import (
"go.uber.org/zap"
)

// TODO: handle collection config update

type PremiumFeedInstantiateMsg struct {
AdminAddr string `json:"admin_addr"`
MintRoyalties uint16 `json:"mint_royalties"`
Name string `json:"name"`
Description string `json:"description"`
ImageURI string `json:"image_uri"`
Symbol string `json:"symbol"`
}

func (h *Handler) handleInstantiatePremiumFeedMemberships(e *Message, instantiateMsg *wasmtypes.MsgInstantiateContract) error {
contractAddress, err := e.Events.First("instantiate._contract_address")
if err != nil {
Expand All @@ -28,6 +39,11 @@ func (h *Handler) handleInstantiatePremiumFeedMemberships(e *Message, instantiat
return nil
}

var instantiateData PremiumFeedInstantiateMsg
if err := json.Unmarshal(instantiateMsg.Msg, &instantiateData); err != nil {
return errors.Wrap(err, "failed to unmarshal instantiate msg")
}

blockTime, err := e.GetBlockTime()
if err != nil {
return errors.Wrap(err, "failed to get block time")
Expand All @@ -36,8 +52,8 @@ func (h *Handler) handleInstantiatePremiumFeedMemberships(e *Message, instantiat
collection := indexerdb.Collection{
ID: h.config.Network.CollectionID(contractAddress),
NetworkID: h.config.Network.ID,
Name: "Premium Memberships",
ImageURI: "",
Name: instantiateData.Name,
ImageURI: instantiateData.ImageURI,
MaxSupply: -1,
SecondaryDuringMint: true,
Time: blockTime,
Expand Down
2 changes: 1 addition & 1 deletion networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -10939,7 +10939,7 @@
"featureObjects": [
{
"type": "CosmWasmPremiumFeed",
"membershipContractAddress": "tori1qv4yn5rpu8v6sdgxww65rdpftujuzdgw5xw3tffhf633qxrzuemqgxctfl",
"membershipContractAddress": "tori1gelslcq8jg38rl69xvjmt6j560ks9fypldke5g9er06jgy5n535s048jg5",
"mintDenom": "utori"
}
],
Expand Down
15 changes: 0 additions & 15 deletions packages/hooks/useCollectionInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,18 +393,3 @@ const usePremiumFeedCollectionInfo = (

return { info, notFound: false, refetch };
};

/*
Premium membership cards are held by premium creator subscribers and unlock content reserved for creator communities.
By owning a creator's premium membership card:
- you support the creation of their content
- you have privileged access to their creations
- access to a privileged link with the creator
- you participate in the global economy of Teritori OS, which charges fees that are reinvested in the $TORI token.
- you develop the Teritori ecosystem and help finance the radical resilience of tomorrow's communities
- you benefit from potential future advantages on all Teritori OS features (whitelist, airdrops, early access on new features, alpha information, etc.).
*/
4 changes: 2 additions & 2 deletions packages/hooks/useNFTInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,9 @@ const getPremiumFeedNFTInfo = async (
isOwner,
isSeller: vaultInfo.isListed && isOwner,
isListed: vaultInfo.isListed,
collectionName: "Premium Memberships",
collectionName: "Premium Memberships", // FIXME: get from collection config
collectionImageURL:
"ipfs://bafybeiaznarsgwk7stav6qrzjnwqw4j7eu7drm3xx4p3fokgsnrouelse4",
"ipfs://bafybeiaznarsgwk7stav6qrzjnwqw4j7eu7drm3xx4p3fokgsnrouelse4", // FIXME: get from collection config
mintDenom: "",
royalty: 0,
networkId: network.id,
Expand Down

0 comments on commit 2abbbdb

Please sign in to comment.