@zoralabs/nft-hooks
Advanced tools
Comparing version 1.0.29 to 1.0.30
export declare function reverseResolveEnsAddresses(addresses: readonly string[], networkId: string, endpoint: string, timeout: number): Promise<{ | ||
[name: string]: string; | ||
[name: string]: string | undefined; | ||
}>; |
@@ -66,5 +66,3 @@ "use strict"; | ||
const json = await result.json(); | ||
console.log('json', { json }); | ||
const resultAddresses = processReturnData(json.result); | ||
console.log('results', { resultAddresses }); | ||
if (resultAddresses.length !== mappingKeys.length) { | ||
@@ -74,3 +72,3 @@ throw new Error('Wrong address return length'); | ||
return mappingKeys.reduce((last, at, index) => { | ||
last[at] = resultAddresses[index]; | ||
last[at] = resultAddresses[index] || undefined; | ||
return last; | ||
@@ -77,0 +75,0 @@ }, {}); |
@@ -16,2 +16,5 @@ "use strict"; | ||
function dateToISO(date) { | ||
if (!date.endsWith('Z')) { | ||
date += 'Z'; | ||
} | ||
return new Date(date).toISOString(); | ||
@@ -18,0 +21,0 @@ } |
@@ -26,2 +26,5 @@ "use strict"; | ||
function dateToISO(date) { | ||
if (!date.endsWith('Z')) { | ||
date += 'Z'; | ||
} | ||
return new Date(date).toISOString(); | ||
@@ -28,0 +31,0 @@ } |
@@ -22,3 +22,2 @@ "use strict"; | ||
var _a; | ||
console.log({ url }); | ||
const controller = this.controller; | ||
@@ -25,0 +24,0 @@ const response = await (0, cross_fetch_1.default)(url, { |
@@ -0,1 +1,2 @@ | ||
import { SWRConfiguration } from 'swr'; | ||
import { NFTObject } from '../types/NFTInterface'; | ||
@@ -8,8 +9,2 @@ export declare type useNFTType = { | ||
}; | ||
declare type OptionsType = { | ||
refreshInterval?: number; | ||
initialData?: any; | ||
loadCurrencyInfo?: boolean; | ||
useBetaIndexer?: boolean; | ||
}; | ||
/** | ||
@@ -23,3 +18,2 @@ * Fetches on-chain NFT data and pricing for the given nft contract address and id | ||
*/ | ||
export declare function useNFT(contractAddress?: string, tokenId?: string, options?: OptionsType, marketOptions?: OptionsType): useNFTType; | ||
export {}; | ||
export declare function useNFT(contractAddress?: string, tokenId?: string, options?: SWRConfiguration, marketOptions?: SWRConfiguration): useNFTType; |
@@ -0,1 +1,2 @@ | ||
import { SWRConfiguration } from 'swr'; | ||
export declare type useNFTMetadataType = { | ||
@@ -14,2 +15,2 @@ loading: boolean; | ||
*/ | ||
export declare function useNFTMetadata(uri?: string, initialData?: any): useNFTMetadataType; | ||
export declare function useNFTMetadata(uri?: string, options?: SWRConfiguration): useNFTMetadataType; |
@@ -16,5 +16,5 @@ "use strict"; | ||
*/ | ||
function useNFTMetadata(uri, initialData) { | ||
function useNFTMetadata(uri, options) { | ||
const { fetcher } = (0, react_1.useContext)(NFTFetchContext_1.NFTFetchContext); | ||
const { error, data } = (0, swr_1.default)(uri ? ['loadMetadata', uri] : null, (_, uri) => fetcher.fetchIPFSMetadata(uri), { initialData }); | ||
const { error, data } = (0, swr_1.default)(uri ? ['loadMetadata', uri] : null, (_, uri) => fetcher.fetchIPFSMetadata(uri), options); | ||
return { | ||
@@ -21,0 +21,0 @@ loading: !error && !data, |
@@ -0,1 +1,2 @@ | ||
import { SWRConfiguration } from 'swr'; | ||
import { NFTObject } from '../types'; | ||
@@ -7,8 +8,2 @@ import { NFTQuery } from '../types/NFTQuery'; | ||
}; | ||
declare type OptionsType = { | ||
refreshInterval?: number; | ||
initialData?: any; | ||
loadCurrencyInfo?: boolean; | ||
useBetaIndexer?: boolean; | ||
}; | ||
/** | ||
@@ -21,3 +16,2 @@ * Fetches on-chain NFT data and pricing for a given general NFT Query | ||
*/ | ||
export declare function useNFTQuery(query: NFTQuery, options?: OptionsType): useNFTQueryType; | ||
export {}; | ||
export declare function useNFTQuery(query: NFTQuery, options: SWRConfiguration<NFTObject[]>): useNFTQueryType; |
@@ -15,6 +15,6 @@ "use strict"; | ||
*/ | ||
function useNFTQuery(query, options = {}) { | ||
function useNFTQuery(query, options) { | ||
const dataContext = (0, react_1.useContext)(NFTFetchContext_1.NFTFetchContext); | ||
const strategy = dataContext.strategy; | ||
// run query | ||
// Run query | ||
const { data, error } = (0, swr_1.default)(query ? ['queryNFTs', JSON.stringify(query)] : null, (_, queryString) => strategy.queryNFTs(JSON.parse(queryString)), options); | ||
@@ -21,0 +21,0 @@ return { |
{ | ||
"name": "@zoralabs/nft-hooks", | ||
"version": "1.0.29", | ||
"version": "1.0.30", | ||
"description": "Generic react hooks for fetching zora auctions, nfts, and data on arbitary 721s. Powers nft-components.", | ||
@@ -19,3 +19,3 @@ "repository": "https://github.com/ourzora/nft-hooks", | ||
"@graphql-codegen/typescript": "^1.22.0", | ||
"@graphql-codegen/typescript-graphql-request": "^3.1.1", | ||
"@graphql-codegen/typescript-graphql-request": "^4.4.8", | ||
"@graphql-codegen/typescript-operations": "^1.17.16", | ||
@@ -25,16 +25,21 @@ "@graphql-tools/mock": "^8.1.1", | ||
"@jagi/jest-transform-graphql": "^1.0.2", | ||
"@testing-library/react-hooks": "^5.1.2", | ||
"@testing-library/react-hooks": "^8.0.0", | ||
"@types/big.js": "^6.0.2", | ||
"@types/jest": "^26.0.23", | ||
"@types/react": "^18.0.9", | ||
"fetch-mock-jest": "^1.5.1", | ||
"graphql": "^15.5.0", | ||
"graphql-tools": "^7.0.4", | ||
"husky": "^6.0.0", | ||
"jest": "^26.6.3", | ||
"jest-serial-runner": "^1.1.0", | ||
"jest": "^28.0.2", | ||
"jest-environment-jsdom": "^28.1.0", | ||
"jest-runner": "^28.1.0", | ||
"jest-serial-runner": "^1.2.0", | ||
"jest-transform-graphql": "^2.1.0", | ||
"lint-staged": "^10.5.4", | ||
"prettier": "^2.2.1", | ||
"react-test-renderer": "^17.0.2", | ||
"ts-jest": "^26.5.5", | ||
"typescript": "^4.2.4" | ||
"prettier": "^2.6.2", | ||
"react": "^18.1.0", | ||
"react-test-renderer": "^18.1.0", | ||
"ts-jest": "^28.0.2", | ||
"typescript": "^4.6.4" | ||
}, | ||
@@ -68,3 +73,3 @@ "scripts": { | ||
"@types/deepmerge": "^2.2.0", | ||
"@zoralabs/zdk-alpha": "0.0.37", | ||
"@zoralabs/zdk-alpha": "^0.0.38", | ||
"big.js": "^6.1.0", | ||
@@ -74,7 +79,6 @@ "cross-fetch": "^3.1.4", | ||
"deepmerge": "^4.2.2", | ||
"graphql": "^15.5.0", | ||
"graphql-request": "^4.2.0", | ||
"node-abort-controller": "^2.0.0", | ||
"swr": "^0.5.6", | ||
"tslib": "^2.2.0" | ||
"swr": "^1.3.0", | ||
"tslib": "^2.4.0" | ||
}, | ||
@@ -81,0 +85,0 @@ "prettier": { |
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
14
932409
26
21080
+ Added@zoralabs/zdk-alpha@0.0.38(transitive)
+ Addedswr@1.3.0(transitive)
- Removedgraphql@^15.5.0
- Removed@zoralabs/zdk-alpha@0.0.37(transitive)
- Removeddequal@2.0.2(transitive)
- Removedgraphql@15.9.0(transitive)
- Removedswr@0.5.7(transitive)
Updated@zoralabs/zdk-alpha@^0.0.38
Updatedswr@^1.3.0
Updatedtslib@^2.4.0