0.0.5-alpha.3 • Published 1 year ago

@diego-outdefine/contracts-sdk v0.0.5-alpha.3

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

DEFN Contracts SDK

Software development kit that facilitates the interaction with the DEFN Contracts.

Table of Contents

Installation

Install the package using npm:

npm install @outdef/contracts-sdk

Getting Started

The following steps show how to use the SDK to interact with the DEFN Contracts.

1. Import and Init SDK

Available SDKs:

  • getPolygonMumbaiSDK - for Polygon Mumbai testnet
  • getPolygonSDK - for Polygon mainnet
import { ethers } from 'ethers'
import { getPolygonMumbaiSDK } from '@outdef/contracts-sdk'

const provider = new ethers.providers.JsonRpcProvider('http://localhost:8545')
const signer = new ethers.Wallet('0x...', provider)

const sdk = getPolygonMumbaiSDK(signer)

2. Call view contract methods

const rewardRate = await sdk.odfStaking.rewardRate()
console.log('Reward Rate: ', rewardRate.toString())

3. Call non-view contract methods

const tx = await skd.odfToken.transfer('0x...', '1000000000000000000')
console.log('Transaction Hash: ', tx.hash)
const receipt = await tx.wait()
console.log('Transfer receipt: ', receipt)

Contracts Definition

ODFToken

ODFStake

ODFDAO

0.0.5-alpha.3

1 year ago

0.0.5-alpha.2

1 year ago

0.0.5-alpha.1

1 year ago

0.0.4-alpha.1

1 year ago

0.0.3-alpha.1

1 year ago