开始
This guide will explain how to install the js-mcs-sdk and its basic usage
Last updated
This guide will explain how to install the js-mcs-sdk and its basic usage
Last updated
- This SDK was built using version v16.13.0 (npm v8.1.0)
Polygon Mumbai Testnet Wallet -
Polygon Mumbai Testnet Alchemy RPC -
Mumbai Testnet USDC and MATIC funds are also necessary -
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
Once you have your Mumbai wallet and RPC URL, create a file named .env
in your project directory and store your wallet's private key and the RPC URL.
To begin writing a script utilizing the SDK, create a new .js
file. Let's create a file named demo.js
At the top of this file, require the necessary packages for the script.
require('donenv').config()
will add the variables in your .env
file to process.env
const { mcsSDK } = require('js-mcs-sdk')
will require the SDK
Next, after requiring the SDK, we still need to initialize it
Here is a simple example to upload a single file to MCS. Made a new file named upload.js
Use the command node upload.js
to run the code. This snippet creates the MCS SDK instance, creates a JSON file with your wallet address, and uploads the file to MCS.
Now we can begin using the SDK methods. Since these functions are , we will need to create an async
function to run the SDK methods.