Skip to content

feat: new store method that uploads token with all the assets and metadata - #56

Merged
alanshaw merged 29 commits into
mainfrom
feat/nft-meta-block
May 7, 2021
Merged

feat: new store method that uploads token with all the assets and metadata#56
alanshaw merged 29 commits into
mainfrom
feat/nft-meta-block

Conversation

@Gozala

@Gozala Gozala commented Apr 6, 2021

Copy link
Copy Markdown
Contributor

Supersedes #50

@Gozala
Gozala requested review from alanshaw and hugomrdias April 6, 2021 07:01
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 6, 2021

Copy link
Copy Markdown

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 229deed
Status: ✅  Deploy successful!
Preview URL: https://87b1104e.nft-storage.pages.dev

View logs

@alanshaw alanshaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome work 🚀

I think that where we have Token in this code we should replace with Metadata (or similar) so we don't confuse with our API key token.

Please could we get a really good example added to the README.md in place of what's currently there? 🙏

Comment thread client/src/lib.js Outdated
Comment thread client/src/lib.js Outdated
Comment thread client/src/lib.js
Comment thread client/package.json Outdated
Comment thread client/src/lib/interface.ts Outdated
Comment thread client/src/lib.js Outdated
Comment thread client/src/lib/interface.ts Outdated
Comment thread client/src/lib/interface.ts Outdated
Comment thread client/src/lib/interface.ts Outdated
Comment thread client/src/lib/interface.ts Outdated
Comment thread client/test/service.js
Comment thread client/test/service.js Outdated
Comment thread client/test/service.js Outdated
Comment thread client/test/lib.spec.js
Comment thread client/test/lib.spec.js
Comment thread client/test/service.js Outdated
Comment thread client/src/lib.js Outdated
Comment thread client/package.json Outdated
Comment thread client/package.json Outdated
Comment thread client/test/service.js Outdated
@codecov-io

codecov-io commented Apr 7, 2021

Copy link
Copy Markdown

Codecov Report

Merging #56 (e952844) into main (eacf295) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##              main       #56    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files            2         3     +1     
  Lines          243       574   +331     
==========================================
+ Hits           243       574   +331     
Impacted Files Coverage Δ
src/lib.js 100.00% <0.00%> (ø)
src/token.js 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eacf295...e952844. Read the comment docs.

@Gozala
Gozala requested a review from alanshaw April 8, 2021 21:26
@Gozala
Gozala force-pushed the feat/nft-meta-block branch from b1dfd93 to bee00e5 Compare May 5, 2021 18:26
@Gozala

Gozala commented May 5, 2021

Copy link
Copy Markdown
Contributor Author

I have updated pull request so it now uses cluster and it is ready to be reviewed.

@Gozala
Gozala requested a review from ribasushi May 5, 2021 18:34
Comment thread site/src/routes/nfts-store.js
@alanshaw alanshaw mentioned this pull request May 6, 2021

@alanshaw alanshaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks incredible! A few things that can be sent as followup PRs if you like:

  • We need an update to the OpenAPI schema
  • We should alter the docs for the JS client on the homepage to use the new store method
  • We should change the example here to use the new API
  • We should add example(s?) here

Comment thread client/src/lib/interface.ts
Comment thread client/src/lib/interface.ts
Comment thread client/src/lib/interface.ts
Comment thread client/src/lib/interface.ts
Comment thread client/test/lib.spec.js Outdated
Comment thread site/src/cluster.js Outdated
Comment thread site/src/routes/nfts-store.js
Comment thread site/src/utils/utils.js Outdated
Comment thread client/src/token.js
Comment thread site/src/cluster.js Outdated
@@ -1,5 +1,6 @@
import { Cluster } from '@nftstorage/ipfs-cluster'
import { cluster } from './constants.js'
import { CID } from 'multiformats'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just use the cid string ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need CIDs to assemble an IPLD node. I could move the the CID string parsing to the other module, if that is what you want but CID is needed one way or the other.

@hugomrdias please let me know if this is ok, or if you want me to move the parsing to other module.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would prefer to remove this here but its not a blocker

Comment thread site/src/utils/utils.js Outdated
Comment thread site/tsconfig.json
@Gozala
Gozala requested a review from hugomrdias May 6, 2021 21:48
@Gozala Gozala mentioned this pull request May 7, 2021
Comment thread site/tsconfig.json
"esModuleInterop": true,
// Need to disable this because generated typedefs omit generics which
// creates a problew for multiformats
// @see https://github.com/multiformats/js-multiformats#typescript-support

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but we are on 4.2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR updates to v7

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but we are on 4.2

Generated types don't have type parameters possibly because multiformats is either on older version of TS or maybe that bug has not been fixed yet.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh 🤣 I just realised you meant typescript 4.2 - sorry ignore me

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into this and seems that problem is not with multiformats, but rather with dag-cbor.

Comment thread site/src/cluster.js Outdated
@@ -1,5 +1,6 @@
import { Cluster } from '@nftstorage/ipfs-cluster'
import { cluster } from './constants.js'
import { CID } from 'multiformats'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would prefer to remove this here but its not a blocker

@hugomrdias hugomrdias left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but i'm getting errors running api ts check

did you enable the git hooks like this https://github.com/ipfs-shipyard/nft.storage#development ?

i added an issue to add a github action to run api tests in the CI to avoid these problems in the future

@alanshaw

alanshaw commented May 7, 2021

Copy link
Copy Markdown
Contributor

I upgraded to multiformats@8 - the same version @ipld/car uses and typescript seems to be happier.

@alanshaw
alanshaw merged commit 4473385 into main May 7, 2021
@alanshaw
alanshaw deleted the feat/nft-meta-block branch May 7, 2021 12:46
@alanshaw alanshaw mentioned this pull request May 12, 2021
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants