npm.io
1.26.0 • Published 4 years ago

nfiot-js

Licence
MIT
Version
1.26.0
Deps
0
Size
223 kB
Vulns
0
Weekly
0

NFioT-JS

Interact with NFioT contracts in javascript

Using NFioTJS

See avalaible contracts

NFioTJs exports the Contract enum containing all available contracts:

enum Contract {
  NFTIOT
}
Get a contracts ABI

Use the getContractAbi function to get a contract's ABI:

import { getContractAbi, Contract } from "nfiot-js";

const nfiotAbi = getContractAbi(Contract.NFIOT);
Full example with ethers

NFioTJs exports types for each contract, which can be used alongside Web3 libraries like ethers:

import { ethers } from "ethers";
import { getContractAbi, Contract } from "nfiot-js";
import type { NFioT } from "nftio-js";

const provider = new ethers.providers.Web3Provider((window as any).ethereum);
const signer = provider.getSigner();

const nfiotAbi = getContractAbi(Contract.NFIOT);
const nfiotContract = new ethers.Contract(contractAddress, nfiotAbi, signer) as NFiot;