@unique-nft/sdk
Advanced tools
Comparing version 0.1.6 to 0.1.7
51
index.js
@@ -27,2 +27,12 @@ import Axios from 'axios'; | ||
} | ||
async postRequest(url, data, params) { | ||
const response = await this.client.instance({ | ||
method: Method.POST, | ||
baseURL: this.baseUrl, | ||
url, | ||
data, | ||
params | ||
}); | ||
return response.data; | ||
} | ||
} | ||
@@ -83,2 +93,3 @@ | ||
async getFee(args) { | ||
var _a; | ||
const response = await this.client.instance({ | ||
@@ -90,4 +101,3 @@ method: this.method, | ||
}); | ||
const data = response.data; | ||
return data.fee; | ||
return (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.fee; | ||
} | ||
@@ -209,3 +219,4 @@ async sign(args, options) { | ||
this.send = new Mutation(this.client, Method.POST, `${this.path}/send`); | ||
this.call = (args) => this.query("call", args); | ||
this.contractExists = (args) => this.query("contract-exists", args); | ||
this.call = (args) => this.postRequest("call", args); | ||
} | ||
@@ -358,3 +369,3 @@ } | ||
var version = "0.1.2"; | ||
var version = "0.1.7"; | ||
@@ -367,6 +378,35 @@ class Common extends Section { | ||
this.chainProperties = () => this.query("properties"); | ||
this.getNonce = (args) => this.query("get-nonce", args); | ||
this.getNonce = (args) => this.query("nonce", args); | ||
} | ||
} | ||
class StateQueries extends Section { | ||
constructor() { | ||
super(...arguments); | ||
this.path = "query"; | ||
this.baseUrl = `${this.client.options.baseUrl}/${this.path}`; | ||
} | ||
async get(args) { | ||
const { endpoint, module, method } = args; | ||
const url = `${endpoint}/${module}/${method}`; | ||
const response = await this.client.instance({ | ||
method: Method.GET, | ||
baseURL: this.baseUrl, | ||
url | ||
}); | ||
return response.data; | ||
} | ||
async execute(params, body) { | ||
const { endpoint, module, method } = params; | ||
const url = `${endpoint}/${module}/${method}`; | ||
const response = await this.client.instance({ | ||
method: Method.POST, | ||
baseURL: this.baseUrl, | ||
url, | ||
data: body || {} | ||
}); | ||
return response.data; | ||
} | ||
} | ||
class Client { | ||
@@ -385,2 +425,3 @@ constructor(options) { | ||
this.evm = new Evm(this); | ||
this.stateQuery = new StateQueries(this); | ||
this.defaults = { | ||
@@ -387,0 +428,0 @@ baseUrl: "" |
{ | ||
"name": "@unique-nft/sdk", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"license": "MIT", | ||
@@ -39,2 +39,2 @@ "dependencies": { | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
101760
2943