|
14 | 14 |
|
15 | 15 | //go:embed transactions/user/fulfill_pack_buyback_offer.cdc |
16 | 16 | AdminFulfillPackBuybackOffer []byte |
| 17 | + |
| 18 | + //go:embed transactions/user/delist_NftStorefront.cdc |
| 19 | + DelistNFTStorefront []byte |
| 20 | + |
| 21 | + //go:embed transactions/user/delist_NftStorefrontV2.cdc |
| 22 | + DelistNFTStorefrontV2 []byte |
17 | 23 | ) |
18 | 24 |
|
19 | 25 | type UserBuyPacksPrimarySaleParams struct { |
@@ -89,3 +95,57 @@ func AdminFulfillPackBuybackOfferTxScript(params AdminFulfillPackBuybackOfferPar |
89 | 95 | } |
90 | 96 | return string(bytes), nil |
91 | 97 | } |
| 98 | + |
| 99 | +type DelistNFTStorefrontTxScriptParams struct { |
| 100 | + NFTStorefrontAddress string |
| 101 | + listingResourceIDs []uint64 |
| 102 | +} |
| 103 | + |
| 104 | +func (p DelistNFTStorefrontTxScriptParams) Validate() error { |
| 105 | + if p.NFTStorefrontAddress == "" { |
| 106 | + return fmt.Errorf("NFTStorefrontAddress must be non-empty") |
| 107 | + } |
| 108 | + |
| 109 | + if len(p.listingResourceIDs) == 0 { |
| 110 | + return fmt.Errorf("listingResourceIDs must contain at least one ID") |
| 111 | + } |
| 112 | + return nil |
| 113 | +} |
| 114 | + |
| 115 | +func DelistNFTStorefrontTxScript(params DelistNFTStorefrontTxScriptParams) (string, error) { |
| 116 | + if err := params.Validate(); err != nil { |
| 117 | + return "", err |
| 118 | + } |
| 119 | + bytes, err := utils.ParseCadenceTemplate(DelistNFTStorefront, params) |
| 120 | + if err != nil { |
| 121 | + return "", err |
| 122 | + } |
| 123 | + return string(bytes), nil |
| 124 | +} |
| 125 | + |
| 126 | +type DelistNFTStorefrontV2TxScriptParams struct { |
| 127 | + NFTStorefrontAddressV2 string |
| 128 | + listingResourceIDs []uint64 |
| 129 | +} |
| 130 | + |
| 131 | +func (p DelistNFTStorefrontV2TxScriptParams) Validate() error { |
| 132 | + if p.NFTStorefrontAddressV2 == "" { |
| 133 | + return fmt.Errorf("NFTStorefrontAddress must be non-empty") |
| 134 | + } |
| 135 | + |
| 136 | + if len(p.listingResourceIDs) == 0 { |
| 137 | + return fmt.Errorf("listingResourceIDs must contain at least one ID") |
| 138 | + } |
| 139 | + return nil |
| 140 | +} |
| 141 | + |
| 142 | +func DelistNFTStorefrontV2TxScript(params DelistNFTStorefrontV2TxScriptParams) (string, error) { |
| 143 | + if err := params.Validate(); err != nil { |
| 144 | + return "", err |
| 145 | + } |
| 146 | + bytes, err := utils.ParseCadenceTemplate(DelistNFTStorefrontV2, params) |
| 147 | + if err != nil { |
| 148 | + return "", err |
| 149 | + } |
| 150 | + return string(bytes), nil |
| 151 | +} |
0 commit comments