https://github.com/totem-gdn/totem-dna-parser
Node module for parsing DNA of Totem Assets
https://github.com/totem-gdn/totem-dna-parser
Last synced: 4 months ago
JSON representation
Node module for parsing DNA of Totem Assets
- Host: GitHub
- URL: https://github.com/totem-gdn/totem-dna-parser
- Owner: Totem-gdn
- License: mit
- Created: 2022-10-05T17:49:08.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-07T11:33:07.000Z (almost 2 years ago)
- Last Synced: 2024-12-29T14:41:44.350Z (6 months ago)
- Language: JavaScript
- Size: 377 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# totem-dna-parser
Node module for parsing DNA of Totem Assets
# Installation
npm install --save git+https://github.com/Totem-gdn/totem-dna-parser
# Get Default JSON
const { DNAParser } = require('totem-dna-parser')
const defaultAvatarJson = DNAParser.defaultAvatarJson
const defaultGemJson = DNAParser.defaultGemJson
const defaultItemJson = DNAParser.defaultItemJson
returns an array of objects with rules for DNA
# Get all possible properties for JSON
const { DNAParser } = require('totem-dna-parser')
const parser = new DNAParser(JSON, DNA)
const properties = parser.getFilterPropertiesList()
returns an array of strings with all possible properties for DNA from JSON.
# Get field
const { DNAParser } = require('totem-dna-parser')
const parser = new DNAParser(JSON, DNA)
const result = parser.getField(ID)
returns decrypted value from DNA
# Get Item Rarity
const { DNAParser } = require('totem-dna-parser')
const rarity = new DNAParser().getItemRarity(ITEM_ID)
returns rarity integer
# Working with contract
const { ContractHandler } = require('totem-dna-parser')
const contractHandler = new ContractHandler(url, contract)
const DNA = await contractHandler.getDNA(id)
returns DNA string
# Enum of Registers which can be used for getExponentialValue
const { Registers } = require('totem-dna-parser')
returns enum {
HIGH: 'high',
LOW: 'low'
}# Get exponential value
const parser = new DNAParser(JSON, DNA)
parser.getExponentialValue(index, Registers.LOW)
returns exponential value