@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.cjs +109 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +483 -3
- package/dist/index.d.ts +483 -3
- package/dist/index.js +103 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -61,6 +61,11 @@ var COLLECTION_1155_CONTRACT_MAINNET = "0x067064adcaaed61e17bf50ea802ea648233612
|
|
|
61
61
|
var COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET = "0x188321a7c9ca972cc63e352e3b3a4cdf33781852d957f4b4b62249310fe4c75";
|
|
62
62
|
var COLLECTION_1155_CLASS_HASH_MAINNET = "0x281e13803c906f20bbe158efb44b7a0273c56fdebbeeb55b2ba59530ddb1c80";
|
|
63
63
|
var COLLECTION_1155_START_BLOCK_MAINNET = 10045611;
|
|
64
|
+
var CREATOR_COIN_FACTORY_CONTRACT_MAINNET = "0x50fa807b5274079fb19374673d7bab6d2dc3af7e1032ea43eb6e44bcbde4c3c";
|
|
65
|
+
var CREATOR_COIN_EKUBO_LAUNCHER_MAINNET = "0x4f7fceb5ac10f12f9544a09580592e5bdf1b7f04f48765eecf12286d8ccb7b4";
|
|
66
|
+
var CREATOR_COIN_CLASS_HASH_MAINNET = "0x743e4c8a5b96bb83bbf4af04edbbb482d5ece89eed9b729a79fb7df0cd0b6b6";
|
|
67
|
+
var CREATOR_COIN_FACTORY_CLASS_HASH_MAINNET = "0x51765926b1344c9a20b8cd4b5abe7b7d47375ae97cf6804db3ea5d4b05a9b55";
|
|
68
|
+
var CREATOR_COIN_START_BLOCK_MAINNET = 10474544;
|
|
64
69
|
var FeeConfigSchema = zod.z.object({
|
|
65
70
|
enabled: zod.z.boolean().default(true),
|
|
66
71
|
fundAddress: zod.z.string().min(1).optional(),
|
|
@@ -4629,6 +4634,9 @@ var IPNftABI = [
|
|
|
4629
4634
|
}
|
|
4630
4635
|
];
|
|
4631
4636
|
|
|
4637
|
+
// src/abis/creatorCoinFactory.ts
|
|
4638
|
+
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" }] }];
|
|
4639
|
+
|
|
4632
4640
|
// src/utils/bigint.ts
|
|
4633
4641
|
function stringifyBigInts(obj) {
|
|
4634
4642
|
if (typeof obj === "bigint") {
|
|
@@ -6370,6 +6378,75 @@ var ERC1155CollectionService = class {
|
|
|
6370
6378
|
return { txHash: res.transaction_hash };
|
|
6371
6379
|
}
|
|
6372
6380
|
};
|
|
6381
|
+
var VALIDATED_EKUBO_PARAMS = {
|
|
6382
|
+
fee: "0xc49ba5e353f7d00000000000000000",
|
|
6383
|
+
tickSpacing: 5982n,
|
|
6384
|
+
startingPrice: { mag: 4600158n, sign: true },
|
|
6385
|
+
bound: 88719042n
|
|
6386
|
+
};
|
|
6387
|
+
var CreatorCoinService = class {
|
|
6388
|
+
// config is accepted for signature parity with the other services (none needed
|
|
6389
|
+
// today — launch is zero-fee and views take an account).
|
|
6390
|
+
constructor(_config) {
|
|
6391
|
+
this.factoryAddress = CREATOR_COIN_FACTORY_CONTRACT_MAINNET;
|
|
6392
|
+
}
|
|
6393
|
+
_factory(account) {
|
|
6394
|
+
return new starknet.Contract(CreatorCoinFactoryABI, this.factoryAddress, account);
|
|
6395
|
+
}
|
|
6396
|
+
/** Deploy a fixed-supply CreatorCoin (full supply minted to the Factory). */
|
|
6397
|
+
async createCreatorCoin(account, params) {
|
|
6398
|
+
const salt = params.salt ?? BigInt("0x" + Date.now().toString(16));
|
|
6399
|
+
const call = this._factory(account).populate("create_creator_coin", [
|
|
6400
|
+
params.owner,
|
|
6401
|
+
params.name,
|
|
6402
|
+
params.symbol,
|
|
6403
|
+
BigInt(params.initialSupply),
|
|
6404
|
+
BigInt(salt)
|
|
6405
|
+
]);
|
|
6406
|
+
const res = await account.execute([call]);
|
|
6407
|
+
return { txHash: res.transaction_hash };
|
|
6408
|
+
}
|
|
6409
|
+
/**
|
|
6410
|
+
* Launch a coin on Ekubo (owner-only). Optionally pre-funds the Factory with
|
|
6411
|
+
* quote (for the buyback) in the same multicall. Liquidity is permanently
|
|
6412
|
+
* locked in the EkuboLauncher.
|
|
6413
|
+
*/
|
|
6414
|
+
async launchOnEkubo(account, params) {
|
|
6415
|
+
const ek = params.ekubo ?? VALIDATED_EKUBO_PARAMS;
|
|
6416
|
+
const factory = this._factory(account);
|
|
6417
|
+
const launchParameters = {
|
|
6418
|
+
creator_coin_address: params.creatorCoin,
|
|
6419
|
+
transfer_restriction_delay: params.transferRestrictionDelay ?? 0,
|
|
6420
|
+
max_percentage_buy_launch: params.maxPercentageBuyLaunch ?? 200,
|
|
6421
|
+
quote_address: params.quoteToken,
|
|
6422
|
+
initial_holders: params.initialHolders,
|
|
6423
|
+
initial_holders_amounts: params.initialHoldersAmounts.map((a) => BigInt(a))
|
|
6424
|
+
};
|
|
6425
|
+
const ekuboParameters = {
|
|
6426
|
+
fee: BigInt(ek.fee),
|
|
6427
|
+
tick_spacing: BigInt(ek.tickSpacing),
|
|
6428
|
+
starting_price: { mag: BigInt(ek.startingPrice.mag), sign: ek.startingPrice.sign },
|
|
6429
|
+
bound: BigInt(ek.bound)
|
|
6430
|
+
};
|
|
6431
|
+
const calls = [];
|
|
6432
|
+
if (params.quoteFundAmount !== void 0) {
|
|
6433
|
+
const amt = starknet.uint256.bnToUint256(BigInt(params.quoteFundAmount));
|
|
6434
|
+
calls.push({
|
|
6435
|
+
contractAddress: params.quoteToken,
|
|
6436
|
+
entrypoint: "transfer",
|
|
6437
|
+
calldata: [this.factoryAddress, amt.low, amt.high]
|
|
6438
|
+
});
|
|
6439
|
+
}
|
|
6440
|
+
calls.push(factory.populate("launch_on_ekubo", [launchParameters, ekuboParameters]));
|
|
6441
|
+
const res = await account.execute(calls);
|
|
6442
|
+
return { txHash: res.transaction_hash };
|
|
6443
|
+
}
|
|
6444
|
+
/** View: is this address a Factory-deployed Creator Coin? */
|
|
6445
|
+
async isCreatorCoin(address, account) {
|
|
6446
|
+
const r = await this._factory(account).is_creator_coin(address);
|
|
6447
|
+
return BigInt(r) === 1n;
|
|
6448
|
+
}
|
|
6449
|
+
};
|
|
6373
6450
|
|
|
6374
6451
|
// src/client.ts
|
|
6375
6452
|
var MedialaneClient = class {
|
|
@@ -6380,7 +6457,8 @@ var MedialaneClient = class {
|
|
|
6380
6457
|
this.services = {
|
|
6381
6458
|
pop: new PopService(this.config),
|
|
6382
6459
|
drop: new DropService(this.config),
|
|
6383
|
-
erc1155Collection: new ERC1155CollectionService(this.config)
|
|
6460
|
+
erc1155Collection: new ERC1155CollectionService(this.config),
|
|
6461
|
+
creatorCoin: new CreatorCoinService(this.config)
|
|
6384
6462
|
};
|
|
6385
6463
|
if (!this.config.backendUrl) {
|
|
6386
6464
|
const sentinel = new ApiClient("https://medialane-sdk-no-backend.invalid", this.config.apiKey);
|
|
@@ -6508,6 +6586,28 @@ var SERVICES = {
|
|
|
6508
6586
|
],
|
|
6509
6587
|
metadataSchema: { licenseDefault: "CC BY-SA" }
|
|
6510
6588
|
},
|
|
6589
|
+
"creator-coin": {
|
|
6590
|
+
id: "creator-coin",
|
|
6591
|
+
displayName: "Creator Coin",
|
|
6592
|
+
description: "Launch a fixed-supply social token with permanently-locked Ekubo liquidity.",
|
|
6593
|
+
standard: "ERC20",
|
|
6594
|
+
provenance: "MEDIALANE",
|
|
6595
|
+
onchain: {
|
|
6596
|
+
factoryAddress: CREATOR_COIN_FACTORY_CONTRACT_MAINNET,
|
|
6597
|
+
classHash: CREATOR_COIN_FACTORY_CLASS_HASH_MAINNET,
|
|
6598
|
+
startBlock: CREATOR_COIN_START_BLOCK_MAINNET
|
|
6599
|
+
},
|
|
6600
|
+
uiVariant: "coin",
|
|
6601
|
+
// `swap` is a UI affordance (05 §III): the marketplace renders an embedded
|
|
6602
|
+
// Ekubo swap (via StarkZapp) for the coin. Settlement is Ekubo — Medialane
|
|
6603
|
+
// operates NO trading venue and custodies nothing. No venue service exists
|
|
6604
|
+
// for coins (unlike NFTs, whose Medialane marketplace contract settles them).
|
|
6605
|
+
capabilities: ["launch", "swap", "transfer"],
|
|
6606
|
+
events: [
|
|
6607
|
+
{ name: "CreatorCoinCreated", emittedBy: "factory" },
|
|
6608
|
+
{ name: "CreatorCoinLaunched", emittedBy: "factory" }
|
|
6609
|
+
]
|
|
6610
|
+
},
|
|
6511
6611
|
"medialane-marketplace-erc721": {
|
|
6512
6612
|
id: "medialane-marketplace-erc721",
|
|
6513
6613
|
displayName: "Medialane Marketplace (ERC-721)",
|
|
@@ -6587,7 +6687,14 @@ exports.COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET = COLLECTION_1155_FACTORY_CLA
|
|
|
6587
6687
|
exports.COLLECTION_1155_START_BLOCK_MAINNET = COLLECTION_1155_START_BLOCK_MAINNET;
|
|
6588
6688
|
exports.COLLECTION_721_CONTRACT_MAINNET = COLLECTION_721_CONTRACT_MAINNET;
|
|
6589
6689
|
exports.COLLECTION_721_START_BLOCK_MAINNET = COLLECTION_721_START_BLOCK_MAINNET;
|
|
6690
|
+
exports.CREATOR_COIN_CLASS_HASH_MAINNET = CREATOR_COIN_CLASS_HASH_MAINNET;
|
|
6691
|
+
exports.CREATOR_COIN_EKUBO_LAUNCHER_MAINNET = CREATOR_COIN_EKUBO_LAUNCHER_MAINNET;
|
|
6692
|
+
exports.CREATOR_COIN_FACTORY_CLASS_HASH_MAINNET = CREATOR_COIN_FACTORY_CLASS_HASH_MAINNET;
|
|
6693
|
+
exports.CREATOR_COIN_FACTORY_CONTRACT_MAINNET = CREATOR_COIN_FACTORY_CONTRACT_MAINNET;
|
|
6694
|
+
exports.CREATOR_COIN_START_BLOCK_MAINNET = CREATOR_COIN_START_BLOCK_MAINNET;
|
|
6590
6695
|
exports.CollectionRegistryABI = CollectionRegistryABI;
|
|
6696
|
+
exports.CreatorCoinFactoryABI = CreatorCoinFactoryABI;
|
|
6697
|
+
exports.CreatorCoinService = CreatorCoinService;
|
|
6591
6698
|
exports.DEFAULT_RPC_URL = DEFAULT_RPC_URL;
|
|
6592
6699
|
exports.DROP_COLLECTION_CLASS_HASH_MAINNET = DROP_COLLECTION_CLASS_HASH_MAINNET;
|
|
6593
6700
|
exports.DROP_FACTORY_CONTRACT_MAINNET = DROP_FACTORY_CONTRACT_MAINNET;
|
|
@@ -6625,6 +6732,7 @@ exports.PUBLIC_RPC_FALLBACKS = PUBLIC_RPC_FALLBACKS;
|
|
|
6625
6732
|
exports.PopService = PopService;
|
|
6626
6733
|
exports.SUPPORTED_NETWORKS = SUPPORTED_NETWORKS;
|
|
6627
6734
|
exports.SUPPORTED_TOKENS = SUPPORTED_TOKENS;
|
|
6735
|
+
exports.VALIDATED_EKUBO_PARAMS = VALIDATED_EKUBO_PARAMS;
|
|
6628
6736
|
exports.build1155CancellationTypedData = build1155CancellationTypedData;
|
|
6629
6737
|
exports.build1155OrderTypedData = build1155OrderTypedData;
|
|
6630
6738
|
exports.buildCancellationTypedData = buildCancellationTypedData;
|