0.3.6 • Published 2 years ago

@0xsaturn/sdk v0.3.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

0xSaturn Typescript SDK

The Typescript SDK for building your dApps with ease. ✨

🚀 Installation

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

npm install @0xsaturn/sdk
# OR
yarn add @0xsaturn/sdk

✨ Usage

Quickly get started by initializing the SDK.

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://polygon-rpc.com')
);

// Initialize the client with the signer.
// You can directly use the RPC URL instead of wallet, which gives you read-only access.
const client = new SaturnClient(wallet);

Perfect. Now, deploy your first contract (The cool kids call it "module")!

const address = await client.deployNFTModule({
  name: 'My NFT Module',
  symbol: 'MYNFT'
});

console.log('✨ Deployed NFT module at:', address);

Keep a note of the address, where the contract is deployed! Let's use it to interact with the contract.

import fs from 'fs';

// Initialize the NFT Module.
const module = await client.getNFTModule('<DEPLOYED_NFT_MODULE_ADDRESS>');

// Mint a NFT.
const { transactionHash } = await module.mint({
  name: 'My NFT!',
  description: 'This is my NFT, minted using 0xSaturn!',
  image: fs.readFileSync('my-nft-image.png')
});

console.log('Minted NFT with transaction hash:', transactionHash);

This should mint your NFT! You can verify using the transaction hash on the respective scan website for the chain used.

💬 Get in touch

Have various suggestions, questions, or any comments? Or, just want to discuss with our community?

Check out our Github Discussions or reach out to us on twitter!

👋 Show your support

Be sure to drop a 🌟 if you like the project!