This project demonstrates how to validate and deploy an action using the Action SDK.
-
Clone this repository:
git clone https://github.com/DecenterApps/actions-sdk.git cd action-sdk/examples -
Install dependencies:
npm install -
Open
deployAction.tsand replace the Pinata credentials with your own:const pinataCredentials = { apiKey: 'YOUR_PINATA_API_KEY', apiSecretKey: 'YOUR_PINATA_API_SECRET_KEY', };
To deploy an action, run:
npm run deploy-action
This script will validate the action and then deploy it to IPFS using Pinata.
-
Validation (Optional): The script first calls
validateActionseparately. This step is optional and included for demonstration purposes, asvalidateActionis already part of thedeployToIpfsfunction. -
Deployment: The
deployToIpfsfunction is called to deploy the action to IPFS. This function includes validation step.
By default, the script deploys the donationAction from ./action-examples/donation-action.ts. To deploy a different action:
- Create your custom action or use another example from the
action-examplesfolder. - Import your action in
deployAction.ts:import { yourCustomAction } from './path-to-your-action';
- Update the
deployActionfunction to use your action:const { valid, errors } = validateAction(yourCustomAction); // ... const ipfsHash = await deployToIpfs(yourCustomAction, pinataCredentials);
If you encounter any issues or have questions, please open an issue in this repository.
Happy deploying! 🎉