constructor - Initialize Orbis
Builds the Orbis object.
How to use?
const orbis = new Orbis(params)Parameters
params-optionalinitialization parametersuseLit-booleanwhether Lit client should be initialized and connected (default:true)ceramic-CeramicClientCeramic client to use (default:@ceramicnetwork/http-client)node-stringCeramic Node URL to use when connecting to Ceramic (default:https://node2.orbis.club/)store-localStorage || AsyncStoragetype of a store to use for local data (default: autodetected)PINATA_GATEWAY-stringPinata gateway to use when uploading files (default:https://orbis.mypinata.cloud/ipfs/)PINATA_API_KEY-stringPinata API key to use when uploading files (default:undefined)PINATA_SECRET_API_KEY-stringPinata secret API key to use when uploading files (default:undefined)
Returns
Orbis objectExamples
Initialize Orbis with defaults
/** All params are optional, so this is a valid way of initializing Orbis */
const orbis = new Orbis();Initialize Orbis with file upload capability
/** Set up Orbis SDK with your Pinata gateway credentials */
const orbis = new Orbis({
PINATA_GATEWAY: pinata_gateway, // Your Pinata Gateway
PINATA_API_KEY: pinata_api_key, // Your Pinata API key
PINATA_SECRET_API_KEY: pinata_secret_api_key // Your Pinata Secret API key
});
/** Upload a file to IPFS (file can be obtained via <input type="file" /> or compatible alternatives) */
const uploadedFile = await orbis.uploadMedia(file);
/** Add the results in a media array used when sharing the post (the media object must be an array) */
const res = await orbis.createPost({
body: "Post with a media!",
media: [uploadedFile.result]
});