@mintbase-js/data
Advanced tools
Comparing version 0.6.0-downgrade-test-bcb4c1e.0 to 0.6.0-fix-fetch-token-price-62ca0a4.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.dynamicNftMetadataMockInactive = exports.dynamicNftMetadataMockActive = void 0; | ||
const sdk_1 = require("@mintbase-js/sdk"); | ||
exports.dynamicNftMetadataMockActive = { | ||
nft_metadata: [ | ||
{ | ||
metadataId: 'dynamic.mintbase2.near:deadbeef2', | ||
metadataId: `dynamic.${sdk_1.mbjs.keys.mbContractV2}:deadbeef2`, | ||
internalMetadataId: 0, | ||
contractAddress: 'dynamic.mintbase2.near', | ||
contractAddress: `dynamic.${sdk_1.mbjs.keys.mbContractV2}`, | ||
reference: 'https://arweave.net/reference2', | ||
@@ -30,4 +31,4 @@ referenceBlob: { | ||
{ | ||
metadataId: 'dynamic.mintbase2.near:deadbeef0', | ||
contractAddress: 'dynamic.mintbase2.near', | ||
metadataId: `dynamic.${sdk_1.mbjs.keys.mbContractV2}:deadbeef0`, | ||
contractAddress: `dynamic.${sdk_1.mbjs.keys.mbContractV2}`, | ||
internalMetadataId: 0, | ||
@@ -42,4 +43,4 @@ reference: 'https://arweave.net/reference0', | ||
{ | ||
metadataId: 'dynamic.mintbase2.near:deadbeef1', | ||
contractAddress: 'dynamic.mintbase2.near', | ||
metadataId: `dynamic.${sdk_1.mbjs.keys.mbContractV2}:deadbeef1`, | ||
contractAddress: `dynamic.${sdk_1.mbjs.keys.mbContractV2}`, | ||
internalMetadataId: 0, | ||
@@ -46,0 +47,0 @@ reference: 'https://arweave.net/reference1', |
import { ParsedDataReturn } from '../../types'; | ||
import { NearPriceData } from './nearPrice.types'; | ||
export declare const fetchPriceFromCoinGecko: () => Promise<NearPriceData>; | ||
export declare const fetchPriceFromBinance: () => Promise<NearPriceData>; | ||
export declare const nearPrice: () => Promise<ParsedDataReturn<string>>; | ||
//# sourceMappingURL=nearPrice.d.ts.map |
@@ -15,24 +15,22 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.nearPrice = exports.fetchPriceFromBinance = exports.fetchPriceFromCoinGecko = void 0; | ||
exports.nearPrice = void 0; | ||
const cross_fetch_1 = __importDefault(require("cross-fetch")); | ||
const constants_1 = require("../../constants"); | ||
const utils_1 = require("../../utils"); | ||
const fetchPriceFromCoinGecko = () => __awaiter(void 0, void 0, void 0, function* () { | ||
const req = yield (0, cross_fetch_1.default)(constants_1.COIN_GECKO_API); | ||
const data = yield req.json(); | ||
return { price: data.near.usd }; | ||
}); | ||
exports.fetchPriceFromCoinGecko = fetchPriceFromCoinGecko; | ||
const fetchPriceFromBinance = () => __awaiter(void 0, void 0, void 0, function* () { | ||
const req = yield (0, cross_fetch_1.default)(constants_1.BINANCE_API); | ||
const data = yield req.json(); | ||
return data; | ||
}); | ||
exports.fetchPriceFromBinance = fetchPriceFromBinance; | ||
function fetchPrice(url, tokenPrice) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const req = yield (0, cross_fetch_1.default)(url); | ||
const data = yield req.json(); | ||
return tokenPrice(data); | ||
}); | ||
} | ||
const nearPrice = () => __awaiter(void 0, void 0, void 0, function* () { | ||
try { | ||
const res = yield Promise.any([ | ||
(0, exports.fetchPriceFromCoinGecko)(), | ||
(0, exports.fetchPriceFromBinance)(), | ||
]); | ||
let res; | ||
try { | ||
res = yield fetchPrice(constants_1.COIN_GECKO_API, data => ({ price: data.near.usd })); | ||
} | ||
catch (err) { | ||
res = yield fetchPrice(constants_1.BINANCE_API, data => data); | ||
} | ||
return (0, utils_1.parseData)(res.price); | ||
@@ -39,0 +37,0 @@ } |
@@ -22,3 +22,3 @@ "use strict"; | ||
} }, (network && { network: network }))); | ||
const errorMsg = error ? `Error fetching token listing counts, ${error}` : undefined; | ||
const errorMsg = error ? `Error fetching ownedTokens, ${error}` : undefined; | ||
return (0, utils_1.parseData)(data === null || data === void 0 ? void 0 : data.tokens, error, errorMsg); | ||
@@ -25,0 +25,0 @@ }); |
@@ -25,2 +25,3 @@ "use strict"; | ||
title | ||
description | ||
minter | ||
@@ -27,0 +28,0 @@ media |
@@ -9,5 +9,5 @@ import { DocumentNode } from 'graphql'; | ||
query: DocumentNode | string; | ||
variables?: any; | ||
variables?: V; | ||
network?: Network | null | undefined; | ||
}) => Promise<GqlFetchResult<T>>; | ||
//# sourceMappingURL=fetch.d.ts.map |
@@ -12,2 +12,3 @@ export type Pagination = { | ||
title: string; | ||
description: string; | ||
minter: string; | ||
@@ -51,3 +52,3 @@ media: string; | ||
trait_type?: string; | ||
value?: any; | ||
value?: unknown; | ||
display_type?: string; | ||
@@ -72,2 +73,3 @@ }>; | ||
title: string; | ||
description: string; | ||
media: string; | ||
@@ -74,0 +76,0 @@ reference: string; |
import { ParsedDataReturn } from './types'; | ||
export declare const objectWithCamelKeys: (obj: object) => object; | ||
export declare const objectWithCamelKeys: (obj: Record<string, unknown>) => Record<string, unknown>; | ||
export declare const parseData: <T>(data: T, error?: null | string, errorMsg?: string) => ParsedDataReturn<T>; | ||
@@ -4,0 +4,0 @@ export declare function getTokenArrayFromNodes(nodes: { |
{ | ||
"name": "@mintbase-js/data", | ||
"version": "0.6.0-downgrade-test-bcb4c1e.0", | ||
"version": "0.6.0-fix-fetch-token-price-62ca0a4.0", | ||
"description": "Query wrappers for Mintbase JS SDK", | ||
@@ -24,3 +24,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@mintbase-js/sdk": "^0.5.2-beta.0", | ||
"@mintbase-js/sdk": "^0.6.0-fix-fetch-token-price-62ca0a4.0", | ||
"cross-fetch": "^4.0.0", | ||
@@ -34,3 +34,3 @@ "graphql-request": "^5.2.0" | ||
}, | ||
"gitHead": "6da79cf012e2b9d760e6aad9396f1e5cfa52bb3f" | ||
"gitHead": "f9e93ca72a640b1683438645573cc668876787e6" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
970383
12577
+ Added@mintbase-js/sdk@0.6.5(transitive)
+ Added@near-js/accounts@1.2.2(transitive)
+ Added@near-js/crypto@1.3.0(transitive)
+ Added@near-js/keystores@0.1.0(transitive)
+ Added@near-js/keystores-browser@0.1.0(transitive)
+ Added@near-js/keystores-node@0.0.13(transitive)
+ Added@near-js/providers@0.2.3(transitive)
+ Added@near-js/signers@0.1.5(transitive)
+ Added@near-js/transactions@1.2.3(transitive)
+ Added@near-js/types@0.2.1(transitive)
+ Added@near-js/utils@0.3.0(transitive)
+ Added@near-js/wallet-account@1.2.3(transitive)
+ Added@noble/curves@1.2.0(transitive)
+ Added@noble/hashes@1.3.21.3.3(transitive)
+ Addedbase-x@2.0.6(transitive)
+ Addedbn.js@4.12.1(transitive)
+ Addedborsh@1.0.0(transitive)
+ Addedbrorand@1.1.0(transitive)
+ Addedbs58@4.0.0(transitive)
+ Addedelliptic@6.6.1(transitive)
+ Addedgenerate-function@2.3.1(transitive)
+ Addedgenerate-object-property@1.2.0(transitive)
+ Addedhash.js@1.1.7(transitive)
+ Addedhmac-drbg@1.0.1(transitive)
+ Addedhttp-errors@1.7.2(transitive)
+ Addedinherits@2.0.3(transitive)
+ Addedis-my-ip-valid@1.0.1(transitive)
+ Addedis-my-json-valid@2.20.6(transitive)
+ Addedis-property@1.0.2(transitive)
+ Addedjsonpointer@5.0.1(transitive)
+ Addedlru_map@0.4.1(transitive)
+ Addedminimalistic-assert@1.0.1(transitive)
+ Addedminimalistic-crypto-utils@1.0.1(transitive)
+ Addedmustache@4.0.0(transitive)
+ Addednear-api-js@4.0.4(transitive)
+ Addednode-addon-api@5.1.0(transitive)
+ Addednode-fetch@2.6.7(transitive)
+ Addednode-gyp-build@4.8.4(transitive)
+ Addedrandombytes@2.1.0(transitive)
+ Addedsecp256k1@5.0.0(transitive)
+ Addedsetprototypeof@1.1.1(transitive)
+ Addedtoidentifier@1.0.0(transitive)
+ Addedxtend@4.0.2(transitive)
- Removed@mintbase-js/sdk@0.5.2-v0.5.3-beta.0-94da14c.0(transitive)
- Removed@near-js/accounts@0.1.4(transitive)
- Removed@near-js/crypto@0.0.5(transitive)
- Removed@near-js/keystores@0.0.5(transitive)
- Removed@near-js/keystores-browser@0.0.5(transitive)
- Removed@near-js/keystores-node@0.0.5(transitive)
- Removed@near-js/providers@0.0.7(transitive)
- Removed@near-js/signers@0.0.5(transitive)
- Removed@near-js/transactions@0.2.1(transitive)
- Removed@near-js/types@0.0.4(transitive)
- Removed@near-js/utils@0.0.4(transitive)
- Removed@near-js/wallet-account@0.0.7(transitive)
- Removedajv@8.17.1(transitive)
- Removedajv-formats@2.1.1(transitive)
- Removedbase-x@3.0.10(transitive)
- Removedbn.js@5.2.1(transitive)
- Removedborsh@0.7.0(transitive)
- Removedbs58@4.0.1(transitive)
- Removedcapability@0.2.5(transitive)
- Removederror-polyfill@0.1.3(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-uri@3.0.5(transitive)
- Removedhttp-errors@1.8.1(transitive)
- Removedjs-sha256@0.9.0(transitive)
- Removedjson-schema-traverse@1.0.0(transitive)
- Removedmustache@4.2.0(transitive)
- Removednear-api-js@2.1.4(transitive)
- Removedo3@1.0.3(transitive)
- Removedrequire-from-string@2.0.2(transitive)
- Removedsetprototypeof@1.2.0(transitive)
- Removedtext-encoding-utf-8@1.0.2(transitive)
- Removedtoidentifier@1.0.1(transitive)
- Removedtweetnacl@1.0.3(transitive)
- Removedu3@0.1.1(transitive)
Updated@mintbase-js/sdk@^0.6.0-fix-fetch-token-price-62ca0a4.0