Skip to content

dialectlabs/actions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 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
  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

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.

Basic examples

  1. Jupiter (swap)
  2. Helius (stake)
  3. Meteora (swap)
  4. Sanctum (stake)
  5. Tensor (buy floor or bid)

Live data examples

  1. Basic live data

Action chaining examples

  1. Inline chaining
  2. Post-request chaining

External link examples

  1. External link

Sign message examples

  1. Sign message

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