pinata-sdk
The pinata_sdk provides the easieset path for interacting with the Pinata API.
Setup
Add the crate as a dependency to your codebase
[]
= "1.0.0"
Initializing the API
use PinataApi;
let api = new.unwrap;
// test that you can connect to the API:
let result = api.test_authentication.await;
if let Ok = result
Usage
1. Pinning a file
Send a file to pinata for direct pinning to IPFS.
use ;
let api = new.unwrap;
let result = api.pin_file.await;
if let Ok = result
If a directory path is used to construct PinByFile, then pin_file() will upload all the contents
of the file to be pinned on pinata.
2. Pinning a JSON object
You can send a JSON serializable to pinata for direct pinning to IPFS.
use ;
use HashMap;
let api = new.unwrap;
// HashMap derives serde::Serialize
let mut json_data = new;
json_data.insert;
let result = api.pin_json.await;
if let Ok = result
3. Unpinning
You can unpin using the PinataApi::unpin() function by passing in the CID hash of the already
pinned content.
Contribution Guide
Feel free to contribute. Please ensure that an issue is exists that describes the feature or bugfix you are planning to contribute.
License
MIT OR Apache-2.0