nft.resolver
Resolver for non-fungible tokens issued by oasis.asset.
NFT Resolver is a SDK for NFT developer:
-
NFT generate and sign following
oasis.asset
standard. -
Customized and generate extended meta data from a NFT.
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
; // Initialize with uuid.const uuid = "123456";const symbol = "SWORD";const uri = "oasis://rogeman/OTHER/antsword?subtypes=type1,type2&types1=1&types2=2";const nft = uri symbol uuid; // or initialize without uuidconst nft = uri symbol; // Get nft uri and meta data decoded from urinfturi // "oasis://rogeman/ARMOR/antsword/other1/other2?subtypes=type1,type2&types1=1&types2=2"nftworld // "rogeman"nfttype // "OTHER"nftcategory // "antsword"nftparams // { subtypes:"type1,type2", type1: "1", types2: "2"}nftfragments // ["other1","other2"] // Set extended meta datanftnftextendedMetaData; // the same with above // Sign nftconst signature = nft; // Verify signaturenft;
URI resolve
URI resolver provided a low-level uri assemble or disassemble.
; const uriString = "oasis://rogeman/ARMOR/antsword?subtypes=type1,type2&type1=1&type2=2";const game = "rogeman";const type = "ARMOR";const category = "antsword";const nftUri = game type category subtypes: "type1,type2" type1: "1" type2: "2"; nftUriraw == uriString; // true // Sub types managesnftUri; // "1"nftUri;nftUri; // Return all query paramsnftUri; // Object{"subtypes":"type1,type2","type1":"1","type2":"2"}
Extended Meta data class is provided:
; const name = "Asset Name";const desp = "Simple description";const image = "https://www.google.com/image/1.jpg";const properties: Properties = simpleProperty: "Simple property" richProperty:... // json object; const extMeta = namedespimageproperties; // Set new propertyextMeta; extMeta;// {// "name": "Asset Name",// "description": "Simple description",// "image": "https://www.google.com/image/1.jpg",// "properties": {// "simple_property": "Simple property",// "rich_property": {...}// }// }