✨
BLINKZ
  • Blinkz
    • Our Mission
    • Try It Now
    • Table of Contents
  • SDK
    • Blinkz Actions SDK
      • Introduction
      • Quick Start
      • Getting Started
      • Core Concepts
      • SDK Reference
      • Examples
      • Best Practices
      • How to Contribute
      • API Reference
      • Resources
      • FAQ
  • Extension
    • Blinkz Actions Extension
      • Overview
      • Key Components
      • Key Features
      • Usage
      • Development Status
      • Additional Resources
  • Generator
    • Blinkz Actions Generator
      • Overview
      • Key Components
      • Using The Actions Generator
      • Deployment
      • Extending The Generator
      • Additional Resources
  • Conclusion
    • Conclusion
Powered by GitBook
On this page
  1. SDK
  2. Blinkz Actions SDK

Quick Start

Get up and running with Actions SDK in just a few steps:

  1. Installation

    Install the Actions SDK using npm:

    npm install @actions/sdk
    
  2. Create a Simple Action

    Here's a basic example of creating a simple transfer action:

    import { Action, TransferAction } from '@actions/sdk';
    
    const myAction: Action = {
        title: "Send ETH",
        icon: "<https://example.com/eth-icon.png>",
        description: "Send ETH to a specified address",
        label: "Transfer ETH",
        links: [
            {
                type: "transfer-action",
                label: "Send 0.1 ETH",
                address: {
                    type: "constant",
                    id: "recipientAddress",
                    value: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
                },
                value: "100000000000000000", // 0.1 ETH in wei
                success: {
                    message: "Successfully sent 0.1 ETH!"
                },
                error: {
                    message: "Failed to send ETH. Please try again."
                }
            } as TransferAction
        ]
    };
    
  3. Validate the Action

    Use the validateAction function to ensure your Action is correctly structured:

    import { validateAction } from '@actions/sdk';
    
    const { valid, errors } = validateAction(myAction);
    if (valid) {
        console.log('Action is valid');
    } else {
        console.error('Validation errors:', errors);
    }
    
  4. Deploy the Action

    Deploy your Action to IPFS using the deployToIpfs function:

    import { deployToIpfs } from '@actions/sdk';
    
    const pinataCredentials = {
        apiKey: 'YOUR_PINATA_API_KEY',
        apiSecretKey: 'YOUR_PINATA_API_SECRET_KEY',
    };
    
    deployToIpfs(myAction, pinataCredentials)
        .then((ipfsHash) => console.log('Deployed to IPFS:', ipfsHash))
        .catch((error) => console.error('Deployment failed:', error));
    
  5. Use the Action

    Once deployed, you can use the IPFS hash to reference and execute your Action in a Web3-enabled environment.

That's it! You've created, validated, and deployed your first Action. From here, you can explore more complex Actions, different types of linked actions, and advanced features of the Actions SDK.

PreviousIntroductionNextGetting Started

Last updated 6 months ago