@zoralabs/nft-hooks
Advanced tools
Comparing version 1.1.6 to 1.1.7
@@ -125,3 +125,3 @@ "use strict"; | ||
market, | ||
amount: market.properties.reservePrice || market.properties.highestBidPrice, | ||
amount: market.properties.highestBidPrice || market.properties.reservePrice, | ||
}), | ||
@@ -128,0 +128,0 @@ }); |
@@ -5,3 +5,4 @@ "use strict"; | ||
function dateToISO(date) { | ||
if (!date.endsWith('Z')) { | ||
// Force TZ from server to be GMT | ||
if (!date.endsWith('Z') && !date.includes('+')) { | ||
date += 'Z'; | ||
@@ -8,0 +9,0 @@ } |
@@ -11,6 +11,10 @@ import { NetworkIDs, NFTObject } from '../..'; | ||
export declare function transformNFTZDK(tokenResponse: SharedTokenResponse, object?: NFTObject): NFTObject; | ||
export declare type ZDKOptions = { | ||
apiKey?: string; | ||
endpoint?: string; | ||
}; | ||
export declare class ZDKDataSource implements ZDKDataInterface { | ||
zdk: ZDK; | ||
nftDataLoader: DataLoader<NFTIdentifier, SharedTokenResponse>; | ||
constructor(chainId: NetworkIDs, endpoint?: string); | ||
constructor(chainId: NetworkIDs, { apiKey, endpoint }: ZDKOptions); | ||
canLoadNFT(_: NFTIdentifier): boolean; | ||
@@ -434,2 +438,4 @@ transformNFT(token: SharedTokenResponse, object?: NFTObject): NFTObject; | ||
} | { | ||
__typename: "Sale"; | ||
} | { | ||
__typename: "TransferEvent"; | ||
@@ -436,0 +442,0 @@ fromAddress: string; |
@@ -140,3 +140,3 @@ "use strict"; | ||
class ZDKDataSource { | ||
constructor(chainId, endpoint) { | ||
constructor(chainId, { apiKey, endpoint }) { | ||
this.loadNFTs = async (nfts) => { | ||
@@ -159,3 +159,3 @@ return await this.nftDataLoader.loadMany(nfts); | ||
return (response.tokens.nodes.find((token) => token.token.tokenId === key.id && | ||
token.token.collectionAddress === key.contract) || new ErrorUtils_1.NotFoundError('Missing record')); | ||
token.token.collectionAddress.toLowerCase() === key.contract.toLowerCase()) || new ErrorUtils_1.NotFoundError('Missing record')); | ||
}); | ||
@@ -246,5 +246,7 @@ }; | ||
this.nftDataLoader = new dataloader_1.default(this.fetchNFTs); | ||
this.zdk = new index_1.ZDK(endpoint, [ | ||
{ network: queries_sdk_1.Network.Ethereum, chain: (0, getChainFromNetwork_1.getChainFromNetwork)(chainId) }, | ||
]); | ||
this.zdk = new index_1.ZDK({ | ||
endpoint, | ||
apiKey, | ||
networks: [{ network: queries_sdk_1.Network.Ethereum, chain: (0, getChainFromNetwork_1.getChainFromNetwork)(chainId) }], | ||
}); | ||
} | ||
@@ -251,0 +253,0 @@ canLoadNFT(_) { |
@@ -18,2 +18,3 @@ "use strict"; | ||
const shared_1 = require("../../constants/shared"); | ||
const dateToISO_1 = require("../zdk/utils/dateToISO"); | ||
function unixToISO(unix) { | ||
@@ -26,8 +27,2 @@ if (!unix) { | ||
} | ||
function dateToISO(date) { | ||
if (!date.endsWith('Z')) { | ||
date += 'Z'; | ||
} | ||
return new Date(date).toISOString(); | ||
} | ||
function getLast(items) { | ||
@@ -240,3 +235,3 @@ if (items && items.length) { | ||
endsAt: { | ||
timestamp: dateToISO(auction.expiresAt), | ||
timestamp: (0, dateToISO_1.dateToISO)(auction.expiresAt), | ||
blockNumber: (_a = auction.endedEvent) === null || _a === void 0 ? void 0 : _a.blockNumber, | ||
@@ -304,3 +299,3 @@ transactionHash: (_b = auction.endedEvent) === null || _b === void 0 ? void 0 : _b.transactionHash, | ||
// TODO(iain): fix normalization to handle missing date information | ||
timestamp: dateToISO(asset.mintTransferEvent.blockTimestamp), | ||
timestamp: (0, dateToISO_1.dateToISO)(asset.mintTransferEvent.blockTimestamp), | ||
transactionHash: asset.mintTransferEvent.transactionHash, | ||
@@ -307,0 +302,0 @@ } |
@@ -5,7 +5,8 @@ import { NetworkIDs, NFTObject } from '..'; | ||
import { NFTQuery, NFTQueryResult } from '../types/NFTQuery'; | ||
import { ZDKOptions } from 'src/backends/zdk/ZDKDataSource'; | ||
export declare class ZDKFetchStrategy extends NFTStrategy { | ||
source: ZDKDataSource; | ||
constructor(networkId: NetworkIDs, endpoint?: string); | ||
constructor(networkId: NetworkIDs, options?: ZDKOptions); | ||
fetchNFT: (contract: string, id: string) => Promise<NFTObject>; | ||
queryNFTs: (query: NFTQuery) => Promise<NFTQueryResult>; | ||
} |
@@ -7,3 +7,3 @@ "use strict"; | ||
class ZDKFetchStrategy extends _1.NFTStrategy { | ||
constructor(networkId, endpoint) { | ||
constructor(networkId, options = {}) { | ||
super(networkId); | ||
@@ -20,5 +20,5 @@ this.fetchNFT = async (contract, id) => { | ||
}; | ||
this.source = new backends_1.ZDKDataSource(networkId, endpoint); | ||
this.source = new backends_1.ZDKDataSource(networkId, options); | ||
} | ||
} | ||
exports.ZDKFetchStrategy = ZDKFetchStrategy; |
{ | ||
"name": "@zoralabs/nft-hooks", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"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.0.1", | ||
"@zoralabs/zdk": "2.1.1", | ||
"big.js": "^6.1.0", | ||
@@ -74,0 +74,0 @@ "cross-fetch": "^3.1.4", |
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
942513
21348
+ Added@zoralabs/zdk@2.1.1(transitive)
- Removed@zoralabs/zdk@2.4.0(transitive)
Updated@zoralabs/zdk@2.1.1