V2 Migration Guide
The [email protected]
package became a Private IPFS only SDK and the Public IPFS SDK was moved to pinata-web3
. This was also a result of our APIs being disconnected as well. Due to this problem we’ve unified our Public and Private IPFS APIs in our V3 API, and we have also unified them in our SDK in a new V2 release. This document will walk you through how to migrate from previous versions of either pinata
or pinata-web3
.
[email protected]
The pinata
package was originally just for Private IPFS but now supports both Public and Private IPFS in [email protected]
.
Installation and Initialization
Install the latest version by running the following command:
Initalizing the SDK works the exact same way in previous versions
Public & Private Methods
In [email protected]
all methods were direct. In V2 there are public and private methods for the following classes:
upload
files
groups
gateways
signatures
This means you can simple pass in public
or private
after the main class to access those specific networks.
Accessing Private IPFS Files
The method createSignedURL
for accessing files on Private IPFS has been renamed to createAccessLink
Uploads with Metadata
When uploading files the addMetadata()
method has been replaced with name()
and keyvalues()
to better match querying and listing files with those attributes.
[email protected]
The pinata-web3
package previously was only supporting Public IPFS, and lacked some of the more natural organization that the pinata
package had. With [email protected]
the SDK supprts both Public and Private IPFS and is recommended that you migrate to pinata
instead of continuing to use pinata-web3
. This guide will walk through the changes that will need to be made.
Installation and Initialization
Install the latest version by running the following command:
Initalizing the SDK works the exact same way in previous versions, but you will need to change your imports from pinata-web3
to pinata
.
Public & Private Methods
In [email protected]
all methods were direct. In V2 there are public and private methods for the following classes:
upload
files
groups
gateways
signatures
This means you can simple pass in public
or private
after the main class to access those specific networks.
File Management
In pinata-web3
the methods to listFiles()
, updateMetadata()
, unpin()
under the main PinataSDK class have been moved to a separate files
class for better organization.
listFiles()
-> files.<network>.list()
updateMetadata()
-> files.<network>.update()
unpin()
-> files.<network>.delete()
pinJobs()
-> files.public.queue()
To list you pending pin by CID queue you can use the queue()
method.
Swaps are now under Files
In pinata-web3
the Hot Swap methods were under the gateways
class. These have been moved to the files
class instead. Some of the naming convention has been updated as well.
swapCid()
-> addSwap()
swapHistory()
-> getSwapHistory()
Groups
Groups have been updated to follow the file ID paradigm that is now part of the SDK, and so has the method names for adding or removing files
addCids()
-> addFiles()
Analytics
In pinata-web3
analytics was grouped under the gateways
class. In [email protected]
it has been moved into it’s own class. Additionally the methods inside have been completely rewired to fit needs better.
See Analytics Reference for more info
Usage Class Removed
The pinata.usage
class in the pinata-web3
package has been removed in [email protected]
.