forked from mito-systems/sol-mem-gen
Set tx hash as image file name in pinata (#17)
Part of https://www.notion.so/Upload-generated-image-to-IPFS-190a6b22d47280f1ba81e860b7ca4ae1 Co-authored-by: Shreerang Kale <shreerangkale@gmail.com> Reviewed-on: #17
This commit is contained in:
parent
d3e6f7ad12
commit
3dd1ff74ab
@ -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