0.0.1 • Published 2 years ago

@koibanx/nft-generator-sdk v0.0.1

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
2 years ago

Koibanx NFT Generator SDK

NFT Generator SDK based in module NFT Generator

Description

The Module NFT Generator handles:

SDK Documentation

Feast yourself

Installation

npm install @koibanx/nft-generator-sdk

NOTE: you must have the npm token in your .npmrc file

Initialization

Node

Using ES6 import

import NFTGeneratorSdk from '@koibanx/nft-generator-sdk';

const nftGenerator = NFTGeneratorSdk({
  baseURL: 'http://your-url',
});

With require

exports.__esModule = true;
const NFTGeneratorSdk = require('@koibanx/nft-generator-sdk')["default"];

const nftGenerator = NFTGeneratorSdk({
  baseURL: 'http://your-url',
});

Types

  • Typescript (@koibanx/nft-generator-sdk/dist/index.d.ts)

Examples

Using ES6 import

import NFTGeneratorSdk from "@koibanx/nft-generator-sdk";

const nftGenerator = NFTGeneratorSdk({
    baseURL: 'http://your-url',
})

const catchError = (err, modulo) => {
  console.log('Modulo: ', modulo);
  console.log('details: ', err.details);
  console.log('shortMessage: ', err.message);
  console.log('errorCode: ', err.code);
}

const address = 'LYLXNUVYIQMKHSOFE3COC5QKYC7HP44RWY66U3ULQOVVJHEDFR37JM2WEM';
const creatorAddr = 'LYLXNUVYIQMKHSOFE3COC5QKYC7HP44RWY66U3ULQOVVJHEDFR37JM2WEM';
const url = 'https://ipfs.io/ipfs/QmXcUsZrYZotT9NKXsjQbGVQNu4QdSUdL3Z7DVMXrDQa8U';

nftGenerator.countNFT({
  address,
  nftAsaId: 114560197,
}).then((data) => console.log('countNFT', JSON.stringify(data)))
  .catch((e) => catchError(e, 'countNFT'));

nftGenerator.getNFT({
  address,
  nftAsaId: 114560197,
}).then((data) => console.log('getNFT', JSON.stringify(data.params)))
  .catch((e) => catchError(e, 'getNFT'));

nftGenerator.createNFT({
  creatorAddr,
  amount: 1,
  defaultFrozen: false,
  unitName: 'Testing',
  url,
}).then((data) => console.log('createNFT', JSON.stringify(data)))
  .catch((e) => catchError(e, 'createNFT'));

nftGenerator.transferNFT({
  amount: 0,
  from: address,
  receiver: address,
  nftAsaId: 114560197,
}).then((data) => console.log('transferNFT', JSON.stringify(data)))
  .catch((e) => catchError(e, 'transferNFT'));

nftGenerator.optInNFT({
  address,
  nftAsaId: 114560197,
}).then((data) => console.log('optInNFT', JSON.stringify(data)))
  .catch((e) => catchError(e, 'optInNFT'));

nftGenerator.commitTransaction({
  blob: [130, 163, 115],
}).then((data) => console.log('commitTransaction', JSON.stringify(data)))
  .catch((e) => catchError(e, 'commitTransaction'));
0.0.1

2 years ago