@unique-nft/sdk
Advanced tools
Comparing version 0.2.2 to 0.2.3
48
index.js
import Axios from 'axios'; | ||
import { Coder } from 'abi-coder'; | ||
import FormData from 'form-data'; | ||
import { io } from 'socket.io-client'; | ||
@@ -394,2 +395,3 @@ var Method = /* @__PURE__ */ ((Method2) => { | ||
this.getCollection = (args) => this.query("collection", args); | ||
this.burn = new Mutation(this.client, Method.DELETE, this.path); | ||
this.createCollection = new Mutation(this.client, Method.POST, `${this.path}/collection`); | ||
@@ -401,2 +403,3 @@ this.getBalance = (args) => this.query("balance", args); | ||
this.allowanceTokens = (args) => this.query("tokens/allowance", args); | ||
this.totalPieces = (args) => this.query("total-pieces", args); | ||
} | ||
@@ -411,2 +414,3 @@ } | ||
this.getCollection = (args) => this.query("collection", args); | ||
this.burn = new Mutation(this.client, Method.DELETE, this.path); | ||
this.getBalance = (args) => this.query("tokens/balance", args); | ||
@@ -420,2 +424,3 @@ this.createCollection = new Mutation(this.client, Method.POST, `${this.path}/collection`); | ||
this.totalPieces = (args) => this.query("tokens/total-pieces", args); | ||
this.accountTokens = (args) => this.query("tokens/account-tokens", args); | ||
} | ||
@@ -529,3 +534,3 @@ } | ||
var version = "0.2.2"; | ||
var version = "0.2.3"; | ||
@@ -571,2 +576,40 @@ class Common extends Section { | ||
class SocketClient { | ||
constructor(socket) { | ||
this.socket = socket; | ||
} | ||
on(event, listener) { | ||
this.socket.on(event, listener); | ||
} | ||
subscribeHeaders() { | ||
this.socket.emit("subscribe:headers"); | ||
return this; | ||
} | ||
subscribeBlocks() { | ||
this.socket.emit("subscribe:blocks"); | ||
return this; | ||
} | ||
subscribeExtrinsics(filter) { | ||
this.socket.emit("subscribe:extrinsics", filter); | ||
return this; | ||
} | ||
subscribeEvents(filter) { | ||
this.socket.emit("subscribe:events", filter); | ||
return this; | ||
} | ||
} | ||
class Subscriptions { | ||
constructor(client) { | ||
this.client = client; | ||
} | ||
connect(secondary) { | ||
const options = { | ||
path: secondary ? `/${secondary}/socket.io` : "/socket.io" | ||
}; | ||
const socket = io(this.client.options.baseUrl, options); | ||
return new SocketClient(socket); | ||
} | ||
} | ||
class Client { | ||
@@ -587,2 +630,3 @@ constructor(options) { | ||
this.stateQuery = new StateQueries(this); | ||
this.subscriptions = new Subscriptions(this); | ||
this.defaults = { | ||
@@ -604,3 +648,3 @@ baseUrl: "" | ||
const err = (_b = (_a = exception.response) == null ? void 0 : _a.data) == null ? void 0 : _b.error; | ||
throw err ? new ApiError(err) : exception; | ||
throw err && typeof err === "object" ? new ApiError(err) : exception; | ||
}); | ||
@@ -607,0 +651,0 @@ { |
{ | ||
"name": "@unique-nft/sdk", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"license": "MIT", | ||
@@ -8,3 +8,5 @@ "dependencies": { | ||
"axios": "^0.27.2", | ||
"form-data": "^4.0.0" | ||
"form-data": "^4.0.0", | ||
"socket.io": "^4.5.4", | ||
"socket.io-client": "^4.5.4" | ||
}, | ||
@@ -11,0 +13,0 @@ "description": "The @unique-nft/sdk package implements the SDK methods via the REST API. The package implements all the basic methods for working with the Unique Network SDK.", |
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
128607
3757
5
+ Addedsocket.io@^4.5.4
+ Addedsocket.io-client@^4.5.4
+ Added@socket.io/component-emitter@3.1.2(transitive)
+ Added@types/cookie@0.4.1(transitive)
+ Added@types/cors@2.8.17(transitive)
+ Added@types/node@22.10.0(transitive)
+ Addedaccepts@1.3.8(transitive)
+ Addedbase64id@2.0.0(transitive)
+ Addedcookie@0.7.2(transitive)
+ Addedcors@2.8.5(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addedengine.io@6.6.2(transitive)
+ Addedengine.io-client@6.6.2(transitive)
+ Addedengine.io-parser@5.2.3(transitive)
+ Addedms@2.1.3(transitive)
+ Addednegotiator@0.6.3(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedsocket.io@4.8.1(transitive)
+ Addedsocket.io-adapter@2.5.5(transitive)
+ Addedsocket.io-client@4.8.1(transitive)
+ Addedsocket.io-parser@4.2.4(transitive)
+ Addedundici-types@6.20.0(transitive)
+ Addedvary@1.1.2(transitive)
+ Addedws@8.17.1(transitive)
+ Addedxmlhttprequest-ssl@2.1.2(transitive)