New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@mintbase-js/sdk

Package Overview
Dependencies
Maintainers
2
Versions
1314
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mintbase-js/sdk - npm Package Compare versions

Comparing version 0.6.0-beta-prerelease.4 to 0.6.0-beta-prerelease.5

1

lib/createMetadata/createMetadata.d.ts

@@ -13,2 +13,3 @@ import { CreateMetadataArgs, CreateMetadataArgsResponse, NearContractCall, TokenMetadata } from '../types';

}): string;
export declare function formatPrice(price: number, ftDecimals: number): string;
//# sourceMappingURL=createMetadata.d.ts.map

15

lib/createMetadata/createMetadata.js

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.createMetadataDeposit = exports.createMetadata = void 0;
exports.formatPrice = exports.createMetadataDeposit = exports.createMetadata = void 0;
const bn_js_1 = __importDefault(require("bn.js"));

@@ -21,3 +21,3 @@ const config_1 = require("../config/config");

var _a;
const { contractAddress = config_1.mbjs.keys.contractAddress, metadata, metadataId = null, royalties = null, price, mintersAllowlist = null, maxSupply = null, startsAt = null, expiresAt = null, isDynamic = null, noMedia = false, noReference = false, ftAddress = null, } = args;
const { contractAddress = config_1.mbjs.keys.contractAddress, metadata, metadataId = null, royalties = null, price, mintersAllowlist = null, maxSupply = null, startsAt = null, expiresAt = null, isDynamic = null, noMedia = false, noReference = false, ftAddress = null, ftDecimals = null, } = args;
if (!contractAddress) {

@@ -39,2 +39,5 @@ throw new Error(errorMessages_1.ERROR_MESSAGES.CONTRACT_ADDRESS);

}
if ((ftAddress && !ftDecimals) || (ftDecimals && !ftAddress)) {
throw new Error(errorMessages_1.ERROR_MESSAGES.FT_ADDRESS_DECIMALS);
}
const { royaltyTotal, roundedRoyalties } = (0, utils_1.processRoyalties)(royalties);

@@ -53,3 +56,3 @@ return {

is_dynamic: isDynamic,
price: new bn_js_1.default(price * 1e6).mul(new bn_js_1.default(`1${'0'.repeat(18)}`)).toString(),
price: formatPrice(price, ftDecimals),
ft_contract_id: ftAddress,

@@ -78,2 +81,8 @@ },

exports.createMetadataDeposit = createMetadataDeposit;
function formatPrice(price, ftDecimals) {
const base = new bn_js_1.default(price * 1e6);
const multiplier = new bn_js_1.default(`1${'0'.repeat((ftDecimals !== null && ftDecimals !== void 0 ? ftDecimals : 24) - 6)}`);
return base.mul(multiplier).toString();
}
exports.formatPrice = formatPrice;
//# sourceMappingURL=createMetadata.js.map

@@ -34,3 +34,4 @@ export declare const ERROR_MESSAGES: {

INVALID_FACTORY: string;
FT_ADDRESS_DECIMALS: string;
};
//# sourceMappingURL=errorMessages.d.ts.map

@@ -40,3 +40,4 @@ "use strict";

INVALID_FACTORY: `Your specified factory contract ID is not known to Mintbase ${SUPPORT}`,
FT_ADDRESS_DECIMALS: `If you specify an ftAddress, you must also specify ftDecimals and vice versa ${SUPPORT}`,
};
//# sourceMappingURL=errorMessages.js.map

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

const utils_1 = require("../utils");
const createMetadata_1 = require("../createMetadata/createMetadata");
/**

@@ -20,3 +21,3 @@ * Mint a token given via reference json on a given contract with a specified owner, amount of copies as well and royalties can be specified via options

const mintOnMetadata = (args) => {
const { contractAddress = config_1.mbjs.keys.contractAddress, metadataId, ownerId, amount = null, tokenIds = null, price, ftAddress, } = args;
const { contractAddress = config_1.mbjs.keys.contractAddress, metadataId, ownerId, amount = null, tokenIds = null, price, ftAddress, ftDecimals, } = args;
if (!contractAddress) {

@@ -31,2 +32,5 @@ throw new Error(errorMessages_1.ERROR_MESSAGES.CONTRACT_ADDRESS);

}
if ((ftAddress && !ftDecimals) || (ftDecimals && !ftAddress)) {
throw new Error(errorMessages_1.ERROR_MESSAGES.FT_ADDRESS_DECIMALS);
}
if (tokenIds && tokenIds.length === 0) {

@@ -52,3 +56,3 @@ throw new Error(errorMessages_1.ERROR_MESSAGES.EMPTY_TOKEN_IDS);

const storageDeposit = depositMintingStorage(contractAddress, mintOnMetadataDeposit(amountCalc));
const totalPrice = new bn_js_1.default(`1${'0'.repeat(24)}`).muln(price).muln(amountCalc).toString();
const formattedPrice = (0, createMetadata_1.formatPrice)(price * amountCalc, ftDecimals);
if (ftAddress) {

@@ -61,3 +65,3 @@ return [

receiver_id: contractAddress,
amount: totalPrice,
amount: formattedPrice,
msg: JSON.stringify(mintArgs),

@@ -79,3 +83,3 @@ memo: null,

gas: constants_1.GAS,
deposit: totalPrice,
deposit: formattedPrice,
},

@@ -82,0 +86,0 @@ ];

@@ -221,2 +221,3 @@ import { Wallet } from '@near-wallet-selector/core';

ftAddress?: string;
ftDecimals?: number;
noMedia?: boolean;

@@ -233,2 +234,3 @@ noReference?: boolean;

ftAddress?: string;
ftDecimals?: number;
};

@@ -235,0 +237,0 @@ export type UpdateMetadataArgs = {

{
"name": "@mintbase-js/sdk",
"version": "0.6.0-beta-prerelease.4",
"version": "0.6.0-beta-prerelease.5",
"description": "Core functions for Mintbase JS SDK",

@@ -29,3 +29,3 @@ "main": "lib/index.js",

},
"gitHead": "11401fb24f9eddca1434b470a5de7a77575ffaea"
"gitHead": "66ef9a131176ce709187e976d62ce898ad79b978"
}

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

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