Pinata SDK: https://www.npmjs.com/package/@pinata/sdk
I trying to use the Pinata SDK in one of the packages of a Nx Typescript monorepo project. I installed the SDK with: yarn add @pinata/sdk -W
. Now using it in a package A file: packages/A/src/lib/encryption.ts
where the monorepo structure is like:
packages
- A
- B
Now initializing the SDK as:
import pinataSDK from '@pinata/sdk';
const pinata = new pinataSDK.default('yourPinataApiKey', 'yourPinataSecretApiKey');
// const pinata = new pinataSDK({ pinataApiKey: 'yourPinataApiKey', pinataSecretApiKey: 'yourPinataSecretApiKey' }); // Tried this way too which doesn't work either
I get the following error:
const pinata = new sdk_1.default('yourPinataApiKey', 'yourPinataSecretApiKey');
^
TypeError: sdk_1.default is not a constructor
I tried a different way of importing too:
import * as pinataSDK from '@pinata/sdk';
This also gave a similar error:
const pinata = new pinataSDK.default('yourPinataApiKey', 'yourPinataSecretApiKey');
^
TypeError: pinataSDK.default is not a constructor
How can properly initialize the SDK?