nft.resolver
中文版
Resolver for non-fungible tokens issued by oasis.asset.
NFT Resolver is a SDK for NFT developer:
Check out the API
Installation
Install with npm:
npm install nft-resolver -S
or with yarn:
yarn add nft-resolver -S
Usage
NFT Meta
check out docs.
NFT resolve
import { NFT } from "nft-resolver";
const uuid = "123456";
const symbol = "SWORD";
const uri = "oasis://rogeman/OTHER/antsword?subtypes=type1,type2&types1=1&types2=2";
const nft = new NFT(uri, symbol, uuid);
const nft = new NFT(uri, symbol);
nft.uri
nft.world
nft.type
nft.category
nft.params
nft.fragments
nft.setExtMetaData({
"name": "Asset Name",
"description": "Lorem ipsum...",
"image": "...",
"properties": {
"simple_property": "example value",
"rich_property": {...}
}
})
nft.extendedMetaData;
const signature = nft.sign('5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3');
nft.verifySign('EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV');
URI resolve
URI resolver provided a low-level uri assemble or disassemble.
import { NftURI } from "nft-resolver";
const uriString =
"oasis://rogeman/ARMOR/antsword?subtypes=type1,type2&type1=1&type2=2";
const game = "rogeman";
const type = "ARMOR";
const category = "antsword";
const nftUri = new NftURI(game, type, category, {
subtypes: "type1,type2",
type1: "1",
type2: "2",
});
nftUri.raw == uriString;
nftUri.getParam("type1");
nftUri.addParam("type3", "3");
nftUri.rmParam("type3");
nftUri.allParams();
Extended Meta data class is provided:
import {NftExtMeta} from 'nft-resolver';
const name = "Asset Name";
const desp = "Simple description";
const image = "https://www.google.com/image/1.jpg";
const properties: Properties = {
simpleProperty: "Simple property",
richProperty:{...}
};
const extMeta = new NftExtMeta(name,desp,image,properties);
extMeta.setProps(newProps);
extMeta.toString();