Ir al contenido principal
Volver a las aplicaciones de ejemplo

Intermitente de acción Solana

The Solana Action Blinker app allows you to create Solana Actions and parse Solana Action URLs into their corresponding actions.

Marco de trabajo o biblioteca de front-end:
React/Next.js
Idioma:
TypeScript
Herramienta de compilación/servidor de desarrollo:
Next.js
Vista previa de la aplicación de ejemplo

Resumen

The Solana Action Blinker application allows you to create and interact with Solana Actions by parsing Solana Action URLs into their corresponding actions. With this tool, you can input a valid Action URL to view its details, connect your wallet to execute available actions, and create new actions following the provided structure. Whether you're parsing existing actions or building new ones, this app simplifies the process of interacting with Solana Action URLs.

It uses a Next.js 14 proyecto puesto en marcha con create-next-app.

Background

Solana Actions provide a standardized way to deliver signable transactions or messages from an application directly to a user. Blinks are client apps that convert Solana Actions into shareable, metadata-rich UIs for interacting with and executing Actions. For more information, check out our Guide on Solana Actions.


Primeros pasos

Instalar las dependencias

Open the project directory:

cd sample-dapps/solana-action-blinker

Then, install the dependencies:

npm instalar
# o
yarn
# o
pnpm instalar
# o
bun install

Configurar variables de entorno

Asegúrate de tener a mano un punto de conexión de Quicknode; puedes conseguir uno gratis aquí.


  • Cambiar el nombre .env.example a .env.local and update with your Quicknode Solana Node Endpoint.
  • Make sure to update the cluster to ensure your transaction URLs point to the correct explorer (use only of the enum values provided in the .env.example file).
QN_ENDPOINT=https://example.solana-mainnet.quiknode.pro/123456
NEXT_PUBLIC_CLUSTER=mainnet-beta # mainnet-beta | devnet | testnet | local

En primer lugar, ejecuta el servidor de desarrollo:

npm ejecutar dev
# o
yarn dev
# o
pnpm dev
# o
bun dev

Abre http://localhost:3000 en tu navegador para ver el resultado.


Cómo utilizar la Dapp


  1. Enter a valid Solana Action URL in the input field. You may copy and paste one of the example links on the homepage.
  2. Click "Parse Action" to see the parsed action details.
  3. You will see the parsed details of the action URL. To see and execute available actions, connect a wallet.

Vista previa

  1. Click any of the available actions to execute the action (you will need to sign the transaction when prompted by your wallet).
  2. You may create additional actions by following the structure in solana-action-blinker/app/api/actions

Arquitectura

src/
├── app/
│ ├── page.tsx # Main page for Blink
│ └── layout.tsx # layout for the page
│ └── api/
│ └── solana/
│ └── sendAndConfirm/route.ts # Send and Confirm Transaction
│ └── actions/
│ └── memo/route.ts # Creates a Memo Solana Action
│ └── donate/route.ts # Creates a Donate Solana Action
└── components/
│ ├── ActionComponents/ # includes components for parsing and executing Solana Actions
│ ├── Blink.tsx # Main component
│ ├── SolanaProviders.tsx # Wallet Adapter Context providers
│ └── [supporting components]
└── hooks/
│ ├── useActionFetch.ts # Fetches and parses Solana Actions from URLs
│ └── useTransactionProcessor.ts # Executes Solana Transactions
└── utils/ # includes various utility functions and constants


Implementar en Vercel

Implementar con Vercel


Documentación de Next.js

Para obtener más información sobre Next.js, echa un vistazo a los siguientes recursos:


Puedes echar un vistazo al repositorio de Next.js en GitHub: ¡tus comentarios y aportaciones son bienvenidos!

Aportaciones y comentarios
¡Nos encantaría conocer tu opinión y agradecemos cualquier aportación a esta aplicación de ejemplo!
Para informar de problemas o enviar comentarios, abre una incidencia en GitHub en el qn-guide-ejemplos repositorio.
Para colaborar, sigue estos pasos:
  1. Hacer un fork del repositorio
  2. Crear una rama de características:
    git checkout -b feature/amazing-feature
  3. Guarda los cambios:
    git commit -m "Añadir una función increíble"
  4. Envía tu rama:
    git push origin feature/amazing-feature
  5. Abre una solicitud de incorporación de cambios.