This repository contains reference implementations of Solana Actions using Hono, Next.js, and Express.
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
- Place your api key to
TENSOR_API_KEY
constant in tensor-api.ts
- See Jupiter Swap Action example
- Build your own action
- Add your router to index.ts
- See Donate Native SOL Action example
- 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
- See Donate Native SOL Action example
- 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
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
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.
Basic examples
Live data examples
Action chaining examples
External link examples
Sign message examples
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
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
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
To learn more about Hono, take a look at the following resources:
- Hono Documentation - learn about Hono features and API.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
To learn more about Express, take a look at the following resources:
- Express Documentation - learn about Express features and API.