Skip to content

Commit

Permalink
include setupWeb3 in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
rykci committed Jan 19, 2023
1 parent 9ffcea5 commit 0063e43
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ Here is the demo to get you started; you can get more information in the [SDK do
### For Onchain Storage
To use certain Onchain Storage features (upload, payment, minting), you will need to set up the web3 environment first.
- Setup Web3
```js
await mcs.setupWeb3(<PRIVATE_KEY>, <RPC_URL>)
console.log(mcs.web3Initialized) // true
```
- Upload File to Onchain storage
```js
Expand Down
7 changes: 3 additions & 4 deletions sdk-test/mcs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,16 @@ describe('MCS SDK', function () {

it('Should initialize SDK', async () => {
mcs = await mcsSDK.initialize({
accessToken: process.env.CALI_ACCESS_TOKEN,
apiKey: process.env.CALI_API_KEY,
chainName: 'polygon.mumbai',
accessToken: process.env.ACCESS_TOKEN,
apiKey: process.env.API_KEY,
})

expect(mcs)
})

it('Should setup web3', async () => {
expect(mcs.walletAddress).to.be.undefined
await mcs.setupWeb3(process.env.PRIVATE_KEY, process.env.RPC_URL)
await mcs.setupWeb3(process.env.PRIVATE_KEY)
expect(mcs.walletAddress)
})

Expand Down
11 changes: 11 additions & 0 deletions sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,19 @@ Here is the demo to get you started; you can get more information in the [SDK do
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 compatiable with our calibration environment on the Mumbai testnet. Use `chainName: 'polygon.mumbai'` and generate a new API KEY from [calibration-mcs.filswan.com/](https://calibration-mcs.filswan.com/)
### For Onchain Storage
To use certain Onchain Storage features (upload, payment, minting), you will need to set up the web3 environment first.
- Setup Web3
```js
await mcs.setupWeb3(<PRIVATE_KEY>, <RPC_URL>)
console.log(mcs.web3Initialized) // true
```
- Upload File to Onchain storage
```js
Expand Down

0 comments on commit 0063e43

Please sign in to comment.