shadowaxe99 / creator-Econ

0 stars 0 forks source link

Sweep: #23

Open shadowaxe99 opened 5 months ago

shadowaxe99 commented 5 months ago

Details

make this functional

Checklist - [X] Modify `server/app/blockchain/smart_contracts.py` ✓ https://github.com/shadowaxe99/creator-Econ/commit/d6ef5a4b637d7915acc41dde1c9deb77109b06ef [Edit](https://github.com/shadowaxe99/creator-Econ/edit/sweep/_31b87/server/app/blockchain/smart_contracts.py) - [X] Running GitHub Actions for `server/app/blockchain/smart_contracts.py` ✓ [Edit](https://github.com/shadowaxe99/creator-Econ/edit/sweep/_31b87/server/app/blockchain/smart_contracts.py) - [X] Modify `client/src/components/marketplace/AssetItem.tsx` ✓ https://github.com/shadowaxe99/creator-Econ/commit/08cc22ede871d68c79c7ad37a93769cee426a8ec [Edit](https://github.com/shadowaxe99/creator-Econ/edit/sweep/_31b87/client/src/components/marketplace/AssetItem.tsx) - [X] Running GitHub Actions for `client/src/components/marketplace/AssetItem.tsx` ✓ [Edit](https://github.com/shadowaxe99/creator-Econ/edit/sweep/_31b87/client/src/components/marketplace/AssetItem.tsx) - [X] Modify `server/app/api/routes.py` ✓ https://github.com/shadowaxe99/creator-Econ/commit/1bf135dc070c3711448f25e588171e20b2338531 [Edit](https://github.com/shadowaxe99/creator-Econ/edit/sweep/_31b87/server/app/api/routes.py) - [X] Running GitHub Actions for `server/app/api/routes.py` ✓ [Edit](https://github.com/shadowaxe99/creator-Econ/edit/sweep/_31b87/server/app/api/routes.py)
sweep-ai[bot] commented 5 months ago

🚀 Here's the PR! #24

See Sweep's progress at the progress dashboard!
💎 Sweep Pro: I'm using GPT-4. You have unlimited GPT-4 tickets. (tracking ID: 87cc2dd504)

[!TIP] I can email you next time I complete a pull request if you set up your email here!


Actions (click)


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I think are relevant in decreasing order of relevance (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/shadowaxe99/creator-Econ/blob/c3989a8511fba73d80657dac179037da6b0c8204/server/app/blockchain/smart_contracts.py#L1-L79 https://github.com/shadowaxe99/creator-Econ/blob/c3989a8511fba73d80657dac179037da6b0c8204/client/src/components/marketplace/AssetItem.tsx#L1-L43 https://github.com/shadowaxe99/creator-Econ/blob/c3989a8511fba73d80657dac179037da6b0c8204/client/src/components/auth/CreatorDashboard.tsx#L1-L43 https://github.com/shadowaxe99/creator-Econ/blob/c3989a8511fba73d80657dac179037da6b0c8204/server/app/api/routes.py#L1-L50

Step 2: ⌨️ Coding

--- 
+++ 
@@ -47,12 +47,11 @@
             return False

     def get_asset_details(self, asset_id: str) -> dict:
+        try:
+            return self.contract.functions.getAssetDetails(asset_id).call()
         except Exception as e:
             print('An error occurred during the get_asset_details operation:', e)
             return {}
-
-        try:
-            return self.contract.functions.getAssetDetails(asset_id).call()
         except Exception as e:
             print('An error occurred while getting the asset details:', e)
             return {}
@@ -60,8 +59,6 @@
     def create_asset(self, title: str, description: str, price: int, image_url: str) -> bool:
         nonce = self.w3.eth.getTransactionCount(signer_account.address)
         transaction = self.contract.functions.createAsset(title, description, price, image_url).buildTransaction({
-            'gasPrice': self.w3.eth.generateGasPrice(), 'chainId': self.w3.net.chainId
-
             'gas': 2000000,
             'gasPrice': self.w3.toWei('50', 'gwei'),
             'nonce': nonce

Ran GitHub Actions for d6ef5a4b637d7915acc41dde1c9deb77109b06ef:

--- 
+++ 
@@ -16,7 +16,7 @@
   const handlePurchase = async () => {
     try {
       const transactionReceipt = await purchaseAsset(id);
-      if (transactionReceipt.status === 'success') {
+      if (transactionReceipt.status === true) {
         alert('Purchase successful!');
       } else {
         alert('Purchase failed.');

Ran GitHub Actions for 08cc22ede871d68c79c7ad37a93769cee426a8ec:

--- 
+++ 
@@ -35,7 +35,9 @@
             return jsonify({'message': 'Asset already sold'}), 400

         buyer_address = data['buyer_address']
-        success, transaction_details = sc_manager.purchase_asset(asset_id, buyer_address)
+        purchase_response = sc_manager.purchase_asset(asset_id, buyer_address)
+        success = purchase_response['success']
+        transaction_details = purchase_response['transaction_details']

         if success:
             asset.is_sold = True

Ran GitHub Actions for 1bf135dc070c3711448f25e588171e20b2338531:


Step 3: 🔁 Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/_31b87.


🎉 Latest improvements to Sweep:
  • New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
  • Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
  • Use the GitHub issues extension for creating Sweep issues directly from your editor.

💡 To recreate the pull request edit the issue title or description. Something wrong? Let us know.

This is an automated message generated by Sweep AI.