Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Failed to upload JSON to IPFS with Pinata #175

Open
0xapp123 opened this issue Jun 14, 2024 · 0 comments
Open

Failed to upload JSON to IPFS with Pinata #175

0xapp123 opened this issue Jun 14, 2024 · 0 comments

Comments

@0xapp123
Copy link

I tried to upload like this:

export const uploadMetadata = async (data: CoinInfo): Promise<any> => {

    const url = 'https://api.pinata.cloud/pinning/pinFileToIPFS/'
    const metadata = {
        name: data.name,
        ticker: data.ticker,
        URL: data.url,
        description: data.description,
    }

    try {
        const response = await axios.post(url, metadata, {
             headers: {
                 pinata_api_key: PINATA_API_KEY,
                 pinata_secret_api_key: PINATA_SECRET_API_KEY,
                 'Content-Type': 'application/json'
        }});
        return response.data;

    } catch (error) {
        console.error('Error uploading metadata: ', error);
        return error;
    }
}

But I got an error.

What is the reason do you think?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@0xapp123 and others