DNFT
  • What is NFT?
    • The Origin of NFT
    • Decentralized NFT Marketplace
    • NFT Cross-chain
    • NFT & AI Models
  • Introduction to DNFT
    • Overview
    • Business Model
    • Core Value
  • Technical Architecture
    • Overview
    • Chain Layer
    • Protocol Layer
      • DAO Governance Protocol
      • NFT Administration Protocol
      • ERC2006 (An AI Model Friendly NFT Standard)
      • NFT Cross-chain Protocol
      • NFT Swap Protocol
    • Application Layer
      • AI Module
      • Crypto Art Module
      • Game Module
      • Metaverse Module
      • NFT + Defi Module
  • RoadMap
  • Tokenomics
  • Governance
  • Security
  • Governance Agreement of DNFT
  • DNFT in Substrate
  • Transaction
  • Developer's Guide
    • Front-end Integration
    • Smart Contract
  • Our Products
  • User manual
    • Bridge Brief Description
    • IGO
    • Mining & Staking
    • NFT Marketplace
  • Official Links
  • Contract Address
Powered by GitBook
On this page
  • SDK
  • Dependency

Was this helpful?

  1. Developer's Guide

Front-end Integration

PreviousDeveloper's GuideNextSmart Contract

Last updated 3 years ago

Was this helpful?

SDK

The following webpage contains the technical reference SDK for DNFT. Looking for a quick start instead? You may also want to jump into a wizard, which provides a more friendly introduction to the SDK!

The SDK is written in TypeScript, has a robust test suite, performs arbitrary-precision algorithms, and supports rounding to significant digits or fixed decimal places. The main export SDK is an entity: a class that contains initialization and verification checks, necessary data fields and helper functions.

An important concept in the SDK is fractions. Because Solidity performs integer math, attention must be paid to non-EVM environments to faithfully replicate the actual calculations performed on the chain. The first issue here is to ensure the use of safe overflow integer implementations. Ideally, the SDK can use native Great Indias. However, before the support becomes more widespread, SBI objects are used, with the idea that once BigInts surges, this dependency can be compiled away. The second problem is the loss of precision, for example, chain price ratio calculations. In order to solve this problem, all mathematical operations are performed in the form of fractional operations to ensure arbitrary precision upwards. Until the value is rounded for display purposes, or truncated to fit a fixed bit width point. The SDK is applicable to all factories on the chain that have been deployed.

The source code can be found on .

Dependency

The SDK declares its dependencies as peer dependencies. There are two reasons for this:

Prevent installation of unused dependencies (for example: @ethersproject/providers and @ethersproject/contracts, only for Fetcher)

Prevent repeated @ethersproject version conflict dependencies

However, this means that these dependencies must be installed in the SDK if you haven't installed them yet.

GitHub