Skip to main content

Initialise JavaScript SDK

Let's initiate library in your project, depending on if you're following ES6 standard or CommonJS module format.

Import​

import { DripSDK } from 'dripverse';

or

const { DripSDK } = require('dripverse');

Initialise​

You can generate your Project API from the Utility Page of the NFT or the Project page itself.

var drip = new DripSDK('PROJECT_API_KEY');

Read more about Utility Setup on DripVerse Platform.

info

Note: Please use your generated project key only and do NOT share your project key with anyone. Learn more about Generating Project Key.


Contract Client​

We would need a contract client to proceed. A contract client can be generated from a smart contract deployed on the network and compiled to extract it's abi and bytecode. You can learn about compiling solidity smart contract from solc docs.

We will simplify this process using our sdk:

// Get Contract Client
let contract = await drip.contractClient();

Now, you have the contract client loaded.

Wallet Client​

Minting NFT is non-custodial. So, you're owner of your keys at all times. We do not store or have access to your keys at any point. There are several ways to get wallet client.

// Get your walletClient:
let walletClient = await drip.walletClient(PRIVATE_KEY);

Optional:

  • networkId:
    • 1 : Polygon Mumbai Testnet
    • 3 : Polygon Mainnet (Default)

Now, create a Contract Signer instance. We will use this going forward to interact with the smart contract functions.

let contractSigner = contract.connect(walletClient);