constructor - Initialize Orbis
Builds the Orbis object.
How to use?
const orbis = new Orbis(params)
Parameters
params
-optional
initialization parametersuseLit
-boolean
whether Lit client should be initialized and connected (default:true
)ceramic
-CeramicClient
Ceramic client to use (default:@ceramicnetwork/http-client
)node
-string
Ceramic Node URL to use when connecting to Ceramic (default:https://node2.orbis.club/
)store
-localStorage || AsyncStorage
type of a store to use for local data (default: autodetected)PINATA_GATEWAY
-string
Pinata gateway to use when uploading files (default:https://orbis.mypinata.cloud/ipfs/
)PINATA_API_KEY
-string
Pinata API key to use when uploading files (default:undefined
)PINATA_SECRET_API_KEY
-string
Pinata secret API key to use when uploading files (default:undefined
)
Returns
Orbis object
Examples
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]
});