npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ainft-team/ainft-js

v2.1.3

Published

[![Docs](https://img.shields.io/badge/Docs-blue)](https://ainft-team.github.io/ainft-js/) [![Tutorial](https://img.shields.io/badge/Tutorial-gre)](https://docs.ainetwork.ai/ainfts/developer-reference/ainft-tutorial) [![GitHub](https://img.shields.io/githu

Downloads

1,312

Readme

ainft-js

Docs Tutorial GitHub Npm

The ainft-js is typescript SDK to interact with AIN blockchain and create and manage AINFT.

AINFT Factory

The AINFT Factory is a component consisting of AINFT Factory server and ainft-js. AINFT Factory supports the following two features:

  • AINFT: Supports creating and managing AINFT, the NFT of the Ain blockchain.
  • Tokenomics: Supports functions for activating tokenomics in NFT communities.

You can see reference about AINFT Factory: https://docs.ainetwork.ai/ainfts/ainft.

Installation

yarn add @ainft-team/ainft-js

Usage

First, install the application and import the SDK to get started:

import AinftJs from '@ainft-team/ainft-js';

Configuration

To initialize the SDK with a private key, create an instance of `AinftJs` as follows. If you don't have an account, create one through the AIN wallet or by using script at `examples/wallet/createAccount.js`;

const ainft = new AinftJs({
  privateKey: '<YOUR_PRIVATE_KEY>',
});

Alternatively, you can use the AIN wallet for authentication and transaction signing in the Chrome browser.

const ainft = new AinftJs({
  signer: new AinWalletSigner(),
});

Connecting to the Testnet

To connect to the AIN blockchain testnet, configure the SDK with the testnet endpoints:

const ainft = new AinftJs({
  privateKey: '<YOUR_PRIVATE_KEY>',
  baseUrl: 'https://ainft-api-dev.ainetwork.ai',
  blockchainUrl: 'https://testnet-api.ainetwork.ai',
  chainId: 0,
});

Features

AINFT

You can create AINFT object and mint AINFT though AINFT object. Below modules support it.

  • nft: Creates AINFT object and Searches AINFTs and AINFT objects.
  • ainft721Object: It is AINFT object class. Mints AINFTs and Transfers it to other accounts.
  • ainftToken: It is AINFT class. Updates metadata.

You can learn how to make AINFT in tutorials.

Tokenomics

Features for activating tokenomics in NFT communities.

  • credit: Create and manage community-specific credits.
  • event: Create and manage events where user can take action and receive rewards. This is a function for credit mining.
  • store: You can create items, register them in the store, and sell them. This is a function for consuming credit.

NFT API

Introducing the main API functions that can be used in the nft module.

  • create(name, symbol): Creates AINFT object.
  • register(ainftObjectId): Register AINFT object created to AINFT Factory server.
  • get(ainftObjectId): Gets AINFT object instance by id.
  • getAinftsByAinftObject(ainftObjectId, limit, cursor): Gets information of AINFTs by AINFT object.
  • getAinftsByAccount(address, limit, cursor): Gets information of AINFTs by user address.
  • searchAinftObjects(searchParams): Search for AINFT object. You can use ainft object id, name, symbol for searching.
  • searchAinfts(searchParams): Search for AINFT. You can use ainft object id, name, symbol, token id, user address for searching.

AINFT721 Object API

Introducing the main API functions that can be used in the ainftObject module.

  • getToken(tokenId): Gets AINFT that was minted by AINFT object.
  • transfer(from, to, tokenId): Transfers AINFT to other account.
  • mint(to, tokenId): Mints AINFT.

AINFT Token API

Introducing the main API functions that can be used in the ainftToken module.

  • setMetadata(metadata): Sets metadata of AINFT.

AI API

We provide AI API functions, including assistant, thread, and message. To use these functions follow streamlined steps:

  1. Initialization: Before using any AI functions, initialize the event channel with the connect() method.
  2. Using AI functions: After opening the event channel, you can use AI function.
  3. Closure: Ensure to close the event channel with the disconnect() method when the functions are no longer needed.
import AinftJs from '@ainft-team/ainft-js';

const ainft = new AinftJs({
  privateKey: '<YOUR_PRIVATE_KEY>',
  baseUrl: 'https://ainft-api-dev.ainetwork.ai',
  blockchainUrl: 'https://testnet-api.ainetwork.ai',
  chainId: 0,
});

async function main() {
  await ainft.connect(); // connect to the blockchain endpoint

  // your ai function usage here
  // ...

  await ainft.disconnect(); // disconnect from the blockchain endpoint
}

main();

AINFT tutorial

You can view the tutorial document at the following link. and You can also look at scripts created for tutorials in the tutorial directory.

Tutorial scripts

API Documentation

API documentation is available at https://ainft-team.github.io/ainft-js.

License

MIT License