diff --git a/src/app/account/all-songs/page.tsx b/src/app/account/all-songs/page.tsx new file mode 100644 index 0000000..6a46c01 --- /dev/null +++ b/src/app/account/all-songs/page.tsx @@ -0,0 +1,213 @@ +"use client"; +import MintSongButton from "@/components/MintSongButton/MintSongButton"; +import SongListItemMusicNFT from "@/components/SongList/SongListItemMusicNFT"; +import SongListItemSpinamp from "@/components/SongList/SongListItemSpinamp"; +import { MusicNFTAddr } from "@/env"; +import { GET_MY_LISTED_MUSIC } from "@/graph-ql/queries/octav3/GET_MY_LISTED_MUSIC/getMyListedMusic"; +import { GET_MY_MUSIC_LIMIT } from "@/graph-ql/queries/octav3/GET_MY_MUSIC_LIMIT/getMyMusicLimit"; +import { GetMyMusicQuery } from "@/graph-ql/queries/octav3/__generated__/graphql"; +import { GET_MY_MUSIC as GET_MY_MUSIC_SPINAMP } from "@/graph-ql/queries/spinamp/GET_MY_MUSIC/getMyMusic"; +import { Metadata } from "@/graph-ql/queries/spinamp/types"; +import { GetMyMusicQuery as GetMyMusicQuerySpinamp } from "@/graph-ql/queries/spinamp/__generated__/graphql"; +import { deToHttps, fetchDe } from "@/services/de-storage/fetchDe"; +import { monetize } from "@/services/smart-contract/monetize"; +import { MusicPlayerSub } from "@/subs/MusicPlayerSub"; +import { useQuery } from "@apollo/client"; +import React, { useEffect } from "react"; +import { usePublicClient, useWalletClient } from "wagmi"; +import AccountListBtn from "../AccountListBtn"; +import { unmonetize } from "@/services/smart-contract/unmonetize"; + +const Account = () => { + const { data: walletClient } = useWalletClient(); + const publicClient = usePublicClient(); + const handlePlaySongSpinamp = async ( + musicNft: NonNullable< + NonNullable< + NonNullable< + NonNullable["nodes"][0] + >["nftsProcessedTracksByProcessedTrackId"]["nodes"][0] + >["nftByNftId"] + > + ) => { + const metadata = musicNft?.metadata as Metadata; + if (!metadata) return; + if ( + musicNft?.contractAddress && + musicNft?.tokenId && + metadata.animation_url && + walletClient + ) { + MusicPlayerSub.next({ + artist: metadata.artist ?? ".....", + artworkUrl: deToHttps(metadata.artwork?.uri ?? metadata.image ?? "..."), + contractAddr: musicNft?.contractAddress ?? "", + musicUrl: deToHttps(metadata.animation_url ?? ""), + title: metadata.title ?? ".....", + tokenId: musicNft?.tokenId ?? ".....", + owner: walletClient.account.address, + }); + } + }; + + const handlePlaySong = async ( + musicNft: NonNullable[0]> + ) => { + const metadata = await fetchDe(musicNft.tokenUri); + if (!metadata) return; + if (musicNft?.id && metadata.animation_url && walletClient) { + MusicPlayerSub.next({ + artist: metadata.artist ?? ".....", + artworkUrl: deToHttps(metadata.artwork?.uri ?? "TODO"), + contractAddr: MusicNFTAddr, + musicUrl: deToHttps(metadata.animation_url ?? ""), + title: metadata.title ?? ".....", + tokenId: musicNft?.id ?? ".....", + owner: walletClient.account.address, + }); + } + }; + + const { data: myMusicSpinamp, refetch: refetchSpinamp } = useQuery( + GET_MY_MUSIC_SPINAMP, + { + variables: { + owner: "0x26ef03a20aaeda8aafcee4e146dc6b328195947c", + }, + } + ); + + const { data: myMusic, refetch } = useQuery(GET_MY_MUSIC_LIMIT, { + variables: { + owner: walletClient?.account.address.toLowerCase(), + }, + }); + const { data: myListedMusic } = useQuery(GET_MY_LISTED_MUSIC, { + variables: { + owner: walletClient?.account.address.toLowerCase(), + }, + }); + useEffect(() => { + refetch(); + refetchSpinamp(); + }, [walletClient, refetchSpinamp, refetch]); + + return ( +
+
+
+

Music NFTs

+
+
+ +
+ {myMusicSpinamp?.allProcessedTracks?.nodes + .map( + (e) => e?.nftsProcessedTracksByProcessedTrackId.nodes[0]?.nftByNftId + ) + .map((e) => { + if (!e) return <>; + return ( + { + handlePlaySongSpinamp(e); + }} + customBtn={ + { + if (!e.contractAddress || !e.tokenId) return false; + return ( + (ele.musicNftAddr as string).toLowerCase() == + e.contractAddress.toLowerCase() && + (ele.musicNftTokenId as string).toLowerCase() == + e.tokenId.toLowerCase() + ); + })?.id ?? "-1" + )} + onList={() => { + //TODO error + if ( + !walletClient || + !publicClient || + !e.contractAddress || + !e.tokenId || + !e.tokenUri + ) + return; + monetize( + e.contractAddress, + BigInt(e.tokenId), + e.tokenUri, + publicClient, + walletClient + ); + }} + onUnlist={(monetizeId) => { + if ( + !walletClient || + !publicClient || + !e.contractAddress || + !e.tokenId || + !e.tokenUri + ) + return; + unmonetize(monetizeId, publicClient, walletClient); + }} + /> + } + /> + ); + })} + {myMusic?.musicTokens?.map((e) => { + if (!e) return <>; + return ( + { + handlePlaySong(e); + }} + customBtn={ + { + if (!e.id) return false; + return ( + (ele.musicNftAddr as string).toLowerCase() == + MusicNFTAddr.toLowerCase() && + (ele.musicNftTokenId as string).toLowerCase() == + e.id.toLowerCase() + ); + })?.id ?? "-1" + )} + onList={() => { + //TODO error + if (!walletClient || !publicClient || !e.id || !e.tokenUri) + return; + monetize( + MusicNFTAddr, + BigInt(e.id), + e.tokenUri, + publicClient, + walletClient + ); + }} + onUnlist={(monetizeId) => { + if (!walletClient || !publicClient || !e.id) return; + unmonetize(monetizeId, publicClient, walletClient); + }} + /> + } + /> + ); + })} + +
+
+ ); +}; + +export default Account; diff --git a/src/app/account/page.tsx b/src/app/account/page.tsx index 083c049..3c56e24 100644 --- a/src/app/account/page.tsx +++ b/src/app/account/page.tsx @@ -7,8 +7,8 @@ import { MusicNFTAddr } from "@/env"; import { GET_MY_LISTED_MUSIC } from "@/graph-ql/queries/octav3/GET_MY_LISTED_MUSIC/getMyListedMusic"; import { GET_MY_MUSIC } from "@/graph-ql/queries/octav3/GET_MY_MUSIC/getMyMusic"; import { GetMyMusicQuery } from "@/graph-ql/queries/octav3/__generated__/graphql"; -import { GET_MY_MUSIC as GET_MY_MUSIC_SPINAMP } from "@/graph-ql/queries/spinamp/GET_MY_MUSIC/getMyMusic"; -import { Metadata } from "@/graph-ql/queries/spinamp/GET_MY_MUSIC/types"; +import { GET_MY_MUSIC_LIMIT as GET_MY_MUSIC_SPINAMP } from "@/graph-ql/queries/spinamp/GET_MY_MUSIC_LIMIT/getMyMusicLimit"; +import { Metadata } from "@/graph-ql/queries/spinamp/types"; import { GetMyMusicQuery as GetMyMusicQuerySpinamp } from "@/graph-ql/queries/spinamp/__generated__/graphql"; import { deToHttps, fetchDe } from "@/services/de-storage/fetchDe"; import { monetize } from "@/services/smart-contract/monetize"; @@ -19,6 +19,7 @@ import { usePublicClient, useWalletClient } from "wagmi"; import AccountListBtn from "./AccountListBtn"; import { unmonetize } from "@/services/smart-contract/unmonetize"; import { getBalance } from "@/services/backend/axios"; +import Link from "next/link"; const Account = () => { const { data: walletClient } = useWalletClient(); @@ -133,7 +134,9 @@ const Account = () => {

Your Music

-

See all

+ +

See all

+
diff --git a/src/components/SongList/SongListItemMusicNFT.tsx b/src/components/SongList/SongListItemMusicNFT.tsx index daa177a..3a29070 100644 --- a/src/components/SongList/SongListItemMusicNFT.tsx +++ b/src/components/SongList/SongListItemMusicNFT.tsx @@ -2,7 +2,7 @@ import { MusicPlayerSub } from "../../subs/MusicPlayerSub"; import React, { useEffect, useState } from "react"; import { GetMyMusicQuery } from "@/graph-ql/queries/octav3/__generated__/graphql"; -import { Metadata } from "@/graph-ql/queries/spinamp/GET_MY_MUSIC/types"; +import { Metadata } from "@/graph-ql/queries/spinamp/types"; import { deToHttps, fetchDe } from "@/services/de-storage/fetchDe"; import SongListItemUI from "./SongListItemUI"; import { MusicNFTAddr } from "@/env"; diff --git a/src/components/SongList/SongListItemSpinamp.tsx b/src/components/SongList/SongListItemSpinamp.tsx index 8c049b5..33c02cf 100644 --- a/src/components/SongList/SongListItemSpinamp.tsx +++ b/src/components/SongList/SongListItemSpinamp.tsx @@ -1,7 +1,7 @@ "use client"; import { MusicPlayerSub } from "../../subs/MusicPlayerSub"; import React, { useEffect, useState } from "react"; -import { Metadata } from "@/graph-ql/queries/spinamp/GET_MY_MUSIC/types"; +import { Metadata } from "@/graph-ql/queries/spinamp/types"; import { deToHttps } from "@/services/de-storage/fetchDe"; import SongListItemUI from "./SongListItemUI"; import { getPlatformUrl } from "@/services/platform/geturl"; diff --git a/src/graph-ql/queries/octav3/GET_MY_MUSIC/getMyMusic.ts b/src/graph-ql/queries/octav3/GET_MY_MUSIC/getMyMusic.ts index 6578adc..53c29b0 100644 --- a/src/graph-ql/queries/octav3/GET_MY_MUSIC/getMyMusic.ts +++ b/src/graph-ql/queries/octav3/GET_MY_MUSIC/getMyMusic.ts @@ -2,7 +2,7 @@ import { gql } from "../__generated__"; export const GET_MY_MUSIC = gql(` query GetMyMusic($owner:Bytes) @api(name: octav3){ - musicTokens(first: 5,where:{owner:$owner}) { + musicTokens(where:{owner:$owner}) { id tokenUri } diff --git a/src/graph-ql/queries/octav3/GET_MY_MUSIC_LIMIT/getMyMusicLimit.ts b/src/graph-ql/queries/octav3/GET_MY_MUSIC_LIMIT/getMyMusicLimit.ts new file mode 100644 index 0000000..f5bff4c --- /dev/null +++ b/src/graph-ql/queries/octav3/GET_MY_MUSIC_LIMIT/getMyMusicLimit.ts @@ -0,0 +1,10 @@ +import { gql } from "../__generated__"; + +export const GET_MY_MUSIC_LIMIT = gql(` +query GetMyMusicLimit($owner:Bytes) @api(name: octav3){ + musicTokens(first: 5,where:{owner:$owner}) { + id + tokenUri + } + } +`) diff --git a/src/graph-ql/queries/octav3/__generated__/gql.ts b/src/graph-ql/queries/octav3/__generated__/gql.ts index 2e85bd5..42d6d4f 100644 --- a/src/graph-ql/queries/octav3/__generated__/gql.ts +++ b/src/graph-ql/queries/octav3/__generated__/gql.ts @@ -15,7 +15,8 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/ const documents = { "\nquery GetAllMusic @api(name: octav3){\n octaveTokens(where:{closed:false}) {\n id\n owner\n musicNftAddr\n musicNftTokenId\n tokenUri\n }\n }\n": types.GetAllMusicDocument, "\nquery GetMyListedMusic($owner:Bytes) @api(name: octav3){\n octaveTokens(where:{owner:$owner,closed:false}) {\n id\n musicNftAddr\n musicNftTokenId\n }\n }\n": types.GetMyListedMusicDocument, - "\nquery GetMyMusic($owner:Bytes) @api(name: octav3){\n musicTokens(first: 5,where:{owner:$owner}) {\n id\n tokenUri\n }\n }\n": types.GetMyMusicDocument, + "\nquery GetMyMusic($owner:Bytes) @api(name: octav3){\n musicTokens(where:{owner:$owner}) {\n id\n tokenUri\n }\n }\n": types.GetMyMusicDocument, + "\nquery GetMyMusicLimit($owner:Bytes) @api(name: octav3){\n musicTokens(first: 5,where:{owner:$owner}) {\n id\n tokenUri\n }\n }\n": types.GetMyMusicLimitDocument, }; /** @@ -43,7 +44,11 @@ export function gql(source: "\nquery GetMyListedMusic($owner:Bytes) @api(name: o /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql(source: "\nquery GetMyMusic($owner:Bytes) @api(name: octav3){\n musicTokens(first: 5,where:{owner:$owner}) {\n id\n tokenUri\n }\n }\n"): (typeof documents)["\nquery GetMyMusic($owner:Bytes) @api(name: octav3){\n musicTokens(first: 5,where:{owner:$owner}) {\n id\n tokenUri\n }\n }\n"]; +export function gql(source: "\nquery GetMyMusic($owner:Bytes) @api(name: octav3){\n musicTokens(where:{owner:$owner}) {\n id\n tokenUri\n }\n }\n"): (typeof documents)["\nquery GetMyMusic($owner:Bytes) @api(name: octav3){\n musicTokens(where:{owner:$owner}) {\n id\n tokenUri\n }\n }\n"]; +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql(source: "\nquery GetMyMusicLimit($owner:Bytes) @api(name: octav3){\n musicTokens(first: 5,where:{owner:$owner}) {\n id\n tokenUri\n }\n }\n"): (typeof documents)["\nquery GetMyMusicLimit($owner:Bytes) @api(name: octav3){\n musicTokens(first: 5,where:{owner:$owner}) {\n id\n tokenUri\n }\n }\n"]; export function gql(source: string) { return (documents as any)[source] ?? {}; diff --git a/src/graph-ql/queries/octav3/__generated__/graphql.ts b/src/graph-ql/queries/octav3/__generated__/graphql.ts index 1217212..83eed0a 100644 --- a/src/graph-ql/queries/octav3/__generated__/graphql.ts +++ b/src/graph-ql/queries/octav3/__generated__/graphql.ts @@ -363,7 +363,15 @@ export type GetMyMusicQueryVariables = Exact<{ export type GetMyMusicQuery = { __typename?: 'Query', musicTokens: Array<{ __typename?: 'MusicToken', id: string, tokenUri: string }> }; +export type GetMyMusicLimitQueryVariables = Exact<{ + owner?: InputMaybe; +}>; + + +export type GetMyMusicLimitQuery = { __typename?: 'Query', musicTokens: Array<{ __typename?: 'MusicToken', id: string, tokenUri: string }> }; + export const GetAllMusicDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAllMusic"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"api"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"name"},"value":{"kind":"EnumValue","value":"octav3"}}]}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"octaveTokens"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"closed"},"value":{"kind":"BooleanValue","value":false}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"owner"}},{"kind":"Field","name":{"kind":"Name","value":"musicNftAddr"}},{"kind":"Field","name":{"kind":"Name","value":"musicNftTokenId"}},{"kind":"Field","name":{"kind":"Name","value":"tokenUri"}}]}}]}}]} as unknown as DocumentNode; export const GetMyListedMusicDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetMyListedMusic"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"owner"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Bytes"}}}],"directives":[{"kind":"Directive","name":{"kind":"Name","value":"api"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"name"},"value":{"kind":"EnumValue","value":"octav3"}}]}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"octaveTokens"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"owner"},"value":{"kind":"Variable","name":{"kind":"Name","value":"owner"}}},{"kind":"ObjectField","name":{"kind":"Name","value":"closed"},"value":{"kind":"BooleanValue","value":false}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"musicNftAddr"}},{"kind":"Field","name":{"kind":"Name","value":"musicNftTokenId"}}]}}]}}]} as unknown as DocumentNode; -export const GetMyMusicDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetMyMusic"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"owner"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Bytes"}}}],"directives":[{"kind":"Directive","name":{"kind":"Name","value":"api"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"name"},"value":{"kind":"EnumValue","value":"octav3"}}]}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"musicTokens"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"IntValue","value":"5"}},{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"owner"},"value":{"kind":"Variable","name":{"kind":"Name","value":"owner"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"tokenUri"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file +export const GetMyMusicDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetMyMusic"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"owner"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Bytes"}}}],"directives":[{"kind":"Directive","name":{"kind":"Name","value":"api"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"name"},"value":{"kind":"EnumValue","value":"octav3"}}]}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"musicTokens"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"owner"},"value":{"kind":"Variable","name":{"kind":"Name","value":"owner"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"tokenUri"}}]}}]}}]} as unknown as DocumentNode; +export const GetMyMusicLimitDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetMyMusicLimit"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"owner"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Bytes"}}}],"directives":[{"kind":"Directive","name":{"kind":"Name","value":"api"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"name"},"value":{"kind":"EnumValue","value":"octav3"}}]}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"musicTokens"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"IntValue","value":"5"}},{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"owner"},"value":{"kind":"Variable","name":{"kind":"Name","value":"owner"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"tokenUri"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/src/graph-ql/queries/spinamp/GET_MY_MUSIC/getMyMusic.ts b/src/graph-ql/queries/spinamp/GET_MY_MUSIC/getMyMusic.ts index fdc5b74..285be20 100644 --- a/src/graph-ql/queries/spinamp/GET_MY_MUSIC/getMyMusic.ts +++ b/src/graph-ql/queries/spinamp/GET_MY_MUSIC/getMyMusic.ts @@ -4,7 +4,6 @@ import { gql } from "../__generated__"; export const GET_MY_MUSIC = gql(` query GetMyMusic($owner:String) @api(name: spinamp){ allProcessedTracks( - first:5 orderBy: CREATED_AT_TIME_DESC filter: { artistByArtistId: { diff --git a/src/graph-ql/queries/spinamp/GET_MY_MUSIC_LIMIT/getMyMusicLimit.ts b/src/graph-ql/queries/spinamp/GET_MY_MUSIC_LIMIT/getMyMusicLimit.ts new file mode 100644 index 0000000..2774f0f --- /dev/null +++ b/src/graph-ql/queries/spinamp/GET_MY_MUSIC_LIMIT/getMyMusicLimit.ts @@ -0,0 +1,53 @@ +import { gql } from "../__generated__"; + +// TODO use pagination +export const GET_MY_MUSIC_LIMIT = gql(` +query GetMyMusicLimit($owner:String) @api(name: spinamp){ + allProcessedTracks( + first:5 + orderBy: CREATED_AT_TIME_DESC + filter: { + artistByArtistId: { + userByUserId: { + addressesByUserId: { + some: { + id: { + equalToInsensitive: $owner + } + } + } + } + } + } + ) { + nodes { + nftsProcessedTracksByProcessedTrackId { + nodes { + nftByNftId { + id + tokenId + contractAddress + tokenMetadataUri + tokenUri + metadata + platformId + chainId + artistsNftsByNftId { + nodes { + artistByArtistId { + name + } + } + } + nftsProcessedTracksByNftId { + nodes { + platformInternalId + } + } + } + } + } + } + } + } +`) \ No newline at end of file diff --git a/src/graph-ql/queries/spinamp/__generated__/gql.ts b/src/graph-ql/queries/spinamp/__generated__/gql.ts index b3a9b2b..6993076 100644 --- a/src/graph-ql/queries/spinamp/__generated__/gql.ts +++ b/src/graph-ql/queries/spinamp/__generated__/gql.ts @@ -13,7 +13,8 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/ * Therefore it is highly recommended to use the babel or swc plugin for production. */ const documents = { - "\nquery GetMyMusic($owner:String) @api(name: spinamp){\n allProcessedTracks(\n first:5\n orderBy: CREATED_AT_TIME_DESC\n filter: {\n artistByArtistId: {\n userByUserId: {\n addressesByUserId: {\n some: {\n id: {\n equalToInsensitive: $owner\n }\n }\n }\n }\n }\n }\n ) {\n nodes {\n nftsProcessedTracksByProcessedTrackId {\n nodes {\n nftByNftId {\n id\n tokenId\n contractAddress\n tokenMetadataUri\n tokenUri\n metadata\n platformId\n chainId\n artistsNftsByNftId {\n nodes {\n artistByArtistId {\n name\n }\n }\n }\n nftsProcessedTracksByNftId {\n nodes {\n platformInternalId\n }\n }\n }\n }\n }\n }\n }\n }\n": types.GetMyMusicDocument, + "\nquery GetMyMusic($owner:String) @api(name: spinamp){\n allProcessedTracks(\n orderBy: CREATED_AT_TIME_DESC\n filter: {\n artistByArtistId: {\n userByUserId: {\n addressesByUserId: {\n some: {\n id: {\n equalToInsensitive: $owner\n }\n }\n }\n }\n }\n }\n ) {\n nodes {\n nftsProcessedTracksByProcessedTrackId {\n nodes {\n nftByNftId {\n id\n tokenId\n contractAddress\n tokenMetadataUri\n tokenUri\n metadata\n platformId\n chainId\n artistsNftsByNftId {\n nodes {\n artistByArtistId {\n name\n }\n }\n }\n nftsProcessedTracksByNftId {\n nodes {\n platformInternalId\n }\n }\n }\n }\n }\n }\n }\n }\n": types.GetMyMusicDocument, + "\nquery GetMyMusicLimit($owner:String) @api(name: spinamp){\n allProcessedTracks(\n first:5\n orderBy: CREATED_AT_TIME_DESC\n filter: {\n artistByArtistId: {\n userByUserId: {\n addressesByUserId: {\n some: {\n id: {\n equalToInsensitive: $owner\n }\n }\n }\n }\n }\n }\n ) {\n nodes {\n nftsProcessedTracksByProcessedTrackId {\n nodes {\n nftByNftId {\n id\n tokenId\n contractAddress\n tokenMetadataUri\n tokenUri\n metadata\n platformId\n chainId\n artistsNftsByNftId {\n nodes {\n artistByArtistId {\n name\n }\n }\n }\n nftsProcessedTracksByNftId {\n nodes {\n platformInternalId\n }\n }\n }\n }\n }\n }\n }\n }\n": types.GetMyMusicLimitDocument, }; /** @@ -33,7 +34,11 @@ export function gql(source: string): unknown; /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql(source: "\nquery GetMyMusic($owner:String) @api(name: spinamp){\n allProcessedTracks(\n first:5\n orderBy: CREATED_AT_TIME_DESC\n filter: {\n artistByArtistId: {\n userByUserId: {\n addressesByUserId: {\n some: {\n id: {\n equalToInsensitive: $owner\n }\n }\n }\n }\n }\n }\n ) {\n nodes {\n nftsProcessedTracksByProcessedTrackId {\n nodes {\n nftByNftId {\n id\n tokenId\n contractAddress\n tokenMetadataUri\n tokenUri\n metadata\n platformId\n chainId\n artistsNftsByNftId {\n nodes {\n artistByArtistId {\n name\n }\n }\n }\n nftsProcessedTracksByNftId {\n nodes {\n platformInternalId\n }\n }\n }\n }\n }\n }\n }\n }\n"): (typeof documents)["\nquery GetMyMusic($owner:String) @api(name: spinamp){\n allProcessedTracks(\n first:5\n orderBy: CREATED_AT_TIME_DESC\n filter: {\n artistByArtistId: {\n userByUserId: {\n addressesByUserId: {\n some: {\n id: {\n equalToInsensitive: $owner\n }\n }\n }\n }\n }\n }\n ) {\n nodes {\n nftsProcessedTracksByProcessedTrackId {\n nodes {\n nftByNftId {\n id\n tokenId\n contractAddress\n tokenMetadataUri\n tokenUri\n metadata\n platformId\n chainId\n artistsNftsByNftId {\n nodes {\n artistByArtistId {\n name\n }\n }\n }\n nftsProcessedTracksByNftId {\n nodes {\n platformInternalId\n }\n }\n }\n }\n }\n }\n }\n }\n"]; +export function gql(source: "\nquery GetMyMusic($owner:String) @api(name: spinamp){\n allProcessedTracks(\n orderBy: CREATED_AT_TIME_DESC\n filter: {\n artistByArtistId: {\n userByUserId: {\n addressesByUserId: {\n some: {\n id: {\n equalToInsensitive: $owner\n }\n }\n }\n }\n }\n }\n ) {\n nodes {\n nftsProcessedTracksByProcessedTrackId {\n nodes {\n nftByNftId {\n id\n tokenId\n contractAddress\n tokenMetadataUri\n tokenUri\n metadata\n platformId\n chainId\n artistsNftsByNftId {\n nodes {\n artistByArtistId {\n name\n }\n }\n }\n nftsProcessedTracksByNftId {\n nodes {\n platformInternalId\n }\n }\n }\n }\n }\n }\n }\n }\n"): (typeof documents)["\nquery GetMyMusic($owner:String) @api(name: spinamp){\n allProcessedTracks(\n orderBy: CREATED_AT_TIME_DESC\n filter: {\n artistByArtistId: {\n userByUserId: {\n addressesByUserId: {\n some: {\n id: {\n equalToInsensitive: $owner\n }\n }\n }\n }\n }\n }\n ) {\n nodes {\n nftsProcessedTracksByProcessedTrackId {\n nodes {\n nftByNftId {\n id\n tokenId\n contractAddress\n tokenMetadataUri\n tokenUri\n metadata\n platformId\n chainId\n artistsNftsByNftId {\n nodes {\n artistByArtistId {\n name\n }\n }\n }\n nftsProcessedTracksByNftId {\n nodes {\n platformInternalId\n }\n }\n }\n }\n }\n }\n }\n }\n"]; +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql(source: "\nquery GetMyMusicLimit($owner:String) @api(name: spinamp){\n allProcessedTracks(\n first:5\n orderBy: CREATED_AT_TIME_DESC\n filter: {\n artistByArtistId: {\n userByUserId: {\n addressesByUserId: {\n some: {\n id: {\n equalToInsensitive: $owner\n }\n }\n }\n }\n }\n }\n ) {\n nodes {\n nftsProcessedTracksByProcessedTrackId {\n nodes {\n nftByNftId {\n id\n tokenId\n contractAddress\n tokenMetadataUri\n tokenUri\n metadata\n platformId\n chainId\n artistsNftsByNftId {\n nodes {\n artistByArtistId {\n name\n }\n }\n }\n nftsProcessedTracksByNftId {\n nodes {\n platformInternalId\n }\n }\n }\n }\n }\n }\n }\n }\n"): (typeof documents)["\nquery GetMyMusicLimit($owner:String) @api(name: spinamp){\n allProcessedTracks(\n first:5\n orderBy: CREATED_AT_TIME_DESC\n filter: {\n artistByArtistId: {\n userByUserId: {\n addressesByUserId: {\n some: {\n id: {\n equalToInsensitive: $owner\n }\n }\n }\n }\n }\n }\n ) {\n nodes {\n nftsProcessedTracksByProcessedTrackId {\n nodes {\n nftByNftId {\n id\n tokenId\n contractAddress\n tokenMetadataUri\n tokenUri\n metadata\n platformId\n chainId\n artistsNftsByNftId {\n nodes {\n artistByArtistId {\n name\n }\n }\n }\n nftsProcessedTracksByNftId {\n nodes {\n platformInternalId\n }\n }\n }\n }\n }\n }\n }\n }\n"]; export function gql(source: string) { return (documents as any)[source] ?? {}; diff --git a/src/graph-ql/queries/spinamp/__generated__/graphql.ts b/src/graph-ql/queries/spinamp/__generated__/graphql.ts index d5b7524..02a120f 100644 --- a/src/graph-ql/queries/spinamp/__generated__/graphql.ts +++ b/src/graph-ql/queries/spinamp/__generated__/graphql.ts @@ -7517,5 +7517,13 @@ export type GetMyMusicQueryVariables = Exact<{ export type GetMyMusicQuery = { __typename?: 'Query', allProcessedTracks?: { __typename?: 'ProcessedTracksConnection', nodes: Array<{ __typename?: 'ProcessedTrack', nftsProcessedTracksByProcessedTrackId: { __typename?: 'NftsProcessedTracksConnection', nodes: Array<{ __typename?: 'NftsProcessedTrack', nftByNftId?: { __typename?: 'Nft', id: string, tokenId?: string | null, contractAddress?: string | null, tokenMetadataUri?: string | null, tokenUri?: string | null, metadata?: any | null, platformId?: string | null, chainId?: string | null, artistsNftsByNftId: { __typename?: 'ArtistsNftsConnection', nodes: Array<{ __typename?: 'ArtistsNft', artistByArtistId?: { __typename?: 'Artist', name?: string | null } | null } | null> }, nftsProcessedTracksByNftId: { __typename?: 'NftsProcessedTracksConnection', nodes: Array<{ __typename?: 'NftsProcessedTrack', platformInternalId?: string | null } | null> } } | null } | null> } } | null> } | null }; +export type GetMyMusicLimitQueryVariables = Exact<{ + owner?: InputMaybe; +}>; + + +export type GetMyMusicLimitQuery = { __typename?: 'Query', allProcessedTracks?: { __typename?: 'ProcessedTracksConnection', nodes: Array<{ __typename?: 'ProcessedTrack', nftsProcessedTracksByProcessedTrackId: { __typename?: 'NftsProcessedTracksConnection', nodes: Array<{ __typename?: 'NftsProcessedTrack', nftByNftId?: { __typename?: 'Nft', id: string, tokenId?: string | null, contractAddress?: string | null, tokenMetadataUri?: string | null, tokenUri?: string | null, metadata?: any | null, platformId?: string | null, chainId?: string | null, artistsNftsByNftId: { __typename?: 'ArtistsNftsConnection', nodes: Array<{ __typename?: 'ArtistsNft', artistByArtistId?: { __typename?: 'Artist', name?: string | null } | null } | null> }, nftsProcessedTracksByNftId: { __typename?: 'NftsProcessedTracksConnection', nodes: Array<{ __typename?: 'NftsProcessedTrack', platformInternalId?: string | null } | null> } } | null } | null> } } | null> } | null }; + -export const GetMyMusicDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetMyMusic"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"owner"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"directives":[{"kind":"Directive","name":{"kind":"Name","value":"api"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"name"},"value":{"kind":"EnumValue","value":"spinamp"}}]}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"allProcessedTracks"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"IntValue","value":"5"}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"EnumValue","value":"CREATED_AT_TIME_DESC"}},{"kind":"Argument","name":{"kind":"Name","value":"filter"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"artistByArtistId"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"userByUserId"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"addressesByUserId"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"some"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"equalToInsensitive"},"value":{"kind":"Variable","name":{"kind":"Name","value":"owner"}}}]}}]}}]}}]}}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nftsProcessedTracksByProcessedTrackId"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nftByNftId"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"tokenId"}},{"kind":"Field","name":{"kind":"Name","value":"contractAddress"}},{"kind":"Field","name":{"kind":"Name","value":"tokenMetadataUri"}},{"kind":"Field","name":{"kind":"Name","value":"tokenUri"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"platformId"}},{"kind":"Field","name":{"kind":"Name","value":"chainId"}},{"kind":"Field","name":{"kind":"Name","value":"artistsNftsByNftId"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"artistByArtistId"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"nftsProcessedTracksByNftId"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"platformInternalId"}}]}}]}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file +export const GetMyMusicDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetMyMusic"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"owner"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"directives":[{"kind":"Directive","name":{"kind":"Name","value":"api"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"name"},"value":{"kind":"EnumValue","value":"spinamp"}}]}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"allProcessedTracks"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"EnumValue","value":"CREATED_AT_TIME_DESC"}},{"kind":"Argument","name":{"kind":"Name","value":"filter"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"artistByArtistId"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"userByUserId"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"addressesByUserId"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"some"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"equalToInsensitive"},"value":{"kind":"Variable","name":{"kind":"Name","value":"owner"}}}]}}]}}]}}]}}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nftsProcessedTracksByProcessedTrackId"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nftByNftId"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"tokenId"}},{"kind":"Field","name":{"kind":"Name","value":"contractAddress"}},{"kind":"Field","name":{"kind":"Name","value":"tokenMetadataUri"}},{"kind":"Field","name":{"kind":"Name","value":"tokenUri"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"platformId"}},{"kind":"Field","name":{"kind":"Name","value":"chainId"}},{"kind":"Field","name":{"kind":"Name","value":"artistsNftsByNftId"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"artistByArtistId"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"nftsProcessedTracksByNftId"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"platformInternalId"}}]}}]}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const GetMyMusicLimitDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetMyMusicLimit"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"owner"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"directives":[{"kind":"Directive","name":{"kind":"Name","value":"api"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"name"},"value":{"kind":"EnumValue","value":"spinamp"}}]}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"allProcessedTracks"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"IntValue","value":"5"}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"EnumValue","value":"CREATED_AT_TIME_DESC"}},{"kind":"Argument","name":{"kind":"Name","value":"filter"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"artistByArtistId"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"userByUserId"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"addressesByUserId"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"some"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"equalToInsensitive"},"value":{"kind":"Variable","name":{"kind":"Name","value":"owner"}}}]}}]}}]}}]}}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nftsProcessedTracksByProcessedTrackId"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nftByNftId"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"tokenId"}},{"kind":"Field","name":{"kind":"Name","value":"contractAddress"}},{"kind":"Field","name":{"kind":"Name","value":"tokenMetadataUri"}},{"kind":"Field","name":{"kind":"Name","value":"tokenUri"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"platformId"}},{"kind":"Field","name":{"kind":"Name","value":"chainId"}},{"kind":"Field","name":{"kind":"Name","value":"artistsNftsByNftId"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"artistByArtistId"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"nftsProcessedTracksByNftId"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"platformInternalId"}}]}}]}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/src/graph-ql/queries/spinamp/GET_MY_MUSIC/types.ts b/src/graph-ql/queries/spinamp/types.ts similarity index 100% rename from src/graph-ql/queries/spinamp/GET_MY_MUSIC/types.ts rename to src/graph-ql/queries/spinamp/types.ts