@mintbase-js/data
Advanced tools
Comparing version 0.6.0-add-bitte-wallet-setup-f054e86.0 to 0.6.0-add-bitte-wallet-support-17d2a30.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,20 @@ "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)(), | ||
]); | ||
const res = yield fetchPrice(constants_1.BINANCE_API, data => data) | ||
.catch((err) => __awaiter(void 0, void 0, void 0, function* () { | ||
console.log('First API call failed, trying second API', err); | ||
return yield fetchPrice(constants_1.COIN_GECKO_API, data => ({ price: data.near.usd })); | ||
})); | ||
return (0, utils_1.parseData)(res.price); | ||
@@ -39,0 +35,0 @@ } |
{ | ||
"name": "@mintbase-js/data", | ||
"version": "0.6.0-add-bitte-wallet-setup-f054e86.0", | ||
"version": "0.6.0-add-bitte-wallet-support-17d2a30.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-beta-prerelease.1", | ||
"cross-fetch": "^4.0.0", | ||
@@ -34,3 +34,3 @@ "graphql-request": "^5.2.0" | ||
}, | ||
"gitHead": "653a658e1a70b9b18a0e751f0368894f10a91026" | ||
"gitHead": "6570fcf0be86f0b66e12c254f7d6cad0b0ae6e4a" | ||
} |
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
970512
12575
- 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)
- Removed@types/json-schema@7.0.15(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)
- Removeddepd@1.1.22.0.0(transitive)
- Removederror-polyfill@0.1.3(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-uri@3.0.3(transitive)
- Removedhttp-errors@1.8.1(transitive)
- Removedinherits@2.0.4(transitive)
- Removedjs-sha256@0.9.0(transitive)
- Removedjson-schema-traverse@1.0.0(transitive)
- Removedmustache@4.2.0(transitive)
- Removednear-abi@0.1.1(transitive)
- Removednear-api-js@2.1.4(transitive)
- Removedo3@1.0.3(transitive)
- Removedrequire-from-string@2.0.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsetprototypeof@1.2.0(transitive)
- Removedstatuses@1.5.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)