Added class for NaaS rest client#1
Open
shivanshsinghal107 wants to merge 2 commits intoonecdotin:naas-rest-clientfrom
Open
Added class for NaaS rest client#1shivanshsinghal107 wants to merge 2 commits intoonecdotin:naas-rest-clientfrom
shivanshsinghal107 wants to merge 2 commits intoonecdotin:naas-rest-clientfrom
Conversation
Author
|
Code to test the sdk:
import onec from "ceno-sdk";
const data = {
"token_id": "13",
"metadata": {
"Title": "Reference NFT",
"Creator": "Onecdot"
},
"public_address": "0xB1932F9dE39c0633b77F64752f83692aD978cDD9"
}
async function mint(data) {
const naas = new onec.naas(api_key)
// var res = await naas.mintRefNFT(data)
// console.log(res)
var res = await naas.checkMintStatus(1267)
console.log(res)
var res = await naas.fetchTokenID(1267)
console.log(res)
var res = await naas.fetchRefTokenID(1270)
console.log(res)
var res = await naas.getTokenMetadataHash(13)
console.log(res)
var res = await naas.getRefNFTs(13)
console.log(res)
var res = await naas.getIpfsFiles()
console.log(res)
// var res = await naas.uploadIpfsMetaData(data)
// console.log(res)
// var res = await naas.getIpfsMetaData()
// console.log(res)
}
mint(data)
const onec = require('ceno-sdk')
const api_key = process.env.NAAS_APIKEY
function handler(req, res) {
return new Promise(async (resolve, reject) => {
if (req.method === 'GET') {
try {
var data = {
"meta_data": {
"Concert": "Test Service",
"Date": "dd-mm"
},
"info": "Optional:Some info"
}
const naas = new onec.naas(api_key)
// const mintRes = await naas.mintRefNFT(data)
// console.log(mintRes)
var resp = await naas.checkMintStatus(1273)
console.log(resp)
var resp = await naas.fetchTokenID(1273)
console.log(resp)
var resp = await naas.fetchRefTokenID(1275)
console.log(resp)
var resp = await naas.getTokenMetadataHash(20)
console.log(resp)
var resp = await naas.getRefNFTs(20)
console.log(resp)
var resp = await naas.getIpfsFiles()
console.log(resp)
var resp = await naas.uploadIpfsMetaData(data)
console.log(resp)
var resp = await naas.getIpfsMetaData()
console.log(resp)
res.status(200).json({ resp });
res.end();
} catch (error) {
console.log(error);
res.status(400).send(error);
res.end();
}
}
});
}
export default handler; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.