Skip to content

Commit

Permalink
remove js tests and add description to license metadata view
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuahannan committed Aug 22, 2023
1 parent ee4c409 commit 555e549
Show file tree
Hide file tree
Showing 22 changed files with 537 additions and 27,184 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,12 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
cache-dependency-path: lib/js/test/package-lock.json
- name: Install Flow CLI
run: sh -ci "$(curl -fsSL https://raw.githubusercontent.com/onflow/flow-cli/master/install.sh)" -- v1.3.1
- name: Flow CLI Version
run: flow version
- name: Update PATH
run: echo "/root/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: cd lib/js/test && npm ci
- name: Run tests
run: make ci

17 changes: 1 addition & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 📚 checkout
uses: actions/checkout@v2.4.2
- name: 🟢 node
uses: actions/setup-node@v3.2.0
with:
node-version: 15
registry-url: https://registry.npmjs.org
- name: Install Dependencies
run: npm i
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
uses: actions/checkout@v2.4.2
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
test:
$(MAKE) generate -C lib/go
$(MAKE) test -C lib/go
$(MAKE) test -C lib/js/test
flow test --cover tests/test_example_nft.cdc

.PHONY: ci
ci:
$(MAKE) ci -C lib/go
$(MAKE) ci -C lib/js/test
flow test --cover tests/test_example_nft.cdc
6 changes: 4 additions & 2 deletions contracts/ExampleNFT.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ pub contract ExampleNFT: NonFungibleToken, ViewResolver {
Type<MetadataViews.NFTCollectionData>(),
Type<MetadataViews.NFTCollectionDisplay>(),
Type<MetadataViews.Serial>(),
Type<MetadataViews.Traits>()
Type<MetadataViews.Traits>(),
Type<MetadataViews.NFTLicense>()
]
}

Expand Down Expand Up @@ -159,7 +160,8 @@ pub contract ExampleNFT: NonFungibleToken, ViewResolver {
traitsView.addTrait(fooTrait)

return traitsView

// case Type<MetadataViews.NFTLicense>():
// return nil //MetadataViews.NFTLicense()
}
return nil
}
Expand Down
74 changes: 50 additions & 24 deletions contracts/MetadataViews.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,12 @@ pub contract MetadataViews {
return MetadataViews.nlpVoteCom()
case ...
*/
///
/// The first version of the NFT license standard is only deployed
/// with the license names and text descriptions. Projects must refer
/// to the proposal and license documentation for specific descriptions of
/// the rights that each license grants.
///
pub struct NFTLicense {
/// Array of the specific license identifiers
pub let licenses: [String]
Expand All @@ -761,10 +767,14 @@ pub contract MetadataViews {
/// Link to a description of the specific rights that the license offers
pub var descriptionLink: Media?

/// Plain text description of the license
pub var description: String?

init() {
self.licenses = []
self.badgeLink = nil
self.descriptionLink = nil
self.description = nil
}

access(contract) fun setBadgeLink(link: Media) {
Expand All @@ -775,6 +785,10 @@ pub contract MetadataViews {
self.descriptionLink = link
}

access(contract) fun setDescription(_ description: String) {
self.description = description
}

access(contract) fun personalUse(): NFTLicense {
self.licenses.append("NLP-PER")
return self
Expand Down Expand Up @@ -804,85 +818,97 @@ pub contract MetadataViews {

pub fun nlpUtil(): NFTLicense {
let license = NFTLicense().personalUse().votingRights().additionalContentExperienceRights()
license.setBadgeLink(link: Media(file: , mediaType: ))
license.setDescriptionLink(link: Media(file: , mediaType: ))
// license.setBadgeLink(link: Media(file: , mediaType: ))
// license.setDescriptionLink(link: Media(file: , mediaType: ))
license.setDescription("This license gives the buyer Personal Use Rights, Voting Rights, and ACE Rights")
return license
}

pub fun nlpVoteMerch(): NFTLicense {
let license = NFTLicense().personalUse().votingRights().merchandisingRights()
license.setBadgeLink(link: Media(file: , mediaType: ))
license.setDescriptionLink(link: Media(file: , mediaType: ))
// license.setBadgeLink(link: Media(file: , mediaType: ))
// license.setDescriptionLink(link: Media(file: , mediaType: ))
license.setDescription("This license gives the buyer Personal Use Rights, Voting Rights, and Merch Rights")
return license
}

pub fun nlpVoteCom(): NFTLicense {
let license = NFTLicense().personalUse().votingRights().commercialRights()
license.setBadgeLink(link: Media(file: , mediaType: ))
license.setDescriptionLink(link: Media(file: , mediaType: ))
// license.setBadgeLink(link: Media(file: , mediaType: ))
// license.setDescriptionLink(link: Media(file: , mediaType: ))
license.setDescription("This license gives the buyer Personal Use Rights, Voting Rights, and Comm Rights")
return license
}

pub fun nlpAceMerch(): NFTLicense {
let license = NFTLicense().personalUse().additionalContentExperienceRights().merchandisingRights()
license.setBadgeLink(link: Media(file: , mediaType: ))
license.setDescriptionLink(link: Media(file: , mediaType: ))
// license.setBadgeLink(link: Media(file: , mediaType: ))
// license.setDescriptionLink(link: Media(file: , mediaType: ))
license.setDescription("This license gives the buyer Personal Use Rights, ACE Rights, and Merch Rights")
return license
}

pub fun nlpAceCom(): NFTLicense {
let license = NFTLicense().personalUse().additionalContentExperienceRights().commercialRights()
license.setBadgeLink(link: Media(file: , mediaType: ))
license.setDescriptionLink(link: Media(file: , mediaType: ))
// license.setBadgeLink(link: Media(file: , mediaType: ))
// license.setDescriptionLink(link: Media(file: , mediaType: ))
license.setDescription("This license gives the buyer Personal Use Rights, ACE Rights, and Comm Rights")
return license
}

pub fun nlpUtilMerch(): NFTLicense {
let license = NFTLicense().personalUse().votingRights().additionalContentExperienceRights().merchandisingRights()
license.setBadgeLink(link: Media(file: , mediaType: ))
license.setDescriptionLink(link: Media(file: , mediaType: ))
// license.setBadgeLink(link: Media(file: , mediaType: ))
// license.setDescriptionLink(link: Media(file: , mediaType: ))
license.setDescription("This license gives the buyer Personal Use Rights, Voting Rights, ACE Rights, and Merch Rights")
return license
}

pub fun nlpUtilCom(): NFTLicense {
let license = NFTLicense().personalUse().votingRights().additionalContentExperienceRights().commercialRights()
license.setBadgeLink(link: Media(file: , mediaType: ))
license.setDescriptionLink(link: Media(file: , mediaType: ))
// license.setBadgeLink(link: Media(file: , mediaType: ))
// license.setDescriptionLink(link: Media(file: , mediaType: ))
license.setDescription("This license gives the buyer Personal Use Rights, Voting Rights, ACE Rights, and Comm Rights")
return license
}

pub fun nlpAce(): NFTLicense {
let license = NFTLicense().additionalContentExperienceRights()
license.setBadgeLink(link: Media(file: , mediaType: ))
license.setDescriptionLink(link: Media(file: , mediaType: ))
// license.setBadgeLink(link: Media(file: , mediaType: ))
// license.setDescriptionLink(link: Media(file: , mediaType: ))
license.setDescription("This license gives the buyer ACE Rights")
return license
}

pub fun nlpPer(): NFTLicense {
let license = NFTLicense().personalUse()
license.setBadgeLink(link: Media(file: , mediaType: ))
license.setDescriptionLink(link: Media(file: , mediaType: ))
// license.setBadgeLink(link: Media(file: , mediaType: ))
// license.setDescriptionLink(link: Media(file: , mediaType: ))
license.setDescription("This license gives the buyer Personal Use Rights")
return license
}

pub fun nlpVote(): NFTLicense {
let license = NFTLicense().votingRights()
license.setBadgeLink(link: Media(file: , mediaType: ))
license.setDescriptionLink(link: Media(file: , mediaType: ))
// license.setBadgeLink(link: Media(file: , mediaType: ))
// license.setDescriptionLink(link: Media(file: , mediaType: ))
license.setDescription("This license gives the buyer Voting Rights")
return license
}

pub fun nlpCom(): NFTLicense {
let license = NFTLicense().commercialRights()
license.setBadgeLink(link: Media(file: , mediaType: ))
license.setDescriptionLink(link: Media(file: , mediaType: ))
// license.setBadgeLink(link: Media(file: , mediaType: ))
// license.setDescriptionLink(link: Media(file: , mediaType: ))
license.setDescription("This license gives the buyer Comm Rights")
return license
}

pub fun nlpMerch(): NFTLicense {
let license = NFTLicense().merchandisingRights()
license.setBadgeLink(link: Media(file: , mediaType: ))
license.setDescriptionLink(link: Media(file: , mediaType: ))
// license.setBadgeLink(link: Media(file: , mediaType: ))
// license.setDescriptionLink(link: Media(file: , mediaType: ))
license.setDescription("This license gives the buyer Merch Rights")
return license
}

Expand Down
Loading

0 comments on commit 555e549

Please sign in to comment.