@medialane/sdk 0.35.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +62 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +54 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6319,13 +6319,19 @@ async function getCreatorCoinPrice(coinAddress, provider) {
|
|
|
6319
6319
|
const quotePerCoin = (quoteIsToken0 ? 1 / priceT1perT0 : priceT1perT0) * decAdj;
|
|
6320
6320
|
return { quotePerCoin, quoteToken, quoteSymbol: token?.symbol ?? null, quoteDecimals };
|
|
6321
6321
|
}
|
|
6322
|
-
var
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6322
|
+
var _factoryContract = null;
|
|
6323
|
+
function factoryContract() {
|
|
6324
|
+
if (!_factoryContract) {
|
|
6325
|
+
_factoryContract = new starknet.Contract(
|
|
6326
|
+
CreatorCoinFactoryABI,
|
|
6327
|
+
CREATOR_COIN_FACTORY_CONTRACT_MAINNET
|
|
6328
|
+
);
|
|
6329
|
+
}
|
|
6330
|
+
return _factoryContract;
|
|
6331
|
+
}
|
|
6326
6332
|
function buildCreateCreatorCoinCall(params) {
|
|
6327
6333
|
const salt = params.salt ?? BigInt("0x" + Date.now().toString(16));
|
|
6328
|
-
return factoryContract.populate("create_creator_coin", [
|
|
6334
|
+
return factoryContract().populate("create_creator_coin", [
|
|
6329
6335
|
params.owner,
|
|
6330
6336
|
params.name,
|
|
6331
6337
|
params.symbol,
|
|
@@ -6358,7 +6364,7 @@ function buildLaunchOnEkuboCalls(params) {
|
|
|
6358
6364
|
calldata: [CREATOR_COIN_FACTORY_CONTRACT_MAINNET, amt.low, amt.high]
|
|
6359
6365
|
});
|
|
6360
6366
|
}
|
|
6361
|
-
calls.push(factoryContract.populate("launch_on_ekubo", [launchParameters, ekuboParameters]));
|
|
6367
|
+
calls.push(factoryContract().populate("launch_on_ekubo", [launchParameters, ekuboParameters]));
|
|
6362
6368
|
return calls;
|
|
6363
6369
|
}
|
|
6364
6370
|
var CREATOR_COIN_CREATED_SELECTOR = starknet.hash.getSelectorFromName("CreatorCoinCreated");
|
|
@@ -6463,6 +6469,46 @@ var MedialaneClient = class {
|
|
|
6463
6469
|
// src/types/api.ts
|
|
6464
6470
|
var OPEN_LICENSES = ["CC0", "CC BY", "CC BY-SA", "CC BY-NC"];
|
|
6465
6471
|
|
|
6472
|
+
// src/services/coinLaunchMath.ts
|
|
6473
|
+
var COIN_DECIMALS2 = 18;
|
|
6474
|
+
var LAUNCH_PRICE_QUOTE_PER_COIN = 0.01;
|
|
6475
|
+
var MIN_SUPPLY = 1000n;
|
|
6476
|
+
var MAX_SUPPLY = 1000000000000n;
|
|
6477
|
+
var MAX_FELT_BYTES = 31;
|
|
6478
|
+
function byteLen(s) {
|
|
6479
|
+
return new TextEncoder().encode(s).length;
|
|
6480
|
+
}
|
|
6481
|
+
function validateName(s) {
|
|
6482
|
+
if (!s.trim()) return "Name is required";
|
|
6483
|
+
if (byteLen(s) > MAX_FELT_BYTES) return `Name must be at most ${MAX_FELT_BYTES} bytes`;
|
|
6484
|
+
return null;
|
|
6485
|
+
}
|
|
6486
|
+
function validateSymbol(s) {
|
|
6487
|
+
if (!s.trim()) return "Symbol is required";
|
|
6488
|
+
if (byteLen(s) > MAX_FELT_BYTES) return `Symbol must be at most ${MAX_FELT_BYTES} bytes`;
|
|
6489
|
+
return null;
|
|
6490
|
+
}
|
|
6491
|
+
function validateSupply(human) {
|
|
6492
|
+
if (!/^\d+$/.test(human.trim())) return "Supply must be a whole number";
|
|
6493
|
+
const v = BigInt(human.trim());
|
|
6494
|
+
if (v < MIN_SUPPLY) return `Supply must be at least ${MIN_SUPPLY.toString()}`;
|
|
6495
|
+
if (v > MAX_SUPPLY) return `Supply must be at most ${MAX_SUPPLY.toString()}`;
|
|
6496
|
+
return null;
|
|
6497
|
+
}
|
|
6498
|
+
function toRaw(human, decimals = COIN_DECIMALS2) {
|
|
6499
|
+
return human * 10n ** BigInt(decimals);
|
|
6500
|
+
}
|
|
6501
|
+
function teamCoinsRaw(supplyRaw, pct) {
|
|
6502
|
+
const bps = BigInt(Math.round(pct * 100));
|
|
6503
|
+
return supplyRaw * bps / 10000n;
|
|
6504
|
+
}
|
|
6505
|
+
function buybackQuoteRaw(teamCoinsRawValue, quoteDecimals) {
|
|
6506
|
+
return teamCoinsRawValue * 10n ** BigInt(quoteDecimals) / (100n * 10n ** BigInt(COIN_DECIMALS2));
|
|
6507
|
+
}
|
|
6508
|
+
function fdvHuman(supplyHuman) {
|
|
6509
|
+
return supplyHuman * LAUNCH_PRICE_QUOTE_PER_COIN;
|
|
6510
|
+
}
|
|
6511
|
+
|
|
6466
6512
|
// src/services/registry.ts
|
|
6467
6513
|
var SERVICES = {
|
|
6468
6514
|
"mip-erc721": {
|
|
@@ -6656,6 +6702,8 @@ function getServicesByCapability(cap) {
|
|
|
6656
6702
|
}
|
|
6657
6703
|
|
|
6658
6704
|
exports.ApiClient = ApiClient;
|
|
6705
|
+
exports.COIN_MAX_SUPPLY = MAX_SUPPLY;
|
|
6706
|
+
exports.COIN_MIN_SUPPLY = MIN_SUPPLY;
|
|
6659
6707
|
exports.COLLECTION_1155_CLASS_HASH_MAINNET = COLLECTION_1155_CLASS_HASH_MAINNET;
|
|
6660
6708
|
exports.COLLECTION_1155_CONTRACT_MAINNET = COLLECTION_1155_CONTRACT_MAINNET;
|
|
6661
6709
|
exports.COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET = COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET;
|
|
@@ -6686,6 +6734,7 @@ exports.IPCollectionABI = IPCollectionABI;
|
|
|
6686
6734
|
exports.IPMarketplaceABI = IPMarketplaceABI;
|
|
6687
6735
|
exports.IPNFT_CLASS_HASH_MAINNET = IPNFT_CLASS_HASH_MAINNET;
|
|
6688
6736
|
exports.IPNftABI = IPNftABI;
|
|
6737
|
+
exports.LAUNCH_PRICE_QUOTE_PER_COIN = LAUNCH_PRICE_QUOTE_PER_COIN;
|
|
6689
6738
|
exports.MARKETPLACE_1155_CLASS_HASH_MAINNET = MARKETPLACE_1155_CLASS_HASH_MAINNET;
|
|
6690
6739
|
exports.MARKETPLACE_1155_CONTRACT_MAINNET = MARKETPLACE_1155_CONTRACT_MAINNET;
|
|
6691
6740
|
exports.MARKETPLACE_1155_START_BLOCK_MAINNET = MARKETPLACE_1155_START_BLOCK_MAINNET;
|
|
@@ -6716,8 +6765,11 @@ exports.buildCreateCreatorCoinCall = buildCreateCreatorCoinCall;
|
|
|
6716
6765
|
exports.buildFeeCall = buildFeeCall;
|
|
6717
6766
|
exports.buildLaunchOnEkuboCalls = buildLaunchOnEkuboCalls;
|
|
6718
6767
|
exports.buildOrderTypedData = buildOrderTypedData;
|
|
6768
|
+
exports.buybackQuoteRaw = buybackQuoteRaw;
|
|
6769
|
+
exports.coinToRaw = toRaw;
|
|
6719
6770
|
exports.createFailoverFetch = createFailoverFetch;
|
|
6720
6771
|
exports.encodeByteArray = encodeByteArray;
|
|
6772
|
+
exports.fdvHuman = fdvHuman;
|
|
6721
6773
|
exports.formatAmount = formatAmount;
|
|
6722
6774
|
exports.getCreatorCoinPrice = getCreatorCoinPrice;
|
|
6723
6775
|
exports.getListableTokens = getListableTokens;
|
|
@@ -6736,6 +6788,10 @@ exports.resolveConfig = resolveConfig;
|
|
|
6736
6788
|
exports.resolveFeeConfig = resolveFeeConfig;
|
|
6737
6789
|
exports.shortenAddress = shortenAddress;
|
|
6738
6790
|
exports.stringifyBigInts = stringifyBigInts;
|
|
6791
|
+
exports.teamCoinsRaw = teamCoinsRaw;
|
|
6739
6792
|
exports.u256ToBigInt = u256ToBigInt;
|
|
6793
|
+
exports.validateCoinName = validateName;
|
|
6794
|
+
exports.validateCoinSupply = validateSupply;
|
|
6795
|
+
exports.validateCoinSymbol = validateSymbol;
|
|
6740
6796
|
//# sourceMappingURL=index.cjs.map
|
|
6741
6797
|
//# sourceMappingURL=index.cjs.map
|