Socket
Socket
Sign inDemoInstall

@zoralabs/nft-hooks

Package Overview
Dependencies
Maintainers
25
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zoralabs/nft-hooks - npm Package Compare versions

Comparing version 1.1.10 to 1.2.0

9

dist/backends/zdk/transformUtils/transformEvents.js

@@ -9,2 +9,3 @@ "use strict";

const transformMarketEvent_1 = require("./transformMarketEvent");
const extractPrice_1 = require("../utils/extractPrice");
function transformEvents(events) {

@@ -61,4 +62,6 @@ const eventsList = [];

let event = undefined;
let amount = {};
switch (tokenEvent.properties.v2AuctionEventType) {
case queries_sdk_1.V2AuctionEventType.V2AuctionCreated:
amount = (0, extractPrice_1.extractPrice)(tokenEvent);
event = types_1.AUCTION_EVENT_TYPES.AUCTION_CREATED;

@@ -70,4 +73,9 @@ break;

case queries_sdk_1.V2AuctionEventType.V2AuctionBid:
amount = (0, extractPrice_1.extractPrice)(tokenEvent);
event = types_1.AUCTION_EVENT_TYPES.AUCTION_BID;
break;
case queries_sdk_1.V2AuctionEventType.V2AuctionReservePriceUpdated:
amount = (0, extractPrice_1.extractPrice)(tokenEvent);
event = types_1.AUCTION_EVENT_TYPES.AUCTION_UPDATED;
break;
case queries_sdk_1.V2AuctionEventType.V2AuctionApprovalUpdated:

@@ -92,2 +100,3 @@ event = types_1.AUCTION_EVENT_TYPES.AUCTION_APPROVED;

...common,
...amount,
event: event,

@@ -94,0 +103,0 @@ sender: tokenEvent.properties.address,

63

dist/backends/zdk/transformUtils/transformMarkets.js

@@ -47,3 +47,3 @@ "use strict";

markets.forEach((market) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
var _a, _b, _c, _d, _e, _f, _g;
if (market.marketType === queries_sdk_1.MarketType.V1Ask &&

@@ -55,8 +55,9 @@ ((_a = market === null || market === void 0 ? void 0 : market.properties) === null || _a === void 0 ? void 0 : _a.__typename) === 'V1Ask') {

side: types_1.FIXED_SIDE_TYPES.ASK,
// TODO(iain): fix naming
status: getV1MarketFixedPriceStatus((_b = market === null || market === void 0 ? void 0 : market.properties) === null || _b === void 0 ? void 0 : _b.v1AskStatus),
...(0, getStandardMarketData_1.getStandardMarketData)({ market, amount: (_c = market === null || market === void 0 ? void 0 : market.properties) === null || _c === void 0 ? void 0 : _c.amount }),
...(0, getStandardMarketData_1.getStandardMarketData)({ market, amount: market.properties.amount }),
});
}
if (market.marketType === queries_sdk_1.MarketType.V1Offer &&
((_d = market === null || market === void 0 ? void 0 : market.properties) === null || _d === void 0 ? void 0 : _d.__typename) === 'V1Offer') {
((_c = market === null || market === void 0 ? void 0 : market.properties) === null || _c === void 0 ? void 0 : _c.__typename) === 'V1Offer') {
marketResponse.push({

@@ -66,23 +67,23 @@ type: types_1.MARKET_TYPES.FIXED_PRICE,

side: types_1.FIXED_SIDE_TYPES.OFFER,
status: getV1MarketFixedPriceStatus((_e = market === null || market === void 0 ? void 0 : market.properties) === null || _e === void 0 ? void 0 : _e.v1OfferStatus),
...(0, getStandardMarketData_1.getStandardMarketData)({ market, amount: (_f = market === null || market === void 0 ? void 0 : market.properties) === null || _f === void 0 ? void 0 : _f.amount }),
status: getV1MarketFixedPriceStatus(market.properties.v1OfferStatus),
...(0, getStandardMarketData_1.getStandardMarketData)({ market, amount: market.properties.amount }),
});
}
if (market.marketType === queries_sdk_1.MarketType.V2Auction &&
((_g = market === null || market === void 0 ? void 0 : market.properties) === null || _g === void 0 ? void 0 : _g.__typename) === 'V2Auction') {
const expiresAt = (_h = market === null || market === void 0 ? void 0 : market.properties) === null || _h === void 0 ? void 0 : _h.estimatedExpirationTime;
((_d = market === null || market === void 0 ? void 0 : market.properties) === null || _d === void 0 ? void 0 : _d.__typename) === 'V2Auction') {
const expiresAt = market.properties.estimatedExpirationTime;
marketResponse.push({
type: types_1.MARKET_TYPES.AUCTION,
source: types_1.AUCTION_SOURCE_TYPES.ZORA_RESERVE_V2,
status: getReserveAuctionStatus((_j = market === null || market === void 0 ? void 0 : market.properties) === null || _j === void 0 ? void 0 : _j.v2AuctionStatus),
auctionId: (_k = market === null || market === void 0 ? void 0 : market.properties) === null || _k === void 0 ? void 0 : _k.auctionId,
status: getReserveAuctionStatus(market.properties.v2AuctionStatus),
auctionId: market.properties.auctionId,
// Duration shouldn't be able to overflow
duration: parseInt((_l = market === null || market === void 0 ? void 0 : market.properties) === null || _l === void 0 ? void 0 : _l.duration, 10),
startedAt: ((_m = market === null || market === void 0 ? void 0 : market.properties) === null || _m === void 0 ? void 0 : _m.firstBidTime)
duration: parseInt(market.properties.duration, 10),
startedAt: market.properties.firstBidTime
? {
timestamp: (_o = market === null || market === void 0 ? void 0 : market.properties) === null || _o === void 0 ? void 0 : _o.firstBidTime,
timestamp: market.properties.firstBidTime,
}
: undefined,
bids: [],
endsAt: ((_p = market === null || market === void 0 ? void 0 : market.properties) === null || _p === void 0 ? void 0 : _p.firstBidTime)
endsAt: market.properties.firstBidTime
? {

@@ -92,5 +93,5 @@ timestamp: (0, dateToISO_1.dateToISO)(expiresAt),

: undefined,
currentBid: ((_q = market === null || market === void 0 ? void 0 : market.properties) === null || _q === void 0 ? void 0 : _q.highestBidder) && ((_r = market === null || market === void 0 ? void 0 : market.properties) === null || _r === void 0 ? void 0 : _r.highestBidPrice)
currentBid: market.properties.highestBidder && market.properties.highestBidPrice
? {
creator: (_s = market === null || market === void 0 ? void 0 : market.properties) === null || _s === void 0 ? void 0 : _s.highestBidder,
creator: market.properties.highestBidder,
created: {

@@ -100,13 +101,13 @@ timestamp: (0, dateToISO_1.dateToISO)(market.transactionInfo.blockTimestamp),

amount: {
usd: ((_t = market === null || market === void 0 ? void 0 : market.properties) === null || _t === void 0 ? void 0 : _t.highestBidPrice.usdcPrice)
usd: market.properties.highestBidPrice.usdcPrice
? {
value: (_v = (_u = market === null || market === void 0 ? void 0 : market.properties) === null || _u === void 0 ? void 0 : _u.highestBidPrice.usdcPrice) === null || _v === void 0 ? void 0 : _v.decimal,
raw: (_x = (_w = market === null || market === void 0 ? void 0 : market.properties) === null || _w === void 0 ? void 0 : _w.highestBidPrice.usdcPrice) === null || _x === void 0 ? void 0 : _x.raw,
value: (_e = market.properties.highestBidPrice.usdcPrice) === null || _e === void 0 ? void 0 : _e.decimal,
raw: (_f = market.properties.highestBidPrice.usdcPrice) === null || _f === void 0 ? void 0 : _f.raw,
decimals: 18,
}
: undefined,
eth: ((_y = market === null || market === void 0 ? void 0 : market.properties) === null || _y === void 0 ? void 0 : _y.highestBidPrice.nativePrice)
eth: market.properties.highestBidPrice.nativePrice
? {
value: (_z = market === null || market === void 0 ? void 0 : market.properties) === null || _z === void 0 ? void 0 : _z.highestBidPrice.nativePrice.decimal,
raw: (_0 = market === null || market === void 0 ? void 0 : market.properties) === null || _0 === void 0 ? void 0 : _0.highestBidPrice.nativePrice.raw,
value: market.properties.highestBidPrice.nativePrice.decimal,
raw: market.properties.highestBidPrice.nativePrice.raw,
decimals: 18,

@@ -116,10 +117,10 @@ }

amount: {
raw: (_1 = market === null || market === void 0 ? void 0 : market.properties) === null || _1 === void 0 ? void 0 : _1.highestBidPrice.nativePrice.raw,
value: (_2 = market === null || market === void 0 ? void 0 : market.properties) === null || _2 === void 0 ? void 0 : _2.highestBidPrice.nativePrice.decimal,
decimals: ((_3 = market === null || market === void 0 ? void 0 : market.properties) === null || _3 === void 0 ? void 0 : _3.highestBidPrice.nativePrice.currency.decimals) ||
raw: market.properties.highestBidPrice.nativePrice.raw,
value: market.properties.highestBidPrice.nativePrice.decimal,
decimals: market.properties.highestBidPrice.nativePrice.currency.decimals ||
undefined,
},
symbol: (_4 = market === null || market === void 0 ? void 0 : market.properties) === null || _4 === void 0 ? void 0 : _4.highestBidPrice.nativePrice.currency.name,
name: (_5 = market === null || market === void 0 ? void 0 : market.properties) === null || _5 === void 0 ? void 0 : _5.highestBidPrice.nativePrice.currency.name,
address: (_6 = market === null || market === void 0 ? void 0 : market.properties) === null || _6 === void 0 ? void 0 : _6.highestBidPrice.nativePrice.currency.address,
symbol: market.properties.highestBidPrice.nativePrice.currency.name,
name: market.properties.highestBidPrice.nativePrice.currency.name,
address: market.properties.highestBidPrice.nativePrice.currency.address,
},

@@ -130,3 +131,3 @@ }

market,
amount: ((_7 = market === null || market === void 0 ? void 0 : market.properties) === null || _7 === void 0 ? void 0 : _7.highestBidPrice) || ((_8 = market === null || market === void 0 ? void 0 : market.properties) === null || _8 === void 0 ? void 0 : _8.reservePrice),
amount: market.properties.highestBidPrice || market.properties.reservePrice,
}),

@@ -136,3 +137,3 @@ });

if (market.marketType === queries_sdk_1.MarketType.V3Ask &&
((_9 = market === null || market === void 0 ? void 0 : market.properties) === null || _9 === void 0 ? void 0 : _9.__typename) === 'V3Ask') {
((_g = market === null || market === void 0 ? void 0 : market.properties) === null || _g === void 0 ? void 0 : _g.__typename) === 'V3Ask') {
marketResponse.push({

@@ -142,4 +143,4 @@ type: types_1.MARKET_TYPES.FIXED_PRICE,

side: types_1.FIXED_SIDE_TYPES.ASK,
status: getV3AskStatus((_10 = market === null || market === void 0 ? void 0 : market.properties) === null || _10 === void 0 ? void 0 : _10.v3AskStatus),
...(0, getStandardMarketData_1.getStandardMarketData)({ market, amount: (_11 = market === null || market === void 0 ? void 0 : market.properties) === null || _11 === void 0 ? void 0 : _11.askPrice }),
status: getV3AskStatus(market.properties.v3AskStatus),
...(0, getStandardMarketData_1.getStandardMarketData)({ market, amount: market.properties.askPrice }),
});

@@ -146,0 +147,0 @@ }

@@ -29,3 +29,3 @@ import { NetworkIDs, NFTObject } from '../..';

__typename?: "Market" | undefined;
collectionAddress?: string | null | undefined;
collectionAddress: string;
marketAddress: string;

@@ -71,9 +71,5 @@ marketType: ZDKMarketType;

};
properties?: {
__typename: "LilNounsAuction";
} | {
__typename: "NounsAuction";
} | {
properties: {
__typename: "V1Ask";
v1AskStatus: string;
v1AskStatus: import("@zoralabs/zdk/dist/queries/queries-sdk").V1MarketEntityStatus;
currency: string;

@@ -109,3 +105,3 @@ amount: {

__typename: "V1Offer";
v1OfferStatus: string;
v1OfferStatus: import("@zoralabs/zdk/dist/queries/queries-sdk").V1MarketEntityStatus;
sellOnShare: string;

@@ -150,3 +146,3 @@ bidder: string;

estimatedExpirationTime?: any;
v2AuctionStatus: string;
v2AuctionStatus: import("@zoralabs/zdk/dist/queries/queries-sdk").V2AuctionStatus;
tokenOwner: string;

@@ -210,5 +206,5 @@ address: string;

finder?: string | null | undefined;
findersFeeBps?: number | null | undefined;
sellerFundsRecipient?: string | null | undefined;
v3AskStatus: string;
findersFeeBps: number;
sellerFundsRecipient: string;
v3AskStatus: import("@zoralabs/zdk/dist/queries/queries-sdk").V3AskStatus;
seller: string;

@@ -243,5 +239,3 @@ address: string;

};
} | {
__typename: "V3ReserveAuction";
} | null | undefined;
};
}[];

@@ -409,3 +403,3 @@ token: {

eventType: import("@zoralabs/zdk/dist/queries/queries-sdk").EventType;
collectionAddress?: string | null | undefined;
collectionAddress: string;
tokenId?: string | null | undefined;

@@ -422,4 +416,2 @@ transactionInfo: {

} | {
__typename: "LilNounsAuctionEvent";
} | {
__typename: "MintEvent";

@@ -456,8 +448,4 @@ tokenId: string;

} | {
__typename: "NounsAuctionEvent";
} | {
__typename: "Sale";
} | {
__typename: "SeaportEvent";
} | {
__typename: "TransferEvent";

@@ -878,7 +866,3 @@ fromAddress: string;

};
} | {
__typename: "V3PrivateAskEventProperties";
};
} | {
__typename: "V3ReserveAuctionEvent";
};

@@ -885,0 +869,0 @@ }[];

@@ -58,3 +58,2 @@ "use strict";

object.markets = (0, transformMarkets_1.transformMarkets)(tokenResponse.markets);
object.events = (0, transformEvents_1.transformEvents)(tokenResponse.events);
}

@@ -65,2 +64,6 @@ // Response of tokens (plural) query

}
// Handle events
if (tokenResponse.events) {
object.events = (0, transformEvents_1.transformEvents)(tokenResponse.events);
}
object.metadata = {

@@ -67,0 +70,0 @@ name: token.name || undefined,

@@ -1,5 +0,5 @@

declare type NetworkNames = 'MAINNET' | 'RINKEBY' | 'POLYGON' | 'MUMBAI' | 'ROPSTEN';
declare type NetworkIDs = '1' | '3' | '4' | '137' | '80001';
declare type NetworkNames = 'MAINNET' | 'RINKEBY' | 'GOERLI' | 'POLYGON' | 'MUMBAI' | 'ROPSTEN';
declare type NetworkIDs = '1' | '3' | '4' | '5' | '137' | '80001';
declare const Networks: Record<NetworkNames, NetworkIDs>;
export { Networks };
export type { NetworkIDs };

@@ -10,2 +10,3 @@ "use strict";

RINKEBY: '4',
GOERLI: '5',
POLYGON: '137',

@@ -12,0 +13,0 @@ MUMBAI: '80001',

@@ -35,2 +35,7 @@ import { EventInfoFragment } from '@zoralabs/zdk/dist/queries/queries-sdk';

}
export declare enum TOKEN_EVENT_TYPES {
TRANSFER = "transfer",
AUCTION = "auction",
FIXED_PRICE = "fixed_price"
}
export declare enum FIXED_PRICE_MARKET_SOURCES {

@@ -154,7 +159,14 @@ ZNFT_PERPETUAL = "ZNFTPerpetual",

};
export declare type PriceType = {
symbol: string;
amount: number;
usdcPrice?: Pick<CurrencyAmount, 'decimals' | 'raw'>;
nativePrice?: Pick<CurrencyAmount, 'decimals' | 'raw'>;
};
export declare type MarketAuctionEvent = SharedMarketEventData & {
event: AUCTION_EVENT_TYPES;
at: TimedAction;
winner?: string;
price?: PriceType;
amount?: number;
winner?: string;
eventType: TOKEN_TRANSFER_EVENT_CONTEXT_TYPES.TOKEN_MARKET_EVENT;

@@ -176,8 +188,4 @@ raw: {

seller?: ETHAddress;
price?: {
symbol: string;
amount: number;
usdcPrice?: Pick<CurrencyAmount, 'decimals' | 'raw'>;
nativePrice?: Pick<CurrencyAmount, 'decimals' | 'raw'>;
};
amount?: number;
price?: PriceType;
raw: {

@@ -184,0 +192,0 @@ source: FIXED_PRICE_MARKET_SOURCES.ZORA_ASK_V3;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FIXED_PRICE_EVENT_TYPES = exports.AUCTION_EVENT_TYPES = exports.FIXED_SIDE_TYPES = exports.AUCTION_SOURCE_TYPES = exports.TOKEN_TRANSFER_EVENT_CONTEXT_TYPES = exports.FIXED_PRICE_MARKET_SOURCES = exports.TOKEN_TRANSFER_EVENT_TYPES = exports.MEDIA_SOURCES = exports.MARKET_INFO_STATUSES = exports.EDITION_SOURCES = exports.MARKET_TYPES = exports.KNOWN_CONTRACTS = void 0;
exports.FIXED_PRICE_EVENT_TYPES = exports.AUCTION_EVENT_TYPES = exports.FIXED_SIDE_TYPES = exports.AUCTION_SOURCE_TYPES = exports.TOKEN_TRANSFER_EVENT_CONTEXT_TYPES = exports.FIXED_PRICE_MARKET_SOURCES = exports.TOKEN_EVENT_TYPES = exports.TOKEN_TRANSFER_EVENT_TYPES = exports.MEDIA_SOURCES = exports.MARKET_INFO_STATUSES = exports.EDITION_SOURCES = exports.MARKET_TYPES = exports.KNOWN_CONTRACTS = void 0;
var KNOWN_CONTRACTS;

@@ -42,2 +42,9 @@ (function (KNOWN_CONTRACTS) {

})(TOKEN_TRANSFER_EVENT_TYPES = exports.TOKEN_TRANSFER_EVENT_TYPES || (exports.TOKEN_TRANSFER_EVENT_TYPES = {}));
var TOKEN_EVENT_TYPES;
(function (TOKEN_EVENT_TYPES) {
TOKEN_EVENT_TYPES["TRANSFER"] = "transfer";
TOKEN_EVENT_TYPES["AUCTION"] = "auction";
TOKEN_EVENT_TYPES["FIXED_PRICE"] = "fixed_price";
})(TOKEN_EVENT_TYPES = exports.TOKEN_EVENT_TYPES || (exports.TOKEN_EVENT_TYPES = {}));
;
var FIXED_PRICE_MARKET_SOURCES;

@@ -44,0 +51,0 @@ (function (FIXED_PRICE_MARKET_SOURCES) {

{
"name": "@zoralabs/nft-hooks",
"version": "1.1.10",
"version": "1.2.0",
"description": "Generic react hooks for fetching zora auctions, nfts, and data on arbitary 721s. Powers nft-components.",

@@ -71,3 +71,3 @@ "repository": "https://github.com/ourzora/nft-hooks",

"@types/deepmerge": "^2.2.0",
"@zoralabs/zdk": "2.1.9",
"@zoralabs/zdk": "2.1.6",
"big.js": "^6.1.0",

@@ -74,0 +74,0 @@ "cross-fetch": "^3.1.4",

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