Class: PunksMeta
- Inherits:
-
Ethlite::Contract
- Object
- Ethlite::Contract
- PunksMeta
- Defined in:
- lib/ethlite/contracts/punks_meta.rb
Instance Method Summary collapse
-
#getAttributes(_tokenId) ⇒ Object
function getAttributes(uint256 _tokenId) returns (string).
-
#intToString(value) ⇒ Object
function intToString(uint256 value) returns (string).
-
#parseAttributes(_tokenId) ⇒ Object
function parseAttributes(uint256 _tokenId) returns (string).
-
#tokenURI(_tokenId) ⇒ Object
function tokenURI(uint256 _tokenId) returns (string).
Methods inherited from Ethlite::Contract
address, at, default_address, #do_call, #initialize, methods, sig
Constructor Details
This class inherits a constructor from Ethlite::Contract
Instance Method Details
#getAttributes(_tokenId) ⇒ Object
function getAttributes(uint256 _tokenId) returns (string)
getAttributes calls parseAttributes and returns the result as JSON
@param _tokenId the punk id
41 42 43 |
# File 'lib/ethlite/contracts/punks_meta.rb', line 41 def getAttributes(_tokenId) do_call("getAttributes", _tokenId) end |
#intToString(value) ⇒ Object
function intToString(uint256 value) returns (string)
74 75 76 |
# File 'lib/ethlite/contracts/punks_meta.rb', line 74 def intToString(value) do_call("intToString", value) end |
#parseAttributes(_tokenId) ⇒ Object
function parseAttributes(uint256 _tokenId) returns (string)
parseAttributes returns an array of punk attributes. 8 rows in total
The first row is the Type, and next seven rows are the attributes.
The values are fetched form the CryptoPunksData contract and then the
string is parsed.
@param _tokenId the punk id
53 54 55 |
# File 'lib/ethlite/contracts/punks_meta.rb', line 53 def parseAttributes(_tokenId) do_call("parseAttributes", _tokenId) end |
#tokenURI(_tokenId) ⇒ Object
function tokenURI(uint256 _tokenId) returns (string)
tokenURI gets the metadata about a punk and returns as a JSON
formatted string, according to the ERC721 schema and market
recommendations. It also embeds the SVG data.
The attributes and SVG data are fetched form the CryptoPunksData
contract, which stores all the CryptoPunks metadata on-chain.
@param _tokenId the punk id
66 67 68 |
# File 'lib/ethlite/contracts/punks_meta.rb', line 66 def tokenURI(_tokenId) do_call("tokenURI", _tokenId) end |