Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Action SDK Deployment Example

This project demonstrates how to validate and deploy an action using the Action SDK.

Prerequisites

Setup

  1. Clone this repository:

    git clone https://github.com/DecenterApps/actions-sdk.git
    cd action-sdk/examples
    
  2. Install dependencies:

    npm install
    
  3. Open deployAction.ts and replace the Pinata credentials with your own:

    const pinataCredentials = {
        apiKey: 'YOUR_PINATA_API_KEY',
        apiSecretKey: 'YOUR_PINATA_API_SECRET_KEY',
    };

Running the Deployment Script

To deploy an action, run:

npm run deploy-action

This script will validate the action and then deploy it to IPFS using Pinata.

Understanding the Deployment Process

  1. Validation (Optional): The script first calls validateAction separately. This step is optional and included for demonstration purposes, as validateAction is already part of the deployToIpfs function.

  2. Deployment: The deployToIpfs function is called to deploy the action to IPFS. This function includes validation step.

Customizing the Action

By default, the script deploys the donationAction from ./action-examples/donation-action.ts. To deploy a different action:

  1. Create your custom action or use another example from the action-examples folder.
  2. Import your action in deployAction.ts:
    import { yourCustomAction } from './path-to-your-action';
  3. Update the deployAction function to use your action:
    const { valid, errors } = validateAction(yourCustomAction);
    // ...
    const ipfsHash = await deployToIpfs(yourCustomAction, pinataCredentials);

Need Help?

If you encounter any issues or have questions, please open an issue in this repository.

Happy deploying! 🎉