Skip to content

Commit

Permalink
default destroy event, event args, id field, remove getID, go test up…
Browse files Browse the repository at this point in the history
…dates
  • Loading branch information
joshuahannan committed Jan 10, 2024
1 parent ecf0b5b commit aebb56b
Show file tree
Hide file tree
Showing 25 changed files with 760 additions and 1,381 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.19'
go-version: '1.20'
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install Flow CLI
run: sh -ci "$(curl -fsSL https://raw.githubusercontent.com/onflow/flow-cli/master/install.sh)" -- v1.5.0-stable-cadence.3
run: sh -ci "$(curl -fsSL https://raw.githubusercontent.com/onflow/flow-cli/master/install.sh)" -- v1.9.2-stable-cadence.1
- name: Flow CLI Version
run: flow version
- name: Update PATH
Expand Down
12 changes: 8 additions & 4 deletions contracts/BasicNFT-v2.cdc → contracts/BasicNFT.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,19 @@ access(all) contract BasicNFT {
access(all) resource NFT: NonFungibleToken.NFT, ViewResolver.Resolver {
/// Arbitrary trait mapping metadata
access(self) let metadata: {String: AnyStruct}

access(all) let id: UInt64

init(
metadata: {String: AnyStruct},
) {
self.id = self.uuid
self.metadata = metadata
}

/// Gets the ID of the NFT, which here is the UUID
access(all) view fun getID(): UInt64 { return self.uuid }
access(all) fun createEmptyCollection(): @{NonFungibleToken.Collection} {
return <- BasicNFT.createEmptyCollection()
}

/// Uses the basic NFT views
access(all) view fun getViews(): [Type] {
Expand All @@ -53,7 +57,7 @@ access(all) contract BasicNFT {
)
case Type<MetadataViews.Serial>():
return MetadataViews.Serial(
self.getID()
self.id
)
case Type<MetadataViews.Traits>():
return MetadataViews.dictToTraits(dict: self.metadata, excludedNames: nil)
Expand All @@ -74,7 +78,7 @@ access(all) contract BasicNFT {

init() {
let minter <- create NFTMinter()
self.account.save(<-minter, to: /storage/flowBasicNFTMinterPath)
self.account.storage.save(<-minter, to: /storage/flowBasicNFTMinterPath)
}
}

Loading

0 comments on commit aebb56b

Please sign in to comment.