@zoralabs/nft-hooks
Advanced tools
Comparing version 1.0.21 to 1.0.22
@@ -8,2 +8,3 @@ "use strict"; | ||
const FetchWithTimeout_1 = require("../../fetcher/FetchWithTimeout"); | ||
const NFTInterface_1 = require("../../types/NFTInterface"); | ||
const address_1 = require("@ethersproject/address"); | ||
@@ -76,3 +77,3 @@ const shared_1 = require("../../constants/shared"); | ||
: undefined, | ||
source: "derived" /* DERIVED */, | ||
source: NFTInterface_1.MEDIA_SOURCES.DERIVED, | ||
}; | ||
@@ -92,3 +93,3 @@ object.media = { | ||
: undefined, | ||
source: "derived" /* DERIVED */, | ||
source: NFTInterface_1.MEDIA_SOURCES.DERIVED, | ||
}; | ||
@@ -95,0 +96,0 @@ object.rawData['EtherActor'] = asset; |
@@ -8,2 +8,3 @@ "use strict"; | ||
const FetchWithTimeout_1 = require("../../fetcher/FetchWithTimeout"); | ||
const NFTInterface_1 = require("../../types/NFTInterface"); | ||
const shared_1 = require("../../constants/shared"); | ||
@@ -91,3 +92,3 @@ const address_1 = require("@ethersproject/address"); | ||
: undefined, | ||
source: "opensea" /* OPENSEA */, | ||
source: NFTInterface_1.MEDIA_SOURCES.OPENSEA, | ||
}; | ||
@@ -94,0 +95,0 @@ if (!object.rawData) { |
@@ -56,6 +56,6 @@ "use strict"; | ||
to: tokenEvent.properties.toAddress, | ||
type: "mint" /* MINT */, | ||
eventType: "TokenTransferEvent" /* TOKEN_TRANSFER_EVENT */, | ||
type: types_1.TOKEN_TRANSFER_EVENT_TYPES.MINT, | ||
eventType: types_1.TOKEN_TRANSFER_EVENT_CONTEXT_TYPES.TOKEN_TRANSFER_EVENT, | ||
raw: { | ||
source: "zora" /* ZORA */, | ||
source: types_1.MEDIA_SOURCES.ZORA, | ||
data: tokenEvent, | ||
@@ -71,8 +71,8 @@ }, | ||
to: tokenEvent.properties.toAddress, | ||
eventType: "TokenTransferEvent" /* TOKEN_TRANSFER_EVENT */, | ||
eventType: types_1.TOKEN_TRANSFER_EVENT_CONTEXT_TYPES.TOKEN_TRANSFER_EVENT, | ||
type: tokenEvent.properties.toAddress === addresses_1.ZERO_ADDRESS | ||
? "burn" /* BURN */ | ||
: "transfer" /* TRANSFER */, | ||
? types_1.TOKEN_TRANSFER_EVENT_TYPES.BURN | ||
: types_1.TOKEN_TRANSFER_EVENT_TYPES.TRANSFER, | ||
raw: { | ||
source: "zora" /* ZORA */, | ||
source: types_1.MEDIA_SOURCES.ZORA, | ||
data: tokenEvent, | ||
@@ -110,6 +110,6 @@ }, | ||
event, | ||
eventType: "TokenMarketEvent" /* TOKEN_MARKET_EVENT */, | ||
side: "ask" /* ASK */, | ||
eventType: types_1.TOKEN_TRANSFER_EVENT_CONTEXT_TYPES.TOKEN_MARKET_EVENT, | ||
side: types_1.FIXED_SIDE_TYPES.ASK, | ||
raw: { | ||
source: "ZoraAskV1" /* ZORA_ASK_V1 */, | ||
source: types_1.FIXED_PRICE_MARKET_SOURCES.ZORA_ASK_V1, | ||
data: tokenEvent, | ||
@@ -154,3 +154,3 @@ }, | ||
marketAddress: tokenEvent.properties.collectionAddress, | ||
eventType: "TokenMarketEvent" /* TOKEN_MARKET_EVENT */, | ||
eventType: types_1.TOKEN_TRANSFER_EVENT_CONTEXT_TYPES.TOKEN_MARKET_EVENT, | ||
blockInfo: { | ||
@@ -161,3 +161,3 @@ timestamp: tokenEvent.transactionInfo.blockTimestamp, | ||
raw: { | ||
source: "ZoraReserveV2" /* ZORA_RESERVE_V2 */, | ||
source: types_1.AUCTION_SOURCE_TYPES.ZORA_RESERVE_V2, | ||
raw: tokenEvent, | ||
@@ -193,6 +193,6 @@ }, | ||
event, | ||
eventType: "TokenMarketEvent" /* TOKEN_MARKET_EVENT */, | ||
side: "ask" /* ASK */, | ||
eventType: types_1.TOKEN_TRANSFER_EVENT_CONTEXT_TYPES.TOKEN_MARKET_EVENT, | ||
side: types_1.FIXED_SIDE_TYPES.ASK, | ||
raw: { | ||
source: "ZoraAskV3" /* ZORA_ASK_V3 */, | ||
source: types_1.FIXED_PRICE_MARKET_SOURCES.ZORA_ASK_V3, | ||
data: tokenEvent, | ||
@@ -240,35 +240,35 @@ }, | ||
if (status === queries_sdk_1.V2AuctionStatus.Active) { | ||
return "active" /* ACTIVE */; | ||
return types_1.MARKET_INFO_STATUSES.ACTIVE; | ||
} | ||
if (status === queries_sdk_1.V2AuctionStatus.Canceled) { | ||
return "canceled" /* CANCELED */; | ||
return types_1.MARKET_INFO_STATUSES.CANCELED; | ||
} | ||
if (status === queries_sdk_1.V2AuctionStatus.Completed) { | ||
return "complete" /* COMPLETE */; | ||
return types_1.MARKET_INFO_STATUSES.COMPLETE; | ||
} | ||
return "unknown" /* UNKNOWN */; | ||
return types_1.MARKET_INFO_STATUSES.UNKNOWN; | ||
}; | ||
const getV1MarketFixedPriceStatus = (status) => { | ||
if (status === queries_sdk_1.V1MarketEntityStatus.Active) { | ||
return "active" /* ACTIVE */; | ||
return types_1.MARKET_INFO_STATUSES.ACTIVE; | ||
} | ||
if (status === queries_sdk_1.V1MarketEntityStatus.Canceled) { | ||
return "canceled" /* CANCELED */; | ||
return types_1.MARKET_INFO_STATUSES.CANCELED; | ||
} | ||
if (status === queries_sdk_1.V1MarketEntityStatus.Completed) { | ||
return "complete" /* COMPLETE */; | ||
return types_1.MARKET_INFO_STATUSES.COMPLETE; | ||
} | ||
return "unknown" /* UNKNOWN */; | ||
return types_1.MARKET_INFO_STATUSES.UNKNOWN; | ||
}; | ||
const getV3AskStatus = (status) => { | ||
if (status === queries_sdk_1.V3AskStatus.Active) { | ||
return "active" /* ACTIVE */; | ||
return types_1.MARKET_INFO_STATUSES.ACTIVE; | ||
} | ||
if (status === queries_sdk_1.V3AskStatus.Canceled) { | ||
return "canceled" /* CANCELED */; | ||
return types_1.MARKET_INFO_STATUSES.CANCELED; | ||
} | ||
if (status === queries_sdk_1.V3AskStatus.Completed) { | ||
return "complete" /* COMPLETE */; | ||
return types_1.MARKET_INFO_STATUSES.COMPLETE; | ||
} | ||
return "unknown" /* UNKNOWN */; | ||
return types_1.MARKET_INFO_STATUSES.UNKNOWN; | ||
}; | ||
@@ -281,5 +281,5 @@ const marketResponse = []; | ||
marketResponse.push({ | ||
type: "FixedPrice" /* FIXED_PRICE */, | ||
source: "ZoraAskV1" /* ZORA_ASK_V1 */, | ||
side: "ask" /* ASK */, | ||
type: types_1.MARKET_TYPES.FIXED_PRICE, | ||
source: types_1.FIXED_PRICE_MARKET_SOURCES.ZORA_ASK_V1, | ||
side: types_1.FIXED_SIDE_TYPES.ASK, | ||
// TODO(iain): fix naming | ||
@@ -293,5 +293,5 @@ status: getV1MarketFixedPriceStatus(market.properties.offerStatus), | ||
marketResponse.push({ | ||
type: "FixedPrice" /* FIXED_PRICE */, | ||
source: "ZoraAskV1" /* ZORA_ASK_V1 */, | ||
side: "offer" /* OFFER */, | ||
type: types_1.MARKET_TYPES.FIXED_PRICE, | ||
source: types_1.FIXED_PRICE_MARKET_SOURCES.ZORA_ASK_V1, | ||
side: types_1.FIXED_SIDE_TYPES.OFFER, | ||
status: getV1MarketFixedPriceStatus(market.properties.offerStatus), | ||
@@ -307,4 +307,4 @@ ...getStandardMarketData(market, market.properties.amount), | ||
marketResponse.push({ | ||
type: "Auction" /* AUCTION */, | ||
source: "ZoraReserveV2" /* ZORA_RESERVE_V2 */, | ||
type: types_1.MARKET_TYPES.AUCTION, | ||
source: types_1.AUCTION_SOURCE_TYPES.ZORA_RESERVE_V2, | ||
status: getReserveAuctionStatus(market.properties.auctionStatus), | ||
@@ -364,5 +364,5 @@ // Duration shouldn't be able to overflow | ||
marketResponse.push({ | ||
type: "FixedPrice" /* FIXED_PRICE */, | ||
source: "ZoraAskV3" /* ZORA_ASK_V3 */, | ||
side: "ask" /* ASK */, | ||
type: types_1.MARKET_TYPES.FIXED_PRICE, | ||
source: types_1.FIXED_PRICE_MARKET_SOURCES.ZORA_ASK_V3, | ||
side: types_1.FIXED_SIDE_TYPES.ASK, | ||
status: getV3AskStatus(market.properties.askStatus), | ||
@@ -446,3 +446,3 @@ ...getStandardMarketData(market, market.properties.askPrice), | ||
: undefined, | ||
source: "zora" /* ZORA */, | ||
source: types_1.MEDIA_SOURCES.ZORA, | ||
}; | ||
@@ -449,0 +449,0 @@ if (!object.rawData) { |
@@ -10,2 +10,3 @@ "use strict"; | ||
const FetchWithTimeout_1 = require("../../fetcher/FetchWithTimeout"); | ||
const NFTInterface_1 = require("../../types/NFTInterface"); | ||
const big_js_1 = tslib_1.__importDefault(require("big.js")); | ||
@@ -95,3 +96,3 @@ const zora_graph_1 = require("./zora-graph"); | ||
if (!response.approved) { | ||
return "pending" /* PENDING */; | ||
return NFTInterface_1.MARKET_INFO_STATUSES.PENDING; | ||
} | ||
@@ -101,3 +102,3 @@ if (response.finalizedAtTimestamp && | ||
!response.currentBid) { | ||
return "canceled" /* CANCELED */; | ||
return NFTInterface_1.MARKET_INFO_STATUSES.CANCELED; | ||
} | ||
@@ -108,15 +109,15 @@ if (!response.approved || | ||
!response.currentBid)) { | ||
return "pending" /* PENDING */; | ||
return NFTInterface_1.MARKET_INFO_STATUSES.PENDING; | ||
} | ||
if (response.finalizedAtTimestamp) { | ||
return "complete" /* COMPLETE */; | ||
return NFTInterface_1.MARKET_INFO_STATUSES.COMPLETE; | ||
} | ||
if (response.expectedEndTimestamp && | ||
response.expectedEndTimestamp <= unixTimeNow()) { | ||
return "complete" /* COMPLETE */; | ||
return NFTInterface_1.MARKET_INFO_STATUSES.COMPLETE; | ||
} | ||
if (response.firstBidTime) { | ||
return "active" /* ACTIVE */; | ||
return NFTInterface_1.MARKET_INFO_STATUSES.ACTIVE; | ||
} | ||
return "unknown" /* UNKNOWN */; | ||
return NFTInterface_1.MARKET_INFO_STATUSES.UNKNOWN; | ||
}; | ||
@@ -190,3 +191,3 @@ function addCurrencyInfo(amount) { | ||
raw: response, | ||
type: "Auction" /* AUCTION */, | ||
type: NFTInterface_1.MARKET_TYPES.AUCTION, | ||
createdBy: response.curator.id, | ||
@@ -212,3 +213,3 @@ createdAt: { | ||
currentBid: getHighestBid(), | ||
source: "ZoraReserveV2" /* ZORA_RESERVE_V2 */, | ||
source: NFTInterface_1.AUCTION_SOURCE_TYPES.ZORA_RESERVE_V2, | ||
bids: [...(((_b = response.previousBids) === null || _b === void 0 ? void 0 : _b.map(formatBid)) || [])], | ||
@@ -215,0 +216,0 @@ }; |
@@ -12,2 +12,3 @@ "use strict"; | ||
const zora_graph_types_1 = require("./zora-graph-types"); | ||
const NFTInterface_1 = require("../../types/NFTInterface"); | ||
const GraphAuctionDataSource_1 = require("./GraphAuctionDataSource"); | ||
@@ -30,3 +31,3 @@ const GenericMediaData_1 = require("../generic-media/GenericMediaData"); | ||
symbol: 'ZORA', | ||
knownContract: "zora" /* ZORA */, | ||
knownContract: NFTInterface_1.KNOWN_CONTRACTS.ZORA, | ||
}, | ||
@@ -48,3 +49,3 @@ owner: { | ||
content: { uri: asset.contentURI, mime: metadata.mimeType }, | ||
source: "derived" /* DERIVED */, | ||
source: NFTInterface_1.MEDIA_SOURCES.DERIVED, | ||
}; | ||
@@ -51,0 +52,0 @@ object.metadata = metadata; |
@@ -77,11 +77,11 @@ "use strict"; | ||
if (status === 'ACTIVE') { | ||
return "active" /* ACTIVE */; | ||
return NFTInterface_1.MARKET_INFO_STATUSES.ACTIVE; | ||
} | ||
if (status === 'FILLED') { | ||
return "complete" /* COMPLETE */; | ||
return NFTInterface_1.MARKET_INFO_STATUSES.COMPLETE; | ||
} | ||
if (status === 'CANCELLED') { | ||
return "canceled" /* CANCELED */; | ||
return NFTInterface_1.MARKET_INFO_STATUSES.CANCELED; | ||
} | ||
return "unknown" /* UNKNOWN */; | ||
return NFTInterface_1.MARKET_INFO_STATUSES.UNKNOWN; | ||
}; | ||
@@ -104,4 +104,4 @@ function extractAsk(ask) { | ||
}, | ||
side: "ask" /* ASK */, | ||
type: "FixedPrice" /* FIXED_PRICE */, | ||
side: NFTInterface_1.FIXED_SIDE_TYPES.ASK, | ||
type: NFTInterface_1.MARKET_TYPES.FIXED_PRICE, | ||
canceledAt: undefined, | ||
@@ -122,3 +122,3 @@ createdAt: { | ||
// : undefined, | ||
source: "ZoraAskV3" /* ZORA_ASK_V3 */, | ||
source: NFTInterface_1.FIXED_PRICE_MARKET_SOURCES.ZORA_ASK_V3, | ||
raw: ask, | ||
@@ -144,6 +144,6 @@ }; | ||
event: status, | ||
eventType: "TokenMarketEvent" /* TOKEN_MARKET_EVENT */, | ||
side: "ask" /* ASK */, | ||
eventType: NFTInterface_1.TOKEN_TRANSFER_EVENT_CONTEXT_TYPES.TOKEN_MARKET_EVENT, | ||
side: NFTInterface_1.FIXED_SIDE_TYPES.ASK, | ||
raw: { | ||
source: "ZoraAskV3" /* ZORA_ASK_V3 */, | ||
source: NFTInterface_1.FIXED_PRICE_MARKET_SOURCES.ZORA_ASK_V3, | ||
data: askEvent, | ||
@@ -158,17 +158,17 @@ }, | ||
if (auction.canceledEvent) { | ||
return "canceled" /* CANCELED */; | ||
return NFTInterface_1.MARKET_INFO_STATUSES.CANCELED; | ||
} | ||
if (!auction.approved || (auction.approved && !auction.firstBidTime)) { | ||
return "pending" /* PENDING */; | ||
return NFTInterface_1.MARKET_INFO_STATUSES.PENDING; | ||
} | ||
if (auction.endedEvent) { | ||
return "complete" /* COMPLETE */; | ||
return NFTInterface_1.MARKET_INFO_STATUSES.COMPLETE; | ||
} | ||
if (auction.expiresAt && timeIsPast(auction.expiresAt)) { | ||
return "complete" /* COMPLETE */; | ||
return NFTInterface_1.MARKET_INFO_STATUSES.COMPLETE; | ||
} | ||
if (auction.firstBidTime) { | ||
return "active" /* ACTIVE */; | ||
return NFTInterface_1.MARKET_INFO_STATUSES.ACTIVE; | ||
} | ||
return "unknown" /* UNKNOWN */; | ||
return NFTInterface_1.MARKET_INFO_STATUSES.UNKNOWN; | ||
}; | ||
@@ -214,3 +214,3 @@ const addCurrencyInfo = (amount) => { | ||
createdBy: auction.tokenOwner || undefined, | ||
type: "Auction" /* AUCTION */, | ||
type: NFTInterface_1.MARKET_TYPES.AUCTION, | ||
finishedAt: auction.endedEvent | ||
@@ -243,3 +243,3 @@ ? { | ||
currentBid: highestBid ? formatBid(highestBid) : undefined, | ||
source: "ZoraReserveV2" /* ZORA_RESERVE_V2 */, | ||
source: NFTInterface_1.AUCTION_SOURCE_TYPES.ZORA_RESERVE_V2, | ||
bids: [...auction.bidEvents.map((bid) => formatBid(bid))], | ||
@@ -251,8 +251,8 @@ }; | ||
if (transferEvent.from === addresses_1.ZERO_ADDRESS) { | ||
return "mint" /* MINT */; | ||
return NFTInterface_1.TOKEN_TRANSFER_EVENT_TYPES.MINT; | ||
} | ||
if (transferEvent.to === addresses_1.ZERO_ADDRESS) { | ||
return "burn" /* BURN */; | ||
return NFTInterface_1.TOKEN_TRANSFER_EVENT_TYPES.BURN; | ||
} | ||
return "transfer" /* TRANSFER */; | ||
return NFTInterface_1.TOKEN_TRANSFER_EVENT_TYPES.TRANSFER; | ||
} | ||
@@ -265,3 +265,3 @@ function extractTransferEvents(transferEvents) { | ||
tokenId: transferEvent.tokenId, | ||
eventType: "TokenTransferEvent" /* TOKEN_TRANSFER_EVENT */, | ||
eventType: NFTInterface_1.TOKEN_TRANSFER_EVENT_CONTEXT_TYPES.TOKEN_TRANSFER_EVENT, | ||
at: { | ||
@@ -273,3 +273,3 @@ timestamp: dateToUnix(transferEvent.blockTimestamp), | ||
raw: { | ||
source: "zora" /* ZORA */, | ||
source: NFTInterface_1.MEDIA_SOURCES.ZORA, | ||
data: transferEvent, | ||
@@ -330,3 +330,3 @@ }, | ||
: undefined, | ||
source: "zora" /* ZORA */, | ||
source: NFTInterface_1.MEDIA_SOURCES.ZORA, | ||
}; | ||
@@ -333,0 +333,0 @@ if (!object.rawData) { |
import { EventInfoFragment } from '@zoralabs/zdk-alpha/dist/src/queries/queries-sdk'; | ||
import { NFTQuery } from '../types/NFTQuery'; | ||
export declare const enum KNOWN_CONTRACTS { | ||
export declare enum KNOWN_CONTRACTS { | ||
ZORA = "zora" | ||
} | ||
export declare const enum MARKET_TYPES { | ||
export declare enum MARKET_TYPES { | ||
AUCTION = "Auction", | ||
@@ -11,7 +11,7 @@ FIXED_PRICE = "FixedPrice", | ||
} | ||
export declare const enum EDITION_SOURCES { | ||
export declare enum EDITION_SOURCES { | ||
CUSTOM = "Custom", | ||
ZORA_EDITIONS = "ZoraEditions" | ||
} | ||
export declare const enum MARKET_INFO_STATUSES { | ||
export declare enum MARKET_INFO_STATUSES { | ||
PENDING = "pending", | ||
@@ -24,3 +24,3 @@ ACTIVE = "active", | ||
} | ||
export declare const enum MEDIA_SOURCES { | ||
export declare enum MEDIA_SOURCES { | ||
OPENSEA = "opensea", | ||
@@ -31,3 +31,3 @@ ZORA = "zora", | ||
} | ||
export declare const enum TOKEN_TRANSFER_EVENT_TYPES { | ||
export declare enum TOKEN_TRANSFER_EVENT_TYPES { | ||
MINT = "mint", | ||
@@ -38,3 +38,3 @@ BURN = "burn", | ||
} | ||
export declare const enum FIXED_PRICE_MARKET_SOURCES { | ||
export declare enum FIXED_PRICE_MARKET_SOURCES { | ||
ZNFT_PERPETUAL = "ZNFTPerpetual", | ||
@@ -46,11 +46,11 @@ ZORA_ASK_V1 = "ZoraAskV1", | ||
} | ||
export declare const enum TOKEN_TRANSFER_EVENT_CONTEXT_TYPES { | ||
export declare enum TOKEN_TRANSFER_EVENT_CONTEXT_TYPES { | ||
TOKEN_TRANSFER_EVENT = "TokenTransferEvent", | ||
TOKEN_MARKET_EVENT = "TokenMarketEvent" | ||
} | ||
export declare const enum AUCTION_SOURCE_TYPES { | ||
export declare enum AUCTION_SOURCE_TYPES { | ||
ZORA_RESERVE_V2 = "ZoraReserveV2", | ||
OPENSEA_ENGLISH = "OpenseaEnglish" | ||
} | ||
export declare const enum FIXED_SIDE_TYPES { | ||
export declare enum FIXED_SIDE_TYPES { | ||
ASK = "ask", | ||
@@ -57,0 +57,0 @@ OFFER = "offer" |
{ | ||
"name": "@zoralabs/nft-hooks", | ||
"version": "1.0.21", | ||
"version": "1.0.22", | ||
"description": "Generic react hooks for fetching zora auctions, nfts, and data on arbitary 721s. Powers nft-components.", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/ourzora/nft-hooks", |
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
907077
20535