diff --git a/packages/app/src/models/models.ts b/packages/app/src/models/models.ts index 39e78f24..e70656e0 100644 --- a/packages/app/src/models/models.ts +++ b/packages/app/src/models/models.ts @@ -9,8 +9,8 @@ export interface Steward { address: string; actions: number; totalEarned: string; - // nfts: ProvableNFT[] | string[]; --> This can be fetched, but we are not using it in the MVP collectives: StewardCollective[]; + nfts: ProvableNFT[]; } export interface DonorCollective { @@ -55,11 +55,12 @@ export interface IpfsCollective { images?: string[]; } -// export type ProvableNFT = { -// owner: string; -// hash: string; -// collective: Collective | string; -// }; +export type ProvableNFT = { + id: string; + owner: string; + hash: string; + collective: string; +}; export interface Transaction { hash: string; diff --git a/packages/app/src/models/transforms.ts b/packages/app/src/models/transforms.ts index de8d32c8..e2083deb 100644 --- a/packages/app/src/models/transforms.ts +++ b/packages/app/src/models/transforms.ts @@ -7,6 +7,7 @@ import { DonorCollective, ClaimTx, SupportTx, + ProvableNFT, } from './models'; import { SubgraphClaim, @@ -14,6 +15,7 @@ import { SubgraphDonor, SubgraphDonorCollective, SubgraphIpfsCollective, + SubgraphProvableNFT, SubgraphSteward, SubgraphStewardCollective, SubgraphSupportEvent, @@ -36,6 +38,7 @@ export function subgraphStewardToModel(subgraphSteward: SubgraphSteward): Stewar actions: subgraphSteward.actions, totalEarned: subgraphSteward.totalEarned, collectives: subgraphSteward.collectives.map(subgraphStewardCollectiveToModel), + nfts: subgraphSteward.nfts.map(subgraphProvableNftToModel), }; } @@ -104,6 +107,15 @@ export function subgraphClaimToModel(subgraphClaim: SubgraphClaim): ClaimTx { }; } +export function subgraphProvableNftToModel(nft: SubgraphProvableNFT): ProvableNFT { + return { + id: nft.id, + owner: nft.owner, + hash: nft.hash, + collective: nft.collective.id, + }; +} + export function subgraphSupportEventToModel(subgraphSupportEvent: SubgraphSupportEvent): SupportTx { return { hash: subgraphSupportEvent.id, diff --git a/packages/app/src/subgraph/subgraphModels.ts b/packages/app/src/subgraph/subgraphModels.ts index 0d41a83e..f20c4db5 100644 --- a/packages/app/src/subgraph/subgraphModels.ts +++ b/packages/app/src/subgraph/subgraphModels.ts @@ -19,8 +19,8 @@ export type SubgraphSteward = { id: string; actions: number; totalEarned: string; - nfts?: SubgraphProvableNFT[] | { id: string }[]; collectives: SubgraphStewardCollective[]; + nfts: SubgraphProvableNFT[]; }; export type SubgraphStewardCollective = { @@ -83,8 +83,8 @@ export type SubgraphProvableNFT = { id: string; owner: string; hash: string; - steward: SubgraphSteward[] | { id: string }[]; - collective: SubgraphCollective | string; + stewards?: SubgraphSteward[] | { id: string }[]; + collective: SubgraphCollective | { id: string }; }; export type SubgraphClaimEvent = { diff --git a/packages/app/src/subgraph/useSubgraphSteward.ts b/packages/app/src/subgraph/useSubgraphSteward.ts index 8099d59a..7cc60e48 100644 --- a/packages/app/src/subgraph/useSubgraphSteward.ts +++ b/packages/app/src/subgraph/useSubgraphSteward.ts @@ -19,6 +19,14 @@ const steward = gql` actions totalEarned } + nfts { + id + owner + hash + collective { + id + } + } } } `;