开始

This guide will explain how to install the python-mcs-sdk and its basic usage

Prerequisites

Mumbai Testnet USDC and MATIC funds are also necessary - Swan Faucet Tutorial

Installation

Install package using pip

pip install python-mcs-sdk

Or Install the package from https://github.com/filswan/python-mcs-sdk.

$ git clone https://github.com/filswan/python-mcs-sdk.git

Install required packages using pip.

pip install -r requirements.txt

Environment Variables

Once you have your Mumbai wallet and RPC URL, store your wallet's private key and the RPC URL.

wallet_info = {
  'wallet_address' : <'WALLET_ADDRESS'>
  'private_key' : <'PRIVATE_KEY'>
  'web3_api' : '<'WEB3_API'>
}

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 .py file. Let's create a file named demo.py

At the top of this file, require the necessary packages for the script. (pytest is only necessary if you are running a test)

from mcs.api import McsAPI
from mcs.contract import ContractAPI

Next, after requiring the SDK, set up the wallet information.

wallet_info = {
        'wallet_address' : '*',
        'private_key' : '*',
        'web3_api' : '*',
    }

Now we can begin using the SDK methods.

Last updated