Swap a CID for another using the Hot Swaps gateway plugin
Usage
import { PinataSDK } from "pinata-web3";
const pinata = new PinataSDK({
pinataJwt: process.env.PINATA_JWT!,
pinataGateway: "example-gateway.mypinata.cloud",
});
const swap = await pinata.gateways.swapCid({
cid: "bafkreibbvdqf5ekc2crouowv7vtjbcmbjoiysegslmmqc6jrxbaa43xske",
swapCid: "bafkreihumyr3bgxulu45ghws33xokwjm5o7xnkkgakaz66ldtylwiecnhu"
})
Returns
export type SwapCidResponse = {
mappedCid: string;
createdAt: string;
};
Parameters
Pass in the required parameters below to swap a CID
cid
This would be the original CID that would be visted
const swap = await pinata.gateways.swapCid({
cid: "bafkreibbvdqf5ekc2crouowv7vtjbcmbjoiysegslmmqc6jrxbaa43xske",
})
swapCid
This would be the CID you would want the old CID to point to
const swap = await pinata.gateways.swapCid({
swapCid: "bafkreihumyr3bgxulu45ghws33xokwjm5o7xnkkgakaz66ldtylwiecnhu"
})