human-standard-collectible-abi

A simple node module that exports the Ethereum ABI for ERC 721 compatible tokens.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
human-standard-collectible-abi
1.0.24 years ago4 years agoMinified + gzip package size for human-standard-collectible-abi in KB

Readme

Human Standard Collectible ABI
A simple node module that exports the Ethereum ABI1 for ERC 7212 compatible tokens.
Requires the web3 API to be available, either by initailizing it yourself, or using a web3-injecting Javascript environment, like Geth, MetaMask, or Mist.

Usage

var abi = require('human-standard-collectible-abi')

var collectible = web3.eth.contract(abi).at(contractAddress)
var tokenId = 12345
var addr = web3.eth.accounts[0]

// Get the token name
collectible.name.call(function(err, name) {
  if(err) { console.log(err) }
  if(name) { console.log('The collectible name is: ' + name) }
})

// Get the token symbol
collectible.symbol.call({from: addr}, function(err, symbol) {
  //ABI expects string here,
  if(err) { console.log(err) }
  console.log('Collectible symbol: ' + symbol)
})

collectible.tokenURI.call(tokenId, function(err, tokenURI) {
  console.log(tokenURI)
})

collectible.balanceOf.call(addr, function (err, bal) {
  if (err) { console.error(err) }
  console.log('balance is ' + bal.toString(10))
})