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-metadata-start-date-9eda88b.0 to 0.6.0-najs-v4-5c6461e.0

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, 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);

@@ -50,6 +53,6 @@ return {

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

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

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

const constants_1 = require("../constants");
const errorMessages_1 = require("../errorMessages");
const types_1 = require("../types");

@@ -17,2 +18,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 +46,3 @@ return {

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

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

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

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

import type { providers } from 'near-api-js';
import type { ComposableCall, NearExecuteOptions } from '../types';
import { FinalExecutionOutcome } from '@near-wallet-selector/core';
/**

@@ -10,3 +10,3 @@ * Base method for executing contract calls.

*/
export declare const execute: ({ wallet, account, callbackUrl, callbackArgs }: NearExecuteOptions, ...calls: ComposableCall[]) => Promise<void | providers.FinalExecutionOutcome | providers.FinalExecutionOutcome[]>;
export declare const execute: ({ wallet, account, callbackUrl, callbackArgs }: NearExecuteOptions, ...calls: ComposableCall[]) => Promise<void | FinalExecutionOutcome | FinalExecutionOutcome[]>;
//# sourceMappingURL=execute.d.ts.map
import type { Wallet, FinalExecutionOutcome } from '@near-wallet-selector/core';
import type { providers, Account } from 'near-api-js';
import type { Account } from 'near-api-js';
import type { CallBackArgs, ContractCall, TxnOptionalSignerId, NearExecuteOptions, ExecuteArgsResponse, ComposableCall } from '../types';

@@ -13,3 +13,3 @@ /**

export declare const callbackUrlFormatter: (callbackUrl: string, callbackArgs: CallBackArgs) => string;
export declare const genericBatchExecute: (call: ContractCall<ExecuteArgsResponse>[], wallet: Wallet, account: Account, callbackUrl: string, callbackArgs: CallBackArgs) => Promise<void | providers.FinalExecutionOutcome[]>;
export declare const genericBatchExecute: (call: ContractCall<ExecuteArgsResponse>[], wallet: Wallet, account: Account, callbackUrl: string, callbackArgs: CallBackArgs) => Promise<void | FinalExecutionOutcome[]>;
export declare const convertGenericCallToWalletCall: (call: ContractCall<ExecuteArgsResponse>) => TxnOptionalSignerId;

@@ -16,0 +16,0 @@ export declare function flattenArgs(calls: ComposableCall[]): ContractCall<ExecuteArgsResponse>[];

@@ -11,8 +11,4 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateSigningOptions = exports.flattenArgs = exports.convertGenericCallToWalletCall = exports.genericBatchExecute = exports.callbackUrlFormatter = exports.checkCallbackUrl = void 0;
const bn_js_1 = __importDefault(require("bn.js"));
const errors_1 = require("../errors");

@@ -92,3 +88,3 @@ /**

try {
outcomes.push(yield account.functionCall(Object.assign({ contractId: call.contractAddress, methodName: call.methodName, args: call.args, gas: new bn_js_1.default(call.gas), attachedDeposit: new bn_js_1.default(call.deposit) }, (callbackUrl && { walletCallbackUrl: callbackUrl }))));
outcomes.push(yield account.functionCall(Object.assign({ contractId: call.contractAddress, methodName: call.methodName, args: call.args, gas: BigInt(call.gas.toString()), attachedDeposit: BigInt(call.deposit.toString()) }, (callbackUrl && { walletCallbackUrl: callbackUrl }))));
}

@@ -102,4 +98,3 @@ catch (err) {

const batchExecuteWithBrowserWallet = (calls, wallet, callback, callbackArgs) => __awaiter(void 0, void 0, void 0, function* () {
const res = yield wallet.signAndSendTransactions(Object.assign(Object.assign({ transactions: calls.map(exports.convertGenericCallToWalletCall) }, (callback && { callbackUrl: callback })), (callbackArgs && { callbackArgs: callbackArgs })));
return res;
return wallet.signAndSendTransactions(Object.assign(Object.assign({ transactions: calls.map(exports.convertGenericCallToWalletCall) }, (callback && { callbackUrl: callback })), (callbackArgs && { callbackArgs: callbackArgs })));
});

@@ -106,0 +101,0 @@ const convertGenericCallToWalletCall = (call) => {

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

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

import { Wallet } from '@near-wallet-selector/core';
import BN from 'bn.js';
import { Account } from 'near-api-js';
import { Account, providers } from 'near-api-js';
import type { Optional, Transaction } from '@near-wallet-selector/core';
import type { FinalExecutionOutcome as FEO } from '@near-wallet-selector/core';
export declare enum TOKEN_METHOD_NAMES {

@@ -105,3 +104,3 @@ TRANSFER = "nft_transfer",

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

@@ -222,2 +221,3 @@ }

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

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

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

@@ -431,5 +432,5 @@ export type UpdateMetadataArgs = {

export type ExecuteArgsResponse = TransferArgsResponse | ListArgsResponse | MintArgsV1Response | MinterArgsResponse | DeployContractArgsResponse | DelistMultipleArgsResponse | BuyArgsResponse | BuyArgsFtResponse | BurnArgsResponse | TransferContractOwnershipArgsResponse | ExecuteExtraArgsResponse | FtTransferArgsResponse | CreateMetadataArgsResponse | MintOnMetadataArgsResponse | UpdateMetadataArgsResponse | LockMetadataArgsResponse | BatchChangeMintersArgsResponse | Record<string, unknown>;
export type FinalExecutionOutcome = FEO;
export type FinalExecutionOutcome = providers.FinalExecutionOutcome;
export type EmptyObject = Record<string, never>;
export type AnyObject = Record<string, unknown>;
//# sourceMappingURL=types.d.ts.map

@@ -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.6.0-metadata-start-date-9eda88b.0",
"version": "0.6.0-najs-v4-5c6461e.0",
"description": "Core functions for Mintbase JS SDK",

@@ -23,9 +23,5 @@ "main": "lib/index.js",

"dependencies": {
"bn.js": "5.2.1",
"near-api-js": "^2.1.4"
"near-api-js": "^4.0.0"
},
"devDependencies": {
"@near-wallet-selector/core": "8.9.3"
},
"gitHead": "07356ffb3c60719045c29714ad5f0abad70915c6"
"gitHead": "d7487a8c11e452ba8fc5e4cf201d7f69ddec8c1b"
}

@@ -47,3 +47,3 @@ [//]: # `{ "title": "@mintbase-js/sdk", "order": "0" }`

calls: NearContractCall[],
): Promise<providers.FinalExecutionOutcome | providers.FinalExecutionOutcome[]>
): Promise<FinalExecutionOutcome | FinalExecutionOutcome[]>
```

@@ -50,0 +50,0 @@ Here is an example using the execute function call:

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