Skip to content

Commit

Permalink
filter out collection fields not applicable on asset on derivation (#149
Browse files Browse the repository at this point in the history
)
  • Loading branch information
nhanphan authored Jun 21, 2024
1 parent 49de271 commit c286bd3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 3 additions & 5 deletions clients/js/src/helpers/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,10 @@ export function deriveAssetPlugins(
}
});

const { numMinted, currentSize, masterEdition, ...colRest } = collection; // remove collection only fields

return {
...{
...collection,
// the following plugins can only be on the collection
masterEdition: undefined,
},
...colRest,
...asset,
...externalPluginAdapters,
};
Expand Down
4 changes: 4 additions & 0 deletions clients/js/test/helps/fetch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ test('it can use helper to fetch assets by collection and derive plugins', async
fetchedAssets.forEach((asset) => {
if (asset.publicKey === override.publicKey) {
t.like(asset, {
numMinted: undefined,
currentSize: undefined,
attributes: {
attributeList: [
{
Expand All @@ -142,6 +144,8 @@ test('it can use helper to fetch assets by collection and derive plugins', async
});
} else {
t.like(asset, {
numMinted: undefined,
currentSize: undefined,
freezeDelegate: {
frozen: true,
},
Expand Down

0 comments on commit c286bd3

Please sign in to comment.