diff --git a/scripts/get_collection_external_url.cdc b/scripts/get_collection_external_url.cdc new file mode 100644 index 0000000..defa7c6 --- /dev/null +++ b/scripts/get_collection_external_url.cdc @@ -0,0 +1,5 @@ +import "FlowtyWrapped" + +pub fun main(): String { + return FlowtyWrapped.collectionExternalUrl +} \ No newline at end of file diff --git a/test/FlowtyWrapped_tests.cdc b/test/FlowtyWrapped_tests.cdc index 9d510cc..babc4cd 100644 --- a/test/FlowtyWrapped_tests.cdc +++ b/test/FlowtyWrapped_tests.cdc @@ -46,6 +46,16 @@ pub fun testGetRaffleManager() { scriptExecutor("raffle/borrow_raffle_manager.cdc", [rafflesAcct.address]) } +pub fun testSetCollectionExternalUrl() { + let baseHtmlUrl: String = "https://flowty.io/asset/0x0000000000000007/FlowtyWrappedTEST" + + txExecutor("set_collection_external_url.cdc", [rafflesAcct], [baseHtmlUrl], nil) + + let result = scriptExecutor("get_collection_external_url.cdc", []) + let castedResult = result! as! String + assert(castedResult == baseHtmlUrl, message: "baseHtmlUrl does not match expected") +} + pub fun testMint() { let acct = Test.createAccount() let username: String = "user1" diff --git a/transactions/set_collection_external_url.cdc b/transactions/set_collection_external_url.cdc new file mode 100644 index 0000000..81b0b5b --- /dev/null +++ b/transactions/set_collection_external_url.cdc @@ -0,0 +1,15 @@ +import "FlowtyWrapped" + + +transaction(url: String) { + let admin: &FlowtyWrapped.Admin + + prepare(acct: AuthAccount) { + self.admin = acct.borrow<&FlowtyWrapped.Admin>(from: FlowtyWrapped.AdminStoragePath) + ?? panic("Could not borrow a reference to the NFT minter") + } + + execute { + self.admin.setCollectionExternalUrl(url) + } +} \ No newline at end of file