0.1.27 • Published 1 year ago
@zoek/genx v0.1.27
GenX
Empower your users adding genes to NFTS. Your users can mutate and evolve the assets in multiple games, don't tie the characters to only one game. Don't reinvent the wheel.
Setup
import genx from 'genx';
const Tezos = genx.genx.getTezos();
const [alreadyConnected, wallet, userAddress] = await genx.genx.getWallet(this.Tezos, "Pirate Genx Game");
const pk = !alreadyConnected
? await genx.genx.connectWallet(wallet)
: userAddress;
const contract = await this.Tezos.wallet.at(contractAddress);
const storage = await this.contract.storage();
Functions
getLastTokenId(storage)
: Get the next token Idget_generations(storage.genx, token_id)
: Get all generations keysget_generation(storage.genx, token_id)
: Get all generations as array of objectsgetAssets(storage)
: Retrieve all NFT Tokens and its metadatareduceGenes(storage.genx, tokenId)
: Combine all genes of the tokenversion(str)
: Convert string to numeric version ("2.1.0" => 2,1,0)fusion(genx, token_x, gen_x, token_y, gen_y)
: Fusion two genes versionscreate_token(contract, token_id, props)
: Create a NFT Tokenadd_gen(contract, token_id, genes, major, minor=0, patch=0)
: Add or update if exists the generationnerf(contract, token_id, gene_name, gene_type, gene_value, major, minor=0, patch=0)
: Add or update specified genemutate(contract, token_id, genes, major, minor=0, patch=0)
: Update specific version with the provided genesevolve(contract, token_id, genes)
: Create a new version based on the provided genes
Licese
See LICENSE