@medialane/sdk 0.36.0 → 0.38.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/README.md +18 -6
- package/dist/index.cjs +248 -133
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +207 -125
- package/dist/index.d.ts +207 -125
- package/dist/index.js +246 -132
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -1,70 +1,48 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { hash, cairo, num, Contract, uint256, RpcProvider, TypedDataRevision, shortString, constants } from 'starknet';
|
|
3
|
+
import { keccak_256 } from '@noble/hashes/sha3.js';
|
|
4
|
+
import { base58 } from '@scure/base';
|
|
3
5
|
|
|
4
6
|
// src/config.ts
|
|
5
7
|
|
|
6
|
-
// src/
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
|
|
37
|
-
decimals: 18,
|
|
38
|
-
listable: true
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
symbol: "STRK",
|
|
42
|
-
address: "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d",
|
|
43
|
-
decimals: 18,
|
|
44
|
-
listable: true
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
symbol: "WBTC",
|
|
48
|
-
address: "0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac",
|
|
49
|
-
decimals: 8,
|
|
50
|
-
listable: true
|
|
8
|
+
// src/chains.ts
|
|
9
|
+
var CHAINS = ["STARKNET", "ETHEREUM", "SOLANA", "BASE", "BITCOIN"];
|
|
10
|
+
var COORDINATES = {
|
|
11
|
+
STARKNET: {
|
|
12
|
+
rpcUrl: "https://rpc.starknet.lava.build",
|
|
13
|
+
marketplace721: "0x069cf5391077e3ebdd9cb6aebf90ed530d29f0d6aa34a43f5afae938c0fb565e",
|
|
14
|
+
marketplace721ClassHash: "0x04c6f952d747ad7ead1b3dad4c1d587837d38f8ec29d6c095a4afa5b5ece5957",
|
|
15
|
+
marketplace721StartBlock: 10350340,
|
|
16
|
+
marketplace1155: "0x040cd7b3e73bb3c892166e34bdc01d1797f97ecbc356c23f1cf38033cacf0077",
|
|
17
|
+
marketplace1155ClassHash: "0x02600bb720908f119afe482309d36c39d087587f0df9576454acfb6363e78cd8",
|
|
18
|
+
marketplace1155StartBlock: 10350855,
|
|
19
|
+
collection721: "0x0322cb7119955e01ac778d40976eb3ba50540bb0899f812d612f9c7e63e49fd2",
|
|
20
|
+
collection721StartBlock: 10046166,
|
|
21
|
+
ipNftClassHash: "0x27ee4ded786d51bced1e94afec3034d6ffce71c032c45ee1ff283ccfa9db12e",
|
|
22
|
+
ipCollectionClassHash: "0x287ccdff8b6655a2248cfe170d82eae3a35303cd00ef3e751b25ddca26d9095",
|
|
23
|
+
collection1155: "0x0083543c3ee15040a419fc539fa6889f5b956e7d071bcfa97842cb0ae42ad6cc",
|
|
24
|
+
collection1155FactoryClassHash: "0x331a69da8655a882ba1fbcb55188b8fa09116521db901bbbaafc9fead0689f8",
|
|
25
|
+
collection1155ClassHash: "0x4e110b59af240ae6c7742999964c4eae13fb2ed935c47fe97653ec017ebea34",
|
|
26
|
+
collection1155StartBlock: 10665319,
|
|
27
|
+
popFactory: "0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111",
|
|
28
|
+
popCollectionClassHash: "0x077c421686f10851872561953ea16898d933364b7f8937a5d7e2b1ba0a36263f",
|
|
29
|
+
dropFactory: "0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800",
|
|
30
|
+
dropCollectionClassHash: "0x00092e72cdb63067521e803aaf7d4101c3e3ce026ae6bc045ec4228027e58282",
|
|
31
|
+
nftComments: "0x02cdac70c94447189af0389dfea63f4d5e4154ea8a563de288a5ab1c39e37843",
|
|
32
|
+
creatorCoinFactory: "0x50fa807b5274079fb19374673d7bab6d2dc3af7e1032ea43eb6e44bcbde4c3c",
|
|
33
|
+
creatorCoinEkuboLauncher: "0x4f7fceb5ac10f12f9544a09580592e5bdf1b7f04f48765eecf12286d8ccb7b4",
|
|
34
|
+
creatorCoinClassHash: "0x743e4c8a5b96bb83bbf4af04edbbb482d5ece89eed9b729a79fb7df0cd0b6b6",
|
|
35
|
+
creatorCoinFactoryClassHash: "0x51765926b1344c9a20b8cd4b5abe7b7d47375ae97cf6804db3ea5d4b05a9b55",
|
|
36
|
+
creatorCoinStartBlock: 10474544,
|
|
37
|
+
ekuboCore: "0x00000005dd3d2f4429af886cd1a3b08289dbcea99a294197e9eb43b0e0325b4b"
|
|
51
38
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
var
|
|
59
|
-
var COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET = "0x331a69da8655a882ba1fbcb55188b8fa09116521db901bbbaafc9fead0689f8";
|
|
60
|
-
var COLLECTION_1155_CLASS_HASH_MAINNET = "0x4e110b59af240ae6c7742999964c4eae13fb2ed935c47fe97653ec017ebea34";
|
|
61
|
-
var COLLECTION_1155_START_BLOCK_MAINNET = 10665319;
|
|
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;
|
|
67
|
-
var EKUBO_CORE_MAINNET = "0x00000005dd3d2f4429af886cd1a3b08289dbcea99a294197e9eb43b0e0325b4b";
|
|
39
|
+
};
|
|
40
|
+
function getCoordinates(chain) {
|
|
41
|
+
const c = COORDINATES[chain];
|
|
42
|
+
if (!c) throw new Error(`No coordinates configured for chain "${chain}"`);
|
|
43
|
+
return c;
|
|
44
|
+
}
|
|
45
|
+
var DEFAULT_CHAIN = "STARKNET";
|
|
68
46
|
var FeeConfigSchema = z.object({
|
|
69
47
|
enabled: z.boolean().default(true),
|
|
70
48
|
fundAddress: z.string().min(1).optional(),
|
|
@@ -96,10 +74,13 @@ function buildFeeCall(p, cfg) {
|
|
|
96
74
|
|
|
97
75
|
// src/config.ts
|
|
98
76
|
var MedialaneConfigSchema = z.object({
|
|
99
|
-
|
|
77
|
+
// Chain-scoped client (spec 2026-06-13 Decision B): one client per chain,
|
|
78
|
+
// coordinates resolved from the registry. Replaces the removed `network` axis.
|
|
79
|
+
chain: z.enum(CHAINS).default(DEFAULT_CHAIN),
|
|
100
80
|
rpcUrl: z.string().url().optional(),
|
|
101
81
|
backendUrl: z.string().url().optional(),
|
|
102
82
|
apiKey: z.string().optional(),
|
|
83
|
+
// Per-contract overrides remain for tests/forks; default from the registry.
|
|
103
84
|
marketplace721Contract: z.string().optional(),
|
|
104
85
|
marketplaceContract: z.string().optional(),
|
|
105
86
|
marketplace1155Contract: z.string().optional(),
|
|
@@ -115,19 +96,20 @@ var MedialaneConfigSchema = z.object({
|
|
|
115
96
|
});
|
|
116
97
|
function resolveConfig(raw) {
|
|
117
98
|
const parsed = MedialaneConfigSchema.parse(raw);
|
|
118
|
-
const
|
|
119
|
-
const
|
|
99
|
+
const coords = getCoordinates(parsed.chain);
|
|
100
|
+
const marketplace721Contract = parsed.marketplace721Contract ?? parsed.marketplaceContract ?? coords.marketplace721;
|
|
101
|
+
const collection721Contract = parsed.collection721Contract ?? parsed.collectionContract ?? coords.collection721;
|
|
120
102
|
return {
|
|
121
|
-
|
|
122
|
-
rpcUrl: parsed.rpcUrl ??
|
|
103
|
+
chain: parsed.chain,
|
|
104
|
+
rpcUrl: parsed.rpcUrl ?? coords.rpcUrl,
|
|
123
105
|
backendUrl: parsed.backendUrl,
|
|
124
106
|
apiKey: parsed.apiKey,
|
|
125
107
|
marketplace721Contract,
|
|
126
108
|
marketplaceContract: marketplace721Contract,
|
|
127
|
-
marketplace1155Contract: parsed.marketplace1155Contract ??
|
|
109
|
+
marketplace1155Contract: parsed.marketplace1155Contract ?? coords.marketplace1155,
|
|
128
110
|
collection721Contract,
|
|
129
111
|
collectionContract: collection721Contract,
|
|
130
|
-
collection1155Contract: parsed.collection1155Contract ??
|
|
112
|
+
collection1155Contract: parsed.collection1155Contract ?? coords.collection1155,
|
|
131
113
|
retryOptions: parsed.retryOptions,
|
|
132
114
|
feeConfig: resolveFeeConfig(parsed.feeConfig)
|
|
133
115
|
};
|
|
@@ -4529,6 +4511,68 @@ var IPNftABI = [
|
|
|
4529
4511
|
// src/abis/creatorCoinFactory.ts
|
|
4530
4512
|
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" }] }];
|
|
4531
4513
|
|
|
4514
|
+
// src/constants.ts
|
|
4515
|
+
var SN = getCoordinates("STARKNET");
|
|
4516
|
+
var MARKETPLACE_721_CONTRACT_MAINNET = SN.marketplace721;
|
|
4517
|
+
var MARKETPLACE_721_CLASS_HASH_MAINNET = SN.marketplace721ClassHash;
|
|
4518
|
+
var MARKETPLACE_721_START_BLOCK_MAINNET = SN.marketplace721StartBlock;
|
|
4519
|
+
var MARKETPLACE_1155_CONTRACT_MAINNET = SN.marketplace1155;
|
|
4520
|
+
var MARKETPLACE_1155_CLASS_HASH_MAINNET = SN.marketplace1155ClassHash;
|
|
4521
|
+
var MARKETPLACE_1155_START_BLOCK_MAINNET = SN.marketplace1155StartBlock;
|
|
4522
|
+
var COLLECTION_721_CONTRACT_MAINNET = SN.collection721;
|
|
4523
|
+
var IPNFT_CLASS_HASH_MAINNET = SN.ipNftClassHash;
|
|
4524
|
+
var IPCOLLECTION_CLASS_HASH_MAINNET = SN.ipCollectionClassHash;
|
|
4525
|
+
var COLLECTION_721_START_BLOCK_MAINNET = SN.collection721StartBlock;
|
|
4526
|
+
var DROP_FACTORY_CONTRACT_MAINNET = SN.dropFactory;
|
|
4527
|
+
var POP_FACTORY_CONTRACT_MAINNET = SN.popFactory;
|
|
4528
|
+
var NFTCOMMENTS_CONTRACT_MAINNET = SN.nftComments;
|
|
4529
|
+
var SUPPORTED_TOKENS = [
|
|
4530
|
+
{
|
|
4531
|
+
// Circle-native USDC on Starknet (canonical)
|
|
4532
|
+
symbol: "USDC",
|
|
4533
|
+
address: "0x033068f6539f8e6e6b131e6b2b814e6c34a5224bc66947c47dab9dfee93b35fb",
|
|
4534
|
+
decimals: 6,
|
|
4535
|
+
listable: true
|
|
4536
|
+
},
|
|
4537
|
+
{
|
|
4538
|
+
symbol: "USDT",
|
|
4539
|
+
address: "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",
|
|
4540
|
+
decimals: 6,
|
|
4541
|
+
listable: true
|
|
4542
|
+
},
|
|
4543
|
+
{
|
|
4544
|
+
symbol: "ETH",
|
|
4545
|
+
address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
|
|
4546
|
+
decimals: 18,
|
|
4547
|
+
listable: true
|
|
4548
|
+
},
|
|
4549
|
+
{
|
|
4550
|
+
symbol: "STRK",
|
|
4551
|
+
address: "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d",
|
|
4552
|
+
decimals: 18,
|
|
4553
|
+
listable: true
|
|
4554
|
+
},
|
|
4555
|
+
{
|
|
4556
|
+
symbol: "WBTC",
|
|
4557
|
+
address: "0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac",
|
|
4558
|
+
decimals: 8,
|
|
4559
|
+
listable: true
|
|
4560
|
+
}
|
|
4561
|
+
];
|
|
4562
|
+
var DEFAULT_CURRENCY = "USDC";
|
|
4563
|
+
var POP_COLLECTION_CLASS_HASH_MAINNET = SN.popCollectionClassHash;
|
|
4564
|
+
var DROP_COLLECTION_CLASS_HASH_MAINNET = SN.dropCollectionClassHash;
|
|
4565
|
+
var COLLECTION_1155_CONTRACT_MAINNET = SN.collection1155;
|
|
4566
|
+
var COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET = SN.collection1155FactoryClassHash;
|
|
4567
|
+
var COLLECTION_1155_CLASS_HASH_MAINNET = SN.collection1155ClassHash;
|
|
4568
|
+
var COLLECTION_1155_START_BLOCK_MAINNET = SN.collection1155StartBlock;
|
|
4569
|
+
var CREATOR_COIN_FACTORY_CONTRACT_MAINNET = SN.creatorCoinFactory;
|
|
4570
|
+
var CREATOR_COIN_EKUBO_LAUNCHER_MAINNET = SN.creatorCoinEkuboLauncher;
|
|
4571
|
+
var CREATOR_COIN_CLASS_HASH_MAINNET = SN.creatorCoinClassHash;
|
|
4572
|
+
var CREATOR_COIN_FACTORY_CLASS_HASH_MAINNET = SN.creatorCoinFactoryClassHash;
|
|
4573
|
+
var CREATOR_COIN_START_BLOCK_MAINNET = SN.creatorCoinStartBlock;
|
|
4574
|
+
var EKUBO_CORE_MAINNET = SN.ekuboCore;
|
|
4575
|
+
|
|
4532
4576
|
// src/utils/bigint.ts
|
|
4533
4577
|
function stringifyBigInts(obj) {
|
|
4534
4578
|
if (typeof obj === "bigint") {
|
|
@@ -4669,7 +4713,10 @@ function toSignatureArray(sig) {
|
|
|
4669
4713
|
const s = sig;
|
|
4670
4714
|
return [s.r.toString(), s.s.toString()];
|
|
4671
4715
|
}
|
|
4672
|
-
function getChainId(
|
|
4716
|
+
function getChainId(config) {
|
|
4717
|
+
if (config.chain !== "STARKNET") {
|
|
4718
|
+
throw new Error(`SNIP-12 signing is Starknet-only; got chain "${config.chain}"`);
|
|
4719
|
+
}
|
|
4673
4720
|
return constants.StarknetChainId.SN_MAIN;
|
|
4674
4721
|
}
|
|
4675
4722
|
function resolveToken(currency) {
|
|
@@ -4736,7 +4783,7 @@ async function createListing(account, params, config) {
|
|
|
4736
4783
|
salt: generateSalt(),
|
|
4737
4784
|
counter
|
|
4738
4785
|
};
|
|
4739
|
-
const chainId = getChainId();
|
|
4786
|
+
const chainId = getChainId(config);
|
|
4740
4787
|
const typedData = stringifyBigInts(buildOrderTypedData(orderParams, chainId));
|
|
4741
4788
|
const signature = await account.signMessage(typedData);
|
|
4742
4789
|
const signatureArray = toSignatureArray(signature);
|
|
@@ -4818,7 +4865,7 @@ async function makeOffer(account, params, config) {
|
|
|
4818
4865
|
salt: generateSalt(),
|
|
4819
4866
|
counter
|
|
4820
4867
|
};
|
|
4821
|
-
const chainId = getChainId();
|
|
4868
|
+
const chainId = getChainId(config);
|
|
4822
4869
|
const typedData = stringifyBigInts(buildOrderTypedData(orderParams, chainId));
|
|
4823
4870
|
const signature = await account.signMessage(typedData);
|
|
4824
4871
|
const signatureArray = toSignatureArray(signature);
|
|
@@ -4885,7 +4932,7 @@ async function fulfillOrder(account, params, config) {
|
|
|
4885
4932
|
async function cancelOrder(account, params, config) {
|
|
4886
4933
|
const { orderHash } = params;
|
|
4887
4934
|
const { contract, provider } = makeContract(config);
|
|
4888
|
-
const chainId = getChainId();
|
|
4935
|
+
const chainId = getChainId(config);
|
|
4889
4936
|
const cancelParams = {
|
|
4890
4937
|
order_hash: orderHash,
|
|
4891
4938
|
offerer: account.address
|
|
@@ -5071,7 +5118,7 @@ async function createListing1155(account, params, config) {
|
|
|
5071
5118
|
const priceWei = parseAmount(pricePerUnit, token.decimals);
|
|
5072
5119
|
const now = Math.floor(Date.now() / 1e3);
|
|
5073
5120
|
const endTime = now + durationSeconds;
|
|
5074
|
-
const chainId = getChainId();
|
|
5121
|
+
const chainId = getChainId(config);
|
|
5075
5122
|
const counter = (await contract.get_counter(account.address)).toString();
|
|
5076
5123
|
const royaltyMaxBps = await resolveRoyaltyMaxBps(provider, nftContract, tokenId, params.royaltyMaxBps);
|
|
5077
5124
|
const orderParams = {
|
|
@@ -5171,7 +5218,7 @@ async function cancelOrder1155(account, params, config) {
|
|
|
5171
5218
|
const { orderHash } = params;
|
|
5172
5219
|
const contract = getContract(config);
|
|
5173
5220
|
const provider = getProvider(config);
|
|
5174
|
-
const chainId = getChainId();
|
|
5221
|
+
const chainId = getChainId(config);
|
|
5175
5222
|
const cancelParams = {
|
|
5176
5223
|
order_hash: orderHash,
|
|
5177
5224
|
offerer: account.address
|
|
@@ -5205,7 +5252,7 @@ async function makeOffer1155(account, params, config) {
|
|
|
5205
5252
|
} = params;
|
|
5206
5253
|
const contract = getContract(config);
|
|
5207
5254
|
const provider = getProvider(config);
|
|
5208
|
-
const chainId = getChainId();
|
|
5255
|
+
const chainId = getChainId(config);
|
|
5209
5256
|
const token = resolveToken(currency);
|
|
5210
5257
|
const priceWei = parseAmount(price, token.decimals);
|
|
5211
5258
|
const now = Math.floor(Date.now() / 1e3);
|
|
@@ -5387,12 +5434,46 @@ var Medialane1155Module = class {
|
|
|
5387
5434
|
return build1155CancellationTypedData(params, chainId);
|
|
5388
5435
|
}
|
|
5389
5436
|
};
|
|
5390
|
-
function normalizeAddress(address) {
|
|
5437
|
+
function normalizeAddress(chain, address) {
|
|
5438
|
+
switch (chain) {
|
|
5439
|
+
case "STARKNET":
|
|
5440
|
+
return normalizeStarknet(address);
|
|
5441
|
+
case "ETHEREUM":
|
|
5442
|
+
case "BASE":
|
|
5443
|
+
return normalizeEvm(address);
|
|
5444
|
+
case "SOLANA":
|
|
5445
|
+
return normalizeSolana(address);
|
|
5446
|
+
case "BITCOIN":
|
|
5447
|
+
throw new Error("BITCOIN address normalization not implemented");
|
|
5448
|
+
}
|
|
5449
|
+
}
|
|
5450
|
+
function normalizeStarknet(address) {
|
|
5391
5451
|
try {
|
|
5392
5452
|
const hex = num.toHex(BigInt(address));
|
|
5393
5453
|
return "0x" + hex.slice(2).padStart(64, "0").toLowerCase();
|
|
5394
5454
|
} catch {
|
|
5395
|
-
throw new Error(`Invalid
|
|
5455
|
+
throw new Error(`Invalid STARKNET address: "${address}"`);
|
|
5456
|
+
}
|
|
5457
|
+
}
|
|
5458
|
+
function normalizeEvm(address) {
|
|
5459
|
+
const m = /^0x([0-9a-fA-F]{40})$/.exec(address);
|
|
5460
|
+
if (!m) throw new Error(`Invalid ETHEREUM/BASE address: "${address}"`);
|
|
5461
|
+
const lower = m[1].toLowerCase();
|
|
5462
|
+
const hash2 = keccak_256(new TextEncoder().encode(lower));
|
|
5463
|
+
let out = "0x";
|
|
5464
|
+
for (let i = 0; i < 40; i++) {
|
|
5465
|
+
const nibble = hash2[i >> 1] >> (i % 2 === 0 ? 4 : 0) & 15;
|
|
5466
|
+
out += nibble >= 8 ? lower[i].toUpperCase() : lower[i];
|
|
5467
|
+
}
|
|
5468
|
+
return out;
|
|
5469
|
+
}
|
|
5470
|
+
function normalizeSolana(address) {
|
|
5471
|
+
try {
|
|
5472
|
+
const bytes = base58.decode(address);
|
|
5473
|
+
if (bytes.length !== 32) throw new Error("not a 32-byte key");
|
|
5474
|
+
return address;
|
|
5475
|
+
} catch {
|
|
5476
|
+
throw new Error(`Invalid SOLANA address: "${address}"`);
|
|
5396
5477
|
}
|
|
5397
5478
|
}
|
|
5398
5479
|
function normalizeHash(hash2) {
|
|
@@ -5400,11 +5481,11 @@ function normalizeHash(hash2) {
|
|
|
5400
5481
|
const hex = num.toHex(BigInt(hash2));
|
|
5401
5482
|
return "0x" + hex.slice(2).padStart(64, "0").toLowerCase();
|
|
5402
5483
|
} catch {
|
|
5403
|
-
throw new Error(`Invalid
|
|
5484
|
+
throw new Error(`Invalid hash: "${hash2}"`);
|
|
5404
5485
|
}
|
|
5405
5486
|
}
|
|
5406
|
-
function shortenAddress(address, chars = 4) {
|
|
5407
|
-
const norm = normalizeAddress(address);
|
|
5487
|
+
function shortenAddress(chain, address, chars = 4) {
|
|
5488
|
+
const norm = normalizeAddress(chain, address);
|
|
5408
5489
|
return `${norm.slice(0, chars + 2)}...${norm.slice(-chars)}`;
|
|
5409
5490
|
}
|
|
5410
5491
|
|
|
@@ -5458,11 +5539,16 @@ var MedialaneApiError = class extends Error {
|
|
|
5458
5539
|
}
|
|
5459
5540
|
};
|
|
5460
5541
|
var ApiClient = class {
|
|
5461
|
-
constructor(baseUrl, apiKey, retryOptions) {
|
|
5542
|
+
constructor(baseUrl, apiKey, retryOptions, chain = "STARKNET") {
|
|
5462
5543
|
this.baseUrl = baseUrl;
|
|
5544
|
+
this.chain = chain;
|
|
5463
5545
|
this.baseHeaders = apiKey ? { "x-api-key": apiKey } : {};
|
|
5464
5546
|
this.retryOptions = retryOptions;
|
|
5465
5547
|
}
|
|
5548
|
+
/** Normalize an address for this client's chain (chain-scoped — Decision B). */
|
|
5549
|
+
addr(a) {
|
|
5550
|
+
return normalizeAddress(this.chain, a);
|
|
5551
|
+
}
|
|
5466
5552
|
async request(path, init) {
|
|
5467
5553
|
const url = `${this.baseUrl.replace(/\/$/, "")}${path}`;
|
|
5468
5554
|
const headers = { ...this.baseHeaders };
|
|
@@ -5524,7 +5610,7 @@ var ApiClient = class {
|
|
|
5524
5610
|
if (query.sort) params.set("sort", query.sort);
|
|
5525
5611
|
if (query.page !== void 0) params.set("page", String(query.page));
|
|
5526
5612
|
if (query.limit !== void 0) params.set("limit", String(query.limit));
|
|
5527
|
-
if (query.offerer) params.set("offerer",
|
|
5613
|
+
if (query.offerer) params.set("offerer", this.addr(query.offerer));
|
|
5528
5614
|
if (query.minPrice) params.set("minPrice", query.minPrice);
|
|
5529
5615
|
if (query.maxPrice) params.set("maxPrice", query.maxPrice);
|
|
5530
5616
|
const qs = params.toString();
|
|
@@ -5534,11 +5620,11 @@ var ApiClient = class {
|
|
|
5534
5620
|
return this.get(`/v1/orders/${orderHash}`);
|
|
5535
5621
|
}
|
|
5536
5622
|
getActiveOrdersForToken(contract, tokenId) {
|
|
5537
|
-
return this.get(`/v1/orders/token/${
|
|
5623
|
+
return this.get(`/v1/orders/token/${this.addr(contract)}/${tokenId}`);
|
|
5538
5624
|
}
|
|
5539
5625
|
getOrdersByUser(address, page = 1, limit = 20) {
|
|
5540
5626
|
return this.get(
|
|
5541
|
-
`/v1/orders/user/${
|
|
5627
|
+
`/v1/orders/user/${this.addr(address)}?page=${page}&limit=${limit}`
|
|
5542
5628
|
);
|
|
5543
5629
|
}
|
|
5544
5630
|
// ─── Tokens ────────────────────────────────────────────────────────────────
|
|
@@ -5549,7 +5635,7 @@ var ApiClient = class {
|
|
|
5549
5635
|
}
|
|
5550
5636
|
getTokensByOwner(address, page = 1, limit = 20) {
|
|
5551
5637
|
return this.get(
|
|
5552
|
-
`/v1/tokens/owned/${
|
|
5638
|
+
`/v1/tokens/owned/${this.addr(address)}?page=${page}&limit=${limit}`
|
|
5553
5639
|
);
|
|
5554
5640
|
}
|
|
5555
5641
|
getTokenHistory(contract, tokenId, page = 1, limit = 20) {
|
|
@@ -5566,15 +5652,15 @@ var ApiClient = class {
|
|
|
5566
5652
|
return this.get(`/v1/collections?${params}`);
|
|
5567
5653
|
}
|
|
5568
5654
|
getCollectionsByOwner(owner, page = 1, limit = 50) {
|
|
5569
|
-
const params = new URLSearchParams({ owner:
|
|
5655
|
+
const params = new URLSearchParams({ owner: this.addr(owner), page: String(page), limit: String(limit) });
|
|
5570
5656
|
return this.get(`/v1/collections?${params}`);
|
|
5571
5657
|
}
|
|
5572
5658
|
getCollection(contract) {
|
|
5573
|
-
return this.get(`/v1/collections/${
|
|
5659
|
+
return this.get(`/v1/collections/${this.addr(contract)}`);
|
|
5574
5660
|
}
|
|
5575
5661
|
getCollectionTokens(contract, page = 1, limit = 20) {
|
|
5576
5662
|
return this.get(
|
|
5577
|
-
`/v1/collections/${
|
|
5663
|
+
`/v1/collections/${this.addr(contract)}/tokens?page=${page}&limit=${limit}`
|
|
5578
5664
|
);
|
|
5579
5665
|
}
|
|
5580
5666
|
// ─── Activities ────────────────────────────────────────────────────────────
|
|
@@ -5588,7 +5674,7 @@ var ApiClient = class {
|
|
|
5588
5674
|
}
|
|
5589
5675
|
getActivitiesByAddress(address, page = 1, limit = 20) {
|
|
5590
5676
|
return this.get(
|
|
5591
|
-
`/v1/activities/${
|
|
5677
|
+
`/v1/activities/${this.addr(address)}?page=${page}&limit=${limit}`
|
|
5592
5678
|
);
|
|
5593
5679
|
}
|
|
5594
5680
|
// ─── Comments ──────────────────────────────────────────────────────────────
|
|
@@ -5598,7 +5684,7 @@ var ApiClient = class {
|
|
|
5598
5684
|
if (opts.limit !== void 0) params.set("limit", String(opts.limit));
|
|
5599
5685
|
const qs = params.toString();
|
|
5600
5686
|
return this.get(
|
|
5601
|
-
`/v1/tokens/${
|
|
5687
|
+
`/v1/tokens/${this.addr(contract)}/${tokenId}/comments${qs ? `?${qs}` : ""}`
|
|
5602
5688
|
);
|
|
5603
5689
|
}
|
|
5604
5690
|
// ─── Search ────────────────────────────────────────────────────────────────
|
|
@@ -5736,7 +5822,7 @@ var ApiClient = class {
|
|
|
5736
5822
|
}
|
|
5737
5823
|
// ─── Collection Profiles ────────────────────────────────────────────────────
|
|
5738
5824
|
async getCollectionProfile(contractAddress) {
|
|
5739
|
-
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/collections/${
|
|
5825
|
+
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/collections/${this.addr(contractAddress)}/profile`;
|
|
5740
5826
|
const res = await fetch(url, { headers: this.baseHeaders });
|
|
5741
5827
|
return this.checkResponse(res, { allow404: true });
|
|
5742
5828
|
}
|
|
@@ -5744,7 +5830,7 @@ var ApiClient = class {
|
|
|
5744
5830
|
* Update collection profile. Requires Clerk JWT for ownership check.
|
|
5745
5831
|
*/
|
|
5746
5832
|
async updateCollectionProfile(contractAddress, data, clerkToken) {
|
|
5747
|
-
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/collections/${
|
|
5833
|
+
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/collections/${this.addr(contractAddress)}/profile`;
|
|
5748
5834
|
const res = await fetch(url, {
|
|
5749
5835
|
method: "PATCH",
|
|
5750
5836
|
headers: {
|
|
@@ -5757,7 +5843,7 @@ var ApiClient = class {
|
|
|
5757
5843
|
return this.checkResponse(res);
|
|
5758
5844
|
}
|
|
5759
5845
|
async getGatedContent(contractAddress, clerkToken) {
|
|
5760
|
-
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/collections/${
|
|
5846
|
+
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/collections/${this.addr(contractAddress)}/gated-content`;
|
|
5761
5847
|
const res = await fetch(url, {
|
|
5762
5848
|
headers: { ...this.baseHeaders, "Authorization": `Bearer ${clerkToken}` }
|
|
5763
5849
|
});
|
|
@@ -5775,7 +5861,7 @@ var ApiClient = class {
|
|
|
5775
5861
|
return this.checkResponse(res);
|
|
5776
5862
|
}
|
|
5777
5863
|
async getCreatorProfile(walletAddress) {
|
|
5778
|
-
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/creators/${
|
|
5864
|
+
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/creators/${this.addr(walletAddress)}/profile`;
|
|
5779
5865
|
const res = await fetch(url, { headers: this.baseHeaders });
|
|
5780
5866
|
return this.checkResponse(res, { allow404: true });
|
|
5781
5867
|
}
|
|
@@ -5789,7 +5875,7 @@ var ApiClient = class {
|
|
|
5789
5875
|
* Update creator profile. Requires Clerk JWT; wallet must match authenticated user.
|
|
5790
5876
|
*/
|
|
5791
5877
|
async updateCreatorProfile(walletAddress, data, clerkToken) {
|
|
5792
|
-
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/creators/${
|
|
5878
|
+
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/creators/${this.addr(walletAddress)}/profile`;
|
|
5793
5879
|
const res = await fetch(url, {
|
|
5794
5880
|
method: "PATCH",
|
|
5795
5881
|
headers: {
|
|
@@ -5889,7 +5975,7 @@ var ApiClient = class {
|
|
|
5889
5975
|
if (opts.limit !== void 0) params.set("limit", String(opts.limit));
|
|
5890
5976
|
const qs = params.toString();
|
|
5891
5977
|
return this.get(
|
|
5892
|
-
`/v1/tokens/${
|
|
5978
|
+
`/v1/tokens/${this.addr(contract)}/${tokenId}/remixes${qs ? `?${qs}` : ""}`
|
|
5893
5979
|
);
|
|
5894
5980
|
}
|
|
5895
5981
|
/**
|
|
@@ -5984,24 +6070,38 @@ var ApiClient = class {
|
|
|
5984
6070
|
}
|
|
5985
6071
|
async getPopEligibility(collection, wallet) {
|
|
5986
6072
|
const res = await this.get(
|
|
5987
|
-
`/v1/pop/eligibility/${
|
|
6073
|
+
`/v1/pop/eligibility/${this.addr(collection)}/${this.addr(wallet)}`
|
|
5988
6074
|
);
|
|
5989
6075
|
return res.data;
|
|
5990
6076
|
}
|
|
5991
6077
|
async getPopEligibilityBatch(collection, wallets) {
|
|
5992
|
-
const params = new URLSearchParams({ wallets: wallets.map(
|
|
6078
|
+
const params = new URLSearchParams({ wallets: wallets.map((w) => this.addr(w)).join(",") });
|
|
5993
6079
|
const res = await this.get(
|
|
5994
|
-
`/v1/pop/eligibility/${
|
|
6080
|
+
`/v1/pop/eligibility/${this.addr(collection)}?${params}`
|
|
5995
6081
|
);
|
|
5996
6082
|
return res.data;
|
|
5997
6083
|
}
|
|
6084
|
+
// ─── Coins (fungible — ERC-20 etc.) ───────────────────────────────────────────
|
|
6085
|
+
// Coins are a separate model from Collections (spec 2026-06-14). Price/liquidity
|
|
6086
|
+
// is read live from Ekubo (CreatorCoinService.getPrice), never from these.
|
|
6087
|
+
getCoins(opts = {}) {
|
|
6088
|
+
const params = new URLSearchParams();
|
|
6089
|
+
if (opts.page) params.set("page", String(opts.page));
|
|
6090
|
+
if (opts.limit) params.set("limit", String(opts.limit));
|
|
6091
|
+
if (opts.service) params.set("service", opts.service);
|
|
6092
|
+
const qs = params.toString();
|
|
6093
|
+
return this.get(`/v1/coins${qs ? `?${qs}` : ""}`);
|
|
6094
|
+
}
|
|
6095
|
+
getCoin(contract) {
|
|
6096
|
+
return this.get(`/v1/coins/${this.addr(contract)}`);
|
|
6097
|
+
}
|
|
5998
6098
|
// ─── Collection Drop ────────────────────────────────────────────────────────
|
|
5999
6099
|
getDropCollections(opts = {}) {
|
|
6000
6100
|
return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "COLLECTION_DROP");
|
|
6001
6101
|
}
|
|
6002
6102
|
async getDropMintStatus(collection, wallet) {
|
|
6003
6103
|
const res = await this.get(
|
|
6004
|
-
`/v1/drop/mint-status/${
|
|
6104
|
+
`/v1/drop/mint-status/${this.addr(collection)}/${this.addr(wallet)}`
|
|
6005
6105
|
);
|
|
6006
6106
|
return res.data;
|
|
6007
6107
|
}
|
|
@@ -6011,7 +6111,7 @@ var PopService = class {
|
|
|
6011
6111
|
this.factoryAddress = POP_FACTORY_CONTRACT_MAINNET;
|
|
6012
6112
|
}
|
|
6013
6113
|
_collection(address, account) {
|
|
6014
|
-
return new Contract(POPCollectionABI, normalizeAddress(address), account);
|
|
6114
|
+
return new Contract(POPCollectionABI, normalizeAddress("STARKNET", address), account);
|
|
6015
6115
|
}
|
|
6016
6116
|
async claim(account, collectionAddress) {
|
|
6017
6117
|
const call = this._collection(collectionAddress, account).populate("claim", []);
|
|
@@ -6087,7 +6187,7 @@ var DropService = class {
|
|
|
6087
6187
|
this.config = config;
|
|
6088
6188
|
}
|
|
6089
6189
|
_collection(address, account) {
|
|
6090
|
-
return new Contract(DropCollectionABI, normalizeAddress(address), account);
|
|
6190
|
+
return new Contract(DropCollectionABI, normalizeAddress("STARKNET", address), account);
|
|
6091
6191
|
}
|
|
6092
6192
|
async claim(account, collectionAddress, quantity = 1) {
|
|
6093
6193
|
const collection = this._collection(collectionAddress, account);
|
|
@@ -6170,14 +6270,14 @@ var ERC1155CollectionService = class {
|
|
|
6170
6270
|
_factory(account) {
|
|
6171
6271
|
return new Contract(
|
|
6172
6272
|
IPCollection1155FactoryABI,
|
|
6173
|
-
normalizeAddress(this.factoryAddress),
|
|
6273
|
+
normalizeAddress("STARKNET", this.factoryAddress),
|
|
6174
6274
|
account
|
|
6175
6275
|
);
|
|
6176
6276
|
}
|
|
6177
6277
|
_collection(address, account) {
|
|
6178
6278
|
return new Contract(
|
|
6179
6279
|
IPCollection1155ABI,
|
|
6180
|
-
normalizeAddress(address),
|
|
6280
|
+
normalizeAddress("STARKNET", address),
|
|
6181
6281
|
account
|
|
6182
6282
|
);
|
|
6183
6283
|
}
|
|
@@ -6299,7 +6399,7 @@ async function getCreatorCoinPrice(coinAddress, provider) {
|
|
|
6299
6399
|
if (BigInt(r[0]) !== 0n || BigInt(r[1]) !== 0n) return null;
|
|
6300
6400
|
const fee = r[2];
|
|
6301
6401
|
const tickSpacing = r[3];
|
|
6302
|
-
const quoteToken = normalizeAddress("0x" + BigInt(r[7]).toString(16));
|
|
6402
|
+
const quoteToken = normalizeAddress("STARKNET", "0x" + BigInt(r[7]).toString(16));
|
|
6303
6403
|
const token = getTokenByAddress(quoteToken);
|
|
6304
6404
|
const quoteDecimals = token?.decimals ?? 18;
|
|
6305
6405
|
const ci = BigInt(coinAddress);
|
|
@@ -6367,20 +6467,20 @@ function buildLaunchOnEkuboCalls(params) {
|
|
|
6367
6467
|
}
|
|
6368
6468
|
var CREATOR_COIN_CREATED_SELECTOR = hash.getSelectorFromName("CreatorCoinCreated");
|
|
6369
6469
|
function parseCreatorCoinCreated(receipt) {
|
|
6370
|
-
const factory = normalizeAddress(CREATOR_COIN_FACTORY_CONTRACT_MAINNET);
|
|
6470
|
+
const factory = normalizeAddress("STARKNET", CREATOR_COIN_FACTORY_CONTRACT_MAINNET);
|
|
6371
6471
|
for (const ev of receipt?.events ?? []) {
|
|
6372
6472
|
let from;
|
|
6373
6473
|
try {
|
|
6374
|
-
from = normalizeAddress(ev.from_address ?? "");
|
|
6474
|
+
from = normalizeAddress("STARKNET", ev.from_address ?? "");
|
|
6375
6475
|
} catch {
|
|
6376
6476
|
continue;
|
|
6377
6477
|
}
|
|
6378
6478
|
if (from !== factory) continue;
|
|
6379
6479
|
const k0 = ev.keys?.[0];
|
|
6380
|
-
if (!k0 || normalizeAddress(k0) !== normalizeAddress(CREATOR_COIN_CREATED_SELECTOR)) continue;
|
|
6480
|
+
if (!k0 || normalizeAddress("STARKNET", k0) !== normalizeAddress("STARKNET", CREATOR_COIN_CREATED_SELECTOR)) continue;
|
|
6381
6481
|
const data = ev.data ?? [];
|
|
6382
6482
|
if (data.length < 1) continue;
|
|
6383
|
-
return normalizeAddress(data[data.length - 1]);
|
|
6483
|
+
return normalizeAddress("STARKNET", data[data.length - 1]);
|
|
6384
6484
|
}
|
|
6385
6485
|
throw new Error("Coin deployed but the coin address could not be read from the receipt");
|
|
6386
6486
|
}
|
|
@@ -6450,11 +6550,11 @@ var MedialaneClient = class {
|
|
|
6450
6550
|
}
|
|
6451
6551
|
});
|
|
6452
6552
|
} else {
|
|
6453
|
-
this.api = new ApiClient(this.config.backendUrl, this.config.apiKey, this.config.retryOptions);
|
|
6553
|
+
this.api = new ApiClient(this.config.backendUrl, this.config.apiKey, this.config.retryOptions, this.config.chain);
|
|
6454
6554
|
}
|
|
6455
6555
|
}
|
|
6456
|
-
get
|
|
6457
|
-
return this.config.
|
|
6556
|
+
get chain() {
|
|
6557
|
+
return this.config.chain;
|
|
6458
6558
|
}
|
|
6459
6559
|
get rpcUrl() {
|
|
6460
6560
|
return this.config.rpcUrl;
|
|
@@ -6516,8 +6616,10 @@ var SERVICES = {
|
|
|
6516
6616
|
standard: "ERC721",
|
|
6517
6617
|
provenance: "MEDIALANE",
|
|
6518
6618
|
onchain: {
|
|
6519
|
-
|
|
6520
|
-
|
|
6619
|
+
STARKNET: {
|
|
6620
|
+
factoryAddress: COLLECTION_721_CONTRACT_MAINNET,
|
|
6621
|
+
startBlock: COLLECTION_721_START_BLOCK_MAINNET
|
|
6622
|
+
}
|
|
6521
6623
|
},
|
|
6522
6624
|
uiVariant: "standard",
|
|
6523
6625
|
capabilities: ["list", "buy", "make_offer", "cancel", "transfer", "mint", "remix", "license"],
|
|
@@ -6539,7 +6641,7 @@ var SERVICES = {
|
|
|
6539
6641
|
uiVariant: "standard",
|
|
6540
6642
|
capabilities: ["list", "buy", "make_offer", "cancel", "transfer", "mint", "remix", "license"],
|
|
6541
6643
|
// No factory — single shared contract. Events declared when the genesis
|
|
6542
|
-
// contract address is wired into onchain.factoryAddress here.
|
|
6644
|
+
// contract address is wired into onchain.STARKNET.factoryAddress here.
|
|
6543
6645
|
metadataSchema: { licenseDefault: "CC BY-SA" }
|
|
6544
6646
|
},
|
|
6545
6647
|
"mip-erc1155": {
|
|
@@ -6549,9 +6651,11 @@ var SERVICES = {
|
|
|
6549
6651
|
standard: "ERC1155",
|
|
6550
6652
|
provenance: "MEDIALANE",
|
|
6551
6653
|
onchain: {
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6654
|
+
STARKNET: {
|
|
6655
|
+
factoryAddress: COLLECTION_1155_CONTRACT_MAINNET,
|
|
6656
|
+
classHash: COLLECTION_1155_CLASS_HASH_MAINNET,
|
|
6657
|
+
startBlock: COLLECTION_1155_START_BLOCK_MAINNET
|
|
6658
|
+
}
|
|
6555
6659
|
},
|
|
6556
6660
|
uiVariant: "edition",
|
|
6557
6661
|
capabilities: ["list", "buy", "make_offer", "cancel", "transfer", "mint", "remix", "license"],
|
|
@@ -6567,8 +6671,10 @@ var SERVICES = {
|
|
|
6567
6671
|
standard: "ERC721",
|
|
6568
6672
|
provenance: "MEDIALANE",
|
|
6569
6673
|
onchain: {
|
|
6570
|
-
|
|
6571
|
-
|
|
6674
|
+
STARKNET: {
|
|
6675
|
+
factoryAddress: POP_FACTORY_CONTRACT_MAINNET,
|
|
6676
|
+
classHash: POP_COLLECTION_CLASS_HASH_MAINNET
|
|
6677
|
+
}
|
|
6572
6678
|
},
|
|
6573
6679
|
uiVariant: "pop",
|
|
6574
6680
|
capabilities: ["claim", "transfer"],
|
|
@@ -6585,8 +6691,10 @@ var SERVICES = {
|
|
|
6585
6691
|
standard: "ERC721",
|
|
6586
6692
|
provenance: "MEDIALANE",
|
|
6587
6693
|
onchain: {
|
|
6588
|
-
|
|
6589
|
-
|
|
6694
|
+
STARKNET: {
|
|
6695
|
+
factoryAddress: DROP_FACTORY_CONTRACT_MAINNET,
|
|
6696
|
+
classHash: DROP_COLLECTION_CLASS_HASH_MAINNET
|
|
6697
|
+
}
|
|
6590
6698
|
},
|
|
6591
6699
|
uiVariant: "drop",
|
|
6592
6700
|
capabilities: ["claim", "list", "buy", "make_offer", "cancel", "transfer"],
|
|
@@ -6603,9 +6711,11 @@ var SERVICES = {
|
|
|
6603
6711
|
standard: "ERC20",
|
|
6604
6712
|
provenance: "MEDIALANE",
|
|
6605
6713
|
onchain: {
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6714
|
+
STARKNET: {
|
|
6715
|
+
factoryAddress: CREATOR_COIN_FACTORY_CONTRACT_MAINNET,
|
|
6716
|
+
classHash: CREATOR_COIN_FACTORY_CLASS_HASH_MAINNET,
|
|
6717
|
+
startBlock: CREATOR_COIN_START_BLOCK_MAINNET
|
|
6718
|
+
}
|
|
6609
6719
|
},
|
|
6610
6720
|
uiVariant: "coin",
|
|
6611
6721
|
// `swap` is a UI affordance (05 §III): the marketplace renders an embedded
|
|
@@ -6625,9 +6735,11 @@ var SERVICES = {
|
|
|
6625
6735
|
standard: "ERC721",
|
|
6626
6736
|
provenance: "MEDIALANE",
|
|
6627
6737
|
onchain: {
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6738
|
+
STARKNET: {
|
|
6739
|
+
factoryAddress: MARKETPLACE_721_CONTRACT_MAINNET,
|
|
6740
|
+
classHash: MARKETPLACE_721_CLASS_HASH_MAINNET,
|
|
6741
|
+
startBlock: MARKETPLACE_721_START_BLOCK_MAINNET
|
|
6742
|
+
}
|
|
6631
6743
|
},
|
|
6632
6744
|
uiVariant: "standard",
|
|
6633
6745
|
capabilities: ["list", "buy", "make_offer", "cancel"],
|
|
@@ -6644,9 +6756,11 @@ var SERVICES = {
|
|
|
6644
6756
|
standard: "ERC1155",
|
|
6645
6757
|
provenance: "MEDIALANE",
|
|
6646
6758
|
onchain: {
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6759
|
+
STARKNET: {
|
|
6760
|
+
factoryAddress: MARKETPLACE_1155_CONTRACT_MAINNET,
|
|
6761
|
+
classHash: MARKETPLACE_1155_CLASS_HASH_MAINNET,
|
|
6762
|
+
startBlock: MARKETPLACE_1155_START_BLOCK_MAINNET
|
|
6763
|
+
}
|
|
6650
6764
|
},
|
|
6651
6765
|
uiVariant: "edition",
|
|
6652
6766
|
capabilities: ["list", "buy", "make_offer", "cancel"],
|
|
@@ -6699,6 +6813,6 @@ function getServicesByCapability(cap) {
|
|
|
6699
6813
|
);
|
|
6700
6814
|
}
|
|
6701
6815
|
|
|
6702
|
-
export { ApiClient, MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, 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,
|
|
6816
|
+
export { ApiClient, CHAINS, MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, 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_CHAIN, DROP_COLLECTION_CLASS_HASH_MAINNET, DROP_FACTORY_CONTRACT_MAINNET, DropCollectionABI, DropFactoryABI, DropService, EKUBO_CORE_MAINNET, ERC1155CollectionService, FeeConfigSchema, IPCOLLECTION_CLASS_HASH_MAINNET, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPMarketplaceABI, IPNFT_CLASS_HASH_MAINNET, IPNftABI, LAUNCH_PRICE_QUOTE_PER_COIN, 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_TOKENS, VALIDATED_EKUBO_PARAMS, build1155CancellationTypedData, build1155OrderTypedData, buildCancellationTypedData, buildCreateCreatorCoinCall, buildFeeCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buybackQuoteRaw, toRaw as coinToRaw, createFailoverFetch, encodeByteArray, fdvHuman, formatAmount, getCoordinates, getCreatorCoinPrice, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, isServiceId, isTransientRpcError, listServices, normalizeAddress, normalizeHash, parseAmount, parseCreatorCoinCreated, resolveConfig, resolveFeeConfig, shortenAddress, stringifyBigInts, teamCoinsRaw, u256ToBigInt, validateName as validateCoinName, validateSupply as validateCoinSupply, validateSymbol as validateCoinSymbol };
|
|
6703
6817
|
//# sourceMappingURL=index.js.map
|
|
6704
6818
|
//# sourceMappingURL=index.js.map
|