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
0
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.5.9-dynamic-nft-metadata-type-exports-fc380a2.0 to 0.6.0-add-bitte-wallet-3fd6031.0

1

lib/buy/buy.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buy = void 0;
/* eslint-disable @typescript-eslint/camelcase */
const config_1 = require("../config/config");

@@ -6,0 +5,0 @@ const constants_1 = require("../constants");

3

lib/constants.d.ts

@@ -6,3 +6,4 @@ import { FtAddresses, LAVA_RPC_ENDPOINTS, NEAR_RPC_ENDPOINTS } from './types';

export declare const TOKEN_CONTRACT_SPEC = "nft-1.0.0";
export declare const CONTRACT_DEPOSIT: string;
export declare const DEPLOY_CONTRACT_V1_DEPOSIT: string;
export declare const DEPLOY_CONTRACT_V2_DEPOSIT: string;
export declare const LISTING_DEPOSIT: string;

@@ -9,0 +10,0 @@ export declare const FT_STORAGE_DEPOSIT: string;

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.RPC_ENDPOINTS = exports.FT_ADDRESSES = exports.GAS_FOR_TRANSFER = exports.DEPOSIT_FOR_TRANSFER = exports.GAS_FOR_BURN = exports.DEPOSIT_FOR_BURN = exports.DEFAULT_MB_BASE_URI = exports.DEFAULT_MB_LOGO = exports.multipleTokensLegacyListing = exports.STORAGE_PRICE_PER_BYTE_EXPONENT = exports.STORAGE_BYTES = exports.DEPOSIT_CONSTANTS = exports.GAS_CONSTANTS = exports.FT_STORAGE_DEPOSIT = exports.LISTING_DEPOSIT = exports.CONTRACT_DEPOSIT = exports.TOKEN_CONTRACT_SPEC = exports.ONE_YOCTO = exports.MAX_GAS = exports.GAS = void 0;
exports.RPC_ENDPOINTS = exports.FT_ADDRESSES = exports.GAS_FOR_TRANSFER = exports.DEPOSIT_FOR_TRANSFER = exports.GAS_FOR_BURN = exports.DEPOSIT_FOR_BURN = exports.DEFAULT_MB_BASE_URI = exports.DEFAULT_MB_LOGO = exports.multipleTokensLegacyListing = exports.STORAGE_PRICE_PER_BYTE_EXPONENT = exports.STORAGE_BYTES = exports.DEPOSIT_CONSTANTS = exports.GAS_CONSTANTS = exports.FT_STORAGE_DEPOSIT = exports.LISTING_DEPOSIT = exports.DEPLOY_CONTRACT_V2_DEPOSIT = exports.DEPLOY_CONTRACT_V1_DEPOSIT = exports.TOKEN_CONTRACT_SPEC = exports.ONE_YOCTO = exports.MAX_GAS = exports.GAS = void 0;
const bn_js_1 = __importDefault(require("bn.js"));

@@ -14,3 +14,4 @@ const types_1 = require("./types");

exports.TOKEN_CONTRACT_SPEC = 'nft-1.0.0';
exports.CONTRACT_DEPOSIT = `3700000${'0'.repeat(18)}`; // 3.5 NEAR
exports.DEPLOY_CONTRACT_V1_DEPOSIT = `3700000${'0'.repeat(18)}`; // 3.7 NEAR
exports.DEPLOY_CONTRACT_V2_DEPOSIT = `4000000${'0'.repeat(18)}`; // 4.0 NEAR
exports.LISTING_DEPOSIT = `1000${'0'.repeat(18)}`; // 1 milliNEAR

@@ -17,0 +18,0 @@ exports.FT_STORAGE_DEPOSIT = `1250${'0'.repeat(18)}`;

@@ -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

@@ -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, lastPossibleMint = null, isDynamic = null, noMedia = false, noReference = false, } = 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);

@@ -50,5 +53,7 @@ return {

max_supply: maxSupply,
last_possible_mint: lastPossibleMint ? (+lastPossibleMint * 1e6).toString() : null,
starts_at: startsAt ? (0, utils_1.dateToTimestamp)(startsAt) : null,
expires_at: expiresAt ? (0, utils_1.dateToTimestamp)(expiresAt) : null,
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,
},

@@ -76,2 +81,8 @@ methodName: types_1.TOKEN_METHOD_NAMES.CREATE_METADATA,

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
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.deployContract = void 0;
/* eslint-disable @typescript-eslint/camelcase */
const config_1 = require("../config/config");
const constants_1 = require("../constants");
const errorMessages_1 = require("../errorMessages");
const types_1 = require("../types");

@@ -17,2 +17,12 @@ const utils_1 = require("../utils");

const { name, factoryContractId = config_1.mbjs.keys.mbContract, ownerId, metadata } = args;
const deposit = (() => {
switch (factoryContractId) {
case config_1.mbjs.keys.mbContract:
return constants_1.DEPLOY_CONTRACT_V1_DEPOSIT;
case config_1.mbjs.keys.mbContractV2:
return constants_1.DEPLOY_CONTRACT_V2_DEPOSIT;
default:
throw new Error(errorMessages_1.ERROR_MESSAGES.INVALID_FACTORY);
}
})();
const { symbol, icon = constants_1.DEFAULT_MB_LOGO, baseUri = ARWEAVE_BASE_URI, reference = null, referenceHash = null } = metadata;

@@ -35,3 +45,3 @@ return {

gas: constants_1.GAS_CONSTANTS.DEFAULT_GAS,
deposit: constants_1.CONTRACT_DEPOSIT,
deposit,
};

@@ -38,0 +48,0 @@ };

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

import { DepositStorageArgs, NearContractCall } from '../types';
import { DepositStorageArgs, EmptyObject, NearContractCall } from '../types';
/**

@@ -7,3 +7,3 @@ * Deposits 0.01 * listAmount of near to the market contract to be consumed for listing purposes

*/
export declare const depositStorage: (args: DepositStorageArgs) => NearContractCall<{}>;
export declare const depositStorage: (args: DepositStorageArgs) => NearContractCall<EmptyObject>;
//# sourceMappingURL=depositStorage.d.ts.map

@@ -33,3 +33,5 @@ export declare const ERROR_MESSAGES: {

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

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

BATCH_CHANGE_CREATORS_NO_CHANGE: `There are no creators provided to the batchChangeCreators method to be changed, try adding account IDs to at least one of the fields ${SUPPORT}`,
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

@@ -8,2 +8,8 @@ import { NearContractCall, FtDepositStorageArgs, FtDepositStorageArgsResponse } from '../types';

export declare const ftDepositStorage: ({ ftContractAddress, accountId, }: FtDepositStorageArgs) => NearContractCall<FtDepositStorageArgsResponse>;
export declare const usdcDepositStorage: ({ accountId }: {
accountId: string;
}) => NearContractCall<FtDepositStorageArgsResponse>;
export declare const usdtDepositStorage: ({ accountId }: {
accountId: string;
}) => NearContractCall<FtDepositStorageArgsResponse>;
//# sourceMappingURL=ftDepositStorage.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ftDepositStorage = void 0;
exports.usdtDepositStorage = exports.usdcDepositStorage = exports.ftDepositStorage = void 0;
const config_1 = require("../config/config");
const constants_1 = require("../constants");

@@ -25,2 +26,6 @@ const errorMessages_1 = require("../errorMessages");

exports.ftDepositStorage = ftDepositStorage;
const usdcDepositStorage = ({ accountId }) => (0, exports.ftDepositStorage)({ accountId, ftContractAddress: config_1.mbjs.keys.ftAddresses.usdc });
exports.usdcDepositStorage = usdcDepositStorage;
const usdtDepositStorage = ({ accountId }) => (0, exports.ftDepositStorage)({ accountId, ftContractAddress: config_1.mbjs.keys.ftAddresses.usdt });
exports.usdtDepositStorage = usdtDepositStorage;
//# sourceMappingURL=ftDepositStorage.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.list = void 0;
/* eslint-disable @typescript-eslint/camelcase */
const config_1 = require("../config/config");

@@ -6,0 +5,0 @@ const constants_1 = require("../constants");

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

import { MintOnMetadataArgs, MintOnMetadataArgsResponse, NearContractCall } from '../types';
import { EmptyObject, FtTransferCallArgsResponse, MintOnMetadataArgs, MintOnMetadataArgsResponse, NearContractCall } from '../types';
type DepositAndMintCalls = [NearContractCall<EmptyObject>, NearContractCall<MintOnMetadataArgsResponse | FtTransferCallArgsResponse>];
/**

@@ -7,4 +8,5 @@ * 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

*/
export declare const mintOnMetadata: (args: MintOnMetadataArgs) => NearContractCall<MintOnMetadataArgsResponse>;
export declare function mintOnMetadataDeposit(nTokens: number, price: number): string;
export declare const mintOnMetadata: (args: MintOnMetadataArgs) => DepositAndMintCalls;
export declare function mintOnMetadataDeposit(nTokens: number): string;
export {};
//# sourceMappingURL=mintOnMetadata.d.ts.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, } = 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) {

@@ -45,17 +49,47 @@ throw new Error(errorMessages_1.ERROR_MESSAGES.EMPTY_TOKEN_IDS);

}
return {
contractAddress: contractAddress || config_1.mbjs.keys.contractAddress,
args: {
metadata_id: metadataId,
owner_id: ownerId,
num_to_mint: tokenIds ? null : amountCalc,
token_ids: tokenIds,
const mintArgs = {
metadata_id: metadataId,
owner_id: ownerId,
num_to_mint: tokenIds ? null : amountCalc,
token_ids: tokenIds,
};
const storageDeposit = depositMintingStorage(contractAddress, mintOnMetadataDeposit(amountCalc));
const formattedPrice = (0, createMetadata_1.formatPrice)(price * amountCalc, ftDecimals);
if (ftAddress) {
return [
storageDeposit,
{
contractAddress: ftAddress,
args: {
receiver_id: contractAddress,
amount: formattedPrice,
msg: JSON.stringify(mintArgs),
memo: null,
},
methodName: types_1.FT_METHOD_NAMES.FT_TRANSFER_CALL,
deposit: constants_1.ONE_YOCTO,
gas: constants_1.MAX_GAS,
},
];
}
return [
storageDeposit,
{
contractAddress: contractAddress || config_1.mbjs.keys.contractAddress,
args: mintArgs,
methodName: types_1.TOKEN_METHOD_NAMES.MINT_ON_METADATA,
gas: constants_1.GAS,
deposit: formattedPrice,
},
methodName: types_1.TOKEN_METHOD_NAMES.MINT_ON_METADATA,
gas: constants_1.GAS,
deposit: mintOnMetadataDeposit(amountCalc, price),
};
];
};
exports.mintOnMetadata = mintOnMetadata;
function mintOnMetadataDeposit(nTokens, price) {
const depositMintingStorage = (contractAddress, amount) => ({
contractAddress,
args: {},
methodName: types_1.TOKEN_METHOD_NAMES.DEPOSIT_STORAGE,
gas: constants_1.GAS,
deposit: amount,
});
function mintOnMetadataDeposit(nTokens) {
const totalBytes = constants_1.STORAGE_BYTES.MINTING_BASE +

@@ -65,6 +99,5 @@ constants_1.STORAGE_BYTES.MINTING_FEE +

const storageCost = new bn_js_1.default(`${Math.ceil(totalBytes)}${'0'.repeat(constants_1.STORAGE_PRICE_PER_BYTE_EXPONENT)}`);
const priceCost = new bn_js_1.default(`1${'0'.repeat(24)}`).muln(price).muln(nTokens);
return storageCost.add(priceCost).toString();
return storageCost.toString();
}
exports.mintOnMetadataDeposit = mintOnMetadataDeposit;
//# sourceMappingURL=mintOnMetadata.js.map

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

import { SetMintingCapArgs, NearContractCall } from '../types';
import { SetMintingCapArgs, NearContractCall, SetMintingCapArgsResponse } from '../types';
/**

@@ -7,3 +7,3 @@ * Deposits 0.01 * listAmount of near to the market contract to be consumed for listing purposes

*/
export declare const setMintingCap: (args: SetMintingCapArgs) => NearContractCall<{}>;
export declare const setMintingCap: (args: SetMintingCapArgs) => NearContractCall<SetMintingCapArgsResponse>;
//# sourceMappingURL=setMintingCap.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setSplits = void 0;
/* eslint-disable @typescript-eslint/camelcase */
const config_1 = require("../config/config");

@@ -6,0 +5,0 @@ const constants_1 = require("../constants");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.transferContractOwnership = void 0;
/* eslint-disable @typescript-eslint/camelcase */
const config_1 = require("../config/config");

@@ -6,0 +5,0 @@ const constants_1 = require("../constants");

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

SET_SPLITS = "set_split_owners",
SET_MINTING_CAP = "set_minting_cap"
SET_MINTING_CAP = "set_minting_cap",
DEPOSIT_STORAGE = "deposit_storage"
}

@@ -105,3 +106,3 @@ export declare enum MARKET_METHOD_NAMES {

connectProxyAddress?: string;
ftAddresses: FtAddresses | '';
ftAddresses: FtAddresses;
checkVersions?: boolean;

@@ -128,3 +129,3 @@ }

export type CallBackArgs = {
args: object;
args: Record<string, unknown>;
type: TransactionSuccessEnum;

@@ -218,5 +219,8 @@ };

maxSupply?: number;
lastPossibleMint?: Date;
startsAt?: Date;
expiresAt?: Date;
isDynamic?: boolean;
price: number;
ftAddress?: string;
ftDecimals?: number;
noMedia?: boolean;

@@ -232,2 +236,4 @@ noReference?: boolean;

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

@@ -373,5 +379,7 @@ export type UpdateMetadataArgs = {

max_supply?: number;
last_possible_mint?: string;
starts_at?: string;
expires_at?: string;
is_dynamic?: boolean;
price: string;
ft_contract_id?: string;
}

@@ -410,2 +418,5 @@ export interface MintOnMetadataArgsResponse {

}
export type SetMintingCapArgsResponse = {
minting_cap: number;
};
export interface FtTransferArgsResponse {

@@ -416,2 +427,8 @@ receiver_id: string;

}
export interface FtTransferCallArgsResponse {
receiver_id: string;
amount: string;
memo: string | null;
msg: string;
}
export interface FtDepositStorageArgsResponse {

@@ -422,2 +439,4 @@ account_id: string;

export type FinalExecutionOutcome = FEO;
export type EmptyObject = Record<string, never>;
export type AnyObject = Record<string, unknown>;
//# sourceMappingURL=types.d.ts.map

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

TOKEN_METHOD_NAMES["SET_MINTING_CAP"] = "set_minting_cap";
TOKEN_METHOD_NAMES["DEPOSIT_STORAGE"] = "deposit_storage";
})(TOKEN_METHOD_NAMES = exports.TOKEN_METHOD_NAMES || (exports.TOKEN_METHOD_NAMES = {}));

@@ -24,0 +25,0 @@ var MARKET_METHOD_NAMES;

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

gas: constants_1.GAS,
deposit: '1',
deposit: '1', // FIXME: should cover storage, not only 1 yocto.
};

@@ -43,0 +43,0 @@ };

@@ -6,2 +6,8 @@ import { Splits } from './types';

export declare function isIntString(x: string): boolean;
/**
* Converts Date object into string representation of its unix timestamp in mircoseconds.
* @param date
* @returns timestamp in miliseconds
*/
export declare function dateToTimestamp(date: Date): string;
export declare function processRoyalties(royalties: Splits | null | undefined): {

@@ -8,0 +14,0 @@ royaltyTotal: number;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.processRoyalties = exports.isIntString = exports.standardizeString = exports.isStoreV2 = exports.isStoreV1 = void 0;
exports.processRoyalties = exports.dateToTimestamp = exports.isIntString = exports.standardizeString = exports.isStoreV2 = exports.isStoreV1 = void 0;
const config_1 = require("./config/config");

@@ -22,2 +22,11 @@ const errorMessages_1 = require("./errorMessages");

exports.isIntString = isIntString;
/**
* Converts Date object into string representation of its unix timestamp in mircoseconds.
* @param date
* @returns timestamp in miliseconds
*/
function dateToTimestamp(date) {
return (date.getTime() * 1e6).toString();
}
exports.dateToTimestamp = dateToTimestamp;
function processRoyalties(royalties) {

@@ -24,0 +33,0 @@ if (!royalties) {

{
"name": "@mintbase-js/sdk",
"version": "0.5.9-dynamic-nft-metadata-type-exports-fc380a2.0",
"version": "0.6.0-add-bitte-wallet-3fd6031.0",
"description": "Core functions for Mintbase JS SDK",

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

},
"gitHead": "5f9ffed8830166e8ed423c69627664fbd0f598fe"
"gitHead": "444942672c6407dc5bc21c67797f8ee93720fa08"
}

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

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

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