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

Failed to upload JSON to IPFS with Pinata #175

Description

@0xapp123

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions