Guides
Get started

Get started

Installation

To get started, you need to install our SDK.

Ensure that you have Node.js installed locally, to install the Typescript SDK (PS: It works for both Typescript and JavaScript!).

npm install ethers @0xsaturn/sdk
# OR
yarn add ethers @0xsaturn/sdk
pip install saturn-sdk

Setting up your 0xSaturn project

Typescript

Initialize a npm project quickly using npm init -y.

Next, create a file index.ts based on what you're using.

Now, Install the dependencies as so:

npm i ethers @0xsaturn/sdk dotenv

And, then the typescript dependencies:

npm i typescript ts-node tslib @types/node -D

If you're going with JavaScript, feel free to just skip the typescript-related steps.

Now, move on to the next steps!

Python

It's just as easy for Python aswell.

Install the dependencies using pip, or use a package manager such as pipenv or poetry.

pip install saturn-sdk

Finally, create a file main.py and move on to the next steps!

Getting started with the SDK

Typescript

You can use the SDK in read-only mode (using Provider/Network), or read/write using Signer.

// Read only mode using RPC URL.
import { SaturnClient } from '@0xsaturn/sdk';

// We support websockets too.
const client = new SaturnClient('https://rpc-mainnet.maticvigil.com');

Or, you can use a signer too with help of Ethers.js

import { ethers } from 'ethers';
import { SaturnClient } from '@0xsaturn/sdk';

// Create the wallet which has the Signer and Provider.
const wallet = new ethers.Wallet(
  '<WALLET_PRIVATE_KEY>',
  ethers.getDefaultProvider('https://rpc-mainnet.maticvigil.com')
);

// Initialize the client with the signer.
const client = new SaturnClient(wallet);

Python

Python SDK is relatively easier to use. It needs both the Signer and Provider for read and write.

from saturn_sdk import SaturnClient

client = SaturnClient(
    # This can be a Web3 provider instance aswell.
    provider="https://rpc-mainnet.maticvigil.com",

    # This can be a `LocalAccount` object too.
    signer="<WALLET_PRIVATE_KEY>"
)
âš 

Your private key should NOT be exposed under any circumstances, anyone with access to it can use it to make transactions and transfer all tokens and crypto from your account.

You can use the dotenv library in both Python and Typescript to store your key safely.

Further steps

Here are some ideas for you to hack on!

  • Create your own Token (ERC20) on the chain!
  • Mint some of your art as NFTs.
  • Airdrop your NFTs to others. ✨
Last updated on July 20, 2022