Get Started
guide on how to install the js-mcs-sdk package and its basic usage
Installation
Install the package using npm. It is recommended to create a new directory for a new project. Run the init command to setup a package.json file
Environment Variables
Set your API Key and Access Token as environment variables in a .env
file. Optionally include your wallet's private key and RPC-URL.
Be careful not to expose this information! Revealing your private key to others will give them access to your wallet.
Writing SDK Scripts
To begin writing a script utilizing the SDK, create a new .js
file.
At the top of this file, require the necessary packages. Since these functions are asynchronous, we will need to create an async
function to run the SDK methods.
Now inside the asynchronous main
function, we can initialize the SDK
Optionally, you can pass privateKey
to use the onChain Storage upload and payment functions and pass rpcUrl
if you wish to use your own RPC URL (this SDK uses https://polygon-rpc.com/ by default).
This SDK is also compatible with our calibration environment on the Mumbai testnet. Use chainName: 'polygon.mumbai'
and generate a new API KEY from calibration-mcs.filswan.com
Make sure the API Key and Access Token come from the same environment as chainName
Last updated