-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEAT: added blink chaining logic + RPC url from env
- Loading branch information
Showing
5 changed files
with
41 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import prisma from "@/lib/db"; | ||
import { NextAction } from "@dialectlabs/blinks"; | ||
import { ACTIONS_CORS_HEADERS } from "@solana/actions"; | ||
import { NextResponse } from "next/server"; | ||
|
||
export async function POST( | ||
req: Request, | ||
{ params }: { params: { blinkid: string } } | ||
) { | ||
const blink = await prisma.blinks.findFirst({ | ||
where: { | ||
id: params.blinkid, | ||
}, | ||
}); | ||
const { signature, account } = await req.json(); | ||
console.log({ signature, account }); | ||
// @ts-ignore | ||
const payload: NextAction = blink?.data!; | ||
payload.type = "completed"; | ||
payload.disabled = true; | ||
return NextResponse.json(payload, ACTIONS_CORS_HEADERS); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
import { clusterApiUrl, Connection } from "@solana/web3.js"; | ||
import { Connection } from "@solana/web3.js"; | ||
|
||
export const conn = new Connection(clusterApiUrl("devnet")); | ||
export const conn = new Connection( | ||
`https://${ | ||
process.env.RPC_NET === "mainnet" ? "mainnet" : "devnet" | ||
}.helius-rpc.com/?api-key=${process.env.RPC_URL_KEY}` | ||
); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters