andy-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.0.15 • Public • Published

Usage

Installation

npm install andy-sdk --save

Importing

Node.js

const { Andy } = require("andy-sdk");
const { ethers } = require("ethers");

Typesccript or ES6

import { Andy } from "andy-sdk";
import { ethers } from "ethers";

Pre-requsite setup

const andyInstance = new Andy("testnet"); // Other option - 'mainnet'
// Provide valid rpc url
const provider = new ethers.providers.JsonRpcProvider("https://polygon-testnet.infura.io/v3");
andyInstance.setProvider(provider);

SDK Helper functions

Checking Availability

const isAvailable = await andyInstance.isAndyAvailable(andid);

/* Response

{
  owner: '0xd8965A2DE04A72667cCc5fE6bA3faCe12a7049AE',
  isAvailable: false
}

*/

Getting Andid Owner Details

const ownerDetail = await andyInstance.getOnwer(andid);

/* Response

{
  onwer: '0xd8965A2DE04A72667cCc5fE6bA3faCe12a7049AE',
  metadataUrl: 'https://dev.andysvc.getandy.xyz/metadata/weebly'
}

*/

Getting andids held by particular address

const andidsHeldByAddress = await andyInstance.getAndidOwnedByAddress(addressInput);

/* Response

[
  {
    "tokenId": "43969677626897412952373899752913639441918603015557032557413919303705553966113",
    "uri": "https://prod.andysvc.getandy.xyz/metadata/sahilkathpal",
    "owner": "0x06a632242804286964cbef3ea3ab59fedecfd7c8"
  }
]

*/

Getting history of andid

const andyHistory = await andyInstance.getHistoryOfAndid(andyInput);

/* Response

[
  {
    "txnHash": "0x713350fe2513c49eb5458a73fd9171a575f0435ba3e3f8305079b0accb85a7ec",
    "tokenId": "16672474611014187258095013380947172067126435195903326241914102396144580949994",
    "uri": "https://dev.andysvc.getandy.xyz/metadata/transfertest",
    "fromAddress": "0xd8965a2de04a72667ccc5fe6ba3face12a7049ae",
    "toAddress": "0xd2c5e014469c95df39634aa96818bfb46c58f4b6"
  },
  {
    "txnHash": "0xae1a5a879e1e85f8b236cf94340ccbc0ac826c75c0f3a323a6360b41d0d649b7",
    "tokenId": "16672474611014187258095013380947172067126435195903326241914102396144580949994",
    "uri": "https://dev.andysvc.getandy.xyz/metadata/transfertest",
    "fromAddress": "0x0000000000000000000000000000000000000000",
    "toAddress": "0xd8965a2de04a72667ccc5fe6ba3face12a7049ae"
  }
]

*/

Package Sidebar

Install

npm i andy-sdk

Weekly Downloads

5

Version

0.0.15

License

ISC

Unpacked Size

37.9 kB

Total Files

14

Last publish

Collaborators

  • tech-andy