@medialane/sdk 0.97.0 → 0.98.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.
@@ -599,6 +599,7 @@ interface LaunchCoinIntentParams {
599
599
  owner: string;
600
600
  creatorCoin: string;
601
601
  quoteToken: string;
602
+ price: number;
602
603
  initialHolders: string[];
603
604
  initialHoldersAmounts: string[];
604
605
  transferRestrictionDelay?: number;
@@ -599,6 +599,7 @@ interface LaunchCoinIntentParams {
599
599
  owner: string;
600
600
  creatorCoin: string;
601
601
  quoteToken: string;
602
+ price: number;
602
603
  initialHolders: string[];
603
604
  initialHoldersAmounts: string[];
604
605
  transferRestrictionDelay?: number;
@@ -10269,7 +10269,7 @@ var ERC1155CollectionService = class {
10269
10269
 
10270
10270
  // src/starknet/services/coinLaunchMath.ts
10271
10271
  var COIN_DECIMALS = 18;
10272
- var LAUNCH_PRICE_QUOTE_PER_COIN = 0.01;
10272
+ var SUGGESTED_DEFAULT_PRICE = 0.01;
10273
10273
  var MIN_SUPPLY = 1000n;
10274
10274
  var MAX_SUPPLY = 1000000000000n;
10275
10275
  var MAX_FELT_BYTES = 31;
@@ -10300,11 +10300,13 @@ function teamCoinsRaw(supplyRaw, pct) {
10300
10300
  const bps = BigInt(Math.round(pct * 100));
10301
10301
  return supplyRaw * bps / 10000n;
10302
10302
  }
10303
- function buybackQuoteRaw(teamCoinsRawValue, quoteDecimals) {
10304
- return teamCoinsRawValue * 10n ** BigInt(quoteDecimals) / (100n * 10n ** BigInt(COIN_DECIMALS));
10303
+ var PRICE_SCALE = 1000000000000n;
10304
+ function buybackQuoteRaw(teamCoinsRawValue, price, quoteDecimals) {
10305
+ const priceScaled = BigInt(Math.round(price * Number(PRICE_SCALE)));
10306
+ return teamCoinsRawValue * priceScaled * 10n ** BigInt(quoteDecimals) / (PRICE_SCALE * 10n ** BigInt(COIN_DECIMALS));
10305
10307
  }
10306
- function fdvHuman(supplyHuman) {
10307
- return supplyHuman * LAUNCH_PRICE_QUOTE_PER_COIN;
10308
+ function fdvHuman(supplyHuman, price) {
10309
+ return supplyHuman * price;
10308
10310
  }
10309
10311
 
10310
10312
  // src/starknet/services/creatorCoin.ts
@@ -10315,8 +10317,8 @@ var VALIDATED_EKUBO_PARAMS = {
10315
10317
  bound: 88719042n
10316
10318
  };
10317
10319
  var TICK_BASE = 1.000001;
10318
- function priceToEkuboParams(quoteDecimals, price = LAUNCH_PRICE_QUOTE_PER_COIN) {
10319
- const decAdj = 10 ** (COIN_DECIMALS2 - quoteDecimals);
10320
+ function priceToEkuboParams(quoteDecimals, price = SUGGESTED_DEFAULT_PRICE) {
10321
+ const decAdj = 10 ** (COIN_DECIMALS - quoteDecimals);
10320
10322
  const rawRatio = price / decAdj;
10321
10323
  const tickSpacing = Number(VALIDATED_EKUBO_PARAMS.tickSpacing);
10322
10324
  const rawTick = Math.log(rawRatio) / Math.log(TICK_BASE);
@@ -10328,6 +10330,17 @@ function priceToEkuboParams(quoteDecimals, price = LAUNCH_PRICE_QUOTE_PER_COIN)
10328
10330
  bound: VALIDATED_EKUBO_PARAMS.bound
10329
10331
  };
10330
10332
  }
10333
+ function validatePrice(quoteDecimals, price) {
10334
+ if (!isFinite(price) || price <= 0) return "Price must be a positive number";
10335
+ const decAdj = 10 ** (COIN_DECIMALS - quoteDecimals);
10336
+ const rawRatio = price / decAdj;
10337
+ if (!isFinite(rawRatio) || rawRatio <= 0) return "Price must be a positive number";
10338
+ const rawTick = Math.log(rawRatio) / Math.log(TICK_BASE);
10339
+ if (!isFinite(rawTick)) return "Price is outside the supported range";
10340
+ const bound = Number(VALIDATED_EKUBO_PARAMS.bound);
10341
+ if (Math.abs(rawTick) >= bound) return "Price is outside the supported range";
10342
+ return null;
10343
+ }
10331
10344
  var MAX_TEAM_ALLOCATION_PERCENT = 10;
10332
10345
  var MAX_HOLDERS_AT_LAUNCH = 10;
10333
10346
  function u256(parts, offset = 0) {
@@ -10360,7 +10373,6 @@ async function getCreatorCoinGuarantees(coinAddress, provider) {
10360
10373
  liquidityPositionId
10361
10374
  };
10362
10375
  }
10363
- var COIN_DECIMALS2 = 18;
10364
10376
  var _factoryContract = null;
10365
10377
  function factoryContract() {
10366
10378
  if (!_factoryContract) {
@@ -10382,7 +10394,7 @@ function buildCreateCreatorCoinCall(params) {
10382
10394
  ]);
10383
10395
  }
10384
10396
  function buildLaunchOnEkuboCalls(params) {
10385
- const ek = params.ekubo ?? VALIDATED_EKUBO_PARAMS;
10397
+ const ek = params.ekubo;
10386
10398
  const launchParameters = {
10387
10399
  creator_coin_address: params.creatorCoin,
10388
10400
  transfer_restriction_delay: params.transferRestrictionDelay ?? 0,
@@ -11727,7 +11739,6 @@ exports.IPNftABI = IPNftABI;
11727
11739
  exports.IPSponsorshipABI = IPSponsorshipABI;
11728
11740
  exports.IPTicketCollectionABI = IPTicketCollectionABI;
11729
11741
  exports.IPTicketCollectionFactoryABI = IPTicketCollectionFactoryABI;
11730
- exports.LAUNCH_PRICE_QUOTE_PER_COIN = LAUNCH_PRICE_QUOTE_PER_COIN;
11731
11742
  exports.MAX_HOLDERS_AT_LAUNCH = MAX_HOLDERS_AT_LAUNCH;
11732
11743
  exports.MAX_TEAM_ALLOCATION_PERCENT = MAX_TEAM_ALLOCATION_PERCENT;
11733
11744
  exports.Medialane1155ABI = Medialane1155ABI;
@@ -11736,6 +11747,7 @@ exports.MedialaneError = MedialaneError;
11736
11747
  exports.POPCollectionABI = POPCollectionABI;
11737
11748
  exports.POPFactoryABI = POPFactoryABI;
11738
11749
  exports.PopService = PopService;
11750
+ exports.SUGGESTED_DEFAULT_PRICE = SUGGESTED_DEFAULT_PRICE;
11739
11751
  exports.SponsorshipService = SponsorshipService;
11740
11752
  exports.StarknetVenue = StarknetVenue;
11741
11753
  exports.TicketService = TicketService;
@@ -11797,6 +11809,7 @@ exports.unsealPrivateKey = unsealPrivateKey;
11797
11809
  exports.validateCoinName = validateName;
11798
11810
  exports.validateCoinSupply = validateSupply;
11799
11811
  exports.validateCoinSymbol = validateSymbol;
11812
+ exports.validatePrice = validatePrice;
11800
11813
  exports.verifyAdminRequestSig = verifyAdminRequestSig;
11801
11814
  //# sourceMappingURL=index.cjs.map
11802
11815
  //# sourceMappingURL=index.cjs.map