forked from mito-systems/sol-mem-gen
Set tx hash as image file name in pinata #17
@ -97,7 +97,7 @@ export async function POST(req: NextRequest): Promise<NextResponse> {
|
||||
)
|
||||
}
|
||||
|
||||
const pinataResult = await uploadToPinata(imageUrl);
|
||||
const pinataResult = await uploadToPinata(imageUrl, transactionSignature);
|
||||
|
||||
if (pinataResult.error) {
|
||||
return NextResponse.json(
|
||||
|
@ -12,9 +12,9 @@ const pinata = new PinataSDK({
|
||||
pinataGateway: process.env.PINATA_GATEWAY,
|
||||
});
|
||||
|
||||
export async function uploadToPinata(imageUrl: string): Promise<FluxGenerationResult> {
|
||||
export async function uploadToPinata(imageUrl: string, transactionSignature: string): Promise<FluxGenerationResult> {
|
||||
try {
|
||||
const upload = await pinata.upload.url(imageUrl);
|
||||
const upload = await pinata.upload.url(imageUrl, { metadata: { name: transactionSignature }});
|
||||
|
||||
const publicURL = await pinata.gateways.convert(upload.IpfsHash);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user