Socket
Socket
Sign inDemoInstall

@zoralabs/nft-hooks

Package Overview
Dependencies
Maintainers
10
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 0.1.1 to 0.1.2

dist/src/graph-queries/uniswap-types.d.ts

5

dist/src/context/NFTFetchContext.d.ts
import React from 'react';
import type { ReactNode } from 'react';
import { NetworkIDs } from '../constants/networks';

@@ -10,5 +9,5 @@ import { MediaFetchAgent } from '../fetcher/MediaFetchAgent';

networkId: NetworkIDs;
children: ReactNode;
children: React.ReactNode;
};
export declare const NFTFetchConfiguration: ({ networkId, children, }: NFTFetchConfigurationProps) => ReactNode;
export declare const NFTFetchConfiguration: ({ networkId, children, }: NFTFetchConfigurationProps) => JSX.Element;
export {};

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

const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = tslib_1.__importStar(require("react"));

@@ -10,3 +11,3 @@ const networks_1 = require("../constants/networks");

exports.defaultFetchAgent = new MediaFetchAgent_1.MediaFetchAgent(networks_1.Networks.MAINNET);
exports.NFTFetchContext = react_1.createContext(exports.defaultFetchAgent);
exports.NFTFetchContext = react_1.default.createContext(exports.defaultFetchAgent);
const NFTFetchConfiguration = ({ networkId, children, }) => {

@@ -20,4 +21,4 @@ const lastFetchContext = react_1.useContext(exports.NFTFetchContext);

}, [networkId]);
return (react_1.default.createElement(exports.NFTFetchContext.Provider, { value: fetchAgent }, children));
return (jsx_runtime_1.jsx(exports.NFTFetchContext.Provider, Object.assign({ value: fetchAgent }, { children: children }), void 0));
};
exports.NFTFetchConfiguration = NFTFetchConfiguration;

11

dist/src/fetcher/AuctionInfoTypes.d.ts

@@ -1,2 +0,2 @@

import { AskPriceFragment, BidDataPartialFragment, CurrencyShortFragment } from '../graph-queries/zora-types';
import { AskPriceFragment, BidDataPartialFragment, CurrencyShortFragment, PreviousReserveBidFragment } from '../graph-queries/zora-types';
import { ChainCurrencyType } from '../fetcher/FetchResultTypes';

@@ -9,8 +9,8 @@ export declare type PricingInfo = {

};
export declare type PerpetualBid = Omit<BidDataPartialFragment, 'currency' | 'amount'> & {
declare type BidPricingInfo = {
pricing: PricingInfo;
};
export declare type PerpetualAsk = Pick<AskPriceFragment, 'id' | 'createdAtTimestamp'> & {
pricing: PricingInfo;
};
export declare type PastReserveBid = Omit<PreviousReserveBidFragment, 'amount'> & BidPricingInfo;
export declare type PerpetualBid = Omit<BidDataPartialFragment, 'currency' | 'amount'> & BidPricingInfo;
export declare type PerpetualAsk = Pick<AskPriceFragment, 'id' | 'createdAtTimestamp'> & BidPricingInfo;
export declare type PricingInfoValue = {

@@ -37,1 +37,2 @@ inUSD: string;

};
export {};
import { Maybe } from 'graphql/jsutils/Maybe';
import { TokenShortFragment } from 'src/graph-queries/uniswap-types';
import { AskPriceFragment, BidDataPartialFragment, NftMediaFragment, ReserveAuctionPartialFragment } from 'src/graph-queries/zora-types';
import { AuctionInfoData, PerpetualAsk, PerpetualBid } from './AuctionInfoTypes';
import { TokenShortFragment } from '../graph-queries/uniswap-types';
import { AskPriceFragment, BidDataPartialFragment, NftMediaFragment, ReserveAuctionPartialFragment } from '../graph-queries/zora-types';
import { AuctionInfoData, PastReserveBid, PerpetualAsk, PerpetualBid } from './AuctionInfoTypes';
export declare type MediaContentType = {

@@ -28,2 +28,5 @@ uri: string;

};
declare type ReserveAuctionBidsWithCurrency = Omit<ReserveAuctionPartialFragment, 'previousBids'> & {
previousBids: PastReserveBid[];
};
export declare type NFTDataType = Omit<NFTMediaDataType, 'pricing'> & {

@@ -36,3 +39,3 @@ auction: AuctionInfoData;

};
reserve: Maybe<ReserveAuctionPartialFragment>;
reserve: Maybe<ReserveAuctionBidsWithCurrency>;
};

@@ -50,1 +53,2 @@ };

};
export {};

@@ -1,2 +0,2 @@

import type { GetMediaAndAuctionsQuery } from '../graph-queries/zora-types';
import type { Currency, GetMediaAndAuctionsQuery } from '../graph-queries/zora-types';
import type { GetTokenPricesQuery } from '../graph-queries/uniswap-types';

@@ -34,3 +34,3 @@ import { ChainCurrencyType, NFTDataType, NFTMediaDataType } from './FetchResultTypes';

__typename?: "Currency" | undefined;
} & Pick<import("../graph-queries/zora-types").Currency, "symbol" | "id" | "name" | "decimals">;
} & Pick<Currency, "symbol" | "id" | "name" | "decimals">;
})[];

@@ -46,3 +46,3 @@ ask: import("../graph-queries/zora-types").Maybe<{

__typename?: "Currency" | undefined;
} & Pick<import("../graph-queries/zora-types").Currency, "symbol" | "id" | "name" | "decimals">;
} & Pick<Currency, "symbol" | "id" | "name" | "decimals">;
}> | undefined;

@@ -70,3 +70,5 @@ };

__typename?: "ReserveAuctionBid" | undefined;
} & Pick<import("../graph-queries/zora-types").ReserveAuctionBid, "createdAtTimestamp" | "amount"> & {
} & {
__typename?: "ReserveAuctionBid" | undefined;
} & Pick<import("../graph-queries/zora-types").ReserveAuctionBid, "createdAtTimestamp" | "amount" | "bidType"> & {
bidder: {

@@ -76,2 +78,11 @@ __typename?: "User" | undefined;

}> | undefined;
previousBids?: import("../graph-queries/zora-types").Maybe<({
__typename?: "InactiveReserveAuctionBid" | undefined;
} & {
__typename?: "InactiveReserveAuctionBid" | undefined;
} & Pick<import("../graph-queries/zora-types").InactiveReserveAuctionBid, "id" | "createdAtTimestamp" | "amount" | "bidType" | "bidInactivatedAtTimestamp" | "bidInactivatedAtBlockNumber"> & {
bidder: {
__typename?: "User" | undefined;
} & Pick<import("../graph-queries/zora-types").User, "id">;
})[]> | undefined;
} | undefined;

@@ -78,0 +89,0 @@ };

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

function addAuctionInformation(chainNFT, currencyInfos = {}) {
var _a, _b, _c, _d;
var _a, _b, _c, _d, _e, _f;
const hasActiveReserveAuction = ((_a = chainNFT.pricing.reserve) === null || _a === void 0 ? void 0 : _a.status) === 'Active';

@@ -77,3 +77,3 @@ const getCurrencyComputedValue = (currencyId, bidAmount) => {

};
const handleBid = (bidRaw) => {
const handlePerpetualBid = (bidRaw) => {
const { amount, currency, ...bid } = bidRaw;

@@ -90,2 +90,17 @@ return {

};
const handleReserveBid = ({ amount, ...bidRaw }) => {
var _a;
const currency = (_a = chainNFT.pricing.reserve) === null || _a === void 0 ? void 0 : _a.auctionCurrency;
return {
...bidRaw,
pricing: {
currency,
amount,
prettyAmount: setCurrencyDecimal(amount, currency === null || currency === void 0 ? void 0 : currency.decimals),
computedValue: currency
? getCurrencyComputedValue(currency.id, amount)
: undefined,
},
};
};
const transformAskCurrency = (ask) => {

@@ -187,3 +202,10 @@ const { amount, currency, createdAtTimestamp, id } = ask;

pricing: {
...pricing,
reserve: pricing.reserve
? {
...pricing.reserve,
previousBids: ((_d = (_c = pricing.reserve) === null || _c === void 0 ? void 0 : _c.previousBids) === null || _d === void 0 ? void 0 : _d.map((previousBid) => handleReserveBid(previousBid)).sort((bidA, bidB) => bidA.bidInactivatedAtBlockNumber > bidB.bidInactivatedAtBlockNumber
? -1
: 1)) || [],
}
: undefined,
perpetual: {

@@ -193,3 +215,3 @@ ask: pricing.perpetual.ask

: undefined,
bids: pricing.perpetual.bids.map((bid) => handleBid(bid)),
bids: pricing.perpetual.bids.map((bid) => handlePerpetualBid(bid)),
},

@@ -206,6 +228,6 @@ },

reserveMet: hasActiveReserveAuction
? !((_c = chainNFT.pricing.reserve) === null || _c === void 0 ? void 0 : _c.firstBidTime)
? !((_e = chainNFT.pricing.reserve) === null || _e === void 0 ? void 0 : _e.firstBidTime)
: false,
endingAt: hasActiveReserveAuction
? (_d = chainNFT.pricing.reserve) === null || _d === void 0 ? void 0 : _d.expectedEndTimestamp
? (_f = chainNFT.pricing.reserve) === null || _f === void 0 ? void 0 : _f.expectedEndTimestamp
: undefined,

@@ -212,0 +234,0 @@ },

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

}
fragment BidDataPartial on Bid {

@@ -24,2 +25,24 @@ id

}
fragment PreviousReserveBid on InactiveReserveAuctionBid {
id
bidder {
id
}
createdAtTimestamp
amount
bidType
bidInactivatedAtTimestamp
bidInactivatedAtBlockNumber
}
fragment CurrentReserveBid on ReserveAuctionBid {
bidType
amount
createdAtTimestamp
bidder {
id
}
}
fragment AskPrice on Ask {

@@ -33,2 +56,3 @@ id

}
fragment NFTMedia on Media {

@@ -50,2 +74,3 @@ id

}
fragment ReserveAuctionPartial on ReserveAuction {

@@ -62,8 +87,7 @@ id

currentBid {
amount
createdAtTimestamp
bidder {
id
}
...CurrentReserveBid
}
previousBids {
...PreviousReserveBid
}
duration

@@ -70,0 +94,0 @@ expectedEndTimestamp

@@ -23,2 +23,5 @@ "use strict";

Bytes: () => "ByTeSStrInG",
// Randomly chosen by mock
// breaks consistent testing
ReserveAuctionBidType: () => "Final",
ID: () => (currentID++).toString(),

@@ -25,0 +28,0 @@ Currency: () => ({

{
"name": "@zoralabs/nft-hooks",
"version": "0.1.1",
"version": "0.1.2",
"description": "Generic Rendering Component for zNFTs",

@@ -57,3 +57,2 @@ "repository": "https://github.com/our-zora/nft-hooks",

"dependencies": {
"@graphql-tools/mock": "^8.1.1",
"@zoralabs/media-metadata-schemas": "^0.1.3",

@@ -60,0 +59,0 @@ "big.js": "^6.1.0",

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