Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@unique-nft/sdk

Package Overview
Dependencies
Maintainers
7
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unique-nft/sdk - npm Package Compare versions

Comparing version 0.1.11 to 0.1.12

143

index.js
import Axios from 'axios';
import { Coder } from 'abi-coder';
import FormData from 'form-data';

@@ -47,17 +48,17 @@

var __defProp = Object.defineProperty;
var __defProp$2 = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues$2 = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__hasOwnProp$2.call(b, prop))
__defNormalProp$2(a, prop, b[prop]);
if (__getOwnPropSymbols$2)
for (var prop of __getOwnPropSymbols$2(b)) {
if (__propIsEnum$2.call(b, prop))
__defNormalProp$2(a, prop, b[prop]);
}

@@ -78,3 +79,3 @@ return a;

url: this.url,
params: __spreadProps(__spreadValues({}, options), { use: "BuildBatch" }),
params: __spreadProps(__spreadValues$2({}, options), { use: "BuildBatch" }),
data: args

@@ -88,3 +89,3 @@ });

url: this.url,
params: __spreadProps(__spreadValues({}, options), { use: "Build" }),
params: __spreadProps(__spreadValues$2({}, options), { use: "Build" }),
data: args

@@ -115,3 +116,3 @@ });

url: this.url,
params: __spreadProps(__spreadValues({}, options), { use: "Submit" }),
params: __spreadProps(__spreadValues$2({}, options), { use: "Submit" }),
data: submitTxArguments

@@ -126,3 +127,3 @@ });

url: this.url,
params: __spreadProps(__spreadValues({}, options), { use: "SubmitWatch" }),
params: __spreadProps(__spreadValues$2({}, options), { use: "SubmitWatch" }),
data: submitTxArguments

@@ -215,2 +216,103 @@ });

const parseEvmEvents = (events, abi) => {
const erc20Coder = new Coder(abi);
const parsedEvents = [];
const unknownEvents = [];
events.filter((event) => event.section === "evm" && event.method === "Log").forEach((event) => {
const logData = event.data[0];
const { topics, data } = logData;
try {
const decoded = erc20Coder.decodeEvent(topics, data);
parsedEvents.push({
name: decoded.name,
values: decoded.values
});
} catch (err) {
unknownEvents.push({
topics,
data
});
}
});
return {
parsedEvents,
unknownEvents
};
};
var __defProp$1 = Object.defineProperty;
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues$1 = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp$1.call(b, prop))
__defNormalProp$1(a, prop, b[prop]);
if (__getOwnPropSymbols$1)
for (var prop of __getOwnPropSymbols$1(b)) {
if (__propIsEnum$1.call(b, prop))
__defNormalProp$1(a, prop, b[prop]);
}
return a;
};
class ContractSendMutation extends Mutation {
constructor(client, method, path, contract) {
super(client, method, path);
this.contract = contract;
}
async build(args) {
return super.build(__spreadValues$1({
contractAddress: this.contract.contractAddress,
abi: this.contract.abi
}, args));
}
async submitWaitResult(args) {
const result = await super.submitWaitResult(args);
const { parsedEvents, unknownEvents } = parseEvmEvents(result.events, this.contract.abi);
result.parsed.parsedEvents = parsedEvents;
result.parsed.unknownEvents = unknownEvents;
return result;
}
}
var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
class Contract extends Section {
constructor(client, contractAddress, abi) {
super(client);
this.contractAddress = contractAddress;
this.abi = abi;
this.path = "evm";
this.baseUrl = `${this.client.options.baseUrl}/${this.path}`;
this.send = new ContractSendMutation(this.client, Method.POST, `${this.path}/send`, this);
}
async call(args) {
const response = await this.client.instance({
method: Method.POST,
baseURL: this.baseUrl,
url: "call",
data: __spreadValues({
contractAddress: this.contractAddress,
abi: this.abi
}, args)
});
return response.data;
}
}
class Evm extends Section {

@@ -225,2 +327,9 @@ constructor() {

}
async contractConnect(contractAddress, abi) {
const { exists } = await this.contractExists({ contractAddress });
if (!exists) {
throw new Error("Contract is not exists");
}
return new Contract(this.client, contractAddress, abi);
}
}

@@ -405,3 +514,3 @@

var version = "0.1.11";
var version = "0.1.12";

@@ -408,0 +517,0 @@ class Common extends Section {

3

package.json
{
"name": "@unique-nft/sdk",
"version": "0.1.11",
"version": "0.1.12",
"license": "MIT",
"dependencies": {
"abi-coder": "^4.1.1",
"axios": "^0.27.2",

@@ -7,0 +8,0 @@ "form-data": "^4.0.0"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc