Socket
Socket
Sign inDemoInstall

@reservoir0x/reservoir-sdk

Package Overview
Dependencies
Maintainers
8
Versions
176
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reservoir0x/reservoir-sdk - npm Package Compare versions

Comparing version 0.5.1 to 0.6.0

82

dist/index.js

@@ -90,3 +90,3 @@ var $lPQI4$etherslibutils = require("ethers/lib/utils");

var $134f7602d1733f79$exports = {};
$134f7602d1733f79$exports = JSON.parse('{"name":"@reservoir0x/reservoir-sdk","version":"0.5.1","description":"An SDK that can be used in any javascript/typescript context to easily interact with Reservoir liquidity APIs","source":"src/index.ts","main":"dist/index.js","module":"dist/index.module.js","types":"dist/index.d.ts","author":"Reservoir Protocol","license":"MIT","files":["dist"],"scripts":{"clean":"rm -rf dist","version":"yarn version","version:package":"sh ../../scripts/package-version.sh","version:update":"yarn version ${0}; PACKAGE_VERSION=$(yarn version:package); git add -A; git commit -m \\"\uD83C\uDF89 Release client package v$PACKAGE_VERSION\\"; git push","syncApi":"node ./sync-api.mjs","changelog":"node ../../scripts/generate-changelog.js package=sdk"},"repository":{"type":"git","url":"https://github.com/reservoirprotocol/reservoir-kit"},"sideEffects":false,"keywords":["nft","reservoir","reservoir-sdk","reservoirkit","protocol","sdk"],"peerDependencies":{"ethers":"^5.6.1"},"dependencies":{"axios":"^0.27.2"},"publishConfig":{"access":"public"},"devDependencies":{"openapi-typescript":"^5.4.1"}}');
$134f7602d1733f79$exports = JSON.parse('{"name":"@reservoir0x/reservoir-sdk","version":"0.6.0","description":"An SDK that can be used in any javascript/typescript context to easily interact with Reservoir liquidity APIs","source":"src/index.ts","main":"dist/index.js","module":"dist/index.module.js","types":"dist/index.d.ts","author":"Reservoir Protocol","license":"MIT","files":["dist"],"scripts":{"clean":"rm -rf dist","version":"yarn version","version:package":"sh ../../scripts/package-version.sh","version:update":"yarn version ${0}; PACKAGE_VERSION=$(yarn version:package); git add -A; git commit -m \\"\uD83C\uDF89 Release client package v$PACKAGE_VERSION\\"; git push","syncApi":"node ./sync-api.mjs","changelog":"node ../../scripts/generate-changelog.js package=sdk"},"repository":{"type":"git","url":"https://github.com/reservoirprotocol/reservoir-kit"},"sideEffects":false,"keywords":["nft","reservoir","reservoir-sdk","reservoirkit","protocol","sdk"],"peerDependencies":{"ethers":"^5.6.1"},"dependencies":{"axios":"^0.27.2"},"publishConfig":{"access":"public"},"devDependencies":{"openapi-typescript":"^5.4.1"}}');

@@ -350,8 +350,8 @@

async function $6aa510e6f7e872cf$export$ed27da83bcbea2e5(data) {
async function $6aa510e6f7e872cf$export$ed27da83bcbea2e5(data1) {
var _a;
const { token: token , expectedPrice: expectedPrice , signer: signer , onProgress: onProgress } = data;
const { items: items , expectedPrice: expectedPrice , signer: signer , onProgress: onProgress } = data1;
const taker = await signer.getAddress();
const client = (0, $3ba04d43fdd1e5a5$export$6bb76d6eba7e258c)();
const options = data.options || {};
const options = data1.options || {};
const baseApiUrl = (_a = client.currentChain()) === null || _a === void 0 ? void 0 : _a.baseApiUrl;

@@ -361,4 +361,4 @@ if (!client.currentChain()) throw new ReferenceError("ReservoirClient missing chain configuration");

const params = {
items: items,
taker: taker,
token: `${token.contract}:${token.tokenId}`,
source: client.source || "",

@@ -369,3 +369,3 @@ ...options

await (0, $350ec40f38382016$export$21ece85d7636deb)({
url: `${baseApiUrl}/execute/sell/v6`,
url: `${baseApiUrl}/execute/sell/v7`,
method: "post",

@@ -376,9 +376,11 @@ data: params

} catch (err) {
const data = {
token: `${token.contract}:${token.tokenId}`
};
(0, $b3114c59012a233a$export$b5fe3f66a567bec0)({
method: "POST",
url: `${baseApiUrl}/tokens/refresh/v1`,
data: JSON.stringify(data)
items.forEach(({ token: token })=>{
const data = {
token: token
};
(0, $b3114c59012a233a$export$b5fe3f66a567bec0)({
method: "POST",
url: `${baseApiUrl}/tokens/refresh/v1`,
data: JSON.stringify(data)
}).catch(()=>{});
});

@@ -394,3 +396,3 @@ throw err;

var _a;
const { tokens: tokens , orderIds: orderIds , rawOrders: rawOrders , expectedPrice: expectedPrice , signer: signer , onProgress: onProgress } = data1;
const { items: items , expectedPrice: expectedPrice , signer: signer , onProgress: onProgress } = data1;
const taker = await signer.getAddress();

@@ -401,36 +403,27 @@ const client = (0, $3ba04d43fdd1e5a5$export$6bb76d6eba7e258c)();

if (!baseApiUrl) throw new ReferenceError("ReservoirClient missing chain configuration");
if ((!tokens || !tokens.length) && (!data1.orderIds || !data1.orderIds.length) && !data1.rawOrders) {
console.debug(data1);
throw new ReferenceError("ReservoirClient missing data: At least one of the following is required, tokens, orderIds or rawOrders");
}
if (tokens && (orderIds || rawOrders) || orderIds && (tokens || rawOrders) || rawOrders && (orderIds || tokens)) {
console.debug(data1);
throw new ReferenceError("ReservoirClient conflicting data: tokens, orderIds and rawOrders are mutually exclusive");
}
try {
const params = {
items: items,
taker: taker,
source: client.source || "",
source: client.source || undefined,
...options
};
if (tokens) params.tokens = tokens === null || tokens === void 0 ? void 0 : tokens.map((token)=>`${token.contract}:${token.tokenId}`);
else if (orderIds) params.orderIds = orderIds;
else if (rawOrders) params.rawOrders = rawOrders;
if (client.normalizeRoyalties !== undefined && params.normalizeRoyalties === undefined) params.normalizeRoyalties = client.normalizeRoyalties;
await (0, $350ec40f38382016$export$21ece85d7636deb)({
url: `${baseApiUrl}/execute/buy/v6`,
return (0, $350ec40f38382016$export$21ece85d7636deb)({
url: `${baseApiUrl}/execute/buy/v7`,
method: "post",
data: params
}, signer, onProgress, undefined, expectedPrice);
return true;
} catch (err) {
if (tokens) tokens.forEach((token)=>{
const data = {
token: `${token.contract}:${token.tokenId}`
};
(0, $b3114c59012a233a$export$b5fe3f66a567bec0)({
method: "POST",
url: `${baseApiUrl}/tokens/refresh/v1`,
data: JSON.stringify(data)
});
items.forEach(({ token: token })=>{
if (token) {
const data = {
token: token
};
(0, $b3114c59012a233a$export$b5fe3f66a567bec0)({
method: "POST",
url: `${baseApiUrl}/tokens/refresh/v1`,
data: JSON.stringify(data)
}).catch(()=>{});
}
});

@@ -482,3 +475,3 @@ throw err;

maker: maker,
source: client.source || ""
source: client.source || undefined
};

@@ -529,3 +522,3 @@ listings.forEach((listing)=>{

maker: maker,
source: client.source || ""
source: client.source || undefined
};

@@ -582,10 +575,3 @@ bids.forEach((bid)=>{

this.normalizeRoyalties = options.normalizeRoyalties;
if (!options.source) {
if (typeof window !== "undefined") {
let host = location.hostname;
if (host.indexOf("www.") === 0) host = host.replace("www.", "");
this.source = host;
console.warn("ReservoirKit automatically generated a source based on the url, we recommend providing a source when initializing ReservoirKit. Refer to our docs for steps on how to do this: http://docs.reservoir.tools");
}
} else this.source = options.source;
this.source = options.source;
}

@@ -592,0 +578,0 @@ configure(options) {

@@ -87,3 +87,3 @@ import {arrayify as $9C8uf$arrayify} from "ethers/lib/utils";

var $d3dd819ecb91ce83$exports = {};
$d3dd819ecb91ce83$exports = JSON.parse('{"name":"@reservoir0x/reservoir-sdk","version":"0.5.1","description":"An SDK that can be used in any javascript/typescript context to easily interact with Reservoir liquidity APIs","source":"src/index.ts","main":"dist/index.js","module":"dist/index.module.js","types":"dist/index.d.ts","author":"Reservoir Protocol","license":"MIT","files":["dist"],"scripts":{"clean":"rm -rf dist","version":"yarn version","version:package":"sh ../../scripts/package-version.sh","version:update":"yarn version ${0}; PACKAGE_VERSION=$(yarn version:package); git add -A; git commit -m \\"\uD83C\uDF89 Release client package v$PACKAGE_VERSION\\"; git push","syncApi":"node ./sync-api.mjs","changelog":"node ../../scripts/generate-changelog.js package=sdk"},"repository":{"type":"git","url":"https://github.com/reservoirprotocol/reservoir-kit"},"sideEffects":false,"keywords":["nft","reservoir","reservoir-sdk","reservoirkit","protocol","sdk"],"peerDependencies":{"ethers":"^5.6.1"},"dependencies":{"axios":"^0.27.2"},"publishConfig":{"access":"public"},"devDependencies":{"openapi-typescript":"^5.4.1"}}');
$d3dd819ecb91ce83$exports = JSON.parse('{"name":"@reservoir0x/reservoir-sdk","version":"0.6.0","description":"An SDK that can be used in any javascript/typescript context to easily interact with Reservoir liquidity APIs","source":"src/index.ts","main":"dist/index.js","module":"dist/index.module.js","types":"dist/index.d.ts","author":"Reservoir Protocol","license":"MIT","files":["dist"],"scripts":{"clean":"rm -rf dist","version":"yarn version","version:package":"sh ../../scripts/package-version.sh","version:update":"yarn version ${0}; PACKAGE_VERSION=$(yarn version:package); git add -A; git commit -m \\"\uD83C\uDF89 Release client package v$PACKAGE_VERSION\\"; git push","syncApi":"node ./sync-api.mjs","changelog":"node ../../scripts/generate-changelog.js package=sdk"},"repository":{"type":"git","url":"https://github.com/reservoirprotocol/reservoir-kit"},"sideEffects":false,"keywords":["nft","reservoir","reservoir-sdk","reservoirkit","protocol","sdk"],"peerDependencies":{"ethers":"^5.6.1"},"dependencies":{"axios":"^0.27.2"},"publishConfig":{"access":"public"},"devDependencies":{"openapi-typescript":"^5.4.1"}}');

@@ -347,8 +347,8 @@

async function $824b3a5b2fb74e30$export$ed27da83bcbea2e5(data) {
async function $824b3a5b2fb74e30$export$ed27da83bcbea2e5(data1) {
var _a;
const { token: token , expectedPrice: expectedPrice , signer: signer , onProgress: onProgress } = data;
const { items: items , expectedPrice: expectedPrice , signer: signer , onProgress: onProgress } = data1;
const taker = await signer.getAddress();
const client = (0, $6496f8ee40d0c4eb$export$6bb76d6eba7e258c)();
const options = data.options || {};
const options = data1.options || {};
const baseApiUrl = (_a = client.currentChain()) === null || _a === void 0 ? void 0 : _a.baseApiUrl;

@@ -358,4 +358,4 @@ if (!client.currentChain()) throw new ReferenceError("ReservoirClient missing chain configuration");

const params = {
items: items,
taker: taker,
token: `${token.contract}:${token.tokenId}`,
source: client.source || "",

@@ -366,3 +366,3 @@ ...options

await (0, $13b5a8bc45044506$export$21ece85d7636deb)({
url: `${baseApiUrl}/execute/sell/v6`,
url: `${baseApiUrl}/execute/sell/v7`,
method: "post",

@@ -373,9 +373,11 @@ data: params

} catch (err) {
const data = {
token: `${token.contract}:${token.tokenId}`
};
(0, $ce40c15ff138f6b7$export$b5fe3f66a567bec0)({
method: "POST",
url: `${baseApiUrl}/tokens/refresh/v1`,
data: JSON.stringify(data)
items.forEach(({ token: token })=>{
const data = {
token: token
};
(0, $ce40c15ff138f6b7$export$b5fe3f66a567bec0)({
method: "POST",
url: `${baseApiUrl}/tokens/refresh/v1`,
data: JSON.stringify(data)
}).catch(()=>{});
});

@@ -391,3 +393,3 @@ throw err;

var _a;
const { tokens: tokens , orderIds: orderIds , rawOrders: rawOrders , expectedPrice: expectedPrice , signer: signer , onProgress: onProgress } = data1;
const { items: items , expectedPrice: expectedPrice , signer: signer , onProgress: onProgress } = data1;
const taker = await signer.getAddress();

@@ -398,36 +400,27 @@ const client = (0, $6496f8ee40d0c4eb$export$6bb76d6eba7e258c)();

if (!baseApiUrl) throw new ReferenceError("ReservoirClient missing chain configuration");
if ((!tokens || !tokens.length) && (!data1.orderIds || !data1.orderIds.length) && !data1.rawOrders) {
console.debug(data1);
throw new ReferenceError("ReservoirClient missing data: At least one of the following is required, tokens, orderIds or rawOrders");
}
if (tokens && (orderIds || rawOrders) || orderIds && (tokens || rawOrders) || rawOrders && (orderIds || tokens)) {
console.debug(data1);
throw new ReferenceError("ReservoirClient conflicting data: tokens, orderIds and rawOrders are mutually exclusive");
}
try {
const params = {
items: items,
taker: taker,
source: client.source || "",
source: client.source || undefined,
...options
};
if (tokens) params.tokens = tokens === null || tokens === void 0 ? void 0 : tokens.map((token)=>`${token.contract}:${token.tokenId}`);
else if (orderIds) params.orderIds = orderIds;
else if (rawOrders) params.rawOrders = rawOrders;
if (client.normalizeRoyalties !== undefined && params.normalizeRoyalties === undefined) params.normalizeRoyalties = client.normalizeRoyalties;
await (0, $13b5a8bc45044506$export$21ece85d7636deb)({
url: `${baseApiUrl}/execute/buy/v6`,
return (0, $13b5a8bc45044506$export$21ece85d7636deb)({
url: `${baseApiUrl}/execute/buy/v7`,
method: "post",
data: params
}, signer, onProgress, undefined, expectedPrice);
return true;
} catch (err) {
if (tokens) tokens.forEach((token)=>{
const data = {
token: `${token.contract}:${token.tokenId}`
};
(0, $ce40c15ff138f6b7$export$b5fe3f66a567bec0)({
method: "POST",
url: `${baseApiUrl}/tokens/refresh/v1`,
data: JSON.stringify(data)
});
items.forEach(({ token: token })=>{
if (token) {
const data = {
token: token
};
(0, $ce40c15ff138f6b7$export$b5fe3f66a567bec0)({
method: "POST",
url: `${baseApiUrl}/tokens/refresh/v1`,
data: JSON.stringify(data)
}).catch(()=>{});
}
});

@@ -479,3 +472,3 @@ throw err;

maker: maker,
source: client.source || ""
source: client.source || undefined
};

@@ -526,3 +519,3 @@ listings.forEach((listing)=>{

maker: maker,
source: client.source || ""
source: client.source || undefined
};

@@ -579,10 +572,3 @@ bids.forEach((bid)=>{

this.normalizeRoyalties = options.normalizeRoyalties;
if (!options.source) {
if (typeof window !== "undefined") {
let host = location.hostname;
if (host.indexOf("www.") === 0) host = host.replace("www.", "");
this.source = host;
console.warn("ReservoirKit automatically generated a source based on the url, we recommend providing a source when initializing ReservoirKit. Refer to our docs for steps on how to do this: http://docs.reservoir.tools");
}
} else this.source = options.source;
this.source = options.source;
}

@@ -589,0 +575,0 @@ configure(options) {

{
"name": "@reservoir0x/reservoir-sdk",
"version": "0.5.1",
"version": "0.6.0",
"description": "An SDK that can be used in any javascript/typescript context to easily interact with Reservoir liquidity APIs",

@@ -5,0 +5,0 @@ "source": "src/index.ts",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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