Skip to content

dialectlabs/actions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@dialectlabs/actions

This repository contains reference implementations of Solana Actions using Hono, Next.js, and Express.

Getting Started

For Hono, run the development server in the root directory:

For Next.js, run the development server in it's directory:

For Express, run the development server in the subfolder in it's directory:

npm install
npm run dev

Presets

Tensor Buy Floor

  • Place your api key to TENSOR_API_KEY constant in tensor-api.ts

How To

Actions Development with Hono

  1. See Jupiter Swap Action example
  2. Build your own action
    • Use specified openapi responses from openapi.ts for your POST, GET methods
    • Use the specified openapi body from openapi.ts for your POST methods
  3. Add your router to index.ts

Actions Development with Next.js

  1. See Donate Native SOL Action example
  2. Build your own action
    • Create a new folder in src/app/api/actions with your action name
    • Under that folder, create a route.ts file with your action

Actions Development with Express

  1. See Donate Native SOL Action example
  2. Build your own action
    • Create a new folder in examples/express with your action name
    • Under that folder, create a server.js file with your action and make the necessary imports

Swagger UI

With Hono, open http://localhost:3000/swagger-ui with your browser to explore actions.

Unfurl action into a Blink

To check and unfurl your or existing action open https://actions.dialect.to/
e.g action for swap on Jupiter using Hono: localhost:3000/api/jupiter/swap/SOL-Bonk

Examples in this repo

Hono

There is a simple donate action as well as a memo action in this repo which serves as a template for creating your own actions.

There are also a few example actions in this repository for Jupiter (swap), Helius (stake), Meteora (swap), Sanctum (stake), and Tensor (buy floor or bid).

You can also unfurl these actions into Blinks on https://dial.to by entering the action URL into the Blink URL field.

For example, to unfurl the Helius stake action, you would enter the following URL into the Blink URL field:

http://localhost:3000/api/helius/stake

Next.js

There are a few example actions in this repository for Donating Native SOL and Donating SPL Tokens.

To unfurl these actions into Blinks on https://dial.to by entering the action URL into the Blink URL field.

For example, to unfurl the Donate Native SOL action, you would enter the following URL into the Blink URL field:

http://localhost:3000/api/actions/donate-sol

Express

There is an example action in this repository for Donating Native SOL.

To unfurl this action into Blinks on https://dial.to by entering the action URL into the Blink URL field.

For example, to unfurl the Donate Native SOL action, you would enter the following URL into the Blink URL field:

http://localhost:8080/api/actions/transfer-sol

Learn More

To learn more about Hono, take a look at the following resources:

To learn more about Next.js, take a look at the following resources:

To learn more about Express, take a look at the following resources:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published