diff --git a/packages/contracts/flow/contracts/SakutaroPoem.cdc b/packages/contracts/flow/contracts/SakutaroPoem.cdc index 96266c6..edead6e 100644 --- a/packages/contracts/flow/contracts/SakutaroPoem.cdc +++ b/packages/contracts/flow/contracts/SakutaroPoem.cdc @@ -122,6 +122,7 @@ access(all) contract SakutaroPoem: NonFungibleToken { access(all) resource interface SakutaroPoemCollectionPublic { access(all) fun deposit(token: @{NonFungibleToken.NFT}) access(all) view fun getIDs(): [UInt64] + access(all) view fun getLength(): Int access(all) view fun borrowNFT(_ id: UInt64): &{NonFungibleToken.NFT}? access(all) view fun borrowPoem(_ id: UInt64): &SakutaroPoem.NFT? { post { @@ -164,6 +165,10 @@ access(all) contract SakutaroPoem: NonFungibleToken { return self.ownedNFTs.keys } + access(all) view fun getLength(): Int { + return self.ownedNFTs.length + } + access(all) view fun borrowNFT(_ id: UInt64): &{NonFungibleToken.NFT}? { return &self.ownedNFTs[id] as &{NonFungibleToken.NFT}? } diff --git a/packages/contracts/flow/contracts/SakutaroPoemReplica.cdc b/packages/contracts/flow/contracts/SakutaroPoemReplica.cdc index a2005cc..528a4b2 100644 --- a/packages/contracts/flow/contracts/SakutaroPoemReplica.cdc +++ b/packages/contracts/flow/contracts/SakutaroPoemReplica.cdc @@ -71,6 +71,7 @@ access(all) contract SakutaroPoemReplica: NonFungibleToken { access(all) resource interface SakutaroPoemReplicaCollectionPublic { access(all) fun deposit(token: @{NonFungibleToken.NFT}) access(all) view fun getIDs(): [UInt64] + access(all) view fun getLength(): Int access(all) view fun borrowNFT(_ id: UInt64): &{NonFungibleToken.NFT}? access(all) view fun borrowPoem(_ id: UInt64): &SakutaroPoemReplica.NFT? { post { @@ -113,6 +114,10 @@ access(all) contract SakutaroPoemReplica: NonFungibleToken { return self.ownedNFTs.keys } + access(all) view fun getLength(): Int { + return self.ownedNFTs.length + } + access(all) view fun borrowNFT(_ id: UInt64): &{NonFungibleToken.NFT}? { return &self.ownedNFTs[id] as &{NonFungibleToken.NFT}? } diff --git a/packages/contracts/flow/flow.json b/packages/contracts/flow/flow.json index 06d7c97..a1d5d77 100644 --- a/packages/contracts/flow/flow.json +++ b/packages/contracts/flow/flow.json @@ -6,9 +6,30 @@ } }, "contracts": { - "NonFungibleToken": "./contracts/core/NonFungibleToken.cdc", - "ViewResolver": "./contracts/core/ViewResolver.cdc", - "MetadataViews": "./contracts/core/MetadataViews.cdc", + "NonFungibleToken": { + "source": "./contracts/core/NonFungibleToken.cdc", + "aliases": { + "emulator": "f8d6e0586b0a20c7", + "mainnet": "1d7e57aa55817448", + "testnet": "631e88ae7f1d7c20" + } + }, + "ViewResolver": { + "source": "./contracts/core/ViewResolver.cdc", + "aliases": { + "emulator": "f8d6e0586b0a20c7", + "mainnet": "1d7e57aa55817448", + "testnet": "631e88ae7f1d7c20" + } + }, + "MetadataViews": { + "source": "./contracts/core/MetadataViews.cdc", + "aliases": { + "emulator": "f8d6e0586b0a20c7", + "mainnet": "1d7e57aa55817448", + "testnet": "631e88ae7f1d7c20" + } + }, "Base64Util": "./contracts/Base64Util.cdc", "SakutaroPoem": "./contracts/SakutaroPoem.cdc", "SakutaroPoemReplica": "./contracts/SakutaroPoemReplica.cdc", @@ -55,15 +76,7 @@ }, "deployments": { "emulator": { - "emulator-account": [ - "NonFungibleToken", - "ViewResolver", - "MetadataViews", - "Base64Util", - "SakutaroPoem", - "SakutaroPoemReplica", - "SakutaroPoemContent" - ] + "emulator-account": ["Base64Util", "SakutaroPoem", "SakutaroPoemReplica", "SakutaroPoemContent"] }, "testnet": { "testnet-account": ["Base64Util", "SakutaroPoem", "SakutaroPoemReplica", "SakutaroPoemContent"]