Skip to content

Latest commit

 

History

History
83 lines (54 loc) · 2.08 KB

README.md

File metadata and controls

83 lines (54 loc) · 2.08 KB

PyPI version

Python SDK Docs Samples

Python samples for the Swan SDK

Setup

  1. Clone the repository
git clone https://github.com/swanchain/python-sdk-docs-samples.git
  1. Obtain authentication credentials.

To use swan-sdk, an Swan API Key is required.

Steps to get an Swan API Key:

  • Go to Swan Console. Make sure you're under the Mainnet environment.
  • Login through MetaMask.
  • Click 'Generate API Key'.
  • Store your API Key safely, do not share with others.

To use the swan-sdk Multi-Chain Storage (MCS) service, an MCS API key is required.

Steps to get a MCS API Key:

  • Go to Multi Chain Storage. Make sure you're under the Mainnet environment.
  • Login through MetaMask.
  • Click the gear icon on the top right and select 'Setting'.
  • Click 'Create API Key'.
  • Store your API Key safely, do not share with others.
  1. Set up environment variables Create a .env file in the root directory and add the following environment variables:
WALLET_ADDRESS=<your_wallet_address>
PRIVATE_KEY=<your_private_key>
SWAN_API_KEY=<your_swanchain_api_key>
MCS_API_KEY=<your_mcs_api_key>

Make sure to replace the placeholders with your actual values. And have enough balance in your wallet to run the test.

How to run a sample

  1. Set Up the Virtual Environment:**
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install the dependencies:
pip install -r requirements.txt
  1. Run the sample:
python compute/<sample_name>.py
python storage/<sample_name>.py
  • for compute example details, checkout the document
  • for storage example details, checkout the document

References

https://github.com/GoogleCloudPlatform/python-docs-samples