@medialane/sdk 0.28.0 → 0.29.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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { cairo, num, Contract, TypedDataRevision, shortString, constants, RpcProvider } from 'starknet';
2
+ import { cairo, num, Contract, uint256, TypedDataRevision, shortString, constants, RpcProvider } from 'starknet';
3
3
 
4
4
  // src/config.ts
5
5
 
@@ -59,6 +59,11 @@ var COLLECTION_1155_CONTRACT_MAINNET = "0x067064adcaaed61e17bf50ea802ea648233612
59
59
  var COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET = "0x188321a7c9ca972cc63e352e3b3a4cdf33781852d957f4b4b62249310fe4c75";
60
60
  var COLLECTION_1155_CLASS_HASH_MAINNET = "0x281e13803c906f20bbe158efb44b7a0273c56fdebbeeb55b2ba59530ddb1c80";
61
61
  var COLLECTION_1155_START_BLOCK_MAINNET = 10045611;
62
+ var CREATOR_COIN_FACTORY_CONTRACT_MAINNET = "0x50fa807b5274079fb19374673d7bab6d2dc3af7e1032ea43eb6e44bcbde4c3c";
63
+ var CREATOR_COIN_EKUBO_LAUNCHER_MAINNET = "0x4f7fceb5ac10f12f9544a09580592e5bdf1b7f04f48765eecf12286d8ccb7b4";
64
+ var CREATOR_COIN_CLASS_HASH_MAINNET = "0x743e4c8a5b96bb83bbf4af04edbbb482d5ece89eed9b729a79fb7df0cd0b6b6";
65
+ var CREATOR_COIN_FACTORY_CLASS_HASH_MAINNET = "0x51765926b1344c9a20b8cd4b5abe7b7d47375ae97cf6804db3ea5d4b05a9b55";
66
+ var CREATOR_COIN_START_BLOCK_MAINNET = 10474544;
62
67
  var FeeConfigSchema = z.object({
63
68
  enabled: z.boolean().default(true),
64
69
  fundAddress: z.string().min(1).optional(),
@@ -4627,6 +4632,9 @@ var IPNftABI = [
4627
4632
  }
4628
4633
  ];
4629
4634
 
4635
+ // src/abis/creatorCoinFactory.ts
4636
+ var CreatorCoinFactoryABI = [{ "type": "impl", "name": "FactoryImpl", "interface_name": "creator_coin::factory::interface::IFactory" }, { "type": "struct", "name": "core::integer::u256", "members": [{ "name": "low", "type": "core::integer::u128" }, { "name": "high", "type": "core::integer::u128" }] }, { "type": "struct", "name": "core::array::Span::<core::starknet::contract_address::ContractAddress>", "members": [{ "name": "snapshot", "type": "@core::array::Array::<core::starknet::contract_address::ContractAddress>" }] }, { "type": "struct", "name": "core::array::Span::<core::integer::u256>", "members": [{ "name": "snapshot", "type": "@core::array::Array::<core::integer::u256>" }] }, { "type": "struct", "name": "creator_coin::factory::LaunchParameters", "members": [{ "name": "creator_coin_address", "type": "core::starknet::contract_address::ContractAddress" }, { "name": "transfer_restriction_delay", "type": "core::integer::u64" }, { "name": "max_percentage_buy_launch", "type": "core::integer::u16" }, { "name": "quote_address", "type": "core::starknet::contract_address::ContractAddress" }, { "name": "initial_holders", "type": "core::array::Span::<core::starknet::contract_address::ContractAddress>" }, { "name": "initial_holders_amounts", "type": "core::array::Span::<core::integer::u256>" }] }, { "type": "enum", "name": "core::bool", "variants": [{ "name": "False", "type": "()" }, { "name": "True", "type": "()" }] }, { "type": "struct", "name": "ekubo::types::i129::i129", "members": [{ "name": "mag", "type": "core::integer::u128" }, { "name": "sign", "type": "core::bool" }] }, { "type": "struct", "name": "creator_coin::exchanges::ekubo::ekubo_adapter::EkuboPoolParameters", "members": [{ "name": "fee", "type": "core::integer::u128" }, { "name": "tick_spacing", "type": "core::integer::u128" }, { "name": "starting_price", "type": "ekubo::types::i129::i129" }, { "name": "bound", "type": "core::integer::u128" }] }, { "type": "struct", "name": "ekubo::types::keys::PoolKey", "members": [{ "name": "token0", "type": "core::starknet::contract_address::ContractAddress" }, { "name": "token1", "type": "core::starknet::contract_address::ContractAddress" }, { "name": "fee", "type": "core::integer::u128" }, { "name": "tick_spacing", "type": "core::integer::u128" }, { "name": "extension", "type": "core::starknet::contract_address::ContractAddress" }] }, { "type": "struct", "name": "ekubo::types::bounds::Bounds", "members": [{ "name": "lower", "type": "ekubo::types::i129::i129" }, { "name": "upper", "type": "ekubo::types::i129::i129" }] }, { "type": "struct", "name": "creator_coin::exchanges::ekubo::launcher::EkuboLP", "members": [{ "name": "owner", "type": "core::starknet::contract_address::ContractAddress" }, { "name": "quote_address", "type": "core::starknet::contract_address::ContractAddress" }, { "name": "pool_key", "type": "ekubo::types::keys::PoolKey" }, { "name": "bounds", "type": "ekubo::types::bounds::Bounds" }] }, { "type": "enum", "name": "creator_coin::exchanges::SupportedExchanges", "variants": [{ "name": "Jediswap", "type": "()" }, { "name": "Ekubo", "type": "()" }, { "name": "Starkdefi", "type": "()" }] }, { "type": "enum", "name": "creator_coin::token::creator_coin::LiquidityType", "variants": [{ "name": "JediERC20", "type": "core::starknet::contract_address::ContractAddress" }, { "name": "StarkDeFiERC20", "type": "core::starknet::contract_address::ContractAddress" }, { "name": "EkuboNFT", "type": "core::integer::u64" }] }, { "type": "enum", "name": "core::option::Option::<(core::starknet::contract_address::ContractAddress, creator_coin::token::creator_coin::LiquidityType)>", "variants": [{ "name": "Some", "type": "(core::starknet::contract_address::ContractAddress, creator_coin::token::creator_coin::LiquidityType)" }, { "name": "None", "type": "()" }] }, { "type": "interface", "name": "creator_coin::factory::interface::IFactory", "items": [{ "type": "function", "name": "create_creator_coin", "inputs": [{ "name": "owner", "type": "core::starknet::contract_address::ContractAddress" }, { "name": "name", "type": "core::felt252" }, { "name": "symbol", "type": "core::felt252" }, { "name": "initial_supply", "type": "core::integer::u256" }, { "name": "contract_address_salt", "type": "core::felt252" }], "outputs": [{ "type": "core::starknet::contract_address::ContractAddress" }], "state_mutability": "external" }, { "type": "function", "name": "launch_on_jediswap", "inputs": [{ "name": "launch_parameters", "type": "creator_coin::factory::LaunchParameters" }, { "name": "quote_amount", "type": "core::integer::u256" }, { "name": "unlock_time", "type": "core::integer::u64" }], "outputs": [{ "type": "core::starknet::contract_address::ContractAddress" }], "state_mutability": "external" }, { "type": "function", "name": "launch_on_ekubo", "inputs": [{ "name": "launch_parameters", "type": "creator_coin::factory::LaunchParameters" }, { "name": "ekubo_parameters", "type": "creator_coin::exchanges::ekubo::ekubo_adapter::EkuboPoolParameters" }], "outputs": [{ "type": "(core::integer::u64, creator_coin::exchanges::ekubo::launcher::EkuboLP)" }], "state_mutability": "external" }, { "type": "function", "name": "launch_on_starkdefi", "inputs": [{ "name": "launch_parameters", "type": "creator_coin::factory::LaunchParameters" }, { "name": "quote_amount", "type": "core::integer::u256" }, { "name": "unlock_time", "type": "core::integer::u64" }], "outputs": [{ "type": "core::starknet::contract_address::ContractAddress" }], "state_mutability": "external" }, { "type": "function", "name": "exchange_address", "inputs": [{ "name": "exchange", "type": "creator_coin::exchanges::SupportedExchanges" }], "outputs": [{ "type": "core::starknet::contract_address::ContractAddress" }], "state_mutability": "view" }, { "type": "function", "name": "lock_manager_address", "inputs": [], "outputs": [{ "type": "core::starknet::contract_address::ContractAddress" }], "state_mutability": "view" }, { "type": "function", "name": "locked_liquidity", "inputs": [{ "name": "token", "type": "core::starknet::contract_address::ContractAddress" }], "outputs": [{ "type": "core::option::Option::<(core::starknet::contract_address::ContractAddress, creator_coin::token::creator_coin::LiquidityType)>" }], "state_mutability": "view" }, { "type": "function", "name": "is_creator_coin", "inputs": [{ "name": "address", "type": "core::starknet::contract_address::ContractAddress" }], "outputs": [{ "type": "core::bool" }], "state_mutability": "view" }, { "type": "function", "name": "ekubo_core_address", "inputs": [], "outputs": [{ "type": "core::starknet::contract_address::ContractAddress" }], "state_mutability": "view" }] }, { "type": "struct", "name": "core::array::Span::<(creator_coin::exchanges::SupportedExchanges, core::starknet::contract_address::ContractAddress)>", "members": [{ "name": "snapshot", "type": "@core::array::Array::<(creator_coin::exchanges::SupportedExchanges, core::starknet::contract_address::ContractAddress)>" }] }, { "type": "struct", "name": "core::array::Span::<(core::starknet::contract_address::ContractAddress, core::starknet::contract_address::ContractAddress)>", "members": [{ "name": "snapshot", "type": "@core::array::Array::<(core::starknet::contract_address::ContractAddress, core::starknet::contract_address::ContractAddress)>" }] }, { "type": "constructor", "name": "constructor", "inputs": [{ "name": "creator_coin_class_hash", "type": "core::starknet::class_hash::ClassHash" }, { "name": "lock_manager_address", "type": "core::starknet::contract_address::ContractAddress" }, { "name": "exchanges", "type": "core::array::Span::<(creator_coin::exchanges::SupportedExchanges, core::starknet::contract_address::ContractAddress)>" }, { "name": "migrated_tokens", "type": "core::array::Span::<(core::starknet::contract_address::ContractAddress, core::starknet::contract_address::ContractAddress)>" }] }, { "type": "event", "name": "creator_coin::factory::factory::Factory::CreatorCoinCreated", "kind": "struct", "members": [{ "name": "owner", "type": "core::starknet::contract_address::ContractAddress", "kind": "data" }, { "name": "name", "type": "core::felt252", "kind": "data" }, { "name": "symbol", "type": "core::felt252", "kind": "data" }, { "name": "initial_supply", "type": "core::integer::u256", "kind": "data" }, { "name": "creator_coin_address", "type": "core::starknet::contract_address::ContractAddress", "kind": "data" }] }, { "type": "event", "name": "creator_coin::factory::factory::Factory::CreatorCoinLaunched", "kind": "struct", "members": [{ "name": "creator_coin_address", "type": "core::starknet::contract_address::ContractAddress", "kind": "data" }, { "name": "quote_token", "type": "core::starknet::contract_address::ContractAddress", "kind": "data" }, { "name": "exchange_name", "type": "core::felt252", "kind": "data" }] }, { "type": "event", "name": "creator_coin::factory::factory::Factory::Event", "kind": "enum", "variants": [{ "name": "CreatorCoinCreated", "type": "creator_coin::factory::factory::Factory::CreatorCoinCreated", "kind": "nested" }, { "name": "CreatorCoinLaunched", "type": "creator_coin::factory::factory::Factory::CreatorCoinLaunched", "kind": "nested" }] }];
4637
+
4630
4638
  // src/utils/bigint.ts
4631
4639
  function stringifyBigInts(obj) {
4632
4640
  if (typeof obj === "bigint") {
@@ -6368,6 +6376,75 @@ var ERC1155CollectionService = class {
6368
6376
  return { txHash: res.transaction_hash };
6369
6377
  }
6370
6378
  };
6379
+ var VALIDATED_EKUBO_PARAMS = {
6380
+ fee: "0xc49ba5e353f7d00000000000000000",
6381
+ tickSpacing: 5982n,
6382
+ startingPrice: { mag: 4600158n, sign: true },
6383
+ bound: 88719042n
6384
+ };
6385
+ var CreatorCoinService = class {
6386
+ // config is accepted for signature parity with the other services (none needed
6387
+ // today — launch is zero-fee and views take an account).
6388
+ constructor(_config) {
6389
+ this.factoryAddress = CREATOR_COIN_FACTORY_CONTRACT_MAINNET;
6390
+ }
6391
+ _factory(account) {
6392
+ return new Contract(CreatorCoinFactoryABI, this.factoryAddress, account);
6393
+ }
6394
+ /** Deploy a fixed-supply CreatorCoin (full supply minted to the Factory). */
6395
+ async createCreatorCoin(account, params) {
6396
+ const salt = params.salt ?? BigInt("0x" + Date.now().toString(16));
6397
+ const call = this._factory(account).populate("create_creator_coin", [
6398
+ params.owner,
6399
+ params.name,
6400
+ params.symbol,
6401
+ BigInt(params.initialSupply),
6402
+ BigInt(salt)
6403
+ ]);
6404
+ const res = await account.execute([call]);
6405
+ return { txHash: res.transaction_hash };
6406
+ }
6407
+ /**
6408
+ * Launch a coin on Ekubo (owner-only). Optionally pre-funds the Factory with
6409
+ * quote (for the buyback) in the same multicall. Liquidity is permanently
6410
+ * locked in the EkuboLauncher.
6411
+ */
6412
+ async launchOnEkubo(account, params) {
6413
+ const ek = params.ekubo ?? VALIDATED_EKUBO_PARAMS;
6414
+ const factory = this._factory(account);
6415
+ const launchParameters = {
6416
+ creator_coin_address: params.creatorCoin,
6417
+ transfer_restriction_delay: params.transferRestrictionDelay ?? 0,
6418
+ max_percentage_buy_launch: params.maxPercentageBuyLaunch ?? 200,
6419
+ quote_address: params.quoteToken,
6420
+ initial_holders: params.initialHolders,
6421
+ initial_holders_amounts: params.initialHoldersAmounts.map((a) => BigInt(a))
6422
+ };
6423
+ const ekuboParameters = {
6424
+ fee: BigInt(ek.fee),
6425
+ tick_spacing: BigInt(ek.tickSpacing),
6426
+ starting_price: { mag: BigInt(ek.startingPrice.mag), sign: ek.startingPrice.sign },
6427
+ bound: BigInt(ek.bound)
6428
+ };
6429
+ const calls = [];
6430
+ if (params.quoteFundAmount !== void 0) {
6431
+ const amt = uint256.bnToUint256(BigInt(params.quoteFundAmount));
6432
+ calls.push({
6433
+ contractAddress: params.quoteToken,
6434
+ entrypoint: "transfer",
6435
+ calldata: [this.factoryAddress, amt.low, amt.high]
6436
+ });
6437
+ }
6438
+ calls.push(factory.populate("launch_on_ekubo", [launchParameters, ekuboParameters]));
6439
+ const res = await account.execute(calls);
6440
+ return { txHash: res.transaction_hash };
6441
+ }
6442
+ /** View: is this address a Factory-deployed Creator Coin? */
6443
+ async isCreatorCoin(address, account) {
6444
+ const r = await this._factory(account).is_creator_coin(address);
6445
+ return BigInt(r) === 1n;
6446
+ }
6447
+ };
6371
6448
 
6372
6449
  // src/client.ts
6373
6450
  var MedialaneClient = class {
@@ -6378,7 +6455,8 @@ var MedialaneClient = class {
6378
6455
  this.services = {
6379
6456
  pop: new PopService(this.config),
6380
6457
  drop: new DropService(this.config),
6381
- erc1155Collection: new ERC1155CollectionService(this.config)
6458
+ erc1155Collection: new ERC1155CollectionService(this.config),
6459
+ creatorCoin: new CreatorCoinService(this.config)
6382
6460
  };
6383
6461
  if (!this.config.backendUrl) {
6384
6462
  const sentinel = new ApiClient("https://medialane-sdk-no-backend.invalid", this.config.apiKey);
@@ -6506,6 +6584,28 @@ var SERVICES = {
6506
6584
  ],
6507
6585
  metadataSchema: { licenseDefault: "CC BY-SA" }
6508
6586
  },
6587
+ "creator-coin": {
6588
+ id: "creator-coin",
6589
+ displayName: "Creator Coin",
6590
+ description: "Launch a fixed-supply social token with permanently-locked Ekubo liquidity.",
6591
+ standard: "ERC20",
6592
+ provenance: "MEDIALANE",
6593
+ onchain: {
6594
+ factoryAddress: CREATOR_COIN_FACTORY_CONTRACT_MAINNET,
6595
+ classHash: CREATOR_COIN_FACTORY_CLASS_HASH_MAINNET,
6596
+ startBlock: CREATOR_COIN_START_BLOCK_MAINNET
6597
+ },
6598
+ uiVariant: "coin",
6599
+ // `swap` is a UI affordance (05 §III): the marketplace renders an embedded
6600
+ // Ekubo swap (via StarkZapp) for the coin. Settlement is Ekubo — Medialane
6601
+ // operates NO trading venue and custodies nothing. No venue service exists
6602
+ // for coins (unlike NFTs, whose Medialane marketplace contract settles them).
6603
+ capabilities: ["launch", "swap", "transfer"],
6604
+ events: [
6605
+ { name: "CreatorCoinCreated", emittedBy: "factory" },
6606
+ { name: "CreatorCoinLaunched", emittedBy: "factory" }
6607
+ ]
6608
+ },
6509
6609
  "medialane-marketplace-erc721": {
6510
6610
  id: "medialane-marketplace-erc721",
6511
6611
  displayName: "Medialane Marketplace (ERC-721)",
@@ -6578,6 +6678,6 @@ function getServicesByCapability(cap) {
6578
6678
  );
6579
6679
  }
6580
6680
 
6581
- export { ApiClient, COLLECTION_1155_CLASS_HASH_MAINNET, COLLECTION_1155_CONTRACT_MAINNET, COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET, COLLECTION_1155_START_BLOCK_MAINNET, COLLECTION_721_CONTRACT_MAINNET, COLLECTION_721_START_BLOCK_MAINNET, CollectionRegistryABI, DEFAULT_RPC_URL, DROP_COLLECTION_CLASS_HASH_MAINNET, DROP_FACTORY_CONTRACT_MAINNET, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, FeeConfigSchema, IPCOLLECTION_CLASS_HASH_MAINNET, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPMarketplaceABI, IPNFT_CLASS_HASH_MAINNET, IPNftABI, MARKETPLACE_1155_CLASS_HASH_MAINNET, MARKETPLACE_1155_CONTRACT_MAINNET, MARKETPLACE_1155_START_BLOCK_MAINNET, MARKETPLACE_721_CLASS_HASH_MAINNET, MARKETPLACE_721_CONTRACT_MAINNET, MARKETPLACE_721_START_BLOCK_MAINNET, MarketplaceModule, Medialane1155ABI, Medialane1155Module, MedialaneApiError, MedialaneClient, MedialaneError, NFTCOMMENTS_CONTRACT_MAINNET, OPEN_LICENSES, POPCollectionABI, POPFactoryABI, POP_COLLECTION_CLASS_HASH_MAINNET, POP_FACTORY_CONTRACT_MAINNET, PUBLIC_RPC_FALLBACKS, PopService, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, build1155CancellationTypedData, build1155OrderTypedData, buildCancellationTypedData, buildFeeCall, buildOrderTypedData, createFailoverFetch, encodeByteArray, formatAmount, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, isServiceId, isTransientRpcError, listServices, normalizeAddress, normalizeHash, parseAmount, resolveConfig, resolveFeeConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
6681
+ export { ApiClient, COLLECTION_1155_CLASS_HASH_MAINNET, COLLECTION_1155_CONTRACT_MAINNET, COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET, COLLECTION_1155_START_BLOCK_MAINNET, COLLECTION_721_CONTRACT_MAINNET, COLLECTION_721_START_BLOCK_MAINNET, CREATOR_COIN_CLASS_HASH_MAINNET, CREATOR_COIN_EKUBO_LAUNCHER_MAINNET, CREATOR_COIN_FACTORY_CLASS_HASH_MAINNET, CREATOR_COIN_FACTORY_CONTRACT_MAINNET, CREATOR_COIN_START_BLOCK_MAINNET, CollectionRegistryABI, CreatorCoinFactoryABI, CreatorCoinService, DEFAULT_RPC_URL, DROP_COLLECTION_CLASS_HASH_MAINNET, DROP_FACTORY_CONTRACT_MAINNET, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, FeeConfigSchema, IPCOLLECTION_CLASS_HASH_MAINNET, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPMarketplaceABI, IPNFT_CLASS_HASH_MAINNET, IPNftABI, MARKETPLACE_1155_CLASS_HASH_MAINNET, MARKETPLACE_1155_CONTRACT_MAINNET, MARKETPLACE_1155_START_BLOCK_MAINNET, MARKETPLACE_721_CLASS_HASH_MAINNET, MARKETPLACE_721_CONTRACT_MAINNET, MARKETPLACE_721_START_BLOCK_MAINNET, MarketplaceModule, Medialane1155ABI, Medialane1155Module, MedialaneApiError, MedialaneClient, MedialaneError, NFTCOMMENTS_CONTRACT_MAINNET, OPEN_LICENSES, POPCollectionABI, POPFactoryABI, POP_COLLECTION_CLASS_HASH_MAINNET, POP_FACTORY_CONTRACT_MAINNET, PUBLIC_RPC_FALLBACKS, PopService, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, VALIDATED_EKUBO_PARAMS, build1155CancellationTypedData, build1155OrderTypedData, buildCancellationTypedData, buildFeeCall, buildOrderTypedData, createFailoverFetch, encodeByteArray, formatAmount, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, isServiceId, isTransientRpcError, listServices, normalizeAddress, normalizeHash, parseAmount, resolveConfig, resolveFeeConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
6582
6682
  //# sourceMappingURL=index.js.map
6583
6683
  //# sourceMappingURL=index.js.map