@medialane/sdk 0.91.0 → 0.93.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.
@@ -10332,14 +10332,43 @@ function priceToEkuboParams(quoteDecimals, price = LAUNCH_PRICE_QUOTE_PER_COIN)
10332
10332
  bound: VALIDATED_EKUBO_PARAMS.bound
10333
10333
  };
10334
10334
  }
10335
+ var MAX_TEAM_ALLOCATION_PERCENT = 10;
10336
+ var MAX_HOLDERS_AT_LAUNCH = 10;
10337
+ function u256(parts, offset = 0) {
10338
+ return BigInt(parts[offset] ?? "0x0") + (BigInt(parts[offset + 1] ?? "0x0") << 128n);
10339
+ }
10340
+ async function getCreatorCoinGuarantees(coinAddress, provider) {
10341
+ const call = (entrypoint) => provider.callContract({ contractAddress: coinAddress, entrypoint, calldata: [] });
10342
+ const [launchedRes, supplyRes, allocRes, blockRes, liquidityRes] = await Promise.all([
10343
+ call("is_launched"),
10344
+ call("total_supply"),
10345
+ call("get_team_allocation"),
10346
+ call("launched_at_block_number").catch(() => null),
10347
+ call("liquidity_type").catch(() => null)
10348
+ ]);
10349
+ const isLaunched = BigInt(launchedRes[0] ?? "0x0") !== 0n;
10350
+ const totalSupply = u256(supplyRes);
10351
+ const teamAllocation = u256(allocRes);
10352
+ const teamAllocationPercent = totalSupply > 0n ? Number(teamAllocation * 10000n / totalSupply) / 100 : null;
10353
+ const launchedAtBlock = isLaunched && blockRes?.[0] != null ? Number(BigInt(blockRes[0])) : null;
10354
+ const liquidityPositionId = liquidityRes && BigInt(liquidityRes[0] ?? "0x1") === 0n && liquidityRes[2] != null ? BigInt(liquidityRes[2]).toString() : null;
10355
+ return {
10356
+ isLaunched,
10357
+ launchedAtBlock,
10358
+ totalSupplyRaw: totalSupply.toString(),
10359
+ teamAllocationRaw: teamAllocation.toString(),
10360
+ teamAllocationPercent,
10361
+ liquidityPositionId
10362
+ };
10363
+ }
10335
10364
  var COIN_DECIMALS2 = 18;
10336
- async function getCreatorCoinPrice(coinAddress, provider) {
10365
+ async function getCreatorCoinMarket(coinAddress, provider) {
10337
10366
  const r = await provider.callContract({
10338
10367
  contractAddress: coinAddress,
10339
10368
  entrypoint: "launched_with_liquidity_parameters",
10340
10369
  calldata: []
10341
10370
  });
10342
- if (BigInt(r[0]) !== 0n || BigInt(r[1]) !== 0n) return null;
10371
+ if (BigInt(r[0]) !== 0n || BigInt(r[1]) !== 0n) return { status: "pre-launch" };
10343
10372
  const fee = r[2];
10344
10373
  const tickSpacing = r[3];
10345
10374
  const quoteToken = normalizeAddress("STARKNET", "0x" + BigInt(r[7]).toString(16));
@@ -10358,7 +10387,10 @@ async function getCreatorCoinPrice(coinAddress, provider) {
10358
10387
  const priceT1perT0 = (Number(sqrt) / 2 ** 128) ** 2;
10359
10388
  const decAdj = 10 ** (COIN_DECIMALS2 - quoteDecimals);
10360
10389
  const quotePerCoin = (quoteIsToken0 ? 1 / priceT1perT0 : priceT1perT0) * decAdj;
10361
- return { quotePerCoin, quoteToken, quoteSymbol: token?.symbol ?? null, quoteDecimals };
10390
+ return {
10391
+ status: "live",
10392
+ price: { quotePerCoin, quoteToken, quoteSymbol: token?.symbol ?? null, quoteDecimals }
10393
+ };
10362
10394
  }
10363
10395
  var _factoryContract = null;
10364
10396
  function factoryContract() {
@@ -10447,8 +10479,8 @@ var CreatorCoinService = class {
10447
10479
  const r = await this._factory(account).is_creator_coin(address);
10448
10480
  return BigInt(r) === 1n;
10449
10481
  }
10450
- async getPrice(coinAddress) {
10451
- return getCreatorCoinPrice(coinAddress, new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl }));
10482
+ async getMarket(coinAddress) {
10483
+ return getCreatorCoinMarket(coinAddress, new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl }));
10452
10484
  }
10453
10485
  };
10454
10486
  var TicketService = class {
@@ -11727,6 +11759,8 @@ exports.IPSponsorshipABI = IPSponsorshipABI;
11727
11759
  exports.IPTicketCollectionABI = IPTicketCollectionABI;
11728
11760
  exports.IPTicketCollectionFactoryABI = IPTicketCollectionFactoryABI;
11729
11761
  exports.LAUNCH_PRICE_QUOTE_PER_COIN = LAUNCH_PRICE_QUOTE_PER_COIN;
11762
+ exports.MAX_HOLDERS_AT_LAUNCH = MAX_HOLDERS_AT_LAUNCH;
11763
+ exports.MAX_TEAM_ALLOCATION_PERCENT = MAX_TEAM_ALLOCATION_PERCENT;
11730
11764
  exports.Medialane1155ABI = Medialane1155ABI;
11731
11765
  exports.MedialaneClient = MedialaneClient;
11732
11766
  exports.MedialaneError = MedialaneError;
@@ -11767,7 +11801,8 @@ exports.fdvHuman = fdvHuman;
11767
11801
  exports.generateStarkKeyPair = generateStarkKeyPair;
11768
11802
  exports.getCounter = getCounter;
11769
11803
  exports.getCounter1155 = getCounter1155;
11770
- exports.getCreatorCoinPrice = getCreatorCoinPrice;
11804
+ exports.getCreatorCoinGuarantees = getCreatorCoinGuarantees;
11805
+ exports.getCreatorCoinMarket = getCreatorCoinMarket;
11771
11806
  exports.getEscape = getEscape;
11772
11807
  exports.getEscapeSecurityPeriod = getEscapeSecurityPeriod;
11773
11808
  exports.getGuardians = getGuardians;