From e96effa499a1fb8a66083b9dba51f0a94d899009 Mon Sep 17 00:00:00 2001 From: loic1 <17323063+loic1@users.noreply.github.com> Date: Mon, 17 Jun 2024 11:11:07 -0600 Subject: [PATCH] clean up link provider tx --- .../go/templates/internal/assets/assets.go | 25 +------------------ pds/lib/go/templates/transaction_templates.go | 25 +++++++------------ pds/lib/go/test/pds_test.go | 24 ------------------ .../link_providerCap_dapperSport.cdc | 16 ------------ 4 files changed, 10 insertions(+), 80 deletions(-) delete mode 100644 pds/transactions/dapperSport/link_providerCap_dapperSport.cdc diff --git a/pds/lib/go/templates/internal/assets/assets.go b/pds/lib/go/templates/internal/assets/assets.go index 11e9fb2..6af08de 100644 --- a/pds/lib/go/templates/internal/assets/assets.go +++ b/pds/lib/go/templates/internal/assets/assets.go @@ -18,7 +18,6 @@ // ../../../scripts/pds/get_next_dist_id.cdc // ../../../transactions/collectibleNFT/mint.cdc // ../../../transactions/collectibleNFT/setup_collection_and_link_provider.cdc -// ../../../transactions/dapperSport/link_providerCap_dapperSport.cdc // ../../../transactions/dapperSport/setup_dapperSport.cdc // ../../../transactions/deploy/deploy-packNFT-with-auth.cdc // ../../../transactions/deploy/deploy-pds-with-auth.cdc @@ -480,26 +479,6 @@ func transactionsCollectiblenftSetup_collection_and_link_providerCdc() (*asset, return a, nil } -var _transactionsDappersportLink_providercap_dappersportCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x90\x41\xab\xea\x30\x10\x85\xf7\xf9\x15\x83\x0b\xa9\xf0\xa8\xfb\xf2\xde\x83\x8b\xe2\x52\x0a\xfa\x07\xa6\xe9\xd8\x0e\xc6\x24\x4c\x26\xba\x10\xff\xfb\xa5\xd6\x5b\x8a\x08\x77\x56\xd3\xc3\x39\xd3\x2f\x87\x2f\x31\x88\xc2\x3e\xf8\x5d\xf6\x1d\x37\x8e\x8e\xe1\x4c\x1e\x4e\x12\x2e\xb0\x78\x97\x17\xe6\xe5\xdf\x62\x8c\x24\x87\xe7\x3e\x5a\x67\xca\xc2\x18\x15\xf4\x09\xad\x72\xf0\xc5\x7e\x77\xac\x25\x5c\xb9\x25\xa9\x51\xfb\x0a\x6a\xe1\x2b\x2a\x0d\x1f\x2b\xb8\x1b\x03\x00\x10\x85\x22\x0a\x15\x89\x3b\x4f\x52\x01\x66\xed\x8b\x0d\x46\x6c\xd8\xb1\x32\xa5\x15\x2c\xbf\xac\x0d\xd9\xeb\x90\x81\xd7\xf0\x09\xc6\x44\x69\x67\xde\xb2\x23\xfd\xbb\xbc\xbf\xd3\x97\x3f\x18\x8f\xff\x05\x6a\x05\x6f\x60\xab\xd2\xf6\x64\xcf\xc5\xfc\xfe\x30\x42\x9a\xc5\x4f\xd2\x63\xda\x1c\x29\x58\x8c\xf0\xef\x23\x43\xd2\x20\xd8\x51\xc9\x29\x65\xfa\x85\x46\x51\x3a\xd2\x6a\x5e\x6b\xb9\x09\xce\xd1\xb3\xc1\xc3\x78\xe9\xc9\x68\xa6\xbf\xaf\xd7\x70\xec\x39\x81\x27\x6a\x13\x68\x80\x86\x20\x27\x6a\x87\x15\x9d\x0b\x37\x38\x05\x81\x7a\x7b\x18\x84\x1b\x6b\xdf\x0a\xde\xa6\xf4\x27\xe2\x98\x1b\xc7\xa9\x2f\x2c\xc6\x3f\xf0\xa9\x20\x33\xbe\xdf\x3c\xcc\x77\x00\x00\x00\xff\xff\xe6\xb1\x24\x8d\x37\x02\x00\x00" - -func transactionsDappersportLink_providercap_dappersportCdcBytes() ([]byte, error) { - return bindataRead( - _transactionsDappersportLink_providercap_dappersportCdc, - "transactions/dapperSport/link_providerCap_dapperSport.cdc", - ) -} - -func transactionsDappersportLink_providercap_dappersportCdc() (*asset, error) { - bytes, err := transactionsDappersportLink_providercap_dappersportCdcBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "transactions/dapperSport/link_providerCap_dapperSport.cdc", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - var _transactionsDappersportSetup_dappersportCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x52\xcd\x6e\x9b\x40\x10\xbe\xef\x53\xcc\xa9\xc5\x92\x63\x7a\x8e\x9c\x48\x51\x5b\xdf\x6a\x45\x0a\x2f\x30\xac\x07\x58\x65\xd9\x59\x2d\x43\x53\x0b\xf1\xee\xd5\x02\xc2\xe0\xd8\x52\xf6\x80\x80\xf9\x7e\x07\x4c\xed\x39\x08\x1c\xd9\x1d\x5a\x57\x9a\xdc\x52\xc6\xef\xe4\xa0\x08\x5c\xc3\x8f\x7f\x5d\xb7\xbb\x1e\xf5\xbd\x9a\x48\xbf\xd0\x7b\x0a\x6f\xc3\xfd\x05\xbf\x78\xdb\xf7\x4a\xa5\x29\x64\x95\x69\x40\x02\xba\x06\xb5\x18\x76\xa0\xd9\x15\xa6\x6c\x03\x35\x80\x0e\x50\x6b\x6e\x9d\x80\x30\x54\x6c\x4f\x2b\xd9\xe3\x21\x6b\x76\x4a\x2d\xc9\x9d\x02\x00\xf0\x81\x3c\x06\x4a\x1a\x53\x3a\x0a\x8f\xf0\xd2\x4a\xf5\x32\x0a\x6d\x26\x48\x3c\x69\x0a\xa6\x00\xa9\x68\x76\x39\x31\x35\xee\xbb\x00\xda\x40\x78\x3a\x43\x85\x7f\x09\x10\x34\x5b\x4b\x83\xc1\xcc\x35\x05\x8c\xea\xbb\x9c\x43\xe0\x8f\xfd\xb7\x45\xb2\xdd\xcf\x99\xf0\x9c\xc4\xf2\x8f\x70\x7b\xfa\x26\x1c\xb0\xa4\x57\x94\x6a\x03\x4f\x4f\xe0\x8c\x85\x4e\xcd\x26\x53\x48\x1d\x08\x25\xe6\x70\xf4\x01\x54\x7b\x39\xdf\x4a\x14\x8f\x25\x59\x8c\x60\xff\xb0\xf2\x1d\x75\x7e\x47\x81\x4b\x84\x64\xf3\xc9\xaf\x89\xad\xcd\xb0\xf3\xc5\x72\x56\xa8\xa9\x7b\x44\x26\xfb\x87\x8b\xe5\x16\x84\xbf\x52\xf6\x7e\x47\xdf\xe6\xd6\x68\xd0\xe8\x31\x37\xd6\xc8\x19\x0a\x0e\x43\x8e\x3b\x9d\xa7\x28\xd6\xb8\xf7\x7b\x1f\xa1\xbb\xfe\x4d\x17\xb3\xd7\xc1\x6f\xbb\xca\xfc\x87\x6b\x72\x72\x3c\x64\xd7\xb0\xfe\x39\x59\x79\xc7\x73\xdb\x72\xc4\xc7\xae\xdb\x4f\x0c\xc1\x50\x92\x7c\x61\x4d\x2b\xe6\x66\x7e\xea\xd5\x78\xed\xd5\xff\x00\x00\x00\xff\xff\xdc\xa5\x3d\x19\xa1\x03\x00\x00" func transactionsDappersportSetup_dappersportCdcBytes() ([]byte, error) { @@ -1070,7 +1049,6 @@ var _bindata = map[string]func() (*asset, error){ "scripts/pds/get_next_dist_id.cdc": scriptsPdsGet_next_dist_idCdc, "transactions/collectibleNFT/mint.cdc": transactionsCollectiblenftMintCdc, "transactions/collectibleNFT/setup_collection_and_link_provider.cdc": transactionsCollectiblenftSetup_collection_and_link_providerCdc, - "transactions/dapperSport/link_providerCap_dapperSport.cdc": transactionsDappersportLink_providercap_dappersportCdc, "transactions/dapperSport/setup_dapperSport.cdc": transactionsDappersportSetup_dappersportCdc, "transactions/deploy/deploy-packNFT-with-auth.cdc": transactionsDeployDeployPacknftWithAuthCdc, "transactions/deploy/deploy-pds-with-auth.cdc": transactionsDeployDeployPdsWithAuthCdc, @@ -1171,8 +1149,7 @@ var _bintree = &bintree{nil, map[string]*bintree{ "setup_collection_and_link_provider.cdc": &bintree{transactionsCollectiblenftSetup_collection_and_link_providerCdc, map[string]*bintree{}}, }}, "dapperSport": &bintree{nil, map[string]*bintree{ - "link_providerCap_dapperSport.cdc": &bintree{transactionsDappersportLink_providercap_dappersportCdc, map[string]*bintree{}}, - "setup_dapperSport.cdc": &bintree{transactionsDappersportSetup_dappersportCdc, map[string]*bintree{}}, + "setup_dapperSport.cdc": &bintree{transactionsDappersportSetup_dappersportCdc, map[string]*bintree{}}, }}, "deploy": &bintree{nil, map[string]*bintree{ "deploy-packNFT-with-auth.cdc": &bintree{transactionsDeployDeployPacknftWithAuthCdc, map[string]*bintree{}}, diff --git a/pds/lib/go/templates/transaction_templates.go b/pds/lib/go/templates/transaction_templates.go index 9e0c0be..0c614d7 100644 --- a/pds/lib/go/templates/transaction_templates.go +++ b/pds/lib/go/templates/transaction_templates.go @@ -9,16 +9,15 @@ import ( ) const ( - filenameDeployPackNFT = "transactions/deploy/deploy-packNFT-with-auth.cdc" - filenameDeployPDS = "transactions/deploy/deploy-pds-with-auth.cdc" - filenameCreatePackIssuer = "transactions/pds/create_new_pack_issuer.cdc" - filenameLinkExampleNFTProviderCap = "transactions/exampleNFT/link_providerCap_exampleNFT.cdc" - filenmaeSetPackIssuerCap = "transactions/pds/set_pack_issuer_cap.cdc" - filenameCreateDistribution = "transactions/pds/create_distribution.cdc" - filenameMintPackNFT = "transactions/pds/mint_packNFT.cdc" - filenameSettleDistribution = "transactions/pds/settle.cdc" - filenameOpenPackNFT = "transactions/pds/open_packNFT.cdc" - filenameRevealRequest = "transactions/packNFT/reveal_request.cdc" + filenameDeployPackNFT = "transactions/deploy/deploy-packNFT-with-auth.cdc" + filenameDeployPDS = "transactions/deploy/deploy-pds-with-auth.cdc" + filenameCreatePackIssuer = "transactions/pds/create_new_pack_issuer.cdc" + filenmaeSetPackIssuerCap = "transactions/pds/set_pack_issuer_cap.cdc" + filenameCreateDistribution = "transactions/pds/create_distribution.cdc" + filenameMintPackNFT = "transactions/pds/mint_packNFT.cdc" + filenameSettleDistribution = "transactions/pds/settle.cdc" + filenameOpenPackNFT = "transactions/pds/open_packNFT.cdc" + filenameRevealRequest = "transactions/packNFT/reveal_request.cdc" ) // GenerateDeployPackNFTTx returns a transaction script that @@ -43,12 +42,6 @@ func GenerateCreatePackIssuerTx(pdsAddress flow.Address) []byte { return replaceAddresses(code, flow.EmptyAddress, flow.EmptyAddress, flow.EmptyAddress, flow.EmptyAddress, flow.EmptyAddress, pdsAddress, flow.EmptyAddress) } -// GenerateLinkExampleNFTProviderCapTx returns a transaction script that links NFT provider to a private path -func GenerateLinkExampleNFTProviderCapTx(nftAddress, exampleNFTAddress flow.Address) []byte { - code := string(assets.MustAsset(filenameLinkExampleNFTProviderCap)) - return replaceAddresses(code, nftAddress, exampleNFTAddress, flow.EmptyAddress, flow.EmptyAddress, flow.EmptyAddress, flow.EmptyAddress, flow.EmptyAddress) -} - // GenerateSetPackIssuerCapTx returns a transaction script that sets the pack issuer capability func GenerateSetPackIssuerCapTx(pdsAddress flow.Address) []byte { code := string(assets.MustAsset(filenmaeSetPackIssuerCap)) diff --git a/pds/lib/go/test/pds_test.go b/pds/lib/go/test/pds_test.go index 4415b7e..a1b0ad4 100644 --- a/pds/lib/go/test/pds_test.go +++ b/pds/lib/go/test/pds_test.go @@ -150,30 +150,6 @@ func TestCreateDistribution(t *testing.T) { false, ) - // t.Run("Should be able to link NFT provider capability", func(t *testing.T) { - - // // Assumes issuer is deployer of exampleNFT - // script = templates.GenerateLinkExampleNFTProviderCapTx(nftAddress, exampleNFTAddress) - // tx := createTxWithTemplateAndAuthorizer(b, script, exampleNFTAddress) - // // Set argument: NFT provider path - // tx.AddArgument(cadence.Path{Domain: "private", Identifier: "exampleNFTprovider"}) - - // serviceSigner, _ := b.ServiceKey().Signer() - - // signAndSubmit( - // t, b, tx, - // []flow.Address{ - // b.ServiceKey().Address, - // exampleNFTAddress, - // }, - // []crypto.Signer{ - // serviceSigner, - // exampleNFTSigner, - // }, - // false, - // ) - // }) - t.Run("Should be able to set pack issuer capability", func(t *testing.T) { // Assumes issuer is deployer of exampleNFT diff --git a/pds/transactions/dapperSport/link_providerCap_dapperSport.cdc b/pds/transactions/dapperSport/link_providerCap_dapperSport.cdc deleted file mode 100644 index 10d9b39..0000000 --- a/pds/transactions/dapperSport/link_providerCap_dapperSport.cdc +++ /dev/null @@ -1,16 +0,0 @@ -import NonFungibleToken from "NonFungibleToken" -import DapperSport from "DapperSport" - -transaction(NFTProviderPath: PrivatePath) { - - prepare(signer: auth(Capabilities) &Account) { - if signer.capabilities.get<&{NonFungibleToken.Provider}>(at: NFTProviderPath).check() { - return - } - let cap = signer.capabilities.storage.issue<&{NonFungibleToken.Provider}>(target: DapperSport.CollectionStoragePath) - - // This needs to be used to allow for PDS to withdraw - signer.capabilities.publish(cap, at: NFTProviderPath) - } - -}