Skip to content

Commit

Permalink
Add animation URLS to Opensea Asset (#968)
Browse files Browse the repository at this point in the history
* Include animation urls in asset (#325)


* Add getAsset integration test

---------

Co-authored-by: Will Harris <[email protected]>
  • Loading branch information
JoshuaSchmidt-OpenSea and fjij authored May 18, 2023
1 parent 56b51da commit 939136a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/__integration_tests__/getAsset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { assert } from "chai";
import { suite, test } from "mocha";
import { sdk } from "./init";

suite("SDK: getAsset", () => {
test("Get Asset", async () => {
const tokenAddress = "0x059edd72cd353df5106d2b9cc5ab83a52287ac3a"; // Chromie Squiggles
const assetToGet = {
tokenAddress,
tokenId: "1",
};
const asset = await sdk.api.getAsset(assetToGet);
assert(asset, "Asset should not be null");
assert(
asset.assetContract.address === tokenAddress,
"Contract address should match."
);
assert(asset.animationUrl, "Animation URL should not be null");
});
});
4 changes: 4 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,10 @@ export interface OpenSeaAsset extends Asset {
imageUrlOriginal: string;
// Thumbnail url for this token
imageUrlThumbnail: string;
// The animation url for this token, if it exists
animationUrl: string | null;
// The original animation url for this token, if it exists
animationUrlOriginal: string | null;
// Link to token on OpenSea
openseaLink: string;
// Link to token on dapp's site
Expand Down
3 changes: 3 additions & 0 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ export const assetFromJSON = (asset: any): OpenSeaAsset => {
imageUrlOriginal: asset.image_original_url,
imageUrlThumbnail: asset.image_thumbnail_url,

animationUrl: asset.animation_url,
animationUrlOriginal: asset.animation_original_url,

externalLink: asset.external_link,
openseaLink: asset.permalink,
traits: asset.traits,
Expand Down

0 comments on commit 939136a

Please sign in to comment.