Skip to content

Commit

Permalink
docs:add guides for network interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
reyraa committed Oct 1, 2024
1 parent 73321ad commit bb4e346
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/api/contribution/controllers/contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export default factories.createCoreController('api::contribution.contribution',

// Return the created contribution
const sanitizedEntity = await this.sanitizeOutput(contribution, ctx);

// before returning the value, make sure to update the Solana project too
return this.transformResponse(sanitizedEntity);
} catch (err) {
ctx.throw(500, err);
Expand Down
23 changes: 21 additions & 2 deletions src/api/project/controllers/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,30 @@ export default factories.createCoreController(
// Proceed with creating the the project
const result = await super.create(ctx);

// TODO: Call the Smart Contract method here to register the project on the blockchain
// and if not created, revert the centralized project creation.

// const wallet = await strapi.entityService.findMany(
// 'api::wallet.wallet',
// {
// users_permissions_user: user.id,
// },
// );

// if(wallet.length) {
// // TODO: Call the Smart Contract method here to register the project on the blockchain
// // and if not created, revert the centralized project creation.


// // If the Smart contract interaction was unsuccessful, we have to delete the recently created
// // Project using result.data.id
// throw new Error(`Error transaction: ${result.data.id}`);
// } else {
// throw new Error('Wallet not found');
// }


return result;
} catch (err) {
// const id = err.message.split('Error transaction:')[1]
ctx.throw(500, err);
}
},
Expand Down

0 comments on commit bb4e346

Please sign in to comment.